Skip to content

PKCS7: decode detached SignedData in d2i_PKCS7 - #11374

Open
kojo1 wants to merge 2 commits into
wolfSSL:masterfrom
kojo1:pkcs7-d2i
Open

PKCS7: decode detached SignedData in d2i_PKCS7#11374
kojo1 wants to merge 2 commits into
wolfSSL:masterfrom
kojo1:pkcs7-d2i

Conversation

@kojo1

@kojo1 kojo1 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Description

wolfSSL_d2i_PKCS7() verified the signature while decoding, so a
detached SignedData - one whose content is not in the bundle - could
never be decoded through the OpenSSL compatibility layer. OpenSSL's
d2i_PKCS7() only decodes; the content is handed to PKCS7_verify()
afterwards.

Add wc_PKCS7_DecodeSignedData(). It parses certificates, signerInfo
and content type like wc_PKCS7_VerifySignedData() and verifies an
attached bundle as before. A detached bundle without content is only
parsed: pkcs7->detached is set and the signature is left for a later
wc_PKCS7_VerifySignedData() call with the content. The existing state
machine is reused with a parseOnly argument; no structure change.

Fixes zd#22345

Testing

Added test cases:
test_wc_PKCS7_DecodeSignedData
test_wolfSSL_PKCS7_d2i_detached

Checklist

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

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

gcc-arm-cortex-m4

  • FLASH: .text +128 B (+0.1%, 204,893 B / 262,144 B, total: 78% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .rodata -80 B, .text +1,408 B (+0.2%, 782,236 B / 1,048,576 B, total: 75% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .text +192 B (+0.1%, 217,756 B / 262,144 B, total: 83% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .text +128 B (+0.0%, 331,936 B / 1,048,576 B, total: 32% used)

gcc-arm-cortex-m7

  • FLASH: .text +128 B (+0.1%, 204,893 B / 262,144 B, total: 78% used)

linuxkm-pie

  • Data: __patchable_function_entries +16 B (+0.1%, 27,000 B)

linuxkm-standard

@kojo1
kojo1 requested a review from wolfSSL-Bot September 5, 2026 05:07
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.

1 participant