diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-18 22:56:11 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-18 22:56:11 +0000 |
commit | 246f5cfe67fda9fa2fed869c2fffb48effcdc6b9 (patch) | |
tree | b345674a43e7830b5f0fb8f453e9f37fa06554b8 /ext/openssl/ossl_pkey_dsa.c | |
parent | 8885a8720d55bd881e7083adf38a21d73e095e4b (diff) | |
download | ruby-246f5cfe67fda9fa2fed869c2fffb48effcdc6b9.tar.gz |
* ext/openssl/ossl_pkey.h, ossl_pkey_rsa.c, ossl_pkey_dsa.c:
an instance variable "private" is added to OpenSSL::PKey class.
this ivar is a flag that shows whether there is a private key
in the instance.
* ext/openssl/ossl_engine.c: (ossl_engine_load_privkey): set private
key flag.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_pkey_dsa.c')
-rw-r--r-- | ext/openssl/ossl_pkey_dsa.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c index daa0f4cd83..39b1902d57 100644 --- a/ext/openssl/ossl_pkey_dsa.c +++ b/ext/openssl/ossl_pkey_dsa.c @@ -20,13 +20,7 @@ } while (0) #define DSA_HAS_PRIVATE(dsa) ((dsa)->priv_key) - -#ifdef OSSL_ENGINE_ENABLED -# define DSA_PRIVATE(dsa) (DSA_HAS_PRIVATE(dsa) || (dsa)->engine) -#else -# define DSA_PRIVATE(dsa) DSA_HAS_PRIVATE(dsa) -#endif - +#define DSA_PRIVATE(obj,dsa) (DSA_HAS_PRIVATE(dsa)||OSSL_PKEY_IS_PRIVATE(obj)) /* * Classes @@ -190,7 +184,7 @@ ossl_dsa_is_private(VALUE self) GetPKeyDSA(self, pkey); - return (DSA_PRIVATE(pkey->pkey.dsa)) ? Qtrue : Qfalse; + return (DSA_PRIVATE(self, pkey->pkey.dsa)) ? Qtrue : Qfalse; } static VALUE @@ -336,7 +330,7 @@ ossl_dsa_sign(VALUE self, VALUE data) GetPKeyDSA(self, pkey); StringValue(data); - if (!DSA_PRIVATE(pkey->pkey.dsa)) { + if (!DSA_PRIVATE(self, pkey->pkey.dsa)) { ossl_raise(eDSAError, "Private DSA key needed!"); } str = rb_str_new(0, ossl_dsa_buf_size(pkey)); |