Skip to content

Commit 12cbc9f

Browse files
committed
WIP
1 parent f95e548 commit 12cbc9f

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/pk/pkcs1/pkcs_1_mgf1.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ int ltc_pkcs_1_mgf1(int hash_idx,
4040
}
4141

4242
#ifdef LTC_SHA3
43-
if (XSTRCMP(hash_descriptor[hash_idx].name, "shake128") == 0) {
44-
return sha3_shake_memory(128, seed, seedlen, mask, &masklen);
45-
}
46-
if (XSTRCMP(hash_descriptor[hash_idx].name, "shake256") == 0) {
47-
return sha3_shake_memory(256, seed, seedlen, mask, &masklen);
43+
if (hash_descriptor[hash_idx].ID == shake128_desc.ID
44+
|| hash_descriptor[hash_idx].ID == shake256_desc.ID) {
45+
/* The output hashsize is double the announced SHAKE bitsize
46+
* and given in octets, so only multiply by 4 to arrive at 128 resp. 256. */
47+
return sha3_shake_memory(hash_descriptor[hash_idx].hashsize * 4, seed, seedlen, mask, &masklen);
4848
}
4949
#endif
5050

0 commit comments

Comments
 (0)