aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-11-16 17:04:48 -0500
committerJack Lloyd <[email protected]>2016-11-16 17:04:48 -0500
commitb9d4052012abd077556d987204e64de31f15fbc1 (patch)
tree278e060c05fe2b76fc5f449a5d1caf837501ecba /src/tests
parent124f4fe26706572c439f603c802da2726f5651de (diff)
parent10b8c8e8ad16a3c37a4a6911f2c0e8972c711377 (diff)
Merge GH #727 Tests for KDF::name
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/data/kdf/hkdf.vec18
-rw-r--r--src/tests/data/kdf/kdf1.vec2
-rw-r--r--src/tests/data/kdf/kdf1_iso18033.vec2
-rw-r--r--src/tests/data/kdf/kdf2.vec2
-rw-r--r--src/tests/data/kdf/sp800_108_ctr.vec8
-rw-r--r--src/tests/data/kdf/sp800_108_fb.vec8
-rw-r--r--src/tests/data/kdf/sp800_108_pipe.vec8
-rw-r--r--src/tests/data/kdf/sp800_56c.vec8
-rw-r--r--src/tests/data/kdf/tls_prf.vec8
-rw-r--r--src/tests/data/kdf/x942_prf.vec4
-rw-r--r--src/tests/test_kdf.cpp1
11 files changed, 35 insertions, 34 deletions
diff --git a/src/tests/data/kdf/hkdf.vec b/src/tests/data/kdf/hkdf.vec
index da63cd558..fc14e6b19 100644
--- a/src/tests/data/kdf/hkdf.vec
+++ b/src/tests/data/kdf/hkdf.vec
@@ -1,7 +1,7 @@
# SHA-1 and SHA-256 data from RFC 5869
# SHA-512 data from https://www.kullo.net/blog/hkdf-sha-512-test-vectors/
-[HKDF(SHA-1)]
+[HKDF(HMAC(SHA-160))]
Salt = 000102030405060708090A0B0C
Label = F0F1F2F3F4F5F6F7F8F9
OutputLen = 42
@@ -22,7 +22,7 @@ OutputLen = 42
Secret = 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C
Output = 2C91117204D745F3500D636A62F64F0AB3BAE548AA53D423B0D1F27EBBA6F5E5673A081D70CCE7ACFC48
-[HKDF(SHA-256)]
+[HKDF(HMAC(SHA-256))]
Salt = 000102030405060708090A0B0C
Label = F0F1F2F3F4F5F6F7F8F9
OutputLen = 42
@@ -39,7 +39,7 @@ OutputLen = 42
Secret = 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B
Output = 8DA4E775A563C18F715F802A063C5A31B8A11F5C5EE1879EC3454E5F3C738D2D9D201395FAA4B61A96C8
-[HKDF(SHA-512)]
+[HKDF(HMAC(SHA-512))]
Salt = 000102030405060708090A0B0C
Label = F0F1F2F3F4F5F6F7F8F9
OutputLen = 42
@@ -66,7 +66,7 @@ OutputLen = 42
Secret = 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C
Output = 1407D46013D98BC6DECEFCFEE55F0F90B0C7F63D68EB1A80EAF07E953CFC0A3A5240A155D6E4DAA965BB
-[HKDF-Extract(SHA-1)]
+[HKDF-Extract(HMAC(SHA-160))]
Salt = 000102030405060708090A0B0C
OutputLen = 20
Secret = 0B0B0B0B0B0B0B0B0B0B0B
@@ -85,7 +85,7 @@ OutputLen = 20
Secret = 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C
Output = 2ADCCADA18779E7C2077AD2EB19D3F3E731385DD
-[HKDF-Extract(SHA-256)]
+[HKDF-Extract(HMAC(SHA-256))]
Salt = 000102030405060708090A0B0C
OutputLen = 42
Secret = 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B
@@ -101,7 +101,7 @@ OutputLen = 42
Secret = 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B
Output = 19EF24A32C717B167F33A91D6F648BDF96596776AFDB6377AC434C1C293CCB04
-[HKDF-Extract(SHA-512)]
+[HKDF-Extract(HMAC(SHA-512))]
Salt = 000102030405060708090A0B0C
OutputLen = 64
Secret = 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B
@@ -125,7 +125,7 @@ OutputLen = 64
Secret = 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C
Output = 5346B376BF3AA9F84F8F6ED5B1C4F489172E244DAC303D12F68ECC766EA600AA88495E7FB605803122FA136924A840B1F0719D2D5F68E29B242299D758ED680C
-[HKDF-Expand(SHA-1)]
+[HKDF-Expand(HMAC(SHA-160))]
IKM = 0B0B0B0B0B0B0B0B0B0B0B
XTS = 000102030405060708090A0B0C
Salt = F0F1F2F3F4F5F6F7F8F9
@@ -146,7 +146,7 @@ OutputLen = 42
Secret = 2ADCCADA18779E7C2077AD2EB19D3F3E731385DD
Output = 2C91117204D745F3500D636A62F64F0AB3BAE548AA53D423B0D1F27EBBA6F5E5673A081D70CCE7ACFC48
-[HKDF-Expand(SHA-256)]
+[HKDF-Expand(HMAC(SHA-256))]
Salt = F0F1F2F3F4F5F6F7F8F9
OutputLen = 42
Secret = 077709362C2E32DF0DDC3F0DC47BBA6390B6C73BB50F9C3122EC844AD7C2B3E5
@@ -161,7 +161,7 @@ OutputLen = 42
Secret = 19EF24A32C717B167F33A91D6F648BDF96596776AFDB6377AC434C1C293CCB04
Output = 8DA4E775A563C18F715F802A063C5A31B8A11F5C5EE1879EC3454E5F3C738D2D9D201395FAA4B61A96C8
-[HKDF-Expand(SHA-512)]
+[HKDF-Expand(HMAC(SHA-512))]
Salt = F0F1F2F3F4F5F6F7F8F9
OutputLen = 42
Secret = 665799823737DED04A88E47E54A5890BB2C3D247C7A4254A8E61350723590A26C36238127D8661B88CF80EF802D57E2F7CEBCF1E00E083848BE19929C61B4237
diff --git a/src/tests/data/kdf/kdf1.vec b/src/tests/data/kdf/kdf1.vec
index 01b0c5792..4bee93a8f 100644
--- a/src/tests/data/kdf/kdf1.vec
+++ b/src/tests/data/kdf/kdf1.vec
@@ -1,4 +1,4 @@
-[KDF1(SHA-1)]
+[KDF1(SHA-160)]
Secret = 61736F67696A6F7367696A736F69676A736F6964676A6F696A6F736467696A736F6964676A736F6964676A736F696A
Salt =
OutputLen = 20
diff --git a/src/tests/data/kdf/kdf1_iso18033.vec b/src/tests/data/kdf/kdf1_iso18033.vec
index 389ae9b0b..96f0e1208 100644
--- a/src/tests/data/kdf/kdf1_iso18033.vec
+++ b/src/tests/data/kdf/kdf1_iso18033.vec
@@ -3,7 +3,7 @@
# C.5.1
-[KDF1-18033(SHA-1)]
+[KDF1-18033(SHA-160)]
Secret = D6E168C5F256A2DCFF7EF12FACD390F393C7A88D
OutputLen = 107
Output = C325EBBB41A82551D5D0AD4834870A05EF3918C8CAAE38873F07DCA43127A4DEE36A6CA5970F6C06926037DE7DF79C4915D83FF705821D2C46A1FA7BB81B73E27176FEB7FD3A45E40B843F1AAEBCCB1EF4FA7EE3B9B491A342F43EAAA435EFDED41E0A3A6EC2EFF1F2ED95
diff --git a/src/tests/data/kdf/kdf2.vec b/src/tests/data/kdf/kdf2.vec
index 36cf84805..53979da85 100644
--- a/src/tests/data/kdf/kdf2.vec
+++ b/src/tests/data/kdf/kdf2.vec
@@ -1,4 +1,4 @@
-[KDF2(SHA-1)]
+[KDF2(SHA-160)]
Secret = FD7A43EA8A443C580C0DE618ECC013704505EFF8B5A4A9
Salt = BF0B2ECD1724A348211D8C0CA7
OutputLen = 1
diff --git a/src/tests/data/kdf/sp800_108_ctr.vec b/src/tests/data/kdf/sp800_108_ctr.vec
index e264a842c..001acf689 100644
--- a/src/tests/data/kdf/sp800_108_ctr.vec
+++ b/src/tests/data/kdf/sp800_108_ctr.vec
@@ -1,4 +1,4 @@
-[SP800-108-Counter(SHA-1)]
+[SP800-108-Counter(HMAC(SHA-160))]
OutputLen = 2
Salt = 876F7274958C9F920019
Secret = 4C5FFEE342D0F1D9204CE138ED131558CF364BBC
@@ -180,7 +180,7 @@ Label = 5B05AB73546BBCCB1B96B763
Output = 53C570373C7ADEDFF13BA573BB45550192FC585A
-[SP800-108-Counter(SHA-256)]
+[SP800-108-Counter(HMAC(SHA-256))]
OutputLen = 2
Salt = 2D8C9FEA0B61911D5035
Secret = C3981FD4820F6F6B26D90E4FCA64341446512BE1880D143F9824C4CEFBF14A18
@@ -362,7 +362,7 @@ Label = 99B47AC07FF5EE2D7B9B1D99
Output = 93C6FF261D1E7A6FF8B21DC658273F4F7399F376
-[SP800-108-Counter(SHA-384)]
+[SP800-108-Counter(HMAC(SHA-384))]
OutputLen = 2
Salt = F66A5F03BD8FB8E4EE73
Secret = 30EBC364331C53CF98F771C4864CE8B00766893EEFEC211B5F4E5DE0BFAE06C783753A5E8F34380EF30C7E28196F51F3
@@ -544,7 +544,7 @@ Label = E257EE6E8BAB6692DF1D51F3
Output = 22DC12E4D8E251F66D2E242B4A1EB27458E24C05
-[SP800-108-Counter(SHA-512)]
+[SP800-108-Counter(HMAC(SHA-512))]
OutputLen = 2
Salt = 33C0ED9DF8C585FD7B30
Secret = A6CC599CEAEDAA4266C1E5DB866476F798585D6F3E22666FBC0E5770621CE124E81B9D555476A87E5CA0778DF5FB9465DC239C8C574C83B8F5EAF3525495F9BA
diff --git a/src/tests/data/kdf/sp800_108_fb.vec b/src/tests/data/kdf/sp800_108_fb.vec
index 60e92a2f1..e10d3e1c8 100644
--- a/src/tests/data/kdf/sp800_108_fb.vec
+++ b/src/tests/data/kdf/sp800_108_fb.vec
@@ -1,4 +1,4 @@
-[SP800-108-Feedback(SHA-1)]
+[SP800-108-Feedback(HMAC(SHA-160))]
OutputLen = 2
Salt = 0976FDEC7817D94D60C4E0C9091D82E38BCFC58D7FFF0829A13D1B4455B8
Secret = E6EA4E4F7178A81230A01DA05705B9C8B902121B
@@ -180,7 +180,7 @@ Label = B686D252600420228DB788A9
Output = BC1729FEBC2B31F685DF5A12E1D00DC88E39FF44
-[SP800-108-Feedback(SHA-256)]
+[SP800-108-Feedback(HMAC(SHA-256))]
OutputLen = 2
Salt = 8BA32A09224E2BA61EADFE345E3978950895F605E73867946DD1175CC836421B6318D9E6384ABE5F323E
Secret = A7C84831ED751469D67BD1341502F8D9CEA242F22B603A82B82E5F04124E14D0
@@ -362,7 +362,7 @@ Label = 6C383B3C1A54582C30699847
Output = 52F702F095AB0C462E9E2BDAA85E1A41EC410ED5
-[SP800-108-Feedback(SHA-384)]
+[SP800-108-Feedback(HMAC(SHA-384))]
OutputLen = 2
Salt = 1FFDDCAD8C6DEFFF9A2BEC601CA464A2531FAD765B94D2C72ED24E4C7CBA8C78101C1826ABC88A8A8884CB9C2563787877D95CCDB09D8A843F01
Secret = 3A1CFF3F51B9656B4DB090DE212E309B810592F6D348CF8157D48A92744F5639885784D244C3BC3EA978DC5000A73221
@@ -544,7 +544,7 @@ Label = ABA6ED181A41A5DD5680E5C8
Output = 004006170090E730BB137914309D69C6DBC0D15F
-[SP800-108-Feedback(SHA-512)]
+[SP800-108-Feedback(HMAC(SHA-512))]
OutputLen = 2
Salt = A1BF74237FF9A58582135BFD9017A483CF65F1528BA58EAE100703CDDD3E736949E003B76354434FFB2C1BE3C9789573E4FF445494097A07517E4C56F5B62ED12DA2371C4230291DE2DD
Secret = 7475D90525595BA1A1EC2B82F7A97F647707FB90B43863A87B9950A318084610E6BAA1112A35E1361C6E50949ADC106DF4BC6F046461F267E039B8936F4CEC2F
diff --git a/src/tests/data/kdf/sp800_108_pipe.vec b/src/tests/data/kdf/sp800_108_pipe.vec
index cf9f1e60f..6889a19cc 100644
--- a/src/tests/data/kdf/sp800_108_pipe.vec
+++ b/src/tests/data/kdf/sp800_108_pipe.vec
@@ -1,4 +1,4 @@
-[SP800-108-Pipeline(SHA-1)]
+[SP800-108-Pipeline(HMAC(SHA-160))]
OutputLen = 2
Salt = B65A30885B0849C7099B
Secret = 63CB90F9CD34B95007277AE6FC17FB45A9248725
@@ -180,7 +180,7 @@ Label = 262FD4B95A73CB24D554DBD2
Output = EC87CC0BF9A726A0296B4BC9481AF900296CD058
-[SP800-108-Pipeline(SHA-256)]
+[SP800-108-Pipeline(HMAC(SHA-256))]
OutputLen = 2
Salt = 371FF6784237FC6F25B6
Secret = 4AC9763574A4483C8074B191DCA5CEC35DE6876A0AA54A87C56EB243E25159CF
@@ -362,7 +362,7 @@ Label = 1621C7DCA433B1B90B74F373
Output = F452D57C00A0799B538B2E28B136EF88D39C2274
-[SP800-108-Pipeline(SHA-384)]
+[SP800-108-Pipeline(HMAC(SHA-384))]
OutputLen = 2
Salt = C7DD056E2807475B55B7
Secret = 1ECAF0F20EA2E2DE63A1D426DA78B5ADBA3BCF645EEFDA387EDFDE1FB56650F69DC5BA62FF91810E309E445AB5BF4BD6
@@ -544,7 +544,7 @@ Label = CF0D784CE58A1C5E8818E9D0
Output = 735BD29382001F05DF7CFE508B39A1A18990036B
-[SP800-108-Pipeline(SHA-512)]
+[SP800-108-Pipeline(HMAC(SHA-512))]
OutputLen = 2
Salt = EE2ADE03A78F200A2D89
Secret = EDCA47FC977F4F8E2B0288132AB642EBA0C91E6A503C55B5A7DA5DF1B482CF6AB5A90B19FE1D7B2DFE6CFC270FB7E4674B88DC5868B2BEDADAE16633F357AED3
diff --git a/src/tests/data/kdf/sp800_56c.vec b/src/tests/data/kdf/sp800_56c.vec
index a08414b3b..b1f96bd6d 100644
--- a/src/tests/data/kdf/sp800_56c.vec
+++ b/src/tests/data/kdf/sp800_56c.vec
@@ -1,4 +1,4 @@
-[SP800-56C(SHA-1)]
+[SP800-56C(HMAC(SHA-160))]
OutputLen = 2
Salt = 97ca00eac481e8b3556a
Secret = 52f4676023946c7307b5e8148d97f312623a6e88
@@ -59,7 +59,7 @@ Secret = 9b4a2d72afa39d598f81cb22f1b3edc7d1f91f68
Label = 6bc3cf66b452ca7dae045555
Output = 73ae9581548285698d00a391ac5eb301004eab1d
-[SP800-56C(SHA-256)]
+[SP800-56C(HMAC(SHA-256))]
OutputLen = 3
Salt = 28e12e410d501368b3e8
Secret = b3dad1f46a18430ea0c8fbe2172922a5a42c47af40046db24d38cb11eff4ce44
@@ -120,7 +120,7 @@ Secret = 1fd2b381110cbedd80b2ddc4ee2f48700303044ab345d48eec3316a20d01b4de
Label = c5d0f9eb31293ba4251f5fdd
Output = fd3b37142521487e97f251d13c31bb01b5714693ca0dbfc1065a7b024a5e
-[SP800-56C(SHA-384)]
+[SP800-56C(HMAC(SHA-384))]
OutputLen = 4
Salt = 9b9b25cf91a93d3cc618
Secret = f6070cbd6cf37c42ce50bde749d11a5a3bf3520b2c48b724288d939d8691946f2fee8bf8b3cebaa0
@@ -181,7 +181,7 @@ Secret = 6f97ca4f8c61875fc452442aac903e3f6b63f229051428d26617b0ab7c127e098b7a939
Label = ba852ca1cd0cdccd87708338
Output = 0d317a18e498fe8e9f0dfa5130190d80db5eec6439d483108157b129d8be5c0a74032fb5321f28dd
-[SP800-56C(SHA-512)]
+[SP800-56C(HMAC(SHA-512))]
OutputLen = 5
Salt = 36b6876d676c8567b81c
Secret = 876039a028357f06ac7c979b514562e850c297859076b8feba0bc6bbdaec124d5395b8c738b4070a868b12c3ecede77b404b4c1ff07a7f1cf4173f9d76d6b587
diff --git a/src/tests/data/kdf/tls_prf.vec b/src/tests/data/kdf/tls_prf.vec
index 3a89854b4..a9a7832e2 100644
--- a/src/tests/data/kdf/tls_prf.vec
+++ b/src/tests/data/kdf/tls_prf.vec
@@ -161,7 +161,7 @@ Output = 1E1C646C2BFBDC62FA4C81F1D0781F5F269D3F45E5C33CAC8A2640226C8C5D16
# TLS 1.2 PRF vectors from https://www.ietf.org/mail-archive/web/tls/current/msg03416.html
-[TLS-12-PRF(SHA-224)]
+[TLS-12-PRF(HMAC(SHA-224))]
Secret = e18828740352b530d69b34c6597dea2e
Salt = f5a3fe6d34e2e28560fdcaf6823f9091
@@ -169,7 +169,7 @@ Label = 74657374206c6162656c
OutputLen = 88
Output = 224d8af3c0453393a9779789d21cf7da5ee62ae6b617873d489428efc8dd58d1566e7029e2ca3a5ecd355dc64d4d927e2fbd78c4233e8604b14749a77a92a70fddf614bc0df623d798604e4ca5512794d802a258e82f86cf
-[TLS-12-PRF(SHA-256)]
+[TLS-12-PRF(HMAC(SHA-256))]
Secret = 9bbe436ba940f017b17652849a71db35
Salt = a0ba9f936cda311827a6f796ffd5198c
@@ -177,7 +177,7 @@ Label = 74657374206c6162656c
OutputLen = 100
Output = e3f229ba727be17b8d122620557cd453c2aab21d07c3d495329b52d4e61edb5a6b301791e90d35c9c9a46b4e14baf9af0fa022f7077def17abfd3797c0564bab4fbc91666e9def9b97fce34f796789baa48082d122ee42c5a72e5a5110fff70187347b66
-[TLS-12-PRF(SHA-384)]
+[TLS-12-PRF(HMAC(SHA-384))]
Secret = b80b733d6ceefcdc71566ea48e5567df
Salt = cd665cf6a8447dd6ff8b27555edb7465
@@ -185,7 +185,7 @@ Label = 74657374206c6162656c
OutputLen = 148
Output = 7b0c18e9ced410ed1804f2cfa34a336a1c14dffb4900bb5fd7942107e81c83cde9ca0faa60be9fe34f82b1233c9146a0e534cb400fed2700884f9dc236f80edd8bfa961144c9e8d792eca722a7b32fc3d416d473ebc2c5fd4abfdad05d9184259b5bf8cd4d90fa0d31e2dec479e4f1a26066f2eea9a69236a3e52655c9e9aee691c8f3a26854308d5eaa3be85e0990703d73e56f
-[TLS-12-PRF(SHA-512)]
+[TLS-12-PRF(HMAC(SHA-512))]
Secret = b0323523c1853599584d88568bbb05eb
Salt = d4640e12e4bcdbfb437f03e6ae418ee5
diff --git a/src/tests/data/kdf/x942_prf.vec b/src/tests/data/kdf/x942_prf.vec
index a04af82ff..711765955 100644
--- a/src/tests/data/kdf/x942_prf.vec
+++ b/src/tests/data/kdf/x942_prf.vec
@@ -1,11 +1,11 @@
-[X9.42-PRF(KeyWrap.TripleDES)]
+[X9.42-PRF(1.2.840.113549.1.9.16.3.6)]
Secret = 000102030405060708090A0B0C0D0E0F10111213
Salt =
OutputLen = 24
Output = A09661392376F7044D9052A397883246B67F5F1EF63EB5FB
-[X9.42-PRF(KeyWrap.RC2)]
+[X9.42-PRF(1.2.840.113549.1.9.16.3.7)]
Secret = 000102030405060708090A0B0C0D0E0F10111213
Salt = 0123456789ABCDEFFEDCBA98765432010123456789ABCDEFFEDCBA98765432010123456789ABCDEFFEDCBA98765432010123456789ABCDEFFEDCBA9876543201
OutputLen = 16
diff --git a/src/tests/test_kdf.cpp b/src/tests/test_kdf.cpp
index 2dbb7e677..50034de0e 100644
--- a/src/tests/test_kdf.cpp
+++ b/src/tests/test_kdf.cpp
@@ -41,6 +41,7 @@ class KDF_KAT_Tests : public Text_Based_Test
const std::vector<uint8_t> label = get_opt_bin(vars, "Label");
const std::vector<uint8_t> expected = get_req_bin(vars, "Output");
+ result.test_eq("name", kdf->name(), kdf_name);
result.test_eq("derived key", kdf->derive_key(outlen, secret, salt, label), expected);
return result;