summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_pkey_dsa.c
diff options
context:
space:
mode:
authormichal <michal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-12 13:46:48 +0000
committermichal <michal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-12 13:46:48 +0000
commitbd96b4c8ccbfbaf68c6996d74515fd603b2aea63 (patch)
tree7585c4dabc044459b4cfb92230bdff20fb882087 /ext/openssl/ossl_pkey_dsa.c
parentecf0c48d5a8308500f2331287fe88c88d6c43b70 (diff)
OpenSSL update
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_pkey_dsa.c')
-rw-r--r--ext/openssl/ossl_pkey_dsa.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c
index 73ab47b2c9..5cea9345e9 100644
--- a/ext/openssl/ossl_pkey_dsa.c
+++ b/ext/openssl/ossl_pkey_dsa.c
@@ -74,21 +74,6 @@ ossl_dsa_new(EVP_PKEY *pkey)
/*
* Private
*/
-/*
- * CB for yielding when generating DSA params
- */
-static void
-ossl_dsa_generate_cb(int p, int n, void *arg)
-{
- VALUE ary;
-
- ary = rb_ary_new2(2);
- rb_ary_store(ary, 0, INT2NUM(p));
- rb_ary_store(ary, 1, INT2NUM(n));
-
- rb_yield(ary);
-}
-
static DSA *
dsa_generate(int size)
{
@@ -96,18 +81,15 @@ dsa_generate(int size)
unsigned char seed[20];
int seed_len = 20, counter;
unsigned long h;
- void (*cb)(int, int, void *) = NULL;
if (!RAND_bytes(seed, seed_len)) {
return 0;
}
- if (rb_block_given_p()) {
- cb = ossl_dsa_generate_cb;
- }
- dsa = DSA_generate_parameters(size, seed, seed_len, &counter, &h, cb, NULL);
- if(!dsa) { /* arg to cb = NULL */
- return 0;
- }
+ dsa = DSA_generate_parameters(size, seed, seed_len, &counter, &h,
+ rb_block_given_p() ? ossl_generate_cb : NULL,
+ NULL);
+ if(!dsa) return 0;
+
if (!DSA_generate_key(dsa)) {
DSA_free(dsa);
return 0;