git: c09c379c7aa7 - main - aesni: Permit AES-CCM requests with neither payload nor AAD.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 06 Oct 2021 21:10:34 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=c09c379c7aa7337680ff3cb73691ce12d627128b

commit c09c379c7aa7337680ff3cb73691ce12d627128b
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-10-06 21:08:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-10-06 21:08:47 +0000

    aesni: Permit AES-CCM requests with neither payload nor AAD.
    
    Reviewed by:    sef
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D32114
---
 sys/crypto/aesni/aesni_ccm.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sys/crypto/aesni/aesni_ccm.c b/sys/crypto/aesni/aesni_ccm.c
index 9e2fa317b2ed..34b61a633907 100644
--- a/sys/crypto/aesni/aesni_ccm.c
+++ b/sys/crypto/aesni/aesni_ccm.c
@@ -205,9 +205,6 @@ AES_CCM_encrypt(const unsigned char *in, unsigned char *out,
 	uint8_t *byte_ptr;
 	__m128i s0, rolling_mac, s_x, staging_block;
 
-	if (nbytes == 0 && abytes == 0)
-		return;
-
 	/* NIST 800-38c section A.1 says n is [7, 13]. */
 	if (nlen < 7 || nlen > 13)
 		panic("%s: bad nonce length %d", __FUNCTION__, nlen);
@@ -377,8 +374,6 @@ AES_CCM_decrypt(const unsigned char *in, unsigned char *out,
 	__m128i s0, rolling_mac, staging_block;
 	uint8_t *byte_ptr;
 
-	if (nbytes == 0 && abytes == 0)
-		return (1);	// No message means no decryption!
 	if (nlen < 0 || nlen > 15)
 		panic("%s: bad nonce length %d", __FUNCTION__, nlen);