mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 11:17:29 +02:00
Merge pull request #7803 from SparkiDev/dilithium_hint_check_fix
Dilithium: fix check hint
This commit is contained in:
@ -32389,6 +32389,12 @@ static int test_wc_dilithium_verify(void)
|
|||||||
0);
|
0);
|
||||||
ExpectIntEQ(res, 0);
|
ExpectIntEQ(res, 0);
|
||||||
sig[100] ^= 0x80;
|
sig[100] ^= 0x80;
|
||||||
|
|
||||||
|
/* Set all indeces to 0. */
|
||||||
|
XMEMSET(sig + sigLen - 4, 0, 4);
|
||||||
|
ExpectIntEQ(wc_dilithium_verify_msg(sig, sigLen, msg, 32, &res, key),
|
||||||
|
SIG_VERIFY_E);
|
||||||
|
ExpectIntEQ(res, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3183,11 +3183,11 @@ static int dilithium_check_hint(const byte* h, byte k, byte omega)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
/* Skip polynomial index while count is 0. */
|
/* Skip polynomial index while count is 0. */
|
||||||
while ((h[omega + o] == 0) && (o < k)) {
|
while ((o < k) && (h[omega + o] == 0)) {
|
||||||
o++;
|
o++;
|
||||||
}
|
}
|
||||||
/* Check all possible hints. */
|
/* Check all possible hints. */
|
||||||
for (i = 1; i < omega; i++) {
|
for (i = 1; (o < k) && (i < omega); i++) {
|
||||||
/* Done with polynomial if index equals count of hints. */
|
/* Done with polynomial if index equals count of hints. */
|
||||||
if (i == h[omega + o]) {
|
if (i == h[omega + o]) {
|
||||||
/* Next polynomial index while count is index. */
|
/* Next polynomial index while count is index. */
|
||||||
|
Reference in New Issue
Block a user