X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tfctrapi.c;h=67ec44b714f37efcc78686f7f3857f41afa45c1d;hb=HEAD;hp=2845b2dba0b820a7a87222810111a6944180d9ba;hpb=0f0e095f408d4d867a056dffc9d20d853d761489;p=tfcrypt.git diff --git a/tfctrapi.c b/tfctrapi.c index 2845b2d..67ec44b 100644 --- a/tfctrapi.c +++ b/tfctrapi.c @@ -6,9 +6,12 @@ void tf_ctr_set(void *ctr, const void *sctr, size_t sctrsz) 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); }