]> git.sur5r.net Git - openldap/blob - contrib/slapd-modules/comp_match/crl.c
Componant matching routines for CRL support
[openldap] / contrib / slapd-modules / comp_match / crl.c
1 /*
2  *    crl.c
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
6  */
7
8 #include "crl.h"
9
10 BDecComponentCertificateListTop( void* mem_op, GenBuf* b, void *v, AsnLen* bytesDecoded,int mode) {
11         AsnTag tag;
12         AsnLen elmtLen;
13
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) ) {
18                 return (-1);
19         }
20                 
21         return BDecComponentCertificateList( mem_op, b, tag, elmtLen, ( ComponentCertificateList**)v, (AsnLen*)bytesDecoded, mode );
22 }
23
24
25 void init_module_CertificateRevokationList() {
26         InstallOidDecoderMapping( "2.5.4.39", NULL,
27                 GDecComponentCertificateList,
28                 BDecComponentCertificateList,
29                 ExtractingComponentCertificateList,
30                 MatchingComponentCertificateList);
31 }
32
33 int
34 MatchingComponentTBSCertListSeqOfSeq ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
35         int rc;
36         MatchingRule* mr;
37
38         if ( oid ) {
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 );
41         }
42
43         rc = 1;
44         rc =    MatchingComponentCertificateSerialNumber ( oid, (ComponentSyntaxInfo*)&((ComponentTBSCertListSeqOfSeq*)csi_attr)->userCertificate, (ComponentSyntaxInfo*)&((ComponentTBSCertListSeqOfSeq*)csi_assert)->userCertificate );
45         if ( rc != LDAP_COMPARE_TRUE )
46                 return rc;
47         rc =    MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_attr)->revocationDate, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_assert)->revocationDate );
48         if ( rc != LDAP_COMPARE_TRUE )
49                 return rc;
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 )
53                 return rc;
54         }
55         return LDAP_COMPARE_TRUE;
56 }  /* BMatchingComponentTBSCertListSeqOfSeq */
57
58 void*
59 ExtractingComponentTBSCertListSeqOfSeq ( void* mem_op, ComponentReference* cr, ComponentTBSCertListSeqOfSeq *comp )
60 {
61
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;
65                 else
66                 return NULL;
67         }
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;
71                 else {
72                         cr->cr_curr = cr->cr_curr->ci_next;
73                         return  ExtractingComponentTime ( mem_op, cr, comp->revocationDate );
74                 }
75         }
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;
79                 else {
80                         cr->cr_curr = cr->cr_curr->ci_next;
81                         return  ExtractingComponentExtensions ( mem_op, cr, comp->crlEntryExtensions );
82                 }
83         }
84         return NULL;
85 }  /* ExtractingComponentTBSCertListSeqOfSeq */
86
87 int
88 BDecComponentTBSCertListSeqOfSeq PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
89 void* mem_op _AND_
90 GenBuf * b _AND_
91 AsnTag tagId0 _AND_
92 AsnLen elmtLen0 _AND_
93 ComponentTBSCertListSeqOfSeq **v _AND_
94 AsnLen *bytesDecoded _AND_
95 int mode)
96 {
97         int seqDone = FALSE;
98         AsnLen totalElmtsLen1 = 0;
99         AsnLen elmtLen1;
100         AsnTag tagId1;
101         int mandatoryElmtCount1 = 0;
102         AsnLen totalElmtsLen2 = 0;
103         AsnLen elmtLen2;
104         AsnTag tagId2;
105         int old_mode = mode;
106         int rc;
107         ComponentTBSCertListSeqOfSeq *k, *t, c_temp;
108
109
110         if ( !(mode & DEC_ALLOC_MODE_1) ) {
111                 memset(&c_temp,0,sizeof(c_temp));
112                  k = &c_temp;
113         } else
114                  k = t = *v;
115         mode = DEC_ALLOC_MODE_2;
116     tagId1 = BDecTag (b, &totalElmtsLen1 );
117
118     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))))
119     {
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);
127     }
128     else
129         return -1;
130
131
132
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))))
137     {
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))
145         seqDone = TRUE;
146     else
147     {
148         tagId1 = BDecTag (b, &totalElmtsLen1 );
149
150          if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
151         {
152             BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
153             seqDone = TRUE;
154         }
155     }
156     }
157     else
158         return -1;
159
160
161
162     if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
163     {
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");
170         seqDone = TRUE;
171         if (elmtLen0 == INDEFINITE_LEN)
172             BDecEoc (b, &totalElmtsLen1 );
173         else if (totalElmtsLen1 != elmtLen0)
174         return -1;
175
176     }
177
178
179     if (!seqDone)
180         return -1;
181
182         if( !(old_mode & DEC_ALLOC_MODE_1) ) {
183         *v = t = (ComponentTBSCertListSeqOfSeq*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOfSeq) );
184         if ( !t ) return -1;
185         *t = *k;
186         }
187         t->syntax = (Syntax*)NULL;
188         t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
189         if ( !t->comp_desc ) {
190                 free ( t );
191                 return -1;
192         }
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;
204         return LDAP_SUCCESS;
205 }  /* BDecTBSCertListSeqOfSeq*/
206
207 int
208 GDecComponentTBSCertListSeqOfSeq PARAMS (( mem_op,b, v, bytesDecoded, mode),
209 void* mem_op _AND_
210 GenBuf * b _AND_
211 ComponentTBSCertListSeqOfSeq **v _AND_
212 AsnLen *bytesDecoded _AND_
213 int mode)
214 {
215         char* peek_head,*peek_head2;
216         int i, strLen,strLen2, rc, old_mode = mode;
217         ComponentTBSCertListSeqOfSeq *k,*t, c_temp;
218
219
220         if ( !(mode & DEC_ALLOC_MODE_1) ) {
221                 memset(&c_temp,0,sizeof(c_temp));
222                  k = &c_temp;
223         } else
224                  k = t = *v;
225         mode = DEC_ALLOC_MODE_2;
226         *bytesDecoded = 0;
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;
230         }
231         if(*peek_head != '{'){
232                 Asn1Error("Missing { in encoded data");
233                 return LDAP_PROTOCOL_ERROR;
234         }
235
236         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
237                 Asn1Error("Error during Reading identifier");
238                 return LDAP_PROTOCOL_ERROR;
239         }
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;
248         }
249         if(*peek_head != ','){
250                 Asn1Error("Missing , in encoding");
251                 return LDAP_PROTOCOL_ERROR;
252         }
253         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
254           Asn1Error("Error during Reading identifier");
255                 return LDAP_PROTOCOL_ERROR;
256         }
257         }
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;
266         }
267         if(*peek_head != ','){
268                 Asn1Error("Missing , in encoding");
269                 return LDAP_PROTOCOL_ERROR;
270         }
271         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
272           Asn1Error("Error during Reading identifier");
273                 return LDAP_PROTOCOL_ERROR;
274         }
275         }
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;
281         }
282         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
283                 Asn1Error("Error during Reading } in encoding");
284                 return LDAP_PROTOCOL_ERROR;
285         }
286         if(*peek_head != '}'){
287                 Asn1Error("Missing } in encoding");
288                 return LDAP_PROTOCOL_ERROR;
289         }
290         if( !(old_mode & DEC_ALLOC_MODE_1) ) {
291         *v = t = (ComponentTBSCertListSeqOfSeq*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOfSeq) );
292         if ( !t ) return -1;
293         *t = *k;
294         }
295         t->syntax = (Syntax*)NULL;
296         t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
297         if ( !t->comp_desc ) {
298                 free ( t );
299                 return -1;
300         }
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;
311         return LDAP_SUCCESS;
312 }  /* GDecTBSCertListSeqOfSeq*/
313
314
315 int
316 MatchingComponentTBSCertListSeqOf ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
317         int rc;
318         MatchingRule* mr;
319         void* component1, *component2;
320         AsnList *v1, *v2, t_list;
321
322
323         if ( oid ) {
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 );
326         }
327
328         v1 = &((ComponentTBSCertListSeqOf*)csi_attr)->comp_list;
329         v2 = &((ComponentTBSCertListSeqOf*)csi_assert)->comp_list;
330         FOR_EACH_LIST_PAIR_ELMT(component1, component2, v1, v2)
331         {
332                 if( MatchingComponentTBSCertListSeqOfSeq(oid, (ComponentSyntaxInfo*)component1, (ComponentSyntaxInfo*)component2) == LDAP_COMPARE_FALSE) {
333                         return LDAP_COMPARE_FALSE;
334                 }
335         } /* end of for */
336
337         AsnListFirst( v1 );
338         AsnListFirst( v2 );
339         if( (!component1 && component2) || (component1 && !component2))
340                 return LDAP_COMPARE_FALSE;
341         else
342                 return LDAP_COMPARE_TRUE;
343 }  /* BMatchingComponentTBSCertListSeqOfContent */
344
345 void*
346 ExtractingComponentTBSCertListSeqOf ( void* mem_op, ComponentReference* cr, ComponentTBSCertListSeqOf *comp )
347 {
348         int count = 0;
349         int total;
350         AsnList *v = &comp->comp_list;
351         ComponentInt *k;
352         ComponentTBSCertListSeqOfSeq *component;
353
354
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 ) {
359                         if( --count == 0 ) {
360                                 if( cr->cr_curr->ci_next == NULL )
361                                         return component;
362                                 else {
363                                         cr->cr_curr = cr->cr_curr->ci_next;
364                                         return  ExtractingComponentTBSCertListSeqOfSeq ( mem_op, cr, component );
365                                 }
366                         }
367                 }
368                 break;
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 ) {
374                         if( --count == 0 ) {
375                                 if( cr->cr_curr->ci_next == NULL ) 
376                                         return component;
377                                 else {
378                                         cr->cr_curr = cr->cr_curr->ci_next;
379                                         return  ExtractingComponentTBSCertListSeqOfSeq ( mem_op, cr, component );
380                                 }
381                         }
382                 }
383                 break;
384         case LDAP_COMPREF_ALL :
385                 return comp;
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);
397                 return k;
398         default :
399                 return NULL;
400         }
401 }  /* ExtractingComponentTBSCertListSeqOf */
402
403 int
404 BDecComponentTBSCertListSeqOf PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
405 void* mem_op _AND_
406 GenBuf * b _AND_
407 AsnTag tagId0 _AND_
408 AsnLen elmtLen0 _AND_
409 ComponentTBSCertListSeqOf **v _AND_
410 AsnLen *bytesDecoded _AND_
411 int mode)
412 {
413         int seqDone = FALSE;
414         AsnLen totalElmtsLen1 = 0;
415         AsnLen elmtLen1;
416         AsnTag tagId1;
417         int mandatoryElmtCount1 = 0;
418         int old_mode = mode;
419         int rc;
420         ComponentTBSCertListSeqOf *k, *t, c_temp;
421
422
423         if ( !(mode & DEC_ALLOC_MODE_1) ) {
424                 memset(&c_temp,0,sizeof(c_temp));
425                  k = &c_temp;
426         } else
427                  k = t = *v;
428         mode = DEC_ALLOC_MODE_2;
429         AsnListInit(&k->comp_list,sizeof(ComponentTBSCertListSeqOfSeq));
430     for (totalElmtsLen1 = 0; (totalElmtsLen1 < elmtLen0) || (elmtLen0 == INDEFINITE_LEN);)
431     {
432         ComponentTBSCertListSeqOfSeq **tmpVar;
433     tagId1 = BDecTag (b, &totalElmtsLen1 );
434
435     if ((tagId1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
436     {
437         BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
438         break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/
439     }
440     if ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
441     {
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 */
447     else  /* wrong tag */
448     {
449          Asn1Error ("Unexpected Tag\n");
450          return -1;
451     }
452     } /* end of for */
453
454         if( !(old_mode & DEC_ALLOC_MODE_1) ) {
455         *v = t = (ComponentTBSCertListSeqOf*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOf) );
456         if ( !t ) return -1;
457         *t = *k;
458         }
459         t->syntax = (Syntax*)NULL;
460         t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
461         if ( !t->comp_desc ) {
462                 free ( t );
463                 return -1;
464         }
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;
476         return LDAP_SUCCESS;
477 }  /* BDecTBSCertListSeqOfContent */
478
479 int
480 GDecComponentTBSCertListSeqOf PARAMS (( mem_op,b, v, bytesDecoded, mode),
481 void* mem_op _AND_
482 GenBuf * b _AND_
483 ComponentTBSCertListSeqOf **v _AND_
484 AsnLen *bytesDecoded _AND_
485 int mode)
486 {
487         char* peek_head,*peek_head2;
488         int i, strLen,strLen2, rc, old_mode = mode;
489         ComponentTBSCertListSeqOf *k,*t, c_temp;
490
491
492         int ElmtsLen1;
493         if ( !(mode & DEC_ALLOC_MODE_1) ) {
494                 memset(&c_temp,0,sizeof(c_temp));
495                  k = &c_temp;
496         } else
497                  k = t = *v;
498         mode = DEC_ALLOC_MODE_2;
499         AsnListInit( &k->comp_list, sizeof( ComponentTBSCertListSeqOfSeq ) );
500         *bytesDecoded = 0;
501         if( !(strLen = LocateNextGSERToken(mem_op,b, &peek_head, GSER_PEEK)) ){
502                 Asn1Error("Error during Reading { in encoding");
503                 return LDAP_PROTOCOL_ERROR;
504         }
505         if(*peek_head != '{'){
506                 Asn1Error("Missing { in encoded data");
507                 return LDAP_PROTOCOL_ERROR;
508         }
509
510         for (ElmtsLen1 = 0; ElmtsLen1 >= INDEFINITE_LEN; ElmtsLen1++)
511         {
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;
516                 }
517                 if(*peek_head == '}') break;
518                 if( !(*peek_head == '{' || *peek_head ==',') ) {
519                         return LDAP_PROTOCOL_ERROR;
520                 }
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;
525                 }
526                 rc =    GDecComponentTBSCertListSeqOfSeq (mem_op, b, tmpVar, bytesDecoded, mode);
527                 if ( rc != LDAP_SUCCESS ) return rc;
528         } /* end of for */
529
530         if( !(old_mode & DEC_ALLOC_MODE_1) ) {
531         *v = t = (ComponentTBSCertListSeqOf*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOf) );
532         if ( !t ) return -1;
533         *t = *k;
534         }
535         t->syntax = (Syntax*)NULL;
536         t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
537         if ( !t->comp_desc ) {
538                 free ( t );
539                 return -1;
540         }
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;
551         return LDAP_SUCCESS;
552 }  /* GDecTBSCertListSeqOfContent */
553
554 int
555 MatchingComponentTBSCertList ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
556         int rc;
557         MatchingRule* mr;
558
559         if ( oid ) {
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 );
562         }
563
564         rc = 1;
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 )
568                 return rc;
569         }
570         rc =    MatchingComponentAlgorithmIdentifier ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->signature, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->signature );
571         if ( rc != LDAP_COMPARE_TRUE )
572                 return rc;
573         rc =    MatchingComponentName ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->issuer, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->issuer );
574         if ( rc != LDAP_COMPARE_TRUE )
575                 return rc;
576         rc =    MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->thisUpdate, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->thisUpdate );
577         if ( rc != LDAP_COMPARE_TRUE )
578                 return rc;
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 )
582                 return rc;
583         }
584         rc =    MatchingComponentTBSCertListSeqOf ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->revokedCertificates, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->revokedCertificates );
585         if ( rc != LDAP_COMPARE_TRUE )
586                 return rc;
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 )
590                 return rc;
591         }
592         return LDAP_COMPARE_TRUE;
593 }  /* BMatchingComponentTBSCertList */
594
595 void*
596 ExtractingComponentTBSCertList ( void* mem_op, ComponentReference* cr, ComponentTBSCertList *comp )
597 {
598
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;
602                 else {
603                         cr->cr_curr = cr->cr_curr->ci_next;
604                         return  ExtractingComponentVersion ( mem_op, cr, comp->version );
605                 }
606         }
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;
610                 else {
611                         cr->cr_curr = cr->cr_curr->ci_next;
612                         return  ExtractingComponentAlgorithmIdentifier ( mem_op, cr, comp->signature );
613                 }
614         }
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 )
617                         return comp->issuer;
618                 else {
619                         cr->cr_curr = cr->cr_curr->ci_next;
620                         return  ExtractingComponentName ( mem_op, cr, comp->issuer );
621                 }
622         }
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;
626                 else {
627                         cr->cr_curr = cr->cr_curr->ci_next;
628                         return  ExtractingComponentTime ( mem_op, cr, comp->thisUpdate );
629                 }
630         }
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;
634                 else {
635                         cr->cr_curr = cr->cr_curr->ci_next;
636                         return  ExtractingComponentTime ( mem_op, cr, comp->nextUpdate );
637                 }
638         }
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;
642                 else {
643                         cr->cr_curr = cr->cr_curr->ci_next;
644                         return  ExtractingComponentTBSCertListSeqOf ( mem_op, cr, comp->revokedCertificates );
645                 }
646         }
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;
650                 else {
651                         cr->cr_curr = cr->cr_curr->ci_next;
652                         return  ExtractingComponentExtensions ( mem_op, cr, comp->crlExtensions );
653                 }
654         }
655         return NULL;
656 }  /* ExtractingComponentTBSCertList */
657
658 int
659 BDecComponentTBSCertList PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
660 void* mem_op _AND_
661 GenBuf * b _AND_
662 AsnTag tagId0 _AND_
663 AsnLen elmtLen0 _AND_
664 ComponentTBSCertList **v _AND_
665 AsnLen *bytesDecoded _AND_
666 int mode)
667 {
668         int seqDone = FALSE;
669         AsnLen totalElmtsLen1 = 0;
670         AsnLen elmtLen1;
671         AsnTag tagId1;
672         int mandatoryElmtCount1 = 0;
673         AsnLen totalElmtsLen2 = 0;
674         AsnLen elmtLen2;
675         AsnTag tagId2;
676         int old_mode = mode;
677         int rc;
678         ComponentTBSCertList *k, *t, c_temp;
679
680
681         if ( !(mode & DEC_ALLOC_MODE_1) ) {
682                 memset(&c_temp,0,sizeof(c_temp));
683                  k = &c_temp;
684         } else
685                  k = t = *v;
686         mode = DEC_ALLOC_MODE_2;
687     tagId1 = BDecTag (b, &totalElmtsLen1 );
688
689     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))))
690     {
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);
698     }
699
700
701     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
702     {
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);
710     }
711     else
712         return -1;
713
714
715
716     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
717     {
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);
725     }
726     else
727         return -1;
728
729
730
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))))
735     {
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);
743     }
744     else
745         return -1;
746
747
748
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))))
753     {
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);
761     }
762
763
764     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
765     {
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))
773         seqDone = TRUE;
774     else
775     {
776         tagId1 = BDecTag (b, &totalElmtsLen1 );
777
778          if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
779         {
780             BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
781             seqDone = TRUE;
782         }
783     }
784     }
785     else
786         return -1;
787
788
789
790     if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, CONS, 0))))
791     {
792     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
793         tagId2 = BDecTag (b, &totalElmtsLen1 );
794
795     if (tagId2 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
796     {
797          Asn1Error ("Unexpected Tag\n");
798          return -1;
799     }
800
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 );
809         seqDone = TRUE;
810         if (elmtLen0 == INDEFINITE_LEN)
811             BDecEoc (b, &totalElmtsLen1 );
812         else if (totalElmtsLen1 != elmtLen0)
813         return -1;
814
815     }
816
817
818     if (!seqDone)
819         return -1;
820
821         if( !(old_mode & DEC_ALLOC_MODE_1) ) {
822         *v = t = (ComponentTBSCertList*) CompAlloc( mem_op, sizeof(ComponentTBSCertList) );
823         if ( !t ) return -1;
824         *t = *k;
825         }
826         t->syntax = (Syntax*)NULL;
827         t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
828         if ( !t->comp_desc ) {
829                 free ( t );
830                 return -1;
831         }
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;
843         return LDAP_SUCCESS;
844 }  /* BDecTBSCertList*/
845
846 int
847 GDecComponentTBSCertList PARAMS (( mem_op,b, v, bytesDecoded, mode),
848 void* mem_op _AND_
849 GenBuf * b _AND_
850 ComponentTBSCertList **v _AND_
851 AsnLen *bytesDecoded _AND_
852 int mode)
853 {
854         char* peek_head,*peek_head2;
855         int i, strLen,strLen2, rc, old_mode = mode;
856         ComponentTBSCertList *k,*t, c_temp;
857
858
859         if ( !(mode & DEC_ALLOC_MODE_1) ) {
860                 memset(&c_temp,0,sizeof(c_temp));
861                  k = &c_temp;
862         } else
863                  k = t = *v;
864         mode = DEC_ALLOC_MODE_2;
865         *bytesDecoded = 0;
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;
869         }
870         if(*peek_head != '{'){
871                 Asn1Error("Missing { in encoded data");
872                 return LDAP_PROTOCOL_ERROR;
873         }
874
875         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
876                 Asn1Error("Error during Reading identifier");
877                 return LDAP_PROTOCOL_ERROR;
878         }
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;
887         }
888         if(*peek_head != ','){
889                 Asn1Error("Missing , in encoding");
890                 return LDAP_PROTOCOL_ERROR;
891         }
892         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
893           Asn1Error("Error during Reading identifier");
894                 return LDAP_PROTOCOL_ERROR;
895         }
896         }
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;
905         }
906         if(*peek_head != ','){
907                 Asn1Error("Missing , in encoding");
908                 return LDAP_PROTOCOL_ERROR;
909         }
910         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
911           Asn1Error("Error during Reading identifier");
912                 return LDAP_PROTOCOL_ERROR;
913         }
914         }
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;
923         }
924         if(*peek_head != ','){
925                 Asn1Error("Missing , in encoding");
926                 return LDAP_PROTOCOL_ERROR;
927         }
928         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
929           Asn1Error("Error during Reading identifier");
930                 return LDAP_PROTOCOL_ERROR;
931         }
932         }
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;
941         }
942         if(*peek_head != ','){
943                 Asn1Error("Missing , in encoding");
944                 return LDAP_PROTOCOL_ERROR;
945         }
946         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
947           Asn1Error("Error during Reading identifier");
948                 return LDAP_PROTOCOL_ERROR;
949         }
950         }
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;
959         }
960         if(*peek_head != ','){
961                 Asn1Error("Missing , in encoding");
962                 return LDAP_PROTOCOL_ERROR;
963         }
964         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
965           Asn1Error("Error during Reading identifier");
966                 return LDAP_PROTOCOL_ERROR;
967         }
968         }
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;
977         }
978         if(*peek_head != ','){
979                 Asn1Error("Missing , in encoding");
980                 return LDAP_PROTOCOL_ERROR;
981         }
982         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
983           Asn1Error("Error during Reading identifier");
984                 return LDAP_PROTOCOL_ERROR;
985         }
986         }
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;
992         }
993         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
994                 Asn1Error("Error during Reading } in encoding");
995                 return LDAP_PROTOCOL_ERROR;
996         }
997         if(*peek_head != '}'){
998                 Asn1Error("Missing } in encoding");
999                 return LDAP_PROTOCOL_ERROR;
1000         }
1001         if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1002         *v = t = (ComponentTBSCertList*) CompAlloc( mem_op, sizeof(ComponentTBSCertList) );
1003         if ( !t ) return -1;
1004         *t = *k;
1005         }
1006         t->syntax = (Syntax*)NULL;
1007         t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1008         if ( !t->comp_desc ) {
1009                 free ( t );
1010                 return -1;
1011         }
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*/
1024
1025
1026 int
1027 MatchingComponentCertificateList ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
1028         int rc;
1029         MatchingRule* mr;
1030
1031         if ( oid ) {
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 );
1034         }
1035
1036         rc = 1;
1037         rc =    MatchingComponentTBSCertList ( oid, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_attr)->tbsCertList, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_assert)->tbsCertList );
1038         if ( rc != LDAP_COMPARE_TRUE )
1039                 return rc;
1040         rc =    MatchingComponentAlgorithmIdentifier ( oid, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_attr)->signatureAlgorithm, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_assert)->signatureAlgorithm );
1041         if ( rc != LDAP_COMPARE_TRUE )
1042                 return rc;
1043         rc =    MatchingComponentBits ( oid, (ComponentSyntaxInfo*)&((ComponentCertificateList*)csi_attr)->signature, (ComponentSyntaxInfo*)&((ComponentCertificateList*)csi_assert)->signature );
1044         if ( rc != LDAP_COMPARE_TRUE )
1045                 return rc;
1046         return LDAP_COMPARE_TRUE;
1047 }  /* BMatchingComponentCertificateList */
1048
1049 void*
1050 ExtractingComponentCertificateList ( void* mem_op, ComponentReference* cr, ComponentCertificateList *comp )
1051 {
1052
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;
1056                 else {
1057                         cr->cr_curr = cr->cr_curr->ci_next;
1058                         return  ExtractingComponentTBSCertList ( mem_op, cr, comp->tbsCertList );
1059                 }
1060         }
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;
1064                 else {
1065                         cr->cr_curr = cr->cr_curr->ci_next;
1066                         return  ExtractingComponentAlgorithmIdentifier ( mem_op, cr, comp->signatureAlgorithm );
1067                 }
1068         }
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;
1075          } else {
1076                 return NULL;
1077                 }
1078         }
1079         return NULL;
1080 }  /* ExtractingComponentCertificateList */
1081
1082 int
1083 BDecComponentCertificateList PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
1084 void* mem_op _AND_
1085 GenBuf * b _AND_
1086 AsnTag tagId0 _AND_
1087 AsnLen elmtLen0 _AND_
1088 ComponentCertificateList **v _AND_
1089 AsnLen *bytesDecoded _AND_
1090 int mode)
1091 {
1092         int seqDone = FALSE;
1093         AsnLen totalElmtsLen1 = 0;
1094         AsnLen elmtLen1;
1095         AsnTag tagId1;
1096         int mandatoryElmtCount1 = 0;
1097         int old_mode = mode;
1098         int rc;
1099         ComponentCertificateList *k, *t, c_temp;
1100
1101
1102         if ( !(mode & DEC_ALLOC_MODE_1) ) {
1103                 memset(&c_temp,0,sizeof(c_temp));
1104                  k = &c_temp;
1105         } else
1106                  k = t = *v;
1107         mode = DEC_ALLOC_MODE_2;
1108     tagId1 = BDecTag (b, &totalElmtsLen1 );
1109
1110     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
1111     {
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);
1119     }
1120     else
1121         return -1;
1122
1123
1124
1125     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
1126     {
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);
1134     }
1135     else
1136         return -1;
1137
1138
1139
1140     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, BITSTRING_TAG_CODE)) ||
1141 (tagId1 == MAKE_TAG_ID (UNIV, CONS, BITSTRING_TAG_CODE))))
1142     {
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");
1149         seqDone = TRUE;
1150         if (elmtLen0 == INDEFINITE_LEN)
1151             BDecEoc (b, &totalElmtsLen1 );
1152         else if (totalElmtsLen1 != elmtLen0)
1153         return -1;
1154
1155     }
1156     else
1157         return -1;
1158
1159
1160
1161     if (!seqDone)
1162         return -1;
1163
1164         if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1165         *v = t = (ComponentCertificateList*) CompAlloc( mem_op, sizeof(ComponentCertificateList) );
1166         if ( !t ) return -1;
1167         *t = *k;
1168         }
1169         t->syntax = (Syntax*)NULL;
1170         t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1171         if ( !t->comp_desc ) {
1172                 free ( t );
1173                 return -1;
1174         }
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*/
1188
1189 int
1190 GDecComponentCertificateList PARAMS (( mem_op,b, v, bytesDecoded, mode),
1191 void* mem_op _AND_
1192 GenBuf * b _AND_
1193 ComponentCertificateList **v _AND_
1194 AsnLen *bytesDecoded _AND_
1195 int mode)
1196 {
1197         char* peek_head,*peek_head2;
1198         int i, strLen,strLen2, rc, old_mode = mode;
1199         ComponentCertificateList *k,*t, c_temp;
1200
1201
1202         if ( !(mode & DEC_ALLOC_MODE_1) ) {
1203                 memset(&c_temp,0,sizeof(c_temp));
1204                  k = &c_temp;
1205         } else
1206                  k = t = *v;
1207         mode = DEC_ALLOC_MODE_2;
1208         *bytesDecoded = 0;
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;
1212         }
1213         if(*peek_head != '{'){
1214                 Asn1Error("Missing { in encoded data");
1215                 return LDAP_PROTOCOL_ERROR;
1216         }
1217
1218         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1219                 Asn1Error("Error during Reading identifier");
1220                 return LDAP_PROTOCOL_ERROR;
1221         }
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;
1230         }
1231         if(*peek_head != ','){
1232                 Asn1Error("Missing , in encoding");
1233                 return LDAP_PROTOCOL_ERROR;
1234         }
1235         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1236           Asn1Error("Error during Reading identifier");
1237                 return LDAP_PROTOCOL_ERROR;
1238         }
1239         }
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;
1248         }
1249         if(*peek_head != ','){
1250                 Asn1Error("Missing , in encoding");
1251                 return LDAP_PROTOCOL_ERROR;
1252         }
1253         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1254           Asn1Error("Error during Reading identifier");
1255                 return LDAP_PROTOCOL_ERROR;
1256         }
1257         }
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;
1263         }
1264         if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
1265                 Asn1Error("Error during Reading } in encoding");
1266                 return LDAP_PROTOCOL_ERROR;
1267         }
1268         if(*peek_head != '}'){
1269                 Asn1Error("Missing } in encoding");
1270                 return LDAP_PROTOCOL_ERROR;
1271         }
1272         if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1273         *v = t = (ComponentCertificateList*) CompAlloc( mem_op, sizeof(ComponentCertificateList) );
1274         if ( !t ) return -1;
1275         *t = *k;
1276         }
1277         t->syntax = (Syntax*)NULL;
1278         t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1279         if ( !t->comp_desc ) {
1280                 free ( t );
1281                 return -1;
1282         }
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*/