-
Notifications
You must be signed in to change notification settings - Fork 167
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
asn1: a bunch of bugfixes and test improvements #98
Commits on Jun 30, 2017
-
asn1: infinite length -> indefinite length
Replace all occurrences of 'infinite' with 'inDEfinite'. Accessor methods OpenSSL::ASN1::ASN1Data#infinite_length and #infinite_length= are kept as alias for backwards compatibility.
Configuration menu - View commit details
-
Copy full SHA for 570f43e - Browse repository at this point
Copy the full SHA 570f43eView commit details -
Improve test coverage of OpenSSL::ASN1. Add more BER encode/decode tests, while reducing redundant assertions.
Configuration menu - View commit details
-
Copy full SHA for ba33960 - Browse repository at this point
Copy the full SHA ba33960View commit details
Commits on Jul 23, 2017
-
Configuration menu - View commit details
-
Copy full SHA for 8a80e34 - Browse repository at this point
Copy the full SHA 8a80e34View commit details -
asn1: require tag information when instantiating generic type
Improve the error message of the exception raised when OpenSSL::ASN1::Primitive.new or OpenSSL::ASN1::Constructive.new is called with one argument (which is wrong).
Configuration menu - View commit details
-
Copy full SHA for e696490 - Browse repository at this point
Copy the full SHA e696490View commit details -
asn1: initialize 'unused_bits' attribute of BitString with 0
Fix the initial value of 'unused_bits' attribute of OpenSSL::ASN1::BitString. The attribute must always contain an Integer in the range 0 to 7.
Configuration menu - View commit details
-
Copy full SHA for 7df19c3 - Browse repository at this point
Copy the full SHA 7df19c3View commit details -
asn1: check for illegal 'unused_bits' value of BitString
Invalid values such as nil or values not in the range 0 to 7 are silently coerced into the valid range. This behavior is confusing and hides user bugs. Raise an exception instead if an illegal value is specified.
Configuration menu - View commit details
-
Copy full SHA for e61502f - Browse repository at this point
Copy the full SHA e61502fView commit details -
asn1: disallow NULL to be passed to asn1time_to_time()
Let the callers check the validity of the ASN1_TIME.
Configuration menu - View commit details
-
Copy full SHA for f61af66 - Browse repository at this point
Copy the full SHA f61af66View commit details -
asn1: avoid truncating OID in OpenSSL::ASN1::ObjectId#oid
OpenSSL::ASN1::ObjectId#oid, which returns the dotted representation of the OID, is silently truncating the result if it overflows the 128-bytes buffer. Although it normally won't be more than 127-characters, it'd be better to avoid. This can be done by checking the return value of OBJ_obj2txt(). Previous releases of LibreSSL (< 2.5.1) have a bug in OBJ_obj2txt() and it does not work if the resulting string would be larger than the buffer. A workaround is added to the test. It should be removed when we deprecate support for LibreSSL 2.4.
Configuration menu - View commit details
-
Copy full SHA for af895bc - Browse repository at this point
Copy the full SHA af895bcView commit details -
asn1: allow constructed encoding with definite length form
Constructed encoding can use the definite length form as well as the indefinite length form, regardless of the tag number.
Configuration menu - View commit details
-
Copy full SHA for 400d9ca - Browse repository at this point
Copy the full SHA 400d9caView commit details -
asn1: prohibit indefinite length form for primitive encoding
The setter method #indefinite_length= for OpenSSL::ASN1::Primitive is undef-ed, but we can still set 'indefinite_length' to true illegally when constructing an object with the raw OpenSSL::ASN1::ASN1Data. Indefinite length form is not possible in primitive encoding. Raise an exception in OpenSSL::ASN1::ASN1Data#to_der if specified.
Configuration menu - View commit details
-
Copy full SHA for a2b32a4 - Browse repository at this point
Copy the full SHA a2b32a4View commit details -
asn1: allow tag number to be >= 32 for universal tag class
There are actually high-tag universal types such as the time-of-day type.
Configuration menu - View commit details
-
Copy full SHA for 22a944f - Browse repository at this point
Copy the full SHA 22a944fView commit details -
Use ossl_asn1_tag() instead of the combination of ossl_asn1_get_tag() and NUM2INT().
Configuration menu - View commit details
-
Copy full SHA for 3effe62 - Browse repository at this point
Copy the full SHA 3effe62View commit details -
asn1: clean up OpenSSL::ASN1::Constructive#to_der
Remove a mysterious behavior in Constructive#to_der: if the 'tagging' attribute is set to :EXPLICIT and it is not an instance of universal tag class classes, it "searches" the original tag from the first value whose encoding is primitive. ary = [ OpenSSL::ASN1.Sequence([ OpenSSL::ASN1.OctetString("abc") ]) ] cons = OpenSSL::ASN1::Constructive.new(ary, 1, :EXPLICIT) cons.to_der #=> "\xA1\x09\x24\x07\x30\x05\x04\x03\x61\x62\x63" # ^ # This 4 comes from the OctetString This is really confusing and nobody seems to be using this behavior. Let's make it raise error instead.
Configuration menu - View commit details
-
Copy full SHA for 3fde14b - Browse repository at this point
Copy the full SHA 3fde14bView commit details -
asn1: harmonize OpenSSL::ASN1::*#to_der
Extract the common paths for code reduction.
Configuration menu - View commit details
-
Copy full SHA for 27e4bad - Browse repository at this point
Copy the full SHA 27e4badView commit details -
asn1: prevent EOC octets from being in the middle of the content
Encoding with indefinite length form produces an invalid encoding if the contents array contains an EOC object in the middle. Raise an exception in that case.
Configuration menu - View commit details
-
Copy full SHA for 1d202b0 - Browse repository at this point
Copy the full SHA 1d202b0View commit details -
asn1: do not treat EOC octets as part of content octets
We currently treat end-of-contents octets as a BER encoding of a value whose tag is universal class and the number is zero, and require users to put one in the end of 'value' array when encoding using indefinite length form. However, the end-of-contents are just a marker indicating the end of the contents and not really part of the contents. Do not require users to put an EOC object in the content when encoding, and don't produce an EOC object when decoding an encoding that uses indefinite length form.
Configuration menu - View commit details
-
Copy full SHA for 6b67c6d - Browse repository at this point
Copy the full SHA 6b67c6dView commit details