Back to index

openldap  2.4.31
crl.c
Go to the documentation of this file.
00001 /*
00002  *    crl.c
00003  *    "CertificateRevokationList" ASN.1 module encode/decode/extracting/matching/free C src.
00004  *    This file was generated by modified eSMACC compiler Fri Jan 21 11:25:24 2005
00005  *    The generated files are supposed to be compiled as a module for OpenLDAP Software
00006  */
00007 
00008 #include "crl.h"
00009 
00010 BDecComponentCertificateListTop( void* mem_op, GenBuf* b, void *v, AsnLen* bytesDecoded,int mode) {
00011        AsnTag tag;
00012        AsnLen elmtLen;
00013 
00014        tag = BDecTag ( b, bytesDecoded );
00015        elmtLen = BDecLen ( b, bytesDecoded );
00016        if ( elmtLen <= 0 ) return (-1);
00017        if ( tag != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE) ) {
00018               return (-1);
00019        }
00020               
00021        return BDecComponentCertificateList( mem_op, b, tag, elmtLen, ( ComponentCertificateList**)v, (AsnLen*)bytesDecoded, mode );
00022 }
00023 
00024 
00025 void init_module_CertificateRevokationList() {
00026        InstallOidDecoderMapping( "2.5.4.39", NULL,
00027               GDecComponentCertificateList,
00028               BDecComponentCertificateListTop,
00029               ExtractingComponentCertificateList,
00030               MatchingComponentCertificateList);
00031 }
00032 
00033 int
00034 MatchingComponentTBSCertListSeqOfSeq ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
00035        int rc;
00036        MatchingRule* mr;
00037 
00038        if ( oid ) {
00039               mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
00040               if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
00041        }
00042 
00043        rc = 1;
00044        rc =   MatchingComponentCertificateSerialNumber ( oid, (ComponentSyntaxInfo*)&((ComponentTBSCertListSeqOfSeq*)csi_attr)->userCertificate, (ComponentSyntaxInfo*)&((ComponentTBSCertListSeqOfSeq*)csi_assert)->userCertificate );
00045        if ( rc != LDAP_COMPARE_TRUE )
00046               return rc;
00047        rc =   MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_attr)->revocationDate, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_assert)->revocationDate );
00048        if ( rc != LDAP_COMPARE_TRUE )
00049               return rc;
00050        if(COMPONENTNOT_NULL( ((ComponentTBSCertListSeqOfSeq*)csi_attr)->crlEntryExtensions ) ) {
00051        rc =   MatchingComponentExtensions ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_attr)->crlEntryExtensions, (ComponentSyntaxInfo*)((ComponentTBSCertListSeqOfSeq*)csi_assert)->crlEntryExtensions );
00052        if ( rc != LDAP_COMPARE_TRUE )
00053               return rc;
00054        }
00055        return LDAP_COMPARE_TRUE;
00056 }  /* BMatchingComponentTBSCertListSeqOfSeq */
00057 
00058 void*
00059 ExtractingComponentTBSCertListSeqOfSeq ( void* mem_op, ComponentReference* cr, ComponentTBSCertListSeqOfSeq *comp )
00060 {
00061 
00062        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 ) ) {
00063               if ( cr->cr_curr->ci_next == NULL )
00064               return &comp->userCertificate;
00065               else
00066               return NULL;
00067        }
00068        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 ) ) {
00069               if ( cr->cr_curr->ci_next == NULL )
00070                      return comp->revocationDate;
00071               else {
00072                      cr->cr_curr = cr->cr_curr->ci_next;
00073                      return        ExtractingComponentTime ( mem_op, cr, comp->revocationDate );
00074               }
00075        }
00076        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 ) ) {
00077               if ( cr->cr_curr->ci_next == NULL )
00078                      return comp->crlEntryExtensions;
00079               else {
00080                      cr->cr_curr = cr->cr_curr->ci_next;
00081                      return        ExtractingComponentExtensions ( mem_op, cr, comp->crlEntryExtensions );
00082               }
00083        }
00084        return NULL;
00085 }  /* ExtractingComponentTBSCertListSeqOfSeq */
00086 
00087 int
00088 BDecComponentTBSCertListSeqOfSeq PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
00089 void* mem_op _AND_
00090 GenBuf * b _AND_
00091 AsnTag tagId0 _AND_
00092 AsnLen elmtLen0 _AND_
00093 ComponentTBSCertListSeqOfSeq **v _AND_
00094 AsnLen *bytesDecoded _AND_
00095 int mode)
00096 {
00097        int seqDone = FALSE;
00098        AsnLen totalElmtsLen1 = 0;
00099        AsnLen elmtLen1;
00100        AsnTag tagId1;
00101        int mandatoryElmtCount1 = 0;
00102        AsnLen totalElmtsLen2 = 0;
00103        AsnLen elmtLen2;
00104        AsnTag tagId2;
00105        int old_mode = mode;
00106        int rc;
00107        ComponentTBSCertListSeqOfSeq *k, *t, c_temp;
00108 
00109 
00110        if ( !(mode & DEC_ALLOC_MODE_1) ) {
00111               memset(&c_temp,0,sizeof(c_temp));
00112                k = &c_temp;
00113        } else
00114                k = t = *v;
00115        mode = DEC_ALLOC_MODE_2;
00116     tagId1 = BDecTag (b, &totalElmtsLen1 );
00117 
00118     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))))
00119     {
00120     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00121        rc = BDecComponentCertificateSerialNumber (mem_op, b, tagId1, elmtLen1, (&k->userCertificate), &totalElmtsLen1, mode);
00122               if ( rc != LDAP_SUCCESS ) return rc;
00123               (&k->userCertificate)->identifier.bv_val = (&k->userCertificate)->id_buf;
00124               (&k->userCertificate)->identifier.bv_len = strlen("userCertificate");
00125               strcpy( (&k->userCertificate)->identifier.bv_val, "userCertificate");
00126     tagId1 = BDecTag (b, &totalElmtsLen1);
00127     }
00128     else
00129         return -1;
00130 
00131 
00132 
00133     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||
00134 (tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) ||
00135      (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))||
00136     (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE))))
00137     {
00138         elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00139        rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->revocationDate), &totalElmtsLen1, mode);
00140               if ( rc != LDAP_SUCCESS ) return rc;
00141               (k->revocationDate)->identifier.bv_val = (k->revocationDate)->id_buf;
00142               (k->revocationDate)->identifier.bv_len = strlen("revocationDate");
00143               strcpy( (k->revocationDate)->identifier.bv_val, "revocationDate");
00144     if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0))
00145         seqDone = TRUE;
00146     else
00147     {
00148         tagId1 = BDecTag (b, &totalElmtsLen1 );
00149 
00150          if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
00151         {
00152             BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
00153             seqDone = TRUE;
00154         }
00155     }
00156     }
00157     else
00158         return -1;
00159 
00160 
00161 
00162     if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
00163     {
00164     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00165        rc = BDecComponentExtensions (mem_op, b, tagId1, elmtLen1, (&k->crlEntryExtensions), &totalElmtsLen1, mode);
00166               if ( rc != LDAP_SUCCESS ) return rc;
00167               (k->crlEntryExtensions)->identifier.bv_val = (k->crlEntryExtensions)->id_buf;
00168               (k->crlEntryExtensions)->identifier.bv_len = strlen("crlEntryExtensions");
00169               strcpy( (k->crlEntryExtensions)->identifier.bv_val, "crlEntryExtensions");
00170         seqDone = TRUE;
00171         if (elmtLen0 == INDEFINITE_LEN)
00172             BDecEoc (b, &totalElmtsLen1 );
00173         else if (totalElmtsLen1 != elmtLen0)
00174         return -1;
00175 
00176     }
00177 
00178 
00179     if (!seqDone)
00180         return -1;
00181 
00182        if( !(old_mode & DEC_ALLOC_MODE_1) ) {
00183        *v = t = (ComponentTBSCertListSeqOfSeq*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOfSeq) );
00184        if ( !t ) return -1;
00185        *t = *k;
00186        }
00187        t->syntax = (Syntax*)NULL;
00188        t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
00189        if ( !t->comp_desc ) {
00190               free ( t );
00191               return -1;
00192        }
00193        t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
00194        t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
00195        t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
00196        t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOfSeq ;
00197        t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOfSeq ;
00198        t->comp_desc->cd_free = (comp_free_func*)NULL;
00199        t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOfSeq;
00200        t->comp_desc->cd_type = ASN_COMPOSITE;
00201        t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
00202        t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOfSeq;
00203     (*bytesDecoded) += totalElmtsLen1;
00204        return LDAP_SUCCESS;
00205 }  /* BDecTBSCertListSeqOfSeq*/
00206 
00207 int
00208 GDecComponentTBSCertListSeqOfSeq PARAMS (( mem_op,b, v, bytesDecoded, mode),
00209 void* mem_op _AND_
00210 GenBuf * b _AND_
00211 ComponentTBSCertListSeqOfSeq **v _AND_
00212 AsnLen *bytesDecoded _AND_
00213 int mode)
00214 {
00215        char* peek_head,*peek_head2;
00216        int i, strLen,strLen2, rc, old_mode = mode;
00217        ComponentTBSCertListSeqOfSeq *k,*t, c_temp;
00218 
00219 
00220        if ( !(mode & DEC_ALLOC_MODE_1) ) {
00221               memset(&c_temp,0,sizeof(c_temp));
00222                k = &c_temp;
00223        } else
00224                k = t = *v;
00225        mode = DEC_ALLOC_MODE_2;
00226        *bytesDecoded = 0;
00227        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00228               Asn1Error("Error during Reading { in encoded data");
00229               return LDAP_PROTOCOL_ERROR;
00230        }
00231        if(*peek_head != '{'){
00232               Asn1Error("Missing { in encoded data");
00233               return LDAP_PROTOCOL_ERROR;
00234        }
00235 
00236        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00237               Asn1Error("Error during Reading identifier");
00238               return LDAP_PROTOCOL_ERROR;
00239        }
00240        if ( strncmp( peek_head, "userCertificate", strlen("userCertificate") ) == 0 ) {
00241               rc =   GDecComponentCertificateSerialNumber (mem_op, b, (&k->userCertificate), bytesDecoded, mode);
00242               if ( rc != LDAP_SUCCESS ) return rc;
00243        (&k->userCertificate)->identifier.bv_val = peek_head;
00244        (&k->userCertificate)->identifier.bv_len = strLen;
00245        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00246               Asn1Error("Error during Reading , ");
00247               return LDAP_PROTOCOL_ERROR;
00248        }
00249        if(*peek_head != ','){
00250               Asn1Error("Missing , in encoding");
00251               return LDAP_PROTOCOL_ERROR;
00252        }
00253        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00254          Asn1Error("Error during Reading identifier");
00255               return LDAP_PROTOCOL_ERROR;
00256        }
00257        }
00258        if ( strncmp( peek_head, "revocationDate", strlen("revocationDate") ) == 0 ) {
00259               rc =   GDecComponentTime (mem_op, b, (&k->revocationDate), bytesDecoded, mode);
00260               if ( rc != LDAP_SUCCESS ) return rc;
00261        ( k->revocationDate)->identifier.bv_val = peek_head;
00262        ( k->revocationDate)->identifier.bv_len = strLen;
00263        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00264               Asn1Error("Error during Reading , ");
00265               return LDAP_PROTOCOL_ERROR;
00266        }
00267        if(*peek_head != ','){
00268               Asn1Error("Missing , in encoding");
00269               return LDAP_PROTOCOL_ERROR;
00270        }
00271        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00272          Asn1Error("Error during Reading identifier");
00273               return LDAP_PROTOCOL_ERROR;
00274        }
00275        }
00276        if ( strncmp( peek_head, "crlEntryExtensions", strlen("crlEntryExtensions") ) == 0 ) {
00277               rc =   GDecComponentExtensions (mem_op, b, (&k->crlEntryExtensions), bytesDecoded, mode);
00278               if ( rc != LDAP_SUCCESS ) return rc;
00279        ( k->crlEntryExtensions)->identifier.bv_val = peek_head;
00280        ( k->crlEntryExtensions)->identifier.bv_len = strLen;
00281        }
00282        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
00283               Asn1Error("Error during Reading } in encoding");
00284               return LDAP_PROTOCOL_ERROR;
00285        }
00286        if(*peek_head != '}'){
00287               Asn1Error("Missing } in encoding");
00288               return LDAP_PROTOCOL_ERROR;
00289        }
00290        if( !(old_mode & DEC_ALLOC_MODE_1) ) {
00291        *v = t = (ComponentTBSCertListSeqOfSeq*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOfSeq) );
00292        if ( !t ) return -1;
00293        *t = *k;
00294        }
00295        t->syntax = (Syntax*)NULL;
00296        t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
00297        if ( !t->comp_desc ) {
00298               free ( t );
00299               return -1;
00300        }
00301        t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
00302        t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
00303        t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
00304        t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOfSeq ;
00305        t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOfSeq ;
00306        t->comp_desc->cd_free = (comp_free_func*)NULL;
00307        t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOfSeq;
00308        t->comp_desc->cd_type = ASN_COMPOSITE;
00309        t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
00310        t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOfSeq;
00311        return LDAP_SUCCESS;
00312 }  /* GDecTBSCertListSeqOfSeq*/
00313 
00314 
00315 int
00316 MatchingComponentTBSCertListSeqOf ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
00317        int rc;
00318        MatchingRule* mr;
00319        void* component1, *component2;
00320        AsnList *v1, *v2, t_list;
00321 
00322 
00323        if ( oid ) {
00324               mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
00325               if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
00326        }
00327 
00328        v1 = &((ComponentTBSCertListSeqOf*)csi_attr)->comp_list;
00329        v2 = &((ComponentTBSCertListSeqOf*)csi_assert)->comp_list;
00330        FOR_EACH_LIST_PAIR_ELMT(component1, component2, v1, v2)
00331        {
00332               if( MatchingComponentTBSCertListSeqOfSeq(oid, (ComponentSyntaxInfo*)component1, (ComponentSyntaxInfo*)component2) == LDAP_COMPARE_FALSE) {
00333                      return LDAP_COMPARE_FALSE;
00334               }
00335        } /* end of for */
00336 
00337        AsnListFirst( v1 );
00338        AsnListFirst( v2 );
00339        if( (!component1 && component2) || (component1 && !component2))
00340               return LDAP_COMPARE_FALSE;
00341        else
00342               return LDAP_COMPARE_TRUE;
00343 }  /* BMatchingComponentTBSCertListSeqOfContent */
00344 
00345 void*
00346 ExtractingComponentTBSCertListSeqOf ( void* mem_op, ComponentReference* cr, ComponentTBSCertListSeqOf *comp )
00347 {
00348        int count = 0;
00349        int total;
00350        AsnList *v = &comp->comp_list;
00351        ComponentInt *k;
00352        ComponentTBSCertListSeqOfSeq *component;
00353 
00354 
00355        switch ( cr->cr_curr->ci_type ) {
00356        case LDAP_COMPREF_FROM_BEGINNING :
00357               count = cr->cr_curr->ci_val.ci_from_beginning;
00358               FOR_EACH_LIST_ELMT( component , v ) {
00359                      if( --count == 0 ) {
00360                             if( cr->cr_curr->ci_next == NULL )
00361                                    return component;
00362                             else {
00363                                    cr->cr_curr = cr->cr_curr->ci_next;
00364                                    return        ExtractingComponentTBSCertListSeqOfSeq ( mem_op, cr, component );
00365                             }
00366                      }
00367               }
00368               break;
00369        case LDAP_COMPREF_FROM_END :
00370               total = AsnListCount ( v );
00371               count = cr->cr_curr->ci_val.ci_from_end;
00372               count = total + count +1;
00373               FOR_EACH_LIST_ELMT ( component, v ) {
00374                      if( --count == 0 ) {
00375                             if( cr->cr_curr->ci_next == NULL ) 
00376                                    return component;
00377                             else {
00378                                    cr->cr_curr = cr->cr_curr->ci_next;
00379                                    return        ExtractingComponentTBSCertListSeqOfSeq ( mem_op, cr, component );
00380                             }
00381                      }
00382               }
00383               break;
00384        case LDAP_COMPREF_ALL :
00385               return comp;
00386        case LDAP_COMPREF_COUNT :
00387               k = (ComponentInt*)CompAlloc( mem_op, sizeof(ComponentInt));
00388               k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
00389               k->comp_desc->cd_tag = (-1);
00390               k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentInt;
00391               k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentInt;
00392               k->comp_desc->cd_extract_i = (extract_component_from_id_func*)NULL;
00393               k->comp_desc->cd_type = ASN_BASIC;
00394               k->comp_desc->cd_type_id = BASICTYPE_INTEGER;
00395               k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentInt;
00396               k->value = AsnListCount(v);
00397               return k;
00398        default :
00399               return NULL;
00400        }
00401 }  /* ExtractingComponentTBSCertListSeqOf */
00402 
00403 int
00404 BDecComponentTBSCertListSeqOf PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
00405 void* mem_op _AND_
00406 GenBuf * b _AND_
00407 AsnTag tagId0 _AND_
00408 AsnLen elmtLen0 _AND_
00409 ComponentTBSCertListSeqOf **v _AND_
00410 AsnLen *bytesDecoded _AND_
00411 int mode)
00412 {
00413        int seqDone = FALSE;
00414        AsnLen totalElmtsLen1 = 0;
00415        AsnLen elmtLen1;
00416        AsnTag tagId1;
00417        int mandatoryElmtCount1 = 0;
00418        int old_mode = mode;
00419        int rc;
00420        ComponentTBSCertListSeqOf *k, *t, c_temp;
00421 
00422 
00423        if ( !(mode & DEC_ALLOC_MODE_1) ) {
00424               memset(&c_temp,0,sizeof(c_temp));
00425                k = &c_temp;
00426        } else
00427                k = t = *v;
00428        mode = DEC_ALLOC_MODE_2;
00429        AsnListInit(&k->comp_list,sizeof(ComponentTBSCertListSeqOfSeq));
00430     for (totalElmtsLen1 = 0; (totalElmtsLen1 < elmtLen0) || (elmtLen0 == INDEFINITE_LEN);)
00431     {
00432         ComponentTBSCertListSeqOfSeq **tmpVar;
00433     tagId1 = BDecTag (b, &totalElmtsLen1 );
00434 
00435     if ((tagId1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
00436     {
00437         BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
00438         break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/
00439     }
00440     if ((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
00441     {
00442         elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00443     tmpVar = (ComponentTBSCertListSeqOfSeq**) CompAsnListAppend (mem_op,&k->comp_list);
00444        rc = BDecComponentTBSCertListSeqOfSeq (mem_op, b, tagId1, elmtLen1, tmpVar, &totalElmtsLen1, mode);
00445               if ( rc != LDAP_SUCCESS ) return rc;
00446     }  /* end of tag check if */
00447     else  /* wrong tag */
00448     {
00449          Asn1Error ("Unexpected Tag\n");
00450          return -1;
00451     }
00452     } /* end of for */
00453 
00454        if( !(old_mode & DEC_ALLOC_MODE_1) ) {
00455        *v = t = (ComponentTBSCertListSeqOf*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOf) );
00456        if ( !t ) return -1;
00457        *t = *k;
00458        }
00459        t->syntax = (Syntax*)NULL;
00460        t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
00461        if ( !t->comp_desc ) {
00462               free ( t );
00463               return -1;
00464        }
00465        t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
00466        t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
00467        t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
00468        t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOf ;
00469        t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOf ;
00470        t->comp_desc->cd_free = (comp_free_func*)NULL;
00471        t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOf;
00472        t->comp_desc->cd_type = ASN_COMPOSITE;
00473        t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
00474        t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOf;
00475     (*bytesDecoded) += totalElmtsLen1;
00476        return LDAP_SUCCESS;
00477 }  /* BDecTBSCertListSeqOfContent */
00478 
00479 int
00480 GDecComponentTBSCertListSeqOf PARAMS (( mem_op,b, v, bytesDecoded, mode),
00481 void* mem_op _AND_
00482 GenBuf * b _AND_
00483 ComponentTBSCertListSeqOf **v _AND_
00484 AsnLen *bytesDecoded _AND_
00485 int mode)
00486 {
00487        char* peek_head,*peek_head2;
00488        int i, strLen,strLen2, rc, old_mode = mode;
00489        ComponentTBSCertListSeqOf *k,*t, c_temp;
00490 
00491 
00492        int ElmtsLen1;
00493        if ( !(mode & DEC_ALLOC_MODE_1) ) {
00494               memset(&c_temp,0,sizeof(c_temp));
00495                k = &c_temp;
00496        } else
00497                k = t = *v;
00498        mode = DEC_ALLOC_MODE_2;
00499        AsnListInit( &k->comp_list, sizeof( ComponentTBSCertListSeqOfSeq ) );
00500        *bytesDecoded = 0;
00501        if( !(strLen = LocateNextGSERToken(mem_op,b, &peek_head, GSER_PEEK)) ){
00502               Asn1Error("Error during Reading { in encoding");
00503               return LDAP_PROTOCOL_ERROR;
00504        }
00505        if(*peek_head != '{'){
00506               Asn1Error("Missing { in encoded data");
00507               return LDAP_PROTOCOL_ERROR;
00508        }
00509 
00510        for (ElmtsLen1 = 0; ElmtsLen1 >= INDEFINITE_LEN; ElmtsLen1++)
00511        {
00512               ComponentTBSCertListSeqOfSeq **tmpVar;
00513               if( !(strLen = LocateNextGSERToken(mem_op,b, &peek_head, GSER_NO_COPY)) ){
00514                      Asn1Error("Error during Reading{ in encoding");
00515                      return LDAP_PROTOCOL_ERROR;
00516               }
00517               if(*peek_head == '}') break;
00518               if( !(*peek_head == '{' || *peek_head ==',') ) {
00519                      return LDAP_PROTOCOL_ERROR;
00520               }
00521               tmpVar = (ComponentTBSCertListSeqOfSeq**) CompAsnListAppend (mem_op, &k->comp_list);
00522               if ( tmpVar == NULL ) {
00523                      Asn1Error("Error during Reading{ in encoding");
00524                      return LDAP_PROTOCOL_ERROR;
00525               }
00526               rc =   GDecComponentTBSCertListSeqOfSeq (mem_op, b, tmpVar, bytesDecoded, mode);
00527               if ( rc != LDAP_SUCCESS ) return rc;
00528        } /* end of for */
00529 
00530        if( !(old_mode & DEC_ALLOC_MODE_1) ) {
00531        *v = t = (ComponentTBSCertListSeqOf*) CompAlloc( mem_op, sizeof(ComponentTBSCertListSeqOf) );
00532        if ( !t ) return -1;
00533        *t = *k;
00534        }
00535        t->syntax = (Syntax*)NULL;
00536        t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
00537        if ( !t->comp_desc ) {
00538               free ( t );
00539               return -1;
00540        }
00541        t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
00542        t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
00543        t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
00544        t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertListSeqOf ;
00545        t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertListSeqOf ;
00546        t->comp_desc->cd_free = (comp_free_func*)NULL;
00547        t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertListSeqOf;
00548        t->comp_desc->cd_type = ASN_COMPOSITE;
00549        t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
00550        t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertListSeqOf;
00551        return LDAP_SUCCESS;
00552 }  /* GDecTBSCertListSeqOfContent */
00553 
00554 int
00555 MatchingComponentTBSCertList ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
00556        int rc;
00557        MatchingRule* mr;
00558 
00559        if ( oid ) {
00560               mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
00561               if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
00562        }
00563 
00564        rc = 1;
00565        if(COMPONENTNOT_NULL( ((ComponentTBSCertList*)csi_attr)->version ) ) {
00566        rc =   MatchingComponentVersion ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->version, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->version );
00567        if ( rc != LDAP_COMPARE_TRUE )
00568               return rc;
00569        }
00570        rc =   MatchingComponentAlgorithmIdentifier ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->signature, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->signature );
00571        if ( rc != LDAP_COMPARE_TRUE )
00572               return rc;
00573        rc =   MatchingComponentName ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->issuer, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->issuer );
00574        if ( rc != LDAP_COMPARE_TRUE )
00575               return rc;
00576        rc =   MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->thisUpdate, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->thisUpdate );
00577        if ( rc != LDAP_COMPARE_TRUE )
00578               return rc;
00579        if(COMPONENTNOT_NULL( ((ComponentTBSCertList*)csi_attr)->nextUpdate ) ) {
00580        rc =   MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->nextUpdate, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->nextUpdate );
00581        if ( rc != LDAP_COMPARE_TRUE )
00582               return rc;
00583        }
00584        rc =   MatchingComponentTBSCertListSeqOf ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->revokedCertificates, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->revokedCertificates );
00585        if ( rc != LDAP_COMPARE_TRUE )
00586               return rc;
00587        if(COMPONENTNOT_NULL( ((ComponentTBSCertList*)csi_attr)->crlExtensions ) ) {
00588        rc =   MatchingComponentExtensions ( oid, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_attr)->crlExtensions, (ComponentSyntaxInfo*)((ComponentTBSCertList*)csi_assert)->crlExtensions );
00589        if ( rc != LDAP_COMPARE_TRUE )
00590               return rc;
00591        }
00592        return LDAP_COMPARE_TRUE;
00593 }  /* BMatchingComponentTBSCertList */
00594 
00595 void*
00596 ExtractingComponentTBSCertList ( void* mem_op, ComponentReference* cr, ComponentTBSCertList *comp )
00597 {
00598 
00599        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 ) ) {
00600               if ( cr->cr_curr->ci_next == NULL )
00601                      return comp->version;
00602               else {
00603                      cr->cr_curr = cr->cr_curr->ci_next;
00604                      return        ExtractingComponentVersion ( mem_op, cr, comp->version );
00605               }
00606        }
00607        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 ) ) {
00608               if ( cr->cr_curr->ci_next == NULL )
00609                      return comp->signature;
00610               else {
00611                      cr->cr_curr = cr->cr_curr->ci_next;
00612                      return        ExtractingComponentAlgorithmIdentifier ( mem_op, cr, comp->signature );
00613               }
00614        }
00615        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 ) ) {
00616               if ( cr->cr_curr->ci_next == NULL )
00617                      return comp->issuer;
00618               else {
00619                      cr->cr_curr = cr->cr_curr->ci_next;
00620                      return        ExtractingComponentName ( mem_op, cr, comp->issuer );
00621               }
00622        }
00623        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 ) ) {
00624               if ( cr->cr_curr->ci_next == NULL )
00625                      return comp->thisUpdate;
00626               else {
00627                      cr->cr_curr = cr->cr_curr->ci_next;
00628                      return        ExtractingComponentTime ( mem_op, cr, comp->thisUpdate );
00629               }
00630        }
00631        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 ) ) {
00632               if ( cr->cr_curr->ci_next == NULL )
00633                      return comp->nextUpdate;
00634               else {
00635                      cr->cr_curr = cr->cr_curr->ci_next;
00636                      return        ExtractingComponentTime ( mem_op, cr, comp->nextUpdate );
00637               }
00638        }
00639        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 ) ) {
00640               if ( cr->cr_curr->ci_next == NULL )
00641                      return comp->revokedCertificates;
00642               else {
00643                      cr->cr_curr = cr->cr_curr->ci_next;
00644                      return        ExtractingComponentTBSCertListSeqOf ( mem_op, cr, comp->revokedCertificates );
00645               }
00646        }
00647        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 ) ) {
00648               if ( cr->cr_curr->ci_next == NULL )
00649                      return comp->crlExtensions;
00650               else {
00651                      cr->cr_curr = cr->cr_curr->ci_next;
00652                      return        ExtractingComponentExtensions ( mem_op, cr, comp->crlExtensions );
00653               }
00654        }
00655        return NULL;
00656 }  /* ExtractingComponentTBSCertList */
00657 
00658 int
00659 BDecComponentTBSCertList PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
00660 void* mem_op _AND_
00661 GenBuf * b _AND_
00662 AsnTag tagId0 _AND_
00663 AsnLen elmtLen0 _AND_
00664 ComponentTBSCertList **v _AND_
00665 AsnLen *bytesDecoded _AND_
00666 int mode)
00667 {
00668        int seqDone = FALSE;
00669        AsnLen totalElmtsLen1 = 0;
00670        AsnLen elmtLen1;
00671        AsnTag tagId1;
00672        int mandatoryElmtCount1 = 0;
00673        AsnLen totalElmtsLen2 = 0;
00674        AsnLen elmtLen2;
00675        AsnTag tagId2;
00676        int old_mode = mode;
00677        int rc;
00678        ComponentTBSCertList *k, *t, c_temp;
00679 
00680 
00681        if ( !(mode & DEC_ALLOC_MODE_1) ) {
00682               memset(&c_temp,0,sizeof(c_temp));
00683                k = &c_temp;
00684        } else
00685                k = t = *v;
00686        mode = DEC_ALLOC_MODE_2;
00687     tagId1 = BDecTag (b, &totalElmtsLen1 );
00688 
00689     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))))
00690     {
00691     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00692        rc = BDecComponentVersion (mem_op, b, tagId1, elmtLen1, (&k->version), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
00693               if ( rc != LDAP_SUCCESS ) return rc;
00694               (k->version)->identifier.bv_val = (k->version)->id_buf;
00695               (k->version)->identifier.bv_len = strlen("version");
00696               strcpy( (k->version)->identifier.bv_val, "version");
00697     tagId1 = BDecTag (b, &totalElmtsLen1);
00698     }
00699 
00700 
00701     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
00702     {
00703     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00704        rc = BDecComponentAlgorithmIdentifier (mem_op, b, tagId1, elmtLen1, (&k->signature), &totalElmtsLen1, mode);
00705               if ( rc != LDAP_SUCCESS ) return rc;
00706               (k->signature)->identifier.bv_val = (k->signature)->id_buf;
00707               (k->signature)->identifier.bv_len = strlen("signature");
00708               strcpy( (k->signature)->identifier.bv_val, "signature");
00709     tagId1 = BDecTag (b, &totalElmtsLen1);
00710     }
00711     else
00712         return -1;
00713 
00714 
00715 
00716     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
00717     {
00718         elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00719        rc = BDecComponentName (mem_op, b, tagId1, elmtLen1, (&k->issuer), &totalElmtsLen1, mode);
00720               if ( rc != LDAP_SUCCESS ) return rc;
00721               (k->issuer)->identifier.bv_val = (k->issuer)->id_buf;
00722               (k->issuer)->identifier.bv_len = strlen("issuer");
00723               strcpy( (k->issuer)->identifier.bv_val, "issuer");
00724     tagId1 = BDecTag (b, &totalElmtsLen1);
00725     }
00726     else
00727         return -1;
00728 
00729 
00730 
00731     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||
00732 (tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) ||
00733      (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))||
00734     (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE))))
00735     {
00736         elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00737        rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->thisUpdate), &totalElmtsLen1, mode);
00738               if ( rc != LDAP_SUCCESS ) return rc;
00739               (k->thisUpdate)->identifier.bv_val = (k->thisUpdate)->id_buf;
00740               (k->thisUpdate)->identifier.bv_len = strlen("thisUpdate");
00741               strcpy( (k->thisUpdate)->identifier.bv_val, "thisUpdate");
00742     tagId1 = BDecTag (b, &totalElmtsLen1);
00743     }
00744     else
00745         return -1;
00746 
00747 
00748 
00749     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||
00750 (tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) ||
00751      (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))||
00752     (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE))))
00753     {
00754         elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00755        rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->nextUpdate), &totalElmtsLen1, mode);
00756               if ( rc != LDAP_SUCCESS ) return rc;
00757               (k->nextUpdate)->identifier.bv_val = (k->nextUpdate)->id_buf;
00758               (k->nextUpdate)->identifier.bv_len = strlen("nextUpdate");
00759               strcpy( (k->nextUpdate)->identifier.bv_val, "nextUpdate");
00760     tagId1 = BDecTag (b, &totalElmtsLen1);
00761     }
00762 
00763 
00764     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
00765     {
00766     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00767        rc = BDecComponentTBSCertListSeqOf (mem_op, b, tagId1, elmtLen1, (&k->revokedCertificates), &totalElmtsLen1, mode);
00768               if ( rc != LDAP_SUCCESS ) return rc;
00769               (k->revokedCertificates)->identifier.bv_val = (k->revokedCertificates)->id_buf;
00770               (k->revokedCertificates)->identifier.bv_len = strlen("revokedCertificates");
00771               strcpy( (k->revokedCertificates)->identifier.bv_val, "revokedCertificates");
00772     if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0))
00773         seqDone = TRUE;
00774     else
00775     {
00776         tagId1 = BDecTag (b, &totalElmtsLen1 );
00777 
00778          if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
00779         {
00780             BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
00781             seqDone = TRUE;
00782         }
00783     }
00784     }
00785     else
00786         return -1;
00787 
00788 
00789 
00790     if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, CONS, 0))))
00791     {
00792     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
00793         tagId2 = BDecTag (b, &totalElmtsLen1 );
00794 
00795     if (tagId2 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
00796     {
00797          Asn1Error ("Unexpected Tag\n");
00798          return -1;
00799     }
00800 
00801     elmtLen2 = BDecLen (b, &totalElmtsLen1 );
00802        rc = BDecComponentExtensions (mem_op, b, tagId2, elmtLen2, (&k->crlExtensions), &totalElmtsLen1, mode);
00803               if ( rc != LDAP_SUCCESS ) return rc;
00804               (k->crlExtensions)->identifier.bv_val = (k->crlExtensions)->id_buf;
00805               (k->crlExtensions)->identifier.bv_len = strlen("crlExtensions");
00806               strcpy( (k->crlExtensions)->identifier.bv_val, "crlExtensions");
00807        if (elmtLen1 == INDEFINITE_LEN)
00808         BDecEoc (b, &totalElmtsLen1 );
00809         seqDone = TRUE;
00810         if (elmtLen0 == INDEFINITE_LEN)
00811             BDecEoc (b, &totalElmtsLen1 );
00812         else if (totalElmtsLen1 != elmtLen0)
00813         return -1;
00814 
00815     }
00816 
00817 
00818     if (!seqDone)
00819         return -1;
00820 
00821        if( !(old_mode & DEC_ALLOC_MODE_1) ) {
00822        *v = t = (ComponentTBSCertList*) CompAlloc( mem_op, sizeof(ComponentTBSCertList) );
00823        if ( !t ) return -1;
00824        *t = *k;
00825        }
00826        t->syntax = (Syntax*)NULL;
00827        t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
00828        if ( !t->comp_desc ) {
00829               free ( t );
00830               return -1;
00831        }
00832        t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
00833        t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
00834        t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
00835        t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertList ;
00836        t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertList ;
00837        t->comp_desc->cd_free = (comp_free_func*)NULL;
00838        t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertList;
00839        t->comp_desc->cd_type = ASN_COMPOSITE;
00840        t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
00841        t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertList;
00842     (*bytesDecoded) += totalElmtsLen1;
00843        return LDAP_SUCCESS;
00844 }  /* BDecTBSCertList*/
00845 
00846 int
00847 GDecComponentTBSCertList PARAMS (( mem_op,b, v, bytesDecoded, mode),
00848 void* mem_op _AND_
00849 GenBuf * b _AND_
00850 ComponentTBSCertList **v _AND_
00851 AsnLen *bytesDecoded _AND_
00852 int mode)
00853 {
00854        char* peek_head,*peek_head2;
00855        int i, strLen,strLen2, rc, old_mode = mode;
00856        ComponentTBSCertList *k,*t, c_temp;
00857 
00858 
00859        if ( !(mode & DEC_ALLOC_MODE_1) ) {
00860               memset(&c_temp,0,sizeof(c_temp));
00861                k = &c_temp;
00862        } else
00863                k = t = *v;
00864        mode = DEC_ALLOC_MODE_2;
00865        *bytesDecoded = 0;
00866        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00867               Asn1Error("Error during Reading { in encoded data");
00868               return LDAP_PROTOCOL_ERROR;
00869        }
00870        if(*peek_head != '{'){
00871               Asn1Error("Missing { in encoded data");
00872               return LDAP_PROTOCOL_ERROR;
00873        }
00874 
00875        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00876               Asn1Error("Error during Reading identifier");
00877               return LDAP_PROTOCOL_ERROR;
00878        }
00879        if ( strncmp( peek_head, "version", strlen("version") ) == 0 ) {
00880               rc =   GDecComponentVersion (mem_op, b, (&k->version), bytesDecoded, DEC_ALLOC_MODE_0 );
00881               if ( rc != LDAP_SUCCESS ) return rc;
00882        ( k->version)->identifier.bv_val = peek_head;
00883        ( k->version)->identifier.bv_len = strLen;
00884        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00885               Asn1Error("Error during Reading , ");
00886               return LDAP_PROTOCOL_ERROR;
00887        }
00888        if(*peek_head != ','){
00889               Asn1Error("Missing , in encoding");
00890               return LDAP_PROTOCOL_ERROR;
00891        }
00892        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00893          Asn1Error("Error during Reading identifier");
00894               return LDAP_PROTOCOL_ERROR;
00895        }
00896        }
00897        if ( strncmp( peek_head, "signature", strlen("signature") ) == 0 ) {
00898               rc =   GDecComponentAlgorithmIdentifier (mem_op, b, (&k->signature), bytesDecoded, mode);
00899               if ( rc != LDAP_SUCCESS ) return rc;
00900        ( k->signature)->identifier.bv_val = peek_head;
00901        ( k->signature)->identifier.bv_len = strLen;
00902        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00903               Asn1Error("Error during Reading , ");
00904               return LDAP_PROTOCOL_ERROR;
00905        }
00906        if(*peek_head != ','){
00907               Asn1Error("Missing , in encoding");
00908               return LDAP_PROTOCOL_ERROR;
00909        }
00910        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00911          Asn1Error("Error during Reading identifier");
00912               return LDAP_PROTOCOL_ERROR;
00913        }
00914        }
00915        if ( strncmp( peek_head, "issuer", strlen("issuer") ) == 0 ) {
00916               rc =   GDecComponentName (mem_op, b, (&k->issuer), bytesDecoded, mode);
00917               if ( rc != LDAP_SUCCESS ) return rc;
00918        ( k->issuer)->identifier.bv_val = peek_head;
00919        ( k->issuer)->identifier.bv_len = strLen;
00920        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00921               Asn1Error("Error during Reading , ");
00922               return LDAP_PROTOCOL_ERROR;
00923        }
00924        if(*peek_head != ','){
00925               Asn1Error("Missing , in encoding");
00926               return LDAP_PROTOCOL_ERROR;
00927        }
00928        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00929          Asn1Error("Error during Reading identifier");
00930               return LDAP_PROTOCOL_ERROR;
00931        }
00932        }
00933        if ( strncmp( peek_head, "thisUpdate", strlen("thisUpdate") ) == 0 ) {
00934               rc =   GDecComponentTime (mem_op, b, (&k->thisUpdate), bytesDecoded, mode);
00935               if ( rc != LDAP_SUCCESS ) return rc;
00936        ( k->thisUpdate)->identifier.bv_val = peek_head;
00937        ( k->thisUpdate)->identifier.bv_len = strLen;
00938        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00939               Asn1Error("Error during Reading , ");
00940               return LDAP_PROTOCOL_ERROR;
00941        }
00942        if(*peek_head != ','){
00943               Asn1Error("Missing , in encoding");
00944               return LDAP_PROTOCOL_ERROR;
00945        }
00946        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00947          Asn1Error("Error during Reading identifier");
00948               return LDAP_PROTOCOL_ERROR;
00949        }
00950        }
00951        if ( strncmp( peek_head, "nextUpdate", strlen("nextUpdate") ) == 0 ) {
00952               rc =   GDecComponentTime (mem_op, b, (&k->nextUpdate), bytesDecoded, mode);
00953               if ( rc != LDAP_SUCCESS ) return rc;
00954        ( k->nextUpdate)->identifier.bv_val = peek_head;
00955        ( k->nextUpdate)->identifier.bv_len = strLen;
00956        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00957               Asn1Error("Error during Reading , ");
00958               return LDAP_PROTOCOL_ERROR;
00959        }
00960        if(*peek_head != ','){
00961               Asn1Error("Missing , in encoding");
00962               return LDAP_PROTOCOL_ERROR;
00963        }
00964        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00965          Asn1Error("Error during Reading identifier");
00966               return LDAP_PROTOCOL_ERROR;
00967        }
00968        }
00969        if ( strncmp( peek_head, "revokedCertificates", strlen("revokedCertificates") ) == 0 ) {
00970               rc =   GDecComponentTBSCertListSeqOf (mem_op, b, (&k->revokedCertificates), bytesDecoded, mode);
00971               if ( rc != LDAP_SUCCESS ) return rc;
00972        ( k->revokedCertificates)->identifier.bv_val = peek_head;
00973        ( k->revokedCertificates)->identifier.bv_len = strLen;
00974        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00975               Asn1Error("Error during Reading , ");
00976               return LDAP_PROTOCOL_ERROR;
00977        }
00978        if(*peek_head != ','){
00979               Asn1Error("Missing , in encoding");
00980               return LDAP_PROTOCOL_ERROR;
00981        }
00982        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
00983          Asn1Error("Error during Reading identifier");
00984               return LDAP_PROTOCOL_ERROR;
00985        }
00986        }
00987        if ( strncmp( peek_head, "crlExtensions", strlen("crlExtensions") ) == 0 ) {
00988               rc =   GDecComponentExtensions (mem_op, b, (&k->crlExtensions), bytesDecoded, mode);
00989               if ( rc != LDAP_SUCCESS ) return rc;
00990        ( k->crlExtensions)->identifier.bv_val = peek_head;
00991        ( k->crlExtensions)->identifier.bv_len = strLen;
00992        }
00993        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
00994               Asn1Error("Error during Reading } in encoding");
00995               return LDAP_PROTOCOL_ERROR;
00996        }
00997        if(*peek_head != '}'){
00998               Asn1Error("Missing } in encoding");
00999               return LDAP_PROTOCOL_ERROR;
01000        }
01001        if( !(old_mode & DEC_ALLOC_MODE_1) ) {
01002        *v = t = (ComponentTBSCertList*) CompAlloc( mem_op, sizeof(ComponentTBSCertList) );
01003        if ( !t ) return -1;
01004        *t = *k;
01005        }
01006        t->syntax = (Syntax*)NULL;
01007        t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
01008        if ( !t->comp_desc ) {
01009               free ( t );
01010               return -1;
01011        }
01012        t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
01013        t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
01014        t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
01015        t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertList ;
01016        t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertList ;
01017        t->comp_desc->cd_free = (comp_free_func*)NULL;
01018        t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertList;
01019        t->comp_desc->cd_type = ASN_COMPOSITE;
01020        t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
01021        t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertList;
01022        return LDAP_SUCCESS;
01023 }  /* GDecTBSCertList*/
01024 
01025 
01026 int
01027 MatchingComponentCertificateList ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
01028        int rc;
01029        MatchingRule* mr;
01030 
01031        if ( oid ) {
01032               mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
01033               if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
01034        }
01035 
01036        rc = 1;
01037        rc =   MatchingComponentTBSCertList ( oid, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_attr)->tbsCertList, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_assert)->tbsCertList );
01038        if ( rc != LDAP_COMPARE_TRUE )
01039               return rc;
01040        rc =   MatchingComponentAlgorithmIdentifier ( oid, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_attr)->signatureAlgorithm, (ComponentSyntaxInfo*)((ComponentCertificateList*)csi_assert)->signatureAlgorithm );
01041        if ( rc != LDAP_COMPARE_TRUE )
01042               return rc;
01043        rc =   MatchingComponentBits ( oid, (ComponentSyntaxInfo*)&((ComponentCertificateList*)csi_attr)->signature, (ComponentSyntaxInfo*)&((ComponentCertificateList*)csi_assert)->signature );
01044        if ( rc != LDAP_COMPARE_TRUE )
01045               return rc;
01046        return LDAP_COMPARE_TRUE;
01047 }  /* BMatchingComponentCertificateList */
01048 
01049 void*
01050 ExtractingComponentCertificateList ( void* mem_op, ComponentReference* cr, ComponentCertificateList *comp )
01051 {
01052 
01053        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 ) ) {
01054               if ( cr->cr_curr->ci_next == NULL )
01055                      return comp->tbsCertList;
01056               else {
01057                      cr->cr_curr = cr->cr_curr->ci_next;
01058                      return        ExtractingComponentTBSCertList ( mem_op, cr, comp->tbsCertList );
01059               }
01060        }
01061        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 ) ) {
01062               if ( cr->cr_curr->ci_next == NULL )
01063                      return comp->signatureAlgorithm;
01064               else {
01065                      cr->cr_curr = cr->cr_curr->ci_next;
01066                      return        ExtractingComponentAlgorithmIdentifier ( mem_op, cr, comp->signatureAlgorithm );
01067               }
01068        }
01069        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 ) ) {
01070               if ( cr->cr_curr->ci_next == NULL )
01071               return &comp->signature;
01072        else if ( cr->cr_curr->ci_next->ci_type == LDAP_COMPREF_CONTENT) {
01073                      cr->cr_curr = cr->cr_curr->ci_next;
01074               return &comp->signature;
01075         } else {
01076               return NULL;
01077               }
01078        }
01079        return NULL;
01080 }  /* ExtractingComponentCertificateList */
01081 
01082 int
01083 BDecComponentCertificateList PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
01084 void* mem_op _AND_
01085 GenBuf * b _AND_
01086 AsnTag tagId0 _AND_
01087 AsnLen elmtLen0 _AND_
01088 ComponentCertificateList **v _AND_
01089 AsnLen *bytesDecoded _AND_
01090 int mode)
01091 {
01092        int seqDone = FALSE;
01093        AsnLen totalElmtsLen1 = 0;
01094        AsnLen elmtLen1;
01095        AsnTag tagId1;
01096        int mandatoryElmtCount1 = 0;
01097        int old_mode = mode;
01098        int rc;
01099        ComponentCertificateList *k, *t, c_temp;
01100 
01101 
01102        if ( !(mode & DEC_ALLOC_MODE_1) ) {
01103               memset(&c_temp,0,sizeof(c_temp));
01104                k = &c_temp;
01105        } else
01106                k = t = *v;
01107        mode = DEC_ALLOC_MODE_2;
01108     tagId1 = BDecTag (b, &totalElmtsLen1 );
01109 
01110     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
01111     {
01112     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
01113        rc = BDecComponentTBSCertList (mem_op, b, tagId1, elmtLen1, (&k->tbsCertList), &totalElmtsLen1, mode);
01114               if ( rc != LDAP_SUCCESS ) return rc;
01115               (k->tbsCertList)->identifier.bv_val = (k->tbsCertList)->id_buf;
01116               (k->tbsCertList)->identifier.bv_len = strlen("tbsCertList");
01117               strcpy( (k->tbsCertList)->identifier.bv_val, "tbsCertList");
01118     tagId1 = BDecTag (b, &totalElmtsLen1);
01119     }
01120     else
01121         return -1;
01122 
01123 
01124 
01125     if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))))
01126     {
01127     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
01128        rc = BDecComponentAlgorithmIdentifier (mem_op, b, tagId1, elmtLen1, (&k->signatureAlgorithm), &totalElmtsLen1, mode);
01129               if ( rc != LDAP_SUCCESS ) return rc;
01130               (k->signatureAlgorithm)->identifier.bv_val = (k->signatureAlgorithm)->id_buf;
01131               (k->signatureAlgorithm)->identifier.bv_len = strlen("signatureAlgorithm");
01132               strcpy( (k->signatureAlgorithm)->identifier.bv_val, "signatureAlgorithm");
01133     tagId1 = BDecTag (b, &totalElmtsLen1);
01134     }
01135     else
01136         return -1;
01137 
01138 
01139 
01140     if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, BITSTRING_TAG_CODE)) ||
01141 (tagId1 == MAKE_TAG_ID (UNIV, CONS, BITSTRING_TAG_CODE))))
01142     {
01143     elmtLen1 = BDecLen (b, &totalElmtsLen1 );
01144        rc = BDecComponentBits (mem_op, b, tagId1, elmtLen1, (&k->signature), &totalElmtsLen1, mode);
01145               if ( rc != LDAP_SUCCESS ) return rc;
01146               (&k->signature)->identifier.bv_val = (&k->signature)->id_buf;
01147               (&k->signature)->identifier.bv_len = strlen("signature");
01148               strcpy( (&k->signature)->identifier.bv_val, "signature");
01149         seqDone = TRUE;
01150         if (elmtLen0 == INDEFINITE_LEN)
01151             BDecEoc (b, &totalElmtsLen1 );
01152         else if (totalElmtsLen1 != elmtLen0)
01153         return -1;
01154 
01155     }
01156     else
01157         return -1;
01158 
01159 
01160 
01161     if (!seqDone)
01162         return -1;
01163 
01164        if( !(old_mode & DEC_ALLOC_MODE_1) ) {
01165        *v = t = (ComponentCertificateList*) CompAlloc( mem_op, sizeof(ComponentCertificateList) );
01166        if ( !t ) return -1;
01167        *t = *k;
01168        }
01169        t->syntax = (Syntax*)NULL;
01170        t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
01171        if ( !t->comp_desc ) {
01172               free ( t );
01173               return -1;
01174        }
01175        t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
01176        t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
01177        t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
01178        t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentCertificateList ;
01179        t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentCertificateList ;
01180        t->comp_desc->cd_free = (comp_free_func*)NULL;
01181        t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentCertificateList;
01182        t->comp_desc->cd_type = ASN_COMPOSITE;
01183        t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
01184        t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentCertificateList;
01185     (*bytesDecoded) += totalElmtsLen1;
01186        return LDAP_SUCCESS;
01187 }  /* BDecCertificateList*/
01188 
01189 int
01190 GDecComponentCertificateList PARAMS (( mem_op,b, v, bytesDecoded, mode),
01191 void* mem_op _AND_
01192 GenBuf * b _AND_
01193 ComponentCertificateList **v _AND_
01194 AsnLen *bytesDecoded _AND_
01195 int mode)
01196 {
01197        char* peek_head,*peek_head2;
01198        int i, strLen,strLen2, rc, old_mode = mode;
01199        ComponentCertificateList *k,*t, c_temp;
01200 
01201 
01202        if ( !(mode & DEC_ALLOC_MODE_1) ) {
01203               memset(&c_temp,0,sizeof(c_temp));
01204                k = &c_temp;
01205        } else
01206                k = t = *v;
01207        mode = DEC_ALLOC_MODE_2;
01208        *bytesDecoded = 0;
01209        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
01210               Asn1Error("Error during Reading { in encoded data");
01211               return LDAP_PROTOCOL_ERROR;
01212        }
01213        if(*peek_head != '{'){
01214               Asn1Error("Missing { in encoded data");
01215               return LDAP_PROTOCOL_ERROR;
01216        }
01217 
01218        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
01219               Asn1Error("Error during Reading identifier");
01220               return LDAP_PROTOCOL_ERROR;
01221        }
01222        if ( strncmp( peek_head, "tbsCertList", strlen("tbsCertList") ) == 0 ) {
01223               rc =   GDecComponentTBSCertList (mem_op, b, (&k->tbsCertList), bytesDecoded, mode);
01224               if ( rc != LDAP_SUCCESS ) return rc;
01225        ( k->tbsCertList)->identifier.bv_val = peek_head;
01226        ( k->tbsCertList)->identifier.bv_len = strLen;
01227        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
01228               Asn1Error("Error during Reading , ");
01229               return LDAP_PROTOCOL_ERROR;
01230        }
01231        if(*peek_head != ','){
01232               Asn1Error("Missing , in encoding");
01233               return LDAP_PROTOCOL_ERROR;
01234        }
01235        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
01236          Asn1Error("Error during Reading identifier");
01237               return LDAP_PROTOCOL_ERROR;
01238        }
01239        }
01240        if ( strncmp( peek_head, "signatureAlgorithm", strlen("signatureAlgorithm") ) == 0 ) {
01241               rc =   GDecComponentAlgorithmIdentifier (mem_op, b, (&k->signatureAlgorithm), bytesDecoded, mode);
01242               if ( rc != LDAP_SUCCESS ) return rc;
01243        ( k->signatureAlgorithm)->identifier.bv_val = peek_head;
01244        ( k->signatureAlgorithm)->identifier.bv_len = strLen;
01245        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
01246               Asn1Error("Error during Reading , ");
01247               return LDAP_PROTOCOL_ERROR;
01248        }
01249        if(*peek_head != ','){
01250               Asn1Error("Missing , in encoding");
01251               return LDAP_PROTOCOL_ERROR;
01252        }
01253        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
01254          Asn1Error("Error during Reading identifier");
01255               return LDAP_PROTOCOL_ERROR;
01256        }
01257        }
01258        if ( strncmp( peek_head, "signature", strlen("signature") ) == 0 ) {
01259               rc =   GDecComponentBits (mem_op, b, (&k->signature), bytesDecoded, mode);
01260               if ( rc != LDAP_SUCCESS ) return rc;
01261        (&k->signature)->identifier.bv_val = peek_head;
01262        (&k->signature)->identifier.bv_len = strLen;
01263        }
01264        if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
01265               Asn1Error("Error during Reading } in encoding");
01266               return LDAP_PROTOCOL_ERROR;
01267        }
01268        if(*peek_head != '}'){
01269               Asn1Error("Missing } in encoding");
01270               return LDAP_PROTOCOL_ERROR;
01271        }
01272        if( !(old_mode & DEC_ALLOC_MODE_1) ) {
01273        *v = t = (ComponentCertificateList*) CompAlloc( mem_op, sizeof(ComponentCertificateList) );
01274        if ( !t ) return -1;
01275        *t = *k;
01276        }
01277        t->syntax = (Syntax*)NULL;
01278        t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
01279        if ( !t->comp_desc ) {
01280               free ( t );
01281               return -1;
01282        }
01283        t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL;
01284        t->comp_desc->cd_gser_encoder = (encoder_func*)NULL;
01285        t->comp_desc->cd_ber_encoder = (encoder_func*)NULL;
01286        t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentCertificateList ;
01287        t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentCertificateList ;
01288        t->comp_desc->cd_free = (comp_free_func*)NULL;
01289        t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentCertificateList;
01290        t->comp_desc->cd_type = ASN_COMPOSITE;
01291        t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
01292        t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentCertificateList;
01293        return LDAP_SUCCESS;
01294 }  /* GDecCertificateList*/