ltc_pkcs_1_pss_decode_mgf1 allocates a separate buffer for salt:
unsigned char *DB, *mask, *salt, *hash;
[...]
salt = XMALLOC(modulus_len);
However, the salt buffer is never written to or read from. The salt is already available directly within DB and is passed to the hash function using:
hash_descriptor[op_checked.hash_alg].process(&md, DB+x, saltlen)
At this point, DB + x points to the beginning of the salt portion of DB.
Suggested Fix:
Remove the unused salt buffer and all associated allocation, cleanup, and deallocation code.
The PSS verification logic itself does not need to change, as the salt can continue to be processed directly from DB + x.
ltc_pkcs_1_pss_decode_mgf1allocates a separate buffer for salt:However, the salt buffer is never written to or read from. The salt is already available directly within
DBand is passed to the hash function using:hash_descriptor[op_checked.hash_alg].process(&md, DB+x, saltlen)At this point,
DB + xpoints to the beginning of the salt portion ofDB.Suggested Fix:
Remove the unused
saltbuffer and all associated allocation, cleanup, and deallocation code.The PSS verification logic itself does not need to change, as the salt can continue to be processed directly from
DB + x.