This patch adds the plain SHA* test cases to AESNI-MB crypto unit test. The
tests are enabled only for intel-ipsec-mb library version 0.52 or older.

Signed-off-by: Damian Nowak <damianx.no...@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakow...@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zh...@intel.com>
---
 test/test/test_cryptodev_hash_test_vectors.h | 65 +++++++++++++++++++++++++---
 1 file changed, 60 insertions(+), 5 deletions(-)

diff --git a/test/test/test_cryptodev_hash_test_vectors.h 
b/test/test/test_cryptodev_hash_test_vectors.h
index 8964a3bac..21bf347f6 100644
--- a/test/test/test_cryptodev_hash_test_vectors.h
+++ b/test/test/test_cryptodev_hash_test_vectors.h
@@ -96,7 +96,8 @@ sha1_test_vector = {
                        0x35, 0x62, 0xFB, 0xFA, 0x93, 0xFD, 0x7D, 0x70,
                        0xA6, 0x7D, 0x45, 0xCA
                },
-               .len = 20
+               .len = 20,
+               .truncated_len = 20
        }
 };
 
@@ -140,7 +141,8 @@ sha224_test_vector = {
                        0x39, 0x26, 0xDF, 0xB5, 0x78, 0x62, 0xB2, 0x6E,
                        0x5E, 0x8F, 0x25, 0x84
                },
-               .len = 28
+               .len = 28,
+               .truncated_len = 28
        }
 };
 
@@ -186,7 +188,8 @@ sha256_test_vector = {
                        0x1F, 0xC7, 0x84, 0xEE, 0x76, 0xA6, 0x39, 0x15,
                        0x76, 0x2F, 0x87, 0xF9, 0x01, 0x06, 0xF3, 0xB7
                },
-               .len = 32
+               .len = 32,
+               .truncated_len = 32
        }
 };
 
@@ -234,7 +237,8 @@ sha384_test_vector = {
                        0xAD, 0x41, 0xAB, 0x15, 0xB0, 0x03, 0x15, 0xEC,
                        0x9E, 0x3D, 0xED, 0xCB, 0x80, 0x7B, 0xF4, 0xB6
                },
-               .len = 48
+               .len = 48,
+               .truncated_len = 48
        }
 };
 
@@ -288,7 +292,8 @@ sha512_test_vector = {
                        0x64, 0x4E, 0x15, 0x68, 0x12, 0x67, 0x26, 0x0F,
                        0x2C, 0x3C, 0x83, 0x25, 0x27, 0x86, 0xF0, 0xDB
                },
-               .len = 64
+               .len = 64,
+               .truncated_len = 64
        }
 };
 
@@ -428,7 +433,12 @@ static const struct blockcipher_test_case 
hash_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                            BLOCKCIPHER_TEST_TARGET_PMD_CCP |
                            BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
                            BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+                           BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+                           BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
        },
        {
                .test_descr = "SHA1 Digest Verify",
@@ -437,7 +447,12 @@ static const struct blockcipher_test_case 
hash_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                            BLOCKCIPHER_TEST_TARGET_PMD_CCP |
                            BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
                            BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+                           BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+                           BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
        },
        {
                .test_descr = "HMAC-SHA1 Digest",
@@ -496,7 +511,12 @@ static const struct blockcipher_test_case 
hash_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                            BLOCKCIPHER_TEST_TARGET_PMD_CCP |
                            BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
                            BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+                           BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+                           BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
        },
        {
                .test_descr = "SHA224 Digest Verify",
@@ -505,7 +525,12 @@ static const struct blockcipher_test_case 
hash_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                            BLOCKCIPHER_TEST_TARGET_PMD_CCP |
                            BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
                            BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+                           BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+                           BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
        },
        {
                .test_descr = "HMAC-SHA224 Digest",
@@ -542,7 +567,12 @@ static const struct blockcipher_test_case 
hash_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                            BLOCKCIPHER_TEST_TARGET_PMD_CCP |
                            BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
                            BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+                           BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+                           BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
        },
        {
                .test_descr = "SHA256 Digest Verify",
@@ -551,7 +581,12 @@ static const struct blockcipher_test_case 
hash_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                            BLOCKCIPHER_TEST_TARGET_PMD_CCP |
                            BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
                            BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+                           BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+                           BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
        },
        {
                .test_descr = "HMAC-SHA256 Digest",
@@ -590,7 +625,12 @@ static const struct blockcipher_test_case 
hash_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                            BLOCKCIPHER_TEST_TARGET_PMD_CCP |
                            BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
                            BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+                           BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+                           BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
        },
        {
                .test_descr = "SHA384 Digest Verify",
@@ -599,7 +639,12 @@ static const struct blockcipher_test_case 
hash_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                            BLOCKCIPHER_TEST_TARGET_PMD_CCP |
                            BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
                            BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+                           BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+                           BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
        },
        {
                .test_descr = "HMAC-SHA384 Digest",
@@ -638,7 +683,12 @@ static const struct blockcipher_test_case 
hash_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                            BLOCKCIPHER_TEST_TARGET_PMD_CCP |
                            BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
                            BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+                           BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+                           BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
        },
        {
                .test_descr = "SHA512 Digest Verify",
@@ -647,7 +697,12 @@ static const struct blockcipher_test_case 
hash_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                            BLOCKCIPHER_TEST_TARGET_PMD_CCP |
                            BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
                            BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+                           BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+                           BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
        },
        {
                .test_descr = "HMAC-SHA512 Digest",
-- 
2.13.6

Reply via email to