From: Dmitry Belyavskiy Date: Sun, 10 May 2020 14:15:45 +0000 (+0300) Subject: Merge branch 'master' of https://github.com/gost-engine/engine X-Git-Tag: v3.0.0~122 X-Git-Url: http://www.wagner.pp.ru/gitweb/?a=commitdiff_plain;h=ea599c11e431540582ccc6ca785ea6579fa248fc;hp=-c;p=openssl-gost%2Fengine.git Merge branch 'master' of https://github.com/gost-engine/engine --- ea599c11e431540582ccc6ca785ea6579fa248fc diff --combined gost_crypt.c index 6d265a6,33dc668..2bede85 --- a/gost_crypt.c +++ b/gost_crypt.c @@@ -774,10 -774,11 +774,11 @@@ int magma_cipher_do_cbc(EVP_CIPHER_CTX d[7 - i] = in_ptr[i]; } gostdecrypt(&(c->cctx), d, b); + memcpy(d, in_ptr, 8); for (i = 0; i < 8; i++) { out_ptr[i] = iv[i] ^ b[7 - i]; } - memcpy(iv, in_ptr, 8); + memcpy(iv, d, 8); out_ptr += 8; in_ptr += 8; inl -= 8; @@@ -866,9 -867,6 +867,9 @@@ static int magma_cipher_do_ctr_acpkm_om if (in == NULL && inl == 0) /* Final call */ return gost2015_final_call(ctx, c->omac_ctx, MAGMA_MAC_MAX_SIZE, c->tag, magma_cipher_do_ctr); + if (in == NULL) + return -1; + /* As in and out can be the same pointer, process unencrypted here */ if (EVP_CIPHER_CTX_encrypting(ctx)) EVP_DigestSignUpdate(c->omac_ctx, in, inl);