1e1051a39Sopenharmony_ci# 2e1051a39Sopenharmony_ci# Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci# 4e1051a39Sopenharmony_ci# Licensed under the Apache License 2.0 (the "License"). You may not use 5e1051a39Sopenharmony_ci# this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci# in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci# https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci 9e1051a39Sopenharmony_ci# Tests start with one of these keywords 10e1051a39Sopenharmony_ci# Cipher Decrypt Derive Digest Encoding KDF MAC PBE 11e1051a39Sopenharmony_ci# PrivPubKeyPair Sign Verify VerifyRecover 12e1051a39Sopenharmony_ci# and continue until a blank line. Lines starting with a pound sign are ignored. 13e1051a39Sopenharmony_ci 14e1051a39Sopenharmony_ciTitle = HKDF tests (from RFC5869 test vectors) 15e1051a39Sopenharmony_ci 16e1051a39Sopenharmony_ciKDF = HKDF 17e1051a39Sopenharmony_ciCtrl.digest = digest:SHA256 18e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b 19e1051a39Sopenharmony_ciCtrl.salt = hexsalt:000102030405060708090a0b0c 20e1051a39Sopenharmony_ciCtrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9 21e1051a39Sopenharmony_ciOutput = 3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865 22e1051a39Sopenharmony_ci 23e1051a39Sopenharmony_ciKDF = HKDF 24e1051a39Sopenharmony_ciCtrl.mode = mode:EXTRACT_ONLY 25e1051a39Sopenharmony_ciCtrl.digest = digest:SHA256 26e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b 27e1051a39Sopenharmony_ciCtrl.salt = hexsalt:000102030405060708090a0b0c 28e1051a39Sopenharmony_ciOutput = 077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5 29e1051a39Sopenharmony_ci 30e1051a39Sopenharmony_ciKDF = HKDF 31e1051a39Sopenharmony_ciCtrl.mode = mode:EXPAND_ONLY 32e1051a39Sopenharmony_ciCtrl.digest = digest:SHA256 33e1051a39Sopenharmony_ciCtrl.IKM = hexkey:077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5 34e1051a39Sopenharmony_ciCtrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9 35e1051a39Sopenharmony_ciOutput = 3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865 36e1051a39Sopenharmony_ci 37e1051a39Sopenharmony_ciKDF = HKDF 38e1051a39Sopenharmony_ciCtrl.digest = digest:SHA256 39e1051a39Sopenharmony_ciCtrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f 40e1051a39Sopenharmony_ciCtrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf 41e1051a39Sopenharmony_ciCtrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 42e1051a39Sopenharmony_ciOutput = b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87 43e1051a39Sopenharmony_ci 44e1051a39Sopenharmony_ciKDF = HKDF 45e1051a39Sopenharmony_ciCtrl.mode = mode:EXTRACT_ONLY 46e1051a39Sopenharmony_ciCtrl.digest = digest:SHA256 47e1051a39Sopenharmony_ciCtrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f 48e1051a39Sopenharmony_ciCtrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf 49e1051a39Sopenharmony_ciOutput = 06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244 50e1051a39Sopenharmony_ci 51e1051a39Sopenharmony_ciKDF = HKDF 52e1051a39Sopenharmony_ciCtrl.mode = mode:EXPAND_ONLY 53e1051a39Sopenharmony_ciCtrl.digest = digest:SHA256 54e1051a39Sopenharmony_ciCtrl.IKM = hexkey:06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244 55e1051a39Sopenharmony_ciCtrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 56e1051a39Sopenharmony_ciOutput = b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87 57e1051a39Sopenharmony_ci 58e1051a39Sopenharmony_ciKDF = HKDF 59e1051a39Sopenharmony_ciCtrl.digest = digest:SHA256 60e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b 61e1051a39Sopenharmony_ciCtrl.salt = salt: 62e1051a39Sopenharmony_ciCtrl.info = info: 63e1051a39Sopenharmony_ciOutput = 8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8 64e1051a39Sopenharmony_ci 65e1051a39Sopenharmony_ciKDF = HKDF 66e1051a39Sopenharmony_ciCtrl.mode = mode:EXTRACT_ONLY 67e1051a39Sopenharmony_ciCtrl.digest = digest:SHA256 68e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b 69e1051a39Sopenharmony_ciCtrl.salt = salt: 70e1051a39Sopenharmony_ciCtrl.info = info: 71e1051a39Sopenharmony_ciOutput = 19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04 72e1051a39Sopenharmony_ci 73e1051a39Sopenharmony_ciKDF = HKDF 74e1051a39Sopenharmony_ciCtrl.mode = mode:EXPAND_ONLY 75e1051a39Sopenharmony_ciCtrl.digest = digest:SHA256 76e1051a39Sopenharmony_ciCtrl.IKM = hexkey:19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04 77e1051a39Sopenharmony_ciCtrl.info = info: 78e1051a39Sopenharmony_ciOutput = 8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8 79e1051a39Sopenharmony_ci 80e1051a39Sopenharmony_ciKDF = HKDF 81e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 82e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b 83e1051a39Sopenharmony_ciCtrl.salt = hexsalt:000102030405060708090a0b0c 84e1051a39Sopenharmony_ciCtrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9 85e1051a39Sopenharmony_ciOutput = 085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896 86e1051a39Sopenharmony_ci 87e1051a39Sopenharmony_ciKDF = HKDF 88e1051a39Sopenharmony_ciCtrl.mode = mode:EXTRACT_ONLY 89e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 90e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b 91e1051a39Sopenharmony_ciCtrl.salt = hexsalt:000102030405060708090a0b0c 92e1051a39Sopenharmony_ciOutput = 9b6c18c432a7bf8f0e71c8eb88f4b30baa2ba243 93e1051a39Sopenharmony_ci 94e1051a39Sopenharmony_ciKDF = HKDF 95e1051a39Sopenharmony_ciCtrl.mode = mode:EXPAND_ONLY 96e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 97e1051a39Sopenharmony_ciCtrl.IKM = hexkey:9b6c18c432a7bf8f0e71c8eb88f4b30baa2ba243 98e1051a39Sopenharmony_ciCtrl.info = hexinfo:f0f1f2f3f4f5f6f7f8f9 99e1051a39Sopenharmony_ciOutput = 085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896 100e1051a39Sopenharmony_ci 101e1051a39Sopenharmony_ciKDF = HKDF 102e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 103e1051a39Sopenharmony_ciCtrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f 104e1051a39Sopenharmony_ciCtrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf 105e1051a39Sopenharmony_ciCtrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 106e1051a39Sopenharmony_ciOutput = 0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4 107e1051a39Sopenharmony_ci 108e1051a39Sopenharmony_ciKDF = HKDF 109e1051a39Sopenharmony_ciCtrl.mode = mode:EXTRACT_ONLY 110e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 111e1051a39Sopenharmony_ciCtrl.IKM = hexkey:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f 112e1051a39Sopenharmony_ciCtrl.salt = hexsalt:606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf 113e1051a39Sopenharmony_ciOutput = 8adae09a2a307059478d309b26c4115a224cfaf6 114e1051a39Sopenharmony_ci 115e1051a39Sopenharmony_ciKDF = HKDF 116e1051a39Sopenharmony_ciCtrl.mode = mode:EXPAND_ONLY 117e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 118e1051a39Sopenharmony_ciCtrl.IKM = hexkey:8adae09a2a307059478d309b26c4115a224cfaf6 119e1051a39Sopenharmony_ciCtrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 120e1051a39Sopenharmony_ciOutput = 0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4 121e1051a39Sopenharmony_ci 122e1051a39Sopenharmony_ciKDF = HKDF 123e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 124e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b 125e1051a39Sopenharmony_ciCtrl.salt = salt: 126e1051a39Sopenharmony_ciCtrl.info = info: 127e1051a39Sopenharmony_ciOutput = 0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918 128e1051a39Sopenharmony_ci 129e1051a39Sopenharmony_ciKDF = HKDF 130e1051a39Sopenharmony_ciCtrl.mode = mode:EXTRACT_ONLY 131e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 132e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b 133e1051a39Sopenharmony_ciCtrl.salt = salt: 134e1051a39Sopenharmony_ciOutput = da8c8a73c7fa77288ec6f5e7c297786aa0d32d01 135e1051a39Sopenharmony_ci 136e1051a39Sopenharmony_ciKDF = HKDF 137e1051a39Sopenharmony_ciCtrl.mode = mode:EXPAND_ONLY 138e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 139e1051a39Sopenharmony_ciCtrl.IKM = hexkey:da8c8a73c7fa77288ec6f5e7c297786aa0d32d01 140e1051a39Sopenharmony_ciCtrl.info = info: 141e1051a39Sopenharmony_ciOutput = 0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918 142e1051a39Sopenharmony_ci 143e1051a39Sopenharmony_ciKDF = HKDF 144e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 145e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c 146e1051a39Sopenharmony_ciCtrl.salt = salt: 147e1051a39Sopenharmony_ciCtrl.info = info: 148e1051a39Sopenharmony_ciOutput = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48 149e1051a39Sopenharmony_ci 150e1051a39Sopenharmony_ciKDF = HKDF 151e1051a39Sopenharmony_ciCtrl.mode = mode:EXTRACT_ONLY 152e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 153e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c 154e1051a39Sopenharmony_ciCtrl.salt = salt: 155e1051a39Sopenharmony_ciOutput = 2adccada18779e7c2077ad2eb19d3f3e731385dd 156e1051a39Sopenharmony_ci 157e1051a39Sopenharmony_ciKDF = HKDF 158e1051a39Sopenharmony_ciCtrl.mode = mode:EXPAND_ONLY 159e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 160e1051a39Sopenharmony_ciCtrl.IKM = hexkey:2adccada18779e7c2077ad2eb19d3f3e731385dd 161e1051a39Sopenharmony_ciCtrl.info = info: 162e1051a39Sopenharmony_ciOutput = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48 163e1051a39Sopenharmony_ci 164e1051a39Sopenharmony_ciKDF = HKDF 165e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c 166e1051a39Sopenharmony_ciCtrl.salt = salt: 167e1051a39Sopenharmony_ciCtrl.info = info: 168e1051a39Sopenharmony_ciOutput = 00 169e1051a39Sopenharmony_ciResult = KDF_DERIVE_ERROR 170e1051a39Sopenharmony_ci 171e1051a39Sopenharmony_ciKDF = HKDF 172e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 173e1051a39Sopenharmony_ciCtrl.salt = salt: 174e1051a39Sopenharmony_ciCtrl.info = info: 175e1051a39Sopenharmony_ciOutput = 00 176e1051a39Sopenharmony_ciResult = KDF_DERIVE_ERROR 177e1051a39Sopenharmony_ci 178e1051a39Sopenharmony_ciKDF = HKDF 179e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 180e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c 181e1051a39Sopenharmony_ciCtrl.info = info: 182e1051a39Sopenharmony_ciOutput = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48 183e1051a39Sopenharmony_ci 184e1051a39Sopenharmony_ciKDF = HKDF 185e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 186e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c 187e1051a39Sopenharmony_ciCtrl.salt = salt: 188e1051a39Sopenharmony_ciOutput = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48 189e1051a39Sopenharmony_ci 190e1051a39Sopenharmony_ciKDF = HKDF 191e1051a39Sopenharmony_ciCtrl.mode = mode:EXTRACT_AND_EXPAND 192e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 193e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c 194e1051a39Sopenharmony_ciCtrl.salt = salt: 195e1051a39Sopenharmony_ciOutput = 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48 196e1051a39Sopenharmony_ci 197e1051a39Sopenharmony_ci# The output key size should match the digest size for EXTRACT_ONLY mode 198e1051a39Sopenharmony_ciKDF = HKDF 199e1051a39Sopenharmony_ciCtrl.mode = mode:EXTRACT_ONLY 200e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 201e1051a39Sopenharmony_ciCtrl.IKM = hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b 202e1051a39Sopenharmony_ciCtrl.salt = salt: 203e1051a39Sopenharmony_ciOutput = da8c8a73 204e1051a39Sopenharmony_ciResult = KDF_DERIVE_ERROR 205e1051a39Sopenharmony_ci 206e1051a39Sopenharmony_ci# Test concat of multiple info (Uses existing test data, and just splits the info into separate fields) 207e1051a39Sopenharmony_ciKDF = HKDF 208e1051a39Sopenharmony_ciCtrl.mode = mode:EXPAND_ONLY 209e1051a39Sopenharmony_ciCtrl.digest = digest:SHA1 210e1051a39Sopenharmony_ciCtrl.IKM = hexkey:8adae09a2a307059478d309b26c4115a224cfaf6 211e1051a39Sopenharmony_ciCtrl.info = hexinfo:b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0 212e1051a39Sopenharmony_ciCtrl.info = hexinfo:c1c2c3 213e1051a39Sopenharmony_ciCtrl.info = hexinfo:c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9 214e1051a39Sopenharmony_ciCtrl.info = hexinfo:dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 215e1051a39Sopenharmony_ciOutput = 0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4 216