From: Mark Fedorov Date: Sat, 9 Jul 2022 16:00:26 +0000 (+0000) Subject: Refactored acpkm_magma_key_meshing X-Git-Tag: v3.0.2~10 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=624bf7d20c0d1258391bda222d16f099241ad1c1;p=openssl-gost%2Fengine.git Refactored acpkm_magma_key_meshing --- diff --git a/gost89.c b/gost89.c index 240bc7a..c103e72 100644 --- a/gost89.c +++ b/gost89.c @@ -768,20 +768,11 @@ void cryptopro_key_meshing(gost_ctx * ctx, unsigned char *iv) void acpkm_magma_key_meshing(gost_ctx * ctx) { unsigned char newkey[32]; - int i, j; - + int i; for (i = 0; i < 4; i++) { - unsigned char buf[8], keybuf[8]; - for (j = 0; j < 8; j++) { - buf[j] = ACPKM_D_const[8 * i + 7 - j]; - } - gostcrypt(ctx, buf, keybuf); - memcpy(newkey + 8 * i, keybuf + 4, 4); - memcpy(newkey + 8 * i + 4, keybuf, 4); - OPENSSL_cleanse(keybuf, sizeof(keybuf)); - OPENSSL_cleanse(buf, sizeof(buf)); + magmacrypt(ctx, ACPKM_D_const + 8 * i, newkey + 8 * i); } /* set new key */ - gost_key(ctx, newkey); + magma_key(ctx, newkey); OPENSSL_cleanse(newkey, sizeof(newkey)); }