Even thought the underlying calls might return something other than 0
or 1, EVP_CIPHER_CTX_ctrl() and EVP_MD_CTX_ctrl() were made to only
return those values regardless. That behaviour was recently lost, so
we need to restore it.
Fixes #10106
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10108)
ret = EVP_MD_CTX_set_params(ctx, params);
else
ret = EVP_MD_CTX_get_params(ctx, params);
- return ret;
+ goto conclude;
/* TODO(3.0): Remove legacy code below */
}
ret = ctx->digest->md_ctrl(ctx, cmd, p1, p2);
+ conclude:
if (ret <= 0)
return 0;
return ret;
ret = evp_do_ciph_ctx_setparams(ctx->cipher, ctx->provctx, params);
else
ret = evp_do_ciph_ctx_getparams(ctx->cipher, ctx->provctx, params);
- return ret;
+ goto conclude;
/* TODO(3.0): Remove legacy code below */
legacy:
}
ret = ctx->cipher->ctrl(ctx, type, arg, ptr);
+
+ conclude:
if (ret == EVP_CTRL_RET_UNSUPPORTED) {
EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL,
EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED);