forked from wolfSSL/wolfssl
check return value of hash digest size
This commit is contained in:
@ -6120,7 +6120,7 @@ static int sakke_hash_to_range(SakkeKey* key, enum wc_HashType hashType,
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
byte h[WC_MAX_DIGEST_SIZE];
|
byte h[WC_MAX_DIGEST_SIZE];
|
||||||
byte v[WC_MAX_DIGEST_SIZE];
|
byte v[WC_MAX_DIGEST_SIZE];
|
||||||
word32 hashSz = wc_HashGetDigestSize(hashType);
|
word32 hashSz;
|
||||||
word32 i;
|
word32 i;
|
||||||
|
|
||||||
/* Step 1: A = hashfn( s ), where s = data | extra
|
/* Step 1: A = hashfn( s ), where s = data | extra
|
||||||
@ -6128,7 +6128,12 @@ static int sakke_hash_to_range(SakkeKey* key, enum wc_HashType hashType,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Step 2: h_0 = 00...00, a string of null bits of length hashlen bits */
|
/* Step 2: h_0 = 00...00, a string of null bits of length hashlen bits */
|
||||||
XMEMSET(h, 0, hashSz);
|
err = wc_HashGetDigestSize(hashType);
|
||||||
|
if (err > 0) {
|
||||||
|
hashSz = (word32)err;
|
||||||
|
XMEMSET(h, 0, hashSz);
|
||||||
|
err = 0; /* reset err value after getting digest size */
|
||||||
|
}
|
||||||
|
|
||||||
/* Step 3: l = Ceiling(lg(n)/hashlen) */
|
/* Step 3: l = Ceiling(lg(n)/hashlen) */
|
||||||
/* Step 4: For each i in 1 to l, do */
|
/* Step 4: For each i in 1 to l, do */
|
||||||
|
Reference in New Issue
Block a user