@@ -30,6 +30,7 @@ struct gss_krb5_test_param {
30
30
const struct xdr_netobj * plaintext ;
31
31
const struct xdr_netobj * confounder ;
32
32
const struct xdr_netobj * expected_result ;
33
+ const struct xdr_netobj * expected_hmac ;
33
34
const struct xdr_netobj * next_iv ;
34
35
};
35
36
@@ -1562,6 +1563,329 @@ static const struct gss_krb5_test_param rfc8009_checksum_test_params[] = {
1562
1563
KUNIT_ARRAY_PARAM (rfc8009_checksum , rfc8009_checksum_test_params ,
1563
1564
gss_krb5_get_desc );
1564
1565
1566
+ /*
1567
+ * From RFC 8009 Appendix A. Test Vectors
1568
+ *
1569
+ * Sample encryptions (all using the default cipher state):
1570
+ * --------------------------------------------------------
1571
+ *
1572
+ * These sample encryptions use the above sample key derivation results,
1573
+ * including use of the same base-key and key usage values.
1574
+ *
1575
+ * This test material is copyright (c) 2016 IETF Trust and the
1576
+ * persons identified as the document authors. All rights reserved.
1577
+ */
1578
+
1579
+ static const struct xdr_netobj rfc8009_enc_empty_plaintext = {
1580
+ .len = 0 ,
1581
+ };
1582
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_short_plaintext ,
1583
+ 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05
1584
+ );
1585
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_block_plaintext ,
1586
+ 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 ,
1587
+ 0x08 , 0x09 , 0x0a , 0x0b , 0x0c , 0x0d , 0x0e , 0x0f
1588
+ );
1589
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_long_plaintext ,
1590
+ 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 ,
1591
+ 0x08 , 0x09 , 0x0a , 0x0b , 0x0c , 0x0d , 0x0e , 0x0f ,
1592
+ 0x10 , 0x11 , 0x12 , 0x13 , 0x14
1593
+ );
1594
+
1595
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test1_confounder ,
1596
+ 0x7e , 0x58 , 0x95 , 0xea , 0xf2 , 0x67 , 0x24 , 0x35 ,
1597
+ 0xba , 0xd8 , 0x17 , 0xf5 , 0x45 , 0xa3 , 0x71 , 0x48
1598
+ );
1599
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test1_expected_result ,
1600
+ 0xef , 0x85 , 0xfb , 0x89 , 0x0b , 0xb8 , 0x47 , 0x2f ,
1601
+ 0x4d , 0xab , 0x20 , 0x39 , 0x4d , 0xca , 0x78 , 0x1d
1602
+ );
1603
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test1_expected_hmac ,
1604
+ 0xad , 0x87 , 0x7e , 0xda , 0x39 , 0xd5 , 0x0c , 0x87 ,
1605
+ 0x0c , 0x0d , 0x5a , 0x0a , 0x8e , 0x48 , 0xc7 , 0x18
1606
+ );
1607
+
1608
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test2_confounder ,
1609
+ 0x7b , 0xca , 0x28 , 0x5e , 0x2f , 0xd4 , 0x13 , 0x0f ,
1610
+ 0xb5 , 0x5b , 0x1a , 0x5c , 0x83 , 0xbc , 0x5b , 0x24
1611
+ );
1612
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test2_expected_result ,
1613
+ 0x84 , 0xd7 , 0xf3 , 0x07 , 0x54 , 0xed , 0x98 , 0x7b ,
1614
+ 0xab , 0x0b , 0xf3 , 0x50 , 0x6b , 0xeb , 0x09 , 0xcf ,
1615
+ 0xb5 , 0x54 , 0x02 , 0xce , 0xf7 , 0xe6
1616
+ );
1617
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test2_expected_hmac ,
1618
+ 0x87 , 0x7c , 0xe9 , 0x9e , 0x24 , 0x7e , 0x52 , 0xd1 ,
1619
+ 0x6e , 0xd4 , 0x42 , 0x1d , 0xfd , 0xf8 , 0x97 , 0x6c
1620
+ );
1621
+
1622
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test3_confounder ,
1623
+ 0x56 , 0xab , 0x21 , 0x71 , 0x3f , 0xf6 , 0x2c , 0x0a ,
1624
+ 0x14 , 0x57 , 0x20 , 0x0f , 0x6f , 0xa9 , 0x94 , 0x8f
1625
+ );
1626
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test3_expected_result ,
1627
+ 0x35 , 0x17 , 0xd6 , 0x40 , 0xf5 , 0x0d , 0xdc , 0x8a ,
1628
+ 0xd3 , 0x62 , 0x87 , 0x22 , 0xb3 , 0x56 , 0x9d , 0x2a ,
1629
+ 0xe0 , 0x74 , 0x93 , 0xfa , 0x82 , 0x63 , 0x25 , 0x40 ,
1630
+ 0x80 , 0xea , 0x65 , 0xc1 , 0x00 , 0x8e , 0x8f , 0xc2
1631
+ );
1632
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test3_expected_hmac ,
1633
+ 0x95 , 0xfb , 0x48 , 0x52 , 0xe7 , 0xd8 , 0x3e , 0x1e ,
1634
+ 0x7c , 0x48 , 0xc3 , 0x7e , 0xeb , 0xe6 , 0xb0 , 0xd3
1635
+ );
1636
+
1637
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test4_confounder ,
1638
+ 0xa7 , 0xa4 , 0xe2 , 0x9a , 0x47 , 0x28 , 0xce , 0x10 ,
1639
+ 0x66 , 0x4f , 0xb6 , 0x4e , 0x49 , 0xad , 0x3f , 0xac
1640
+ );
1641
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test4_expected_result ,
1642
+ 0x72 , 0x0f , 0x73 , 0xb1 , 0x8d , 0x98 , 0x59 , 0xcd ,
1643
+ 0x6c , 0xcb , 0x43 , 0x46 , 0x11 , 0x5c , 0xd3 , 0x36 ,
1644
+ 0xc7 , 0x0f , 0x58 , 0xed , 0xc0 , 0xc4 , 0x43 , 0x7c ,
1645
+ 0x55 , 0x73 , 0x54 , 0x4c , 0x31 , 0xc8 , 0x13 , 0xbc ,
1646
+ 0xe1 , 0xe6 , 0xd0 , 0x72 , 0xc1
1647
+ );
1648
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test4_expected_hmac ,
1649
+ 0x86 , 0xb3 , 0x9a , 0x41 , 0x3c , 0x2f , 0x92 , 0xca ,
1650
+ 0x9b , 0x83 , 0x34 , 0xa2 , 0x87 , 0xff , 0xcb , 0xfc
1651
+ );
1652
+
1653
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test5_confounder ,
1654
+ 0xf7 , 0x64 , 0xe9 , 0xfa , 0x15 , 0xc2 , 0x76 , 0x47 ,
1655
+ 0x8b , 0x2c , 0x7d , 0x0c , 0x4e , 0x5f , 0x58 , 0xe4
1656
+ );
1657
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test5_expected_result ,
1658
+ 0x41 , 0xf5 , 0x3f , 0xa5 , 0xbf , 0xe7 , 0x02 , 0x6d ,
1659
+ 0x91 , 0xfa , 0xf9 , 0xbe , 0x95 , 0x91 , 0x95 , 0xa0
1660
+ );
1661
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test5_expected_hmac ,
1662
+ 0x58 , 0x70 , 0x72 , 0x73 , 0xa9 , 0x6a , 0x40 , 0xf0 ,
1663
+ 0xa0 , 0x19 , 0x60 , 0x62 , 0x1a , 0xc6 , 0x12 , 0x74 ,
1664
+ 0x8b , 0x9b , 0xbf , 0xbe , 0x7e , 0xb4 , 0xce , 0x3c
1665
+ );
1666
+
1667
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test6_confounder ,
1668
+ 0xb8 , 0x0d , 0x32 , 0x51 , 0xc1 , 0xf6 , 0x47 , 0x14 ,
1669
+ 0x94 , 0x25 , 0x6f , 0xfe , 0x71 , 0x2d , 0x0b , 0x9a
1670
+ );
1671
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test6_expected_result ,
1672
+ 0x4e , 0xd7 , 0xb3 , 0x7c , 0x2b , 0xca , 0xc8 , 0xf7 ,
1673
+ 0x4f , 0x23 , 0xc1 , 0xcf , 0x07 , 0xe6 , 0x2b , 0xc7 ,
1674
+ 0xb7 , 0x5f , 0xb3 , 0xf6 , 0x37 , 0xb9
1675
+ );
1676
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test6_expected_hmac ,
1677
+ 0xf5 , 0x59 , 0xc7 , 0xf6 , 0x64 , 0xf6 , 0x9e , 0xab ,
1678
+ 0x7b , 0x60 , 0x92 , 0x23 , 0x75 , 0x26 , 0xea , 0x0d ,
1679
+ 0x1f , 0x61 , 0xcb , 0x20 , 0xd6 , 0x9d , 0x10 , 0xf2
1680
+ );
1681
+
1682
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test7_confounder ,
1683
+ 0x53 , 0xbf , 0x8a , 0x0d , 0x10 , 0x52 , 0x65 , 0xd4 ,
1684
+ 0xe2 , 0x76 , 0x42 , 0x86 , 0x24 , 0xce , 0x5e , 0x63
1685
+ );
1686
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test7_expected_result ,
1687
+ 0xbc , 0x47 , 0xff , 0xec , 0x79 , 0x98 , 0xeb , 0x91 ,
1688
+ 0xe8 , 0x11 , 0x5c , 0xf8 , 0xd1 , 0x9d , 0xac , 0x4b ,
1689
+ 0xbb , 0xe2 , 0xe1 , 0x63 , 0xe8 , 0x7d , 0xd3 , 0x7f ,
1690
+ 0x49 , 0xbe , 0xca , 0x92 , 0x02 , 0x77 , 0x64 , 0xf6
1691
+ );
1692
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test7_expected_hmac ,
1693
+ 0x8c , 0xf5 , 0x1f , 0x14 , 0xd7 , 0x98 , 0xc2 , 0x27 ,
1694
+ 0x3f , 0x35 , 0xdf , 0x57 , 0x4d , 0x1f , 0x93 , 0x2e ,
1695
+ 0x40 , 0xc4 , 0xff , 0x25 , 0x5b , 0x36 , 0xa2 , 0x66
1696
+ );
1697
+
1698
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test8_confounder ,
1699
+ 0x76 , 0x3e , 0x65 , 0x36 , 0x7e , 0x86 , 0x4f , 0x02 ,
1700
+ 0xf5 , 0x51 , 0x53 , 0xc7 , 0xe3 , 0xb5 , 0x8a , 0xf1
1701
+ );
1702
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test8_expected_result ,
1703
+ 0x40 , 0x01 , 0x3e , 0x2d , 0xf5 , 0x8e , 0x87 , 0x51 ,
1704
+ 0x95 , 0x7d , 0x28 , 0x78 , 0xbc , 0xd2 , 0xd6 , 0xfe ,
1705
+ 0x10 , 0x1c , 0xcf , 0xd5 , 0x56 , 0xcb , 0x1e , 0xae ,
1706
+ 0x79 , 0xdb , 0x3c , 0x3e , 0xe8 , 0x64 , 0x29 , 0xf2 ,
1707
+ 0xb2 , 0xa6 , 0x02 , 0xac , 0x86
1708
+ );
1709
+ DEFINE_HEX_XDR_NETOBJ (rfc8009_enc_test8_expected_hmac ,
1710
+ 0xfe , 0xf6 , 0xec , 0xb6 , 0x47 , 0xd6 , 0x29 , 0x5f ,
1711
+ 0xae , 0x07 , 0x7a , 0x1f , 0xeb , 0x51 , 0x75 , 0x08 ,
1712
+ 0xd2 , 0xc1 , 0x6b , 0x41 , 0x92 , 0xe0 , 0x1f , 0x62
1713
+ );
1714
+
1715
+ static const struct gss_krb5_test_param rfc8009_encrypt_test_params [] = {
1716
+ {
1717
+ .desc = "Encrypt empty plaintext with aes128-cts-hmac-sha256-128" ,
1718
+ .enctype = ENCTYPE_AES128_CTS_HMAC_SHA256_128 ,
1719
+ .plaintext = & rfc8009_enc_empty_plaintext ,
1720
+ .confounder = & rfc8009_enc_test1_confounder ,
1721
+ .base_key = & aes128_cts_hmac_sha256_128_basekey ,
1722
+ .expected_result = & rfc8009_enc_test1_expected_result ,
1723
+ .expected_hmac = & rfc8009_enc_test1_expected_hmac ,
1724
+ },
1725
+ {
1726
+ .desc = "Encrypt short plaintext with aes128-cts-hmac-sha256-128" ,
1727
+ .enctype = ENCTYPE_AES128_CTS_HMAC_SHA256_128 ,
1728
+ .plaintext = & rfc8009_enc_short_plaintext ,
1729
+ .confounder = & rfc8009_enc_test2_confounder ,
1730
+ .base_key = & aes128_cts_hmac_sha256_128_basekey ,
1731
+ .expected_result = & rfc8009_enc_test2_expected_result ,
1732
+ .expected_hmac = & rfc8009_enc_test2_expected_hmac ,
1733
+ },
1734
+ {
1735
+ .desc = "Encrypt block plaintext with aes128-cts-hmac-sha256-128" ,
1736
+ .enctype = ENCTYPE_AES128_CTS_HMAC_SHA256_128 ,
1737
+ .plaintext = & rfc8009_enc_block_plaintext ,
1738
+ .confounder = & rfc8009_enc_test3_confounder ,
1739
+ .base_key = & aes128_cts_hmac_sha256_128_basekey ,
1740
+ .expected_result = & rfc8009_enc_test3_expected_result ,
1741
+ .expected_hmac = & rfc8009_enc_test3_expected_hmac ,
1742
+ },
1743
+ {
1744
+ .desc = "Encrypt long plaintext with aes128-cts-hmac-sha256-128" ,
1745
+ .enctype = ENCTYPE_AES128_CTS_HMAC_SHA256_128 ,
1746
+ .plaintext = & rfc8009_enc_long_plaintext ,
1747
+ .confounder = & rfc8009_enc_test4_confounder ,
1748
+ .base_key = & aes128_cts_hmac_sha256_128_basekey ,
1749
+ .expected_result = & rfc8009_enc_test4_expected_result ,
1750
+ .expected_hmac = & rfc8009_enc_test4_expected_hmac ,
1751
+ },
1752
+ {
1753
+ .desc = "Encrypt empty plaintext with aes256-cts-hmac-sha384-192" ,
1754
+ .enctype = ENCTYPE_AES256_CTS_HMAC_SHA384_192 ,
1755
+ .plaintext = & rfc8009_enc_empty_plaintext ,
1756
+ .confounder = & rfc8009_enc_test5_confounder ,
1757
+ .base_key = & aes256_cts_hmac_sha384_192_basekey ,
1758
+ .expected_result = & rfc8009_enc_test5_expected_result ,
1759
+ .expected_hmac = & rfc8009_enc_test5_expected_hmac ,
1760
+ },
1761
+ {
1762
+ .desc = "Encrypt short plaintext with aes256-cts-hmac-sha384-192" ,
1763
+ .enctype = ENCTYPE_AES256_CTS_HMAC_SHA384_192 ,
1764
+ .plaintext = & rfc8009_enc_short_plaintext ,
1765
+ .confounder = & rfc8009_enc_test6_confounder ,
1766
+ .base_key = & aes256_cts_hmac_sha384_192_basekey ,
1767
+ .expected_result = & rfc8009_enc_test6_expected_result ,
1768
+ .expected_hmac = & rfc8009_enc_test6_expected_hmac ,
1769
+ },
1770
+ {
1771
+ .desc = "Encrypt block plaintext with aes256-cts-hmac-sha384-192" ,
1772
+ .enctype = ENCTYPE_AES256_CTS_HMAC_SHA384_192 ,
1773
+ .plaintext = & rfc8009_enc_block_plaintext ,
1774
+ .confounder = & rfc8009_enc_test7_confounder ,
1775
+ .base_key = & aes256_cts_hmac_sha384_192_basekey ,
1776
+ .expected_result = & rfc8009_enc_test7_expected_result ,
1777
+ .expected_hmac = & rfc8009_enc_test7_expected_hmac ,
1778
+ },
1779
+ {
1780
+ .desc = "Encrypt long plaintext with aes256-cts-hmac-sha384-192" ,
1781
+ .enctype = ENCTYPE_AES256_CTS_HMAC_SHA384_192 ,
1782
+ .plaintext = & rfc8009_enc_long_plaintext ,
1783
+ .confounder = & rfc8009_enc_test8_confounder ,
1784
+ .base_key = & aes256_cts_hmac_sha384_192_basekey ,
1785
+ .expected_result = & rfc8009_enc_test8_expected_result ,
1786
+ .expected_hmac = & rfc8009_enc_test8_expected_hmac ,
1787
+ },
1788
+ };
1789
+
1790
+ /* Creates the function rfc8009_encrypt_gen_params */
1791
+ KUNIT_ARRAY_PARAM (rfc8009_encrypt , rfc8009_encrypt_test_params ,
1792
+ gss_krb5_get_desc );
1793
+
1794
+ static void rfc8009_encrypt_case (struct kunit * test )
1795
+ {
1796
+ const struct gss_krb5_test_param * param = test -> param_value ;
1797
+ struct crypto_sync_skcipher * cts_tfm , * cbc_tfm ;
1798
+ const struct gss_krb5_enctype * gk5e ;
1799
+ struct xdr_netobj Ke , Ki , checksum ;
1800
+ u8 usage_data [GSS_KRB5_K5CLENGTH ];
1801
+ struct xdr_netobj usage = {
1802
+ .data = usage_data ,
1803
+ .len = sizeof (usage_data ),
1804
+ };
1805
+ struct crypto_ahash * ahash_tfm ;
1806
+ struct xdr_buf buf ;
1807
+ void * text ;
1808
+ size_t len ;
1809
+ u32 err ;
1810
+
1811
+ /* Arrange */
1812
+ gk5e = gss_krb5_lookup_enctype (param -> enctype );
1813
+ KUNIT_ASSERT_NOT_NULL (test , gk5e );
1814
+
1815
+ * (__be32 * )usage .data = cpu_to_be32 (2 );
1816
+
1817
+ Ke .len = gk5e -> Ke_length ;
1818
+ Ke .data = kunit_kzalloc (test , Ke .len , GFP_KERNEL );
1819
+ KUNIT_ASSERT_NOT_ERR_OR_NULL (test , Ke .data );
1820
+ usage .data [4 ] = KEY_USAGE_SEED_ENCRYPTION ;
1821
+ err = gk5e -> derive_key (gk5e , param -> base_key , & Ke ,
1822
+ & usage , GFP_KERNEL );
1823
+ KUNIT_ASSERT_EQ (test , err , 0 );
1824
+
1825
+ cbc_tfm = crypto_alloc_sync_skcipher (gk5e -> aux_cipher , 0 , 0 );
1826
+ KUNIT_ASSERT_NOT_ERR_OR_NULL (test , cbc_tfm );
1827
+ err = crypto_sync_skcipher_setkey (cbc_tfm , Ke .data , Ke .len );
1828
+ KUNIT_ASSERT_EQ (test , err , 0 );
1829
+
1830
+ cts_tfm = crypto_alloc_sync_skcipher (gk5e -> encrypt_name , 0 , 0 );
1831
+ KUNIT_ASSERT_NOT_ERR_OR_NULL (test , cts_tfm );
1832
+ err = crypto_sync_skcipher_setkey (cts_tfm , Ke .data , Ke .len );
1833
+ KUNIT_ASSERT_EQ (test , err , 0 );
1834
+
1835
+ len = param -> confounder -> len + param -> plaintext -> len ;
1836
+ text = kunit_kzalloc (test , len , GFP_KERNEL );
1837
+ KUNIT_ASSERT_NOT_ERR_OR_NULL (test , text );
1838
+ memcpy (text , param -> confounder -> data , param -> confounder -> len );
1839
+ memcpy (text + param -> confounder -> len , param -> plaintext -> data ,
1840
+ param -> plaintext -> len );
1841
+
1842
+ memset (& buf , 0 , sizeof (buf ));
1843
+ buf .head [0 ].iov_base = text ;
1844
+ buf .head [0 ].iov_len = param -> confounder -> len + param -> plaintext -> len ;
1845
+ buf .len = buf .head [0 ].iov_len ;
1846
+
1847
+ checksum .len = gk5e -> cksumlength ;
1848
+ checksum .data = kunit_kzalloc (test , checksum .len , GFP_KERNEL );
1849
+ KUNIT_ASSERT_NOT_ERR_OR_NULL (test , checksum .data );
1850
+
1851
+ Ki .len = gk5e -> Ki_length ;
1852
+ Ki .data = kunit_kzalloc (test , Ki .len , GFP_KERNEL );
1853
+ KUNIT_ASSERT_NOT_ERR_OR_NULL (test , Ki .data );
1854
+ usage .data [4 ] = KEY_USAGE_SEED_INTEGRITY ;
1855
+ err = gk5e -> derive_key (gk5e , param -> base_key , & Ki ,
1856
+ & usage , GFP_KERNEL );
1857
+ KUNIT_ASSERT_EQ (test , err , 0 );
1858
+
1859
+ ahash_tfm = crypto_alloc_ahash (gk5e -> cksum_name , 0 , CRYPTO_ALG_ASYNC );
1860
+ KUNIT_ASSERT_NOT_ERR_OR_NULL (test , ahash_tfm );
1861
+ err = crypto_ahash_setkey (ahash_tfm , Ki .data , Ki .len );
1862
+ KUNIT_ASSERT_EQ (test , err , 0 );
1863
+
1864
+ /* Act */
1865
+ err = krb5_cbc_cts_encrypt (cts_tfm , cbc_tfm , 0 , & buf , NULL , NULL , 0 );
1866
+ KUNIT_ASSERT_EQ (test , err , 0 );
1867
+ err = krb5_etm_checksum (cts_tfm , ahash_tfm , & buf , 0 , & checksum );
1868
+ KUNIT_ASSERT_EQ (test , err , 0 );
1869
+
1870
+ /* Assert */
1871
+ KUNIT_EXPECT_EQ_MSG (test ,
1872
+ param -> expected_result -> len , buf .len ,
1873
+ "ciphertext length mismatch" );
1874
+ KUNIT_EXPECT_EQ_MSG (test ,
1875
+ memcmp (param -> expected_result -> data ,
1876
+ buf .head [0 ].iov_base ,
1877
+ param -> expected_result -> len ), 0 ,
1878
+ "ciphertext mismatch" );
1879
+ KUNIT_EXPECT_EQ_MSG (test , memcmp (param -> expected_hmac -> data ,
1880
+ checksum .data ,
1881
+ checksum .len ), 0 ,
1882
+ "HMAC mismatch" );
1883
+
1884
+ crypto_free_ahash (ahash_tfm );
1885
+ crypto_free_sync_skcipher (cts_tfm );
1886
+ crypto_free_sync_skcipher (cbc_tfm );
1887
+ }
1888
+
1565
1889
static struct kunit_case rfc8009_test_cases [] = {
1566
1890
{
1567
1891
.name = "RFC 8009 key derivation" ,
@@ -1573,6 +1897,11 @@ static struct kunit_case rfc8009_test_cases[] = {
1573
1897
.run_case = checksum_case ,
1574
1898
.generate_params = rfc8009_checksum_gen_params ,
1575
1899
},
1900
+ {
1901
+ .name = "RFC 8009 encryption" ,
1902
+ .run_case = rfc8009_encrypt_case ,
1903
+ .generate_params = rfc8009_encrypt_gen_params ,
1904
+ },
1576
1905
};
1577
1906
1578
1907
static struct kunit_suite rfc8009_suite = {
0 commit comments