From: Dmitry Belyavskiy Date: Fri, 31 Aug 2018 10:02:52 +0000 (+0300) Subject: Some fixes of OMAC processing X-Git-Tag: v3.0.0~371 X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=openssl-gost%2Fengine.git;a=commitdiff_plain;h=6476d4d4966f6efcfd84c5d1c9c4e90d83aa9f14 Some fixes of OMAC processing --- diff --git a/gost_omac.c b/gost_omac.c index 49113a5..daf5750 100644 --- a/gost_omac.c +++ b/gost_omac.c @@ -72,8 +72,7 @@ int omac_imit_final(EVP_MD_CTX *ctx, unsigned char *md) CMAC_Final(c->cmac_ctx, mac, &mac_size); - int md_size = EVP_MD_meth_get_result_size(EVP_MD_CTX_md(ctx)); - memcpy(md, mac, min(md_size, c->dgst_size)); + memcpy(md, mac, c->dgst_size); return 1; } diff --git a/gost_omac_acpkm.c b/gost_omac_acpkm.c index 9bdb05f..3061e36 100644 --- a/gost_omac_acpkm.c +++ b/gost_omac_acpkm.c @@ -475,6 +475,13 @@ int omac_acpkm_imit_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr) } c->dgst_size = arg; break; + case NID_magma_cbc: + if (arg < 1 || arg > 8) { + GOSTerr(GOST_F_OMAC_ACPKM_IMIT_CTRL, GOST_R_INVALID_MAC_SIZE); + return 0; + } + c->dgst_size = arg; + break; default: return 0; }