From 39ba5fed60f6cfca4a33df9527f2b3d6ad7de104 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Sun, 3 Jul 2016 14:10:16 +0900 Subject: pkey: remove unused things Make id_private_q local to ossl_pkey.c, and remove unused DupPrivPKeyPtr() function. --- ext/openssl/ossl_pkey.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'ext/openssl/ossl_pkey.c') diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c index 4ae8e14e..176b49bc 100644 --- a/ext/openssl/ossl_pkey.c +++ b/ext/openssl/ossl_pkey.c @@ -15,7 +15,7 @@ VALUE mPKey; VALUE cPKey; VALUE ePKeyError; -ID id_private_q; +static ID id_private_q; /* * callback for generating keys @@ -196,20 +196,6 @@ DupPKeyPtr(VALUE obj) return pkey; } -EVP_PKEY * -DupPrivPKeyPtr(VALUE obj) -{ - EVP_PKEY *pkey; - - if (rb_funcallv(obj, id_private_q, 0, NULL) != Qtrue) { - ossl_raise(rb_eArgError, "Private key is needed."); - } - SafeGetPKey(obj, pkey); - EVP_PKEY_up_ref(pkey); - - return pkey; -} - /* * Private */ @@ -271,9 +257,7 @@ ossl_pkey_sign(VALUE self, VALUE digest, VALUE data) VALUE str; int result; - if (rb_funcallv(self, id_private_q, 0, NULL) != Qtrue) - ossl_raise(rb_eArgError, "Private key is needed."); - GetPKey(self, pkey); + pkey = GetPrivPKeyPtr(self); md = GetDigestPtr(digest); StringValue(data); str = rb_str_new(0, EVP_PKEY_size(pkey)+16); -- cgit v1.2.3