summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/hmac/hmac.c
diff options
context:
space:
mode:
authorbeck <>2017-01-29 17:49:23 +0000
committerbeck <>2017-01-29 17:49:23 +0000
commit957b11334a7afb14537322f0e4795b2e368b3f59 (patch)
tree1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/hmac/hmac.c
parentdf96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff)
downloadopenbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing libssl had more reacharounds into this. ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/hmac/hmac.c')
-rw-r--r--src/lib/libcrypto/hmac/hmac.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c
index 155e32a540..8fd980b052 100644
--- a/src/lib/libcrypto/hmac/hmac.c
+++ b/src/lib/libcrypto/hmac/hmac.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hmac.c,v 1.22 2015/02/10 09:52:35 miod Exp $ */ 1/* $OpenBSD: hmac.c,v 1.23 2017/01/29 17:49:23 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -80,7 +80,7 @@ HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md,
80 reset = 1; 80 reset = 1;
81 j = EVP_MD_block_size(md); 81 j = EVP_MD_block_size(md);
82 if ((size_t)j > sizeof(ctx->key)) { 82 if ((size_t)j > sizeof(ctx->key)) {
83 EVPerr(EVP_F_HMAC_INIT_EX, EVP_R_BAD_BLOCK_LENGTH); 83 EVPerror(EVP_R_BAD_BLOCK_LENGTH);
84 goto err; 84 goto err;
85 } 85 }
86 if (j < len) { 86 if (j < len) {
@@ -93,8 +93,7 @@ HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md,
93 goto err; 93 goto err;
94 } else { 94 } else {
95 if ((size_t)len > sizeof(ctx->key)) { 95 if ((size_t)len > sizeof(ctx->key)) {
96 EVPerr(EVP_F_HMAC_INIT_EX, 96 EVPerror(EVP_R_BAD_KEY_LENGTH);
97 EVP_R_BAD_KEY_LENGTH);
98 goto err; 97 goto err;
99 } 98 }
100 memcpy(ctx->key, key, len); 99 memcpy(ctx->key, key, len);