git: aacfe3bb52b7 - stable/13 - aesni: Permit AES-CCM requests with neither payload nor AAD.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 21 Oct 2021 22:04:20 UTC
The branch stable/13 has been updated by jhb:

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

commit aacfe3bb52b7c489eab02d8bed49bd1b4da6f669
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-10-06 21:08:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-10-21 21:08:02 +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
    
    (cherry picked from commit c09c379c7aa7337680ff3cb73691ce12d627128b)
---
 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);