1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/openssl/ossl_asn1.c (ossl_asn1_initialize): Allow creation of

Constructives with an explicit tag_class parameter without
automatically setting tagging to :EXPLICIT. Fixes a bug when encoding
infinite length primitive values.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
emboss 2011-05-22 19:38:05 +00:00
parent efd99b781b
commit 2cf8b26bf8
2 changed files with 16 additions and 7 deletions

View file

@ -1,3 +1,10 @@
Mon May 23 04:03:46 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* ext/openssl/ossl_asn1.c (ossl_asn1_initialize): Allow creation of
Constructives with an explicit tag_class parameter without
automatically setting tagging to :EXPLICIT. Fixes a bug when encoding
infinite length primitive values.
Mon May 23 04:03:46 2011 Martin Bosslet <Martin.Bosslet@googlemail.com> Mon May 23 04:03:46 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* ext/openssl/ossl_asn1.c (ossl_asn1_cons_to_der): Add an additional * ext/openssl/ossl_asn1.c (ossl_asn1_cons_to_der): Add an additional

View file

@ -1011,12 +1011,14 @@ ossl_asn1_initialize(int argc, VALUE *argv, VALUE self)
if(argc > 1){ if(argc > 1){
if(NIL_P(tag)) if(NIL_P(tag))
ossl_raise(eASN1Error, "must specify tag number"); ossl_raise(eASN1Error, "must specify tag number");
if(NIL_P(tagging)) if(!NIL_P(tagging) && !SYMBOL_P(tagging))
tagging = ID2SYM(sEXPLICIT); ossl_raise(eASN1Error, "invalid tagging method");
if(!SYMBOL_P(tagging)) if(NIL_P(tag_class)) {
ossl_raise(eASN1Error, "invalid tag default"); if (NIL_P(tagging))
if(NIL_P(tag_class)) tag_class = ID2SYM(sUNIVERSAL);
tag_class = ID2SYM(sCONTEXT_SPECIFIC); else
tag_class = ID2SYM(sCONTEXT_SPECIFIC);
}
if(!SYMBOL_P(tag_class)) if(!SYMBOL_P(tag_class))
ossl_raise(eASN1Error, "invalid tag class"); ossl_raise(eASN1Error, "invalid tag class");
if(SYM2ID(tagging) == sIMPLICIT && NUM2INT(tag) > 31) if(SYM2ID(tagging) == sIMPLICIT && NUM2INT(tag) > 31)
@ -1024,7 +1026,7 @@ ossl_asn1_initialize(int argc, VALUE *argv, VALUE self)
} }
else{ else{
tag = INT2NUM(ossl_asn1_default_tag(self)); tag = INT2NUM(ossl_asn1_default_tag(self));
tagging = Qnil; tagging = Qnil;
tag_class = ID2SYM(sUNIVERSAL); tag_class = ID2SYM(sUNIVERSAL);
} }
ossl_asn1_set_tag(self, tag); ossl_asn1_set_tag(self, tag);