diff options
author | Nitesh Lal <NiteshNarayanLal@freescale.com> | 2014-05-21 07:39:08 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-05-22 09:03:18 -0400 |
commit | 5208ed2ca16526cdbec25abe594a3cc3aea210f4 (patch) | |
tree | b133e5a27ae52c3f6e26db1d72d5693c91958298 /crypto/testmgr.c | |
parent | 9bac019dad8098a77cce555d929f678e22111783 (diff) |
crypto: testmgr - add aead cbc des, des3_ede tests
Test vectors were taken from existing test for
CBC(DES3_EDE). Associated data has been added to test vectors.
HMAC computed with Crypto++ has been used. Following algos have
been covered.
(a) "authenc(hmac(sha1),cbc(des))"
(b) "authenc(hmac(sha1),cbc(des3_ede))"
(c) "authenc(hmac(sha224),cbc(des))"
(d) "authenc(hmac(sha224),cbc(des3_ede))"
(e) "authenc(hmac(sha256),cbc(des))"
(f) "authenc(hmac(sha256),cbc(des3_ede))"
(g) "authenc(hmac(sha384),cbc(des))"
(h) "authenc(hmac(sha384),cbc(des3_ede))"
(i) "authenc(hmac(sha512),cbc(des))"
(j) "authenc(hmac(sha512),cbc(des3_ede))"
Signed-off-by: Vakul Garg <vakul@freescale.com>
[NiteshNarayanLal@freescale.com: added hooks for the missing algorithms test and tested the patch]
Signed-off-by: Nitesh Lal <NiteshNarayanLal@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r-- | crypto/testmgr.c | 174 |
1 files changed, 162 insertions, 12 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 75c78e6b1a26..498649ac1953 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
@@ -1834,8 +1834,38 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1834 | .suite = { | 1834 | .suite = { |
1835 | .aead = { | 1835 | .aead = { |
1836 | .enc = { | 1836 | .enc = { |
1837 | .vecs = hmac_sha1_aes_cbc_enc_tv_template, | 1837 | .vecs = |
1838 | .count = HMAC_SHA1_AES_CBC_ENC_TEST_VECTORS | 1838 | hmac_sha1_aes_cbc_enc_tv_temp, |
1839 | .count = | ||
1840 | HMAC_SHA1_AES_CBC_ENC_TEST_VEC | ||
1841 | } | ||
1842 | } | ||
1843 | } | ||
1844 | }, { | ||
1845 | .alg = "authenc(hmac(sha1),cbc(des))", | ||
1846 | .test = alg_test_aead, | ||
1847 | .fips_allowed = 1, | ||
1848 | .suite = { | ||
1849 | .aead = { | ||
1850 | .enc = { | ||
1851 | .vecs = | ||
1852 | hmac_sha1_des_cbc_enc_tv_temp, | ||
1853 | .count = | ||
1854 | HMAC_SHA1_DES_CBC_ENC_TEST_VEC | ||
1855 | } | ||
1856 | } | ||
1857 | } | ||
1858 | }, { | ||
1859 | .alg = "authenc(hmac(sha1),cbc(des3_ede))", | ||
1860 | .test = alg_test_aead, | ||
1861 | .fips_allowed = 1, | ||
1862 | .suite = { | ||
1863 | .aead = { | ||
1864 | .enc = { | ||
1865 | .vecs = | ||
1866 | hmac_sha1_des3_ede_cbc_enc_tv_temp, | ||
1867 | .count = | ||
1868 | HMAC_SHA1_DES3_EDE_CBC_ENC_TEST_VEC | ||
1839 | } | 1869 | } |
1840 | } | 1870 | } |
1841 | } | 1871 | } |
@@ -1846,12 +1876,44 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1846 | .suite = { | 1876 | .suite = { |
1847 | .aead = { | 1877 | .aead = { |
1848 | .enc = { | 1878 | .enc = { |
1849 | .vecs = hmac_sha1_ecb_cipher_null_enc_tv_template, | 1879 | .vecs = |
1850 | .count = HMAC_SHA1_ECB_CIPHER_NULL_ENC_TEST_VECTORS | 1880 | hmac_sha1_ecb_cipher_null_enc_tv_temp, |
1881 | .count = | ||
1882 | HMAC_SHA1_ECB_CIPHER_NULL_ENC_TEST_VEC | ||
1851 | }, | 1883 | }, |
1852 | .dec = { | 1884 | .dec = { |
1853 | .vecs = hmac_sha1_ecb_cipher_null_dec_tv_template, | 1885 | .vecs = |
1854 | .count = HMAC_SHA1_ECB_CIPHER_NULL_DEC_TEST_VECTORS | 1886 | hmac_sha1_ecb_cipher_null_dec_tv_temp, |
1887 | .count = | ||
1888 | HMAC_SHA1_ECB_CIPHER_NULL_DEC_TEST_VEC | ||
1889 | } | ||
1890 | } | ||
1891 | } | ||
1892 | }, { | ||
1893 | .alg = "authenc(hmac(sha224),cbc(des))", | ||
1894 | .test = alg_test_aead, | ||
1895 | .fips_allowed = 1, | ||
1896 | .suite = { | ||
1897 | .aead = { | ||
1898 | .enc = { | ||
1899 | .vecs = | ||
1900 | hmac_sha224_des_cbc_enc_tv_temp, | ||
1901 | .count = | ||
1902 | HMAC_SHA224_DES_CBC_ENC_TEST_VEC | ||
1903 | } | ||
1904 | } | ||
1905 | } | ||
1906 | }, { | ||
1907 | .alg = "authenc(hmac(sha224),cbc(des3_ede))", | ||
1908 | .test = alg_test_aead, | ||
1909 | .fips_allowed = 1, | ||
1910 | .suite = { | ||
1911 | .aead = { | ||
1912 | .enc = { | ||
1913 | .vecs = | ||
1914 | hmac_sha224_des3_ede_cbc_enc_tv_temp, | ||
1915 | .count = | ||
1916 | HMAC_SHA224_DES3_EDE_CBC_ENC_TEST_VEC | ||
1855 | } | 1917 | } |
1856 | } | 1918 | } |
1857 | } | 1919 | } |
@@ -1862,8 +1924,66 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1862 | .suite = { | 1924 | .suite = { |
1863 | .aead = { | 1925 | .aead = { |
1864 | .enc = { | 1926 | .enc = { |
1865 | .vecs = hmac_sha256_aes_cbc_enc_tv_template, | 1927 | .vecs = |
1866 | .count = HMAC_SHA256_AES_CBC_ENC_TEST_VECTORS | 1928 | hmac_sha256_aes_cbc_enc_tv_temp, |
1929 | .count = | ||
1930 | HMAC_SHA256_AES_CBC_ENC_TEST_VEC | ||
1931 | } | ||
1932 | } | ||
1933 | } | ||
1934 | }, { | ||
1935 | .alg = "authenc(hmac(sha256),cbc(des))", | ||
1936 | .test = alg_test_aead, | ||
1937 | .fips_allowed = 1, | ||
1938 | .suite = { | ||
1939 | .aead = { | ||
1940 | .enc = { | ||
1941 | .vecs = | ||
1942 | hmac_sha256_des_cbc_enc_tv_temp, | ||
1943 | .count = | ||
1944 | HMAC_SHA256_DES_CBC_ENC_TEST_VEC | ||
1945 | } | ||
1946 | } | ||
1947 | } | ||
1948 | }, { | ||
1949 | .alg = "authenc(hmac(sha256),cbc(des3_ede))", | ||
1950 | .test = alg_test_aead, | ||
1951 | .fips_allowed = 1, | ||
1952 | .suite = { | ||
1953 | .aead = { | ||
1954 | .enc = { | ||
1955 | .vecs = | ||
1956 | hmac_sha256_des3_ede_cbc_enc_tv_temp, | ||
1957 | .count = | ||
1958 | HMAC_SHA256_DES3_EDE_CBC_ENC_TEST_VEC | ||
1959 | } | ||
1960 | } | ||
1961 | } | ||
1962 | }, { | ||
1963 | .alg = "authenc(hmac(sha384),cbc(des))", | ||
1964 | .test = alg_test_aead, | ||
1965 | .fips_allowed = 1, | ||
1966 | .suite = { | ||
1967 | .aead = { | ||
1968 | .enc = { | ||
1969 | .vecs = | ||
1970 | hmac_sha384_des_cbc_enc_tv_temp, | ||
1971 | .count = | ||
1972 | HMAC_SHA384_DES_CBC_ENC_TEST_VEC | ||
1973 | } | ||
1974 | } | ||
1975 | } | ||
1976 | }, { | ||
1977 | .alg = "authenc(hmac(sha384),cbc(des3_ede))", | ||
1978 | .test = alg_test_aead, | ||
1979 | .fips_allowed = 1, | ||
1980 | .suite = { | ||
1981 | .aead = { | ||
1982 | .enc = { | ||
1983 | .vecs = | ||
1984 | hmac_sha384_des3_ede_cbc_enc_tv_temp, | ||
1985 | .count = | ||
1986 | HMAC_SHA384_DES3_EDE_CBC_ENC_TEST_VEC | ||
1867 | } | 1987 | } |
1868 | } | 1988 | } |
1869 | } | 1989 | } |
@@ -1874,8 +1994,38 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1874 | .suite = { | 1994 | .suite = { |
1875 | .aead = { | 1995 | .aead = { |
1876 | .enc = { | 1996 | .enc = { |
1877 | .vecs = hmac_sha512_aes_cbc_enc_tv_template, | 1997 | .vecs = |
1878 | .count = HMAC_SHA512_AES_CBC_ENC_TEST_VECTORS | 1998 | hmac_sha512_aes_cbc_enc_tv_temp, |
1999 | .count = | ||
2000 | HMAC_SHA512_AES_CBC_ENC_TEST_VEC | ||
2001 | } | ||
2002 | } | ||
2003 | } | ||
2004 | }, { | ||
2005 | .alg = "authenc(hmac(sha512),cbc(des))", | ||
2006 | .test = alg_test_aead, | ||
2007 | .fips_allowed = 1, | ||
2008 | .suite = { | ||
2009 | .aead = { | ||
2010 | .enc = { | ||
2011 | .vecs = | ||
2012 | hmac_sha512_des_cbc_enc_tv_temp, | ||
2013 | .count = | ||
2014 | HMAC_SHA512_DES_CBC_ENC_TEST_VEC | ||
2015 | } | ||
2016 | } | ||
2017 | } | ||
2018 | }, { | ||
2019 | .alg = "authenc(hmac(sha512),cbc(des3_ede))", | ||
2020 | .test = alg_test_aead, | ||
2021 | .fips_allowed = 1, | ||
2022 | .suite = { | ||
2023 | .aead = { | ||
2024 | .enc = { | ||
2025 | .vecs = | ||
2026 | hmac_sha512_des3_ede_cbc_enc_tv_temp, | ||
2027 | .count = | ||
2028 | HMAC_SHA512_DES3_EDE_CBC_ENC_TEST_VEC | ||
1879 | } | 2029 | } |
1880 | } | 2030 | } |
1881 | } | 2031 | } |
@@ -3276,8 +3426,8 @@ test_done: | |||
3276 | panic("%s: %s alg self test failed in fips mode!\n", driver, alg); | 3426 | panic("%s: %s alg self test failed in fips mode!\n", driver, alg); |
3277 | 3427 | ||
3278 | if (fips_enabled && !rc) | 3428 | if (fips_enabled && !rc) |
3279 | printk(KERN_INFO "alg: self-tests for %s (%s) passed\n", | 3429 | pr_info(KERN_INFO "alg: self-tests for %s (%s) passed\n", |
3280 | driver, alg); | 3430 | driver, alg); |
3281 | 3431 | ||
3282 | return rc; | 3432 | return rc; |
3283 | 3433 | ||