Skip to content

PackageCollectionsSigning: correct BoringSSLCertificate.keyType(of:) #3679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2021

Conversation

compnerd
Copy link
Member

This function takes a named argument which is the EVP_PKEY and checks
the underlying public key type (expected to be one of RSA or EC).
However, instead of checking the key type of the given public key, it
was always returning the key type of the underlying certificate. This
happened to give the correct result as the current usage always used the
same object to get the key. This corrects that and uses the proper
accessors for the value.

[One line description of your change]

Motivation:

[Explain here the context, and why you're making that change. What is the problem you're trying to solve.]

Modifications:

[Describe the modifications you've done.]

Result:

[After your change, what will change.]

This function takes a named argument which is the `EVP_PKEY` and checks
the underlying public key type (expected to be one of RSA or EC).
However, instead of checking the key type of the given public key, it
was always returning the key type of the underlying certificate.  This
happened to give the correct result as the current usage always used the
same object to get the key.  This corrects that and uses the proper
accessors for the value.
@compnerd
Copy link
Member Author

@swift-ci please test

@tomerd
Copy link
Contributor

tomerd commented Aug 19, 2021

@swift-ci please smoke test

@tomerd
Copy link
Contributor

tomerd commented Aug 19, 2021

@yim-lee @Lukasa for review

Copy link
Contributor

@yim-lee yim-lee left a comment

Choose a reason for hiding this comment

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

Thanks @compnerd. How did you find this out? Does it cause problem for you?

Running the code locally, CCryptoBoringSSL_EVP_PKEY_id does seem to return the value we want (the function itself returns the key's type) and the tests pass, so this change LGTM.

@compnerd
Copy link
Member Author

@yim-lee a build error pointed me to the area of the code, the actual issue was found by inspection.

@compnerd compnerd merged commit 1edc34b into swiftlang:main Aug 19, 2021
@compnerd compnerd deleted the public-private-public-key branch August 19, 2021 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants