[ruby/openssl] pkey: do not check NULL argument in ossl_pkey_new()
Passing NULL to ossl_pkey_new() makes no sense in the first place, and in fact it is ensured not to be NULL in all cases. https://github.com/ruby/openssl/commit/316cb2a41f
This commit is contained in:
parent
6ef0f272eb
commit
02a58fbfd1
@ -39,12 +39,8 @@ pkey_new0(VALUE arg)
|
|||||||
{
|
{
|
||||||
EVP_PKEY *pkey = (EVP_PKEY *)arg;
|
EVP_PKEY *pkey = (EVP_PKEY *)arg;
|
||||||
VALUE klass, obj;
|
VALUE klass, obj;
|
||||||
int type;
|
|
||||||
|
|
||||||
if (!pkey || (type = EVP_PKEY_base_id(pkey)) == EVP_PKEY_NONE)
|
switch (EVP_PKEY_base_id(pkey)) {
|
||||||
ossl_raise(rb_eRuntimeError, "pkey is empty");
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
#if !defined(OPENSSL_NO_RSA)
|
#if !defined(OPENSSL_NO_RSA)
|
||||||
case EVP_PKEY_RSA: klass = cRSA; break;
|
case EVP_PKEY_RSA: klass = cRSA; break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,6 +35,7 @@ extern const rb_data_type_t ossl_evp_pkey_type;
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/* Takes ownership of the EVP_PKEY */
|
||||||
VALUE ossl_pkey_new(EVP_PKEY *);
|
VALUE ossl_pkey_new(EVP_PKEY *);
|
||||||
void ossl_pkey_check_public_key(const EVP_PKEY *);
|
void ossl_pkey_check_public_key(const EVP_PKEY *);
|
||||||
EVP_PKEY *ossl_pkey_read_generic(BIO *, VALUE);
|
EVP_PKEY *ossl_pkey_read_generic(BIO *, VALUE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user