This commit is contained in:
John M. Schanck 2020-09-17 11:54:58 -04:00
parent 1caa0cfeff
commit a7e44f79ac
29 changed files with 93 additions and 57 deletions

View File

@ -2656,7 +2656,9 @@ make_fg(uint32_t *data, const int8_t *f, const int8_t *g,
return; return;
} }
if (depth == 0) return; if (depth == 0) {
return;
}
if (depth == 1) { if (depth == 1) {
make_fg_step(data, logn, 0, 0, out_ntt); make_fg_step(data, logn, 0, 0, out_ntt);
return; return;
@ -3043,7 +3045,9 @@ solve_NTRU_intermediate(unsigned logn_top,
* middle or the upper half of these top 10 words. * middle or the upper half of these top 10 words.
*/ */
rlen = slen; rlen = slen;
if (rlen > 10) rlen = 10; if (rlen > 10) {
rlen = 10;
}
poly_big_to_fp(rt3, ft + slen - rlen, rlen, slen, logn); poly_big_to_fp(rt3, ft + slen - rlen, rlen, slen, logn);
poly_big_to_fp(rt4, gt + slen - rlen, rlen, slen, logn); poly_big_to_fp(rt4, gt + slen - rlen, rlen, slen, logn);
@ -3118,7 +3122,9 @@ solve_NTRU_intermediate(unsigned logn_top,
* scaling if the current length is more than 10 words. * scaling if the current length is more than 10 words.
*/ */
rlen = FGlen; rlen = FGlen;
if (rlen > 10) rlen = 10; if (rlen > 10) {
rlen = 10;
}
scale_FG = 31 * (int)(FGlen - rlen); scale_FG = 31 * (int)(FGlen - rlen);
poly_big_to_fp(rt1, Ft + FGlen - rlen, rlen, llen, logn); poly_big_to_fp(rt1, Ft + FGlen - rlen, rlen, llen, logn);
poly_big_to_fp(rt2, Gt + FGlen - rlen, rlen, llen, logn); poly_big_to_fp(rt2, Gt + FGlen - rlen, rlen, llen, logn);

View File

@ -2656,7 +2656,9 @@ make_fg(uint32_t *data, const int8_t *f, const int8_t *g,
return; return;
} }
if (depth == 0) return; if (depth == 0) {
return;
}
if (depth == 1) { if (depth == 1) {
make_fg_step(data, logn, 0, 0, out_ntt); make_fg_step(data, logn, 0, 0, out_ntt);
return; return;
@ -3043,7 +3045,9 @@ solve_NTRU_intermediate(unsigned logn_top,
* middle or the upper half of these top 10 words. * middle or the upper half of these top 10 words.
*/ */
rlen = slen; rlen = slen;
if (rlen > 10) rlen = 10; if (rlen > 10) {
rlen = 10;
}
poly_big_to_fp(rt3, ft + slen - rlen, rlen, slen, logn); poly_big_to_fp(rt3, ft + slen - rlen, rlen, slen, logn);
poly_big_to_fp(rt4, gt + slen - rlen, rlen, slen, logn); poly_big_to_fp(rt4, gt + slen - rlen, rlen, slen, logn);
@ -3118,7 +3122,9 @@ solve_NTRU_intermediate(unsigned logn_top,
* scaling if the current length is more than 10 words. * scaling if the current length is more than 10 words.
*/ */
rlen = FGlen; rlen = FGlen;
if (rlen > 10) rlen = 10; if (rlen > 10) {
rlen = 10;
}
scale_FG = 31 * (int)(FGlen - rlen); scale_FG = 31 * (int)(FGlen - rlen);
poly_big_to_fp(rt1, Ft + FGlen - rlen, rlen, llen, logn); poly_big_to_fp(rt1, Ft + FGlen - rlen, rlen, llen, logn);
poly_big_to_fp(rt2, Gt + FGlen - rlen, rlen, llen, logn); poly_big_to_fp(rt2, Gt + FGlen - rlen, rlen, llen, logn);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256128FROBUST_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256128SROBUST_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256128SSIMPLE_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256192FROBUST_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256192FSIMPLE_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256192SROBUST_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256192SSIMPLE_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256256FROBUST_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256256FSIMPLE_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256256SROBUST_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);

View File

@ -67,7 +67,9 @@ void PQCLEAN_SPHINCSSHA256256SSIMPLE_AVX2_sha256_update8x(sha256ctxx8 *ctx,
while (i < len) { while (i < len) {
bytes_to_copy = len - i; bytes_to_copy = len - i;
if (bytes_to_copy > 64) bytes_to_copy = 64; if (bytes_to_copy > 64) {
bytes_to_copy = 64;
}
memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 0], d0 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 1], d1 + i, bytes_to_copy);
memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy); memcpy(&ctx->msgblocks[64 * 2], d2 + i, bytes_to_copy);