Skip to content

Fix for ASN1::Constructive 'each' implementation #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 29, 2016
Merged
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
2 changes: 1 addition & 1 deletion ext/openssl/ossl_asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ ossl_asn1cons_to_der(VALUE self)
static VALUE
ossl_asn1cons_each(VALUE self)
{
rb_funcall(ossl_asn1_get_value(self), id_each, 0);
rb_block_call(ossl_asn1_get_value(self), id_each, 0, 0, 0, 0);

return self;
}
Expand Down
7 changes: 7 additions & 0 deletions test/test_asn1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,13 @@ def test_decode_constructed_overread
assert_equal 17, ret[0][6]
end

def test_constructive_each
data = [OpenSSL::ASN1::Integer.new(0), OpenSSL::ASN1::Integer.new(1)]
seq = OpenSSL::ASN1::Sequence.new data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'data' should be an array of OpenSSL::ASN1::ASN1Data instances rather than of String.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, stupid mistake on my part. Should be fixed now.


assert_equal data, seq.entries
end

private

def assert_universal(tag, asn1)
Expand Down