diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index 3664ceccff0d..8f8317b03cd1 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -71,7 +71,6 @@ #define SHA2_512_HASH_LEN 64 #define MD5_KPDK_HASH_LEN 16 #define SHA1_KPDK_HASH_LEN 20 - /* Maximum hash algorithm result length */ #define HASH_MAX_LEN SHA2_512_HASH_LEN /* Keep this updated */ @@ -84,7 +83,8 @@ #define SHA2_384_HMAC_BLOCK_LEN 128 #define SHA2_512_HMAC_BLOCK_LEN 128 #define HMAC_BLOCK_LEN 64 -#define HMAC_BLOCK_MAXLEN 128 +/* Maximum HMAC block length */ +#define HMAC_MAX_BLOCK_LEN SHA2_512_HMAC_BLOCK_LEN /* Keep this updated */ #define HMAC_IPAD_VAL 0x36 #define HMAC_OPAD_VAL 0x5C diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 4d1eca042e02..2dfcf76dbc8b 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1030,11 +1030,11 @@ swcr_init(void) { u_int i; - hmac_ipad_buffer = malloc(HMAC_BLOCK_MAXLEN, M_CRYPTO_DATA, M_WAITOK); - for (i = 0; i < HMAC_BLOCK_MAXLEN; i++) + hmac_ipad_buffer = malloc(HMAC_MAX_BLOCK_LEN, M_CRYPTO_DATA, M_WAITOK); + for (i = 0; i < HMAC_MAX_BLOCK_LEN; i++) hmac_ipad_buffer[i] = HMAC_IPAD_VAL; - hmac_opad_buffer = malloc(HMAC_BLOCK_MAXLEN, M_CRYPTO_DATA, M_WAITOK); - for (i = 0; i < HMAC_BLOCK_MAXLEN; i++) + hmac_opad_buffer = malloc(HMAC_MAX_BLOCK_LEN, M_CRYPTO_DATA, M_WAITOK); + for (i = 0; i < HMAC_MAX_BLOCK_LEN; i++) hmac_opad_buffer[i] = HMAC_OPAD_VAL; swcr_id = crypto_get_driverid(CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC);