Leverage sodium_add()

This commit is contained in:
Frank Denis 2018-12-24 15:25:34 +01:00
parent 902f0997c0
commit 8dd554d2c4

View File

@ -1053,15 +1053,8 @@ static void add_l(unsigned char * const S)
0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10 }; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10 };
unsigned char c = 0U;
unsigned int i;
unsigned int s;
for (i = 0U; i < 32U; i++) { sodium_add(S, l, sizeof l);
s = S[i] + l[i] + c;
S[i] = (unsigned char) s;
c = (s >> 8) & 1;
}
} }
int main(void) int main(void)