[dpdk-dev] [PATCH 08/11] examples/ipsec-secgw: iv should be be64

Aviad Yehezkel aviadye at dev.mellanox.co.il
Sun Oct 15 14:55:49 CEST 2017



On 10/14/2017 4:28 PM, aviadye at dev.mellanox.co.il wrote:
> From: Aviad Yehezkel <aviadye at mellanox.com>
>
> To be compatibile with Linux kernel
>
> Signed-off-by: Aviad Yehezkel <aviadye at mellanox.com>
> ---
>   examples/ipsec-secgw/esp.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c
> index aa2233d..81ebf55 100644
> --- a/examples/ipsec-secgw/esp.c
> +++ b/examples/ipsec-secgw/esp.c
> @@ -336,7 +336,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
>   	if (sa->aead_algo == RTE_CRYPTO_AEAD_AES_GCM) {
>   		uint8_t *aad;
>   
> -		*iv = sa->seq;
> +		*iv = rte_cpu_to_be_64(sa->seq);
>   		sym_cop->aead.data.offset = ip_hdr_len +
>   			sizeof(struct esp_hdr) + sa->iv_len;
>   		sym_cop->aead.data.length = pad_payload_len;
> @@ -349,7 +349,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
>   
>   		struct cnt_blk *icb = get_cnt_blk(m);
>   		icb->salt = sa->salt;
> -		icb->iv = sa->seq;
> +		icb->iv = rte_cpu_to_be_64(sa->seq);
>   		icb->cnt = rte_cpu_to_be_32(1);
>   
>   		aad = get_aad(m);
> @@ -371,7 +371,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
>   			sym_cop->cipher.data.length = pad_payload_len + sa->iv_len;
>   			break;
>   		case RTE_CRYPTO_CIPHER_AES_CTR:
> -			*iv = sa->seq;
> +			*iv = rte_cpu_to_be_64(sa->seq);
>   			sym_cop->cipher.data.offset = ip_hdr_len +
>   				sizeof(struct esp_hdr) + sa->iv_len;
>   			sym_cop->cipher.data.length = pad_payload_len;
> @@ -390,7 +390,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
>   
>   		struct cnt_blk *icb = get_cnt_blk(m);
>   		icb->salt = sa->salt;
> -		icb->iv = sa->seq;
> +		icb->iv = rte_cpu_to_be_64(sa->seq);
>   		icb->cnt = rte_cpu_to_be_32(1);
>   
>   		switch (sa->auth_algo) {

Tested-by: Aviad Yehezkel <aviadye at mellanox.com>



More information about the dev mailing list