crypto: add async algo macros for ctr sha2 16/42116/10
authorNithinsen Kaithakadan <[email protected]>
Mon, 6 Jan 2025 12:41:22 +0000 (18:11 +0530)
committerDamjan Marion <[email protected]>
Tue, 21 Jan 2025 13:03:27 +0000 (13:03 +0000)
Add async crypto algo macros for AES_CTR SHA256/384/512.
Add support for these in dev octeon plugin.

Type: feature

Signed-off-by: Nithinsen Kaithakadan <[email protected]>
Change-Id: I22e81c6ac5a549b2f12556b8c79257a20a5bd47d

src/plugins/dev_octeon/crypto.c
src/plugins/dev_octeon/crypto.h
src/vnet/crypto/crypto.h

index b612420..800f24a 100644 (file)
@@ -1250,6 +1250,27 @@ oct_crypto_link_session_update (vlib_main_t *vm, oct_crypto_sess_t *sess,
       auth_type = ROC_SE_SHA1_TYPE;
       digest_len = 12;
       break;
+    case VNET_CRYPTO_ALG_AES_128_CTR_SHA256_TAG16:
+    case VNET_CRYPTO_ALG_AES_192_CTR_SHA256_TAG16:
+    case VNET_CRYPTO_ALG_AES_256_CTR_SHA256_TAG16:
+      enc_type = ROC_SE_AES_CTR;
+      auth_type = ROC_SE_SHA2_SHA256;
+      digest_len = 16;
+      break;
+    case VNET_CRYPTO_ALG_AES_128_CTR_SHA384_TAG24:
+    case VNET_CRYPTO_ALG_AES_192_CTR_SHA384_TAG24:
+    case VNET_CRYPTO_ALG_AES_256_CTR_SHA384_TAG24:
+      enc_type = ROC_SE_AES_CTR;
+      auth_type = ROC_SE_SHA2_SHA384;
+      digest_len = 24;
+      break;
+    case VNET_CRYPTO_ALG_AES_128_CTR_SHA512_TAG32:
+    case VNET_CRYPTO_ALG_AES_192_CTR_SHA512_TAG32:
+    case VNET_CRYPTO_ALG_AES_256_CTR_SHA512_TAG32:
+      enc_type = ROC_SE_AES_CTR;
+      auth_type = ROC_SE_SHA2_SHA512;
+      digest_len = 32;
+      break;
     case VNET_CRYPTO_ALG_3DES_CBC_MD5_TAG12:
       enc_type = ROC_SE_DES3_CBC;
       auth_type = ROC_SE_MD5_TYPE;
index b003a60..5bd26f6 100644 (file)
   _ (3DES_CBC, SHA512, 24, 32)                                                \
   _ (AES_128_CTR, SHA1, 16, 12)                                               \
   _ (AES_192_CTR, SHA1, 24, 12)                                               \
-  _ (AES_256_CTR, SHA1, 32, 12)
+  _ (AES_256_CTR, SHA1, 32, 12)                                               \
+  _ (AES_128_CTR, SHA256, 16, 16)                                             \
+  _ (AES_192_CTR, SHA256, 24, 16)                                             \
+  _ (AES_256_CTR, SHA256, 32, 16)                                             \
+  _ (AES_128_CTR, SHA384, 16, 24)                                             \
+  _ (AES_192_CTR, SHA384, 24, 24)                                             \
+  _ (AES_256_CTR, SHA384, 32, 24)                                             \
+  _ (AES_128_CTR, SHA512, 16, 32)                                             \
+  _ (AES_192_CTR, SHA512, 24, 32)                                             \
+  _ (AES_256_CTR, SHA512, 32, 32)
 
 #define OCT_MOD_INC(i, l) ((i) == (l - 1) ? (i) = 0 : (i)++)
 
index ae95925..a4b6ab9 100644 (file)
@@ -121,7 +121,16 @@ typedef enum
   _ (AES_256_CBC, SHA512, "aes-256-cbc-hmac-sha-512", 32, 32)                 \
   _ (AES_128_CTR, SHA1, "aes-128-ctr-hmac-sha-1", 16, 12)                     \
   _ (AES_192_CTR, SHA1, "aes-192-ctr-hmac-sha-1", 24, 12)                     \
-  _ (AES_256_CTR, SHA1, "aes-256-ctr-hmac-sha-1", 32, 12)
+  _ (AES_256_CTR, SHA1, "aes-256-ctr-hmac-sha-1", 32, 12)                     \
+  _ (AES_128_CTR, SHA256, "aes-128-ctr-hmac-sha-256", 16, 16)                 \
+  _ (AES_192_CTR, SHA256, "aes-192-ctr-hmac-sha-256", 24, 16)                 \
+  _ (AES_256_CTR, SHA256, "aes-256-ctr-hmac-sha-256", 32, 16)                 \
+  _ (AES_128_CTR, SHA384, "aes-128-ctr-hmac-sha-384", 16, 24)                 \
+  _ (AES_192_CTR, SHA384, "aes-192-ctr-hmac-sha-384", 24, 24)                 \
+  _ (AES_256_CTR, SHA384, "aes-256-ctr-hmac-sha-384", 32, 24)                 \
+  _ (AES_128_CTR, SHA512, "aes-128-ctr-hmac-sha-512", 16, 32)                 \
+  _ (AES_192_CTR, SHA512, "aes-192-ctr-hmac-sha-512", 24, 32)                 \
+  _ (AES_256_CTR, SHA512, "aes-256-ctr-hmac-sha-512", 32, 32)
 
 typedef enum
 {