[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
libtasn1 relaxig asn1_der_decoding() size test
From: |
Karel Slany |
Subject: |
libtasn1 relaxig asn1_der_decoding() size test |
Date: |
Thu, 19 Jun 2014 17:04:54 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
Hello,
I've run into a problem with asn1_der_decoding() recently. I have to
decode some DER data which I'm obtaining from a third party source. The
problem is that most of the time the obtained DER data contain some
additional trailing bytes.
The function
asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
char *errorDescription)
, as it is implemented now, expects @ider to have the exact length of
@ider_len. But in my case, @ider_len is slightly larger because of the
aforementioned padding. This causes the whole function to end with
ASN1_DER_ERROR even though the supplied DER was properly parsed.
A solution to my this problem may be:
* relaxing the test at the end of the function (example in the supplied
patch)
* introducing a new function witch such properties (this function could
also give a hint about the real DER size)
* adding a flag to asn1_der_decoding() whether the function should
perform a strict size test (this would break backward compatibility)
My personal favourite is the second choice. Please let me know whether
you are willing to accept any of these changes/enhancements. If so, I
could send you a patch with the changes.
Best regards,
Karel.
relax_decoding_test.diff
Description: Text Data
- libtasn1 relaxig asn1_der_decoding() size test,
Karel Slany <=