diff options
author | Kazuki Yamaguchi <[email protected]> | 2021-12-17 02:21:42 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <[email protected]> | 2021-12-20 23:42:02 +0900 |
commit | b93ae54258684d0c3d1501400af949c013f44fba (patch) | |
tree | c247ccec4f01313bcb0403fc2832235f9eaa3956 /ext/openssl/ossl_pkey_ec.c | |
parent | 0d698be04f6c76250706e8d56f542c3c7fca0fa7 (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/openssl/ossl_pkey_ec.c')
-rw-r--r-- | ext/openssl/ossl_pkey_ec.c | 4 |
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 } /* |