evpkdf_hkdf.txt 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. # Tests start with one of these keywords
  9. # Cipher Decrypt Derive Digest Encoding KDF MAC PBE
  10. # PrivPubKeyPair Sign Verify VerifyRecover
  11. # and continue until a blank line. Lines starting with a pound sign are ignored.
  12. Title = HKDF tests (from RFC5869 test vectors)
  13. KDF = HKDF
  14. Ctrl.digest = digest:SHA256
  15. Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
  16. Ctrl.salt = hexsalt:000102030405060708090a0b0c
  17. Ctrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9
  18. Output = 3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865
  19. KDF = HKDF
  20. Ctrl.mode = mode:EXTRACT_ONLY
  21. Ctrl.digest = digest:SHA256
  22. Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
  23. Ctrl.salt = hexsalt:000102030405060708090a0b0c
  24. Output = 077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5
  25. KDF = HKDF
  26. Ctrl.mode = mode:EXPAND_ONLY
  27. Ctrl.digest = digest:SHA256
  28. Ctrl.IKM = hexkey:077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5
  29. Ctrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9
  30. Output = 3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865
  31. KDF = HKDF
  32. Ctrl.digest = digest:SHA256
  33. Ctrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
  34. Ctrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf
  35. Ctrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
  36. Output = b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87
  37. KDF = HKDF
  38. Ctrl.mode = mode:EXTRACT_ONLY
  39. Ctrl.digest = digest:SHA256
  40. Ctrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
  41. Ctrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf
  42. Output = 06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244
  43. KDF = HKDF
  44. Ctrl.mode = mode:EXPAND_ONLY
  45. Ctrl.digest = digest:SHA256
  46. Ctrl.IKM = hexkey:06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244
  47. Ctrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
  48. Output = b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87
  49. KDF = HKDF
  50. Ctrl.digest = digest:SHA256
  51. Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
  52. Ctrl.salt = salt:
  53. Ctrl.info = info:
  54. Output = 8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8
  55. KDF = HKDF
  56. Ctrl.mode = mode:EXTRACT_ONLY
  57. Ctrl.digest = digest:SHA256
  58. Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
  59. Ctrl.salt = salt:
  60. Ctrl.info = info:
  61. Output = 19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04
  62. KDF = HKDF
  63. Ctrl.mode = mode:EXPAND_ONLY
  64. Ctrl.digest = digest:SHA256
  65. Ctrl.IKM = hexkey:19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04
  66. Ctrl.info = info:
  67. Output = 8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8
  68. KDF = HKDF
  69. Ctrl.digest = digest:SHA1
  70. Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b
  71. Ctrl.salt = hexsalt:000102030405060708090a0b0c
  72. Ctrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9
  73. Output = 085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896
  74. KDF = HKDF
  75. Ctrl.mode = mode:EXTRACT_ONLY
  76. Ctrl.digest = digest:SHA1
  77. Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b
  78. Ctrl.salt = hexsalt:000102030405060708090a0b0c
  79. Output = 9b6c18c432a7bf8f0e71c8eb88f4b30baa2ba243
  80. KDF = HKDF
  81. Ctrl.mode = mode:EXPAND_ONLY
  82. Ctrl.digest = digest:SHA1
  83. Ctrl.IKM = hexkey:9b6c18c432a7bf8f0e71c8eb88f4b30baa2ba243
  84. Ctrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9
  85. Output = 085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896
  86. KDF = HKDF
  87. Ctrl.digest = digest:SHA1
  88. Ctrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
  89. Ctrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf
  90. Ctrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
  91. Output = 0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4
  92. KDF = HKDF
  93. Ctrl.mode = mode:EXTRACT_ONLY
  94. Ctrl.digest = digest:SHA1
  95. Ctrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f
  96. Ctrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf
  97. Output = 8adae09a2a307059478d309b26c4115a224cfaf6
  98. KDF = HKDF
  99. Ctrl.mode = mode:EXPAND_ONLY
  100. Ctrl.digest = digest:SHA1
  101. Ctrl.IKM = hexkey:8adae09a2a307059478d309b26c4115a224cfaf6
  102. Ctrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
  103. Output = 0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4
  104. KDF = HKDF
  105. Ctrl.digest = digest:SHA1
  106. Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
  107. Ctrl.salt = salt:
  108. Ctrl.info = info:
  109. Output = 0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918
  110. KDF = HKDF
  111. Ctrl.mode = mode:EXTRACT_ONLY
  112. Ctrl.digest = digest:SHA1
  113. Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
  114. Ctrl.salt = salt:
  115. Output = da8c8a73c7fa77288ec6f5e7c297786aa0d32d01
  116. KDF = HKDF
  117. Ctrl.mode = mode:EXPAND_ONLY
  118. Ctrl.digest = digest:SHA1
  119. Ctrl.IKM = hexkey:da8c8a73c7fa77288ec6f5e7c297786aa0d32d01
  120. Ctrl.info = info:
  121. Output = 0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918
  122. KDF = HKDF
  123. Ctrl.digest = digest:SHA1
  124. Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
  125. Ctrl.salt = salt:
  126. Ctrl.info = info:
  127. Output = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
  128. KDF = HKDF
  129. Ctrl.mode = mode:EXTRACT_ONLY
  130. Ctrl.digest = digest:SHA1
  131. Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
  132. Ctrl.salt = salt:
  133. Output = 2adccada18779e7c2077ad2eb19d3f3e731385dd
  134. KDF = HKDF
  135. Ctrl.mode = mode:EXPAND_ONLY
  136. Ctrl.digest = digest:SHA1
  137. Ctrl.IKM = hexkey:2adccada18779e7c2077ad2eb19d3f3e731385dd
  138. Ctrl.info = info:
  139. Output = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
  140. KDF = HKDF
  141. Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
  142. Ctrl.salt = salt:
  143. Ctrl.info = info:
  144. Output = 00
  145. Result = KDF_DERIVE_ERROR
  146. KDF = HKDF
  147. Ctrl.digest = digest:SHA1
  148. Ctrl.salt = salt:
  149. Ctrl.info = info:
  150. Output = 00
  151. Result = KDF_DERIVE_ERROR
  152. KDF = HKDF
  153. Ctrl.digest = digest:SHA1
  154. Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
  155. Ctrl.info = info:
  156. Output = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
  157. KDF = HKDF
  158. Ctrl.digest = digest:SHA1
  159. Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
  160. Ctrl.salt = salt:
  161. Output = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
  162. KDF = HKDF
  163. Ctrl.mode = mode:EXTRACT_AND_EXPAND
  164. Ctrl.digest = digest:SHA1
  165. Ctrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
  166. Ctrl.salt = salt:
  167. Output = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
  168. # The output key size should match the digest size for EXTRACT_ONLY mode
  169. KDF = HKDF
  170. Ctrl.mode = mode:EXTRACT_ONLY
  171. Ctrl.digest = digest:SHA1
  172. Ctrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
  173. Ctrl.salt = salt:
  174. Output = da8c8a73
  175. Result = KDF_DERIVE_ERROR
  176. # Test concat of multiple info (Uses existing test data, and just splits the info into separate fields)
  177. KDF = HKDF
  178. Ctrl.mode = mode:EXPAND_ONLY
  179. Ctrl.digest = digest:SHA1
  180. Ctrl.IKM = hexkey:8adae09a2a307059478d309b26c4115a224cfaf6
  181. Ctrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0
  182. Ctrl.info = hexinfo:c1c2c3
  183. Ctrl.info = hexinfo:c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9
  184. Ctrl.info = hexinfo:dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
  185. Output = 0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4
  186. Availablein = default
  187. KDF = HKDF
  188. Ctrl.digest = digest:BLAKE2S-256
  189. Ctrl.IKM = hexkey:1a2d
  190. Ctrl.salt = hexsalt:000000000000000000000000000000000000000000000000000000000000000000
  191. Ctrl.info = info:
  192. Output = 62f99231760bedd72319cc6cad