3 * "CertificateRevokationList" ASN.1 module encode/decode/extracting/matching/free C src.
4 * This file was generated by modified eSMACC compiler Fri Jan 21 11:25:24 2005
5 * The generated files are supposed to be compiled as a module for OpenLDAP Software
10 BDecComponentCertificateListTop( void* mem_op, GenBuf* b, void *v, AsnLen* bytesDecoded,int mode) {
14 tag = BDecTag ( b, bytesDecoded );
15 elmtLen = BDecLen ( b, bytesDecoded );
16 if ( elmtLen <= 0 ) return (-1);
17 if ( tag != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE) ) {
21 return BDecComponentCertificateList( mem_op, b, tag, elmtLen, ( ComponentCertificateList**)v, (AsnLen*)bytesDecoded, mode );
25 void init_module_CertificateRevokationList() {
26 InstallOidDecoderMapping( "2.5.4.39", NULL,
27 GDecComponentCertificateList,
28 BDecComponentCertificateListTop,
29 ExtractingComponentCertificateList,
30 MatchingComponentCertificateList);
34 MatchingComponentTBSCertListSeqOfSeq ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
39 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
40 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
44 rc = MatchingComponentCertificateSerialNumber ( oid, (ComponentSyntaxInfo*)&((ComponentTBSCertListSeqOfSeq*)csi_attr)->userCertificate, (ComponentSyntaxInfo*)&((ComponentTBSCertListSeqOfSeq*)csi_assert)->userCertificate );
45 if ( rc != LDAP_COMPARE_TRUE )
47 rc = MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_attr)->revocationDate, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_assert)->revocationDate );
48 if ( rc != LDAP_COMPARE_TRUE )
50 if(COMPONENTNOT_NULL( ((ComponentTBSCertListSeqOfSeq*)csi_attr)->crlEntryExtensions ) ) {
51 rc = MatchingComponentExtensions ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_attr)->crlEntryExtensions, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_assert)->crlEntryExtensions );
52 if ( rc != LDAP_COMPARE_TRUE )
55 return LDAP_COMPARE_TRUE;
56 } /* BMatchingComponentTBSCertListSeqOfSeq */
59 ExtractingComponentTBSCertListSeqOfSeq ( void* mem_op, ComponentReference* cr, ComponentTBSCertListSeqOfSeq *comp )
62 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 ) ) {
63 if ( cr->cr_curr->ci_next == NULL )
64 return &comp->userCertificate;
68 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 ) ) {
69 if ( cr->cr_curr->ci_next == NULL )
70 return comp->revocationDate;
72 cr->cr_curr = cr->cr_curr->ci_next;
73 return ExtractingComponentTime ( mem_op, cr, comp->revocationDate );
76 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 ) ) {
77 if ( cr->cr_curr->ci_next == NULL )
78 return comp->crlEntryExtensions;
80 cr->cr_curr = cr->cr_curr->ci_next;
81 return ExtractingComponentExtensions ( mem_op, cr, comp->crlEntryExtensions );
85 } /* ExtractingComponentTBSCertListSeqOfSeq */
88 BDecComponentTBSCertListSeqOfSeq PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
93 ComponentTBSCertListSeqOfSeq **v _AND_
94 AsnLen *bytesDecoded _AND_
98 AsnLen totalElmtsLen1 = 0;
101 int mandatoryElmtCount1 = 0;
102 AsnLen totalElmtsLen2 = 0;
107 ComponentTBSCertListSeqOfSeq *k, *t, c_temp;
110 if ( !(mode & DEC_ALLOC_MODE_1) ) {
111 memset(&c_temp,0,sizeof(c_temp));
115 mode = DEC_ALLOC_MODE_2;
116 tagId1 = BDecTag (b, &totalElmtsLen1 );
118 if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))))
120 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
121 rc = BDecComponentCertificateSerialNumber (mem_op, b, tagId1, elmtLen1, (&k->userCertificate), &totalElmtsLen1, mode);
122 if ( rc != LDAP_SUCCESS ) return rc;
123 (&k->userCertificate)->identifier.bv_val = (&k->userCertificate)->id_buf;
124 (&k->userCertificate)->identifier.bv_len = strlen("userCertificate");
125 strcpy( (&k->userCertificate)->identifier.bv_val, "userCertificate");
126 tagId1 = BDecTag (b, &totalElmtsLen1);
133 if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||
134 (tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) ||
135 (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))||
136 (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE))))
138 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
139 rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->revocationDate), &totalElmtsLen1, mode);
140 if ( rc != LDAP_SUCCESS ) return rc;
141 (k->revocationDate)->identifier.bv_val = (k->revocationDate)->id_buf;
142 (k->revocationDate)->identifier.bv_len = strlen("revocationDate");
143 strcpy( (k->revocationDate)->identifier.bv_val, "revocationDate");
144 if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0))
148 tagId1 = BDecTag (b, &totalElmtsLen1 );
150 if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
152 BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
162 if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
164 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
165 rc = BDecComponentExtensions (mem_op, b, tagId1, elmtLen1, (&k->crlEntryExtensions), &totalElmtsLen1, mode);
166 if ( rc != LDAP_SUCCESS ) return rc;
167 (k->crlEntryExtensions)->identifier.bv_val = (k->crlEntryExtensions)->id_buf;
168 (k->crlEntryExtensions)->identifier.bv_len = strlen("crlEntryExtensions");
169 strcpy( (k->crlEntryExtensions)->identifier.bv_val, "crlEntryExtensions");
171 if (elmtLen0 == INDEFINITE_LEN)
172 BDecEoc (b, &totalElmtsLen1 );
173 else if (totalElmtsLen1 != elmtLen0)
182 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
183 *v = t = (ComponentTBSCertListSeqOfSeq*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOfSeq) );
187 t->syntax = (Syntax*)NULL;
188 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
189 if ( !t->comp_desc ) {
193 t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
194 t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
195 t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
196 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOfSeq ;
197 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOfSeq ;
198 t->comp_desc->cd_free = (comp_free_func*)NULL;
199 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOfSeq;
200 t->comp_desc->cd_type = ASN_COMPOSITE;
201 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
202 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOfSeq;
203 (*bytesDecoded) += totalElmtsLen1;
205 } /* BDecTBSCertListSeqOfSeq*/
208 GDecComponentTBSCertListSeqOfSeq PARAMS (( mem_op,b, v, bytesDecoded, mode),
211 ComponentTBSCertListSeqOfSeq **v _AND_
212 AsnLen *bytesDecoded _AND_
215 char* peek_head,*peek_head2;
216 int i, strLen,strLen2, rc, old_mode = mode;
217 ComponentTBSCertListSeqOfSeq *k,*t, c_temp;
220 if ( !(mode & DEC_ALLOC_MODE_1) ) {
221 memset(&c_temp,0,sizeof(c_temp));
225 mode = DEC_ALLOC_MODE_2;
227 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
228 Asn1Error("Error during Reading { in encoded data");
229 return LDAP_PROTOCOL_ERROR;
231 if(*peek_head != '{'){
232 Asn1Error("Missing { in encoded data");
233 return LDAP_PROTOCOL_ERROR;
236 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
237 Asn1Error("Error during Reading identifier");
238 return LDAP_PROTOCOL_ERROR;
240 if ( strncmp( peek_head, "userCertificate", strlen("userCertificate") ) == 0 ) {
241 rc = GDecComponentCertificateSerialNumber (mem_op, b, (&k->userCertificate), bytesDecoded, mode);
242 if ( rc != LDAP_SUCCESS ) return rc;
243 (&k->userCertificate)->identifier.bv_val = peek_head;
244 (&k->userCertificate)->identifier.bv_len = strLen;
245 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
246 Asn1Error("Error during Reading , ");
247 return LDAP_PROTOCOL_ERROR;
249 if(*peek_head != ','){
250 Asn1Error("Missing , in encoding");
251 return LDAP_PROTOCOL_ERROR;
253 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
254 Asn1Error("Error during Reading identifier");
255 return LDAP_PROTOCOL_ERROR;
258 if ( strncmp( peek_head, "revocationDate", strlen("revocationDate") ) == 0 ) {
259 rc = GDecComponentTime (mem_op, b, (&k->revocationDate), bytesDecoded, mode);
260 if ( rc != LDAP_SUCCESS ) return rc;
261 ( k->revocationDate)->identifier.bv_val = peek_head;
262 ( k->revocationDate)->identifier.bv_len = strLen;
263 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
264 Asn1Error("Error during Reading , ");
265 return LDAP_PROTOCOL_ERROR;
267 if(*peek_head != ','){
268 Asn1Error("Missing , in encoding");
269 return LDAP_PROTOCOL_ERROR;
271 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
272 Asn1Error("Error during Reading identifier");
273 return LDAP_PROTOCOL_ERROR;
276 if ( strncmp( peek_head, "crlEntryExtensions", strlen("crlEntryExtensions") ) == 0 ) {
277 rc = GDecComponentExtensions (mem_op, b, (&k->crlEntryExtensions), bytesDecoded, mode);
278 if ( rc != LDAP_SUCCESS ) return rc;
279 ( k->crlEntryExtensions)->identifier.bv_val = peek_head;
280 ( k->crlEntryExtensions)->identifier.bv_len = strLen;
282 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
283 Asn1Error("Error during Reading } in encoding");
284 return LDAP_PROTOCOL_ERROR;
286 if(*peek_head != '}'){
287 Asn1Error("Missing } in encoding");
288 return LDAP_PROTOCOL_ERROR;
290 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
291 *v = t = (ComponentTBSCertListSeqOfSeq*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOfSeq) );
295 t->syntax = (Syntax*)NULL;
296 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
297 if ( !t->comp_desc ) {
301 t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
302 t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
303 t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
304 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOfSeq ;
305 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOfSeq ;
306 t->comp_desc->cd_free = (comp_free_func*)NULL;
307 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOfSeq;
308 t->comp_desc->cd_type = ASN_COMPOSITE;
309 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
310 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOfSeq;
312 } /* GDecTBSCertListSeqOfSeq*/
316 MatchingComponentTBSCertListSeqOf ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
319 void* component1, *component2;
320 AsnList *v1, *v2, t_list;
324 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
325 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
328 v1 = &((ComponentTBSCertListSeqOf*)csi_attr)->comp_list;
329 v2 = &((ComponentTBSCertListSeqOf*)csi_assert)->comp_list;
330 FOR_EACH_LIST_PAIR_ELMT(component1, component2, v1, v2)
332 if( MatchingComponentTBSCertListSeqOfSeq(oid, (ComponentSyntaxInfo*)component1, (ComponentSyntaxInfo*)component2) == LDAP_COMPARE_FALSE) {
333 return LDAP_COMPARE_FALSE;
339 if( (!component1 && component2) || (component1 && !component2))
340 return LDAP_COMPARE_FALSE;
342 return LDAP_COMPARE_TRUE;
343 } /* BMatchingComponentTBSCertListSeqOfContent */
346 ExtractingComponentTBSCertListSeqOf ( void* mem_op, ComponentReference* cr, ComponentTBSCertListSeqOf *comp )
350 AsnList *v = &comp->comp_list;
352 ComponentTBSCertListSeqOfSeq *component;
355 switch ( cr->cr_curr->ci_type ) {
356 case LDAP_COMPREF_FROM_BEGINNING :
357 count = cr->cr_curr->ci_val.ci_from_beginning;
358 FOR_EACH_LIST_ELMT( component , v ) {
360 if( cr->cr_curr->ci_next == NULL )
363 cr->cr_curr = cr->cr_curr->ci_next;
364 return ExtractingComponentTBSCertListSeqOfSeq ( mem_op, cr, component );
369 case LDAP_COMPREF_FROM_END :
370 total = AsnListCount ( v );
371 count = cr->cr_curr->ci_val.ci_from_end;
372 count = total + count +1;
373 FOR_EACH_LIST_ELMT ( component, v ) {
375 if( cr->cr_curr->ci_next == NULL )
378 cr->cr_curr = cr->cr_curr->ci_next;
379 return ExtractingComponentTBSCertListSeqOfSeq ( mem_op, cr, component );
384 case LDAP_COMPREF_ALL :
386 case LDAP_COMPREF_COUNT :
387 k = (ComponentInt*)CompAlloc( mem_op, sizeof(ComponentInt));
388 k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
389 k->comp_desc->cd_tag = (-1);
390 k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentInt;
391 k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentInt;
392 k->comp_desc->cd_extract_i = (extract_component_from_id_func*)NULL;
393 k->comp_desc->cd_type = ASN_BASIC;
394 k->comp_desc->cd_type_id = BASICTYPE_INTEGER;
395 k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentInt;
396 k->value = AsnListCount(v);
401 } /* ExtractingComponentTBSCertListSeqOf */
404 BDecComponentTBSCertListSeqOf PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
408 AsnLen elmtLen0 _AND_
409 ComponentTBSCertListSeqOf **v _AND_
410 AsnLen *bytesDecoded _AND_
414 AsnLen totalElmtsLen1 = 0;
417 int mandatoryElmtCount1 = 0;
420 ComponentTBSCertListSeqOf *k, *t, c_temp;
423 if ( !(mode & DEC_ALLOC_MODE_1) ) {
424 memset(&c_temp,0,sizeof(c_temp));
428 mode = DEC_ALLOC_MODE_2;
429 AsnListInit(&k->comp_list,sizeof(ComponentTBSCertListSeqOfSeq));
430 for (totalElmtsLen1 = 0; (totalElmtsLen1 < elmtLen0) || (elmtLen0 == INDEFINITE_LEN);)
432 ComponentTBSCertListSeqOfSeq **tmpVar;
433 tagId1 = BDecTag (b, &totalElmtsLen1 );
435 if ((tagId1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
437 BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
438 break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/
440 if ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
442 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
443 tmpVar = (ComponentTBSCertListSeqOfSeq**) CompAsnListAppend (mem_op,&k->comp_list);
444 rc = BDecComponentTBSCertListSeqOfSeq (mem_op, b, tagId1, elmtLen1, tmpVar, &totalElmtsLen1, mode);
445 if ( rc != LDAP_SUCCESS ) return rc;
446 } /* end of tag check if */
449 Asn1Error ("Unexpected Tag\n");
454 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
455 *v = t = (ComponentTBSCertListSeqOf*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOf) );
459 t->syntax = (Syntax*)NULL;
460 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
461 if ( !t->comp_desc ) {
465 t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
466 t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
467 t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
468 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOf ;
469 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOf ;
470 t->comp_desc->cd_free = (comp_free_func*)NULL;
471 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOf;
472 t->comp_desc->cd_type = ASN_COMPOSITE;
473 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
474 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOf;
475 (*bytesDecoded) += totalElmtsLen1;
477 } /* BDecTBSCertListSeqOfContent */
480 GDecComponentTBSCertListSeqOf PARAMS (( mem_op,b, v, bytesDecoded, mode),
483 ComponentTBSCertListSeqOf **v _AND_
484 AsnLen *bytesDecoded _AND_
487 char* peek_head,*peek_head2;
488 int i, strLen,strLen2, rc, old_mode = mode;
489 ComponentTBSCertListSeqOf *k,*t, c_temp;
493 if ( !(mode & DEC_ALLOC_MODE_1) ) {
494 memset(&c_temp,0,sizeof(c_temp));
498 mode = DEC_ALLOC_MODE_2;
499 AsnListInit( &k->comp_list, sizeof( ComponentTBSCertListSeqOfSeq ) );
501 if( !(strLen = LocateNextGSERToken(mem_op,b, &peek_head, GSER_PEEK)) ){
502 Asn1Error("Error during Reading { in encoding");
503 return LDAP_PROTOCOL_ERROR;
505 if(*peek_head != '{'){
506 Asn1Error("Missing { in encoded data");
507 return LDAP_PROTOCOL_ERROR;
510 for (ElmtsLen1 = 0; ElmtsLen1 >= INDEFINITE_LEN; ElmtsLen1++)
512 ComponentTBSCertListSeqOfSeq **tmpVar;
513 if( !(strLen = LocateNextGSERToken(mem_op,b, &peek_head, GSER_NO_COPY)) ){
514 Asn1Error("Error during Reading{ in encoding");
515 return LDAP_PROTOCOL_ERROR;
517 if(*peek_head == '}') break;
518 if( !(*peek_head == '{' || *peek_head ==',') ) {
519 return LDAP_PROTOCOL_ERROR;
521 tmpVar = (ComponentTBSCertListSeqOfSeq**) CompAsnListAppend (mem_op, &k->comp_list);
522 if ( tmpVar == NULL ) {
523 Asn1Error("Error during Reading{ in encoding");
524 return LDAP_PROTOCOL_ERROR;
526 rc = GDecComponentTBSCertListSeqOfSeq (mem_op, b, tmpVar, bytesDecoded, mode);
527 if ( rc != LDAP_SUCCESS ) return rc;
530 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
531 *v = t = (ComponentTBSCertListSeqOf*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOf) );
535 t->syntax = (Syntax*)NULL;
536 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
537 if ( !t->comp_desc ) {
541 t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
542 t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
543 t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
544 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOf ;
545 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOf ;
546 t->comp_desc->cd_free = (comp_free_func*)NULL;
547 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOf;
548 t->comp_desc->cd_type = ASN_COMPOSITE;
549 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
550 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOf;
552 } /* GDecTBSCertListSeqOfContent */
555 MatchingComponentTBSCertList ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
560 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
561 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
565 if(COMPONENTNOT_NULL( ((ComponentTBSCertList*)csi_attr)->version ) ) {
566 rc = MatchingComponentVersion ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->version, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->version );
567 if ( rc != LDAP_COMPARE_TRUE )
570 rc = MatchingComponentAlgorithmIdentifier ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->signature, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->signature );
571 if ( rc != LDAP_COMPARE_TRUE )
573 rc = MatchingComponentName ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->issuer, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->issuer );
574 if ( rc != LDAP_COMPARE_TRUE )
576 rc = MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->thisUpdate, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->thisUpdate );
577 if ( rc != LDAP_COMPARE_TRUE )
579 if(COMPONENTNOT_NULL( ((ComponentTBSCertList*)csi_attr)->nextUpdate ) ) {
580 rc = MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->nextUpdate, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->nextUpdate );
581 if ( rc != LDAP_COMPARE_TRUE )
584 rc = MatchingComponentTBSCertListSeqOf ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->revokedCertificates, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->revokedCertificates );
585 if ( rc != LDAP_COMPARE_TRUE )
587 if(COMPONENTNOT_NULL( ((ComponentTBSCertList*)csi_attr)->crlExtensions ) ) {
588 rc = MatchingComponentExtensions ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->crlExtensions, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->crlExtensions );
589 if ( rc != LDAP_COMPARE_TRUE )
592 return LDAP_COMPARE_TRUE;
593 } /* BMatchingComponentTBSCertList */
596 ExtractingComponentTBSCertList ( void* mem_op, ComponentReference* cr, ComponentTBSCertList *comp )
599 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 ) ) {
600 if ( cr->cr_curr->ci_next == NULL )
601 return comp->version;
603 cr->cr_curr = cr->cr_curr->ci_next;
604 return ExtractingComponentVersion ( mem_op, cr, comp->version );
607 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 ) ) {
608 if ( cr->cr_curr->ci_next == NULL )
609 return comp->signature;
611 cr->cr_curr = cr->cr_curr->ci_next;
612 return ExtractingComponentAlgorithmIdentifier ( mem_op, cr, comp->signature );
615 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 ) ) {
616 if ( cr->cr_curr->ci_next == NULL )
619 cr->cr_curr = cr->cr_curr->ci_next;
620 return ExtractingComponentName ( mem_op, cr, comp->issuer );
623 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 ) ) {
624 if ( cr->cr_curr->ci_next == NULL )
625 return comp->thisUpdate;
627 cr->cr_curr = cr->cr_curr->ci_next;
628 return ExtractingComponentTime ( mem_op, cr, comp->thisUpdate );
631 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 ) ) {
632 if ( cr->cr_curr->ci_next == NULL )
633 return comp->nextUpdate;
635 cr->cr_curr = cr->cr_curr->ci_next;
636 return ExtractingComponentTime ( mem_op, cr, comp->nextUpdate );
639 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 ) ) {
640 if ( cr->cr_curr->ci_next == NULL )
641 return comp->revokedCertificates;
643 cr->cr_curr = cr->cr_curr->ci_next;
644 return ExtractingComponentTBSCertListSeqOf ( mem_op, cr, comp->revokedCertificates );
647 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 ) ) {
648 if ( cr->cr_curr->ci_next == NULL )
649 return comp->crlExtensions;
651 cr->cr_curr = cr->cr_curr->ci_next;
652 return ExtractingComponentExtensions ( mem_op, cr, comp->crlExtensions );
656 } /* ExtractingComponentTBSCertList */
659 BDecComponentTBSCertList PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
663 AsnLen elmtLen0 _AND_
664 ComponentTBSCertList **v _AND_
665 AsnLen *bytesDecoded _AND_
669 AsnLen totalElmtsLen1 = 0;
672 int mandatoryElmtCount1 = 0;
673 AsnLen totalElmtsLen2 = 0;
678 ComponentTBSCertList *k, *t, c_temp;
681 if ( !(mode & DEC_ALLOC_MODE_1) ) {
682 memset(&c_temp,0,sizeof(c_temp));
686 mode = DEC_ALLOC_MODE_2;
687 tagId1 = BDecTag (b, &totalElmtsLen1 );
689 if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))))
691 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
692 rc = BDecComponentVersion (mem_op, b, tagId1, elmtLen1, (&k->version), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
693 if ( rc != LDAP_SUCCESS ) return rc;
694 (k->version)->identifier.bv_val = (k->version)->id_buf;
695 (k->version)->identifier.bv_len = strlen("version");
696 strcpy( (k->version)->identifier.bv_val, "version");
697 tagId1 = BDecTag (b, &totalElmtsLen1);
701 if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
703 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
704 rc = BDecComponentAlgorithmIdentifier (mem_op, b, tagId1, elmtLen1, (&k->signature), &totalElmtsLen1, mode);
705 if ( rc != LDAP_SUCCESS ) return rc;
706 (k->signature)->identifier.bv_val = (k->signature)->id_buf;
707 (k->signature)->identifier.bv_len = strlen("signature");
708 strcpy( (k->signature)->identifier.bv_val, "signature");
709 tagId1 = BDecTag (b, &totalElmtsLen1);
716 if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
718 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
719 rc = BDecComponentName (mem_op, b, tagId1, elmtLen1, (&k->issuer), &totalElmtsLen1, mode);
720 if ( rc != LDAP_SUCCESS ) return rc;
721 (k->issuer)->identifier.bv_val = (k->issuer)->id_buf;
722 (k->issuer)->identifier.bv_len = strlen("issuer");
723 strcpy( (k->issuer)->identifier.bv_val, "issuer");
724 tagId1 = BDecTag (b, &totalElmtsLen1);
731 if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||
732 (tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) ||
733 (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))||
734 (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE))))
736 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
737 rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->thisUpdate), &totalElmtsLen1, mode);
738 if ( rc != LDAP_SUCCESS ) return rc;
739 (k->thisUpdate)->identifier.bv_val = (k->thisUpdate)->id_buf;
740 (k->thisUpdate)->identifier.bv_len = strlen("thisUpdate");
741 strcpy( (k->thisUpdate)->identifier.bv_val, "thisUpdate");
742 tagId1 = BDecTag (b, &totalElmtsLen1);
749 if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||
750 (tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) ||
751 (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))||
752 (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE))))
754 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
755 rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->nextUpdate), &totalElmtsLen1, mode);
756 if ( rc != LDAP_SUCCESS ) return rc;
757 (k->nextUpdate)->identifier.bv_val = (k->nextUpdate)->id_buf;
758 (k->nextUpdate)->identifier.bv_len = strlen("nextUpdate");
759 strcpy( (k->nextUpdate)->identifier.bv_val, "nextUpdate");
760 tagId1 = BDecTag (b, &totalElmtsLen1);
764 if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
766 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
767 rc = BDecComponentTBSCertListSeqOf (mem_op, b, tagId1, elmtLen1, (&k->revokedCertificates), &totalElmtsLen1, mode);
768 if ( rc != LDAP_SUCCESS ) return rc;
769 (k->revokedCertificates)->identifier.bv_val = (k->revokedCertificates)->id_buf;
770 (k->revokedCertificates)->identifier.bv_len = strlen("revokedCertificates");
771 strcpy( (k->revokedCertificates)->identifier.bv_val, "revokedCertificates");
772 if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0))
776 tagId1 = BDecTag (b, &totalElmtsLen1 );
778 if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
780 BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
790 if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, CONS, 0))))
792 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
793 tagId2 = BDecTag (b, &totalElmtsLen1 );
795 if (tagId2 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
797 Asn1Error ("Unexpected Tag\n");
801 elmtLen2 = BDecLen (b, &totalElmtsLen1 );
802 rc = BDecComponentExtensions (mem_op, b, tagId2, elmtLen2, (&k->crlExtensions), &totalElmtsLen1, mode);
803 if ( rc != LDAP_SUCCESS ) return rc;
804 (k->crlExtensions)->identifier.bv_val = (k->crlExtensions)->id_buf;
805 (k->crlExtensions)->identifier.bv_len = strlen("crlExtensions");
806 strcpy( (k->crlExtensions)->identifier.bv_val, "crlExtensions");
807 if (elmtLen1 == INDEFINITE_LEN)
808 BDecEoc (b, &totalElmtsLen1 );
810 if (elmtLen0 == INDEFINITE_LEN)
811 BDecEoc (b, &totalElmtsLen1 );
812 else if (totalElmtsLen1 != elmtLen0)
821 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
822 *v = t = (ComponentTBSCertList*) CompAlloc( mem_op, sizeof(ComponentTBSCertList) );
826 t->syntax = (Syntax*)NULL;
827 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
828 if ( !t->comp_desc ) {
832 t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
833 t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
834 t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
835 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertList ;
836 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertList ;
837 t->comp_desc->cd_free = (comp_free_func*)NULL;
838 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertList;
839 t->comp_desc->cd_type = ASN_COMPOSITE;
840 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
841 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertList;
842 (*bytesDecoded) += totalElmtsLen1;
844 } /* BDecTBSCertList*/
847 GDecComponentTBSCertList PARAMS (( mem_op,b, v, bytesDecoded, mode),
850 ComponentTBSCertList **v _AND_
851 AsnLen *bytesDecoded _AND_
854 char* peek_head,*peek_head2;
855 int i, strLen,strLen2, rc, old_mode = mode;
856 ComponentTBSCertList *k,*t, c_temp;
859 if ( !(mode & DEC_ALLOC_MODE_1) ) {
860 memset(&c_temp,0,sizeof(c_temp));
864 mode = DEC_ALLOC_MODE_2;
866 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
867 Asn1Error("Error during Reading { in encoded data");
868 return LDAP_PROTOCOL_ERROR;
870 if(*peek_head != '{'){
871 Asn1Error("Missing { in encoded data");
872 return LDAP_PROTOCOL_ERROR;
875 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
876 Asn1Error("Error during Reading identifier");
877 return LDAP_PROTOCOL_ERROR;
879 if ( strncmp( peek_head, "version", strlen("version") ) == 0 ) {
880 rc = GDecComponentVersion (mem_op, b, (&k->version), bytesDecoded, DEC_ALLOC_MODE_0 );
881 if ( rc != LDAP_SUCCESS ) return rc;
882 ( k->version)->identifier.bv_val = peek_head;
883 ( k->version)->identifier.bv_len = strLen;
884 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
885 Asn1Error("Error during Reading , ");
886 return LDAP_PROTOCOL_ERROR;
888 if(*peek_head != ','){
889 Asn1Error("Missing , in encoding");
890 return LDAP_PROTOCOL_ERROR;
892 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
893 Asn1Error("Error during Reading identifier");
894 return LDAP_PROTOCOL_ERROR;
897 if ( strncmp( peek_head, "signature", strlen("signature") ) == 0 ) {
898 rc = GDecComponentAlgorithmIdentifier (mem_op, b, (&k->signature), bytesDecoded, mode);
899 if ( rc != LDAP_SUCCESS ) return rc;
900 ( k->signature)->identifier.bv_val = peek_head;
901 ( k->signature)->identifier.bv_len = strLen;
902 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
903 Asn1Error("Error during Reading , ");
904 return LDAP_PROTOCOL_ERROR;
906 if(*peek_head != ','){
907 Asn1Error("Missing , in encoding");
908 return LDAP_PROTOCOL_ERROR;
910 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
911 Asn1Error("Error during Reading identifier");
912 return LDAP_PROTOCOL_ERROR;
915 if ( strncmp( peek_head, "issuer", strlen("issuer") ) == 0 ) {
916 rc = GDecComponentName (mem_op, b, (&k->issuer), bytesDecoded, mode);
917 if ( rc != LDAP_SUCCESS ) return rc;
918 ( k->issuer)->identifier.bv_val = peek_head;
919 ( k->issuer)->identifier.bv_len = strLen;
920 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
921 Asn1Error("Error during Reading , ");
922 return LDAP_PROTOCOL_ERROR;
924 if(*peek_head != ','){
925 Asn1Error("Missing , in encoding");
926 return LDAP_PROTOCOL_ERROR;
928 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
929 Asn1Error("Error during Reading identifier");
930 return LDAP_PROTOCOL_ERROR;
933 if ( strncmp( peek_head, "thisUpdate", strlen("thisUpdate") ) == 0 ) {
934 rc = GDecComponentTime (mem_op, b, (&k->thisUpdate), bytesDecoded, mode);
935 if ( rc != LDAP_SUCCESS ) return rc;
936 ( k->thisUpdate)->identifier.bv_val = peek_head;
937 ( k->thisUpdate)->identifier.bv_len = strLen;
938 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
939 Asn1Error("Error during Reading , ");
940 return LDAP_PROTOCOL_ERROR;
942 if(*peek_head != ','){
943 Asn1Error("Missing , in encoding");
944 return LDAP_PROTOCOL_ERROR;
946 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
947 Asn1Error("Error during Reading identifier");
948 return LDAP_PROTOCOL_ERROR;
951 if ( strncmp( peek_head, "nextUpdate", strlen("nextUpdate") ) == 0 ) {
952 rc = GDecComponentTime (mem_op, b, (&k->nextUpdate), bytesDecoded, mode);
953 if ( rc != LDAP_SUCCESS ) return rc;
954 ( k->nextUpdate)->identifier.bv_val = peek_head;
955 ( k->nextUpdate)->identifier.bv_len = strLen;
956 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
957 Asn1Error("Error during Reading , ");
958 return LDAP_PROTOCOL_ERROR;
960 if(*peek_head != ','){
961 Asn1Error("Missing , in encoding");
962 return LDAP_PROTOCOL_ERROR;
964 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
965 Asn1Error("Error during Reading identifier");
966 return LDAP_PROTOCOL_ERROR;
969 if ( strncmp( peek_head, "revokedCertificates", strlen("revokedCertificates") ) == 0 ) {
970 rc = GDecComponentTBSCertListSeqOf (mem_op, b, (&k->revokedCertificates), bytesDecoded, mode);
971 if ( rc != LDAP_SUCCESS ) return rc;
972 ( k->revokedCertificates)->identifier.bv_val = peek_head;
973 ( k->revokedCertificates)->identifier.bv_len = strLen;
974 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
975 Asn1Error("Error during Reading , ");
976 return LDAP_PROTOCOL_ERROR;
978 if(*peek_head != ','){
979 Asn1Error("Missing , in encoding");
980 return LDAP_PROTOCOL_ERROR;
982 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
983 Asn1Error("Error during Reading identifier");
984 return LDAP_PROTOCOL_ERROR;
987 if ( strncmp( peek_head, "crlExtensions", strlen("crlExtensions") ) == 0 ) {
988 rc = GDecComponentExtensions (mem_op, b, (&k->crlExtensions), bytesDecoded, mode);
989 if ( rc != LDAP_SUCCESS ) return rc;
990 ( k->crlExtensions)->identifier.bv_val = peek_head;
991 ( k->crlExtensions)->identifier.bv_len = strLen;
993 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
994 Asn1Error("Error during Reading } in encoding");
995 return LDAP_PROTOCOL_ERROR;
997 if(*peek_head != '}'){
998 Asn1Error("Missing } in encoding");
999 return LDAP_PROTOCOL_ERROR;
1001 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1002 *v = t = (ComponentTBSCertList*) CompAlloc( mem_op, sizeof(ComponentTBSCertList) );
1003 if ( !t ) return -1;
1006 t->syntax = (Syntax*)NULL;
1007 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1008 if ( !t->comp_desc ) {
1012 t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
1013 t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
1014 t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
1015 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertList ;
1016 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertList ;
1017 t->comp_desc->cd_free = (comp_free_func*)NULL;
1018 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertList;
1019 t->comp_desc->cd_type = ASN_COMPOSITE;
1020 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
1021 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertList;
1022 return LDAP_SUCCESS;
1023 } /* GDecTBSCertList*/
1027 MatchingComponentCertificateList ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
1032 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
1033 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
1037 rc = MatchingComponentTBSCertList ( oid, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_attr)->tbsCertList, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_assert)->tbsCertList );
1038 if ( rc != LDAP_COMPARE_TRUE )
1040 rc = MatchingComponentAlgorithmIdentifier ( oid, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_attr)->signatureAlgorithm, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_assert)->signatureAlgorithm );
1041 if ( rc != LDAP_COMPARE_TRUE )
1043 rc = MatchingComponentBits ( oid, (ComponentSyntaxInfo*)&((ComponentCertificateList*)csi_attr)->signature, (ComponentSyntaxInfo*)&((ComponentCertificateList*)csi_assert)->signature );
1044 if ( rc != LDAP_COMPARE_TRUE )
1046 return LDAP_COMPARE_TRUE;
1047 } /* BMatchingComponentCertificateList */
1050 ExtractingComponentCertificateList ( void* mem_op, ComponentReference* cr, ComponentCertificateList *comp )
1053 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 ) ) {
1054 if ( cr->cr_curr->ci_next == NULL )
1055 return comp->tbsCertList;
1057 cr->cr_curr = cr->cr_curr->ci_next;
1058 return ExtractingComponentTBSCertList ( mem_op, cr, comp->tbsCertList );
1061 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 ) ) {
1062 if ( cr->cr_curr->ci_next == NULL )
1063 return comp->signatureAlgorithm;
1065 cr->cr_curr = cr->cr_curr->ci_next;
1066 return ExtractingComponentAlgorithmIdentifier ( mem_op, cr, comp->signatureAlgorithm );
1069 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 ) ) {
1070 if ( cr->cr_curr->ci_next == NULL )
1071 return &comp->signature;
1072 else if ( cr->cr_curr->ci_next->ci_type == LDAP_COMPREF_CONTENT) {
1073 cr->cr_curr = cr->cr_curr->ci_next;
1074 return &comp->signature;
1080 } /* ExtractingComponentCertificateList */
1083 BDecComponentCertificateList PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
1087 AsnLen elmtLen0 _AND_
1088 ComponentCertificateList **v _AND_
1089 AsnLen *bytesDecoded _AND_
1092 int seqDone = FALSE;
1093 AsnLen totalElmtsLen1 = 0;
1096 int mandatoryElmtCount1 = 0;
1097 int old_mode = mode;
1099 ComponentCertificateList *k, *t, c_temp;
1102 if ( !(mode & DEC_ALLOC_MODE_1) ) {
1103 memset(&c_temp,0,sizeof(c_temp));
1107 mode = DEC_ALLOC_MODE_2;
1108 tagId1 = BDecTag (b, &totalElmtsLen1 );
1110 if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
1112 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1113 rc = BDecComponentTBSCertList (mem_op, b, tagId1, elmtLen1, (&k->tbsCertList), &totalElmtsLen1, mode);
1114 if ( rc != LDAP_SUCCESS ) return rc;
1115 (k->tbsCertList)->identifier.bv_val = (k->tbsCertList)->id_buf;
1116 (k->tbsCertList)->identifier.bv_len = strlen("tbsCertList");
1117 strcpy( (k->tbsCertList)->identifier.bv_val, "tbsCertList");
1118 tagId1 = BDecTag (b, &totalElmtsLen1);
1125 if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
1127 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1128 rc = BDecComponentAlgorithmIdentifier (mem_op, b, tagId1, elmtLen1, (&k->signatureAlgorithm), &totalElmtsLen1, mode);
1129 if ( rc != LDAP_SUCCESS ) return rc;
1130 (k->signatureAlgorithm)->identifier.bv_val = (k->signatureAlgorithm)->id_buf;
1131 (k->signatureAlgorithm)->identifier.bv_len = strlen("signatureAlgorithm");
1132 strcpy( (k->signatureAlgorithm)->identifier.bv_val, "signatureAlgorithm");
1133 tagId1 = BDecTag (b, &totalElmtsLen1);
1140 if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, BITSTRING_TAG_CODE)) ||
1141 (tagId1 == MAKE_TAG_ID (UNIV, CONS, BITSTRING_TAG_CODE))))
1143 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1144 rc = BDecComponentBits (mem_op, b, tagId1, elmtLen1, (&k->signature), &totalElmtsLen1, mode);
1145 if ( rc != LDAP_SUCCESS ) return rc;
1146 (&k->signature)->identifier.bv_val = (&k->signature)->id_buf;
1147 (&k->signature)->identifier.bv_len = strlen("signature");
1148 strcpy( (&k->signature)->identifier.bv_val, "signature");
1150 if (elmtLen0 == INDEFINITE_LEN)
1151 BDecEoc (b, &totalElmtsLen1 );
1152 else if (totalElmtsLen1 != elmtLen0)
1164 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1165 *v = t = (ComponentCertificateList*) CompAlloc( mem_op, sizeof(ComponentCertificateList) );
1166 if ( !t ) return -1;
1169 t->syntax = (Syntax*)NULL;
1170 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1171 if ( !t->comp_desc ) {
1175 t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
1176 t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
1177 t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
1178 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentCertificateList ;
1179 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentCertificateList ;
1180 t->comp_desc->cd_free = (comp_free_func*)NULL;
1181 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentCertificateList;
1182 t->comp_desc->cd_type = ASN_COMPOSITE;
1183 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
1184 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentCertificateList;
1185 (*bytesDecoded) += totalElmtsLen1;
1186 return LDAP_SUCCESS;
1187 } /* BDecCertificateList*/
1190 GDecComponentCertificateList PARAMS (( mem_op,b, v, bytesDecoded, mode),
1193 ComponentCertificateList **v _AND_
1194 AsnLen *bytesDecoded _AND_
1197 char* peek_head,*peek_head2;
1198 int i, strLen,strLen2, rc, old_mode = mode;
1199 ComponentCertificateList *k,*t, c_temp;
1202 if ( !(mode & DEC_ALLOC_MODE_1) ) {
1203 memset(&c_temp,0,sizeof(c_temp));
1207 mode = DEC_ALLOC_MODE_2;
1209 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1210 Asn1Error("Error during Reading { in encoded data");
1211 return LDAP_PROTOCOL_ERROR;
1213 if(*peek_head != '{'){
1214 Asn1Error("Missing { in encoded data");
1215 return LDAP_PROTOCOL_ERROR;
1218 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1219 Asn1Error("Error during Reading identifier");
1220 return LDAP_PROTOCOL_ERROR;
1222 if ( strncmp( peek_head, "tbsCertList", strlen("tbsCertList") ) == 0 ) {
1223 rc = GDecComponentTBSCertList (mem_op, b, (&k->tbsCertList), bytesDecoded, mode);
1224 if ( rc != LDAP_SUCCESS ) return rc;
1225 ( k->tbsCertList)->identifier.bv_val = peek_head;
1226 ( k->tbsCertList)->identifier.bv_len = strLen;
1227 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1228 Asn1Error("Error during Reading , ");
1229 return LDAP_PROTOCOL_ERROR;
1231 if(*peek_head != ','){
1232 Asn1Error("Missing , in encoding");
1233 return LDAP_PROTOCOL_ERROR;
1235 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1236 Asn1Error("Error during Reading identifier");
1237 return LDAP_PROTOCOL_ERROR;
1240 if ( strncmp( peek_head, "signatureAlgorithm", strlen("signatureAlgorithm") ) == 0 ) {
1241 rc = GDecComponentAlgorithmIdentifier (mem_op, b, (&k->signatureAlgorithm), bytesDecoded, mode);
1242 if ( rc != LDAP_SUCCESS ) return rc;
1243 ( k->signatureAlgorithm)->identifier.bv_val = peek_head;
1244 ( k->signatureAlgorithm)->identifier.bv_len = strLen;
1245 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1246 Asn1Error("Error during Reading , ");
1247 return LDAP_PROTOCOL_ERROR;
1249 if(*peek_head != ','){
1250 Asn1Error("Missing , in encoding");
1251 return LDAP_PROTOCOL_ERROR;
1253 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1254 Asn1Error("Error during Reading identifier");
1255 return LDAP_PROTOCOL_ERROR;
1258 if ( strncmp( peek_head, "signature", strlen("signature") ) == 0 ) {
1259 rc = GDecComponentBits (mem_op, b, (&k->signature), bytesDecoded, mode);
1260 if ( rc != LDAP_SUCCESS ) return rc;
1261 (&k->signature)->identifier.bv_val = peek_head;
1262 (&k->signature)->identifier.bv_len = strLen;
1264 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
1265 Asn1Error("Error during Reading } in encoding");
1266 return LDAP_PROTOCOL_ERROR;
1268 if(*peek_head != '}'){
1269 Asn1Error("Missing } in encoding");
1270 return LDAP_PROTOCOL_ERROR;
1272 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1273 *v = t = (ComponentCertificateList*) CompAlloc( mem_op, sizeof(ComponentCertificateList) );
1274 if ( !t ) return -1;
1277 t->syntax = (Syntax*)NULL;
1278 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1279 if ( !t->comp_desc ) {
1283 t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
1284 t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
1285 t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
1286 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentCertificateList ;
1287 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentCertificateList ;
1288 t->comp_desc->cd_free = (comp_free_func*)NULL;
1289 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentCertificateList;
1290 t->comp_desc->cd_type = ASN_COMPOSITE;
1291 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
1292 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentCertificateList;
1293 return LDAP_SUCCESS;
1294 } /* GDecCertificateList*/