aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_pkey_dsa.c
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-04-20 01:18:57 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-04-27 23:07:40 +0900
commit26ddc91e4f0db749a2c33c67ac696340c796abcd (patch)
tree677c87a6166889a5cc3fa19a8752a4797eb2a1f8 /ext/openssl/ossl_pkey_dsa.c
parent35f8edeedc0e42d040e2b5823a300aaa2e3ff13f (diff)
downloadruby-26ddc91e4f0db749a2c33c67ac696340c796abcd.tar.gz
ext/openssl: drop support for OpenSSL 0.9.6/0.9.7
The last release of OpenSSL 0.9.7 series was over 9 years ago (!) and even 0.9.8/1.0.0 are no longer supported (EOL was 2015-12-31). It actually doesn't compile since r40461 (ext/openssl/ossl_bn.c (ossl_bn_initialize): allow Fixnum and Bignum. [ruby-core:53986] [Feature #8217], 2013-04-25, 2.1.0) and it looks like nobody noticed it.
Diffstat (limited to 'ext/openssl/ossl_pkey_dsa.c')
-rw-r--r--ext/openssl/ossl_pkey_dsa.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c
index 04900cc649..a3f112274b 100644
--- a/ext/openssl/ossl_pkey_dsa.c
+++ b/ext/openssl/ossl_pkey_dsa.c
@@ -76,7 +76,6 @@ ossl_dsa_new(EVP_PKEY *pkey)
/*
* Private
*/
-#if defined(HAVE_DSA_GENERATE_PARAMETERS_EX) && HAVE_BN_GENCB
struct dsa_blocking_gen_arg {
DSA *dsa;
int size;
@@ -95,12 +94,10 @@ dsa_blocking_gen(void *arg)
gen->result = DSA_generate_parameters_ex(gen->dsa, gen->size, gen->seed, gen->seed_len, gen->counter, gen->h, gen->cb);
return 0;
}
-#endif
static DSA *
dsa_generate(int size)
{
-#if defined(HAVE_DSA_GENERATE_PARAMETERS_EX) && HAVE_BN_GENCB
BN_GENCB cb;
struct ossl_generate_cb_arg cb_arg;
struct dsa_blocking_gen_arg gen_arg;
@@ -138,19 +135,6 @@ dsa_generate(int size)
if (cb_arg.state) rb_jump_tag(cb_arg.state);
return 0;
}
-#else
- DSA *dsa;
- unsigned char seed[20];
- int seed_len = 20, counter;
- unsigned long h;
-
- if (RAND_bytes(seed, seed_len) <= 0) {
- 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;
-#endif
if (!DSA_generate_key(dsa)) {
DSA_free(dsa);
@@ -240,7 +224,10 @@ ossl_dsa_initialize(int argc, VALUE *argv, VALUE self)
}
if (!dsa) {
OSSL_BIO_reset(in);
+#define PEM_read_bio_DSAPublicKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
+ (d2i_of_void *)d2i_DSAPublicKey, PEM_STRING_DSA_PUBLIC, (bp), (void **)(x), (cb), (u))
dsa = PEM_read_bio_DSAPublicKey(in, NULL, NULL, NULL);
+#undef PEM_read_bio_DSAPublicKey
}
BIO_free(in);
if (!dsa) {
@@ -460,7 +447,10 @@ ossl_dsa_to_public_key(VALUE self)
GetPKeyDSA(self, pkey);
/* err check performed by dsa_instance */
+#define DSAPublicKey_dup(dsa) (DSA *)ASN1_dup( \
+ (i2d_of_void *)i2d_DSAPublicKey, (d2i_of_void *)d2i_DSAPublicKey, (char *)(dsa))
dsa = DSAPublicKey_dup(pkey->pkey.dsa);
+#undef DSAPublicKey_dup
obj = dsa_instance(CLASS_OF(self), dsa);
if (obj == Qfalse) {
DSA_free(dsa);