Loading crypto/ts/ts_conf.c +23 −23 Original line number Diff line number Diff line Loading @@ -152,12 +152,12 @@ EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass) /* Function definitions for handling configuration options. */ static void TS_CONF_lookup_fail(const char *name, const char *tag) static void ts_CONF_lookup_fail(const char *name, const char *tag) { fprintf(stderr, "variable lookup failed for %s::%s\n", name, tag); } static void TS_CONF_invalid(const char *name, const char *tag) static void ts_CONF_invalid(const char *name, const char *tag) { fprintf(stderr, "invalid variable value for %s::%s\n", name, tag); } Loading @@ -167,7 +167,7 @@ const char *TS_CONF_get_tsa_section(CONF *conf, const char *section) if (!section) { section = NCONF_get_string(conf, BASE_SECTION, ENV_DEFAULT_TSA); if (!section) TS_CONF_lookup_fail(BASE_SECTION, ENV_DEFAULT_TSA); ts_CONF_lookup_fail(BASE_SECTION, ENV_DEFAULT_TSA); } return section; } Loading @@ -178,7 +178,7 @@ int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, int ret = 0; char *serial = NCONF_get_string(conf, section, ENV_SERIAL); if (!serial) { TS_CONF_lookup_fail(section, ENV_SERIAL); ts_CONF_lookup_fail(section, ENV_SERIAL); goto err; } TS_RESP_CTX_set_serial_cb(ctx, cb, serial); Loading @@ -199,7 +199,7 @@ int TS_CONF_set_crypto_device(CONF *conf, const char *section, device = NCONF_get_string(conf, section, ENV_CRYPTO_DEVICE); if (device && !TS_CONF_set_default_engine(device)) { TS_CONF_invalid(section, ENV_CRYPTO_DEVICE); ts_CONF_invalid(section, ENV_CRYPTO_DEVICE); goto err; } ret = 1; Loading Loading @@ -246,7 +246,7 @@ int TS_CONF_set_signer_cert(CONF *conf, const char *section, if (cert == NULL) { cert = NCONF_get_string(conf, section, ENV_SIGNER_CERT); if (cert == NULL) { TS_CONF_lookup_fail(section, ENV_SIGNER_CERT); ts_CONF_lookup_fail(section, ENV_SIGNER_CERT); goto err; } } Loading Loading @@ -292,7 +292,7 @@ int TS_CONF_set_signer_key(CONF *conf, const char *section, if (!key) key = NCONF_get_string(conf, section, ENV_SIGNER_KEY); if (!key) { TS_CONF_lookup_fail(section, ENV_SIGNER_KEY); ts_CONF_lookup_fail(section, ENV_SIGNER_KEY); goto err; } if ((key_obj = TS_CONF_load_key(key, pass)) == NULL) Loading @@ -314,11 +314,11 @@ int TS_CONF_set_def_policy(CONF *conf, const char *section, if (!policy) policy = NCONF_get_string(conf, section, ENV_DEFAULT_POLICY); if (!policy) { TS_CONF_lookup_fail(section, ENV_DEFAULT_POLICY); ts_CONF_lookup_fail(section, ENV_DEFAULT_POLICY); goto err; } if ((policy_obj = OBJ_txt2obj(policy, 0)) == NULL) { TS_CONF_invalid(section, ENV_DEFAULT_POLICY); ts_CONF_invalid(section, ENV_DEFAULT_POLICY); goto err; } if (!TS_RESP_CTX_set_def_policy(ctx, policy_obj)) Loading @@ -339,7 +339,7 @@ int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx) /* If no other policy is specified, that's fine. */ if (policies && (list = X509V3_parse_list(policies)) == NULL) { TS_CONF_invalid(section, ENV_OTHER_POLICIES); ts_CONF_invalid(section, ENV_OTHER_POLICIES); goto err; } for (i = 0; i < sk_CONF_VALUE_num(list); ++i) { Loading @@ -348,7 +348,7 @@ int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx) ASN1_OBJECT *objtmp; if ((objtmp = OBJ_txt2obj(extval, 0)) == NULL) { TS_CONF_invalid(section, ENV_OTHER_POLICIES); ts_CONF_invalid(section, ENV_OTHER_POLICIES); goto err; } if (!TS_RESP_CTX_add_policy(ctx, objtmp)) Loading @@ -370,15 +370,15 @@ int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx) char *digests = NCONF_get_string(conf, section, ENV_DIGESTS); if (digests == NULL) { TS_CONF_lookup_fail(section, ENV_DIGESTS); ts_CONF_lookup_fail(section, ENV_DIGESTS); goto err; } if ((list = X509V3_parse_list(digests)) == NULL) { TS_CONF_invalid(section, ENV_DIGESTS); ts_CONF_invalid(section, ENV_DIGESTS); goto err; } if (sk_CONF_VALUE_num(list) == 0) { TS_CONF_invalid(section, ENV_DIGESTS); ts_CONF_invalid(section, ENV_DIGESTS); goto err; } for (i = 0; i < sk_CONF_VALUE_num(list); ++i) { Loading @@ -387,7 +387,7 @@ int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx) const EVP_MD *md; if ((md = EVP_get_digestbyname(extval)) == NULL) { TS_CONF_invalid(section, ENV_DIGESTS); ts_CONF_invalid(section, ENV_DIGESTS); goto err; } if (!TS_RESP_CTX_add_md(ctx, md)) Loading @@ -409,7 +409,7 @@ int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx) char *accuracy = NCONF_get_string(conf, section, ENV_ACCURACY); if (accuracy && (list = X509V3_parse_list(accuracy)) == NULL) { TS_CONF_invalid(section, ENV_ACCURACY); ts_CONF_invalid(section, ENV_ACCURACY); goto err; } for (i = 0; i < sk_CONF_VALUE_num(list); ++i) { Loading @@ -424,7 +424,7 @@ int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx) if (val->value) micros = atoi(val->value); } else { TS_CONF_invalid(section, ENV_ACCURACY); ts_CONF_invalid(section, ENV_ACCURACY); goto err; } } Loading @@ -450,7 +450,7 @@ int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, &digits)) digits = 0; if (digits < 0 || digits > TS_MAX_CLOCK_PRECISION_DIGITS) { TS_CONF_invalid(section, ENV_CLOCK_PRECISION_DIGITS); ts_CONF_invalid(section, ENV_CLOCK_PRECISION_DIGITS); goto err; } Loading @@ -462,7 +462,7 @@ int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, return ret; } static int TS_CONF_add_flag(CONF *conf, const char *section, static int ts_CONF_add_flag(CONF *conf, const char *section, const char *field, int flag, TS_RESP_CTX *ctx) { /* Default is false. */ Loading @@ -471,7 +471,7 @@ static int TS_CONF_add_flag(CONF *conf, const char *section, if (strcmp(value, ENV_VALUE_YES) == 0) TS_RESP_CTX_add_flags(ctx, flag); else if (strcmp(value, ENV_VALUE_NO) != 0) { TS_CONF_invalid(section, field); ts_CONF_invalid(section, field); return 0; } } Loading @@ -481,17 +481,17 @@ static int TS_CONF_add_flag(CONF *conf, const char *section, int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx) { return TS_CONF_add_flag(conf, section, ENV_ORDERING, TS_ORDERING, ctx); return ts_CONF_add_flag(conf, section, ENV_ORDERING, TS_ORDERING, ctx); } int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx) { return TS_CONF_add_flag(conf, section, ENV_TSA_NAME, TS_TSA_NAME, ctx); return ts_CONF_add_flag(conf, section, ENV_TSA_NAME, TS_TSA_NAME, ctx); } int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, TS_RESP_CTX *ctx) { return TS_CONF_add_flag(conf, section, ENV_ESS_CERT_ID_CHAIN, return ts_CONF_add_flag(conf, section, ENV_ESS_CERT_ID_CHAIN, TS_ESS_CERT_ID_CHAIN, ctx); } crypto/ts/ts_rsp_print.c +6 −6 Original line number Diff line number Diff line Loading @@ -71,9 +71,9 @@ struct status_map_st { /* Local function declarations. */ static int TS_status_map_print(BIO *bio, const struct status_map_st *a, static int ts_status_map_print(BIO *bio, const struct status_map_st *a, const ASN1_BIT_STRING *v); static int TS_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy); static int ts_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy); /* Function definitions. */ Loading Loading @@ -149,7 +149,7 @@ int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a) /* Printing failure information. */ BIO_printf(bio, "Failure info: "); if (a->failure_info != NULL) lines = TS_status_map_print(bio, failure_map, a->failure_info); lines = ts_status_map_print(bio, failure_map, a->failure_info); if (lines == 0) BIO_printf(bio, "unspecified"); BIO_printf(bio, "\n"); Loading @@ -157,7 +157,7 @@ int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a) return 1; } static int TS_status_map_print(BIO *bio, const struct status_map_st *a, static int ts_status_map_print(BIO *bio, const struct status_map_st *a, const ASN1_BIT_STRING *v) { int lines = 0; Loading Loading @@ -219,7 +219,7 @@ int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a) if (accuracy == NULL) BIO_printf(bio, "unspecified"); else TS_ACCURACY_print_bio(bio, accuracy); ts_ACCURACY_print_bio(bio, accuracy); BIO_write(bio, "\n", 1); /* Print ordering. */ Loading Loading @@ -254,7 +254,7 @@ int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a) return 1; } static int TS_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy) static int ts_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy) { const ASN1_INTEGER *seconds = TS_ACCURACY_get_seconds(accuracy); const ASN1_INTEGER *millis = TS_ACCURACY_get_millis(accuracy); Loading crypto/ts/ts_rsp_sign.c +31 −31 Original line number Diff line number Diff line Loading @@ -73,19 +73,19 @@ static ASN1_INTEGER *def_serial_cb(struct TS_resp_ctx *, void *); static int def_time_cb(struct TS_resp_ctx *, void *, long *sec, long *usec); static int def_extension_cb(struct TS_resp_ctx *, X509_EXTENSION *, void *); static void TS_RESP_CTX_init(TS_RESP_CTX *ctx); static void TS_RESP_CTX_cleanup(TS_RESP_CTX *ctx); static int TS_RESP_check_request(TS_RESP_CTX *ctx); static ASN1_OBJECT *TS_RESP_get_policy(TS_RESP_CTX *ctx); static TS_TST_INFO *TS_RESP_create_tst_info(TS_RESP_CTX *ctx, static void ts_RESP_CTX_init(TS_RESP_CTX *ctx); static void ts_RESP_CTX_cleanup(TS_RESP_CTX *ctx); static int ts_RESP_check_request(TS_RESP_CTX *ctx); static ASN1_OBJECT *ts_RESP_get_policy(TS_RESP_CTX *ctx); static TS_TST_INFO *ts_RESP_create_tst_info(TS_RESP_CTX *ctx, ASN1_OBJECT *policy); static int TS_RESP_process_extensions(TS_RESP_CTX *ctx); static int TS_RESP_sign(TS_RESP_CTX *ctx); static int ts_RESP_process_extensions(TS_RESP_CTX *ctx); static int ts_RESP_sign(TS_RESP_CTX *ctx); static ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert, static ESS_SIGNING_CERT *ess_SIGNING_CERT_new_init(X509 *signcert, STACK_OF(X509) *certs); static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed); static int TS_TST_INFO_content_new(PKCS7 *p7); static ESS_CERT_ID *ess_CERT_ID_new_init(X509 *cert, int issuer_needed); static int ts_TST_INFO_content_new(PKCS7 *p7); static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc); static ASN1_GENERALIZEDTIME Loading Loading @@ -427,7 +427,7 @@ TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio) TS_RESP *response; int result = 0; TS_RESP_CTX_init(ctx); ts_RESP_CTX_init(ctx); /* Creating the response object. */ if ((ctx->response = TS_RESP_new()) == NULL) { Loading @@ -448,23 +448,23 @@ TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio) goto end; /* Checking the request format. */ if (!TS_RESP_check_request(ctx)) if (!ts_RESP_check_request(ctx)) goto end; /* Checking acceptable policies. */ if ((policy = TS_RESP_get_policy(ctx)) == NULL) if ((policy = ts_RESP_get_policy(ctx)) == NULL) goto end; /* Creating the TS_TST_INFO object. */ if ((ctx->tst_info = TS_RESP_create_tst_info(ctx, policy)) == NULL) if ((ctx->tst_info = ts_RESP_create_tst_info(ctx, policy)) == NULL) goto end; /* Processing extensions. */ if (!TS_RESP_process_extensions(ctx)) if (!ts_RESP_process_extensions(ctx)) goto end; /* Generating the signature. */ if (!TS_RESP_sign(ctx)) if (!ts_RESP_sign(ctx)) goto end; /* Everything was successful. */ Loading @@ -484,12 +484,12 @@ TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio) } response = ctx->response; ctx->response = NULL; /* Ownership will be returned to caller. */ TS_RESP_CTX_cleanup(ctx); ts_RESP_CTX_cleanup(ctx); return response; } /* Initializes the variable part of the context. */ static void TS_RESP_CTX_init(TS_RESP_CTX *ctx) static void ts_RESP_CTX_init(TS_RESP_CTX *ctx) { ctx->request = NULL; ctx->response = NULL; Loading @@ -497,7 +497,7 @@ static void TS_RESP_CTX_init(TS_RESP_CTX *ctx) } /* Cleans up the variable part of the context. */ static void TS_RESP_CTX_cleanup(TS_RESP_CTX *ctx) static void ts_RESP_CTX_cleanup(TS_RESP_CTX *ctx) { TS_REQ_free(ctx->request); ctx->request = NULL; Loading @@ -508,7 +508,7 @@ static void TS_RESP_CTX_cleanup(TS_RESP_CTX *ctx) } /* Checks the format and content of the request. */ static int TS_RESP_check_request(TS_RESP_CTX *ctx) static int ts_RESP_check_request(TS_RESP_CTX *ctx) { TS_REQ *request = ctx->request; TS_MSG_IMPRINT *msg_imprint; Loading Loading @@ -564,7 +564,7 @@ static int TS_RESP_check_request(TS_RESP_CTX *ctx) } /* Returns the TSA policy based on the requested and acceptable policies. */ static ASN1_OBJECT *TS_RESP_get_policy(TS_RESP_CTX *ctx) static ASN1_OBJECT *ts_RESP_get_policy(TS_RESP_CTX *ctx) { ASN1_OBJECT *requested = TS_REQ_get_policy_id(ctx->request); ASN1_OBJECT *policy = NULL; Loading Loading @@ -597,7 +597,7 @@ static ASN1_OBJECT *TS_RESP_get_policy(TS_RESP_CTX *ctx) } /* Creates the TS_TST_INFO object based on the settings of the context. */ static TS_TST_INFO *TS_RESP_create_tst_info(TS_RESP_CTX *ctx, static TS_TST_INFO *ts_RESP_create_tst_info(TS_RESP_CTX *ctx, ASN1_OBJECT *policy) { int result = 0; Loading Loading @@ -683,7 +683,7 @@ static TS_TST_INFO *TS_RESP_create_tst_info(TS_RESP_CTX *ctx, } /* Processing the extensions of the request. */ static int TS_RESP_process_extensions(TS_RESP_CTX *ctx) static int ts_RESP_process_extensions(TS_RESP_CTX *ctx) { STACK_OF(X509_EXTENSION) *exts = TS_REQ_get_exts(ctx->request); int i; Loading @@ -704,7 +704,7 @@ static int TS_RESP_process_extensions(TS_RESP_CTX *ctx) } /* Functions for signing the TS_TST_INFO structure of the context. */ static int TS_RESP_sign(TS_RESP_CTX *ctx) static int ts_RESP_sign(TS_RESP_CTX *ctx) { int ret = 0; PKCS7 *p7 = NULL; Loading Loading @@ -764,7 +764,7 @@ static int TS_RESP_sign(TS_RESP_CTX *ctx) * certificate id and optionally the certificate chain. */ certs = ctx->flags & TS_ESS_CERT_ID_CHAIN ? ctx->certs : NULL; if ((sc = ESS_SIGNING_CERT_new_init(ctx->signer_cert, certs)) == NULL) if ((sc = ess_SIGNING_CERT_new_init(ctx->signer_cert, certs)) == NULL) goto err; /* Add SigningCertificate signed attribute to the signer info. */ Loading @@ -774,7 +774,7 @@ static int TS_RESP_sign(TS_RESP_CTX *ctx) } /* Add a new empty NID_id_smime_ct_TSTInfo encapsulated content. */ if (!TS_TST_INFO_content_new(p7)) if (!ts_TST_INFO_content_new(p7)) goto err; /* Add the DER encoded tst_info to the PKCS7 structure. */ Loading Loading @@ -812,7 +812,7 @@ static int TS_RESP_sign(TS_RESP_CTX *ctx) return ret; } static ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert, static ESS_SIGNING_CERT *ess_SIGNING_CERT_new_init(X509 *signcert, STACK_OF(X509) *certs) { ESS_CERT_ID *cid; Loading @@ -827,13 +827,13 @@ static ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert, goto err; /* Adding the signing certificate id. */ if ((cid = ESS_CERT_ID_new_init(signcert, 0)) == NULL if ((cid = ess_CERT_ID_new_init(signcert, 0)) == NULL || !sk_ESS_CERT_ID_push(sc->cert_ids, cid)) goto err; /* Adding the certificate chain ids. */ for (i = 0; i < sk_X509_num(certs); ++i) { X509 *cert = sk_X509_value(certs, i); if ((cid = ESS_CERT_ID_new_init(cert, 1)) == NULL if ((cid = ess_CERT_ID_new_init(cert, 1)) == NULL || !sk_ESS_CERT_ID_push(sc->cert_ids, cid)) goto err; } Loading @@ -845,7 +845,7 @@ static ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert, return NULL; } static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed) static ESS_CERT_ID *ess_CERT_ID_new_init(X509 *cert, int issuer_needed) { ESS_CERT_ID *cid = NULL; GENERAL_NAME *name = NULL; Loading Loading @@ -889,7 +889,7 @@ static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed) return NULL; } static int TS_TST_INFO_content_new(PKCS7 *p7) static int ts_TST_INFO_content_new(PKCS7 *p7) { PKCS7 *ret = NULL; ASN1_OCTET_STRING *octet_string = NULL; Loading crypto/ts/ts_rsp_verify.c +61 −78 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
crypto/ts/ts_conf.c +23 −23 Original line number Diff line number Diff line Loading @@ -152,12 +152,12 @@ EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass) /* Function definitions for handling configuration options. */ static void TS_CONF_lookup_fail(const char *name, const char *tag) static void ts_CONF_lookup_fail(const char *name, const char *tag) { fprintf(stderr, "variable lookup failed for %s::%s\n", name, tag); } static void TS_CONF_invalid(const char *name, const char *tag) static void ts_CONF_invalid(const char *name, const char *tag) { fprintf(stderr, "invalid variable value for %s::%s\n", name, tag); } Loading @@ -167,7 +167,7 @@ const char *TS_CONF_get_tsa_section(CONF *conf, const char *section) if (!section) { section = NCONF_get_string(conf, BASE_SECTION, ENV_DEFAULT_TSA); if (!section) TS_CONF_lookup_fail(BASE_SECTION, ENV_DEFAULT_TSA); ts_CONF_lookup_fail(BASE_SECTION, ENV_DEFAULT_TSA); } return section; } Loading @@ -178,7 +178,7 @@ int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, int ret = 0; char *serial = NCONF_get_string(conf, section, ENV_SERIAL); if (!serial) { TS_CONF_lookup_fail(section, ENV_SERIAL); ts_CONF_lookup_fail(section, ENV_SERIAL); goto err; } TS_RESP_CTX_set_serial_cb(ctx, cb, serial); Loading @@ -199,7 +199,7 @@ int TS_CONF_set_crypto_device(CONF *conf, const char *section, device = NCONF_get_string(conf, section, ENV_CRYPTO_DEVICE); if (device && !TS_CONF_set_default_engine(device)) { TS_CONF_invalid(section, ENV_CRYPTO_DEVICE); ts_CONF_invalid(section, ENV_CRYPTO_DEVICE); goto err; } ret = 1; Loading Loading @@ -246,7 +246,7 @@ int TS_CONF_set_signer_cert(CONF *conf, const char *section, if (cert == NULL) { cert = NCONF_get_string(conf, section, ENV_SIGNER_CERT); if (cert == NULL) { TS_CONF_lookup_fail(section, ENV_SIGNER_CERT); ts_CONF_lookup_fail(section, ENV_SIGNER_CERT); goto err; } } Loading Loading @@ -292,7 +292,7 @@ int TS_CONF_set_signer_key(CONF *conf, const char *section, if (!key) key = NCONF_get_string(conf, section, ENV_SIGNER_KEY); if (!key) { TS_CONF_lookup_fail(section, ENV_SIGNER_KEY); ts_CONF_lookup_fail(section, ENV_SIGNER_KEY); goto err; } if ((key_obj = TS_CONF_load_key(key, pass)) == NULL) Loading @@ -314,11 +314,11 @@ int TS_CONF_set_def_policy(CONF *conf, const char *section, if (!policy) policy = NCONF_get_string(conf, section, ENV_DEFAULT_POLICY); if (!policy) { TS_CONF_lookup_fail(section, ENV_DEFAULT_POLICY); ts_CONF_lookup_fail(section, ENV_DEFAULT_POLICY); goto err; } if ((policy_obj = OBJ_txt2obj(policy, 0)) == NULL) { TS_CONF_invalid(section, ENV_DEFAULT_POLICY); ts_CONF_invalid(section, ENV_DEFAULT_POLICY); goto err; } if (!TS_RESP_CTX_set_def_policy(ctx, policy_obj)) Loading @@ -339,7 +339,7 @@ int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx) /* If no other policy is specified, that's fine. */ if (policies && (list = X509V3_parse_list(policies)) == NULL) { TS_CONF_invalid(section, ENV_OTHER_POLICIES); ts_CONF_invalid(section, ENV_OTHER_POLICIES); goto err; } for (i = 0; i < sk_CONF_VALUE_num(list); ++i) { Loading @@ -348,7 +348,7 @@ int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx) ASN1_OBJECT *objtmp; if ((objtmp = OBJ_txt2obj(extval, 0)) == NULL) { TS_CONF_invalid(section, ENV_OTHER_POLICIES); ts_CONF_invalid(section, ENV_OTHER_POLICIES); goto err; } if (!TS_RESP_CTX_add_policy(ctx, objtmp)) Loading @@ -370,15 +370,15 @@ int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx) char *digests = NCONF_get_string(conf, section, ENV_DIGESTS); if (digests == NULL) { TS_CONF_lookup_fail(section, ENV_DIGESTS); ts_CONF_lookup_fail(section, ENV_DIGESTS); goto err; } if ((list = X509V3_parse_list(digests)) == NULL) { TS_CONF_invalid(section, ENV_DIGESTS); ts_CONF_invalid(section, ENV_DIGESTS); goto err; } if (sk_CONF_VALUE_num(list) == 0) { TS_CONF_invalid(section, ENV_DIGESTS); ts_CONF_invalid(section, ENV_DIGESTS); goto err; } for (i = 0; i < sk_CONF_VALUE_num(list); ++i) { Loading @@ -387,7 +387,7 @@ int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx) const EVP_MD *md; if ((md = EVP_get_digestbyname(extval)) == NULL) { TS_CONF_invalid(section, ENV_DIGESTS); ts_CONF_invalid(section, ENV_DIGESTS); goto err; } if (!TS_RESP_CTX_add_md(ctx, md)) Loading @@ -409,7 +409,7 @@ int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx) char *accuracy = NCONF_get_string(conf, section, ENV_ACCURACY); if (accuracy && (list = X509V3_parse_list(accuracy)) == NULL) { TS_CONF_invalid(section, ENV_ACCURACY); ts_CONF_invalid(section, ENV_ACCURACY); goto err; } for (i = 0; i < sk_CONF_VALUE_num(list); ++i) { Loading @@ -424,7 +424,7 @@ int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx) if (val->value) micros = atoi(val->value); } else { TS_CONF_invalid(section, ENV_ACCURACY); ts_CONF_invalid(section, ENV_ACCURACY); goto err; } } Loading @@ -450,7 +450,7 @@ int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, &digits)) digits = 0; if (digits < 0 || digits > TS_MAX_CLOCK_PRECISION_DIGITS) { TS_CONF_invalid(section, ENV_CLOCK_PRECISION_DIGITS); ts_CONF_invalid(section, ENV_CLOCK_PRECISION_DIGITS); goto err; } Loading @@ -462,7 +462,7 @@ int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, return ret; } static int TS_CONF_add_flag(CONF *conf, const char *section, static int ts_CONF_add_flag(CONF *conf, const char *section, const char *field, int flag, TS_RESP_CTX *ctx) { /* Default is false. */ Loading @@ -471,7 +471,7 @@ static int TS_CONF_add_flag(CONF *conf, const char *section, if (strcmp(value, ENV_VALUE_YES) == 0) TS_RESP_CTX_add_flags(ctx, flag); else if (strcmp(value, ENV_VALUE_NO) != 0) { TS_CONF_invalid(section, field); ts_CONF_invalid(section, field); return 0; } } Loading @@ -481,17 +481,17 @@ static int TS_CONF_add_flag(CONF *conf, const char *section, int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx) { return TS_CONF_add_flag(conf, section, ENV_ORDERING, TS_ORDERING, ctx); return ts_CONF_add_flag(conf, section, ENV_ORDERING, TS_ORDERING, ctx); } int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx) { return TS_CONF_add_flag(conf, section, ENV_TSA_NAME, TS_TSA_NAME, ctx); return ts_CONF_add_flag(conf, section, ENV_TSA_NAME, TS_TSA_NAME, ctx); } int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, TS_RESP_CTX *ctx) { return TS_CONF_add_flag(conf, section, ENV_ESS_CERT_ID_CHAIN, return ts_CONF_add_flag(conf, section, ENV_ESS_CERT_ID_CHAIN, TS_ESS_CERT_ID_CHAIN, ctx); }
crypto/ts/ts_rsp_print.c +6 −6 Original line number Diff line number Diff line Loading @@ -71,9 +71,9 @@ struct status_map_st { /* Local function declarations. */ static int TS_status_map_print(BIO *bio, const struct status_map_st *a, static int ts_status_map_print(BIO *bio, const struct status_map_st *a, const ASN1_BIT_STRING *v); static int TS_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy); static int ts_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy); /* Function definitions. */ Loading Loading @@ -149,7 +149,7 @@ int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a) /* Printing failure information. */ BIO_printf(bio, "Failure info: "); if (a->failure_info != NULL) lines = TS_status_map_print(bio, failure_map, a->failure_info); lines = ts_status_map_print(bio, failure_map, a->failure_info); if (lines == 0) BIO_printf(bio, "unspecified"); BIO_printf(bio, "\n"); Loading @@ -157,7 +157,7 @@ int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a) return 1; } static int TS_status_map_print(BIO *bio, const struct status_map_st *a, static int ts_status_map_print(BIO *bio, const struct status_map_st *a, const ASN1_BIT_STRING *v) { int lines = 0; Loading Loading @@ -219,7 +219,7 @@ int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a) if (accuracy == NULL) BIO_printf(bio, "unspecified"); else TS_ACCURACY_print_bio(bio, accuracy); ts_ACCURACY_print_bio(bio, accuracy); BIO_write(bio, "\n", 1); /* Print ordering. */ Loading Loading @@ -254,7 +254,7 @@ int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a) return 1; } static int TS_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy) static int ts_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy) { const ASN1_INTEGER *seconds = TS_ACCURACY_get_seconds(accuracy); const ASN1_INTEGER *millis = TS_ACCURACY_get_millis(accuracy); Loading
crypto/ts/ts_rsp_sign.c +31 −31 Original line number Diff line number Diff line Loading @@ -73,19 +73,19 @@ static ASN1_INTEGER *def_serial_cb(struct TS_resp_ctx *, void *); static int def_time_cb(struct TS_resp_ctx *, void *, long *sec, long *usec); static int def_extension_cb(struct TS_resp_ctx *, X509_EXTENSION *, void *); static void TS_RESP_CTX_init(TS_RESP_CTX *ctx); static void TS_RESP_CTX_cleanup(TS_RESP_CTX *ctx); static int TS_RESP_check_request(TS_RESP_CTX *ctx); static ASN1_OBJECT *TS_RESP_get_policy(TS_RESP_CTX *ctx); static TS_TST_INFO *TS_RESP_create_tst_info(TS_RESP_CTX *ctx, static void ts_RESP_CTX_init(TS_RESP_CTX *ctx); static void ts_RESP_CTX_cleanup(TS_RESP_CTX *ctx); static int ts_RESP_check_request(TS_RESP_CTX *ctx); static ASN1_OBJECT *ts_RESP_get_policy(TS_RESP_CTX *ctx); static TS_TST_INFO *ts_RESP_create_tst_info(TS_RESP_CTX *ctx, ASN1_OBJECT *policy); static int TS_RESP_process_extensions(TS_RESP_CTX *ctx); static int TS_RESP_sign(TS_RESP_CTX *ctx); static int ts_RESP_process_extensions(TS_RESP_CTX *ctx); static int ts_RESP_sign(TS_RESP_CTX *ctx); static ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert, static ESS_SIGNING_CERT *ess_SIGNING_CERT_new_init(X509 *signcert, STACK_OF(X509) *certs); static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed); static int TS_TST_INFO_content_new(PKCS7 *p7); static ESS_CERT_ID *ess_CERT_ID_new_init(X509 *cert, int issuer_needed); static int ts_TST_INFO_content_new(PKCS7 *p7); static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc); static ASN1_GENERALIZEDTIME Loading Loading @@ -427,7 +427,7 @@ TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio) TS_RESP *response; int result = 0; TS_RESP_CTX_init(ctx); ts_RESP_CTX_init(ctx); /* Creating the response object. */ if ((ctx->response = TS_RESP_new()) == NULL) { Loading @@ -448,23 +448,23 @@ TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio) goto end; /* Checking the request format. */ if (!TS_RESP_check_request(ctx)) if (!ts_RESP_check_request(ctx)) goto end; /* Checking acceptable policies. */ if ((policy = TS_RESP_get_policy(ctx)) == NULL) if ((policy = ts_RESP_get_policy(ctx)) == NULL) goto end; /* Creating the TS_TST_INFO object. */ if ((ctx->tst_info = TS_RESP_create_tst_info(ctx, policy)) == NULL) if ((ctx->tst_info = ts_RESP_create_tst_info(ctx, policy)) == NULL) goto end; /* Processing extensions. */ if (!TS_RESP_process_extensions(ctx)) if (!ts_RESP_process_extensions(ctx)) goto end; /* Generating the signature. */ if (!TS_RESP_sign(ctx)) if (!ts_RESP_sign(ctx)) goto end; /* Everything was successful. */ Loading @@ -484,12 +484,12 @@ TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio) } response = ctx->response; ctx->response = NULL; /* Ownership will be returned to caller. */ TS_RESP_CTX_cleanup(ctx); ts_RESP_CTX_cleanup(ctx); return response; } /* Initializes the variable part of the context. */ static void TS_RESP_CTX_init(TS_RESP_CTX *ctx) static void ts_RESP_CTX_init(TS_RESP_CTX *ctx) { ctx->request = NULL; ctx->response = NULL; Loading @@ -497,7 +497,7 @@ static void TS_RESP_CTX_init(TS_RESP_CTX *ctx) } /* Cleans up the variable part of the context. */ static void TS_RESP_CTX_cleanup(TS_RESP_CTX *ctx) static void ts_RESP_CTX_cleanup(TS_RESP_CTX *ctx) { TS_REQ_free(ctx->request); ctx->request = NULL; Loading @@ -508,7 +508,7 @@ static void TS_RESP_CTX_cleanup(TS_RESP_CTX *ctx) } /* Checks the format and content of the request. */ static int TS_RESP_check_request(TS_RESP_CTX *ctx) static int ts_RESP_check_request(TS_RESP_CTX *ctx) { TS_REQ *request = ctx->request; TS_MSG_IMPRINT *msg_imprint; Loading Loading @@ -564,7 +564,7 @@ static int TS_RESP_check_request(TS_RESP_CTX *ctx) } /* Returns the TSA policy based on the requested and acceptable policies. */ static ASN1_OBJECT *TS_RESP_get_policy(TS_RESP_CTX *ctx) static ASN1_OBJECT *ts_RESP_get_policy(TS_RESP_CTX *ctx) { ASN1_OBJECT *requested = TS_REQ_get_policy_id(ctx->request); ASN1_OBJECT *policy = NULL; Loading Loading @@ -597,7 +597,7 @@ static ASN1_OBJECT *TS_RESP_get_policy(TS_RESP_CTX *ctx) } /* Creates the TS_TST_INFO object based on the settings of the context. */ static TS_TST_INFO *TS_RESP_create_tst_info(TS_RESP_CTX *ctx, static TS_TST_INFO *ts_RESP_create_tst_info(TS_RESP_CTX *ctx, ASN1_OBJECT *policy) { int result = 0; Loading Loading @@ -683,7 +683,7 @@ static TS_TST_INFO *TS_RESP_create_tst_info(TS_RESP_CTX *ctx, } /* Processing the extensions of the request. */ static int TS_RESP_process_extensions(TS_RESP_CTX *ctx) static int ts_RESP_process_extensions(TS_RESP_CTX *ctx) { STACK_OF(X509_EXTENSION) *exts = TS_REQ_get_exts(ctx->request); int i; Loading @@ -704,7 +704,7 @@ static int TS_RESP_process_extensions(TS_RESP_CTX *ctx) } /* Functions for signing the TS_TST_INFO structure of the context. */ static int TS_RESP_sign(TS_RESP_CTX *ctx) static int ts_RESP_sign(TS_RESP_CTX *ctx) { int ret = 0; PKCS7 *p7 = NULL; Loading Loading @@ -764,7 +764,7 @@ static int TS_RESP_sign(TS_RESP_CTX *ctx) * certificate id and optionally the certificate chain. */ certs = ctx->flags & TS_ESS_CERT_ID_CHAIN ? ctx->certs : NULL; if ((sc = ESS_SIGNING_CERT_new_init(ctx->signer_cert, certs)) == NULL) if ((sc = ess_SIGNING_CERT_new_init(ctx->signer_cert, certs)) == NULL) goto err; /* Add SigningCertificate signed attribute to the signer info. */ Loading @@ -774,7 +774,7 @@ static int TS_RESP_sign(TS_RESP_CTX *ctx) } /* Add a new empty NID_id_smime_ct_TSTInfo encapsulated content. */ if (!TS_TST_INFO_content_new(p7)) if (!ts_TST_INFO_content_new(p7)) goto err; /* Add the DER encoded tst_info to the PKCS7 structure. */ Loading Loading @@ -812,7 +812,7 @@ static int TS_RESP_sign(TS_RESP_CTX *ctx) return ret; } static ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert, static ESS_SIGNING_CERT *ess_SIGNING_CERT_new_init(X509 *signcert, STACK_OF(X509) *certs) { ESS_CERT_ID *cid; Loading @@ -827,13 +827,13 @@ static ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert, goto err; /* Adding the signing certificate id. */ if ((cid = ESS_CERT_ID_new_init(signcert, 0)) == NULL if ((cid = ess_CERT_ID_new_init(signcert, 0)) == NULL || !sk_ESS_CERT_ID_push(sc->cert_ids, cid)) goto err; /* Adding the certificate chain ids. */ for (i = 0; i < sk_X509_num(certs); ++i) { X509 *cert = sk_X509_value(certs, i); if ((cid = ESS_CERT_ID_new_init(cert, 1)) == NULL if ((cid = ess_CERT_ID_new_init(cert, 1)) == NULL || !sk_ESS_CERT_ID_push(sc->cert_ids, cid)) goto err; } Loading @@ -845,7 +845,7 @@ static ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert, return NULL; } static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed) static ESS_CERT_ID *ess_CERT_ID_new_init(X509 *cert, int issuer_needed) { ESS_CERT_ID *cid = NULL; GENERAL_NAME *name = NULL; Loading Loading @@ -889,7 +889,7 @@ static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed) return NULL; } static int TS_TST_INFO_content_new(PKCS7 *p7) static int ts_TST_INFO_content_new(PKCS7 *p7) { PKCS7 *ret = NULL; ASN1_OCTET_STRING *octet_string = NULL; Loading
crypto/ts/ts_rsp_verify.c +61 −78 File changed.Preview size limit exceeded, changes collapsed. Show changes