tfctrapi: do not post convert, do preconversion of both arguments instead, then add.
tfe: remove endianness converters, caller must do conversion.
if (!tweakf) skein(key+TF_FROM_BITS(TF_MAX_BITS)+TF_SIZE_UNIT, 2*TF_UNIT_BITS, NULL, key, TF_FROM_BITS(TFC_KEY_BITS));
tf_key_tweak_compat(key);
}
- if (ctr_mode == TFC_MODE_STREAM) tfe_init_iv(&tfe, key, ctr);
if (ctr_mode == TFC_MODE_ECB) goto _ctrskip2;
tfc_data_to_words64(&iseek_blocks, sizeof(iseek_blocks));
tf_ctr_set(ctr, &iseek_blocks, sizeof(iseek_blocks));
+ if (ctr_mode == TFC_MODE_STREAM) tfe_init_iv(&tfe, key, ctr);
+
switch (counter_opt) {
case TFC_CTR_SHOW:
switch (do_outfmt) {
TF_UNIT_TYPE usctr[TF_NR_BLOCK_UNITS];
TF_UNIT_TYPE *uctr = ctr;
+ data_to_words(uctr, TF_BLOCK_SIZE);
+
memset(usctr, 0, TF_BLOCK_SIZE);
memcpy(usctr, sctr, sctrsz > TF_BLOCK_SIZE ? TF_BLOCK_SIZE : sctrsz);
+ data_to_words(usctr, TF_BLOCK_SIZE);
+
ctr_add(uctr, TF_NR_BLOCK_UNITS, usctr, TF_NR_BLOCK_UNITS);
- data_to_words(uctr, TF_BLOCK_SIZE);
memset(usctr, 0, TF_BLOCK_SIZE);
}
{
memset(tfe, 0, sizeof(struct tfe_stream));
memcpy(tfe->key, key, TF_KEY_SIZE);
- data_to_words(tfe->key, TF_KEY_SIZE);
- if (iv) {
- memcpy(tfe->iv, iv, TF_BLOCK_SIZE);
- data_to_words(tfe->iv, TF_BLOCK_SIZE);
- }
+ if (iv) memcpy(tfe->iv, iv, TF_BLOCK_SIZE);
tfe->carry_bytes = 0;
}