diff options
author | pjd <pjd@FreeBSD.org> | 2006-06-04 14:49:34 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2006-06-04 14:49:34 +0000 |
commit | 1dc756f40595d438e645a833fe6a7764d02535a5 (patch) | |
tree | fad62f2deaa75991a4189d14cac086bacb165c21 | |
parent | 2e98c25f190be3790c618acb8ef0ed50d2fdf086 (diff) | |
download | FreeBSD-src-1dc756f40595d438e645a833fe6a7764d02535a5.zip FreeBSD-src-1dc756f40595d438e645a833fe6a7764d02535a5.tar.gz |
- Remove HMAC_BLOCK_LEN, it serves no purpose.
- Use defines of used algorithm instead of HMAC_BLOCK_LEN.
-rw-r--r-- | sys/dev/safe/safe.c | 10 | ||||
-rw-r--r-- | sys/dev/ubsec/ubsec.c | 10 | ||||
-rw-r--r-- | sys/opencrypto/cryptodev.h | 1 |
3 files changed, 12 insertions, 9 deletions
diff --git a/sys/dev/safe/safe.c b/sys/dev/safe/safe.c index 080955d..2c887fc 100644 --- a/sys/dev/safe/safe.c +++ b/sys/dev/safe/safe.c @@ -667,12 +667,13 @@ safe_setup_mackey(struct safe_session *ses, int algo, caddr_t key, int klen) if (algo == CRYPTO_MD5_HMAC) { MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); - MD5Update(&md5ctx, hmac_ipad_buffer, HMAC_BLOCK_LEN - klen); + MD5Update(&md5ctx, hmac_ipad_buffer, MD5_HMAC_BLOCK_LEN - klen); bcopy(md5ctx.state, ses->ses_hminner, sizeof(md5ctx.state)); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); - SHA1Update(&sha1ctx, hmac_ipad_buffer, HMAC_BLOCK_LEN - klen); + SHA1Update(&sha1ctx, hmac_ipad_buffer, + SHA1_HMAC_BLOCK_LEN - klen); bcopy(sha1ctx.h.b32, ses->ses_hminner, sizeof(sha1ctx.h.b32)); } @@ -682,12 +683,13 @@ safe_setup_mackey(struct safe_session *ses, int algo, caddr_t key, int klen) if (algo == CRYPTO_MD5_HMAC) { MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); - MD5Update(&md5ctx, hmac_opad_buffer, HMAC_BLOCK_LEN - klen); + MD5Update(&md5ctx, hmac_opad_buffer, MD5_HMAC_BLOCK_LEN - klen); bcopy(md5ctx.state, ses->ses_hmouter, sizeof(md5ctx.state)); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); - SHA1Update(&sha1ctx, hmac_opad_buffer, HMAC_BLOCK_LEN - klen); + SHA1Update(&sha1ctx, hmac_opad_buffer, + SHA1_HMAC_BLOCK_LEN - klen); bcopy(sha1ctx.h.b32, ses->ses_hmouter, sizeof(sha1ctx.h.b32)); } diff --git a/sys/dev/ubsec/ubsec.c b/sys/dev/ubsec/ubsec.c index 343e773..d2e89d2 100644 --- a/sys/dev/ubsec/ubsec.c +++ b/sys/dev/ubsec/ubsec.c @@ -864,12 +864,13 @@ ubsec_setup_mackey(struct ubsec_session *ses, int algo, caddr_t key, int klen) if (algo == CRYPTO_MD5_HMAC) { MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); - MD5Update(&md5ctx, hmac_ipad_buffer, HMAC_BLOCK_LEN - klen); + MD5Update(&md5ctx, hmac_ipad_buffer, MD5_HMAC_BLOCK_LEN - klen); bcopy(md5ctx.state, ses->ses_hminner, sizeof(md5ctx.state)); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); - SHA1Update(&sha1ctx, hmac_ipad_buffer, HMAC_BLOCK_LEN - klen); + SHA1Update(&sha1ctx, hmac_ipad_buffer, + SHA1_HMAC_BLOCK_LEN - klen); bcopy(sha1ctx.h.b32, ses->ses_hminner, sizeof(sha1ctx.h.b32)); } @@ -879,12 +880,13 @@ ubsec_setup_mackey(struct ubsec_session *ses, int algo, caddr_t key, int klen) if (algo == CRYPTO_MD5_HMAC) { MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); - MD5Update(&md5ctx, hmac_opad_buffer, HMAC_BLOCK_LEN - klen); + MD5Update(&md5ctx, hmac_opad_buffer, MD5_HMAC_BLOCK_LEN - klen); bcopy(md5ctx.state, ses->ses_hmouter, sizeof(md5ctx.state)); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); - SHA1Update(&sha1ctx, hmac_opad_buffer, HMAC_BLOCK_LEN - klen); + SHA1Update(&sha1ctx, hmac_opad_buffer, + SHA1_HMAC_BLOCK_LEN - klen); bcopy(sha1ctx.h.b32, ses->ses_hmouter, sizeof(sha1ctx.h.b32)); } diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index df74fa5..fdd86e9 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -82,7 +82,6 @@ #define SHA2_256_HMAC_BLOCK_LEN 64 #define SHA2_384_HMAC_BLOCK_LEN 128 #define SHA2_512_HMAC_BLOCK_LEN 128 -#define HMAC_BLOCK_LEN 64 /* Maximum HMAC block length */ #define HMAC_MAX_BLOCK_LEN SHA2_512_HMAC_BLOCK_LEN /* Keep this updated */ #define HMAC_IPAD_VAL 0x36 |