Move the AH algorithm list from a static local function variable to
a static const global variable in ah_core.c. This makes it more clear that this array does not require synchronization, as well as synchronizing the layout to the ESP algorithm list. This is the version of my patch that Itojun committed to the KAME tree. Obtained from: me, via KAME
This commit is contained in:
parent
dbdc402421
commit
cd800560cf
@ -153,47 +153,48 @@ static void ah_hmac_ripemd160_result __P((struct ah_algorithm_state *,
|
||||
static void ah_update_mbuf __P((struct mbuf *, int, int,
|
||||
const struct ah_algorithm *, struct ah_algorithm_state *));
|
||||
|
||||
/* checksum algorithms */
|
||||
static const struct ah_algorithm ah_algorithms[] = {
|
||||
{ ah_sumsiz_1216, ah_common_mature, 128, 128, "hmac-md5",
|
||||
ah_hmac_md5_init, ah_hmac_md5_loop,
|
||||
ah_hmac_md5_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 160, 160, "hmac-sha1",
|
||||
ah_hmac_sha1_init, ah_hmac_sha1_loop,
|
||||
ah_hmac_sha1_result, },
|
||||
{ ah_sumsiz_1216, ah_keyed_md5_mature, 128, 128, "keyed-md5",
|
||||
ah_keyed_md5_init, ah_keyed_md5_loop,
|
||||
ah_keyed_md5_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 160, 160, "keyed-sha1",
|
||||
ah_keyed_sha1_init, ah_keyed_sha1_loop,
|
||||
ah_keyed_sha1_result, },
|
||||
{ ah_sumsiz_zero, ah_none_mature, 0, 2048, "none",
|
||||
ah_none_init, ah_none_loop, ah_none_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 256, 256,
|
||||
"hmac-sha2-256",
|
||||
ah_hmac_sha2_256_init, ah_hmac_sha2_256_loop,
|
||||
ah_hmac_sha2_256_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 384, 384,
|
||||
"hmac-sha2-384",
|
||||
ah_hmac_sha2_384_init, ah_hmac_sha2_384_loop,
|
||||
ah_hmac_sha2_384_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 512, 512,
|
||||
"hmac-sha2-512",
|
||||
ah_hmac_sha2_512_init, ah_hmac_sha2_512_loop,
|
||||
ah_hmac_sha2_512_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 160, 160,
|
||||
"hmac-ripemd160",
|
||||
ah_hmac_ripemd160_init, ah_hmac_ripemd160_loop,
|
||||
ah_hmac_ripemd160_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 128, 128,
|
||||
"aes-xcbc-mac",
|
||||
ah_aes_xcbc_mac_init, ah_aes_xcbc_mac_loop,
|
||||
ah_aes_xcbc_mac_result, },
|
||||
};
|
||||
|
||||
const struct ah_algorithm *
|
||||
ah_algorithm_lookup(idx)
|
||||
int idx;
|
||||
{
|
||||
/* checksum algorithms */
|
||||
static struct ah_algorithm ah_algorithms[] = {
|
||||
{ ah_sumsiz_1216, ah_common_mature, 128, 128, "hmac-md5",
|
||||
ah_hmac_md5_init, ah_hmac_md5_loop,
|
||||
ah_hmac_md5_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 160, 160, "hmac-sha1",
|
||||
ah_hmac_sha1_init, ah_hmac_sha1_loop,
|
||||
ah_hmac_sha1_result, },
|
||||
{ ah_sumsiz_1216, ah_keyed_md5_mature, 128, 128, "keyed-md5",
|
||||
ah_keyed_md5_init, ah_keyed_md5_loop,
|
||||
ah_keyed_md5_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 160, 160, "keyed-sha1",
|
||||
ah_keyed_sha1_init, ah_keyed_sha1_loop,
|
||||
ah_keyed_sha1_result, },
|
||||
{ ah_sumsiz_zero, ah_none_mature, 0, 2048, "none",
|
||||
ah_none_init, ah_none_loop, ah_none_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 256, 256,
|
||||
"hmac-sha2-256",
|
||||
ah_hmac_sha2_256_init, ah_hmac_sha2_256_loop,
|
||||
ah_hmac_sha2_256_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 384, 384,
|
||||
"hmac-sha2-384",
|
||||
ah_hmac_sha2_384_init, ah_hmac_sha2_384_loop,
|
||||
ah_hmac_sha2_384_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 512, 512,
|
||||
"hmac-sha2-512",
|
||||
ah_hmac_sha2_512_init, ah_hmac_sha2_512_loop,
|
||||
ah_hmac_sha2_512_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 160, 160,
|
||||
"hmac-ripemd160",
|
||||
ah_hmac_ripemd160_init, ah_hmac_ripemd160_loop,
|
||||
ah_hmac_ripemd160_result, },
|
||||
{ ah_sumsiz_1216, ah_common_mature, 128, 128,
|
||||
"aes-xcbc-mac",
|
||||
ah_aes_xcbc_mac_init, ah_aes_xcbc_mac_loop,
|
||||
ah_aes_xcbc_mac_result, },
|
||||
};
|
||||
|
||||
switch (idx) {
|
||||
case SADB_AALG_MD5HMAC:
|
||||
|
Loading…
Reference in New Issue
Block a user