[FIPS - Cherry-pick] Support allowing specific unknown critical extensions (#2377) #2473
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.
This change is outside of the FIPS module and does not affect its hash.
Commit was cherry-picked from mainline PR #2377. Original description is below.
As of today, AWS-LC returns an error as part of verification if there are any critical extensions present in the certificate being validated. There have been asks to set a custom OID on the issued certificates to ensure that additional validation is performed by customers after or during the handshake. The intention is to prevent accidental mis-use of these certificates without that extra validation.
To support this, we've decided to add two new APIs for this use case.
X509_STORE_CTX_add_custom_crit_oid
adds an oid as anASN1_OBJECT
to the list of "known" critical extension OIDs inctx
. Typical OpenSSL/AWS-LC behavior returns an error if there are any unknown critical extensions present within the certificates being validated. This function lets users specify custom OIDs of any critical extensions that are within the certificates being validated, that they wish to allow. The callback mechanism enabled withX509_STORE_CTX_set_verify_crit_oids
must be set for this feature to enabled.X509_STORE_CTX_set_verify_crit_oids
enables theX509_STORE_CTX_verify_crit_oids_cb
withX509_STORE_CTX
. Consumers should be performing additional validation against the custom extension oids after or during the handshake. This callback forces users to validate their custom OIDs when processing unknown custom critical extensions. TheX509_STORE_CTX_verify_crit_oids_cb
callback function gives the user the current certificate being validated asx509
and a stack ofASN1_OBJECT
s representing unknown critical extension OIDs that were found inx509
and match those previously registered via|X509_STORE_CTX_add_custom_crit_oid
asoids
.This should not effect any existing consumers of
X509_verify_cert
. Any existence of an unknown critical extension will still cause the entire verification to be aborted. Only consumers that have enabled the callback and set specific OIDs withASN1_OBJECT
can circumvent the check and trigger the verification to pass.Testing:
Test certs were generated by the team asking for this feature.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.