5.1.3 DES-ECB-LM Cipher Definition
des_ecb_lm_dec utilizes DES-ECB-LM in cipher-mode decryption.
des_ecb_lm_enc utilizes DES-ECB-LM in cipher-mode encryption.
DES-ECB-LM is defined as follows.
-
des_ecb_lm( input:byte[8], encryptionKey: byte[8], output:byte[8]) InputKey:byte[7] OutputKey:byte[8] Let InputKey be the first 7 bytes of encryptionKey [0-6] OutputKey[0] = InputKey[0] >> 0x01; OutputKey[1] = ((InputKey[0]&0x01)<<6) | (InputKey[1]>>2); OutputKey[2] = ((InputKey[1]&0x03)<<5) | (InputKey[2]>>3); OutputKey[3] = ((InputKey[2]&0x07)<<4) | (InputKey[3]>>4); OutputKey[4] = ((InputKey[3]&0x0F)<<3) | (InputKey[4]>>5); OutputKey[5] = ((InputKey[4]&0x1F)<<2) | (InputKey[5]>>6); OutputKey[6] = ((InputKey[5]&0x3F)<<1) | (InputKey[6]>>7); OutputKey[7] = InputKey[6] & 0x7F; ((unsigned long*)OutputKey)[0] <<= 1; ((unsigned long*)OutputKey)[1] <<= 1; ((unsigned long*)OutputKey)[0] &= 0xfefefefe; ((unsigned long*)OutputKey)[1] &= 0xfefefefe; Let the left-most bit of OutputKey be the parity bit. That is, if the sum of the other 7 bits is odd, the parity bit is zero; otherwise the parity bit is one. The processing starts at the left-most bit of OutputKey. des_ecb( input, OutputKey, output ) END
The algorithm des_ecb is the Data Encryption Standard (DES) encryption in Electronic Code Book (ECB) mode, as specified in [FIPS81].