diff options
-rw-r--r-- | crypto/tcrypt.c | 4 | ||||
-rw-r--r-- | crypto/tcrypt.h | 64 |
2 files changed, 68 insertions, 0 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 53f4ee804bdb..49e344f00806 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -805,6 +805,8 @@ static void do_test(void) | |||
805 | //AES | 805 | //AES |
806 | test_cipher ("aes", MODE_ECB, ENCRYPT, aes_enc_tv_template, AES_ENC_TEST_VECTORS); | 806 | test_cipher ("aes", MODE_ECB, ENCRYPT, aes_enc_tv_template, AES_ENC_TEST_VECTORS); |
807 | test_cipher ("aes", MODE_ECB, DECRYPT, aes_dec_tv_template, AES_DEC_TEST_VECTORS); | 807 | test_cipher ("aes", MODE_ECB, DECRYPT, aes_dec_tv_template, AES_DEC_TEST_VECTORS); |
808 | test_cipher ("aes", MODE_CBC, ENCRYPT, aes_cbc_enc_tv_template, AES_CBC_ENC_TEST_VECTORS); | ||
809 | test_cipher ("aes", MODE_CBC, DECRYPT, aes_cbc_dec_tv_template, AES_CBC_DEC_TEST_VECTORS); | ||
808 | 810 | ||
809 | //CAST5 | 811 | //CAST5 |
810 | test_cipher ("cast5", MODE_ECB, ENCRYPT, cast5_enc_tv_template, CAST5_ENC_TEST_VECTORS); | 812 | test_cipher ("cast5", MODE_ECB, ENCRYPT, cast5_enc_tv_template, CAST5_ENC_TEST_VECTORS); |
@@ -910,6 +912,8 @@ static void do_test(void) | |||
910 | case 10: | 912 | case 10: |
911 | test_cipher ("aes", MODE_ECB, ENCRYPT, aes_enc_tv_template, AES_ENC_TEST_VECTORS); | 913 | test_cipher ("aes", MODE_ECB, ENCRYPT, aes_enc_tv_template, AES_ENC_TEST_VECTORS); |
912 | test_cipher ("aes", MODE_ECB, DECRYPT, aes_dec_tv_template, AES_DEC_TEST_VECTORS); | 914 | test_cipher ("aes", MODE_ECB, DECRYPT, aes_dec_tv_template, AES_DEC_TEST_VECTORS); |
915 | test_cipher ("aes", MODE_CBC, ENCRYPT, aes_cbc_enc_tv_template, AES_CBC_ENC_TEST_VECTORS); | ||
916 | test_cipher ("aes", MODE_CBC, DECRYPT, aes_cbc_dec_tv_template, AES_CBC_DEC_TEST_VECTORS); | ||
913 | break; | 917 | break; |
914 | 918 | ||
915 | case 11: | 919 | case 11: |
diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h index 522ffd4b6f43..733d07ed75e9 100644 --- a/crypto/tcrypt.h +++ b/crypto/tcrypt.h | |||
@@ -1836,6 +1836,8 @@ static struct cipher_testvec cast6_dec_tv_template[] = { | |||
1836 | */ | 1836 | */ |
1837 | #define AES_ENC_TEST_VECTORS 3 | 1837 | #define AES_ENC_TEST_VECTORS 3 |
1838 | #define AES_DEC_TEST_VECTORS 3 | 1838 | #define AES_DEC_TEST_VECTORS 3 |
1839 | #define AES_CBC_ENC_TEST_VECTORS 2 | ||
1840 | #define AES_CBC_DEC_TEST_VECTORS 2 | ||
1839 | 1841 | ||
1840 | static struct cipher_testvec aes_enc_tv_template[] = { | 1842 | static struct cipher_testvec aes_enc_tv_template[] = { |
1841 | { /* From FIPS-197 */ | 1843 | { /* From FIPS-197 */ |
@@ -1911,6 +1913,68 @@ static struct cipher_testvec aes_dec_tv_template[] = { | |||
1911 | }, | 1913 | }, |
1912 | }; | 1914 | }; |
1913 | 1915 | ||
1916 | static struct cipher_testvec aes_cbc_enc_tv_template[] = { | ||
1917 | { /* From RFC 3602 */ | ||
1918 | .key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b, | ||
1919 | 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 }, | ||
1920 | .klen = 16, | ||
1921 | .iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30, | ||
1922 | 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 }, | ||
1923 | .input = { "Single block msg" }, | ||
1924 | .ilen = 16, | ||
1925 | .result = { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8, | ||
1926 | 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a }, | ||
1927 | .rlen = 16, | ||
1928 | }, { | ||
1929 | .key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0, | ||
1930 | 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a }, | ||
1931 | .klen = 16, | ||
1932 | .iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, | ||
1933 | 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 }, | ||
1934 | .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | ||
1935 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | ||
1936 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, | ||
1937 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, | ||
1938 | .ilen = 32, | ||
1939 | .result = { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a, | ||
1940 | 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a, | ||
1941 | 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9, | ||
1942 | 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 }, | ||
1943 | .rlen = 32, | ||
1944 | }, | ||
1945 | }; | ||
1946 | |||
1947 | static struct cipher_testvec aes_cbc_dec_tv_template[] = { | ||
1948 | { /* From RFC 3602 */ | ||
1949 | .key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b, | ||
1950 | 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 }, | ||
1951 | .klen = 16, | ||
1952 | .iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30, | ||
1953 | 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 }, | ||
1954 | .input = { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8, | ||
1955 | 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a }, | ||
1956 | .ilen = 16, | ||
1957 | .result = { "Single block msg" }, | ||
1958 | .rlen = 16, | ||
1959 | }, { | ||
1960 | .key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0, | ||
1961 | 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a }, | ||
1962 | .klen = 16, | ||
1963 | .iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, | ||
1964 | 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 }, | ||
1965 | .input = { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a, | ||
1966 | 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a, | ||
1967 | 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9, | ||
1968 | 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 }, | ||
1969 | .ilen = 32, | ||
1970 | .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | ||
1971 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | ||
1972 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, | ||
1973 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, | ||
1974 | .rlen = 32, | ||
1975 | }, | ||
1976 | }; | ||
1977 | |||
1914 | /* Cast5 test vectors from RFC 2144 */ | 1978 | /* Cast5 test vectors from RFC 2144 */ |
1915 | #define CAST5_ENC_TEST_VECTORS 3 | 1979 | #define CAST5_ENC_TEST_VECTORS 3 |
1916 | #define CAST5_DEC_TEST_VECTORS 3 | 1980 | #define CAST5_DEC_TEST_VECTORS 3 |