From c47ba4e96c7aa9c2f741f8c89b6440ed2c13b91c Mon Sep 17 00:00:00 2001 From: FdaSilvaYY Date: Sun, 31 Jul 2016 19:38:09 +0200 Subject: Constify some ASN1_OBJECT *obj input parameters Reviewed-by: Rich Salz Reviewed-by: Richard Levitte --- crypto/ts/ts_req_utils.c | 4 ++-- crypto/ts/ts_rsp_sign.c | 4 ++-- crypto/ts/ts_rsp_utils.c | 2 +- crypto/ts/ts_rsp_verify.c | 12 +++++++----- 4 files changed, 12 insertions(+), 10 deletions(-) (limited to 'crypto/ts') diff --git a/crypto/ts/ts_req_utils.c b/crypto/ts/ts_req_utils.c index a37cf84..2073d33 100644 --- a/crypto/ts/ts_req_utils.c +++ b/crypto/ts/ts_req_utils.c @@ -76,7 +76,7 @@ ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a) return a->hashed_msg; } -int TS_REQ_set_policy_id(TS_REQ *a, ASN1_OBJECT *policy) +int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy) { ASN1_OBJECT *new_policy; @@ -152,7 +152,7 @@ int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos) return X509v3_get_ext_by_NID(a->extensions, nid, lastpos); } -int TS_REQ_get_ext_by_OBJ(TS_REQ *a, ASN1_OBJECT *obj, int lastpos) +int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos) { return X509v3_get_ext_by_OBJ(a->extensions, obj, lastpos); } diff --git a/crypto/ts/ts_rsp_sign.c b/crypto/ts/ts_rsp_sign.c index 8619cb5..aea7b92 100644 --- a/crypto/ts/ts_rsp_sign.c +++ b/crypto/ts/ts_rsp_sign.c @@ -173,7 +173,7 @@ int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx, const EVP_MD *md) return 1; } -int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *def_policy) +int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy) { ASN1_OBJECT_free(ctx->default_policy); if ((ctx->default_policy = OBJ_dup(def_policy)) == NULL) @@ -199,7 +199,7 @@ int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs) return 1; } -int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy) +int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy) { ASN1_OBJECT *copy = NULL; diff --git a/crypto/ts/ts_rsp_utils.c b/crypto/ts/ts_rsp_utils.c index 3747b5c..3ee9dae 100644 --- a/crypto/ts/ts_rsp_utils.c +++ b/crypto/ts/ts_rsp_utils.c @@ -313,7 +313,7 @@ int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos) return X509v3_get_ext_by_NID(a->extensions, nid, lastpos); } -int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, ASN1_OBJECT *obj, int lastpos) +int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj, int lastpos) { return X509v3_get_ext_by_OBJ(a->extensions, obj, lastpos); } diff --git a/crypto/ts/ts_rsp_verify.c b/crypto/ts/ts_rsp_verify.c index 0916636..8ed973b 100644 --- a/crypto/ts/ts_rsp_verify.c +++ b/crypto/ts/ts_rsp_verify.c @@ -25,12 +25,13 @@ static int int_ts_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token, TS_TST_INFO *tst_info); static int ts_check_status_info(TS_RESP *response); static char *ts_get_status_text(STACK_OF(ASN1_UTF8STRING) *text); -static int ts_check_policy(ASN1_OBJECT *req_oid, TS_TST_INFO *tst_info); +static int ts_check_policy(const ASN1_OBJECT *req_oid, + const TS_TST_INFO *tst_info); static int ts_compute_imprint(BIO *data, TS_TST_INFO *tst_info, X509_ALGOR **md_alg, unsigned char **imprint, unsigned *imprint_len); static int ts_check_imprints(X509_ALGOR *algor_a, - unsigned char *imprint_a, unsigned len_a, + const unsigned char *imprint_a, unsigned len_a, TS_TST_INFO *tst_info); static int ts_check_nonces(const ASN1_INTEGER *a, TS_TST_INFO *tst_info); static int ts_check_signer_name(GENERAL_NAME *tsa_name, X509 *signer); @@ -477,9 +478,10 @@ static char *ts_get_status_text(STACK_OF(ASN1_UTF8STRING) *text) return result; } -static int ts_check_policy(ASN1_OBJECT *req_oid, TS_TST_INFO *tst_info) +static int ts_check_policy(const ASN1_OBJECT *req_oid, + const TS_TST_INFO *tst_info) { - ASN1_OBJECT *resp_oid = tst_info->policy_id; + const ASN1_OBJECT *resp_oid = tst_info->policy_id; if (OBJ_cmp(req_oid, resp_oid) != 0) { TSerr(TS_F_TS_CHECK_POLICY, TS_R_POLICY_MISMATCH); @@ -544,7 +546,7 @@ static int ts_compute_imprint(BIO *data, TS_TST_INFO *tst_info, } static int ts_check_imprints(X509_ALGOR *algor_a, - unsigned char *imprint_a, unsigned len_a, + const unsigned char *imprint_a, unsigned len_a, TS_TST_INFO *tst_info) { TS_MSG_IMPRINT *b = tst_info->msg_imprint; -- cgit v1.1