Project

General

Profile

Bug #4344 ยป fix_bn_cmp.diff

MartinBosslet (Martin Bosslet), 01/30/2011 03:19 AM

View differences:

ruby/ext/openssl/ossl_bn.c (working copy)
GetBN(obj, bn);
} else switch (TYPE(obj)) {
case T_FIXNUM:
case T_BIGNUM:
obj = rb_String(obj);
if (!BN_dec2bn(&bn, StringValuePtr(obj))) {
ossl_raise(eBNError, NULL);
}
WrapBN(cBN, obj, bn); /* Handle potencial mem leaks */
break;
case T_NIL:
break;
default:
ossl_raise(rb_eTypeError, "Cannot convert into OpenSSL::BN");
}
ruby/test/openssl/test_bn.rb (working copy)
OpenSSL::BN.new((2 ** 107 - 1).to_s(16), 16).prime?
OpenSSL::BN.new((2 ** 127 - 1).to_s(16), 16).prime?(1)
end
def test_cmp_nil
bn = OpenSSL::BN.new('1')
bn == nil
bn != nil
end
end
end
    (1-1/1)