summaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/macs/cmac_prov.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/providers/implementations/macs/cmac_prov.c b/providers/implementations/macs/cmac_prov.c
index fc9f911beb..ba89616398 100644
--- a/providers/implementations/macs/cmac_prov.c
+++ b/providers/implementations/macs/cmac_prov.c
@@ -101,8 +101,12 @@ static void *cmac_dup(void *vsrc)
static size_t cmac_size(void *vmacctx)
{
struct cmac_data_st *macctx = vmacctx;
+ const EVP_CIPHER_CTX *cipherctx = CMAC_CTX_get0_cipher_ctx(macctx->ctx);
- return EVP_CIPHER_CTX_get_block_size(CMAC_CTX_get0_cipher_ctx(macctx->ctx));
+ if (EVP_CIPHER_CTX_get0_cipher(cipherctx) == NULL)
+ return 0;
+
+ return EVP_CIPHER_CTX_get_block_size(cipherctx);
}
static int cmac_setkey(struct cmac_data_st *macctx,