diff options
author | Matt Caswell <matt@openssl.org> | 2016-06-15 15:32:38 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-06-18 15:34:03 +0100 |
commit | ac94c8fdb9e8a36e616c80fa8c4aadb455144019 (patch) | |
tree | a5e35dbd815cabd2a3cf9b18e49e59be3c7dfbf3 | |
parent | 98370c2dd7dc32cecd7bb7d940383846fa435f25 (diff) |
Improve const correctness for stacks of EVP_MD
EVP_MDs are always const, so stacks of them should be too. This silences
a warning about type punning on OpenBSD.
RT4378
Reviewed-by: Richard Levitte <levitte@openssl.org>
-rw-r--r-- | crypto/ts/ts_rsp_sign.c | 6 | ||||
-rw-r--r-- | include/openssl/ts.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/crypto/ts/ts_rsp_sign.c b/crypto/ts/ts_rsp_sign.c index a4acc9e837..8619cb5c90 100644 --- a/crypto/ts/ts_rsp_sign.c +++ b/crypto/ts/ts_rsp_sign.c @@ -223,7 +223,7 @@ int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md) if (ctx->mds == NULL && (ctx->mds = sk_EVP_MD_new_null()) == NULL) goto err; - if (!sk_EVP_MD_push(ctx->mds, (EVP_MD *)md)) + if (!sk_EVP_MD_push(ctx->mds, md)) goto err; return 1; @@ -446,7 +446,7 @@ static int ts_RESP_check_request(TS_RESP_CTX *ctx) X509_ALGOR *md_alg; int md_alg_id; const ASN1_OCTET_STRING *digest; - EVP_MD *md = NULL; + const EVP_MD *md = NULL; int i; if (TS_REQ_get_version(request) != 1) { @@ -460,7 +460,7 @@ static int ts_RESP_check_request(TS_RESP_CTX *ctx) md_alg = msg_imprint->hash_algo; md_alg_id = OBJ_obj2nid(md_alg->algorithm); for (i = 0; !md && i < sk_EVP_MD_num(ctx->mds); ++i) { - EVP_MD *current_md = sk_EVP_MD_value(ctx->mds, i); + const EVP_MD *current_md = sk_EVP_MD_value(ctx->mds, i); if (md_alg_id == EVP_MD_type(current_md)) md = current_md; } diff --git a/include/openssl/ts.h b/include/openssl/ts.h index d512648913..3fbaf55ae2 100644 --- a/include/openssl/ts.h +++ b/include/openssl/ts.h @@ -306,7 +306,7 @@ typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *, typedef struct TS_resp_ctx TS_RESP_CTX; -DEFINE_STACK_OF(EVP_MD) +DEFINE_STACK_OF_CONST(EVP_MD) /* Creates a response context that can be used for generating responses. */ TS_RESP_CTX *TS_RESP_CTX_new(void); |