Commit 245d260
committed
wolfcrypt/src/pkcs7.c: Fix PKCS#7 verification for digestAlgorithm.parameters = NULL
RFC 8017 hardcodes DER serialization samples of DigestInfo, where the
parameter part is always NULL (05 00) for known hash algorithm [1]. This
value does thus *not* depend on SignerInfo.digestAlgorithm.parameters.
Starting with 75c3030 ("Add option for absent hash params in PKCS7"),
wolfSSL wrongly assumed and implemented such a dependency.
This non-conformance caused an interoperability bug with OpenSSL: A
signature created with openssl cms could not be verified in WolfSSL.
OpenSSL correctly leaves SignerInfo.digestAlgorithm.parameters absent
and adds explicit NULL to DigestInfo. WolfSSL saw the absence and
wrongly inferred DigestInfo would also have no explicit NULL - but it
has - leading to size mismatch.
Fix it by constructing the expected DigestInfo always with NULL (05 00).
4f21117 ("tests: Add PKCS#7 verification interoperability test") and
8d8170e (".github: Test PKCS7 interoperability for OpenSSL and
GnuTLS") can be used to reproduce the bug and to demonstrate this commit
fixes it.
[1] https://www.rfc-editor.org/rfc/rfc8017#section-9.21 parent 34c2c72 commit 245d260
1 file changed
+1
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4779 | 4779 | | |
4780 | 4780 | | |
4781 | 4781 | | |
4782 | | - | |
4783 | | - | |
4784 | | - | |
| 4782 | + | |
4785 | 4783 | | |
4786 | 4784 | | |
4787 | 4785 | | |
| |||
0 commit comments