gost_grasshopper_cipher_do_ctr,
gost_grasshopper_cipher_destroy_ctr,
1,
- sizeof(gost_grasshopper_cipher_ctx),
+ sizeof(gost_grasshopper_cipher_ctx_ctr),
8,
false
},
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