1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/openssl/extconf.rb: add check for BN_rand_range() and

BN_pseudo_rand_range().

* ext/openssl/ossl_bn.c (ossl_bn_s_rand_range): should raise
  NotImplementedError if BN_rand_range() wan not defined.

* ext/openssl/ossl_bn.c (ossl_bn_s_pseudo_rand_range): should raise
  NotImplementedError if BN_pseudo_rand_range() wan not defined.

* ext/openssl/ossl_pkcs7.c (ossl_pkcs7_s_encrypt): avoid compiler
  warning for OpenSSL-0.9.6.

* ext/openssl/ossl_pkcs7.c (ossl_pkcs7si_initialize): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
gotoyuzo 2003-07-25 06:50:55 +00:00
parent e4bbe657dc
commit b35031495a
4 changed files with 37 additions and 2 deletions

View file

@ -1,3 +1,19 @@
Fri Jul 25 15:47:39 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/extconf.rb: add check for BN_rand_range() and
BN_pseudo_rand_range().
* ext/openssl/ossl_bn.c (ossl_bn_s_rand_range): should raise
NotImplementedError if BN_rand_range() wan not defined.
* ext/openssl/ossl_bn.c (ossl_bn_s_pseudo_rand_range): should raise
NotImplementedError if BN_pseudo_rand_range() wan not defined.
* ext/openssl/ossl_pkcs7.c (ossl_pkcs7_s_encrypt): avoid compiler
warning for OpenSSL-0.9.6.
* ext/openssl/ossl_pkcs7.c (ossl_pkcs7si_initialize): ditto.
Fri Jul 25 14:34:55 2003 Yukihiro Matsumoto <matz@ruby-lang.org> Fri Jul 25 14:34:55 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/socket/socket.c (tcp_s_gethostbyname): was using * ext/socket/socket.c (tcp_s_gethostbyname): was using

View file

@ -100,6 +100,8 @@ have_func("CONF_get1_default_config_file")
have_func("BN_mod_sqr") have_func("BN_mod_sqr")
have_func("BN_mod_add") have_func("BN_mod_add")
have_func("BN_mod_sub") have_func("BN_mod_sub")
have_func("BN_rand_range")
have_func("BN_pseudo_rand_range")
have_func("CONF_get1_default_config_file") have_func("CONF_get1_default_config_file")
if try_cpp("#define FOO(a, ...) foo(a, ##__VA_ARGS__)\n") if try_cpp("#define FOO(a, ...) foo(a, ##__VA_ARGS__)\n")
$defs.push("-DHAVE_VA_ARGS_MACRO") $defs.push("-DHAVE_VA_ARGS_MACRO")

View file

@ -472,8 +472,25 @@ BIGNUM_RAND(pseudo_rand);
WrapBN(klass, obj, result); \ WrapBN(klass, obj, result); \
return obj; \ 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); BIGNUM_RAND_RANGE(rand);
#else
BIGNUM_RAND_RANGE_NOT_IMPL(rand);
#endif
#if defined(HAVE_BN_PSEUDO_RAND_RANGE)
BIGNUM_RAND_RANGE(pseudo_rand); BIGNUM_RAND_RANGE(pseudo_rand);
#else
BIGNUM_RAND_RANGE_NOT_IMPL(pseudo_rand);
#endif
static VALUE static VALUE
ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass) ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)

View file

@ -226,7 +226,7 @@ ossl_pkcs7_s_encrypt(int argc, VALUE *argv, VALUE klass)
BIO_free(in); BIO_free(in);
rb_jump_tag(status); 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); BIO_free(in);
sk_X509_pop_free(x509s, X509_free); sk_X509_pop_free(x509s, X509_free);
ossl_raise(ePKCS7Error, NULL); 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 */ pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
x509 = GetX509CertPtr(cert); /* NO NEED TO DUP */ x509 = GetX509CertPtr(cert); /* NO NEED TO DUP */
md = GetDigestPtr(digest); 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); ossl_raise(ePKCS7Error, NULL);
} }