Resolve failure caused by empty digest algorithm#10746
Open
bjwtaylor wants to merge 7 commits into
Open
Conversation
5 tasks
valeriosetti
requested changes
Jun 4, 2026
valeriosetti
left a comment
Contributor
There was a problem hiding this comment.
Based on the testing requirements in the associated issue I think that:
- [done] pkcs7_get_digest_algorithm_set accepts an empty set.
- [done] In pkcs7_get_signed_data, if the set is empty, don't try to call mbedtls_x509_oid_get_md_alg. In fact, this call is only done to check whether the digest algorithm is supported: it retrieves the internal designation for the digest algorithm, but doesn't store or use that value. So maybe the call should be skipped altogether? If you're only parsing, the use of an unsupported hash doesn't seem problematic to me.
- [done] Have at least one test case for mbedtls_pkcs7_parse_der() where the DigestAlgorithmSet is empty, check that parsing succeeds.
- [partially done - see point (1) below] Have at least one test case for mbedtls_pkcs7_parse_der() where the DigestAlgorithmSet holds an unsupported algorithm, check that parsing succeeds. (This can probably be an existing test case, just removing the depends_on: element for the hash algorithm.)
- [missing] Add tests of mbedtls_pkcs7_signed_data_verify() and mbedtls_pkcs7_signed_hash_verify() where the DigestAlgorithmSet is empty or where the digest algorithm is not supported. We want to make sure that they return a sensible error value.
(1) as far as I understand the idea is to check that parsing is OK even thought the digest algorithm is not supported. So the guard on that test should be !PSA_WANT_ALG_SHA_256, isn't it?
Apart from this I see that in the framework PR you created 2 files, but you're only using one here. I suspect something is missing.
| @@ -0,0 +1,3 @@ | |||
| Bugfix | |||
| * Fix PKCS7 parsing so that it is able to deal with and empty | |||
Contributor
There was a problem hiding this comment.
Suggested change
| * Fix PKCS7 parsing so that it is able to deal with and empty | |
| * Fix PKCS7 parsing so that it is able to deal with an empty |
added 7 commits
June 10, 2026 09:01
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
…kcs7_signed_hash_verify deals with a empty digest algorithm Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
3db48e6 to
11d508e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolve failure caused by empty digest algorithm depends #10480
This PR is part of a two part set which must be merged in the following order:
Parameterised build https://ci.trustedfirmware.org/view/Mbed-TLS/job/mbed-tls-restricted-pr-test-parametrized/145/pipeline-graph/
PR checklist