diff options
Diffstat (limited to 'src/add_threshold/tweakey.c')
| -rw-r--r-- | src/add_threshold/tweakey.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/add_threshold/tweakey.c b/src/add_threshold/tweakey.c index f80ea86..097a79a 100644 --- a/src/add_threshold/tweakey.c +++ b/src/add_threshold/tweakey.c @@ -24,6 +24,7 @@ tweakey schedule, where the tweak and the key are split into two shares. #include <string.h> #include "constants.h" +#include "random.h" #include "tweakey.h" @@ -39,16 +40,14 @@ void tweakey_state_init( const uint8_t tweak[TWEAK_BYTES] ) { - // To be replaced by real random numbers!!! - uint8_t SHARES_0[KEY_BYTES] = { - 0x0f, 0x1e, 0x2d, 0x3c, 0x4b, 0x5a, 0x69, 0x78, 0x87, 0x96, 0xa5, 0xb4, 0xc3, 0xd2, 0xe1, 0xf0 - }; + uint8_t SHARES_0[KEY_BYTES]; + randombytes(sizeof(SHARES_0), SHARES_0); - memcpy(TK_Y, SHARES_0, KEY_BYTES); - memcpy(TK_X, tweak, TWEAK_BYTES); + memcpy(TK_Y, SHARES_0, KEY_BYTES); + memcpy(TK_X, tweak, TWEAK_BYTES); for (size_t i=0; i<KEY_BYTES; i++){ - TK_X[i+TWEAK_BYTES] = key[i] ^ SHARES_0[i] ; + TK_X[i+TWEAK_BYTES] = key[i] ^ SHARES_0[i]; } } |
