[][openwrt][common][Fix aes ccm mode encrypt bug]
[Description]
Fix aes ccm mode encrypt bug.
If the payload in NULL in aes encryption ccm mode, it must
use "" as parameter in `EVP_EncryptUpdate`
[Release-log]
Change-Id: I05c162e76d2390a6d7ae8ae2e36580a72810f034
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8288138
diff --git a/feed/openssl-fips-ext/src/aesccm.c b/feed/openssl-fips-ext/src/aesccm.c
index 2d8bf69..433f993 100644
--- a/feed/openssl-fips-ext/src/aesccm.c
+++ b/feed/openssl-fips-ext/src/aesccm.c
@@ -68,7 +68,10 @@
EVP_EncryptUpdate(ctx, outbuf, &outlen, data.payload, data.payload_size);
printf("Ciphertext: ");
print_hex(outbuf, outlen);
+ } else {
+ EVP_EncryptUpdate(ctx, outbuf, &outlen, "", data.payload_size);
}
+
EVP_EncryptFinal_ex(ctx, outbuf, &outlen);
EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, data.tag_size, outbuf);
printf("Tags: ");