mirror of https://github.com/wolfSSL/wolfssl.git
Merge pull request #3072 from kaleb-himes/SANITY_CHECKS
ed25519 and ed448 check sigLen against expectedpull/3084/head
commit
f6d26b4e81
16
tests/api.c
16
tests/api.c
|
@ -14798,6 +14798,13 @@ static int test_wc_ed25519_sign_msg (void)
|
|||
|
||||
/* Test bad args. */
|
||||
if (ret == 0) {
|
||||
AssertIntEQ(wc_ed25519_verify_msg(sig, siglen - 1, msg,
|
||||
msglen, &verify_ok, &key),
|
||||
BAD_FUNC_ARG);
|
||||
AssertIntEQ(wc_ed25519_verify_msg(sig, siglen + 1, msg,
|
||||
msglen, &verify_ok, &key),
|
||||
BAD_FUNC_ARG);
|
||||
|
||||
ret = wc_ed25519_verify_msg(NULL, siglen, msg, msglen, &verify_ok,
|
||||
&key);
|
||||
if (ret == BAD_FUNC_ARG) {
|
||||
|
@ -15547,6 +15554,15 @@ static int test_wc_ed448_sign_msg (void)
|
|||
|
||||
/* Test bad args. */
|
||||
if (ret == 0) {
|
||||
AssertIntEQ(wc_ed448_verify_msg(sig, siglen - 1, msg,
|
||||
msglen, &verify_ok, &key,
|
||||
NULL, 0),
|
||||
BAD_FUNC_ARG);
|
||||
AssertIntEQ(wc_ed448_verify_msg(sig, siglen + 1, msg,
|
||||
msglen, &verify_ok, &key,
|
||||
NULL, 0),
|
||||
BAD_FUNC_ARG);
|
||||
|
||||
ret = wc_ed448_verify_msg(NULL, siglen, msg, msglen, &verify_ok,
|
||||
&key, NULL, 0);
|
||||
if (ret == BAD_FUNC_ARG) {
|
||||
|
|
|
@ -365,7 +365,7 @@ static int ed25519_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
|||
*res = 0;
|
||||
|
||||
/* check on basics needed to verify signature */
|
||||
if (sigLen < ED25519_SIG_SIZE || (sig[ED25519_SIG_SIZE-1] & 224))
|
||||
if (sigLen != ED25519_SIG_SIZE || (sig[ED25519_SIG_SIZE-1] & 224))
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
/* uncompress A (public key), test if valid, and negate it */
|
||||
|
|
|
@ -379,7 +379,7 @@ static int ed448_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
|||
*res = 0;
|
||||
|
||||
/* check on basics needed to verify signature */
|
||||
if (sigLen < ED448_SIG_SIZE) {
|
||||
if (sigLen != ED448_SIG_SIZE) {
|
||||
ret = BAD_FUNC_ARG;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue