@@ -1417,9 +1417,120 @@ static struct kunit_suite rfc6803_suite = {
1417
1417
.test_cases = rfc6803_test_cases ,
1418
1418
};
1419
1419
1420
+ /*
1421
+ * From RFC 8009 Appendix A. Test Vectors
1422
+ *
1423
+ * Sample results for SHA-2 enctype key derivation
1424
+ *
1425
+ * This test material is copyright (c) 2016 IETF Trust and the
1426
+ * persons identified as the document authors. All rights reserved.
1427
+ */
1428
+
1429
+ DEFINE_HEX_XDR_NETOBJ (aes128_cts_hmac_sha256_128_basekey ,
1430
+ 0x37 , 0x05 , 0xd9 , 0x60 , 0x80 , 0xc1 , 0x77 , 0x28 ,
1431
+ 0xa0 , 0xe8 , 0x00 , 0xea , 0xb6 , 0xe0 , 0xd2 , 0x3c
1432
+ );
1433
+ DEFINE_HEX_XDR_NETOBJ (aes128_cts_hmac_sha256_128_Kc ,
1434
+ 0xb3 , 0x1a , 0x01 , 0x8a , 0x48 , 0xf5 , 0x47 , 0x76 ,
1435
+ 0xf4 , 0x03 , 0xe9 , 0xa3 , 0x96 , 0x32 , 0x5d , 0xc3
1436
+ );
1437
+ DEFINE_HEX_XDR_NETOBJ (aes128_cts_hmac_sha256_128_Ke ,
1438
+ 0x9b , 0x19 , 0x7d , 0xd1 , 0xe8 , 0xc5 , 0x60 , 0x9d ,
1439
+ 0x6e , 0x67 , 0xc3 , 0xe3 , 0x7c , 0x62 , 0xc7 , 0x2e
1440
+ );
1441
+ DEFINE_HEX_XDR_NETOBJ (aes128_cts_hmac_sha256_128_Ki ,
1442
+ 0x9f , 0xda , 0x0e , 0x56 , 0xab , 0x2d , 0x85 , 0xe1 ,
1443
+ 0x56 , 0x9a , 0x68 , 0x86 , 0x96 , 0xc2 , 0x6a , 0x6c
1444
+ );
1445
+
1446
+ DEFINE_HEX_XDR_NETOBJ (aes256_cts_hmac_sha384_192_basekey ,
1447
+ 0x6d , 0x40 , 0x4d , 0x37 , 0xfa , 0xf7 , 0x9f , 0x9d ,
1448
+ 0xf0 , 0xd3 , 0x35 , 0x68 , 0xd3 , 0x20 , 0x66 , 0x98 ,
1449
+ 0x00 , 0xeb , 0x48 , 0x36 , 0x47 , 0x2e , 0xa8 , 0xa0 ,
1450
+ 0x26 , 0xd1 , 0x6b , 0x71 , 0x82 , 0x46 , 0x0c , 0x52
1451
+ );
1452
+ DEFINE_HEX_XDR_NETOBJ (aes256_cts_hmac_sha384_192_Kc ,
1453
+ 0xef , 0x57 , 0x18 , 0xbe , 0x86 , 0xcc , 0x84 , 0x96 ,
1454
+ 0x3d , 0x8b , 0xbb , 0x50 , 0x31 , 0xe9 , 0xf5 , 0xc4 ,
1455
+ 0xba , 0x41 , 0xf2 , 0x8f , 0xaf , 0x69 , 0xe7 , 0x3d
1456
+ );
1457
+ DEFINE_HEX_XDR_NETOBJ (aes256_cts_hmac_sha384_192_Ke ,
1458
+ 0x56 , 0xab , 0x22 , 0xbe , 0xe6 , 0x3d , 0x82 , 0xd7 ,
1459
+ 0xbc , 0x52 , 0x27 , 0xf6 , 0x77 , 0x3f , 0x8e , 0xa7 ,
1460
+ 0xa5 , 0xeb , 0x1c , 0x82 , 0x51 , 0x60 , 0xc3 , 0x83 ,
1461
+ 0x12 , 0x98 , 0x0c , 0x44 , 0x2e , 0x5c , 0x7e , 0x49
1462
+ );
1463
+ DEFINE_HEX_XDR_NETOBJ (aes256_cts_hmac_sha384_192_Ki ,
1464
+ 0x69 , 0xb1 , 0x65 , 0x14 , 0xe3 , 0xcd , 0x8e , 0x56 ,
1465
+ 0xb8 , 0x20 , 0x10 , 0xd5 , 0xc7 , 0x30 , 0x12 , 0xb6 ,
1466
+ 0x22 , 0xc4 , 0xd0 , 0x0f , 0xfc , 0x23 , 0xed , 0x1f
1467
+ );
1468
+
1469
+ static const struct gss_krb5_test_param rfc8009_kdf_test_params [] = {
1470
+ {
1471
+ .desc = "Derive Kc subkey for aes128-cts-hmac-sha256-128" ,
1472
+ .enctype = ENCTYPE_AES128_CTS_HMAC_SHA256_128 ,
1473
+ .base_key = & aes128_cts_hmac_sha256_128_basekey ,
1474
+ .usage = & usage_checksum ,
1475
+ .expected_result = & aes128_cts_hmac_sha256_128_Kc ,
1476
+ },
1477
+ {
1478
+ .desc = "Derive Ke subkey for aes128-cts-hmac-sha256-128" ,
1479
+ .enctype = ENCTYPE_AES128_CTS_HMAC_SHA256_128 ,
1480
+ .base_key = & aes128_cts_hmac_sha256_128_basekey ,
1481
+ .usage = & usage_encryption ,
1482
+ .expected_result = & aes128_cts_hmac_sha256_128_Ke ,
1483
+ },
1484
+ {
1485
+ .desc = "Derive Ki subkey for aes128-cts-hmac-sha256-128" ,
1486
+ .enctype = ENCTYPE_AES128_CTS_HMAC_SHA256_128 ,
1487
+ .base_key = & aes128_cts_hmac_sha256_128_basekey ,
1488
+ .usage = & usage_integrity ,
1489
+ .expected_result = & aes128_cts_hmac_sha256_128_Ki ,
1490
+ },
1491
+ {
1492
+ .desc = "Derive Kc subkey for aes256-cts-hmac-sha384-192" ,
1493
+ .enctype = ENCTYPE_AES256_CTS_HMAC_SHA384_192 ,
1494
+ .base_key = & aes256_cts_hmac_sha384_192_basekey ,
1495
+ .usage = & usage_checksum ,
1496
+ .expected_result = & aes256_cts_hmac_sha384_192_Kc ,
1497
+ },
1498
+ {
1499
+ .desc = "Derive Ke subkey for aes256-cts-hmac-sha384-192" ,
1500
+ .enctype = ENCTYPE_AES256_CTS_HMAC_SHA384_192 ,
1501
+ .base_key = & aes256_cts_hmac_sha384_192_basekey ,
1502
+ .usage = & usage_encryption ,
1503
+ .expected_result = & aes256_cts_hmac_sha384_192_Ke ,
1504
+ },
1505
+ {
1506
+ .desc = "Derive Ki subkey for aes256-cts-hmac-sha384-192" ,
1507
+ .enctype = ENCTYPE_AES256_CTS_HMAC_SHA384_192 ,
1508
+ .base_key = & aes256_cts_hmac_sha384_192_basekey ,
1509
+ .usage = & usage_integrity ,
1510
+ .expected_result = & aes256_cts_hmac_sha384_192_Ki ,
1511
+ },
1512
+ };
1513
+
1514
+ /* Creates the function rfc8009_kdf_gen_params */
1515
+ KUNIT_ARRAY_PARAM (rfc8009_kdf , rfc8009_kdf_test_params , gss_krb5_get_desc );
1516
+
1517
+ static struct kunit_case rfc8009_test_cases [] = {
1518
+ {
1519
+ .name = "RFC 8009 key derivation" ,
1520
+ .run_case = kdf_case ,
1521
+ .generate_params = rfc8009_kdf_gen_params ,
1522
+ },
1523
+ };
1524
+
1525
+ static struct kunit_suite rfc8009_suite = {
1526
+ .name = "RFC 8009 suite" ,
1527
+ .test_cases = rfc8009_test_cases ,
1528
+ };
1529
+
1420
1530
kunit_test_suites (& rfc3961_suite ,
1421
1531
& rfc3962_suite ,
1422
- & rfc6803_suite );
1532
+ & rfc6803_suite ,
1533
+ & rfc8009_suite );
1423
1534
1424
1535
MODULE_DESCRIPTION ("Test RPCSEC GSS Kerberos 5 functions" );
1425
1536
MODULE_LICENSE ("GPL" );
0 commit comments