ctr_add: replace dead with working code.
[tfcrypt.git] / tfctrapi.c
1 #include <string.h>
2 #include "tfdef.h"
3
4 void tf_ctr_set(void *ctr, const void *sctr, size_t sctrsz)
5 {
6         TF_UNIT_TYPE usctr[TF_NR_BLOCK_UNITS];
7         TF_UNIT_TYPE *uctr = ctr;
8
9         memset(usctr, 0, TF_BLOCK_SIZE);
10         memcpy(usctr, sctr, sctrsz > TF_BLOCK_SIZE ? TF_BLOCK_SIZE : sctrsz);
11         ctr_add(uctr, TF_NR_BLOCK_UNITS, usctr, TF_NR_BLOCK_UNITS);
12         data_to_words(uctr, TF_BLOCK_SIZE);
13         memset(usctr, 0, TF_BLOCK_SIZE);
14 }