Add implementation of the RC2 block cipher (RFC 2268)
This commit is contained in:
@@ -46,12 +46,13 @@ ENUM_NEXT(encryption_algorithm_names, ENCR_CAMELLIA_CBC, ENCR_CAMELLIA_CCM_ICV16
|
||||
"CAMELLIA_CCM_8",
|
||||
"CAMELLIA_CCM_12",
|
||||
"CAMELLIA_CCM_16");
|
||||
ENUM_NEXT(encryption_algorithm_names, ENCR_UNDEFINED, ENCR_TWOFISH_CBC, ENCR_CAMELLIA_CCM_ICV16,
|
||||
ENUM_NEXT(encryption_algorithm_names, ENCR_UNDEFINED, ENCR_RC2_CBC, ENCR_CAMELLIA_CCM_ICV16,
|
||||
"UNDEFINED",
|
||||
"DES_ECB",
|
||||
"SERPENT_CBC",
|
||||
"TWOFISH_CBC");
|
||||
ENUM_END(encryption_algorithm_names, ENCR_TWOFISH_CBC);
|
||||
"TWOFISH_CBC",
|
||||
"RC2_CBC");
|
||||
ENUM_END(encryption_algorithm_names, ENCR_RC2_CBC);
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
|
||||
@@ -60,7 +60,9 @@ enum encryption_algorithm_t {
|
||||
ENCR_UNDEFINED = 1024,
|
||||
ENCR_DES_ECB = 1025,
|
||||
ENCR_SERPENT_CBC = 1026,
|
||||
ENCR_TWOFISH_CBC = 1027
|
||||
ENCR_TWOFISH_CBC = 1027,
|
||||
/* see macros below to handle RC2 (effective) key length */
|
||||
ENCR_RC2_CBC = 1028,
|
||||
};
|
||||
|
||||
#define DES_BLOCK_SIZE 8
|
||||
@@ -70,6 +72,15 @@ enum encryption_algorithm_t {
|
||||
#define SERPENT_BLOCK_SIZE 16
|
||||
#define TWOFISH_BLOCK_SIZE 16
|
||||
|
||||
/**
|
||||
* For RC2, if the effective key size in bits is not key_size * 8, it should
|
||||
* be encoded with the macro below. It can be decoded with the other two macros.
|
||||
* After decoding the value should be validated.
|
||||
*/
|
||||
#define RC2_KEY_SIZE(kl, eff) ((kl) | ((eff) << 8))
|
||||
#define RC2_EFFECTIVE_KEY_LEN(ks) ((ks) >> 8)
|
||||
#define RC2_KEY_LEN(ks) ((ks) & 0xff)
|
||||
|
||||
/**
|
||||
* enum name for encryption_algorithm_t.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user