X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_grasshopper_cipher.c;fp=gost_grasshopper_cipher.c;h=363c4aeeac094030e5bbcd3eb897e813bcd24be4;hb=03ff63b67e5b4f3e57f9c462bc073e66dcf20851;hp=6adc3802a34ee688b6c88510620471f4bb06062d;hpb=769661c35d148361ddd45ce8e16ae5996edbacce;p=openssl-gost%2Fengine.git diff --git a/gost_grasshopper_cipher.c b/gost_grasshopper_cipher.c index 6adc380..363c4ae 100644 --- a/gost_grasshopper_cipher.c +++ b/gost_grasshopper_cipher.c @@ -96,7 +96,7 @@ static struct GRASSHOPPER_CIPHER_PARAMS gost_cipher_params[5] = { gost_grasshopper_cipher_do_ctr, gost_grasshopper_cipher_destroy_ctr, 1, - sizeof(gost_grasshopper_cipher_ctx), + sizeof(gost_grasshopper_cipher_ctx_ctr), 8, false }, @@ -295,13 +295,15 @@ static int gost_grasshopper_cipher_do_ctr(EVP_CIPHER_CTX* ctx, unsigned char* ou memcpy(&c->iv_buffer, iv, 8); // full parts - for (size_t i = 0; i < blocks; i++, current_in += GRASSHOPPER_BLOCK_SIZE, current_out += GRASSHOPPER_BLOCK_SIZE) { + for (size_t i = 0; i < blocks; i++) { currentInputBlock = (grasshopper_w128_t*) current_in; currentOutputBlock = (grasshopper_w128_t*) current_out; memcpy(c->iv_buffer.b + 8, &c->counter, 8); grasshopper_encrypt_block(&c->c.encrypt_round_keys, &c->iv_buffer, currentOutputBlock, &c->c.buffer); grasshopper_append128(currentOutputBlock, currentInputBlock); c->counter += 1; + current_in += GRASSHOPPER_BLOCK_SIZE; + current_out += GRASSHOPPER_BLOCK_SIZE; } // last part