EVP_Cipher: fix the incomplete return check
authorPeiwei Hu <jlu.hpw@foxmail.com>
Sun, 14 Nov 2021 08:39:42 +0000 (16:39 +0800)
committerTomas Mraz <tomas@openssl.org>
Tue, 16 Nov 2021 16:28:23 +0000 (17:28 +0100)
Signed-off-by: Peiwei Hu <jlu.hpw@foxmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17027)

crypto/cmac/cmac.c

index 18c7fea3ddeec5be22162353dafe2b6bddd7f031..218eb94259614c18cb98875b40a618e4f4e8f5a7 100644 (file)
@@ -227,7 +227,7 @@ int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen)
         for (i = 0; i < bl; i++)
             out[i] = ctx->last_block[i] ^ ctx->k2[i];
     }
-    if (!EVP_Cipher(ctx->cctx, out, out, bl)) {
+    if (EVP_Cipher(ctx->cctx, out, out, bl) <= 0) {
         OPENSSL_cleanse(out, bl);
         return 0;
     }