Use HMAC_Init_ex, not HMAC_Init, in HMAC.
We've already initialized the context, HMAC_Init has questionable behavior around NULL keys, and this avoids a size_t truncation. Change-Id: Iab6bfc24fe22d46ca4c01be6129efe0630d553e6 Reviewed-on: https://boringssl-review.googlesource.com/3732 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
0d5e080ab9
commit
cc239d3903
@ -76,7 +76,7 @@ uint8_t *HMAC(const EVP_MD *evp_md, const void *key, size_t key_len,
|
||||
}
|
||||
|
||||
HMAC_CTX_init(&ctx);
|
||||
if (!HMAC_Init(&ctx, key, key_len, evp_md) ||
|
||||
if (!HMAC_Init_ex(&ctx, key, key_len, evp_md, NULL) ||
|
||||
!HMAC_Update(&ctx, data, data_len) ||
|
||||
!HMAC_Final(&ctx, out, out_len)) {
|
||||
out = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user