Skip to content

x509_vfy.c: Improve key usage checks in internal_verify() of cert chains#12375

Closed
DDvO wants to merge 2 commits intoopenssl:masterfrom
siemens:keyUsage_checks_on_self-issued
Closed

x509_vfy.c: Improve key usage checks in internal_verify() of cert chains#12375
DDvO wants to merge 2 commits intoopenssl:masterfrom
siemens:keyUsage_checks_on_self-issued

Conversation

@DDvO
Copy link
Contributor

@DDvO DDvO commented Jul 6, 2020

This is the 'forward-port' I'm proposing as by-product of the backport done in #12357.
See the discussion thread there starting with #12357 (review).

If a presumably self-signed cert is last in chain we verify its signature
only if X509_V_FLAG_CHECK_SS_SIGNATURE is set. Upon this request we do the
signature verification, but not in case it is a (non-conforming) self-issued
CA certificate with a key usage extension that does not include keyCertSign.

Make clear when we must verify the signature of a certificate
and when we must adhere to key usage restrictions of the 'issuing' cert.
Add some comments for making internal_verify() easier to understand.
Update the documentation of X509_V_FLAG_CHECK_SS_SIGNATURE accordingly.

Constify X509_check_akid() and prefer using X509_get0_serialNumber() over X509_get_serialNumber().

@DDvO DDvO force-pushed the keyUsage_checks_on_self-issued branch 2 times, most recently from e656233 to 47353bb Compare July 6, 2020 11:26
@DDvO DDvO force-pushed the keyUsage_checks_on_self-issued branch from 47353bb to c40ba05 Compare July 13, 2020 19:57
If a presumably self-signed cert is last in chain we verify its signature
only if X509_V_FLAG_CHECK_SS_SIGNATURE is set. Upon this request we do the
signature verification, but not in case it is a (non-conforming) self-issued
CA certificate with a key usage extension that does not include keyCertSign.

Make clear when we must verify the signature of a certificate
and when we must adhere to key usage restrictions of the 'issuing' cert.
Add some comments for making internal_verify() easier to understand.
Update the documentation of X509_V_FLAG_CHECK_SS_SIGNATURE accordingly.
@DDvO DDvO force-pushed the keyUsage_checks_on_self-issued branch from c40ba05 to 1ddd1d7 Compare July 14, 2020 14:41
Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@t8m t8m added approval: done This pull request has the required number of approvals branch: master Applies to master branch labels Jul 15, 2020
openssl-machine pushed a commit that referenced this pull request Jul 16, 2020
… X509_get_serialNumber

Reviewed-by: Tomas Mraz <[email protected]>
(Merged from #12375)
openssl-machine pushed a commit that referenced this pull request Jul 16, 2020
If a presumably self-signed cert is last in chain we verify its signature
only if X509_V_FLAG_CHECK_SS_SIGNATURE is set. Upon this request we do the
signature verification, but not in case it is a (non-conforming) self-issued
CA certificate with a key usage extension that does not include keyCertSign.

Make clear when we must verify the signature of a certificate
and when we must adhere to key usage restrictions of the 'issuing' cert.
Add some comments for making internal_verify() easier to understand.
Update the documentation of X509_V_FLAG_CHECK_SS_SIGNATURE accordingly.

Reviewed-by: Tomas Mraz <[email protected]>
(Merged from #12375)
@DDvO
Copy link
Contributor Author

DDvO commented Jul 16, 2020

Merged - thanks again for the quick handling!

@DDvO DDvO closed this Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: done This pull request has the required number of approvals branch: master Applies to master branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants