On 9/15/2017 3:09 AM, Pablo de Lara wrote:
The Multi-buffer library now supports DES-CBC
and DES-DOCSISBPI algorithms, so this commit
extends adds support for them in the PMD.

Signed-off-by: Pablo de Lara <pablo.de.lara.gua...@intel.com>
Acked-by: Fan Zhang <roy.fan.zh...@intel.com>
---
  doc/guides/cryptodevs/aesni_mb.rst             |  2 +
  doc/guides/cryptodevs/features/aesni_mb.ini    |  3 ++
  doc/guides/rel_notes/release_17_11.rst         |  7 +++
  drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c     | 74 ++++++++++++++++++--------
  drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 42 +++++++++++++++
  test/test/test_cryptodev.c                     | 42 +++++++++++++++
  test/test/test_cryptodev_des_test_vectors.h    | 24 ++++++---
  7 files changed, 163 insertions(+), 31 deletions(-)

<snip>
+#include <des.h>
+
  #include <rte_common.h>
  #include <rte_hexdump.h>
  #include <rte_cryptodev.h>
@@ -188,6 +190,7 @@ aesni_mb_set_session_cipher_parameters(const struct 
aesni_mb_op_fns *mb_ops,
                struct aesni_mb_session *sess,
                const struct rte_crypto_sym_xform *xform)
  {
+       uint8_t is_aes;
Nitpicking: Maybe initialize with zero and remove is_aes = 0; from the switch body?
        aes_keyexp_t aes_keyexp_fn;
if (xform == NULL) {
@@ -217,45 +220,70 @@ aesni_mb_set_session_cipher_parameters(const struct 
aesni_mb_op_fns *mb_ops,
        switch (xform->cipher.algo) {
        case RTE_CRYPTO_CIPHER_AES_CBC:
                sess->cipher.mode = CBC;
+               is_aes = 1;
                break;
        case RTE_CRYPTO_CIPHER_AES_CTR:
                sess->cipher.mode = CNTR;
+               is_aes = 1;
                break;
        case RTE_CRYPTO_CIPHER_AES_DOCSISBPI:
                sess->cipher.mode = DOCSIS_SEC_BPI;
+               is_aes = 1;
                break;
-       default:
-               MB_LOG_ERR("Unsupported cipher mode parameter");
-               return -ENOTSUP;
-       }
-
-       /* Check key length and choose key expansion function */
-       switch (xform->cipher.key.length) {
-       case AES_128_BYTES:
-               sess->cipher.key_length_in_bytes = AES_128_BYTES;
-               aes_keyexp_fn = mb_ops->aux.keyexp.aes128;
+       case RTE_CRYPTO_CIPHER_DES_CBC:
+               sess->cipher.mode = DES;
+               is_aes = 0;
                break;
-       case AES_192_BYTES:
-               sess->cipher.key_length_in_bytes = AES_192_BYTES;
-               aes_keyexp_fn = mb_ops->aux.keyexp.aes192;
-               break;
-       case AES_256_BYTES:
-               sess->cipher.key_length_in_bytes = AES_256_BYTES;
-               aes_keyexp_fn = mb_ops->aux.keyexp.aes256;
+       case RTE_CRYPTO_CIPHER_DES_DOCSISBPI:
+               sess->cipher.mode = DOCSIS_DES;
+               is_aes = 0;
                break;
        default:
-               MB_LOG_ERR("Invalid cipher key length");
-               return -EINVAL;
+               MB_LOG_ERR("Unsupported cipher mode parameter");
+               return -ENOTSUP;
        }
<snip>
Reviewed-by:  Radu Nicolau <radu.nico...@intel.com>

Reply via email to