diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2021-04-22 16:33:59 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2021-12-12 18:23:59 +0900 |
commit | 66cd8cbaaf85604a13fd68bd9cd280a2881044ad (patch) | |
tree | 2f46515bbc1fcb8a59c596837f10b58ede810e56 /ext/openssl/ossl_pkey_dsa.c | |
parent | 74f6c6175688502a5bf27ae35367616858630c0f (diff) | |
download | ruby-openssl-66cd8cbaaf85604a13fd68bd9cd280a2881044ad.tar.gz |
pkey: use EVP_PKEY_dup() if availableky/pkey-base-dup
We can use it to implement OpenSSL::PKey::PKey#initialize_copy. This
should work on all key types, not just DH/DSA/EC/RSA types.
Diffstat (limited to 'ext/openssl/ossl_pkey_dsa.c')
-rw-r--r-- | ext/openssl/ossl_pkey_dsa.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c index 15724548..25404aa7 100644 --- a/ext/openssl/ossl_pkey_dsa.c +++ b/ext/openssl/ossl_pkey_dsa.c @@ -139,6 +139,7 @@ ossl_dsa_initialize(int argc, VALUE *argv, VALUE self) return self; } +#ifndef HAVE_EVP_PKEY_DUP static VALUE ossl_dsa_initialize_copy(VALUE self, VALUE other) { @@ -166,6 +167,7 @@ ossl_dsa_initialize_copy(VALUE self, VALUE other) return self; } +#endif /* * call-seq: @@ -327,7 +329,9 @@ Init_ossl_dsa(void) cDSA = rb_define_class_under(mPKey, "DSA", cPKey); rb_define_method(cDSA, "initialize", ossl_dsa_initialize, -1); +#ifndef HAVE_EVP_PKEY_DUP rb_define_method(cDSA, "initialize_copy", ossl_dsa_initialize_copy, 1); +#endif rb_define_method(cDSA, "public?", ossl_dsa_is_public, 0); rb_define_method(cDSA, "private?", ossl_dsa_is_private, 0); |