Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions lib/openssl/bn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ def pretty_print(q)
q.text to_i.to_s
}
end

def marshal_dump # :nodoc:
to_i
end

def marshal_load(integer) # :nodoc:
initialize(integer)
end
Comment on lines +31 to +33
end # BN
end # OpenSSL

Expand Down
8 changes: 8 additions & 0 deletions test/openssl/test_bn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ def test_comparison
assert_instance_of(String, @e1.hash.to_s)
end

def test_marshal
assert_equal(@e1, Marshal.load(Marshal.dump(@e1)))
assert_equal(@e2, Marshal.load(Marshal.dump(@e2)))

obj = Marshal.load("\x04\x08U:\x10OpenSSL::BNi\xfe\x01\x00")
assert_equal(-0xffff, obj)
Comment on lines +319 to +323
end

def test_argument_error
bug15760 = '[ruby-core:92231] [Bug #15760]'
assert_raise(ArgumentError, bug15760) { OpenSSL::BN.new(nil, 2) }
Expand Down
Loading