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

ruby-changes:3233

From: ko1@a...
Date: 27 Dec 2007 10:51:00 +0900
Subject: [ruby-changes:3233] technorama - Ruby:r14726 (ruby_1_8): * ext/openssl/ossl_ssl.c: Only show a warning if the default

technorama	2007-12-27 10:50:50 +0900 (Thu, 27 Dec 2007)

  New Revision: 14726

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/ext/openssl/ossl_rand.c
    branches/ruby_1_8/ext/openssl/ossl_ssl.c

  Log:
    * ext/openssl/ossl_ssl.c: Only show a warning if the default 
      DH callback is actually used.
    
    * ext/openssl/ossl_rand.c: New method: random_add().
    


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/openssl/ossl_rand.c?r1=14726&r2=14725
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=14726&r2=14725
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/openssl/ossl_ssl.c?r1=14726&r2=14725

Index: ruby_1_8/ext/openssl/ossl_ssl.c
===================================================================
--- ruby_1_8/ext/openssl/ossl_ssl.c	(revision 14725)
+++ ruby_1_8/ext/openssl/ossl_ssl.c	(revision 14726)
@@ -260,6 +260,8 @@
 static DH*
 ossl_default_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
 {
+    rb_warning("using default DH parameters.");
+
     switch(keylength){
     case 512:
 	return OSSL_DEFAULT_DH_512;
@@ -453,7 +455,6 @@
 	SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
     }
     else{
-	rb_warning("using default DH parameters.");
 	SSL_CTX_set_tmp_dh_callback(ctx, ossl_default_tmp_dh_callback);
     }
 #endif
Index: ruby_1_8/ext/openssl/ossl_rand.c
===================================================================
--- ruby_1_8/ext/openssl/ossl_rand.c	(revision 14725)
+++ ruby_1_8/ext/openssl/ossl_rand.c	(revision 14726)
@@ -27,6 +27,12 @@
 /*
  * Private
  */
+
+/*
+ *  call-seq:
+ *     seed(str) -> str
+ *
+ */
 static VALUE
 ossl_rand_seed(VALUE self, VALUE str)
 {
@@ -38,6 +44,20 @@
 
 /*
  *  call-seq:
+ *     add(str, entropy) -> self
+ *
+ */
+static VALUE
+ossl_rand_add(VALUE self, VALUE str, VALUE entropy)
+{
+    StringValue(str);
+    RAND_add(RSTRING_PTR(str), RSTRING_LEN(str), NUM2DBL(entropy));
+
+    return self;
+}
+
+/*
+ *  call-seq:
  *     load_random_file(filename) -> true
  *
  */
@@ -166,6 +186,7 @@
     eRandomError = rb_define_class_under(mRandom, "RandomError", eOSSLError);
 	
     DEFMETH(mRandom, "seed", ossl_rand_seed, 1);
+    DEFMETH(mRandom, "random_add", ossl_rand_add, 2);
     DEFMETH(mRandom, "load_random_file", ossl_rand_load_file, 1);
     DEFMETH(mRandom, "write_random_file", ossl_rand_write_file, 1);
     DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1);
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 14725)
+++ ruby_1_8/ChangeLog	(revision 14726)
@@ -1,3 +1,10 @@
+Thu Dec 27 10:47:32 2007  Technorama Ltd.  <oss-ruby@t...>
+
+	* ext/openssl/ossl_ssl.c: Only show a warning if the default 
+	  DH callback is actually used.
+
+	* ext/openssl/ossl_rand.c: New method: random_add().
+
 Wed Dec 26 22:27:45 2007  NARUSE, Yui <naruse@r...>
 
 	* lib/resolv.rb (Resolv::DNS::Name.==): fix for other is array of

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

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