Skip to content

X509: Refactor X509_PUBKEY processing to include provider side keys#14281

Closed
levitte wants to merge 2 commits intoopenssl:masterfrom
levitte:fix-13893-take2
Closed

X509: Refactor X509_PUBKEY processing to include provider side keys#14281
levitte wants to merge 2 commits intoopenssl:masterfrom
levitte:fix-13893-take2

Conversation

@levitte
Copy link
Member

@levitte levitte commented Feb 22, 2021

When a SubjectPublicKeyInfo (SPKI) is decoded into an X509_PUBKEY
structure, the corresponding EVP_PKEY is automatically added as well.
This used to only support our built-in keytypes, and only in legacy
form.

This is now refactored by making The ASN1 implementation of the
X509_PUBKEY an EXTERN_ASN1, resulting in a more manual implementation
of the basic support routines. Specifically, the d2i routine will do
what was done in the callback before, and try to interpret the input
as an EVP_PKEY, first in legacy form, and then using OSSL_DECODER.

Fixes #13893

When a SubjectPublicKeyInfo (SPKI) is decoded into an X509_PUBKEY
structure, the corresponding EVP_PKEY is automatically added as well.
This used to only support our built-in keytypes, and only in legacy
form.

This is now refactored by making The ASN1 implementation of the
X509_PUBKEY an EXTERN_ASN1, resulting in a more manual implementation
of the basic support routines.  Specifically, the d2i routine will do
what was done in the callback before, and try to interpret the input
as an EVP_PKEY, first in legacy form, and then using OSSL_DECODER.

Fixes openssl#13893
@levitte levitte added branch: master Applies to master branch approval: review pending This pull request needs review by a committer labels Feb 22, 2021
@levitte levitte added this to the Sprint Hydrogen milestone Feb 22, 2021
Copy link
Contributor

@paulidale paulidale left a comment

Choose a reason for hiding this comment

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

Does this need a test case?

#include <openssl/dsa.h>
#include <openssl/decoder.h>
#include <openssl/encoder.h>
#include <openssl/decoder.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Twice? I know it's a good header file but still...

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess I include with enthusiasm!

Yeahok, I'll remove one of them

Copy link
Member

Choose a reason for hiding this comment

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

Ummmm.....did I miss something. The original header was encoder, and this adds decoder? i.e. its not the same header twice.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's because the conversation page only shows you two diff lines by default. Here's what it looks like when you go look at the file changes

foo

Copy link
Member Author

Choose a reason for hiding this comment

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

Anyway, it's fixed...

@levitte levitte added approval: done This pull request has the required number of approvals approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: review pending This pull request needs review by a committer approval: done This pull request has the required number of approvals labels Feb 23, 2021
@levitte
Copy link
Member Author

levitte commented Feb 24, 2021

Merged

1031585 X509: Refactor X509_PUBKEY processing to include provider side keys

@levitte levitte closed this Feb 24, 2021
@levitte levitte deleted the fix-13893-take2 branch February 24, 2021 09:18
openssl-machine pushed a commit that referenced this pull request Feb 24, 2021
When a SubjectPublicKeyInfo (SPKI) is decoded into an X509_PUBKEY
structure, the corresponding EVP_PKEY is automatically added as well.
This used to only support our built-in keytypes, and only in legacy
form.

This is now refactored by making The ASN1 implementation of the
X509_PUBKEY an EXTERN_ASN1, resulting in a more manual implementation
of the basic support routines.  Specifically, the d2i routine will do
what was done in the callback before, and try to interpret the input
as an EVP_PKEY, first in legacy form, and then using OSSL_DECODER.

Fixes #13893

Reviewed-by: Paul Dale <[email protected]>
(Merged from #14281)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Applies to master branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Public keys decoded from an X509 certificate are legacy keys

3 participants