48#define COLUMN_COUNT 50
51static const uint8_t toeplitz[COLUMN_COUNT + ROW_COUNT - 1] =
52 { 93 , 50 , 210 , 134 , 79 , 52 , 237 , 192 , 40 , 201 ,
53 3 , 184 , 152 , 74 , 27 , 28 , 32 , 111 , 79 , 222 ,
54 174 , 51 , 223 , 66 , 152 , 211 , 234 , 124 , 92 , 64 ,
55 206 , 169 , 227 , 155 , 106 , 87 , 207 , 135 , 238 , 101 ,
56 254 , 163 , 55 , 76 , 50 , 40 , 4 , 149 , 27 , 1 ,
57 127 , 159 , 160 , 91 , 251 , 179 , 186 , 200 , 225 , 47 ,
58 235 , 223 , 39 , 117 , 19 };
62get_toeplitz_element(uint8_t row, uint8_t column)
66 min = row < column ? row : column;
70 return toeplitz[row ? COLUMN_COUNT - 1 + row : column];
81 for(i = 0; i < 8; i++) {
104 for(row = 0; row < ROW_COUNT; row++) {
106 for(column = 0; column < COLUMN_COUNT; column++) {
107 target[row] ^=
mul_gf_256(get_toeplitz_element(row, column), source[column]);
113seed_16_bytes(uint8_t *result)
118 uint8_t accumulator[COLUMN_COUNT];
123 memset(accumulator, 0, COLUMN_COUNT);
126 for(iq_count = 0; iq_count < (COLUMN_COUNT * 8 / 2); iq_count++) {
130 accumulator[byte_pos] |= iq << bit_pos;
137 NETSTACK_RADIO.off();
146 seed_16_bytes(seed.
key);
147 seed_16_bytes(seed.
state);
void iq_seeder_seed(void)
This function will feed the CSPRNG with a new seed.
static uint8_t mul_gf_256(uint8_t a, uint8_t b)
Performs a multiplication within GF(256)
void csprng_feed(struct csprng_seed *new_seed)
Mixes a new seed with the current one.
static void extract(uint8_t *target, uint8_t *source)
Toeplitz matrix-based extractor.
int radio_value_t
Each radio has a set of parameters that designate the current configuration and state of the radio.
@ RADIO_PARAM_IQ_LSBS
The current I/Q LSBs.
Include file for the Contiki low-layer network stack (NETSTACK)
This is the structure of a seed.
uint8_t state[CSPRNG_STATE_LEN]
internal state of the CSPRNG
uint8_t key[CSPRNG_KEY_LEN]
AES-128 key of the CSPRNG.