summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_pkey_rsa.c
diff options
context:
space:
mode:
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 75b02d23ec2..17bec2b7bbd 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);