📄 crl.c
字号:
return comp->crlExtensions; else { cr->cr_curr = cr->cr_curr->ci_next; return ExtractingComponentExtensions ( mem_op, cr, comp->crlExtensions ); } } return NULL;} /* ExtractingComponentTBSCertList */intBDecComponentTBSCertList PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),void* mem_op _AND_GenBuf * b _AND_AsnTag tagId0 _AND_AsnLen elmtLen0 _AND_ComponentTBSCertList **v _AND_AsnLen *bytesDecoded _AND_int mode){ int seqDone = FALSE; AsnLen totalElmtsLen1 = 0; AsnLen elmtLen1; AsnTag tagId1; int mandatoryElmtCount1 = 0; AsnLen totalElmtsLen2 = 0; AsnLen elmtLen2; AsnTag tagId2; int old_mode = mode; int rc; ComponentTBSCertList *k, *t, c_temp; if ( !(mode & DEC_ALLOC_MODE_1) ) { memset(&c_temp,0,sizeof(c_temp)); k = &c_temp; } else k = t = *v; mode = DEC_ALLOC_MODE_2; tagId1 = BDecTag (b, &totalElmtsLen1 ); if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))) { elmtLen1 = BDecLen (b, &totalElmtsLen1 ); rc = BDecComponentVersion (mem_op, b, tagId1, elmtLen1, (&k->version), &totalElmtsLen1, DEC_ALLOC_MODE_0 ); if ( rc != LDAP_SUCCESS ) return rc; (k->version)->identifier.bv_val = (k->version)->id_buf; (k->version)->identifier.bv_len = strlen("version"); strcpy( (k->version)->identifier.bv_val, "version"); tagId1 = BDecTag (b, &totalElmtsLen1); } if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))) { elmtLen1 = BDecLen (b, &totalElmtsLen1 ); rc = BDecComponentAlgorithmIdentifier (mem_op, b, tagId1, elmtLen1, (&k->signature), &totalElmtsLen1, mode); if ( rc != LDAP_SUCCESS ) return rc; (k->signature)->identifier.bv_val = (k->signature)->id_buf; (k->signature)->identifier.bv_len = strlen("signature"); strcpy( (k->signature)->identifier.bv_val, "signature"); tagId1 = BDecTag (b, &totalElmtsLen1); } else return -1; if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))) { elmtLen1 = BDecLen (b, &totalElmtsLen1 ); rc = BDecComponentName (mem_op, b, tagId1, elmtLen1, (&k->issuer), &totalElmtsLen1, mode); if ( rc != LDAP_SUCCESS ) return rc; (k->issuer)->identifier.bv_val = (k->issuer)->id_buf; (k->issuer)->identifier.bv_len = strlen("issuer"); strcpy( (k->issuer)->identifier.bv_val, "issuer"); tagId1 = BDecTag (b, &totalElmtsLen1); } else return -1; if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||(tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) || (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))|| (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE)))) { elmtLen1 = BDecLen (b, &totalElmtsLen1 ); rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->thisUpdate), &totalElmtsLen1, mode); if ( rc != LDAP_SUCCESS ) return rc; (k->thisUpdate)->identifier.bv_val = (k->thisUpdate)->id_buf; (k->thisUpdate)->identifier.bv_len = strlen("thisUpdate"); strcpy( (k->thisUpdate)->identifier.bv_val, "thisUpdate"); tagId1 = BDecTag (b, &totalElmtsLen1); } else return -1; if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, UTCTIME_TAG_CODE)) ||(tagId1 == MAKE_TAG_ID (UNIV, CONS, UTCTIME_TAG_CODE)) || (tagId1 ==MAKE_TAG_ID (UNIV, PRIM, GENERALIZEDTIME_TAG_CODE))|| (tagId1 == MAKE_TAG_ID (UNIV, CONS, GENERALIZEDTIME_TAG_CODE)))) { elmtLen1 = BDecLen (b, &totalElmtsLen1 ); rc = BDecComponentTime (mem_op, b, tagId1, elmtLen1, (&k->nextUpdate), &totalElmtsLen1, mode); if ( rc != LDAP_SUCCESS ) return rc; (k->nextUpdate)->identifier.bv_val = (k->nextUpdate)->id_buf; (k->nextUpdate)->identifier.bv_len = strlen("nextUpdate"); strcpy( (k->nextUpdate)->identifier.bv_val, "nextUpdate"); tagId1 = BDecTag (b, &totalElmtsLen1); } if (((tagId1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))) { elmtLen1 = BDecLen (b, &totalElmtsLen1 ); rc = BDecComponentTBSCertListSeqOf (mem_op, b, tagId1, elmtLen1, (&k->revokedCertificates), &totalElmtsLen1, mode); if ( rc != LDAP_SUCCESS ) return rc; (k->revokedCertificates)->identifier.bv_val = (k->revokedCertificates)->id_buf; (k->revokedCertificates)->identifier.bv_len = strlen("revokedCertificates"); strcpy( (k->revokedCertificates)->identifier.bv_val, "revokedCertificates"); if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0)) seqDone = TRUE; else { tagId1 = BDecTag (b, &totalElmtsLen1 ); if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID)) { BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 ) seqDone = TRUE; } } } else return -1; if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, CONS, 0)))) { elmtLen1 = BDecLen (b, &totalElmtsLen1 ); tagId2 = BDecTag (b, &totalElmtsLen1 ); if (tagId2 != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error ("Unexpected Tag\n"); return -1; } elmtLen2 = BDecLen (b, &totalElmtsLen1 ); rc = BDecComponentExtensions (mem_op, b, tagId2, elmtLen2, (&k->crlExtensions), &totalElmtsLen1, mode); if ( rc != LDAP_SUCCESS ) return rc; (k->crlExtensions)->identifier.bv_val = (k->crlExtensions)->id_buf; (k->crlExtensions)->identifier.bv_len = strlen("crlExtensions"); strcpy( (k->crlExtensions)->identifier.bv_val, "crlExtensions"); if (elmtLen1 == INDEFINITE_LEN) BDecEoc (b, &totalElmtsLen1 ); seqDone = TRUE; if (elmtLen0 == INDEFINITE_LEN) BDecEoc (b, &totalElmtsLen1 ); else if (totalElmtsLen1 != elmtLen0) return -1; } if (!seqDone) return -1; if( !(old_mode & DEC_ALLOC_MODE_1) ) { *v = t = (ComponentTBSCertList*) CompAlloc( mem_op, sizeof(ComponentTBSCertList) ); if ( !t ) return -1; *t = *k; } t->syntax = (Syntax*)NULL; t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) ); if ( !t->comp_desc ) { free ( t ); return -1; } t->comp_desc->cd_ldap_encoder = (encoder_func*)NULL; t->comp_desc->cd_gser_encoder = (encoder_func*)NULL; t->comp_desc->cd_ber_encoder = (encoder_func*)NULL; t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTBSCertList ; t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTBSCertList ; t->comp_desc->cd_free = (comp_free_func*)NULL; t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentTBSCertList; t->comp_desc->cd_type = ASN_COMPOSITE; t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE; t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTBSCertList; (*bytesDecoded) += totalElmtsLen1; return LDAP_SUCCESS;} /* BDecTBSCertList*/intGDecComponentTBSCertList PARAMS (( mem_op,b, v, bytesDecoded, mode),void* mem_op _AND_GenBuf * b _AND_ComponentTBSCertList **v _AND_AsnLen *bytesDecoded _AND_int mode){ char* peek_head,*peek_head2; int i, strLen,strLen2, rc, old_mode = mode; ComponentTBSCertList *k,*t, c_temp; if ( !(mode & DEC_ALLOC_MODE_1) ) { memset(&c_temp,0,sizeof(c_temp)); k = &c_temp; } else k = t = *v; mode = DEC_ALLOC_MODE_2; *bytesDecoded = 0; if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading { in encoded data"); return LDAP_PROTOCOL_ERROR; } if(*peek_head != '{'){ Asn1Error("Missing { in encoded data"); return LDAP_PROTOCOL_ERROR; } if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading identifier"); return LDAP_PROTOCOL_ERROR; } if ( strncmp( peek_head, "version", strlen("version") ) == 0 ) { rc = GDecComponentVersion (mem_op, b, (&k->version), bytesDecoded, DEC_ALLOC_MODE_0 ); if ( rc != LDAP_SUCCESS ) return rc; ( k->version)->identifier.bv_val = peek_head; ( k->version)->identifier.bv_len = strLen; if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading , "); return LDAP_PROTOCOL_ERROR; } if(*peek_head != ','){ Asn1Error("Missing , in encoding"); return LDAP_PROTOCOL_ERROR; } if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading identifier"); return LDAP_PROTOCOL_ERROR; } } if ( strncmp( peek_head, "signature", strlen("signature") ) == 0 ) { rc = GDecComponentAlgorithmIdentifier (mem_op, b, (&k->signature), bytesDecoded, mode); if ( rc != LDAP_SUCCESS ) return rc; ( k->signature)->identifier.bv_val = peek_head; ( k->signature)->identifier.bv_len = strLen; if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading , "); return LDAP_PROTOCOL_ERROR; } if(*peek_head != ','){ Asn1Error("Missing , in encoding"); return LDAP_PROTOCOL_ERROR; } if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading identifier"); return LDAP_PROTOCOL_ERROR; } } if ( strncmp( peek_head, "issuer", strlen("issuer") ) == 0 ) { rc = GDecComponentName (mem_op, b, (&k->issuer), bytesDecoded, mode); if ( rc != LDAP_SUCCESS ) return rc; ( k->issuer)->identifier.bv_val = peek_head; ( k->issuer)->identifier.bv_len = strLen; if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading , "); return LDAP_PROTOCOL_ERROR; } if(*peek_head != ','){ Asn1Error("Missing , in encoding"); return LDAP_PROTOCOL_ERROR; } if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading identifier"); return LDAP_PROTOCOL_ERROR; } } if ( strncmp( peek_head, "thisUpdate", strlen("thisUpdate") ) == 0 ) { rc = GDecComponentTime (mem_op, b, (&k->thisUpdate), bytesDecoded, mode); if ( rc != LDAP_SUCCESS ) return rc; ( k->thisUpdate)->identifier.bv_val = peek_head; ( k->thisUpdate)->identifier.bv_len = strLen; if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading , "); return LDAP_PROTOCOL_ERROR; } if(*peek_head != ','){ Asn1Error("Missing , in encoding"); return LDAP_PROTOCOL_ERROR; } if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading identifier"); return LDAP_PROTOCOL_ERROR; } } if ( strncmp( peek_head, "nextUpdate", strlen("nextUpdate") ) == 0 ) { rc = GDecComponentTime (mem_op, b, (&k->nextUpdate), bytesDecoded, mode); if ( rc != LDAP_SUCCESS ) return rc; ( k->nextUpdate)->identifier.bv_val = peek_head; ( k->nextUpdate)->identifier.bv_len = strLen; if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading , "); return LDAP_PROTOCOL_ERROR; } if(*peek_head != ','){ Asn1Error("Missing , in encoding"); return LDAP_PROTOCOL_ERROR; } if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading identifier"); return LDAP_PROTOCOL_ERROR; } } if ( strncmp( peek_head, "revokedCertificates", strlen("revokedCertificates") ) == 0 ) { rc = GDecComponentTBSCertListSeqOf (mem_op, b, (&k->revokedCertificates), bytesDecoded, mode); if ( rc != LDAP_SUCCESS ) return rc; ( k->revokedCertificates)->identifier.bv_val = peek_head;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -