Kusumit Ghoderao
5cad47df8a
Modify test description
The test data was generated using the python script.
PBKDF2_AES_CMAC_PRF_128 test vectors are generated using PyCryptodome library:
https://github.com/Legrandin/pycryptodome
Steps to generate test vectors:
1. pip install pycryptodome
2. Use the python script below to generate Derived key (see description for details):
Example usage:
pbkdf2_cmac.py <password> <salt> <number_of_iterations> <derived_key_len>
derive_output.py 4a30314e4d45 54687265616437333563383762344f70656e54687265616444656d6f 16384 16
password : 4a30314e4d45
salt : 54687265616437333563383762344f70656e54687265616444656d6f
input cost : 16384
derived key len : 16
output : 8b27beed7e7a4dd6c53138c879a8e33c
"""
from Crypto.Protocol.KDF import PBKDF2
from Crypto.Hash import CMAC
from Crypto.Cipher import AES
import sys
def main():
#check args
if len(sys.argv) != 5:
print("Invalid number of arguments. Expected: <password> <salt> <input_cost> <derived_key_len>")
return
password = bytes.fromhex(sys.argv[1])
salt = bytes.fromhex(sys.argv[2])
iterations = int(sys.argv[3])
dklen = int(sys.argv[4])
# If password is not 16 bytes then we need to use CMAC to derive the password
if len(password) != 16:
zeros = bytes.fromhex("00000000000000000000000000000000")
cobj_pass = CMAC.new(zeros, msg=password, ciphermod=AES, mac_len=16)
passwd = bytes.fromhex(cobj_pass.hexdigest())
else:
passwd = password
cmac_prf = lambda p,s: CMAC.new(p, s, ciphermod=AES, mac_len=16).digest()
actual_output = PBKDF2(passwd, salt=salt, dkLen=dklen, count=iterations, prf=cmac_prf)
print('password : ' + password.hex())
print('salt : ' + salt.hex())
print('input cost : ' + str(iterations))
print('derived key len : ' + str(dklen))
print('output : ' + actual_output.hex())
if __name__ == "__main__":
main()
"""
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-08-18 12:49:07 +05:30
..
2023-04-26 19:40:02 +02:00
2023-04-26 19:40:02 +02:00
2023-04-26 19:40:02 +02:00
2023-05-05 11:21:30 +08:00
2023-05-05 11:21:30 +08:00
2023-05-05 11:21:30 +08:00
2023-07-21 11:45:25 +01:00
2023-05-05 11:21:30 +08:00
2023-05-05 11:21:30 +08:00
2023-05-05 11:21:30 +08:00
2022-12-01 13:31:20 +00:00
2023-08-10 15:01:34 +00:00
2023-07-27 14:17:27 +01:00
2022-11-07 15:42:44 -05:00
2023-07-21 11:32:25 +01:00
2022-06-15 21:16:42 +02:00
2023-08-10 15:01:34 +00:00
2023-05-26 12:42:48 +01:00
2023-07-31 17:22:55 +01:00
2023-08-07 11:47:35 +01:00
2023-04-25 18:07:29 +01:00
2023-04-05 16:13:11 +01:00
2023-07-31 17:22:55 +01:00
2023-08-11 16:28:06 +01:00
2023-04-05 16:13:11 +01:00
2022-12-20 20:28:02 +01:00
2023-08-07 11:47:35 +01:00
2023-08-10 16:57:39 +00:00
2023-04-26 19:40:02 +02:00
2023-01-11 14:50:10 +01:00
2023-05-05 11:21:30 +08:00
2023-07-21 11:45:25 +01:00
2023-07-27 14:17:27 +01:00
2023-01-11 14:50:10 +01:00
2023-05-05 11:21:30 +08:00
2022-10-19 08:35:08 -04:00
2022-10-19 08:35:08 -04:00
2023-05-05 11:21:30 +08:00
2022-02-21 09:57:51 +00:00
2022-02-21 09:57:51 +00:00
2022-10-19 08:35:08 -04:00
2023-07-21 11:45:25 +01:00
2023-05-05 11:21:30 +08:00
2023-05-05 11:21:30 +08:00
2023-05-05 11:21:30 +08:00
2023-01-11 14:50:10 +01:00
2023-06-07 16:38:26 +01:00
2023-07-21 11:45:25 +01:00
2023-03-21 16:29:31 +01:00
2023-08-07 11:47:35 +01:00
2023-05-26 12:42:48 +01:00
2023-08-10 12:18:13 +01:00
2023-05-05 11:21:30 +08:00
2023-02-02 12:40:50 +00:00
2023-07-10 09:13:57 +02:00
2023-05-17 15:38:34 +02:00
2023-01-11 14:50:10 +01:00
2022-10-11 20:57:21 +02:00
2023-01-11 14:50:10 +01:00
2023-01-11 14:50:10 +01:00
2023-03-21 16:28:00 +01:00
2023-06-06 10:33:54 +02:00
2022-10-03 05:43:27 -04:00
2023-03-21 16:29:31 +01:00
2023-08-07 14:37:08 +00:00
2023-08-07 11:47:35 +01:00
2023-04-28 23:45:36 +02:00
2023-01-11 14:50:10 +01:00
2021-10-04 13:54:55 +02:00
2022-10-19 08:35:08 -04:00
2023-05-05 11:21:30 +08:00
2023-05-05 11:21:30 +08:00
2023-05-05 11:21:30 +08:00
2023-05-05 11:21:30 +08:00
2023-07-21 11:45:25 +01:00
2023-03-21 16:42:05 +01:00
2023-07-27 14:17:27 +01:00
2023-03-21 16:42:05 +01:00
2023-06-08 13:48:42 +01:00
2023-03-21 16:42:05 +01:00
2023-03-21 16:42:05 +01:00
2023-03-21 16:42:05 +01:00
2022-10-13 20:48:15 +02:00
2023-07-27 14:17:27 +01:00
2022-10-13 20:45:05 +02:00
2023-07-27 14:17:27 +01:00
2023-06-28 09:42:04 +02:00
2023-07-21 11:45:25 +01:00
2023-03-21 16:29:31 +01:00
2023-02-02 12:40:50 +00:00
2023-01-11 14:50:10 +01:00
2023-07-27 14:17:27 +01:00
2023-01-11 14:50:10 +01:00
2023-05-05 11:21:30 +08:00
2023-01-11 14:50:10 +01:00
2023-06-06 20:57:17 +02:00
2023-06-06 20:57:17 +02:00
2023-07-06 14:21:23 +01:00
2023-05-03 17:47:29 +02:00
2023-07-27 14:50:09 +00:00
2023-07-27 14:50:09 +00:00
2023-03-21 16:28:00 +01:00
2023-03-21 16:29:31 +01:00
2023-03-21 16:28:00 +01:00
2023-07-21 11:45:25 +01:00
2023-03-21 16:28:00 +01:00
2023-03-21 16:29:31 +01:00
2023-03-21 16:28:00 +01:00
2023-07-21 11:32:25 +01:00
2023-03-21 16:28:00 +01:00
2023-07-27 14:17:27 +01:00
2023-08-03 12:02:14 +02:00
2023-08-10 06:43:23 +02:00
2023-06-19 19:24:05 +02:00
2023-08-10 06:43:23 +02:00
2023-04-26 19:50:57 +02:00
2023-07-21 11:45:25 +01:00
2023-03-16 12:02:15 +00:00
2023-03-16 13:43:32 +00:00
2023-05-05 17:03:29 +08:00
2023-05-06 13:45:12 +08:00
2023-07-27 14:17:27 +01:00
2023-01-11 14:50:10 +01:00
2023-07-11 14:06:00 +02:00
2023-08-10 15:01:34 +00:00
2023-07-11 14:06:00 +02:00
2023-08-04 13:45:10 +00:00
2023-01-11 14:50:10 +01:00
2023-07-27 14:17:27 +01:00
2023-04-28 23:45:36 +02:00
2023-07-21 11:32:25 +01:00
2023-07-11 14:06:00 +02:00
2023-07-05 09:12:08 +02:00
2023-01-11 14:50:10 +01:00
2023-07-31 11:35:48 +02:00
2023-07-11 14:06:00 +02:00
2023-06-30 10:16:21 +02:00
2023-07-27 14:17:27 +01:00
2023-07-11 14:06:00 +02:00
2023-07-27 14:17:27 +01:00
2023-01-11 14:50:10 +01:00
2023-05-05 11:21:30 +08:00
2023-08-10 15:01:34 +00:00
2023-06-30 10:16:22 +02:00
2023-08-10 15:01:34 +00:00
2023-07-27 14:17:27 +01:00
2021-07-13 17:12:53 +02:00
2023-08-17 11:15:16 +00:00
2023-08-10 15:01:34 +00:00
2023-08-18 12:49:07 +05:30
2022-02-08 15:19:26 +01:00
2023-07-27 14:17:27 +01:00
2023-03-24 10:43:40 +01:00
2023-08-04 13:45:10 +00:00
2023-07-27 14:50:09 +00:00
2023-03-21 16:29:31 +01:00
2023-06-07 17:06:35 +01:00
2023-08-10 15:01:34 +00:00
2023-07-10 09:13:57 +02:00
2023-07-31 17:22:55 +01:00
2022-04-08 04:41:42 -04:00
2023-03-31 18:04:34 +01:00
2023-08-02 12:50:23 +02:00
2023-01-11 14:50:10 +01:00
2023-08-07 19:14:54 +00:00
2023-08-10 19:41:09 +00:00
2023-08-02 16:38:21 +02:00
2023-08-16 09:19:46 +00:00