-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Init OpenSSL libctx and use it for pkey #18282
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
base: master
Are you sure you want to change the base?
Conversation
@@ -44,6 +44,16 @@ void php_openssl_backend_shutdown(void) | |||
#endif | |||
} | |||
|
|||
EVP_PKEY_CTX *php_openssl_pkey_new_from_name(const char *name, int id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't name
unnecessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be fair, I think he had to for the sake of ssl apis inter-compatibility (look at the version for openssl 3.x), maybe just adding (void)name;
should do.
@@ -1487,6 +1487,37 @@ int php_openssl_get_evp_pkey_type(int key_type) { | |||
} | |||
} | |||
|
|||
const char *php_openssl_get_evp_pkey_name(int key_type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any drawbacks to making it static
?
void php_openssl_backend_init_libctx(OSSL_LIB_CTX **plibctx, char **ppropq) | ||
{ | ||
/* The return value is not checked because we cannot reasonable fail in GINIT so using NULL | ||
* (default context) is probably better. */ | ||
*plibctx = OSSL_LIB_CTX_new(); | ||
*ppropq = NULL; | ||
} | ||
|
||
void php_openssl_backend_destroy_libctx(OSSL_LIB_CTX *libctx, char *propq) | ||
{ | ||
if (libctx != NULL) { | ||
OSSL_LIB_CTX_free(libctx); | ||
} | ||
if (propq != NULL) { | ||
free(propq); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it okay to omit #if PHP_OPENSSL_API_VERSION >= 0x30000
?
This adds initial setup for libctx and make use of it in PKEY handling.