crypto/openssl: support 8-byte 3DES
authorMarko Kovacevic <marko.kovacevic@intel.com>
Tue, 12 Jun 2018 10:39:25 +0000 (11:39 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Mon, 23 Jul 2018 23:48:10 +0000 (01:48 +0200)
Added extra case to support 8 byte key size
for 3DES CBC. Also changed capabilities to reflect
the change.

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
drivers/crypto/openssl/rte_openssl_pmd.c
drivers/crypto/openssl/rte_openssl_pmd_ops.c
test/test/test_cryptodev_des_test_vectors.h

index 10a258f..96b0fd2 100644 (file)
@@ -137,6 +137,9 @@ get_cipher_algo(enum rte_crypto_cipher_algorithm sess_algo, size_t keylen,
                switch (sess_algo) {
                case RTE_CRYPTO_CIPHER_3DES_CBC:
                        switch (keylen) {
+                       case 8:
+                               *algo = EVP_des_cbc();
+                               break;
                        case 16:
                                *algo = EVP_des_ede_cbc();
                                break;
index 5335685..05f452d 100644 (file)
@@ -397,7 +397,7 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {
                                .algo = RTE_CRYPTO_CIPHER_3DES_CBC,
                                .block_size = 8,
                                .key_size = {
-                                       .min = 16,
+                                       .min = 8,
                                        .max = 24,
                                        .increment = 8
                                },
index 4217b72..7479e70 100644 (file)
@@ -1232,13 +1232,15 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
                .test_descr = "3DES-64-CBC Encryption",
                .test_data = &triple_des64cbc_test_vector,
                .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
+                       BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
        },
        {
                .test_descr = "3DES-64-CBC Decryption",
                .test_data = &triple_des64cbc_test_vector,
                .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
+                       BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
        },
        {
                .test_descr = "3DES-128-CBC Encryption",