@ -166,18 +166,16 @@ static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
char opt , ASN1_TLC * ctx , int depth )
{
const ASN1_TEMPLATE * tt , * errtt = NULL ;
const ASN1_COMPAT_FUNCS * cf ;
const ASN1_EXTERN_FUNCS * ef ;
const ASN1_AUX * aux = it - > funcs ;
ASN1_aux_cb * asn1_cb ;
const unsigned char * p = NULL , * q ;
unsigned char * wp = NULL ; /* BIG FAT WARNING! BREAKS CONST WHERE USED */
unsigned char imphack = 0 , oclass ;
unsigned char oclass ;
char seq_eoc , seq_nolen , cst , isopt ;
int i ;
int otag ;
int ret = 0 ;
ASN1_VALUE * * pchptr , * ptmpval ;
ASN1_VALUE * * pchptr ;
int combine = aclass & ASN1_TFLG_COMBINE ;
aclass & = ~ ASN1_TFLG_COMBINE ;
if ( ! pval )
@ -254,66 +252,6 @@ static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
ef = it - > funcs ;
return ef - > asn1_ex_d2i ( pval , in , len , it , tag , aclass , opt , ctx ) ;
case ASN1_ITYPE_COMPAT :
/* we must resort to old style evil hackery */
cf = it - > funcs ;
/* If OPTIONAL see if it is there */
if ( opt ) {
int exptag ;
p = * in ;
if ( tag = = - 1 )
exptag = it - > utype ;
else
exptag = tag ;
/*
* Don ' t care about anything other than presence of expected tag
*/
ret = asn1_check_tlen ( NULL , NULL , NULL , NULL , NULL ,
& p , len , exptag , aclass , 1 , ctx ) ;
if ( ! ret ) {
OPENSSL_PUT_ERROR ( ASN1 , ASN1_R_NESTED_ASN1_ERROR ) ;
goto err ;
}
if ( ret = = - 1 )
return - 1 ;
}
/*
* This is the old style evil hack IMPLICIT handling : since the
* underlying code is expecting a tag and class other than the one
* present we change the buffer temporarily then change it back
* afterwards . This doesn ' t and never did work for tags > 30. Yes
* this is * horrible * but it is only needed for old style d2i which
* will hopefully not be around for much longer . FIXME : should copy
* the buffer then modify it so the input buffer can be const : we
* should * always * copy because the old style d2i might modify the
* buffer .
*/
if ( tag ! = - 1 ) {
wp = * ( unsigned char * * ) in ;
imphack = * wp ;
if ( p = = NULL ) {
OPENSSL_PUT_ERROR ( ASN1 , ASN1_R_NESTED_ASN1_ERROR ) ;
goto err ;
}
* wp = ( unsigned char ) ( ( * p & V_ASN1_CONSTRUCTED )
| it - > utype ) ;
}
ptmpval = cf - > asn1_d2i ( pval , in , len ) ;
if ( tag ! = - 1 )
* wp = imphack ;
if ( ptmpval )
return 1 ;
OPENSSL_PUT_ERROR ( ASN1 , ASN1_R_NESTED_ASN1_ERROR ) ;
goto err ;
case ASN1_ITYPE_CHOICE :
if ( asn1_cb & & ! asn1_cb ( ASN1_OP_D2I_PRE , pval , it , NULL ) )
goto auxerr ;