ruby-changes:3203
From: ko1@a...
Date: 25 Dec 2007 20:34:09 +0900
Subject: [ruby-changes:3203] technorama - Ruby:r14696 (trunk): * ext/openssl/ossl_ssl.c: Only show a warning if the default
technorama 2007-12-25 20:31:51 +0900 (Tue, 25 Dec 2007) New Revision: 14696 Modified files: trunk/ChangeLog trunk/ext/openssl/ossl_rand.c trunk/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/trunk/ext/openssl/ossl_ssl.c?r1=14696&r2=14695 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14696&r2=14695 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/openssl/ossl_rand.c?r1=14696&r2=14695 Index: ChangeLog =================================================================== --- ChangeLog (revision 14695) +++ ChangeLog (revision 14696) @@ -1,3 +1,10 @@ +Tue Dec 25 20:24:58 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(). + Tue Dec 25 20:24:48 2007 Nobuyoshi Nakada <nobu@r...> * tool/make-snapshot: argument check, and cleanup exported directory. Index: ext/openssl/ossl_ssl.c =================================================================== --- ext/openssl/ossl_ssl.c (revision 14695) +++ ext/openssl/ossl_ssl.c (revision 14696) @@ -270,6 +270,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; @@ -463,7 +465,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: ext/openssl/ossl_rand.c =================================================================== --- ext/openssl/ossl_rand.c (revision 14695) +++ ext/openssl/ossl_rand.c (revision 14696) @@ -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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml