summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_rand.c
diff options
context:
space:
mode:
authortechnorama <technorama@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-18 08:56:21 +0000
committertechnorama <technorama@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-18 08:56:21 +0000
commit9fa80b19a61adf70ec785d96ebffc2a9327b7b5c (patch)
tree12598125686f50577b36d0cc7cf6305a4fa74a13 /ext/openssl/ossl_rand.c
parent1c03862049be55c911c1dfb2621c3be42d7c0d09 (diff)
* ext/openssl/{extconf.rb,ossl_ssl_session.c}:
Fix ruby-Bugs-11513. * ext/openssl/ossl_pkey_ec.c New methods EC::Point.[eql,make_affine!,invert!,on_curve?,infinity?] By default output the same key form as the openssl command. * ext/openssl/ossl_rand.c New method Random.status? * test/openssl/test_ec.rb New tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_rand.c')
-rw-r--r--ext/openssl/ossl_rand.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/openssl/ossl_rand.c b/ext/openssl/ossl_rand.c
index ca8c9a5..3b6eaf3 100644
--- a/ext/openssl/ossl_rand.c
+++ b/ext/openssl/ossl_rand.c
@@ -135,6 +135,18 @@ ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
return Qtrue;
}
+/*
+ * call-seq:
+ * status? => true | false
+ *
+ * Return true if the PRNG has been seeded with enough data, false otherwise.
+ */
+static VALUE
+ossl_rand_status(VALUE self)
+{
+ return RAND_status() ? Qtrue : Qfalse;
+}
+
#define DEFMETH(class, name, func, argc) \
rb_define_method(class, name, func, argc); \
rb_define_singleton_method(class, name, func, argc);
@@ -160,5 +172,6 @@ Init_ossl_rand()
DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
DEFMETH(mRandom, "egd", ossl_rand_egd, 1);
DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
+ DEFMETH(mRandom, "status?", ossl_rand_status, 0)
}