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 14 15# Test vectors extracted from 16# https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Algorithm-Validation-Program/documents/components/800-135testvectors/ansx963_2001.zip 17 18Title = X963 KDF tests (from NIST test vectors) 19 20FIPSversion = <3.4.0 21KDF = X963KDF 22Ctrl.digest = digest:SHA1 23Ctrl.hexsecret = hexsecret:fd17198b89ab39c4ab5d7cca363b82f9fd7e23c3984dc8a2 24Ctrl.hexinfo = hexinfo:856a53f3e36a26bbc5792879f307cce2 25Output = 6e5fad865cb4a51c95209b16df0cc490bc2c9064405c5bccd4ee4832a531fbe7f10cb79e2eab6ab1149fbd5a23cfdabc41242269c9df22f628c4424333855b64e95e2d4fb8469c669f17176c07d103376b10b384ec5763d8b8c610409f19aca8eb31f9d85cc61a8d6d4a03d03e5a506b78d6847e93d295ee548c65afedd2efec 26 27KDF = X963KDF 28Ctrl.digest = digest:SHA224 29Ctrl.hexsecret = hexsecret:da67a73072d521a8272c69023573012ddf9b46bff65b3900 30Ctrl.hexinfo = hexinfo:727997aed53e78f74b1d66743a4ea4d2 31Output = dfc3126c5eebf9a58d89730e8d8ff7cc772592f28c10b349b437d9d068698a22e532eae975dfaf9c5c6a9f2935eafb05353013c253444e61f07bc9ddd15948e614bdc7e445ba3b1893f42f87f18fb352d49956009a642c362d45410b43a9ab376e9261210739174759511d1f9e52f6ec73dfed446dbafaf7fd1a57113abc2e8d 32 33KDF = X963KDF 34Ctrl.digest = digest:SHA256 35Ctrl.hexsecret = hexsecret:22518b10e70f2a3f243810ae3254139efbee04aa57c7af7d 36Ctrl.hexinfo = hexinfo:75eef81aa3041e33b80971203d2c0c52 37Output = c498af77161cc59f2962b9a713e2b215152d139766ce34a776df11866a69bf2e52a13d9c7c6fc878c50c5ea0bc7b00e0da2447cfd874f6cf92f30d0097111485500c90c3af8b487872d04685d14c8d1dc8d7fa08beb0ce0ababc11f0bd496269142d43525a78e5bc79a17f59676a5706dc54d54d4d1f0bd7e386128ec26afc21 38 39KDF = X963KDF 40Ctrl.digest = digest:SHA384 41Ctrl.hexsecret = hexsecret:d8554db1b392cd55c3fe957bed76af09c13ac2a9392f88f6 42Output = 671a46aada145162f8ddf1ca586a1cda 43 44KDF = X963KDF 45Ctrl.digest = digest:SHA384 46Ctrl.hexsecret = hexsecret:c051fd22539c9de791d6c43a854b8f80a6bf70190050854a 47Ctrl.hexinfo = hexinfo:1317504aa34759bb4c931e3b78201945 48Output = cf6a84434734ac6949e1d7976743277be789906908ad3ca3a8923da7f476abbeb574306d7243031a85566914bfd247d2519c479953d9d55b6b831e56260806c39af21b74e3ecf470e3bd8332791c8a23c13352514fdef00c2d1a408ba31b2d3f9fdcb373895484649a645d1845eec91b5bfdc5ad28c7824984482002dd4a8677 49 50KDF = X963KDF 51Ctrl.digest = digest:SHA512 52Ctrl.hexsecret = hexsecret:87fc0d8c4477485bb574f5fcea264b30885dc8d90ad82782 53Output = 947665fbb9152153ef460238506a0245 54 55KDF = X963KDF 56Ctrl.digest = digest:SHA512 57Ctrl.hexsecret = hexsecret:00aa5bb79b33e389fa58ceadc047197f14e73712f452caa9fc4c9adb369348b81507392f1a86ddfdb7c4ff8231c4bd0f44e44a1b55b1404747a9e2e753f55ef05a2d 58Ctrl.hexinfo = hexinfo:e3b5b4c1b0d5cf1d2b3a2f9937895d31 59Output = 4463f869f3cc18769b52264b0112b5858f7ad32a5a2d96d8cffabf7fa733633d6e4dd2a599acceb3ea54a6217ce0b50eef4f6b40a5c30250a5a8eeee208002267089dbf351f3f5022aa9638bf1ee419dea9c4ff745a25ac27bda33ca08bd56dd1a59b4106cf2dbbc0ab2aa8e2efa7b17902d34276951ceccab87f9661c3e8816 60 61KDF = X963KDF 62Ctrl.digest = digest:SHA512 63Ctrl.hexsecret = hexsecret:009dcd6ba5c8c803ca21f9996ca5dd86047d4ddc150fddace1b1ebe996c2007e3ee907c8ff03b9ef766e8ceb4dedf7489e5162e2278c0185e4be381bec17dd992cf8 64Ctrl.hexinfo = hexinfo:1e60e51c11a538b0ea8990d69a4c6358 65Output = 4e55036a32f32fc965046fdfbf686c108e43a69f8fc1a64ff1bd77763f2eedc8bf277d78b4ce31243e1adbe2c2d5dd59b47503b5b90b54f9d7a9a5aea49c7f0283cb64c3849a1d157000fd41ef6c1d1a5b62734e7c9a20dcfb57f2da974933f57ee619d72898d0e93d9a4254aaddf73941d6269298b4d49c0ac64a33802fe8f2 66 67KDF = X963KDF 68Ctrl.digest = digest:SHA512 69Ctrl.hexsecret = hexsecret:01bbc44314f24db4d67a2a7fb5ca3f7a5022790f5875895d448050eda5611a2f39de48e394c5a3df26208eb01f804d0a1d68eece6b6fa96d6db895e133e129094f78 70Ctrl.hexinfo = hexinfo:433e3ee77d00e4a9634efd677e2ff21b 71Output = f1255002293d5fbcf35ad0e532ae872171d11014616a2c52d7e5cb861b0251b9e505a77161c777bafc052b6525a6ecf34590605de72f13a1aff0a61a8a4a3364ebbe2f99224c13e043e497af8a26de749cd257e475b2f0e60e3b594901320a692a4af422f9636e4814b33f67d181a086265013b0d4efd9e1a94ea8a576afde66 72 73KDF = X963KDF 74Ctrl.digest = digest:SHA512 75Ctrl.hexsecret = hexsecret:01a33032a2bf6f8e9d6972dd339536c9e248ae9881844ff1bd04af48085be4ca1834f2a94ce1019dd9620d1e3a68203a5b291f40b5f8e3238a2a036312b89061cc60 76Ctrl.hexinfo = hexinfo:d3297ad6b9757d1f5a9d5b0e72176d74 77Output = 63565d1d3443620fba4218c97887ff40d6d68bf56b429c22018be5d91c318187ebe8a9399c5cc6c4a849288ab784d4340714ae3fdb426c4a83db9ce2ba8aea80d448e50ad543749b47bcaae519f7f00badd8d48296e81069104dcd293c605b08159ef2ef14c7833739d0414274136ae4db05ba4fa31b29c59de46d9be539525f 78 79KDF = X963KDF 80Ctrl.digest = digest:SHA512 81Ctrl.hexsecret = hexsecret:004b20a501776ea54cbdabffec2a664b7a93f8d67b17405a82bd9cbf3685a4659beb2deff1b6ecaa7ab187b6d4fd407f10db6992c65308410deb133be31a0de0c1c9 82Ctrl.hexinfo = hexinfo:fd5462cb37aa298e95f8e34bb49d85ca 83Output = cafcbc117317661bf15277c2881e05e345c1720b0c1c4040c33fe4a3ecf8032802642d29828a077ca91b6fac216b7a06517740c7d633c279dd2115eb7a34fd337376247219f53da32df57070f47c2e0816710080d6492e1c3e8cac818c3cfca2a3ce5cf1515f066b1815d2d2f69fa3111a9e81570963b90a536da0376c12265b 84 85KDF = X963KDF 86Ctrl.digest = digest:SHA512 87Ctrl.hexsecret = hexsecret:01fb44335b437771777f14d44e5b634c18c7f570b935228fd3073e3cbde299dfb9f4d64ad720d30e875e8c6bbe181027459c9d3f92a276a38e22faf25f208576a63f 88Ctrl.hexinfo = hexinfo:2359d18657243d61963ceca3fa93587d 89Output = 1544e54cd293e533959bdd893337f01ef0c7685a4d8d403d438b0223a7e18330c312a0f16bd819f4359fdd74ae85cc603d35e3d9cba896177452c8dee5214066fca420c3ab522a245af215beb7de52ebb0bdd15d0596b8b763cf7e25610a53efa726b899a1d9727b25ec673ee91ff2111f03cf761a7880d69625e784becfd4e0 90 91KDF = X963KDF 92Ctrl.digest = digest:SHA512 93Ctrl.hexsecret = hexsecret:0109afa3904193690d3f2c49e42d08c8c5cd2ea907a0d699c876e418e303b485374c8d6cf5a32af1491b3ea8a3503692b4a0fd78f9b4082e2a6e72345db4532d749f 94Ctrl.hexinfo = hexinfo:7c19631d3cd65915fa4789cf7b1c0979 95Output = fb60175568a66ef4202e110396663085fe2a9d6d2071e55d03c30ea499fee850c99c4e42a7227cca2eaf4d75e37dde205ae07260e84aeee6ef0819d98bd00d0ff5ba55994e7bf2a578baf2ee9aa862d94bf431fa14429010ebc30d7e602de726cdffacaeabc8541237fbc0c975abbf203c018c688ee354d07978654b90de9569 96 97KDF = X963KDF 98Ctrl.digest = digest:SHA512 99Ctrl.hexsecret = hexsecret:00632e165775f3c5b6e81d4042f809e904b8167687747638874b39ffce1993f46e8fc44e2a1c3df59563003bad3e25c85b61819e9addc0fdbe173dd4115c38f62ef6 100Ctrl.hexinfo = hexinfo:2bf0f18b7f21c4ec9c20b84c75f66b7c 101Output = c324fed01b75c37fc96703031403d5cc6857dc7ffa48192d9a10d5c69dd6274ecd0eb9a278f9e6b616c27bbf2e3e016635b311940390c52c61a4f4b3383ca6046961dbd2455ff6a982e8269864edd3cc1b1053da7daf9699c61b05f1acca7b79e68db655fd526fdc392bd36dcaf1c5b2fafb8975e318070d4bb948829ac41bb6 102 103KDF = X963KDF 104Ctrl.digest = digest:SHA512 105Ctrl.hexsecret = hexsecret:0096172bf47d06d544ae98471490cf9e52ee59ea7a2208b33b26c52d4952bb8f41b2211d3f9ff32e77ca8cc906ba8d246ff266ddf1df8f53824ccb15b8fb39724703 106Ctrl.hexinfo = hexinfo:cf3a74ba86af42f1ae85477ead645583 107Output = 995d1ab8557dfeafcb347f8182583fa0ac5e6cb3912393592590989f38a0214f6cf7d6fbe23917b0966c6a870876de2a2c13a45fa7aa1715be137ed332e1ffc204ce4dcce33ece6dec7f3da61fa049780040e44142cc8a1e5121cf56b386f65b7c261a192f05e5fefae4221a602bc51c41ef175dc45fb7eab8642421b4f7e3e7 108 109KDF = X942KDF-CONCAT 110Ctrl.digest = digest:SHA512 111Ctrl.hexsecret = hexsecret:0037cd001a0ad87f35ddf58ab355d6144ba2ed0749a7435dab548ba0bfbe723c047e2396b4eef99653412a92c8db74bb5c03063f2eb0525ae87356750ae3676faa86 112Ctrl.hexinfo = hexinfo:eb17da8851c41c7ac6710b1c49f324f8 113Output = 829a28b81f9e95b5f306604067499c07d5944ca034ed130d513951f7143e4e162bad8adb2833e53b8235c293cd2a809659ac7f7e392cba6a543660e5d95070c0c9e6a9cdc38123e22da61bb4cbb6ad6d1a58a069e934fc231bd9fe39a24afcbf322ccea385f0418f3b01c1edd6e7124593a1cefe3e48fcd95daaf72cfd973c59 114 115# Test concat of multiple info (Uses existing test data, and just splits the info into separate fields) 116FIPSversion = >=3.2.0 117KDF = X963KDF 118Ctrl.digest = digest:SHA512 119Ctrl.hexsecret = hexsecret:0096172bf47d06d544ae98471490cf9e52ee59ea7a2208b33b26c52d4952bb8f41b2211d3f9ff32e77ca8cc906ba8d246ff266ddf1df8f53824ccb15b8fb39724703 120Ctrl.hexinfo = hexinfo:cf3a74ba86 121Ctrl.hexinfo = hexinfo:af42f1ae85477ead645583 122Output = 995d1ab8557dfeafcb347f8182583fa0ac5e6cb3912393592590989f38a0214f6cf7d6fbe23917b0966c6a870876de2a2c13a45fa7aa1715be137ed332e1ffc204ce4dcce33ece6dec7f3da61fa049780040e44142cc8a1e5121cf56b386f65b7c261a192f05e5fefae4221a602bc51c41ef175dc45fb7eab8642421b4f7e3e7 123 124# Test that unsupported XOF is rejected 125Availablein = fips 126FIPSversion = <3.4.0 127KDF = X963KDF 128Ctrl.digest = digest:SHAKE-256 129Ctrl.hexsecret = hexsecret:fd17198b89ab39c4ab5d7cca363b82f9fd7e23c3984dc8a2 130Ctrl.hexinfo = hexinfo:856a53f3e36a26bbc5792879f307cce2 131Result = KDF_DERIVE_ERROR 132 133Availablein = fips 134FIPSversion = >=3.4.0 135KDF = X963KDF 136Ctrl.digest = digest:SHAKE-256 137Ctrl.hexsecret = hexsecret:fd17198b89ab39c4ab5d7cca363b82f9fd7e23c3984dc8a2 138Ctrl.hexinfo = hexinfo:856a53f3e36a26bbc5792879f307cce2 139Result = KDF_CTRL_ERROR 140Reason = xof digests not allowed 141 142Title = FIPS indicator tests 143 144# Test that the operation with unapproved digest function is rejected 145Availablein = fips 146FIPSversion = >=3.4.0 147KDF = X963KDF 148Ctrl.digest = digest:SHA1 149Ctrl.hexsecret = hexsecret:fd17198b89ab39c4ab5d7cca363b82f9fd7e23c3984dc8a2 150Ctrl.hexinfo = hexinfo:856a53f3e36a26bbc5792879f307cce2 151Result = KDF_CTRL_ERROR 152Reason = digest not allowed 153 154# Test that the operation with unapproved digest function is is reported as 155# unapproved 156Availablein = fips 157FIPSversion = >=3.4.0 158KDF = X963KDF 159Unapproved = 1 160Ctrl.digest-check = digest-check:0 161Ctrl.digest = digest:SHA1 162Ctrl.hexsecret = hexsecret:fd17198b89ab39c4ab5d7cca363b82f9fd7e23c3984dc8a2 163Ctrl.hexinfo = hexinfo:856a53f3e36a26bbc5792879f307cce2 164Output = 6e5fad865cb4a51c95209b16df0cc490bc2c9064405c5bccd4ee4832a531fbe7f10cb79e2eab6ab1149fbd5a23cfdabc41242269c9df22f628c4424333855b64e95e2d4fb8469c669f17176c07d103376b10b384ec5763d8b8c610409f19aca8eb31f9d85cc61a8d6d4a03d03e5a506b78d6847e93d295ee548c65afedd2efec 165 166# Test that the key whose length is shorter than 112 bits is rejected 167Availablein = fips 168FIPSversion = >=3.4.0 169KDF = X963KDF 170Ctrl.digest = digest:SHA224 171Ctrl.hexsecret = hexsecret:0102030405060908090a0b 172Ctrl.hexinfo = hexinfo:0102030405060708090a0b0c0d0e0f10 173Result = KDF_CTRL_ERROR 174Reason = invalid key length 175 176# Test that the key whose length is shorter than 112 bits is reported as 177# unapproved 178Availablein = fips 179FIPSversion = >=3.4.0 180KDF = X963KDF 181Unapproved = 1 182Ctrl.key-check = key-check:0 183Ctrl.digest = digest:SHA224 184Ctrl.hexsecret = hexsecret:0102030405060908090a0b 185Ctrl.hexinfo = hexinfo:0102030405060708090a0b0c0d0e0f10 186Output = cdbb95eaacfd7df6bee013777ad8cd39129db2b61be91d20bb4a0130deccbd265e1f81c5a7112a7ac463204bd354b47eea04b63404ed4a1d8a991d3c9e17ab22c6f8a23686f3fea364a1a2b22cb6210e99ec0ed24f27779f028f68239f12fc572b23694d4dc6063f602b4496cec6f2698f69b24bbffba7127d8a1c9a49c96a83 187