Home | History | Annotate | Line # | Download | only in comp_match
      1  1.2  christos /*	$NetBSD: crl.c,v 1.2 2021/08/14 16:14:51 christos Exp $	*/
      2  1.2  christos 
      3  1.1     lukem /*
      4  1.1     lukem  *    crl.c
      5  1.1     lukem  *    "CertificateRevokationList" ASN.1 module encode/decode/extracting/matching/free C src.
      6  1.1     lukem  *    This file was generated by modified eSMACC compiler Fri Jan 21 11:25:24 2005
      7  1.1     lukem  *    The generated files are supposed to be compiled as a module for OpenLDAP Software
      8  1.1     lukem  */
      9  1.1     lukem 
     10  1.1     lukem #include "crl.h"
     11  1.1     lukem 
     12  1.1     lukem BDecComponentCertificateListTop( void* mem_op, GenBuf* b, void *v, AsnLen* bytesDecoded,int mode) {
     13  1.1     lukem 	AsnTag tag;
     14  1.1     lukem 	AsnLen elmtLen;
     15  1.1     lukem 
     16  1.1     lukem 	tag = BDecTag ( b, bytesDecoded );
     17  1.1     lukem 	elmtLen = BDecLen ( b, bytesDecoded );
     18  1.1     lukem 	if ( elmtLen <= 0 ) return (-1);
     19  1.1     lukem 	if ( tag != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE) ) {
     20  1.1     lukem 		return (-1);
     21  1.1     lukem 	}
     22  1.1     lukem 
     23  1.1     lukem 	return BDecComponentCertificateList( mem_op, b, tag, elmtLen, ( ComponentCertificateList**)v, (AsnLen*)bytesDecoded, mode );
     24  1.1     lukem }
     25  1.1     lukem 
     26  1.1     lukem 
     27  1.1     lukem void init_module_CertificateRevokationList() {
     28  1.1     lukem 	InstallOidDecoderMapping( "2.5.4.39", NULL,
     29  1.1     lukem 		GDecComponentCertificateList,
     30  1.1     lukem 		BDecComponentCertificateListTop,
     31  1.1     lukem 		ExtractingComponentCertificateList,
     32  1.1     lukem 		MatchingComponentCertificateList);
     33  1.1     lukem }
     34  1.1     lukem 
     35  1.1     lukem int
     36  1.1     lukem MatchingComponentTBSCertListSeqOfSeq ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
     37  1.1     lukem 	int rc;
     38  1.1     lukem 	MatchingRule* mr;
     39  1.1     lukem 
     40  1.1     lukem 	if ( oid ) {
     41  1.1     lukem 		mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
     42  1.1     lukem 		if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
     43  1.1     lukem 	}
     44  1.1     lukem 
     45  1.1     lukem 	rc = 1;
     46  1.1     lukem 	rc =	MatchingComponentCertificateSerialNumber ( oid, (ComponentSyntaxInfo*)&((ComponentTBSCertListSeqOfSeq*)csi_attr)->userCertificate, (ComponentSyntaxInfo*)&((ComponentTBSCertListSeqOfSeq*)csi_assert)->userCertificate );
     47  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
     48  1.1     lukem 		return rc;
     49  1.1     lukem 	rc =	MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_attr)->revocationDate, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_assert)->revocationDate );
     50  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
     51  1.1     lukem 		return rc;
     52  1.1     lukem 	if(COMPONENTNOT_NULL( ((ComponentTBSCertListSeqOfSeq*)csi_attr)->crlEntryExtensions ) ) {
     53  1.1     lukem 	rc =	MatchingComponentExtensions ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_attr)->crlEntryExtensions, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_assert)->crlEntryExtensions );
     54  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
     55  1.1     lukem 		return rc;
     56  1.1     lukem 	}
     57  1.1     lukem 	return LDAP_COMPARE_TRUE;
     58  1.1     lukem }  /* BMatchingComponentTBSCertListSeqOfSeq */
     59  1.1     lukem 
     60  1.1     lukem void*
     61  1.1     lukem ExtractingComponentTBSCertListSeqOfSeq ( void* mem_op, ComponentReference* cr, ComponentTBSCertListSeqOfSeq *comp )
     62  1.1     lukem {
     63  1.1     lukem 
     64  1.1     lukem 	if ( ( comp->userCertificate.identifier.bv_val && strncmp(comp->userCertificate.identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->userCertificate.id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
     65  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
     66  1.1     lukem 		return &comp->userCertificate;
     67  1.1     lukem 		else
     68  1.1     lukem 		return NULL;
     69  1.1     lukem 	}
     70  1.1     lukem 	if ( ( comp->revocationDate->identifier.bv_val && strncmp(comp->revocationDate->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->revocationDate->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
     71  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
     72  1.1     lukem 			return comp->revocationDate;
     73  1.1     lukem 		else {
     74  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
     75  1.1     lukem 			return 	ExtractingComponentTime ( mem_op, cr, comp->revocationDate );
     76  1.1     lukem 		}
     77  1.1     lukem 	}
     78  1.1     lukem 	if ( ( comp->crlEntryExtensions->identifier.bv_val && strncmp(comp->crlEntryExtensions->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->crlEntryExtensions->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
     79  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
     80  1.1     lukem 			return comp->crlEntryExtensions;
     81  1.1     lukem 		else {
     82  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
     83  1.1     lukem 			return 	ExtractingComponentExtensions ( mem_op, cr, comp->crlEntryExtensions );
     84  1.1     lukem 		}
     85  1.1     lukem 	}
     86  1.1     lukem 	return NULL;
     87  1.1     lukem }  /* ExtractingComponentTBSCertListSeqOfSeq */
     88  1.1     lukem 
     89  1.1     lukem int
     90  1.1     lukem BDecComponentTBSCertListSeqOfSeq PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
     91  1.1     lukem void* mem_op _AND_
     92  1.1     lukem GenBuf * b _AND_
     93  1.1     lukem AsnTag tagId0 _AND_
     94  1.1     lukem AsnLen elmtLen0 _AND_
     95  1.1     lukem ComponentTBSCertListSeqOfSeq **v _AND_
     96  1.1     lukem AsnLen *bytesDecoded _AND_
     97  1.1     lukem int mode)
     98  1.1     lukem {
     99  1.1     lukem 	int seqDone = FALSE;
    100  1.1     lukem 	AsnLen totalElmtsLen1 = 0;
    101  1.1     lukem 	AsnLen elmtLen1;
    102  1.1     lukem 	AsnTag tagId1;
    103  1.1     lukem 	int mandatoryElmtCount1 = 0;
    104  1.1     lukem 	AsnLen totalElmtsLen2 = 0;
    105  1.1     lukem 	AsnLen elmtLen2;
    106  1.1     lukem 	AsnTag tagId2;
    107  1.1     lukem 	int old_mode = mode;
    108  1.1     lukem 	int rc;
    109  1.1     lukem 	ComponentTBSCertListSeqOfSeq *k, *t, c_temp;
    110  1.1     lukem 
    111  1.1     lukem 
    112  1.1     lukem 	if ( !(mode & DEC_ALLOC_MODE_1) ) {
    113  1.1     lukem 		memset(&c_temp,0,sizeof(c_temp));
    114  1.1     lukem 		 k = &c_temp;
    115  1.1     lukem 	} else
    116  1.1     lukem 		 k = t = *v;
    117  1.1     lukem 	mode = DEC_ALLOC_MODE_2;
    118  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1 );
    119  1.1     lukem 
    120  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))))
    121  1.1     lukem     {
    122  1.1     lukem     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    123  1.1     lukem 	rc = BDecComponentCertificateSerialNumber (mem_op, b, tagId1, elmtLen1, (&k->userCertificate), &totalElmtsLen1, mode);
    124  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    125  1.1     lukem 		(&k->userCertificate)->identifier.bv_val = (&k->userCertificate)->id_buf;
    126  1.1     lukem 		(&k->userCertificate)->identifier.bv_len = strlen("userCertificate");
    127  1.1     lukem 		strcpy( (&k->userCertificate)->identifier.bv_val, "userCertificate");
    128  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1);
    129  1.1     lukem     }
    130  1.1     lukem     else
    131  1.1     lukem         return -1;
    132  1.1     lukem 
    133  1.1     lukem 
    134  1.1     lukem 
    135  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||
    136  1.1     lukem (tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) ||
    137  1.1     lukem      (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))||
    138  1.1     lukem     (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE))))
    139  1.1     lukem     {
    140  1.1     lukem         elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    141  1.1     lukem 	rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->revocationDate), &totalElmtsLen1, mode);
    142  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    143  1.1     lukem 		(k->revocationDate)->identifier.bv_val = (k->revocationDate)->id_buf;
    144  1.1     lukem 		(k->revocationDate)->identifier.bv_len = strlen("revocationDate");
    145  1.1     lukem 		strcpy( (k->revocationDate)->identifier.bv_val, "revocationDate");
    146  1.1     lukem     if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0))
    147  1.1     lukem         seqDone = TRUE;
    148  1.1     lukem     else
    149  1.1     lukem     {
    150  1.1     lukem         tagId1 = BDecTag (b, &totalElmtsLen1 );
    151  1.1     lukem 
    152  1.1     lukem          if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
    153  1.1     lukem         {
    154  1.1     lukem             BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
    155  1.1     lukem             seqDone = TRUE;
    156  1.1     lukem         }
    157  1.1     lukem     }
    158  1.1     lukem     }
    159  1.1     lukem     else
    160  1.1     lukem         return -1;
    161  1.1     lukem 
    162  1.1     lukem 
    163  1.1     lukem 
    164  1.1     lukem     if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
    165  1.1     lukem     {
    166  1.1     lukem     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    167  1.1     lukem 	rc = BDecComponentExtensions (mem_op, b, tagId1, elmtLen1, (&k->crlEntryExtensions), &totalElmtsLen1, mode);
    168  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    169  1.1     lukem 		(k->crlEntryExtensions)->identifier.bv_val = (k->crlEntryExtensions)->id_buf;
    170  1.1     lukem 		(k->crlEntryExtensions)->identifier.bv_len = strlen("crlEntryExtensions");
    171  1.1     lukem 		strcpy( (k->crlEntryExtensions)->identifier.bv_val, "crlEntryExtensions");
    172  1.1     lukem         seqDone = TRUE;
    173  1.1     lukem         if (elmtLen0 == INDEFINITE_LEN)
    174  1.1     lukem             BDecEoc (b, &totalElmtsLen1 );
    175  1.1     lukem         else if (totalElmtsLen1 != elmtLen0)
    176  1.1     lukem         return -1;
    177  1.1     lukem 
    178  1.1     lukem     }
    179  1.1     lukem 
    180  1.1     lukem 
    181  1.1     lukem     if (!seqDone)
    182  1.1     lukem         return -1;
    183  1.1     lukem 
    184  1.1     lukem 	if( !(old_mode & DEC_ALLOC_MODE_1) ) {
    185  1.1     lukem 	*v = t = (ComponentTBSCertListSeqOfSeq*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOfSeq) );
    186  1.1     lukem 	if ( !t ) return -1;
    187  1.1     lukem 	*t = *k;
    188  1.1     lukem 	}
    189  1.1     lukem 	t->syntax = (Syntax*)NULL;
    190  1.1     lukem 	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
    191  1.1     lukem 	if ( !t->comp_desc ) {
    192  1.1     lukem 		free ( t );
    193  1.1     lukem 		return -1;
    194  1.1     lukem 	}
    195  1.1     lukem 	t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
    196  1.1     lukem 	t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
    197  1.1     lukem 	t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
    198  1.1     lukem 	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOfSeq ;
    199  1.1     lukem 	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOfSeq ;
    200  1.1     lukem 	t->comp_desc->cd_free = (comp_free_func*)NULL;
    201  1.1     lukem 	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOfSeq;
    202  1.1     lukem 	t->comp_desc->cd_type = ASN_COMPOSITE;
    203  1.1     lukem 	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
    204  1.1     lukem 	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOfSeq;
    205  1.1     lukem     (*bytesDecoded) += totalElmtsLen1;
    206  1.1     lukem 	return LDAP_SUCCESS;
    207  1.1     lukem }  /* BDecTBSCertListSeqOfSeq*/
    208  1.1     lukem 
    209  1.1     lukem int
    210  1.1     lukem GDecComponentTBSCertListSeqOfSeq PARAMS (( mem_op,b, v, bytesDecoded, mode),
    211  1.1     lukem void* mem_op _AND_
    212  1.1     lukem GenBuf * b _AND_
    213  1.1     lukem ComponentTBSCertListSeqOfSeq **v _AND_
    214  1.1     lukem AsnLen *bytesDecoded _AND_
    215  1.1     lukem int mode)
    216  1.1     lukem {
    217  1.1     lukem 	char* peek_head,*peek_head2;
    218  1.1     lukem 	int i, strLen,strLen2, rc, old_mode = mode;
    219  1.1     lukem 	ComponentTBSCertListSeqOfSeq *k,*t, c_temp;
    220  1.1     lukem 
    221  1.1     lukem 
    222  1.1     lukem 	if ( !(mode & DEC_ALLOC_MODE_1) ) {
    223  1.1     lukem 		memset(&c_temp,0,sizeof(c_temp));
    224  1.1     lukem 		 k = &c_temp;
    225  1.1     lukem 	} else
    226  1.1     lukem 		 k = t = *v;
    227  1.1     lukem 	mode = DEC_ALLOC_MODE_2;
    228  1.1     lukem 	*bytesDecoded = 0;
    229  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    230  1.1     lukem 		Asn1Error("Error during Reading { in encoded data");
    231  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    232  1.1     lukem 	}
    233  1.1     lukem 	if(*peek_head != '{'){
    234  1.1     lukem 		Asn1Error("Missing { in encoded data");
    235  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    236  1.1     lukem 	}
    237  1.1     lukem 
    238  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    239  1.1     lukem 		Asn1Error("Error during Reading identifier");
    240  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    241  1.1     lukem 	}
    242  1.1     lukem 	if ( strncmp( peek_head, "userCertificate", strlen("userCertificate") ) == 0 ) {
    243  1.1     lukem 		rc = 	GDecComponentCertificateSerialNumber (mem_op, b, (&k->userCertificate), bytesDecoded, mode);
    244  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    245  1.1     lukem 	(&k->userCertificate)->identifier.bv_val = peek_head;
    246  1.1     lukem 	(&k->userCertificate)->identifier.bv_len = strLen;
    247  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    248  1.1     lukem 		Asn1Error("Error during Reading , ");
    249  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    250  1.1     lukem 	}
    251  1.1     lukem 	if(*peek_head != ','){
    252  1.1     lukem 		Asn1Error("Missing , in encoding");
    253  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    254  1.1     lukem 	}
    255  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    256  1.1     lukem 	  Asn1Error("Error during Reading identifier");
    257  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    258  1.1     lukem 	}
    259  1.1     lukem 	}
    260  1.1     lukem 	if ( strncmp( peek_head, "revocationDate", strlen("revocationDate") ) == 0 ) {
    261  1.1     lukem 		rc = 	GDecComponentTime (mem_op, b, (&k->revocationDate), bytesDecoded, mode);
    262  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    263  1.1     lukem 	( k->revocationDate)->identifier.bv_val = peek_head;
    264  1.1     lukem 	( k->revocationDate)->identifier.bv_len = strLen;
    265  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    266  1.1     lukem 		Asn1Error("Error during Reading , ");
    267  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    268  1.1     lukem 	}
    269  1.1     lukem 	if(*peek_head != ','){
    270  1.1     lukem 		Asn1Error("Missing , in encoding");
    271  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    272  1.1     lukem 	}
    273  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    274  1.1     lukem 	  Asn1Error("Error during Reading identifier");
    275  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    276  1.1     lukem 	}
    277  1.1     lukem 	}
    278  1.1     lukem 	if ( strncmp( peek_head, "crlEntryExtensions", strlen("crlEntryExtensions") ) == 0 ) {
    279  1.1     lukem 		rc = 	GDecComponentExtensions (mem_op, b, (&k->crlEntryExtensions), bytesDecoded, mode);
    280  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    281  1.1     lukem 	( k->crlEntryExtensions)->identifier.bv_val = peek_head;
    282  1.1     lukem 	( k->crlEntryExtensions)->identifier.bv_len = strLen;
    283  1.1     lukem 	}
    284  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
    285  1.1     lukem 		Asn1Error("Error during Reading } in encoding");
    286  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    287  1.1     lukem 	}
    288  1.1     lukem 	if(*peek_head != '}'){
    289  1.1     lukem 		Asn1Error("Missing } in encoding");
    290  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    291  1.1     lukem 	}
    292  1.1     lukem 	if( !(old_mode & DEC_ALLOC_MODE_1) ) {
    293  1.1     lukem 	*v = t = (ComponentTBSCertListSeqOfSeq*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOfSeq) );
    294  1.1     lukem 	if ( !t ) return -1;
    295  1.1     lukem 	*t = *k;
    296  1.1     lukem 	}
    297  1.1     lukem 	t->syntax = (Syntax*)NULL;
    298  1.1     lukem 	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
    299  1.1     lukem 	if ( !t->comp_desc ) {
    300  1.1     lukem 		free ( t );
    301  1.1     lukem 		return -1;
    302  1.1     lukem 	}
    303  1.1     lukem 	t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
    304  1.1     lukem 	t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
    305  1.1     lukem 	t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
    306  1.1     lukem 	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOfSeq ;
    307  1.1     lukem 	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOfSeq ;
    308  1.1     lukem 	t->comp_desc->cd_free = (comp_free_func*)NULL;
    309  1.1     lukem 	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOfSeq;
    310  1.1     lukem 	t->comp_desc->cd_type = ASN_COMPOSITE;
    311  1.1     lukem 	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
    312  1.1     lukem 	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOfSeq;
    313  1.1     lukem 	return LDAP_SUCCESS;
    314  1.1     lukem }  /* GDecTBSCertListSeqOfSeq*/
    315  1.1     lukem 
    316  1.1     lukem 
    317  1.1     lukem int
    318  1.1     lukem MatchingComponentTBSCertListSeqOf ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
    319  1.1     lukem 	int rc;
    320  1.1     lukem 	MatchingRule* mr;
    321  1.1     lukem 	void* component1, *component2;
    322  1.1     lukem 	AsnList *v1, *v2, t_list;
    323  1.1     lukem 
    324  1.1     lukem 
    325  1.1     lukem 	if ( oid ) {
    326  1.1     lukem 		mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
    327  1.1     lukem 		if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
    328  1.1     lukem 	}
    329  1.1     lukem 
    330  1.1     lukem 	v1 = &((ComponentTBSCertListSeqOf*)csi_attr)->comp_list;
    331  1.1     lukem 	v2 = &((ComponentTBSCertListSeqOf*)csi_assert)->comp_list;
    332  1.1     lukem 	FOR_EACH_LIST_PAIR_ELMT(component1, component2, v1, v2)
    333  1.1     lukem 	{
    334  1.1     lukem 		if( MatchingComponentTBSCertListSeqOfSeq(oid, (ComponentSyntaxInfo*)component1, (ComponentSyntaxInfo*)component2) == LDAP_COMPARE_FALSE) {
    335  1.1     lukem 			return LDAP_COMPARE_FALSE;
    336  1.1     lukem 		}
    337  1.1     lukem 	} /* end of for */
    338  1.1     lukem 
    339  1.1     lukem 	AsnListFirst( v1 );
    340  1.1     lukem 	AsnListFirst( v2 );
    341  1.1     lukem 	if( (!component1 && component2) || (component1 && !component2))
    342  1.1     lukem 		return LDAP_COMPARE_FALSE;
    343  1.1     lukem 	else
    344  1.1     lukem 		return LDAP_COMPARE_TRUE;
    345  1.1     lukem }  /* BMatchingComponentTBSCertListSeqOfContent */
    346  1.1     lukem 
    347  1.1     lukem void*
    348  1.1     lukem ExtractingComponentTBSCertListSeqOf ( void* mem_op, ComponentReference* cr, ComponentTBSCertListSeqOf *comp )
    349  1.1     lukem {
    350  1.1     lukem 	int count = 0;
    351  1.1     lukem 	int total;
    352  1.1     lukem 	AsnList *v = &comp->comp_list;
    353  1.1     lukem 	ComponentInt *k;
    354  1.1     lukem 	ComponentTBSCertListSeqOfSeq *component;
    355  1.1     lukem 
    356  1.1     lukem 
    357  1.1     lukem 	switch ( cr->cr_curr->ci_type ) {
    358  1.1     lukem 	case LDAP_COMPREF_FROM_BEGINNING :
    359  1.1     lukem 		count = cr->cr_curr->ci_val.ci_from_beginning;
    360  1.1     lukem 		FOR_EACH_LIST_ELMT( component , v ) {
    361  1.1     lukem 			if( --count == 0 ) {
    362  1.1     lukem 				if( cr->cr_curr->ci_next == NULL )
    363  1.1     lukem 					return component;
    364  1.1     lukem 				else {
    365  1.1     lukem 					cr->cr_curr = cr->cr_curr->ci_next;
    366  1.1     lukem 					return 	ExtractingComponentTBSCertListSeqOfSeq ( mem_op, cr, component );
    367  1.1     lukem 				}
    368  1.1     lukem 			}
    369  1.1     lukem 		}
    370  1.1     lukem 		break;
    371  1.1     lukem 	case LDAP_COMPREF_FROM_END :
    372  1.1     lukem 		total = AsnListCount ( v );
    373  1.1     lukem 		count = cr->cr_curr->ci_val.ci_from_end;
    374  1.1     lukem 		count = total + count +1;
    375  1.1     lukem 		FOR_EACH_LIST_ELMT ( component, v ) {
    376  1.1     lukem 			if( --count == 0 ) {
    377  1.1     lukem 				if( cr->cr_curr->ci_next == NULL )
    378  1.1     lukem 					return component;
    379  1.1     lukem 				else {
    380  1.1     lukem 					cr->cr_curr = cr->cr_curr->ci_next;
    381  1.1     lukem 					return 	ExtractingComponentTBSCertListSeqOfSeq ( mem_op, cr, component );
    382  1.1     lukem 				}
    383  1.1     lukem 			}
    384  1.1     lukem 		}
    385  1.1     lukem 		break;
    386  1.1     lukem 	case LDAP_COMPREF_ALL :
    387  1.1     lukem 		return comp;
    388  1.1     lukem 	case LDAP_COMPREF_COUNT :
    389  1.1     lukem 		k = (ComponentInt*)CompAlloc( mem_op, sizeof(ComponentInt));
    390  1.1     lukem 		k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
    391  1.1     lukem 		k->comp_desc->cd_tag = (-1);
    392  1.1     lukem 		k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentInt;
    393  1.1     lukem 		k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentInt;
    394  1.1     lukem 		k->comp_desc->cd_extract_i = (extract_component_from_id_func*)NULL;
    395  1.1     lukem 		k->comp_desc->cd_type = ASN_BASIC;
    396  1.1     lukem 		k->comp_desc->cd_type_id = BASICTYPE_INTEGER;
    397  1.1     lukem 		k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentInt;
    398  1.1     lukem 		k->value = AsnListCount(v);
    399  1.1     lukem 		return k;
    400  1.1     lukem 	default :
    401  1.1     lukem 		return NULL;
    402  1.1     lukem 	}
    403  1.1     lukem }  /* ExtractingComponentTBSCertListSeqOf */
    404  1.1     lukem 
    405  1.1     lukem int
    406  1.1     lukem BDecComponentTBSCertListSeqOf PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
    407  1.1     lukem void* mem_op _AND_
    408  1.1     lukem GenBuf * b _AND_
    409  1.1     lukem AsnTag tagId0 _AND_
    410  1.1     lukem AsnLen elmtLen0 _AND_
    411  1.1     lukem ComponentTBSCertListSeqOf **v _AND_
    412  1.1     lukem AsnLen *bytesDecoded _AND_
    413  1.1     lukem int mode)
    414  1.1     lukem {
    415  1.1     lukem 	int seqDone = FALSE;
    416  1.1     lukem 	AsnLen totalElmtsLen1 = 0;
    417  1.1     lukem 	AsnLen elmtLen1;
    418  1.1     lukem 	AsnTag tagId1;
    419  1.1     lukem 	int mandatoryElmtCount1 = 0;
    420  1.1     lukem 	int old_mode = mode;
    421  1.1     lukem 	int rc;
    422  1.1     lukem 	ComponentTBSCertListSeqOf *k, *t, c_temp;
    423  1.1     lukem 
    424  1.1     lukem 
    425  1.1     lukem 	if ( !(mode & DEC_ALLOC_MODE_1) ) {
    426  1.1     lukem 		memset(&c_temp,0,sizeof(c_temp));
    427  1.1     lukem 		 k = &c_temp;
    428  1.1     lukem 	} else
    429  1.1     lukem 		 k = t = *v;
    430  1.1     lukem 	mode = DEC_ALLOC_MODE_2;
    431  1.1     lukem 	AsnListInit(&k->comp_list,sizeof(ComponentTBSCertListSeqOfSeq));
    432  1.1     lukem     for (totalElmtsLen1 = 0; (totalElmtsLen1 < elmtLen0) || (elmtLen0 == INDEFINITE_LEN);)
    433  1.1     lukem     {
    434  1.1     lukem         ComponentTBSCertListSeqOfSeq **tmpVar;
    435  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1 );
    436  1.1     lukem 
    437  1.1     lukem     if ((tagId1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
    438  1.1     lukem     {
    439  1.1     lukem         BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
    440  1.1     lukem         break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/
    441  1.1     lukem     }
    442  1.1     lukem     if ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
    443  1.1     lukem     {
    444  1.1     lukem         elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    445  1.1     lukem     tmpVar = (ComponentTBSCertListSeqOfSeq**) CompAsnListAppend (mem_op,&k->comp_list);
    446  1.1     lukem 	rc = BDecComponentTBSCertListSeqOfSeq (mem_op, b, tagId1, elmtLen1, tmpVar, &totalElmtsLen1, mode);
    447  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    448  1.1     lukem     }  /* end of tag check if */
    449  1.1     lukem     else  /* wrong tag */
    450  1.1     lukem     {
    451  1.1     lukem          Asn1Error ("Unexpected Tag\n");
    452  1.1     lukem          return -1;
    453  1.1     lukem     }
    454  1.1     lukem     } /* end of for */
    455  1.1     lukem 
    456  1.1     lukem 	if( !(old_mode & DEC_ALLOC_MODE_1) ) {
    457  1.1     lukem 	*v = t = (ComponentTBSCertListSeqOf*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOf) );
    458  1.1     lukem 	if ( !t ) return -1;
    459  1.1     lukem 	*t = *k;
    460  1.1     lukem 	}
    461  1.1     lukem 	t->syntax = (Syntax*)NULL;
    462  1.1     lukem 	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
    463  1.1     lukem 	if ( !t->comp_desc ) {
    464  1.1     lukem 		free ( t );
    465  1.1     lukem 		return -1;
    466  1.1     lukem 	}
    467  1.1     lukem 	t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
    468  1.1     lukem 	t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
    469  1.1     lukem 	t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
    470  1.1     lukem 	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOf ;
    471  1.1     lukem 	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOf ;
    472  1.1     lukem 	t->comp_desc->cd_free = (comp_free_func*)NULL;
    473  1.1     lukem 	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOf;
    474  1.1     lukem 	t->comp_desc->cd_type = ASN_COMPOSITE;
    475  1.1     lukem 	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
    476  1.1     lukem 	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOf;
    477  1.1     lukem     (*bytesDecoded) += totalElmtsLen1;
    478  1.1     lukem 	return LDAP_SUCCESS;
    479  1.1     lukem }  /* BDecTBSCertListSeqOfContent */
    480  1.1     lukem 
    481  1.1     lukem int
    482  1.1     lukem GDecComponentTBSCertListSeqOf PARAMS (( mem_op,b, v, bytesDecoded, mode),
    483  1.1     lukem void* mem_op _AND_
    484  1.1     lukem GenBuf * b _AND_
    485  1.1     lukem ComponentTBSCertListSeqOf **v _AND_
    486  1.1     lukem AsnLen *bytesDecoded _AND_
    487  1.1     lukem int mode)
    488  1.1     lukem {
    489  1.1     lukem 	char* peek_head,*peek_head2;
    490  1.1     lukem 	int i, strLen,strLen2, rc, old_mode = mode;
    491  1.1     lukem 	ComponentTBSCertListSeqOf *k,*t, c_temp;
    492  1.1     lukem 
    493  1.1     lukem 
    494  1.1     lukem 	int ElmtsLen1;
    495  1.1     lukem 	if ( !(mode & DEC_ALLOC_MODE_1) ) {
    496  1.1     lukem 		memset(&c_temp,0,sizeof(c_temp));
    497  1.1     lukem 		 k = &c_temp;
    498  1.1     lukem 	} else
    499  1.1     lukem 		 k = t = *v;
    500  1.1     lukem 	mode = DEC_ALLOC_MODE_2;
    501  1.1     lukem 	AsnListInit( &k->comp_list, sizeof( ComponentTBSCertListSeqOfSeq ) );
    502  1.1     lukem 	*bytesDecoded = 0;
    503  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b, &peek_head, GSER_PEEK)) ){
    504  1.1     lukem 		Asn1Error("Error during Reading { in encoding");
    505  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    506  1.1     lukem 	}
    507  1.1     lukem 	if(*peek_head != '{'){
    508  1.1     lukem 		Asn1Error("Missing { in encoded data");
    509  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    510  1.1     lukem 	}
    511  1.1     lukem 
    512  1.1     lukem 	for (ElmtsLen1 = 0; ElmtsLen1 >= INDEFINITE_LEN; ElmtsLen1++)
    513  1.1     lukem 	{
    514  1.1     lukem 		ComponentTBSCertListSeqOfSeq **tmpVar;
    515  1.1     lukem 		if( !(strLen = LocateNextGSERToken(mem_op,b, &peek_head, GSER_NO_COPY)) ){
    516  1.1     lukem 			Asn1Error("Error during Reading{ in encoding");
    517  1.1     lukem 			return LDAP_PROTOCOL_ERROR;
    518  1.1     lukem 		}
    519  1.1     lukem 		if(*peek_head == '}') break;
    520  1.1     lukem 		if( !(*peek_head == '{' || *peek_head ==',') ) {
    521  1.1     lukem 			return LDAP_PROTOCOL_ERROR;
    522  1.1     lukem 		}
    523  1.1     lukem 		tmpVar = (ComponentTBSCertListSeqOfSeq**) CompAsnListAppend (mem_op, &k->comp_list);
    524  1.1     lukem 		if ( tmpVar == NULL ) {
    525  1.1     lukem 			Asn1Error("Error during Reading{ in encoding");
    526  1.1     lukem 			return LDAP_PROTOCOL_ERROR;
    527  1.1     lukem 		}
    528  1.1     lukem 		rc = 	GDecComponentTBSCertListSeqOfSeq (mem_op, b, tmpVar, bytesDecoded, mode);
    529  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    530  1.1     lukem 	} /* end of for */
    531  1.1     lukem 
    532  1.1     lukem 	if( !(old_mode & DEC_ALLOC_MODE_1) ) {
    533  1.1     lukem 	*v = t = (ComponentTBSCertListSeqOf*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOf) );
    534  1.1     lukem 	if ( !t ) return -1;
    535  1.1     lukem 	*t = *k;
    536  1.1     lukem 	}
    537  1.1     lukem 	t->syntax = (Syntax*)NULL;
    538  1.1     lukem 	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
    539  1.1     lukem 	if ( !t->comp_desc ) {
    540  1.1     lukem 		free ( t );
    541  1.1     lukem 		return -1;
    542  1.1     lukem 	}
    543  1.1     lukem 	t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
    544  1.1     lukem 	t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
    545  1.1     lukem 	t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
    546  1.1     lukem 	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOf ;
    547  1.1     lukem 	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOf ;
    548  1.1     lukem 	t->comp_desc->cd_free = (comp_free_func*)NULL;
    549  1.1     lukem 	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOf;
    550  1.1     lukem 	t->comp_desc->cd_type = ASN_COMPOSITE;
    551  1.1     lukem 	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
    552  1.1     lukem 	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOf;
    553  1.1     lukem 	return LDAP_SUCCESS;
    554  1.1     lukem }  /* GDecTBSCertListSeqOfContent */
    555  1.1     lukem 
    556  1.1     lukem int
    557  1.1     lukem MatchingComponentTBSCertList ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
    558  1.1     lukem 	int rc;
    559  1.1     lukem 	MatchingRule* mr;
    560  1.1     lukem 
    561  1.1     lukem 	if ( oid ) {
    562  1.1     lukem 		mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
    563  1.1     lukem 		if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
    564  1.1     lukem 	}
    565  1.1     lukem 
    566  1.1     lukem 	rc = 1;
    567  1.1     lukem 	if(COMPONENTNOT_NULL( ((ComponentTBSCertList*)csi_attr)->version ) ) {
    568  1.1     lukem 	rc =	MatchingComponentVersion ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->version, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->version );
    569  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
    570  1.1     lukem 		return rc;
    571  1.1     lukem 	}
    572  1.1     lukem 	rc =	MatchingComponentAlgorithmIdentifier ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->signature, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->signature );
    573  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
    574  1.1     lukem 		return rc;
    575  1.1     lukem 	rc =	MatchingComponentName ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->issuer, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->issuer );
    576  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
    577  1.1     lukem 		return rc;
    578  1.1     lukem 	rc =	MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->thisUpdate, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->thisUpdate );
    579  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
    580  1.1     lukem 		return rc;
    581  1.1     lukem 	if(COMPONENTNOT_NULL( ((ComponentTBSCertList*)csi_attr)->nextUpdate ) ) {
    582  1.1     lukem 	rc =	MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->nextUpdate, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->nextUpdate );
    583  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
    584  1.1     lukem 		return rc;
    585  1.1     lukem 	}
    586  1.1     lukem 	rc =	MatchingComponentTBSCertListSeqOf ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->revokedCertificates, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->revokedCertificates );
    587  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
    588  1.1     lukem 		return rc;
    589  1.1     lukem 	if(COMPONENTNOT_NULL( ((ComponentTBSCertList*)csi_attr)->crlExtensions ) ) {
    590  1.1     lukem 	rc =	MatchingComponentExtensions ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->crlExtensions, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->crlExtensions );
    591  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
    592  1.1     lukem 		return rc;
    593  1.1     lukem 	}
    594  1.1     lukem 	return LDAP_COMPARE_TRUE;
    595  1.1     lukem }  /* BMatchingComponentTBSCertList */
    596  1.1     lukem 
    597  1.1     lukem void*
    598  1.1     lukem ExtractingComponentTBSCertList ( void* mem_op, ComponentReference* cr, ComponentTBSCertList *comp )
    599  1.1     lukem {
    600  1.1     lukem 
    601  1.1     lukem 	if ( ( comp->version->identifier.bv_val && strncmp(comp->version->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->version->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
    602  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
    603  1.1     lukem 			return comp->version;
    604  1.1     lukem 		else {
    605  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
    606  1.1     lukem 			return 	ExtractingComponentVersion ( mem_op, cr, comp->version );
    607  1.1     lukem 		}
    608  1.1     lukem 	}
    609  1.1     lukem 	if ( ( comp->signature->identifier.bv_val && strncmp(comp->signature->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->signature->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
    610  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
    611  1.1     lukem 			return comp->signature;
    612  1.1     lukem 		else {
    613  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
    614  1.1     lukem 			return 	ExtractingComponentAlgorithmIdentifier ( mem_op, cr, comp->signature );
    615  1.1     lukem 		}
    616  1.1     lukem 	}
    617  1.1     lukem 	if ( ( comp->issuer->identifier.bv_val && strncmp(comp->issuer->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->issuer->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
    618  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
    619  1.1     lukem 			return comp->issuer;
    620  1.1     lukem 		else {
    621  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
    622  1.1     lukem 			return 	ExtractingComponentName ( mem_op, cr, comp->issuer );
    623  1.1     lukem 		}
    624  1.1     lukem 	}
    625  1.1     lukem 	if ( ( comp->thisUpdate->identifier.bv_val && strncmp(comp->thisUpdate->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->thisUpdate->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
    626  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
    627  1.1     lukem 			return comp->thisUpdate;
    628  1.1     lukem 		else {
    629  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
    630  1.1     lukem 			return 	ExtractingComponentTime ( mem_op, cr, comp->thisUpdate );
    631  1.1     lukem 		}
    632  1.1     lukem 	}
    633  1.1     lukem 	if ( ( comp->nextUpdate->identifier.bv_val && strncmp(comp->nextUpdate->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->nextUpdate->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
    634  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
    635  1.1     lukem 			return comp->nextUpdate;
    636  1.1     lukem 		else {
    637  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
    638  1.1     lukem 			return 	ExtractingComponentTime ( mem_op, cr, comp->nextUpdate );
    639  1.1     lukem 		}
    640  1.1     lukem 	}
    641  1.1     lukem 	if ( ( comp->revokedCertificates->identifier.bv_val && strncmp(comp->revokedCertificates->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->revokedCertificates->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
    642  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
    643  1.1     lukem 			return comp->revokedCertificates;
    644  1.1     lukem 		else {
    645  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
    646  1.1     lukem 			return 	ExtractingComponentTBSCertListSeqOf ( mem_op, cr, comp->revokedCertificates );
    647  1.1     lukem 		}
    648  1.1     lukem 	}
    649  1.1     lukem 	if ( ( comp->crlExtensions->identifier.bv_val && strncmp(comp->crlExtensions->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->crlExtensions->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
    650  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
    651  1.1     lukem 			return comp->crlExtensions;
    652  1.1     lukem 		else {
    653  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
    654  1.1     lukem 			return 	ExtractingComponentExtensions ( mem_op, cr, comp->crlExtensions );
    655  1.1     lukem 		}
    656  1.1     lukem 	}
    657  1.1     lukem 	return NULL;
    658  1.1     lukem }  /* ExtractingComponentTBSCertList */
    659  1.1     lukem 
    660  1.1     lukem int
    661  1.1     lukem BDecComponentTBSCertList PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
    662  1.1     lukem void* mem_op _AND_
    663  1.1     lukem GenBuf * b _AND_
    664  1.1     lukem AsnTag tagId0 _AND_
    665  1.1     lukem AsnLen elmtLen0 _AND_
    666  1.1     lukem ComponentTBSCertList **v _AND_
    667  1.1     lukem AsnLen *bytesDecoded _AND_
    668  1.1     lukem int mode)
    669  1.1     lukem {
    670  1.1     lukem 	int seqDone = FALSE;
    671  1.1     lukem 	AsnLen totalElmtsLen1 = 0;
    672  1.1     lukem 	AsnLen elmtLen1;
    673  1.1     lukem 	AsnTag tagId1;
    674  1.1     lukem 	int mandatoryElmtCount1 = 0;
    675  1.1     lukem 	AsnLen totalElmtsLen2 = 0;
    676  1.1     lukem 	AsnLen elmtLen2;
    677  1.1     lukem 	AsnTag tagId2;
    678  1.1     lukem 	int old_mode = mode;
    679  1.1     lukem 	int rc;
    680  1.1     lukem 	ComponentTBSCertList *k, *t, c_temp;
    681  1.1     lukem 
    682  1.1     lukem 
    683  1.1     lukem 	if ( !(mode & DEC_ALLOC_MODE_1) ) {
    684  1.1     lukem 		memset(&c_temp,0,sizeof(c_temp));
    685  1.1     lukem 		 k = &c_temp;
    686  1.1     lukem 	} else
    687  1.1     lukem 		 k = t = *v;
    688  1.1     lukem 	mode = DEC_ALLOC_MODE_2;
    689  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1 );
    690  1.1     lukem 
    691  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))))
    692  1.1     lukem     {
    693  1.1     lukem     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    694  1.1     lukem 	rc = BDecComponentVersion (mem_op, b, tagId1, elmtLen1, (&k->version), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
    695  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    696  1.1     lukem 		(k->version)->identifier.bv_val = (k->version)->id_buf;
    697  1.1     lukem 		(k->version)->identifier.bv_len = strlen("version");
    698  1.1     lukem 		strcpy( (k->version)->identifier.bv_val, "version");
    699  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1);
    700  1.1     lukem     }
    701  1.1     lukem 
    702  1.1     lukem 
    703  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
    704  1.1     lukem     {
    705  1.1     lukem     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    706  1.1     lukem 	rc = BDecComponentAlgorithmIdentifier (mem_op, b, tagId1, elmtLen1, (&k->signature), &totalElmtsLen1, mode);
    707  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    708  1.1     lukem 		(k->signature)->identifier.bv_val = (k->signature)->id_buf;
    709  1.1     lukem 		(k->signature)->identifier.bv_len = strlen("signature");
    710  1.1     lukem 		strcpy( (k->signature)->identifier.bv_val, "signature");
    711  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1);
    712  1.1     lukem     }
    713  1.1     lukem     else
    714  1.1     lukem         return -1;
    715  1.1     lukem 
    716  1.1     lukem 
    717  1.1     lukem 
    718  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
    719  1.1     lukem     {
    720  1.1     lukem         elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    721  1.1     lukem 	rc = BDecComponentName (mem_op, b, tagId1, elmtLen1, (&k->issuer), &totalElmtsLen1, mode);
    722  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    723  1.1     lukem 		(k->issuer)->identifier.bv_val = (k->issuer)->id_buf;
    724  1.1     lukem 		(k->issuer)->identifier.bv_len = strlen("issuer");
    725  1.1     lukem 		strcpy( (k->issuer)->identifier.bv_val, "issuer");
    726  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1);
    727  1.1     lukem     }
    728  1.1     lukem     else
    729  1.1     lukem         return -1;
    730  1.1     lukem 
    731  1.1     lukem 
    732  1.1     lukem 
    733  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||
    734  1.1     lukem (tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) ||
    735  1.1     lukem      (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))||
    736  1.1     lukem     (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE))))
    737  1.1     lukem     {
    738  1.1     lukem         elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    739  1.1     lukem 	rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->thisUpdate), &totalElmtsLen1, mode);
    740  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    741  1.1     lukem 		(k->thisUpdate)->identifier.bv_val = (k->thisUpdate)->id_buf;
    742  1.1     lukem 		(k->thisUpdate)->identifier.bv_len = strlen("thisUpdate");
    743  1.1     lukem 		strcpy( (k->thisUpdate)->identifier.bv_val, "thisUpdate");
    744  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1);
    745  1.1     lukem     }
    746  1.1     lukem     else
    747  1.1     lukem         return -1;
    748  1.1     lukem 
    749  1.1     lukem 
    750  1.1     lukem 
    751  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||
    752  1.1     lukem (tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) ||
    753  1.1     lukem      (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))||
    754  1.1     lukem     (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE))))
    755  1.1     lukem     {
    756  1.1     lukem         elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    757  1.1     lukem 	rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->nextUpdate), &totalElmtsLen1, mode);
    758  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    759  1.1     lukem 		(k->nextUpdate)->identifier.bv_val = (k->nextUpdate)->id_buf;
    760  1.1     lukem 		(k->nextUpdate)->identifier.bv_len = strlen("nextUpdate");
    761  1.1     lukem 		strcpy( (k->nextUpdate)->identifier.bv_val, "nextUpdate");
    762  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1);
    763  1.1     lukem     }
    764  1.1     lukem 
    765  1.1     lukem 
    766  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
    767  1.1     lukem     {
    768  1.1     lukem     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    769  1.1     lukem 	rc = BDecComponentTBSCertListSeqOf (mem_op, b, tagId1, elmtLen1, (&k->revokedCertificates), &totalElmtsLen1, mode);
    770  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    771  1.1     lukem 		(k->revokedCertificates)->identifier.bv_val = (k->revokedCertificates)->id_buf;
    772  1.1     lukem 		(k->revokedCertificates)->identifier.bv_len = strlen("revokedCertificates");
    773  1.1     lukem 		strcpy( (k->revokedCertificates)->identifier.bv_val, "revokedCertificates");
    774  1.1     lukem     if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0))
    775  1.1     lukem         seqDone = TRUE;
    776  1.1     lukem     else
    777  1.1     lukem     {
    778  1.1     lukem         tagId1 = BDecTag (b, &totalElmtsLen1 );
    779  1.1     lukem 
    780  1.1     lukem          if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
    781  1.1     lukem         {
    782  1.1     lukem             BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
    783  1.1     lukem             seqDone = TRUE;
    784  1.1     lukem         }
    785  1.1     lukem     }
    786  1.1     lukem     }
    787  1.1     lukem     else
    788  1.1     lukem         return -1;
    789  1.1     lukem 
    790  1.1     lukem 
    791  1.1     lukem 
    792  1.1     lukem     if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, CONS, 0))))
    793  1.1     lukem     {
    794  1.1     lukem     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
    795  1.1     lukem         tagId2 = BDecTag (b, &totalElmtsLen1 );
    796  1.1     lukem 
    797  1.1     lukem     if (tagId2 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
    798  1.1     lukem     {
    799  1.1     lukem          Asn1Error ("Unexpected Tag\n");
    800  1.1     lukem          return -1;
    801  1.1     lukem     }
    802  1.1     lukem 
    803  1.1     lukem     elmtLen2 = BDecLen (b, &totalElmtsLen1 );
    804  1.1     lukem 	rc = BDecComponentExtensions (mem_op, b, tagId2, elmtLen2, (&k->crlExtensions), &totalElmtsLen1, mode);
    805  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    806  1.1     lukem 		(k->crlExtensions)->identifier.bv_val = (k->crlExtensions)->id_buf;
    807  1.1     lukem 		(k->crlExtensions)->identifier.bv_len = strlen("crlExtensions");
    808  1.1     lukem 		strcpy( (k->crlExtensions)->identifier.bv_val, "crlExtensions");
    809  1.1     lukem 	if (elmtLen1 == INDEFINITE_LEN)
    810  1.1     lukem         BDecEoc (b, &totalElmtsLen1 );
    811  1.1     lukem         seqDone = TRUE;
    812  1.1     lukem         if (elmtLen0 == INDEFINITE_LEN)
    813  1.1     lukem             BDecEoc (b, &totalElmtsLen1 );
    814  1.1     lukem         else if (totalElmtsLen1 != elmtLen0)
    815  1.1     lukem         return -1;
    816  1.1     lukem 
    817  1.1     lukem     }
    818  1.1     lukem 
    819  1.1     lukem 
    820  1.1     lukem     if (!seqDone)
    821  1.1     lukem         return -1;
    822  1.1     lukem 
    823  1.1     lukem 	if( !(old_mode & DEC_ALLOC_MODE_1) ) {
    824  1.1     lukem 	*v = t = (ComponentTBSCertList*) CompAlloc( mem_op, sizeof(ComponentTBSCertList) );
    825  1.1     lukem 	if ( !t ) return -1;
    826  1.1     lukem 	*t = *k;
    827  1.1     lukem 	}
    828  1.1     lukem 	t->syntax = (Syntax*)NULL;
    829  1.1     lukem 	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
    830  1.1     lukem 	if ( !t->comp_desc ) {
    831  1.1     lukem 		free ( t );
    832  1.1     lukem 		return -1;
    833  1.1     lukem 	}
    834  1.1     lukem 	t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
    835  1.1     lukem 	t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
    836  1.1     lukem 	t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
    837  1.1     lukem 	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertList ;
    838  1.1     lukem 	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertList ;
    839  1.1     lukem 	t->comp_desc->cd_free = (comp_free_func*)NULL;
    840  1.1     lukem 	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertList;
    841  1.1     lukem 	t->comp_desc->cd_type = ASN_COMPOSITE;
    842  1.1     lukem 	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
    843  1.1     lukem 	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertList;
    844  1.1     lukem     (*bytesDecoded) += totalElmtsLen1;
    845  1.1     lukem 	return LDAP_SUCCESS;
    846  1.1     lukem }  /* BDecTBSCertList*/
    847  1.1     lukem 
    848  1.1     lukem int
    849  1.1     lukem GDecComponentTBSCertList PARAMS (( mem_op,b, v, bytesDecoded, mode),
    850  1.1     lukem void* mem_op _AND_
    851  1.1     lukem GenBuf * b _AND_
    852  1.1     lukem ComponentTBSCertList **v _AND_
    853  1.1     lukem AsnLen *bytesDecoded _AND_
    854  1.1     lukem int mode)
    855  1.1     lukem {
    856  1.1     lukem 	char* peek_head,*peek_head2;
    857  1.1     lukem 	int i, strLen,strLen2, rc, old_mode = mode;
    858  1.1     lukem 	ComponentTBSCertList *k,*t, c_temp;
    859  1.1     lukem 
    860  1.1     lukem 
    861  1.1     lukem 	if ( !(mode & DEC_ALLOC_MODE_1) ) {
    862  1.1     lukem 		memset(&c_temp,0,sizeof(c_temp));
    863  1.1     lukem 		 k = &c_temp;
    864  1.1     lukem 	} else
    865  1.1     lukem 		 k = t = *v;
    866  1.1     lukem 	mode = DEC_ALLOC_MODE_2;
    867  1.1     lukem 	*bytesDecoded = 0;
    868  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    869  1.1     lukem 		Asn1Error("Error during Reading { in encoded data");
    870  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    871  1.1     lukem 	}
    872  1.1     lukem 	if(*peek_head != '{'){
    873  1.1     lukem 		Asn1Error("Missing { in encoded data");
    874  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    875  1.1     lukem 	}
    876  1.1     lukem 
    877  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    878  1.1     lukem 		Asn1Error("Error during Reading identifier");
    879  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    880  1.1     lukem 	}
    881  1.1     lukem 	if ( strncmp( peek_head, "version", strlen("version") ) == 0 ) {
    882  1.1     lukem 		rc = 	GDecComponentVersion (mem_op, b, (&k->version), bytesDecoded, DEC_ALLOC_MODE_0 );
    883  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    884  1.1     lukem 	( k->version)->identifier.bv_val = peek_head;
    885  1.1     lukem 	( k->version)->identifier.bv_len = strLen;
    886  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    887  1.1     lukem 		Asn1Error("Error during Reading , ");
    888  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    889  1.1     lukem 	}
    890  1.1     lukem 	if(*peek_head != ','){
    891  1.1     lukem 		Asn1Error("Missing , in encoding");
    892  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    893  1.1     lukem 	}
    894  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    895  1.1     lukem 	  Asn1Error("Error during Reading identifier");
    896  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    897  1.1     lukem 	}
    898  1.1     lukem 	}
    899  1.1     lukem 	if ( strncmp( peek_head, "signature", strlen("signature") ) == 0 ) {
    900  1.1     lukem 		rc = 	GDecComponentAlgorithmIdentifier (mem_op, b, (&k->signature), bytesDecoded, mode);
    901  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    902  1.1     lukem 	( k->signature)->identifier.bv_val = peek_head;
    903  1.1     lukem 	( k->signature)->identifier.bv_len = strLen;
    904  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    905  1.1     lukem 		Asn1Error("Error during Reading , ");
    906  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    907  1.1     lukem 	}
    908  1.1     lukem 	if(*peek_head != ','){
    909  1.1     lukem 		Asn1Error("Missing , in encoding");
    910  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    911  1.1     lukem 	}
    912  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    913  1.1     lukem 	  Asn1Error("Error during Reading identifier");
    914  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    915  1.1     lukem 	}
    916  1.1     lukem 	}
    917  1.1     lukem 	if ( strncmp( peek_head, "issuer", strlen("issuer") ) == 0 ) {
    918  1.1     lukem 		rc = 	GDecComponentName (mem_op, b, (&k->issuer), bytesDecoded, mode);
    919  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    920  1.1     lukem 	( k->issuer)->identifier.bv_val = peek_head;
    921  1.1     lukem 	( k->issuer)->identifier.bv_len = strLen;
    922  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    923  1.1     lukem 		Asn1Error("Error during Reading , ");
    924  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    925  1.1     lukem 	}
    926  1.1     lukem 	if(*peek_head != ','){
    927  1.1     lukem 		Asn1Error("Missing , in encoding");
    928  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    929  1.1     lukem 	}
    930  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    931  1.1     lukem 	  Asn1Error("Error during Reading identifier");
    932  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    933  1.1     lukem 	}
    934  1.1     lukem 	}
    935  1.1     lukem 	if ( strncmp( peek_head, "thisUpdate", strlen("thisUpdate") ) == 0 ) {
    936  1.1     lukem 		rc = 	GDecComponentTime (mem_op, b, (&k->thisUpdate), bytesDecoded, mode);
    937  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    938  1.1     lukem 	( k->thisUpdate)->identifier.bv_val = peek_head;
    939  1.1     lukem 	( k->thisUpdate)->identifier.bv_len = strLen;
    940  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    941  1.1     lukem 		Asn1Error("Error during Reading , ");
    942  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    943  1.1     lukem 	}
    944  1.1     lukem 	if(*peek_head != ','){
    945  1.1     lukem 		Asn1Error("Missing , in encoding");
    946  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    947  1.1     lukem 	}
    948  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    949  1.1     lukem 	  Asn1Error("Error during Reading identifier");
    950  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    951  1.1     lukem 	}
    952  1.1     lukem 	}
    953  1.1     lukem 	if ( strncmp( peek_head, "nextUpdate", strlen("nextUpdate") ) == 0 ) {
    954  1.1     lukem 		rc = 	GDecComponentTime (mem_op, b, (&k->nextUpdate), bytesDecoded, mode);
    955  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    956  1.1     lukem 	( k->nextUpdate)->identifier.bv_val = peek_head;
    957  1.1     lukem 	( k->nextUpdate)->identifier.bv_len = strLen;
    958  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    959  1.1     lukem 		Asn1Error("Error during Reading , ");
    960  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    961  1.1     lukem 	}
    962  1.1     lukem 	if(*peek_head != ','){
    963  1.1     lukem 		Asn1Error("Missing , in encoding");
    964  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    965  1.1     lukem 	}
    966  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    967  1.1     lukem 	  Asn1Error("Error during Reading identifier");
    968  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    969  1.1     lukem 	}
    970  1.1     lukem 	}
    971  1.1     lukem 	if ( strncmp( peek_head, "revokedCertificates", strlen("revokedCertificates") ) == 0 ) {
    972  1.1     lukem 		rc = 	GDecComponentTBSCertListSeqOf (mem_op, b, (&k->revokedCertificates), bytesDecoded, mode);
    973  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    974  1.1     lukem 	( k->revokedCertificates)->identifier.bv_val = peek_head;
    975  1.1     lukem 	( k->revokedCertificates)->identifier.bv_len = strLen;
    976  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    977  1.1     lukem 		Asn1Error("Error during Reading , ");
    978  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    979  1.1     lukem 	}
    980  1.1     lukem 	if(*peek_head != ','){
    981  1.1     lukem 		Asn1Error("Missing , in encoding");
    982  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    983  1.1     lukem 	}
    984  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
    985  1.1     lukem 	  Asn1Error("Error during Reading identifier");
    986  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    987  1.1     lukem 	}
    988  1.1     lukem 	}
    989  1.1     lukem 	if ( strncmp( peek_head, "crlExtensions", strlen("crlExtensions") ) == 0 ) {
    990  1.1     lukem 		rc = 	GDecComponentExtensions (mem_op, b, (&k->crlExtensions), bytesDecoded, mode);
    991  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
    992  1.1     lukem 	( k->crlExtensions)->identifier.bv_val = peek_head;
    993  1.1     lukem 	( k->crlExtensions)->identifier.bv_len = strLen;
    994  1.1     lukem 	}
    995  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
    996  1.1     lukem 		Asn1Error("Error during Reading } in encoding");
    997  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
    998  1.1     lukem 	}
    999  1.1     lukem 	if(*peek_head != '}'){
   1000  1.1     lukem 		Asn1Error("Missing } in encoding");
   1001  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1002  1.1     lukem 	}
   1003  1.1     lukem 	if( !(old_mode & DEC_ALLOC_MODE_1) ) {
   1004  1.1     lukem 	*v = t = (ComponentTBSCertList*) CompAlloc( mem_op, sizeof(ComponentTBSCertList) );
   1005  1.1     lukem 	if ( !t ) return -1;
   1006  1.1     lukem 	*t = *k;
   1007  1.1     lukem 	}
   1008  1.1     lukem 	t->syntax = (Syntax*)NULL;
   1009  1.1     lukem 	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
   1010  1.1     lukem 	if ( !t->comp_desc ) {
   1011  1.1     lukem 		free ( t );
   1012  1.1     lukem 		return -1;
   1013  1.1     lukem 	}
   1014  1.1     lukem 	t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
   1015  1.1     lukem 	t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
   1016  1.1     lukem 	t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
   1017  1.1     lukem 	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertList ;
   1018  1.1     lukem 	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertList ;
   1019  1.1     lukem 	t->comp_desc->cd_free = (comp_free_func*)NULL;
   1020  1.1     lukem 	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertList;
   1021  1.1     lukem 	t->comp_desc->cd_type = ASN_COMPOSITE;
   1022  1.1     lukem 	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
   1023  1.1     lukem 	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertList;
   1024  1.1     lukem 	return LDAP_SUCCESS;
   1025  1.1     lukem }  /* GDecTBSCertList*/
   1026  1.1     lukem 
   1027  1.1     lukem 
   1028  1.1     lukem int
   1029  1.1     lukem MatchingComponentCertificateList ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
   1030  1.1     lukem 	int rc;
   1031  1.1     lukem 	MatchingRule* mr;
   1032  1.1     lukem 
   1033  1.1     lukem 	if ( oid ) {
   1034  1.1     lukem 		mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
   1035  1.1     lukem 		if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
   1036  1.1     lukem 	}
   1037  1.1     lukem 
   1038  1.1     lukem 	rc = 1;
   1039  1.1     lukem 	rc =	MatchingComponentTBSCertList ( oid, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_attr)->tbsCertList, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_assert)->tbsCertList );
   1040  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
   1041  1.1     lukem 		return rc;
   1042  1.1     lukem 	rc =	MatchingComponentAlgorithmIdentifier ( oid, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_attr)->signatureAlgorithm, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_assert)->signatureAlgorithm );
   1043  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
   1044  1.1     lukem 		return rc;
   1045  1.1     lukem 	rc =	MatchingComponentBits ( oid, (ComponentSyntaxInfo*)&((ComponentCertificateList*)csi_attr)->signature, (ComponentSyntaxInfo*)&((ComponentCertificateList*)csi_assert)->signature );
   1046  1.1     lukem 	if ( rc != LDAP_COMPARE_TRUE )
   1047  1.1     lukem 		return rc;
   1048  1.1     lukem 	return LDAP_COMPARE_TRUE;
   1049  1.1     lukem }  /* BMatchingComponentCertificateList */
   1050  1.1     lukem 
   1051  1.1     lukem void*
   1052  1.1     lukem ExtractingComponentCertificateList ( void* mem_op, ComponentReference* cr, ComponentCertificateList *comp )
   1053  1.1     lukem {
   1054  1.1     lukem 
   1055  1.1     lukem 	if ( ( comp->tbsCertList->identifier.bv_val && strncmp(comp->tbsCertList->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->tbsCertList->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
   1056  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
   1057  1.1     lukem 			return comp->tbsCertList;
   1058  1.1     lukem 		else {
   1059  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
   1060  1.1     lukem 			return 	ExtractingComponentTBSCertList ( mem_op, cr, comp->tbsCertList );
   1061  1.1     lukem 		}
   1062  1.1     lukem 	}
   1063  1.1     lukem 	if ( ( comp->signatureAlgorithm->identifier.bv_val && strncmp(comp->signatureAlgorithm->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->signatureAlgorithm->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
   1064  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
   1065  1.1     lukem 			return comp->signatureAlgorithm;
   1066  1.1     lukem 		else {
   1067  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
   1068  1.1     lukem 			return 	ExtractingComponentAlgorithmIdentifier ( mem_op, cr, comp->signatureAlgorithm );
   1069  1.1     lukem 		}
   1070  1.1     lukem 	}
   1071  1.1     lukem 	if ( ( comp->signature.identifier.bv_val && strncmp(comp->signature.identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->signature.id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
   1072  1.1     lukem 		if ( cr->cr_curr->ci_next == NULL )
   1073  1.1     lukem 		return &comp->signature;
   1074  1.1     lukem 	else if ( cr->cr_curr->ci_next->ci_type == LDAP_COMPREF_CONTENT) {
   1075  1.1     lukem 			cr->cr_curr = cr->cr_curr->ci_next;
   1076  1.1     lukem 		return &comp->signature;
   1077  1.1     lukem 	 } else {
   1078  1.1     lukem 		return NULL;
   1079  1.1     lukem 		}
   1080  1.1     lukem 	}
   1081  1.1     lukem 	return NULL;
   1082  1.1     lukem }  /* ExtractingComponentCertificateList */
   1083  1.1     lukem 
   1084  1.1     lukem int
   1085  1.1     lukem BDecComponentCertificateList PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
   1086  1.1     lukem void* mem_op _AND_
   1087  1.1     lukem GenBuf * b _AND_
   1088  1.1     lukem AsnTag tagId0 _AND_
   1089  1.1     lukem AsnLen elmtLen0 _AND_
   1090  1.1     lukem ComponentCertificateList **v _AND_
   1091  1.1     lukem AsnLen *bytesDecoded _AND_
   1092  1.1     lukem int mode)
   1093  1.1     lukem {
   1094  1.1     lukem 	int seqDone = FALSE;
   1095  1.1     lukem 	AsnLen totalElmtsLen1 = 0;
   1096  1.1     lukem 	AsnLen elmtLen1;
   1097  1.1     lukem 	AsnTag tagId1;
   1098  1.1     lukem 	int mandatoryElmtCount1 = 0;
   1099  1.1     lukem 	int old_mode = mode;
   1100  1.1     lukem 	int rc;
   1101  1.1     lukem 	ComponentCertificateList *k, *t, c_temp;
   1102  1.1     lukem 
   1103  1.1     lukem 
   1104  1.1     lukem 	if ( !(mode & DEC_ALLOC_MODE_1) ) {
   1105  1.1     lukem 		memset(&c_temp,0,sizeof(c_temp));
   1106  1.1     lukem 		 k = &c_temp;
   1107  1.1     lukem 	} else
   1108  1.1     lukem 		 k = t = *v;
   1109  1.1     lukem 	mode = DEC_ALLOC_MODE_2;
   1110  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1 );
   1111  1.1     lukem 
   1112  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
   1113  1.1     lukem     {
   1114  1.1     lukem     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
   1115  1.1     lukem 	rc = BDecComponentTBSCertList (mem_op, b, tagId1, elmtLen1, (&k->tbsCertList), &totalElmtsLen1, mode);
   1116  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
   1117  1.1     lukem 		(k->tbsCertList)->identifier.bv_val = (k->tbsCertList)->id_buf;
   1118  1.1     lukem 		(k->tbsCertList)->identifier.bv_len = strlen("tbsCertList");
   1119  1.1     lukem 		strcpy( (k->tbsCertList)->identifier.bv_val, "tbsCertList");
   1120  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1);
   1121  1.1     lukem     }
   1122  1.1     lukem     else
   1123  1.1     lukem         return -1;
   1124  1.1     lukem 
   1125  1.1     lukem 
   1126  1.1     lukem 
   1127  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
   1128  1.1     lukem     {
   1129  1.1     lukem     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
   1130  1.1     lukem 	rc = BDecComponentAlgorithmIdentifier (mem_op, b, tagId1, elmtLen1, (&k->signatureAlgorithm), &totalElmtsLen1, mode);
   1131  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
   1132  1.1     lukem 		(k->signatureAlgorithm)->identifier.bv_val = (k->signatureAlgorithm)->id_buf;
   1133  1.1     lukem 		(k->signatureAlgorithm)->identifier.bv_len = strlen("signatureAlgorithm");
   1134  1.1     lukem 		strcpy( (k->signatureAlgorithm)->identifier.bv_val, "signatureAlgorithm");
   1135  1.1     lukem     tagId1 = BDecTag (b, &totalElmtsLen1);
   1136  1.1     lukem     }
   1137  1.1     lukem     else
   1138  1.1     lukem         return -1;
   1139  1.1     lukem 
   1140  1.1     lukem 
   1141  1.1     lukem 
   1142  1.1     lukem     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, BITSTRING_TAG_CODE)) ||
   1143  1.1     lukem (tagId1 == MAKE_TAG_ID (UNIV, CONS, BITSTRING_TAG_CODE))))
   1144  1.1     lukem     {
   1145  1.1     lukem     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
   1146  1.1     lukem 	rc = BDecComponentBits (mem_op, b, tagId1, elmtLen1, (&k->signature), &totalElmtsLen1, mode);
   1147  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
   1148  1.1     lukem 		(&k->signature)->identifier.bv_val = (&k->signature)->id_buf;
   1149  1.1     lukem 		(&k->signature)->identifier.bv_len = strlen("signature");
   1150  1.1     lukem 		strcpy( (&k->signature)->identifier.bv_val, "signature");
   1151  1.1     lukem         seqDone = TRUE;
   1152  1.1     lukem         if (elmtLen0 == INDEFINITE_LEN)
   1153  1.1     lukem             BDecEoc (b, &totalElmtsLen1 );
   1154  1.1     lukem         else if (totalElmtsLen1 != elmtLen0)
   1155  1.1     lukem         return -1;
   1156  1.1     lukem 
   1157  1.1     lukem     }
   1158  1.1     lukem     else
   1159  1.1     lukem         return -1;
   1160  1.1     lukem 
   1161  1.1     lukem 
   1162  1.1     lukem 
   1163  1.1     lukem     if (!seqDone)
   1164  1.1     lukem         return -1;
   1165  1.1     lukem 
   1166  1.1     lukem 	if( !(old_mode & DEC_ALLOC_MODE_1) ) {
   1167  1.1     lukem 	*v = t = (ComponentCertificateList*) CompAlloc( mem_op, sizeof(ComponentCertificateList) );
   1168  1.1     lukem 	if ( !t ) return -1;
   1169  1.1     lukem 	*t = *k;
   1170  1.1     lukem 	}
   1171  1.1     lukem 	t->syntax = (Syntax*)NULL;
   1172  1.1     lukem 	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
   1173  1.1     lukem 	if ( !t->comp_desc ) {
   1174  1.1     lukem 		free ( t );
   1175  1.1     lukem 		return -1;
   1176  1.1     lukem 	}
   1177  1.1     lukem 	t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
   1178  1.1     lukem 	t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
   1179  1.1     lukem 	t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
   1180  1.1     lukem 	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentCertificateList ;
   1181  1.1     lukem 	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentCertificateList ;
   1182  1.1     lukem 	t->comp_desc->cd_free = (comp_free_func*)NULL;
   1183  1.1     lukem 	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentCertificateList;
   1184  1.1     lukem 	t->comp_desc->cd_type = ASN_COMPOSITE;
   1185  1.1     lukem 	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
   1186  1.1     lukem 	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentCertificateList;
   1187  1.1     lukem     (*bytesDecoded) += totalElmtsLen1;
   1188  1.1     lukem 	return LDAP_SUCCESS;
   1189  1.1     lukem }  /* BDecCertificateList*/
   1190  1.1     lukem 
   1191  1.1     lukem int
   1192  1.1     lukem GDecComponentCertificateList PARAMS (( mem_op,b, v, bytesDecoded, mode),
   1193  1.1     lukem void* mem_op _AND_
   1194  1.1     lukem GenBuf * b _AND_
   1195  1.1     lukem ComponentCertificateList **v _AND_
   1196  1.1     lukem AsnLen *bytesDecoded _AND_
   1197  1.1     lukem int mode)
   1198  1.1     lukem {
   1199  1.1     lukem 	char* peek_head,*peek_head2;
   1200  1.1     lukem 	int i, strLen,strLen2, rc, old_mode = mode;
   1201  1.1     lukem 	ComponentCertificateList *k,*t, c_temp;
   1202  1.1     lukem 
   1203  1.1     lukem 
   1204  1.1     lukem 	if ( !(mode & DEC_ALLOC_MODE_1) ) {
   1205  1.1     lukem 		memset(&c_temp,0,sizeof(c_temp));
   1206  1.1     lukem 		 k = &c_temp;
   1207  1.1     lukem 	} else
   1208  1.1     lukem 		 k = t = *v;
   1209  1.1     lukem 	mode = DEC_ALLOC_MODE_2;
   1210  1.1     lukem 	*bytesDecoded = 0;
   1211  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
   1212  1.1     lukem 		Asn1Error("Error during Reading { in encoded data");
   1213  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1214  1.1     lukem 	}
   1215  1.1     lukem 	if(*peek_head != '{'){
   1216  1.1     lukem 		Asn1Error("Missing { in encoded data");
   1217  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1218  1.1     lukem 	}
   1219  1.1     lukem 
   1220  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
   1221  1.1     lukem 		Asn1Error("Error during Reading identifier");
   1222  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1223  1.1     lukem 	}
   1224  1.1     lukem 	if ( strncmp( peek_head, "tbsCertList", strlen("tbsCertList") ) == 0 ) {
   1225  1.1     lukem 		rc = 	GDecComponentTBSCertList (mem_op, b, (&k->tbsCertList), bytesDecoded, mode);
   1226  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
   1227  1.1     lukem 	( k->tbsCertList)->identifier.bv_val = peek_head;
   1228  1.1     lukem 	( k->tbsCertList)->identifier.bv_len = strLen;
   1229  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
   1230  1.1     lukem 		Asn1Error("Error during Reading , ");
   1231  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1232  1.1     lukem 	}
   1233  1.1     lukem 	if(*peek_head != ','){
   1234  1.1     lukem 		Asn1Error("Missing , in encoding");
   1235  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1236  1.1     lukem 	}
   1237  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
   1238  1.1     lukem 	  Asn1Error("Error during Reading identifier");
   1239  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1240  1.1     lukem 	}
   1241  1.1     lukem 	}
   1242  1.1     lukem 	if ( strncmp( peek_head, "signatureAlgorithm", strlen("signatureAlgorithm") ) == 0 ) {
   1243  1.1     lukem 		rc = 	GDecComponentAlgorithmIdentifier (mem_op, b, (&k->signatureAlgorithm), bytesDecoded, mode);
   1244  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
   1245  1.1     lukem 	( k->signatureAlgorithm)->identifier.bv_val = peek_head;
   1246  1.1     lukem 	( k->signatureAlgorithm)->identifier.bv_len = strLen;
   1247  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
   1248  1.1     lukem 		Asn1Error("Error during Reading , ");
   1249  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1250  1.1     lukem 	}
   1251  1.1     lukem 	if(*peek_head != ','){
   1252  1.1     lukem 		Asn1Error("Missing , in encoding");
   1253  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1254  1.1     lukem 	}
   1255  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
   1256  1.1     lukem 	  Asn1Error("Error during Reading identifier");
   1257  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1258  1.1     lukem 	}
   1259  1.1     lukem 	}
   1260  1.1     lukem 	if ( strncmp( peek_head, "signature", strlen("signature") ) == 0 ) {
   1261  1.1     lukem 		rc = 	GDecComponentBits (mem_op, b, (&k->signature), bytesDecoded, mode);
   1262  1.1     lukem 		if ( rc != LDAP_SUCCESS ) return rc;
   1263  1.1     lukem 	(&k->signature)->identifier.bv_val = peek_head;
   1264  1.1     lukem 	(&k->signature)->identifier.bv_len = strLen;
   1265  1.1     lukem 	}
   1266  1.1     lukem 	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
   1267  1.1     lukem 		Asn1Error("Error during Reading } in encoding");
   1268  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1269  1.1     lukem 	}
   1270  1.1     lukem 	if(*peek_head != '}'){
   1271  1.1     lukem 		Asn1Error("Missing } in encoding");
   1272  1.1     lukem 		return LDAP_PROTOCOL_ERROR;
   1273  1.1     lukem 	}
   1274  1.1     lukem 	if( !(old_mode & DEC_ALLOC_MODE_1) ) {
   1275  1.1     lukem 	*v = t = (ComponentCertificateList*) CompAlloc( mem_op, sizeof(ComponentCertificateList) );
   1276  1.1     lukem 	if ( !t ) return -1;
   1277  1.1     lukem 	*t = *k;
   1278  1.1     lukem 	}
   1279  1.1     lukem 	t->syntax = (Syntax*)NULL;
   1280  1.1     lukem 	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
   1281  1.1     lukem 	if ( !t->comp_desc ) {
   1282  1.1     lukem 		free ( t );
   1283  1.1     lukem 		return -1;
   1284  1.1     lukem 	}
   1285  1.1     lukem 	t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
   1286  1.1     lukem 	t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
   1287  1.1     lukem 	t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
   1288  1.1     lukem 	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentCertificateList ;
   1289  1.1     lukem 	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentCertificateList ;
   1290  1.1     lukem 	t->comp_desc->cd_free = (comp_free_func*)NULL;
   1291  1.1     lukem 	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentCertificateList;
   1292  1.1     lukem 	t->comp_desc->cd_type = ASN_COMPOSITE;
   1293  1.1     lukem 	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
   1294  1.1     lukem 	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentCertificateList;
   1295  1.1     lukem 	return LDAP_SUCCESS;
   1296  1.1     lukem }  /* GDecCertificateList*/
   1297