1#
2# Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the Apache License 2.0 (the "License").  You may not use
5# this file except in compliance with the License.  You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
8
9# Tests start with one of these keywords
10#       Cipher Decrypt Derive Digest Encoding KDF MAC PBE
11#       PrivPubKeyPair Sign Verify VerifyRecover
12# and continue until a blank line. Lines starting with a pound sign are ignored.
13
14Title = PBKDF2 tests
15
16Availablein = default
17KDF = PBKDF2
18Ctrl.pkcs5 = pkcs5:1
19Ctrl.pass = pass:password
20Ctrl.salt = salt:salt
21Ctrl.iter = iter:1
22Ctrl.digest = digest:sha1
23Output = 0c60c80f961f0e71f3a9b524af6012062fe037a6
24
25Availablein = default
26KDF = PBKDF2
27Ctrl.pkcs5 = pkcs5:1
28Ctrl.pass = pass:password
29Ctrl.salt = salt:salt
30Ctrl.iter = iter:1
31Ctrl.digest = digest:sha256
32Output = 120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b
33
34Availablein = default
35KDF = PBKDF2
36Ctrl.pkcs5 = pkcs5:1
37Ctrl.pass = pass:password
38Ctrl.salt = salt:salt
39Ctrl.iter = iter:1
40Ctrl.digest = digest:sha512
41Output = 867f70cf1ade02cff3752599a3a53dc4af34c7a669815ae5d513554e1c8cf252c02d470a285a0501bad999bfe943c08f050235d7d68b1da55e63f73b60a57fce
42
43Availablein = default
44KDF = PBKDF2
45Ctrl.pkcs5 = pkcs5:1
46Ctrl.pass = pass:password
47Ctrl.salt = salt:salt
48Ctrl.iter = iter:2
49Ctrl.digest = digest:sha1
50Output = ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957
51
52Availablein = default
53KDF = PBKDF2
54Ctrl.pkcs5 = pkcs5:1
55Ctrl.pass = pass:password
56Ctrl.salt = salt:salt
57Ctrl.iter = iter:2
58Ctrl.digest = digest:sha256
59Output = ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43
60
61Availablein = default
62KDF = PBKDF2
63Ctrl.pkcs5 = pkcs5:1
64Ctrl.pass = pass:password
65Ctrl.salt = salt:salt
66Ctrl.iter = iter:2
67Ctrl.digest = digest:sha512
68Output = e1d9c16aa681708a45f5c7c4e215ceb66e011a2e9f0040713f18aefdb866d53cf76cab2868a39b9f7840edce4fef5a82be67335c77a6068e04112754f27ccf4e
69
70Availablein = default
71KDF = PBKDF2
72Ctrl.pkcs5 = pkcs5:1
73Ctrl.pass = pass:password
74Ctrl.salt = salt:salt
75Ctrl.iter = iter:4096
76Ctrl.digest = digest:sha1
77Output = 4b007901b765489abead49d926f721d065a429c1
78
79Availablein = default
80KDF = PBKDF2
81Ctrl.pkcs5 = pkcs5:1
82Ctrl.pass = pass:password
83Ctrl.salt = salt:salt
84Ctrl.iter = iter:4096
85Ctrl.digest = digest:sha256
86Output = c5e478d59288c841aa530db6845c4c8d962893a001ce4e11a4963873aa98134a
87
88Availablein = default
89KDF = PBKDF2
90Ctrl.pkcs5 = pkcs5:1
91Ctrl.pass = pass:password
92Ctrl.salt = salt:salt
93Ctrl.iter = iter:4096
94Ctrl.digest = digest:sha512
95Output = d197b1b33db0143e018b12f3d1d1479e6cdebdcc97c5c0f87f6902e072f457b5143f30602641b3d55cd335988cb36b84376060ecd532e039b742a239434af2d5
96
97KDF = PBKDF2
98Ctrl.pass = pass:passwordPASSWORDpassword
99Ctrl.salt = salt:saltSALTsaltSALTsaltSALTsaltSALTsalt
100Ctrl.iter = iter:4096
101Ctrl.digest = digest:sha1
102Output = 3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038
103
104KDF = PBKDF2
105Ctrl.pass = pass:passwordPASSWORDpassword
106Ctrl.salt = salt:saltSALTsaltSALTsaltSALTsaltSALTsalt
107Ctrl.iter = iter:4096
108Ctrl.digest = digest:sha256
109Output = 348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9
110
111KDF = PBKDF2
112Ctrl.pass = pass:passwordPASSWORDpassword
113Ctrl.salt = salt:saltSALTsaltSALTsaltSALTsaltSALTsalt
114Ctrl.iter = iter:4096
115Ctrl.digest = digest:sha512
116Output = 8c0511f4c6e597c6ac6315d8f0362e225f3c501495ba23b868c005174dc4ee71115b59f9e60cd9532fa33e0f75aefe30225c583a186cd82bd4daea9724a3d3b8
117
118Availablein = default
119KDF = PBKDF2
120Ctrl.pkcs5 = pkcs5:1
121Ctrl.hexpass = hexpass:7061737300776f7264
122Ctrl.hexsalt = hexsalt:7361006c74
123Ctrl.iter = iter:4096
124Ctrl.digest = digest:sha1
125Output = 56fa6aa75548099dcc37d7f03425e0c3
126
127Availablein = default
128KDF = PBKDF2
129Ctrl.pkcs5 = pkcs5:1
130Ctrl.hexpass = hexpass:7061737300776f7264
131Ctrl.hexsalt = hexsalt:7361006c74
132Ctrl.iter = iter:4096
133Ctrl.digest = digest:sha256
134Output = 89b69d0516f829893c696226650a8687
135
136Availablein = default
137KDF = PBKDF2
138Ctrl.pkcs5 = pkcs5:1
139Ctrl.hexpass = hexpass:7061737300776f7264
140Ctrl.hexsalt = hexsalt:7361006c74
141Ctrl.iter = iter:4096
142Ctrl.digest = digest:sha512
143Output = 9d9e9c4cd21fe4be24d5b8244c759665
144
145Availablein = default
146KDF = PBKDF2
147Ctrl.pkcs5 = pkcs5:1
148Ctrl.pass = pass:password
149Ctrl.salt = salt:salt
150Ctrl.iter = iter:4096
151Ctrl.digest = digest:sha3-224
152Output = 691292bc3683d7d41ea2910f5b3eed23
153
154Availablein = default
155KDF = PBKDF2
156Ctrl.pkcs5 = pkcs5:1
157Ctrl.pass = pass:password
158Ctrl.salt = salt:salt
159Ctrl.iter = iter:4096
160Ctrl.digest = digest:sha3-256
161Output = 778b6e237a0f49621549ff70d218d208
162
163Availablein = default
164KDF = PBKDF2
165Ctrl.pkcs5 = pkcs5:1
166Ctrl.pass = pass:password
167Ctrl.salt = salt:salt
168Ctrl.iter = iter:4096
169Ctrl.digest = digest:sha3-384
170Output = 9a5f1e45e8b83f1b259ba72d11c59087
171
172Availablein = default
173KDF = PBKDF2
174Ctrl.pkcs5 = pkcs5:1
175Ctrl.pass = pass:password
176Ctrl.salt = salt:salt
177Ctrl.iter = iter:4096
178Ctrl.digest = digest:sha3-512
179Output = 2bfaf2d5ceb6d10f5e262cd902488cfd
180
181Title = PBKDF2 tests for empty inputs
182
183Availablein = default
184KDF = PBKDF2
185Ctrl.pkcs5 = pkcs5:1
186Ctrl.pass = pass:
187Ctrl.salt = salt:salt
188Ctrl.iter = iter:1
189Ctrl.digest = digest:sha1
190Output = a33dddc30478185515311f8752895d36ea4363a2
191
192Availablein = default
193KDF = PBKDF2
194Ctrl.pkcs5 = pkcs5:1
195Ctrl.pass = pass:
196Ctrl.salt = salt:salt
197Ctrl.iter = iter:1
198Ctrl.digest = digest:sha256
199Output = f135c27993baf98773c5cdb40a5706ce6a345cde
200
201Availablein = default
202KDF = PBKDF2
203Ctrl.pkcs5 = pkcs5:1
204Ctrl.pass = pass:
205Ctrl.salt = salt:salt
206Ctrl.iter = iter:1
207Ctrl.digest = digest:sha512
208Output = 00ef42cdbfc98d29db20976608e455567fdddf14
209
210Availablein = fips
211FIPSversion = <3.4.0
212KDF = PBKDF2
213Ctrl.pkcs5 = pkcs5:1
214Ctrl.pass = pass:password
215Ctrl.salt = salt:salt
216Ctrl.iter = iter:1
217Ctrl.digest = digest:shake-128
218Result = KDF_DERIVE_ERROR
219
220Availablein = fips
221FIPSversion = >=3.4.0
222KDF = PBKDF2
223Ctrl.pkcs5 = pkcs5:1
224Ctrl.pass = pass:password
225Ctrl.salt = salt:salt
226Ctrl.iter = iter:1
227Ctrl.digest = digest:shake-128
228Result = KDF_CTRL_ERROR
229Reason = xof digests not allowed
230
231Title = FIPS indicator tests
232
233# Test that operations with unapproved parameters are rejected
234Availablein = fips
235FIPSversion = >=3.4.0
236KDF = PBKDF2
237Ctrl.pass = pass:password
238Ctrl.salt = salt:salt
239Ctrl.iter = iter:4096
240Ctrl.digest = digest:sha1
241Result = KDF_CTRL_ERROR
242Reason = invalid salt length
243
244# Test that operations with unapproved parameters are reported as unapproved
245Availablein = fips
246FIPSversion = >=3.4.0
247KDF = PBKDF2
248Unapproved = 1
249Ctrl.pkcs5 = pkcs5:1
250Ctrl.pass = pass:password
251Ctrl.salt = salt:salt
252Ctrl.iter = iter:4096
253Ctrl.digest = digest:sha1
254Output = 4b007901b765489abead49d926f721d065a429c1
255
256# Test that the operation with approved parameters and unapproved pkcs5 value is
257# reposted as approved
258Availablein = fips
259FIPSversion = >=3.4.0
260KDF = PBKDF2
261Ctrl.pkcs5 = pkcs5:1
262Ctrl.pass = pass:password
263Ctrl.salt = salt:saltSALTsaltSALTsaltSALTsaltSALTsalt
264Ctrl.iter = iter:4096
265Ctrl.digest = digest:sha1
266Output = 043c508e57c6427036fd2c6cd2a02ec7530a412c
267
268Title = Test that a too low iteration count raises an error
269
270Availablein = fips
271KDF = PBKDF2
272Ctrl.pass = pass:password
273Ctrl.salt = salt:saltydaysarethebest
274Ctrl.iter = iter:10
275Ctrl.digest = digest:sha1
276Result = KDF_CTRL_ERROR
277Reason = invalid iteration count
278