Skip to content

Fix alert type for missing cert. Prevent building with RNG disabled and blinding enabled by default. Enforce bounds for AES CMAC size in verify.#10462

Open
kareem-wolfssl wants to merge 4 commits into
wolfSSL:masterfrom
kareem-wolfssl:zd21507
Open

Conversation

@kareem-wolfssl
Copy link
Copy Markdown
Contributor

Description

Fixes zd#21507, F-2624, F-3084.

Testing

Built in tests

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@kareem-wolfssl kareem-wolfssl self-assigned this May 12, 2026
Copilot AI review requested due to automatic review settings May 12, 2026 00:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR hardens cryptographic configuration and CMAC verification behavior, and corrects a TLS 1.3 alert for missing client certificates.

Changes:

  • Prevent builds that combine WC_NO_RNG with blinding options (unless explicitly acknowledged).
  • Enforce AES-CMAC tag length bounds in verify APIs and return MAC_CMP_FAILED_E on mismatch.
  • Send TLS 1.3 certificate_required alert when the client can’t provide a required certificate; update docs/tests accordingly.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
wolfssl/wolfcrypt/settings.h Avoid enabling Curve25519 blinding when RNG is disabled; add build-time error for blinding+no-RNG configurations.
wolfcrypt/src/cmac.c Enforce CMAC tag-size bounds; prevent callback-driven size tampering; return consistent mismatch error.
tests/api/test_cmac.c Add coverage for CMAC verify bounds, truncation behavior, and mismatch return code.
src/tls13.c Fix TLS 1.3 alert to certificate_required for missing client certificate.
doc/formats/html/doxygen_warnings Adds a doxygen warnings output file.
doc/dox_comments/header_files/cmac.h Update doxygen docs for new CMAC verify behavior and examples.
.wolfssl_known_macro_extras Add an acknowledgment macro to the known-macros list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4226 to +4237
/* WC_NO_RNG silently removes RSA blinding, as blinding depends on the RNG.
* Refuse to build until the conflict is resolved or the loss of hardening is
* explicitly acknowledged via WC_RSA_NO_RNG_ACKNOWLEDGE_WEAKNESS. */
#if defined(WC_NO_RNG) && ((defined(WC_RSA_BLINDING) && !defined(NO_RSA)) || \
(defined(HAVE_CURVE25519) && defined(WOLFSSL_CURVE25519_BLINDING)) || \
(defined(HAVE_ECC) && defined(WOLFSSL_ECC_BLIND_K))) && \
!defined(WC_BLINDING_NO_RNG_ACKNOWLEDGE_WEAKNESS)
#error "Blinding is enabled but the RNG is disabled. Either remove \
WC_NO_RNG to enable the RNG, disable blinding by removing WC_RSA_BLINDING/\
WOLFSSL_CURVE25519_BLINDING/WOLFSSL_ECC_BLIND_K, or acknowledge the loss of \
blinding by defining WC_BLINDING_NO_RNG_ACKNOWLEDGE_WEAKNESS."
#endif
WC_RSA_NONBLOCK
WC_RSA_NONBLOCK_TIME
WC_RSA_NO_FERMAT_CHECK
WC_RSA_NO_RNG_ACKNOWLEDGE_WEAKNESS
Comment on lines +1 to +30
warning: source '../../mainpage.dox' is not a readable file or directory... skipping.
/home/work/wkdir/wolfssl/doc/dox_comments/header_files/ascon.h:572: warning: no matching file member found for
wc_AsconAEAD128 * wc_AsconAEAD128_New(void)
Possible candidates:
'wc_AsconAEAD128 * wc_AsconAEAD128_New(void)' at line 110 of file /home/work/wkdir/wolfssl/doc/dox_comments/header_files/ascon.h
/home/work/wkdir/wolfssl/doc/dox_comments/header_files/ssl.h:5565: warning: no matching file member found for
long wolfSSL_CTX_set_tlsext_status_arg(WOLFSSL_CTX *ctx, void *arg)
Possible candidates:
'long wolfSSL_CTX_set_tlsext_status_arg(WOLFSSL_CTX *ctx, void *arg)' at line 5462 of file /home/work/wkdir/wolfssl/doc/dox_comments/header_files/ssl.h
/home/work/wkdir/wolfssl/doc/dox_comments/header_files/wolfio.h:1376: warning: no matching file member found for
void * wolfSSL_GetCookieCtx(WOLFSSL *ssl)
Possible candidates:
'void * wolfSSL_GetCookieCtx(WOLFSSL *ssl)' at line 539 of file /home/work/wkdir/wolfssl/doc/dox_comments/header_files/wolfio.h
/home/work/wkdir/wolfssl/doc/dox_comments/header_files/ascon.h:65: warning: The following parameters of wc_AsconHash256_Final(wc_AsconHash256 *a, byte *hash) are not documented:
parameter 'a'
parameter 'hash'
/home/work/wkdir/wolfssl/doc/dox_comments/header_files/ascon.h:34: warning: The following parameters of wc_AsconHash256_Update(wc_AsconHash256 *a, const byte *data, word32 dataSz) are not documented:
parameter 'a'
parameter 'data'
parameter 'dataSz'
/home/work/wkdir/wolfssl/doc/dox_comments/header_files/cryptocb.h:8: warning: The following parameter of wc_CryptoCb_RegisterDevice(int devId, CryptoDevCallbackFunc cb, void *ctx) is not documented:
parameter 'ctx'
/home/work/wkdir/wolfssl/doc/dox_comments/header_files/quic.h:555: warning: The following parameter of wolfSSL_quic_aead_decrypt(uint8_t *dest, WOLFSSL_EVP_CIPHER_CTX *ctx, const uint8_t *enc, size_t enclen, const uint8_t *iv, const uint8_t *aad, size_t aadlen) is not documented:
parameter 'enclen'
/home/work/wkdir/wolfssl/doc/dox_comments/header_files/quic.h:428: warning: The following parameter of wolfSSL_quic_aead_is_ccm(const WOLFSSL_EVP_CIPHER *aead_cipher) is not documented:
parameter 'aead_cipher'
/home/work/wkdir/wolfssl/doc/dox_comments/header_files/quic.h:449: warning: The following parameter of wolfSSL_quic_aead_is_chacha20(const WOLFSSL_EVP_CIPHER *aead_cipher) is not documented:
parameter 'aead_cipher'
/home/work/wkdir/wolfssl/doc/dox_comments/header_files/quic.h:407: warning: The following parameter of wolfSSL_quic_aead_is_gcm(const WOLFSSL_EVP_CIPHER *aead_cipher) is not documented:
parameter 'aead_cipher'
Comment thread tests/api/test_cmac.c
byte truncMac[WC_AES_BLOCK_SIZE];
word32 truncSz;
word32 lengths[] = { WC_CMAC_TAG_MIN_SZ, 8, WC_AES_BLOCK_SIZE - 1 };
word32 li;
_Example_
\code
byte mac[AES_BLOCK_SIZE];
Cmac cmac;
byte key[16], msg[64];
int ret = wc_AesCmacVerify_ex(NULL, mac, sizeof(mac), msg,
int ret = wc_AesCmacVerify_ex(&cmac, mac, sizeof(mac), msg,
@github-actions
Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants