cryptodev: enable BPI for Cablelabs DOCSIS security spec
[dpdk.git] / lib / librte_cryptodev / rte_cryptodev.c
index fedb9d0..0ac23ed 100644 (file)
@@ -126,6 +126,7 @@ rte_crypto_cipher_algorithm_strings[] = {
        [RTE_CRYPTO_CIPHER_AES_CBC]     = "aes-cbc",
        [RTE_CRYPTO_CIPHER_AES_CCM]     = "aes-ccm",
        [RTE_CRYPTO_CIPHER_AES_CTR]     = "aes-ctr",
+       [RTE_CRYPTO_CIPHER_AES_DOCSISBPI]       = "aes-docsisbpi",
        [RTE_CRYPTO_CIPHER_AES_ECB]     = "aes-ecb",
        [RTE_CRYPTO_CIPHER_AES_GCM]     = "aes-gcm",
        [RTE_CRYPTO_CIPHER_AES_F8]      = "aes-f8",
@@ -134,6 +135,7 @@ rte_crypto_cipher_algorithm_strings[] = {
        [RTE_CRYPTO_CIPHER_ARC4]        = "arc4",
 
        [RTE_CRYPTO_CIPHER_DES_CBC]     = "des-cbc",
+       [RTE_CRYPTO_CIPHER_DES_DOCSISBPI]       = "des-docsisbpi",
 
        [RTE_CRYPTO_CIPHER_NULL]        = "null",
 
@@ -187,6 +189,40 @@ rte_crypto_auth_algorithm_strings[] = {
        [RTE_CRYPTO_AUTH_ZUC_EIA3]      = "zuc-eia3"
 };
 
+int
+rte_cryptodev_get_cipher_algo_enum(enum rte_crypto_cipher_algorithm *algo_enum,
+               const char *algo_string)
+{
+       unsigned int i;
+
+       for (i = 1; i < RTE_DIM(rte_crypto_cipher_algorithm_strings); i++) {
+               if (strcmp(algo_string, rte_crypto_cipher_algorithm_strings[i]) == 0) {
+                       *algo_enum = (enum rte_crypto_cipher_algorithm) i;
+                       return 0;
+               }
+       }
+
+       /* Invalid string */
+       return -1;
+}
+
+int
+rte_cryptodev_get_auth_algo_enum(enum rte_crypto_auth_algorithm *algo_enum,
+               const char *algo_string)
+{
+       unsigned int i;
+
+       for (i = 1; i < RTE_DIM(rte_crypto_auth_algorithm_strings); i++) {
+               if (strcmp(algo_string, rte_crypto_auth_algorithm_strings[i]) == 0) {
+                       *algo_enum = (enum rte_crypto_auth_algorithm) i;
+                       return 0;
+               }
+       }
+
+       /* Invalid string */
+       return -1;
+}
+
 /**
  * The crypto auth operation strings identifiers.
  * It could be used in application command line.