[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:
Kazuki Yamaguchi 2021-04-12 13:55:10 +09:00
Родитель 6ef0f272eb
Коммит 02a58fbfd1
2 изменённых файлов: 2 добавлений и 5 удалений

Просмотреть файл

@ -39,12 +39,8 @@ pkey_new0(VALUE arg)
{
EVP_PKEY *pkey = (EVP_PKEY *)arg;
VALUE klass, obj;
int type;
if (!pkey || (type = EVP_PKEY_base_id(pkey)) == EVP_PKEY_NONE)
ossl_raise(rb_eRuntimeError, "pkey is empty");
switch (type) {
switch (EVP_PKEY_base_id(pkey)) {
#if !defined(OPENSSL_NO_RSA)
case EVP_PKEY_RSA: klass = cRSA; break;
#endif

Просмотреть файл

@ -35,6 +35,7 @@ extern const rb_data_type_t ossl_evp_pkey_type;
} \
} while (0)
/* Takes ownership of the EVP_PKEY */
VALUE ossl_pkey_new(EVP_PKEY *);
void ossl_pkey_check_public_key(const EVP_PKEY *);
EVP_PKEY *ossl_pkey_read_generic(BIO *, VALUE);