Correct XSalsa20 initialization when using 8/12 rounds

This commit is contained in:
Brandon Hamilton 2016-10-09 22:26:37 +02:00
parent ba39567eb6
commit bfaf1d324d

View File

@ -57,7 +57,7 @@ void cryptonite_xsalsa_init(cryptonite_salsa_context *ctx, uint8_t nb_rounds,
/* Compute (z0, z1, . . . , z15) = doubleround ^(r/2) (x0, x1, . . . , x15) */
block hSalsa;
memset(&hSalsa, 0, sizeof(block));
cryptonite_salsa_core_xor(20, &hSalsa, &ctx->st);
cryptonite_salsa_core_xor(nb_rounds, &hSalsa, &ctx->st);
/* Build a new 512-bit input block (x0, x1, . . . , x15):
(x0, x5, x10, x15) is the Salsa20 constant