mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a99c3a6e9d
commit
42643e482e
3 changed files with 30 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Tue Dec 25 20:24:58 2007 Technorama Ltd. <oss-ruby@technorama.net>
|
||||||
|
|
||||||
|
* 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@ruby-lang.org>
|
Tue Dec 25 20:24:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* tool/make-snapshot: argument check, and cleanup exported directory.
|
* tool/make-snapshot: argument check, and cleanup exported directory.
|
||||||
|
|
|
@ -27,6 +27,12 @@ VALUE eRandomError;
|
||||||
/*
|
/*
|
||||||
* Private
|
* Private
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* call-seq:
|
||||||
|
* seed(str) -> str
|
||||||
|
*
|
||||||
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
ossl_rand_seed(VALUE self, VALUE str)
|
ossl_rand_seed(VALUE self, VALUE str)
|
||||||
{
|
{
|
||||||
|
@ -36,6 +42,20 @@ ossl_rand_seed(VALUE self, VALUE str)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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:
|
* call-seq:
|
||||||
* load_random_file(filename) -> true
|
* load_random_file(filename) -> true
|
||||||
|
@ -166,6 +186,7 @@ Init_ossl_rand()
|
||||||
eRandomError = rb_define_class_under(mRandom, "RandomError", eOSSLError);
|
eRandomError = rb_define_class_under(mRandom, "RandomError", eOSSLError);
|
||||||
|
|
||||||
DEFMETH(mRandom, "seed", ossl_rand_seed, 1);
|
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, "load_random_file", ossl_rand_load_file, 1);
|
||||||
DEFMETH(mRandom, "write_random_file", ossl_rand_write_file, 1);
|
DEFMETH(mRandom, "write_random_file", ossl_rand_write_file, 1);
|
||||||
DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1);
|
DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1);
|
||||||
|
|
|
@ -270,6 +270,8 @@ ossl_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
|
||||||
static DH*
|
static DH*
|
||||||
ossl_default_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
|
ossl_default_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
|
||||||
{
|
{
|
||||||
|
rb_warning("using default DH parameters.");
|
||||||
|
|
||||||
switch(keylength){
|
switch(keylength){
|
||||||
case 512:
|
case 512:
|
||||||
return OSSL_DEFAULT_DH_512;
|
return OSSL_DEFAULT_DH_512;
|
||||||
|
@ -463,7 +465,6 @@ ossl_sslctx_setup(VALUE self)
|
||||||
SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
|
SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
rb_warning("using default DH parameters.");
|
|
||||||
SSL_CTX_set_tmp_dh_callback(ctx, ossl_default_tmp_dh_callback);
|
SSL_CTX_set_tmp_dh_callback(ctx, ossl_default_tmp_dh_callback);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue