End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
OpenSSL::BN#/
bn1 / bn2 => [result, remainder]
ext/openssl/ossl_bn.c
View on GitHub ↗
static VALUE
ossl_bn_div(VALUE self, VALUE other)
{
BIGNUM *bn1, *bn2 = GetBNPtr(other), *r1, *r2;
VALUE klass, obj1, obj2;
GetBN(self, bn1);
klass = rb_obj_class(self);
obj1 = NewBN(klass);
obj2 = NewBN(klass);
if (!(r1 = BN_new())) {
ossl_raise(eBNError, NULL);
}
if (!(r2 = BN_new())) {
BN_free(r1);
ossl_raise(eBNError, NULL);
}
if (!BN_div(r1, r2, bn1, bn2, ossl_bn_ctx)) {
BN_free(r1);
BN_free(r2);
ossl_raise(eBNError, NULL);
}
SetBN(obj1, r1);
SetBN(obj2, r2);
return rb_ary_new3(2, obj1, obj2);
}
Division of OpenSSL::BN instances