summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/extconf.rb2
-rw-r--r--ext/openssl/ossl_bn.c17
-rw-r--r--ext/openssl/ossl_pkcs7.c4
3 files changed, 21 insertions, 2 deletions
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 94b79d44285..04827ff498d 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -100,6 +100,8 @@ have_func("CONF_get1_default_config_file")
have_func("BN_mod_sqr")
have_func("BN_mod_add")
have_func("BN_mod_sub")
+have_func("BN_rand_range")
+have_func("BN_pseudo_rand_range")
have_func("CONF_get1_default_config_file")
if try_cpp("#define FOO(a, ...) foo(a, ##__VA_ARGS__)\n")
$defs.push("-DHAVE_VA_ARGS_MACRO")
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index 92b43bd5d18..c59d809bae2 100644
--- a/ext/openssl/ossl_bn.c
+++ b/ext/openssl/ossl_bn.c
@@ -472,8 +472,25 @@ BIGNUM_RAND(pseudo_rand);
WrapBN(klass, obj, result); \
return obj; \
}
+
+#define BIGNUM_RAND_RANGE_NOT_IMPL(func) \
+ static VALUE \
+ ossl_bn_s_##func##_range(VALUE klass, VALUE range) \
+ { \
+ rb_notimplement(); \
+ }
+
+#if defined(HAVE_BN_RAND_RANGE)
BIGNUM_RAND_RANGE(rand);
+#else
+BIGNUM_RAND_RANGE_NOT_IMPL(rand);
+#endif
+
+#if defined(HAVE_BN_PSEUDO_RAND_RANGE)
BIGNUM_RAND_RANGE(pseudo_rand);
+#else
+BIGNUM_RAND_RANGE_NOT_IMPL(pseudo_rand);
+#endif
static VALUE
ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index e8efdf4b69d..c612eb43ff9 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -226,7 +226,7 @@ ossl_pkcs7_s_encrypt(int argc, VALUE *argv, VALUE klass)
BIO_free(in);
rb_jump_tag(status);
}
- if(!(p7 = PKCS7_encrypt(x509s, in, ciph, flg))){
+ if(!(p7 = PKCS7_encrypt(x509s, in, (EVP_CIPHER*)ciph, flg))){
BIO_free(in);
sk_X509_pop_free(x509s, X509_free);
ossl_raise(ePKCS7Error, NULL);
@@ -665,7 +665,7 @@ ossl_pkcs7si_initialize(VALUE self, VALUE cert, VALUE key, VALUE digest)
pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
x509 = GetX509CertPtr(cert); /* NO NEED TO DUP */
md = GetDigestPtr(digest);
- if (!(PKCS7_SIGNER_INFO_set(p7si, x509, pkey, md))) {
+ if (!(PKCS7_SIGNER_INFO_set(p7si, x509, pkey, (EVP_MD*)md))) {
ossl_raise(ePKCS7Error, NULL);
}