summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2021-12-17 02:21:42 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-12-20 23:42:02 +0900
commitb93ae54258684d0c3d1501400af949c013f44fba (patch)
treec247ccec4f01313bcb0403fc2832235f9eaa3956 /ext
parent0d698be04f6c76250706e8d56f542c3c7fca0fa7 (diff)
[ruby/openssl] pkey/ec: deprecate OpenSSL::PKey::EC#generate_key!
OpenSSL::PKey::EC#generate_key! will not work on OpenSSL 3.0 because keys are made immutable. Users should use OpenSSL::PKey.generate_key instead. https://github.com/ruby/openssl/commit/5e2e66cce8
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl_pkey_ec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c
index 3b4930f353..ff3150dac0 100644
--- a/ext/openssl/ossl_pkey_ec.c
+++ b/ext/openssl/ossl_pkey_ec.c
@@ -441,6 +441,9 @@ ossl_ec_key_to_der(VALUE self)
*/
static VALUE ossl_ec_key_generate_key(VALUE self)
{
+#if OSSL_OPENSSL_PREREQ(3, 0, 0)
+ rb_raise(ePKeyError, "pkeys are immutable on OpenSSL 3.0");
+#else
EC_KEY *ec;
GetEC(self, ec);
@@ -448,6 +451,7 @@ static VALUE ossl_ec_key_generate_key(VALUE self)
ossl_raise(eECError, "EC_KEY_generate_key");
return self;
+#endif
}
/*