aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_pkey_rsa.c
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-18 22:56:11 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-18 22:56:11 +0000
commit246f5cfe67fda9fa2fed869c2fffb48effcdc6b9 (patch)
treeb345674a43e7830b5f0fb8f453e9f37fa06554b8 /ext/openssl/ossl_pkey_rsa.c
parent8885a8720d55bd881e7083adf38a21d73e095e4b (diff)
downloadruby-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_rsa.c')
-rw-r--r--ext/openssl/ossl_pkey_rsa.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c
index 75b02d23ec..17bec2b7bb 100644
--- a/ext/openssl/ossl_pkey_rsa.c
+++ b/ext/openssl/ossl_pkey_rsa.c
@@ -20,12 +20,7 @@
} while (0)
#define RSA_HAS_PRIVATE(rsa) ((rsa)->p && (rsa)->q)
-
-#ifdef OSSL_ENGINE_ENABLED
-# define RSA_PRIVATE(rsa) (RSA_HAS_PRIVATE(rsa) || (rsa)->engine)
-#else
-# define RSA_PRIVATE(rsa) RSA_HAS_PRIVATE(rsa)
-#endif
+#define RSA_PRIVATE(obj,rsa) (RSA_HAS_PRIVATE(rsa)||OSSL_PKEY_IS_PRIVATE(obj))
/*
* Classes
@@ -181,8 +176,8 @@ ossl_rsa_is_private(VALUE self)
EVP_PKEY *pkey;
GetPKeyRSA(self, pkey);
-
- return (RSA_PRIVATE(pkey->pkey.rsa)) ? Qtrue : Qfalse;
+
+ return (RSA_PRIVATE(self, pkey->pkey.rsa)) ? Qtrue : Qfalse;
}
static VALUE
@@ -303,7 +298,7 @@ ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self)
VALUE str, buffer, padding;
GetPKeyRSA(self, pkey);
- if (!RSA_PRIVATE(pkey->pkey.rsa)) {
+ if (!RSA_PRIVATE(self, pkey->pkey.rsa)) {
ossl_raise(eRSAError, "private key needed.");
}
rb_scan_args(argc, argv, "11", &buffer, &padding);
@@ -328,7 +323,7 @@ ossl_rsa_private_decrypt(int argc, VALUE *argv, VALUE self)
VALUE str, buffer, padding;
GetPKeyRSA(self, pkey);
- if (!RSA_PRIVATE(pkey->pkey.rsa)) {
+ if (!RSA_PRIVATE(self, pkey->pkey.rsa)) {
ossl_raise(eRSAError, "private key needed.");
}
rb_scan_args(argc, argv, "11", &buffer, &padding);