diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-12 15:33:15 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-12 17:36:12 +0100 |
| commit | f24a5cdcf0eec552f2d2edc73a7df156784ed7c0 (patch) | |
| tree | 4a4959fd2824f3f02a3debe90c804d2a7e76028a /src/add_threshold/tweakey.c | |
| parent | f1bf4826bb5307a2677d44af6f8079b6cf0b3224 (diff) | |
| download | lilliput-ae-implem-f24a5cdcf0eec552f2d2edc73a7df156784ed7c0.tar.xz | |
Utilisation d'un générateur d'aléa pour l'implémentation à seuil
Un peu de machinerie à mettre en place pour permettre l'ajout de
fichiers arbitraires dans une implémentation.
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]; } } |
