summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/hmac
diff options
context:
space:
mode:
authormarkus <>2003-05-11 21:36:58 +0000
committermarkus <>2003-05-11 21:36:58 +0000
commit1c98a87f0daac81245653c227eb2f2508a22a965 (patch)
tree3de6d603296ec563b936da4e6a8a1e33d48f8884 /src/lib/libcrypto/hmac
parent31392c89d1135cf2a416f97295f6d21681b3fbc4 (diff)
downloadopenbsd-1c98a87f0daac81245653c227eb2f2508a22a965.tar.gz
openbsd-1c98a87f0daac81245653c227eb2f2508a22a965.tar.bz2
openbsd-1c98a87f0daac81245653c227eb2f2508a22a965.zip
import 0.9.7b (without idea and rc5)
Diffstat (limited to 'src/lib/libcrypto/hmac')
-rw-r--r--src/lib/libcrypto/hmac/hmac.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c
index da363b7950..4c91f919d5 100644
--- a/src/lib/libcrypto/hmac/hmac.c
+++ b/src/lib/libcrypto/hmac/hmac.c
@@ -59,6 +59,7 @@
59#include <stdlib.h> 59#include <stdlib.h>
60#include <string.h> 60#include <string.h>
61#include <openssl/hmac.h> 61#include <openssl/hmac.h>
62#include "cryptlib.h"
62 63
63void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, 64void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
64 const EVP_MD *md, ENGINE *impl) 65 const EVP_MD *md, ENGINE *impl)
@@ -78,6 +79,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
78 { 79 {
79 reset=1; 80 reset=1;
80 j=EVP_MD_block_size(md); 81 j=EVP_MD_block_size(md);
82 OPENSSL_assert(j <= sizeof ctx->key);
81 if (j < len) 83 if (j < len)
82 { 84 {
83 EVP_DigestInit_ex(&ctx->md_ctx,md, impl); 85 EVP_DigestInit_ex(&ctx->md_ctx,md, impl);
@@ -87,6 +89,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
87 } 89 }
88 else 90 else
89 { 91 {
92 OPENSSL_assert(len <= sizeof ctx->key);
90 memcpy(ctx->key,key,len); 93 memcpy(ctx->key,key,len);
91 ctx->key_length=len; 94 ctx->key_length=len;
92 } 95 }