- Added an EXPLICIT tag number parameter to x509_get_ext()

This commit is contained in:
Paul Bakker 2011-10-12 09:56:41 +00:00
parent 3329d1f805
commit fbc09f3cb6
2 changed files with 7 additions and 5 deletions

View file

@ -14,6 +14,7 @@ Changes
* Fixed rsa_encrypt and rsa_decrypt examples to use public key for
encryption and private key for decryption. (Closes ticket #34)
* Inceased maximum size of ASN1 length reads to 32-bits.
* Added an EXPLICIT tag number parameter to x509_get_ext()
Bugfix
* Fixed faulty HMAC-MD2 implementation. Found by dibac. (Closes

View file

@ -756,7 +756,7 @@ static int x509_get_uid( unsigned char **p,
*/
static int x509_get_ext( unsigned char **p,
const unsigned char *end,
x509_buf *ext )
x509_buf *ext, int tag )
{
int ret;
size_t len;
@ -767,7 +767,7 @@ static int x509_get_ext( unsigned char **p,
ext->tag = **p;
if( ( ret = asn1_get_tag( p, end, &ext->len,
ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 3 ) ) != 0 )
ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | tag ) ) != 0 )
return( ret );
ext->p = *p;
@ -800,9 +800,10 @@ static int x509_get_crl_ext( unsigned char **p,
x509_buf *ext )
{
int ret;
size_t len;
size_t len = 0;
if( ( ret = x509_get_ext( p, end, ext ) ) != 0 )
/* Get explicit tag */
if( ( ret = x509_get_ext( p, end, ext, 0) ) != 0 )
{
if( ret == POLARSSL_ERR_ASN1_UNEXPECTED_TAG )
return( 0 );
@ -951,7 +952,7 @@ static int x509_get_crt_ext( unsigned char **p,
size_t len;
unsigned char *end_ext_data, *end_ext_octet;
if( ( ret = x509_get_ext( p, end, &crt->v3_ext ) ) != 0 )
if( ( ret = x509_get_ext( p, end, &crt->v3_ext, 3 ) ) != 0 )
{
if( ret == POLARSSL_ERR_ASN1_UNEXPECTED_TAG )
return( 0 );