Skip to content
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

Generate PKEYs using EVP_PKEY_Q_keygen #229

Merged
merged 6 commits into from
Dec 10, 2024
Merged

Generate PKEYs using EVP_PKEY_Q_keygen #229

merged 6 commits into from
Dec 10, 2024

Conversation

qmuntal
Copy link
Collaborator

@qmuntal qmuntal commented Nov 29, 2024

OpenSSL supports one-shot PKEY generation using EVP_PKEY_Q_keygen.

Using this function from Go is a bit complicated because it has a variadic parameter, which is not directly supported by cgo (see golang/go#975). I've instead defined the new DEFINEFUNC_VARIADIC_3_0 macro that allows wrapping the same OpenSSL function multiple times with different numbers of arguments.

The code is now a bit more complex, but we shaved some cgo calls and also removed some EVP_PKEY_CTX_ctrl calls from this code path. This last bit is important because EVP_PKEY_CTX_ctrl is not recommended to be directly used in OpenSSL 3 (see quote below from docs), and I'm on a small quest to remove all direct calls to it from our codebase.

Applications will not normally call EVP_PKEY_CTX_ctrl() directly but will instead call one of the algorithm specific functions below.

Copy link
Collaborator

@dagood dagood left a comment

Choose a reason for hiding this comment

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

Functionally, LGTM.

cmd/checkheader/main.go Outdated Show resolved Hide resolved
shims.h Outdated Show resolved Hide resolved
@qmuntal qmuntal merged commit dd4074a into v2 Dec 10, 2024
54 checks passed
@qmuntal qmuntal deleted the pkeyoneshot branch December 10, 2024 09:35
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