Project

General

Profile

Bug #4325 ยป fix_cons_encode_inf.diff

MartinBosslet (Martin Bosslet), 01/26/2011 09:46 AM

View differences:

ruby/ext/openssl/ossl_asn1.c (working copy)
int found_prim = 0;
long seq_len, length;
unsigned char *p;
VALUE value, str, inf_length, ary, example;
VALUE value, str, inf_length, ary, example = Qnil;
tn = NUM2INT(ossl_asn1_get_tag(self));
tc = ossl_asn1_tag_class(self);
inf_length = ossl_asn1_get_infinite_length(self);
if (inf_length == Qtrue) {
constructed = 2;
if (CLASS_OF(self) == cASN1Sequence ||
CLASS_OF(self) == cASN1Set) {
if (rb_obj_is_kind_of(self, cASN1Sequence) ||
rb_obj_is_kind_of(self, cASN1Set)){
tag = ossl_asn1_default_tag(self);
}
else { /*BIT_STRING OR OCTET_STRING*/
else { /*must be a constructive encoding of a primitive value*/
if (!rb_obj_is_kind_of(self, cASN1Constructive)){
ossl_raise(eASN1Error, "invalid constructed encoding");
return Qnil; /* dummy */
}
ary = ossl_asn1_get_value(self);
/* Recursively descend until a primitive value is found.
The overall value of the entire constructed encoding
ruby/test/openssl/test_asn1.rb (working copy)
end
end
def test_encode_subclass_sequence
sub = Class.new(OpenSSL::ASN1::Sequence)
instance = sub.new([OpenSSL::ASN1::EndOfContent.new])
instance.infinite_length = true
puts instance.to_der
end
def test_encode_subclass_set
sub = Class.new(OpenSSL::ASN1::Set)
instance = sub.new([OpenSSL::ASN1::EndOfContent.new])
instance.infinite_length = true
puts instance.to_der
end
end if defined?(OpenSSL)
    (1-1/1)