From ca428e6777947d0da4f2bb435845c91f453da0b8 Mon Sep 17 00:00:00 2001 From: rhe Date: Tue, 24 May 2016 16:27:11 +0000 Subject: openssl: rename EC#generate_key to EC#generate_key! * ext/openssl/ossl_pkey_ec.c (ossl_ec_key_generate_key): Fix up RDoc. (Init_ossl_ec): Rename EC#generate_key to EC#generate_key!. Make the old name an alias of #generate_key!. This change is for consistency with other PKey types. [ruby-core:45541] [Bug #6567] * test/openssl/test_pkey_ec.rb: Use EC#generate_key! instead of EC#generate_key. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/ossl_pkey_ec.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'ext') diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c index ab6209c7..74bc7abe 100644 --- a/ext/openssl/ossl_pkey_ec.c +++ b/ext/openssl/ossl_pkey_ec.c @@ -584,9 +584,17 @@ static VALUE ossl_ec_key_to_text(VALUE self) /* * call-seq: - * key.generate_key => self + * key.generate_key! => self * - * See the OpenSSL documentation for EC_KEY_generate_key() + * Generates a new random private and public key. + * + * See also the OpenSSL documentation for EC_KEY_generate_key() + * + * === Example + * ec = OpenSSL::PKey::EC.new("prime256v1") + * p ec.private_key # => nil + * ec.generate_key! + * p ec.private_key # => # */ static VALUE ossl_ec_key_generate_key(VALUE self) { @@ -1632,7 +1640,8 @@ void Init_ossl_ec(void) set/get asn1_flag (can use ruby to call self.group.asn1_flag) set/get precompute_mult */ - rb_define_method(cEC, "generate_key", ossl_ec_key_generate_key, 0); + rb_define_method(cEC, "generate_key!", ossl_ec_key_generate_key, 0); + rb_define_alias(cEC, "generate_key", "generate_key!"); rb_define_method(cEC, "check_key", ossl_ec_key_check_key, 0); rb_define_method(cEC, "dh_compute_key", ossl_ec_key_dh_compute_key, 1); -- cgit v1.2.3