Files
mbedtls/library
Gilles Peskine ead1766b5f Fix PBKDF2 with empty salt segment on platforms where malloc(0)=NULL
"Fix PBKDF2 with empty salt on platforms where malloc(0)=NULL" took care of
making an empty salt work. But it didn't fix the case of an empty salt
segment followed by a non-empty salt segment, which still invoked memcpy
with a potentially null pointer as the source. This commit fixes that case,
and also simplifies the logic in the function a little.

Test data obtained with:
```
pip3 install cryptodome
python3 -c 'import sys; from Crypto.Hash import SHA256; from Crypto.Protocol.KDF import PBKDF2; cost = int(sys.argv[1], 0); salt = bytes.fromhex(sys.argv[2]); password = bytes.fromhex(sys.argv[3]); n = int(sys.argv[4], 0); print(PBKDF2(password=password, salt=salt, dkLen=n, count=cost, hmac_hash_module=SHA256).hex())' 1 "" "706173737764" 64
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-20 22:05:16 +02:00
..
2023-07-13 17:32:11 +08:00
2023-06-16 20:18:36 +01:00
2023-07-11 14:06:37 +01:00
2023-06-24 13:37:28 +01:00
2023-08-14 15:26:28 +01:00
2023-06-24 13:37:28 +01:00
2023-04-12 06:07:23 +00:00
2023-06-06 10:33:54 +02:00
2023-08-02 10:32:21 +01:00
2023-03-24 10:43:40 +01:00
2023-07-13 15:57:20 +01:00
2023-06-24 13:37:28 +01:00
2023-07-06 12:42:33 +02:00
2023-07-06 12:42:33 +02:00
2023-07-06 12:42:33 +02:00
2023-03-13 12:15:49 +00:00
2023-07-06 12:42:33 +02:00
2023-08-10 06:43:23 +02:00
2023-02-02 12:40:50 +00:00
2023-08-10 12:11:31 +01:00
2023-06-07 19:59:05 +01:00
2023-07-13 10:40:29 +08:00
2023-07-13 10:40:29 +08:00
2023-08-10 14:01:51 +01:00