mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
b3d3d52cd6
commit
8cbd74a362
3 changed files with 24 additions and 5 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Wed May 25 00:37:16 2016 Kazuki Yamaguchi <k@rhe.jp>
|
||||
|
||||
* 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.
|
||||
|
||||
Wed May 25 00:23:05 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* include/ruby/ruby.h (rb_scan_args_set): check the arity after
|
||||
|
|
|
@ -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 # => #<OpenSSL::BN XXXXXX>
|
||||
*/
|
||||
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);
|
||||
|
|
|
@ -16,7 +16,7 @@ class OpenSSL::TestEC < OpenSSL::TestCase
|
|||
group = OpenSSL::PKey::EC::Group.new(curve)
|
||||
|
||||
key = OpenSSL::PKey::EC.new(group)
|
||||
key.generate_key
|
||||
key.generate_key!
|
||||
|
||||
@groups << group
|
||||
@keys << key
|
||||
|
@ -127,7 +127,7 @@ class OpenSSL::TestEC < OpenSSL::TestCase
|
|||
def test_dh_compute_key
|
||||
for key in @keys
|
||||
k = OpenSSL::PKey::EC.new(key.group)
|
||||
k.generate_key
|
||||
k.generate_key!
|
||||
|
||||
puba = key.public_key
|
||||
pubb = k.public_key
|
||||
|
|
Loading…
Reference in a new issue