Skip to content

Commit 1d2a2df

Browse files
moved BN#to_bn to ruby
1 parent dc9aa0f commit 1d2a2df

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

ext/openssl/ossl_bn.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,6 @@ ossl_bn_to_i(VALUE self)
388388
return num;
389389
}
390390

391-
static VALUE
392-
ossl_bn_to_bn(VALUE self)
393-
{
394-
return self;
395-
}
396-
397391
static VALUE
398392
ossl_bn_coerce(VALUE self, VALUE other)
399393
{
@@ -1328,7 +1322,6 @@ Init_ossl_bn(void)
13281322
rb_define_method(cBN, "to_s", ossl_bn_to_s, -1);
13291323
rb_define_method(cBN, "to_i", ossl_bn_to_i, 0);
13301324
rb_define_alias(cBN, "to_int", "to_i");
1331-
rb_define_method(cBN, "to_bn", ossl_bn_to_bn, 0);
13321325
rb_define_method(cBN, "coerce", ossl_bn_coerce, 1);
13331326

13341327
/*

lib/openssl/bn.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ def pretty_print(q)
2323
q.text to_i.to_s
2424
}
2525
end
26+
27+
def to_bn
28+
self
29+
end
2630
end # BN
2731
end # OpenSSL
2832

@@ -35,6 +39,6 @@ class Integer
3539
#
3640
# See `man bn` for more info.
3741
def to_bn
38-
OpenSSL::BN::new(self)
42+
OpenSSL::BN.new(self)
3943
end
4044
end # Integer

0 commit comments

Comments
 (0)