mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-30 19:32:16 +01:00
Check keyLen matches cipher in wolfSSL_CMAC_Init.
Fixes ZD15607.
This commit is contained in:
@@ -28567,6 +28567,13 @@ int wolfSSL_CMAC_Init(WOLFSSL_CMAC_CTX* ctx, const void *key, size_t keyLen,
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
/* Check input keyLen matches input cipher. */
|
||||
if ((int) keyLen != wolfSSL_EVP_Cipher_key_length(cipher)) {
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ret = wc_InitCmac((Cmac*)ctx->internal, (const byte*)key,
|
||||
(word32)keyLen, WC_CMAC_AES, NULL);
|
||||
|
||||
Reference in New Issue
Block a user