From: Lukasz Pawelczyk Date: Tue, 12 Apr 2016 11:33:19 +0000 (+0200) Subject: Get rid of EVP_MD from digest struct, it's redudant. X-Git-Tag: accepted/tizen/common/20160810.161523~225 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0af4e6ef1b64389a57475fee28f0d1e39d9e805a;p=platform%2Fcore%2Fsecurity%2Fyaca.git Get rid of EVP_MD from digest struct, it's redudant. Change-Id: I52d84125d4b0f2ab1face439477efcc82ee0a0fe --- diff --git a/src/digest.c b/src/digest.c index 4cc0ceb..bd3f62f 100644 --- a/src/digest.c +++ b/src/digest.c @@ -32,7 +32,6 @@ struct yaca_digest_ctx_s { struct yaca_ctx_s ctx; - const EVP_MD *md; EVP_MD_CTX *mdctx; }; @@ -57,7 +56,7 @@ static int get_digest_output_length(const yaca_ctx_h ctx, size_t input_len) if (c == NULL) return YACA_ERROR_INVALID_ARGUMENT; - return EVP_MD_size(c->md); + return EVP_MD_CTX_size(c->mdctx); } static void destroy_digest_context(yaca_ctx_h ctx) @@ -117,6 +116,7 @@ API int yaca_digest_init(yaca_ctx_h *ctx, yaca_digest_algo_e algo) { int ret; struct yaca_digest_ctx_s *nc = NULL; + const EVP_MD *md; if (ctx == NULL) return YACA_ERROR_INVALID_ARGUMENT; @@ -129,7 +129,7 @@ API int yaca_digest_init(yaca_ctx_h *ctx, yaca_digest_algo_e algo) nc->ctx.ctx_destroy = destroy_digest_context; nc->ctx.get_output_length = get_digest_output_length; - ret = digest_get_algorithm(algo, &nc->md); + ret = digest_get_algorithm(algo, &md); if (ret < 0) goto free; @@ -139,7 +139,7 @@ API int yaca_digest_init(yaca_ctx_h *ctx, yaca_digest_algo_e algo) goto free; } - ret = EVP_DigestInit(nc->mdctx, nc->md); + ret = EVP_DigestInit(nc->mdctx, md); if (ret != 1) { ret = YACA_ERROR_OPENSSL_FAILURE; goto ctx;