[前][次][番号順一覧][スレッド一覧]

ruby-changes:43077

From: rhe <ko1@a...>
Date: Wed, 25 May 2016 01:27:15 +0900 (JST)
Subject: [ruby-changes:43077] rhe:r55151 (trunk): openssl: rename EC#generate_key to EC#generate_key!

rhe	2016-05-25 01:27:11 +0900 (Wed, 25 May 2016)

  New Revision: 55151

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55151

  Log:
    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.

  Modified files:
    trunk/ChangeLog
    trunk/ext/openssl/ossl_pkey_ec.c
    trunk/test/openssl/test_pkey_ec.rb
Index: test/openssl/test_pkey_ec.rb
===================================================================
--- test/openssl/test_pkey_ec.rb	(revision 55150)
+++ test/openssl/test_pkey_ec.rb	(revision 55151)
@@ -16,7 +16,7 @@ class OpenSSL::TestEC < OpenSSL::TestCas https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_ec.rb#L16
       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::TestCas https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_ec.rb#L127
   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
Index: ext/openssl/ossl_pkey_ec.c
===================================================================
--- ext/openssl/ossl_pkey_ec.c	(revision 55150)
+++ ext/openssl/ossl_pkey_ec.c	(revision 55151)
@@ -584,9 +584,17 @@ static VALUE ossl_ec_key_to_text(VALUE s https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkey_ec.c#L584
 
 /*
  *  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) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkey_ec.c#L1640
     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);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55150)
+++ ChangeLog	(revision 55151)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed May 25 00:37:16 2016  Kazuki Yamaguchi  <k@r...>
+
+	* 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@r...>
 
 	* include/ruby/ruby.h (rb_scan_args_set): check the arity after

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]