Skip to content

Pkcs7 enforce gcm/ccm tag length - #11490

Open
kaleb-himes wants to merge 3 commits into
wolfSSL:masterfrom
kaleb-himes:PKCS7-ENFORCE-GCM-TAG-LENGTH
Open

kaleb-himes wants to merge 3 commits into
wolfSSL:masterfrom
kaleb-himes:PKCS7-ENFORCE-GCM-TAG-LENGTH

Conversation

@kaleb-himes

Copy link
Copy Markdown
Contributor

Description

PKCS7 AuthEnvelopedData decoding now enforces the ICV sizes RFC 5084 actually permits: 12 to 16 bytes for AES-GCM (section 3.2), and even sizes of 8 bytes or more for AES-CCM (section 3.1 plus the SP 800-38C Appendix B.2 floor), so a bundle cannot dictate a shorter tag than the standard allows even in builds that relax WOLFSSL_MIN_AUTH_TAG_SZ. It also restores the cipher OID when the streaming decoder re-enters at the tag state, without which the size check was silently skipped on chunked input.

Followup of the fixes for zd#22449 (#11478)

Testing

How it was tested

  • Three new tests craft bundles with truncated tags and confirm rejection at 8 bytes (GCM) and 6 bytes (CCM), odd-size rejection for CCM, and acceptance at the RFC-legal 12 and 13 for GCM.
  • Every check was proven by negative control: with the floors zeroed, or with the stream-re-entry restore deleted, the corresponding test fails (the latter returning BAD_FUNC_ARG instead of ASN_PARSE_E), and passes once restored.
  • Verified across default streaming, NO_PKCS7_STREAM, and WOLFSSL_MIN_AUTH_TAG_SZ=4 (the kernel-module setting, where the pre-existing minimum can no longer mask the new floors) — 0 failed in each, testwolfcrypt clean.

Checklist

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

@kaleb-himes kaleb-himes self-assigned this Sep 17, 2026
@kaleb-himes kaleb-himes changed the title Pkcs7 enforce gcm tag length Pkcs7 enforce gcm/ccm tag length Sep 17, 2026
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