xref: /freebsd/crypto/openssl/test/recipes/30-test_evp_data/evpkdf_hkdf.txt (revision a90b9d0159070121c221b966469c3e36d912bf82)
1#
2# Copyright 2001-2021 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 = HKDF tests (from RFC5869 test vectors)
15
16KDF = HKDF
17Ctrl.digest = digest:SHA256
18Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
19Ctrl.salt = hexsalt:000102030405060708090a0b0c
20Ctrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9
21Output = 3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865
22
23KDF = HKDF
24Ctrl.mode = mode:EXTRACT_ONLY
25Ctrl.digest = digest:SHA256
26Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
27Ctrl.salt = hexsalt:000102030405060708090a0b0c
28Output = 077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5
29
30KDF = HKDF
31Ctrl.mode = mode:EXPAND_ONLY
32Ctrl.digest = digest:SHA256
33Ctrl.IKM = hexkey:077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5
34Ctrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9
35Output = 3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865
36
37KDF = HKDF
38Ctrl.digest = digest:SHA256
39Ctrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
40Ctrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf
41Ctrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
42Output = b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87
43
44KDF = HKDF
45Ctrl.mode = mode:EXTRACT_ONLY
46Ctrl.digest = digest:SHA256
47Ctrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
48Ctrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf
49Output = 06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244
50
51KDF = HKDF
52Ctrl.mode = mode:EXPAND_ONLY
53Ctrl.digest = digest:SHA256
54Ctrl.IKM = hexkey:06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244
55Ctrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
56Output = b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87
57
58KDF = HKDF
59Ctrl.digest = digest:SHA256
60Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
61Ctrl.salt = salt:
62Ctrl.info = info:
63Output = 8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8
64
65KDF = HKDF
66Ctrl.mode = mode:EXTRACT_ONLY
67Ctrl.digest = digest:SHA256
68Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
69Ctrl.salt = salt:
70Ctrl.info = info:
71Output = 19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04
72
73KDF = HKDF
74Ctrl.mode = mode:EXPAND_ONLY
75Ctrl.digest = digest:SHA256
76Ctrl.IKM = hexkey:19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04
77Ctrl.info = info:
78Output = 8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8
79
80KDF = HKDF
81Ctrl.digest = digest:SHA1
82Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b
83Ctrl.salt = hexsalt:000102030405060708090a0b0c
84Ctrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9
85Output = 085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896
86
87KDF = HKDF
88Ctrl.mode = mode:EXTRACT_ONLY
89Ctrl.digest = digest:SHA1
90Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b
91Ctrl.salt = hexsalt:000102030405060708090a0b0c
92Output = 9b6c18c432a7bf8f0e71c8eb88f4b30baa2ba243
93
94KDF = HKDF
95Ctrl.mode = mode:EXPAND_ONLY
96Ctrl.digest = digest:SHA1
97Ctrl.IKM = hexkey:9b6c18c432a7bf8f0e71c8eb88f4b30baa2ba243
98Ctrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9
99Output = 085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896
100
101KDF = HKDF
102Ctrl.digest = digest:SHA1
103Ctrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
104Ctrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf
105Ctrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
106Output = 0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4
107
108KDF = HKDF
109Ctrl.mode = mode:EXTRACT_ONLY
110Ctrl.digest = digest:SHA1
111Ctrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
112Ctrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf
113Output = 8adae09a2a307059478d309b26c4115a224cfaf6
114
115KDF = HKDF
116Ctrl.mode = mode:EXPAND_ONLY
117Ctrl.digest = digest:SHA1
118Ctrl.IKM = hexkey:8adae09a2a307059478d309b26c4115a224cfaf6
119Ctrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
120Output = 0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4
121
122KDF = HKDF
123Ctrl.digest = digest:SHA1
124Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
125Ctrl.salt = salt:
126Ctrl.info = info:
127Output = 0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918
128
129KDF = HKDF
130Ctrl.mode = mode:EXTRACT_ONLY
131Ctrl.digest = digest:SHA1
132Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
133Ctrl.salt = salt:
134Output = da8c8a73c7fa77288ec6f5e7c297786aa0d32d01
135
136KDF = HKDF
137Ctrl.mode = mode:EXPAND_ONLY
138Ctrl.digest = digest:SHA1
139Ctrl.IKM = hexkey:da8c8a73c7fa77288ec6f5e7c297786aa0d32d01
140Ctrl.info = info:
141Output = 0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918
142
143KDF = HKDF
144Ctrl.digest = digest:SHA1
145Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
146Ctrl.salt = salt:
147Ctrl.info = info:
148Output = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
149
150KDF = HKDF
151Ctrl.mode = mode:EXTRACT_ONLY
152Ctrl.digest = digest:SHA1
153Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
154Ctrl.salt = salt:
155Output = 2adccada18779e7c2077ad2eb19d3f3e731385dd
156
157KDF = HKDF
158Ctrl.mode = mode:EXPAND_ONLY
159Ctrl.digest = digest:SHA1
160Ctrl.IKM = hexkey:2adccada18779e7c2077ad2eb19d3f3e731385dd
161Ctrl.info = info:
162Output = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
163
164KDF = HKDF
165Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
166Ctrl.salt = salt:
167Ctrl.info = info:
168Output = 00
169Result = KDF_DERIVE_ERROR
170
171KDF = HKDF
172Ctrl.digest = digest:SHA1
173Ctrl.salt = salt:
174Ctrl.info = info:
175Output = 00
176Result = KDF_DERIVE_ERROR
177
178KDF = HKDF
179Ctrl.digest = digest:SHA1
180Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
181Ctrl.info = info:
182Output = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
183
184KDF = HKDF
185Ctrl.digest = digest:SHA1
186Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
187Ctrl.salt = salt:
188Output = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
189
190KDF = HKDF
191Ctrl.mode = mode:EXTRACT_AND_EXPAND
192Ctrl.digest = digest:SHA1
193Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
194Ctrl.salt = salt:
195Output = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
196
197# The output key size should match the digest size for EXTRACT_ONLY mode
198KDF = HKDF
199Ctrl.mode = mode:EXTRACT_ONLY
200Ctrl.digest = digest:SHA1
201Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
202Ctrl.salt = salt:
203Output = da8c8a73
204Result = KDF_DERIVE_ERROR
205
206# Test concat of multiple info (Uses existing test data, and just splits the info into separate fields)
207KDF = HKDF
208Ctrl.mode = mode:EXPAND_ONLY
209Ctrl.digest = digest:SHA1
210Ctrl.IKM = hexkey:8adae09a2a307059478d309b26c4115a224cfaf6
211Ctrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0
212Ctrl.info = hexinfo:c1c2c3
213Ctrl.info = hexinfo:c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9
214Ctrl.info = hexinfo:dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
215Output = 0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4
216