diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2021-04-12 13:55:10 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2021-12-12 18:20:36 +0900 |
commit | 316cb2a41f154e4663d7e7fead60cfc0bfa86af9 (patch) | |
tree | 635876468608eaa8e7a99336849da9658c51908c /ext/openssl/ossl_pkey.c | |
parent | 8193b7322ece2548eaf3d8acd1aec32bfc2cfdb9 (diff) | |
download | ruby-openssl-316cb2a41f154e4663d7e7fead60cfc0bfa86af9.tar.gz |
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.
Diffstat (limited to 'ext/openssl/ossl_pkey.c')
-rw-r--r-- | ext/openssl/ossl_pkey.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c index f9f5162e..820e4a2c 100644 --- a/ext/openssl/ossl_pkey.c +++ b/ext/openssl/ossl_pkey.c @@ -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 |