diff --git a/openpgpsdk/src/openpgpsdk/accumulate.c b/openpgpsdk/src/openpgpsdk/accumulate.c index 70c033df4..025e08e74 100644 --- a/openpgpsdk/src/openpgpsdk/accumulate.c +++ b/openpgpsdk/src/openpgpsdk/accumulate.c @@ -154,7 +154,7 @@ int ops_parse_and_accumulate(ops_keyring_t *keyring, parse_info->rinfo.accumulate=ops_true; - rtn=ops_parse(parse_info); + rtn=ops_parse(parse_info,ops_false); ++keyring->nkeys; return rtn; diff --git a/openpgpsdk/src/openpgpsdk/compress.c b/openpgpsdk/src/openpgpsdk/compress.c index 72611a1e6..afe3db6ac 100644 --- a/openpgpsdk/src/openpgpsdk/compress.c +++ b/openpgpsdk/src/openpgpsdk/compress.c @@ -370,7 +370,7 @@ int ops_decompress(ops_region_t *region,ops_parse_info_t *parse_info, return 0; } - ret=ops_parse(parse_info); + ret=ops_parse(parse_info,ops_true); ops_reader_pop(parse_info); diff --git a/openpgpsdk/src/openpgpsdk/keyring.c b/openpgpsdk/src/openpgpsdk/keyring.c index 1a591db56..5828bfa87 100644 --- a/openpgpsdk/src/openpgpsdk/keyring.c +++ b/openpgpsdk/src/openpgpsdk/keyring.c @@ -368,7 +368,7 @@ ops_secret_key_t *ops_decrypt_secret_key_from_data(const ops_keydata_t *key, ops_parse_cb_set(pinfo,decrypt_cb,&arg); pinfo->rinfo.accumulate=ops_true; - ops_parse(pinfo); + ops_parse(pinfo,ops_false); ops_parse_info_delete(pinfo); diff --git a/openpgpsdk/src/openpgpsdk/packet-parse.c b/openpgpsdk/src/openpgpsdk/packet-parse.c index 3b2d4dcd0..b80cf4ef8 100644 --- a/openpgpsdk/src/openpgpsdk/packet-parse.c +++ b/openpgpsdk/src/openpgpsdk/packet-parse.c @@ -2866,7 +2866,7 @@ int ops_decrypt_se_data(ops_content_tag_t tag,ops_region_t *region, ops_parse_in } - r=ops_parse(pinfo); + r=ops_parse(pinfo,ops_false); ops_reader_pop_decrypt(pinfo); } @@ -2904,7 +2904,7 @@ int ops_decrypt_se_ip_data(ops_content_tag_t tag,ops_region_t *region, ops_reader_push_decrypt(pinfo,decrypt,region); ops_reader_push_se_ip_data(pinfo,decrypt,region); - r=ops_parse(pinfo); + r=ops_parse(pinfo,ops_false); ops_reader_pop_se_ip_data(pinfo); ops_reader_pop_decrypt(pinfo); @@ -3228,7 +3228,7 @@ void example() * \endcode */ -int ops_parse(ops_parse_info_t *pinfo) +int ops_parse(ops_parse_info_t *pinfo,ops_boolean_t limit_packets) { int r; unsigned long pktlen; @@ -3239,9 +3239,9 @@ int ops_parse(ops_parse_info_t *pinfo) { r=ops_parse_one_packet(pinfo,&pktlen); - if(++n_packets > 100) + if(++n_packets > 500 && limit_packets) { - fprintf(stderr,"More than 100 packets parsed in a row. This is likely to be a buggy certificate.") ; + fprintf(stderr,"More than 500 packets parsed in a row. This is likely to be a buggy certificate.") ; return 0 ; } } while (r > 0); @@ -3261,7 +3261,7 @@ int ops_parse(ops_parse_info_t *pinfo) int ops_parse_and_print_errors(ops_parse_info_t *pinfo) { - ops_parse(pinfo); + ops_parse(pinfo,ops_false); ops_print_errors(pinfo->errors); return pinfo->errors ? 0 : 1; } diff --git a/openpgpsdk/src/openpgpsdk/packet-parse.h b/openpgpsdk/src/openpgpsdk/packet-parse.h index f0bcfb8da..fe65060c0 100644 --- a/openpgpsdk/src/openpgpsdk/packet-parse.h +++ b/openpgpsdk/src/openpgpsdk/packet-parse.h @@ -125,7 +125,7 @@ ops_parse_cb_return_t ops_parse_stacked_cb(const ops_parser_content_t *content, ops_parse_cb_info_t *cbinfo); ops_reader_info_t *ops_parse_get_rinfo(ops_parse_info_t *pinfo); -int ops_parse(ops_parse_info_t *parse_info); +int ops_parse(ops_parse_info_t *parse_info,ops_boolean_t limit_packets); int ops_parse_and_print_errors(ops_parse_info_t *parse_info); int ops_parse_and_save_errs(ops_parse_info_t *parse_info,ops_ulong_list_t *errs); int ops_parse_errs(ops_parse_info_t *parse_info,ops_ulong_list_t *errs); diff --git a/openpgpsdk/src/openpgpsdk/validate.c b/openpgpsdk/src/openpgpsdk/validate.c index 564557065..8767dd74d 100644 --- a/openpgpsdk/src/openpgpsdk/validate.c +++ b/openpgpsdk/src/openpgpsdk/validate.c @@ -572,7 +572,7 @@ ops_boolean_t ops_validate_key_signatures(ops_validate_result_t *result,const op // is never used. carg.rarg=ops_reader_get_arg_from_pinfo(pinfo); - ops_parse(pinfo); + ops_parse(pinfo,ops_true); ops_public_key_free(&carg.pkey); if(carg.subkey.version) @@ -693,7 +693,7 @@ ops_boolean_t ops_validate_file(ops_validate_result_t *result, const char* filen // Do the verification - ops_parse(pinfo); + ops_parse(pinfo,ops_true); if (debug) { @@ -748,7 +748,7 @@ ops_boolean_t ops_validate_mem(ops_validate_result_t *result, ops_memory_t* mem, // Do the verification - ops_parse(pinfo); + ops_parse(pinfo,ops_true); if (debug) { @@ -819,7 +819,7 @@ ops_boolean_t ops_validate_detached_signature(const void *literal_data, unsigned // Do the verification - ops_parse(pinfo); + ops_parse(pinfo,ops_true); if(debug) printf("valid=%d, invalid=%d, unknown=%d\n", result->valid_count, result->invalid_count, result->unknown_signer_count);