Generalize crypto_ctx_task_md_ctx signature

parent 21cd3102
...@@ -583,16 +583,14 @@ static const struct vmod_priv_methods verifier_priv_task_methods[1] = {{ ...@@ -583,16 +583,14 @@ static const struct vmod_priv_methods verifier_priv_task_methods[1] = {{
}}; }};
static EVP_MD_CTX * static EVP_MD_CTX *
crypto_ctx_task_md_ctx(VRT_CTX, crypto_ctx_task_md_ctx(VRT_CTX, const void *id, EVP_MD_CTX *evpctx, int reset)
const struct vmod_crypto_verifier *vcv, int reset)
{ {
struct vmod_crypto_ctx_task *vcvt; struct vmod_crypto_ctx_task *vcvt;
struct vmod_priv *task; struct vmod_priv *task;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vcv, VMOD_CRYPTO_VERIFIER_MAGIC);
task = VRT_priv_task(ctx, vcv); task = VRT_priv_task(ctx, id);
if (task == NULL) { if (task == NULL) {
VRT_fail(ctx, "no priv_task"); VRT_fail(ctx, "no priv_task");
...@@ -626,7 +624,7 @@ crypto_ctx_task_md_ctx(VRT_CTX, ...@@ -626,7 +624,7 @@ crypto_ctx_task_md_ctx(VRT_CTX,
task->methods = verifier_priv_task_methods; task->methods = verifier_priv_task_methods;
} }
if (EVP_MD_CTX_copy_ex(vcvt->evpctx, vcv->evpctx) != 1) { if (EVP_MD_CTX_copy_ex(vcvt->evpctx, evpctx) != 1) {
VRT_fail(ctx, "vmod_crypto_ctx_task copy" VRT_fail(ctx, "vmod_crypto_ctx_task copy"
" failed, error 0x%lx", ERR_get_error()); " failed, error 0x%lx", ERR_get_error());
EVP_MD_CTX_free(vcvt->evpctx); EVP_MD_CTX_free(vcvt->evpctx);
...@@ -641,7 +639,7 @@ VCL_BOOL ...@@ -641,7 +639,7 @@ VCL_BOOL
vmod_verifier_update(VRT_CTX, struct vmod_crypto_verifier *vcv, vmod_verifier_update(VRT_CTX, struct vmod_crypto_verifier *vcv,
VCL_STRANDS str) VCL_STRANDS str)
{ {
EVP_MD_CTX *evpctx = crypto_ctx_task_md_ctx(ctx, vcv, 0); EVP_MD_CTX *evpctx = crypto_ctx_task_md_ctx(ctx, vcv, vcv->evpctx, 0);
const char *s; const char *s;
int i; int i;
...@@ -671,7 +669,7 @@ VCL_BOOL ...@@ -671,7 +669,7 @@ VCL_BOOL
vmod_verifier_update_blob(VRT_CTX, struct vmod_crypto_verifier *vcv, vmod_verifier_update_blob(VRT_CTX, struct vmod_crypto_verifier *vcv,
VCL_BLOB blob) VCL_BLOB blob)
{ {
EVP_MD_CTX *evpctx = crypto_ctx_task_md_ctx(ctx, vcv, 0); EVP_MD_CTX *evpctx = crypto_ctx_task_md_ctx(ctx, vcv, vcv->evpctx, 0);
if (evpctx == NULL) if (evpctx == NULL)
return (0); return (0);
...@@ -692,7 +690,7 @@ vmod_verifier_update_blob(VRT_CTX, struct vmod_crypto_verifier *vcv, ...@@ -692,7 +690,7 @@ vmod_verifier_update_blob(VRT_CTX, struct vmod_crypto_verifier *vcv,
VCL_BOOL vmod_verifier_reset(VRT_CTX, VCL_BOOL vmod_verifier_reset(VRT_CTX,
struct vmod_crypto_verifier *vcv) struct vmod_crypto_verifier *vcv)
{ {
return (!! crypto_ctx_task_md_ctx(ctx, vcv, 1)); return (!! crypto_ctx_task_md_ctx(ctx, vcv, vcv->evpctx, 1));
} }
static int static int
...@@ -708,7 +706,7 @@ crypto_err_cb(const char *s, size_t l, void *u) ...@@ -708,7 +706,7 @@ crypto_err_cb(const char *s, size_t l, void *u)
VCL_BOOL vmod_verifier_valid(VRT_CTX, VCL_BOOL vmod_verifier_valid(VRT_CTX,
struct vmod_crypto_verifier *vcv, VCL_BLOB sig) struct vmod_crypto_verifier *vcv, VCL_BLOB sig)
{ {
EVP_MD_CTX *evpctx = crypto_ctx_task_md_ctx(ctx, vcv, 0); EVP_MD_CTX *evpctx = crypto_ctx_task_md_ctx(ctx, vcv, vcv->evpctx, 0);
VCL_BOOL r; VCL_BOOL r;
if (evpctx == NULL) if (evpctx == NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment