From d77b606edd788a52e40b27838c6b1b588c1f33cd Mon Sep 17 00:00:00 2001 From: gotoyuzo Date: Thu, 2 Oct 2003 08:47:11 +0000 Subject: * ext/openssl/ossl_engine.c: add a new module OpenSSL::Engine. it supports OpenSSL hardware cryptographic engine interface. * ext/openssl/ossl_engine.h: ditto. * ext/openssl/MANIFEST: add ossl_engine.c and ossl_engine.h. * ext/openssl/extconf.rb: add check for openssl/engine.h. * ext/openssl/ossl.c: call Init_ossl_engine(). * ext/openssl/ossl.h: include openssl/engine.h. * ext/openssl/ossl_pkey_{rsa,dsa,dh}.c: check if underlying EVP_PKEY referes engine. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/ossl_pkey_rsa.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ext/openssl/ossl_pkey_rsa.c') diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c index 2d04bf8367..669e84efca 100644 --- a/ext/openssl/ossl_pkey_rsa.c +++ b/ext/openssl/ossl_pkey_rsa.c @@ -19,7 +19,13 @@ } \ } while (0) -#define RSA_PRIVATE(rsa) ((rsa)->p && (rsa)->q) +#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 /* * Classes @@ -199,7 +205,7 @@ ossl_rsa_export(int argc, VALUE *argv, VALUE self) if (!(out = BIO_new(BIO_s_mem()))) { ossl_raise(eRSAError, NULL); } - if (RSA_PRIVATE(pkey->pkey.rsa)) { + if (RSA_HAS_PRIVATE(pkey->pkey.rsa)) { if (!PEM_write_bio_RSAPrivateKey(out, pkey->pkey.rsa, ciph, NULL, 0, ossl_pem_passwd_cb, passwd)) { BIO_free(out); -- cgit v1.2.3