提交 ac94c8fd 编写于 作者: M Matt Caswell

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: NRichard Levitte <levitte@openssl.org>
上级 98370c2d
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册