summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_pkey.h
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.h
parent8885a8720d55bd881e7083adf38a21d73e095e4b (diff)
* 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.h')
-rw-r--r--ext/openssl/ossl_pkey.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/openssl/ossl_pkey.h b/ext/openssl/ossl_pkey.h
index db4d3cf..880a104 100644
--- a/ext/openssl/ossl_pkey.h
+++ b/ext/openssl/ossl_pkey.h
@@ -16,11 +16,16 @@ extern VALUE cPKey;
extern VALUE ePKeyError;
extern ID id_private_q;
+#define OSSL_PKEY_SET_PRIVATE(obj) rb_iv_set((obj), "private", Qtrue)
+#define OSSL_PKEY_SET_PUBLIC(obj) rb_iv_set((obj), "private", Qfalse)
+#define OSSL_PKEY_IS_PRIVATE(obj) (rb_iv_get((obj), "private") == Qtrue)
+
#define WrapPKey(klass, obj, pkey) do { \
if (!pkey) { \
rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!"); \
} \
obj = Data_Wrap_Struct(klass, 0, EVP_PKEY_free, pkey); \
+ OSSL_PKEY_SET_PUBLIC(obj); \
} while (0)
#define GetPKey(obj, pkey) do {\
Data_Get_Struct(obj, EVP_PKEY, pkey);\