crypto-ipsecmb: use single GCM API 03/23603/4
authorFan Zhang <roy.fan.zhang@intel.com>
Fri, 22 Nov 2019 11:40:23 +0000 (11:40 +0000)
committerDamjan Marion <dmarion@me.com>
Fri, 22 Nov 2019 18:37:10 +0000 (18:37 +0000)
Type: refactor

Use ipsecmb single GCM enc/dec API to furthuer improve single
buffer performance for small packets.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Change-Id: I2d34ff50d34b09f194fc0c88b6e9a3928a86fc33

src/plugins/crypto_ipsecmb/ipsecmb.c

index 30f5338..a9edd98 100644 (file)
@@ -279,9 +279,8 @@ ipsecmb_ops_gcm_cipher_enc_##a (vlib_main_t * vm, vnet_crypto_op_t * ops[],  \
       vnet_crypto_op_t *op = ops[i];                                         \
                                                                              \
       kd = (struct gcm_key_data *) imbm->key_data[op->key_index];            \
-      IMB_AES##b##_GCM_INIT(m, kd, &ctx, op->iv, op->aad, op->aad_len);      \
-      IMB_AES##b##_GCM_ENC_UPDATE(m, kd, &ctx, op->dst, op->src, op->len);   \
-      IMB_AES##b##_GCM_ENC_FINALIZE(m, kd, &ctx, op->tag, op->tag_len);      \
+      IMB_AES##b##_GCM_ENC (m, kd, &ctx, op->dst, op->src, op->len, op->iv,  \
+                            op->aad, op->aad_len, op->tag, op->tag_len);     \
                                                                              \
       op->status = VNET_CRYPTO_OP_STATUS_COMPLETED;                          \
     }                                                                        \
@@ -307,9 +306,8 @@ ipsecmb_ops_gcm_cipher_dec_##a (vlib_main_t * vm, vnet_crypto_op_t * ops[],  \
       u8 scratch[64];                                                        \
                                                                              \
       kd = (struct gcm_key_data *) imbm->key_data[op->key_index];            \
-      IMB_AES##b##_GCM_INIT(m, kd, &ctx, op->iv, op->aad, op->aad_len);      \
-      IMB_AES##b##_GCM_DEC_UPDATE(m, kd, &ctx, op->dst, op->src, op->len);   \
-      IMB_AES##b##_GCM_DEC_FINALIZE(m, kd, &ctx, scratch, op->tag_len);      \
+      IMB_AES##b##_GCM_DEC (m, kd, &ctx, op->dst, op->src, op->len, op->iv,  \
+                            op->aad, op->aad_len, scratch, op->tag_len);     \
                                                                              \
       if ((memcmp (op->tag, scratch, op->tag_len)))                          \
         {                                                                    \