@@ -127,6 +127,7 @@ struct ipsec_sa_s {
unsigned dec_ttl : 1;
unsigned copy_dscp : 1;
unsigned copy_df : 1;
+ unsigned aes_ctr_iv : 1;
/* Only for outbound */
unsigned use_counter_iv : 1;
@@ -337,6 +337,13 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
goto err;
}
+ if (ipsec_sa->aes_ctr_iv) {
+ iv[12] = 0;
+ iv[13] = 0;
+ iv[14] = 0;
+ iv[15] = 1;
+ }
+
hdr_len = _ODP_ESPHDR_LEN + ipsec_sa->esp_iv_len;
trl_len = _ODP_ESPTRL_LEN + ipsec_sa->icv_len;
@@ -729,6 +736,12 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,
memcpy(iv + ipsec_sa->salt_length, &ctr,
ipsec_sa->esp_iv_len);
+ if (ipsec_sa->aes_ctr_iv) {
+ iv[12] = 0;
+ iv[13] = 0;
+ iv[14] = 0;
+ iv[15] = 1;
+ }
} else if (ipsec_sa->esp_iv_len) {
uint32_t len;
@@ -319,6 +319,13 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param)
ipsec_sa->esp_block_len = 16;
crypto_param.iv.length = 16;
break;
+ case ODP_CIPHER_ALG_AES_CTR:
+ ipsec_sa->use_counter_iv = 1;
+ ipsec_sa->aes_ctr_iv = 1;
+ ipsec_sa->esp_iv_len = 8;
+ ipsec_sa->esp_block_len = 16;
+ crypto_param.iv.length = 16;
+ break;
#if ODP_DEPRECATED_API
case ODP_CIPHER_ALG_AES128_GCM:
#endif