Skip to content

Commit d027b30

Browse files
authored
Merge pull request #7257 from philljj/zd17540
Fix unchecked ge448_scalarmult_base return value.
2 parents 88e7d47 + 5aa06c2 commit d027b30

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

wolfcrypt/src/ed448.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,15 @@ int wc_ed448_sign_msg_ex(const byte* in, word32 inLen, byte* out,
368368

369369
/* step 2: computing R = rB where rB is the scalar multiplication of
370370
r and B */
371-
ge448_scalarmult_base(&R,nonce);
372-
ge448_to_bytes(out,&R);
371+
ret = ge448_scalarmult_base(&R,nonce);
373372

374373
/* step 3: hash R + public key + message getting H(R,A,M) then
375374
creating S = (r + H(R,A,M)a) mod l */
375+
if (ret == 0) {
376+
ge448_to_bytes(out,&R);
376377

377-
ret = ed448_hash_update(key, sha, ed448Ctx, ED448CTX_SIZE);
378+
ret = ed448_hash_update(key, sha, ed448Ctx, ED448CTX_SIZE);
379+
}
378380
if (ret == 0) {
379381
ret = ed448_hash_update(key, sha, &type, sizeof(type));
380382
}

0 commit comments

Comments
 (0)