summaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_pkey_rsa.c
diff options
context:
space:
mode:
authornaruse <naruse@ruby-lang.org>2012-03-23 02:33:05 +0000
committernaruse <naruse@ruby-lang.org>2012-03-23 02:33:05 +0000
commit476075e3bbcafff0635d2bffa0c29d9954d56d60 (patch)
treed7b11200ff1c8e3a5570a2a7e4e7a4e1c2fa8ba9 /ext/openssl/ossl_pkey_rsa.c
parent6599129b100da32a83565d01a5bb848c7b9983d9 (diff)
downloadruby-openssl-history-476075e3bbcafff0635d2bffa0c29d9954d56d60.tar.gz
Refix Bug #6094: use unsigned long integer literal.
* ext/openssl/ossl_pkey_rsa.c (rsa_generate): fix argument type. [Bug #6094] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_pkey_rsa.c')
-rw-r--r--ext/openssl/ossl_pkey_rsa.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c
index b224cdd..d3d6913 100644
--- a/ext/openssl/ossl_pkey_rsa.c
+++ b/ext/openssl/ossl_pkey_rsa.c
@@ -95,7 +95,7 @@ rsa_blocking_gen(void *arg)
#endif
static RSA *
-rsa_generate(int size, int exp)
+rsa_generate(int size, unsigned long exp)
{
#if defined(HAVE_RSA_GENERATE_KEY_EX) && HAVE_BN_GENCB
int i;
@@ -111,7 +111,7 @@ rsa_generate(int size, int exp)
return 0;
}
for (i = 0; i < (int)sizeof(exp) * 8; ++i) {
- if (exp & (1 << i)) {
+ if (exp & (1UL << i)) {
if (BN_set_bit(e, i) == 0) {
BN_free(e);
RSA_free(rsa);
@@ -168,7 +168,7 @@ ossl_rsa_s_generate(int argc, VALUE *argv, VALUE klass)
rb_scan_args(argc, argv, "11", &size, &exp);
- rsa = rsa_generate(NUM2INT(size), NIL_P(exp) ? RSA_F4 : NUM2INT(exp)); /* err handled by rsa_instance */
+ rsa = rsa_generate(NUM2INT(size), NIL_P(exp) ? RSA_F4 : NUM2ULONG(exp)); /* err handled by rsa_instance */
obj = rsa_instance(klass, rsa);
if (obj == Qfalse) {
@@ -213,7 +213,7 @@ ossl_rsa_initialize(int argc, VALUE *argv, VALUE self)
rsa = RSA_new();
}
else if (FIXNUM_P(arg)) {
- rsa = rsa_generate(FIX2INT(arg), NIL_P(pass) ? RSA_F4 : NUM2INT(pass));
+ rsa = rsa_generate(FIX2INT(arg), NIL_P(pass) ? RSA_F4 : NUM2ULONG(pass));
if (!rsa) ossl_raise(eRSAError, NULL);
}
else {