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 = X9.42 KDF tests (RFC3565 2.3.2 Examples) 15 16KDF = X942KDF 17Ctrl.digest = digest:SHA1 18Ctrl.hexsecret = hexsecret:000102030405060708090a0b0c0d0e0f10111213 19Ctrl.cekalg = cekalg:id-aes128-wrap 20Output = d6d6b094c1027a7de6e3117294a35364 21 22KDF = X942KDF 23Ctrl.digest = digest:SHA1 24Ctrl.hexkey = hexkey:000102030405060708090a0b0c0d0e0f10111213 25Ctrl.cekalg = cekalg:id-aes256-wrap 26Ctrl.hexukm = hexukm:0123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba9876543201 27Output = 8890585C4E281A5C1167CAA530BED59B3230D893CBA8F922BD1B56A0 28 29Title = X9.42 KDF tests (generated tests to test different options) 30 31KDF = X942KDF 32Ctrl.digest = digest:SHA1 33Ctrl.hexsecret = hexsecret:000102030405060708090a0b0c0d0e0f10111213 34Ctrl.cekalg = cekalg:id-aes256-wrap 35Ctrl.hexpartyu-info = hexpartyu-info:0123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba9876543201 36Output = 8890585C4E281A5C1167CAA530BED59B3230D893CBA8F922BD1B56A0 37 38KDF = X942KDF 39Ctrl.digest = digest:SHA1 40Ctrl.hexsecret = hexsecret:000102030405060708090a0b0c0d0e0f10111213 41Ctrl.cekalg = cekalg:id-aes256-wrap 42Ctrl.hexpartyu-info = hexpartyu-info:0123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba9876543201 43Ctrl.use-keybits = use-keybits:0 44Output = 54bd5dbc1fa4c42c951f6fa51ec59e202b8c622bdb179fb2dd691ffb 45 46KDF = X942KDF 47Ctrl.digest = digest:SHA1 48Ctrl.hexsecret = hexsecret:000102030405060708090a0b0c0d0e0f10111213 49Ctrl.cekalg = cekalg:id-aes256-wrap 50Ctrl.hexpartyv-info = hexpartyv-info:0123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba9876543201 51Ctrl.use-keybits = use-keybits:0 52Output = 76d566e948ca9ae61bcd4ce076f0bd5fe6789b5b0f288977235ecb12 53 54KDF = X942KDF 55Ctrl.digest = digest:SHA1 56Ctrl.hexsecret = hexsecret:000102030405060708090a0b0c0d0e0f10111213 57Ctrl.cekalg = cekalg:id-aes256-wrap 58Ctrl.hexsupp-pubinfo = hexsupp-pubinfo:0123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba9876543201 59Output = ff368c7addb27d7599f8d49bc8d7fbf804540f119491ea419792c82c 60 61KDF = X942KDF 62Ctrl.digest = digest:SHA1 63Ctrl.hexsecret = hexsecret:000102030405060708090a0b0c0d0e0f10111213 64Ctrl.cekalg = cekalg:id-aes256-wrap 65Ctrl.hexsupp-privinfo = hexsupp-privinfo:0123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba98765432010123456789abcdeffedcba9876543201 66Output = 6b68b7affe5efc15e77df56e3dd639b22aa39f12eb0685b33fb39c57 67 68KDF = X942KDF 69Ctrl.digest = digest:SHA1 70Ctrl.hexsecret = hexsecret:000102030405060708090a0b0c0d0e0f10111213 71Ctrl.cekalg = cekalg:id-aes256-wrap 72Ctrl.hexpartyu-info = hexpartyu-info:0123456789abcdef 73Ctrl.hexpartyv-info = hexpartyv-info:fedcba9876543210 74Ctrl.hexsupp-pubinfo = hexsupp-pubinfo:12345678 75Ctrl.hexsupp-privinfo = hexsupp-privinfo:87654321 76Output = 2c5c1f028c6d1fc9ba752e41fdb9edb2ea936f1b2449f214acd56d31 77 78Title = X9.42 KDF tests (ACVP test vectors) 79 80FIPSversion = <3.4.0 81KDF = X942KDF-ASN1 82Ctrl.digest = digest:SHA256 83Ctrl.hexsecret = hexsecret:6B 84Ctrl.use-keybits = use-keybits:0 85Ctrl.cekalg = cekalg:id-aes128-wrap 86Ctrl.hexacvp-info = hexacvp-info:a020299D468D60BC6A257E0B6523D691A3FC1602453B35F308C762FBBAC6069A88BCa12080D49BFE5BE01C7D56489AB017663C22B8CBB34C3174D1D71F00CB7505AC759Aa2203C21A5EA5988562C007986E0503D039E7231D9F152FE72A231A1FD98C59BCA6Aa320FD47477542989B51E4A0845DFABD6EEAA465F69B3D75349B2520051782C7F3FC 87Output = C2E6A0978C24AF3932F478583ADBFB5F57D491822592EAD3C538875F46EB057A 88 89# Negative tests 90 91# Fail if both acvp and ukm values are specified. 92FIPSversion = <3.4.0 93KDF = X942KDF-ASN1 94Ctrl.digest = digest:SHA256 95Ctrl.hexsecret = hexsecret:6B 96Ctrl.use-keybits = use-keybits:0 97Ctrl.cekalg = cekalg:id-aes128-wrap 98Ctrl.hexacvp-info = hexacvp-info:a020299D468D60BC6A257E0B6523D691A3FC1602453B35F308C762FBBAC6069A88BCa12080D49BFE5BE01C7D56489AB017663C22B8CBB34C3174D1D71F00CB7505AC759Aa2203C21A5EA5988562C007986E0503D039E7231D9F152FE72A231A1FD98C59BCA6Aa320FD47477542989B51E4A0845DFABD6EEAA465F69B3D75349B2520051782C7F3FC 99Ctrl.hexukm = hexukm:012345 100Output = C2E6A0978C24AF3932F478583ADBFB5F57D491822592EAD3C538875F46EB057A 101Result = KDF_DERIVE_ERROR 102 103Availablein = fips 104FIPSversion = <3.4.0 105KDF = X942KDF-ASN1 106Ctrl.digest = digest:SHAKE-128 107Ctrl.hexsecret = hexsecret:6B 108Ctrl.use-keybits = use-keybits:0 109Ctrl.cekalg = cekalg:id-aes128-wrap 110Ctrl.hexacvp-info = hexacvp-info:a020299D468D60BC6A257E0B6523D691A3FC1602453B35F308C762FBBAC6069A88BCa12080D49BFE5BE01C7D56489AB017663C22B8CBB34C3174D1D71F00CB7505AC759Aa2203C21A5EA5988562C007986E0503D039E7231D9F152FE72A231A1FD98C59BCA6Aa320FD47477542989B51E4A0845DFABD6EEAA465F69B3D75349B2520051782C7F3FC 111Result = KDF_DERIVE_ERROR 112 113Availablein = fips 114FIPSversion = >=3.4.0 115KDF = X942KDF-ASN1 116Ctrl.digest = digest:SHAKE-128 117Ctrl.hexsecret = hexsecret:6B 118Ctrl.use-keybits = use-keybits:0 119Ctrl.cekalg = cekalg:id-aes128-wrap 120Ctrl.hexacvp-info = hexacvp-info:a020299D468D60BC6A257E0B6523D691A3FC1602453B35F308C762FBBAC6069A88BCa12080D49BFE5BE01C7D56489AB017663C22B8CBB34C3174D1D71F00CB7505AC759Aa2203C21A5EA5988562C007986E0503D039E7231D9F152FE72A231A1FD98C59BCA6Aa320FD47477542989B51E4A0845DFABD6EEAA465F69B3D75349B2520051782C7F3FC 121Result = KDF_CTRL_ERROR 122Reason = xof digests not allowed 123 124Availablein = fips 125FIPSversion = >=3.4.0 126KDF = X942KDF-ASN1 127Ctrl.digest = digest:SHA256 128Ctrl.hexsecret = hexsecret:6B 129Ctrl.use-keybits = use-keybits:0 130Ctrl.cekalg = cekalg:id-aes128-wrap 131Ctrl.hexacvp-info = hexacvp-info:a020299D468D60BC6A257E0B6523D691A3FC1602453B35F308C762FBBAC6069A88BCa12080D49BFE5BE01C7D56489AB017663C22B8CBB34C3174D1D71F00CB7505AC759Aa2203C21A5EA5988562C007986E0503D039E7231D9F152FE72A231A1FD98C59BCA6Aa320FD47477542989B51E4A0845DFABD6EEAA465F69B3D75349B2520051782C7F3FC 132Output = C2E6A0978C24AF3932F478583ADBFB5F57D491822592EAD3C538875F46EB057A 133Result = KDF_CTRL_ERROR 134Reason = invalid key length 135