Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ext/openssl/ossl_asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ asn1str_to_str(const ASN1_STRING *str)
ASN1_STRING_length(str));
}

static VALUE
ossl_bn_new_wrap_i(VALUE arg)
{
return ossl_bn_new((BIGNUM *)arg);
}

/*
* ASN1_INTEGER conversions
*/
Expand All @@ -126,6 +132,7 @@ asn1integer_to_num(const ASN1_INTEGER *ai)
{
BIGNUM *bn;
VALUE num;
int st = 0;

if (!ai) {
ossl_raise(rb_eTypeError, "ASN1_INTEGER is NULL!");
Expand All @@ -137,9 +144,11 @@ asn1integer_to_num(const ASN1_INTEGER *ai)

if (!bn)
ossl_raise(eOSSLError, NULL);
num = ossl_bn_new(bn);
num = rb_protect(ossl_bn_new_wrap_i, (VALUE)bn, &st);
BN_free(bn);

if (st) rb_jump_tag(st);

return num;
}

Expand Down