aboutsummaryrefslogtreecommitdiff
path: root/example/ipsec_crypto
diff options
context:
space:
mode:
authorJanne Peltonen <janne.peltonen@nokia.com>2023-02-20 19:29:30 +0200
committerMatias Elo <matias.elo@nokia.com>2023-04-12 15:52:37 +0300
commitadea8b08b8f95cc61d67650e4b1f63aac996f068 (patch)
treedb1129705701f38a67ec230b83f034d042f6d49c /example/ipsec_crypto
parent5fd47520a2727b02d74e4b1e05b5e7f2048562bb (diff)
example: ipsec_crypto: simplify crypto operation result checking
Check only odp_crypto_packet_result_t::ok to see if a crypto operation succeeded. There is no need to check the status fields to second-guess the validity of the ok field. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Anoob Joseph <anoobj@marvell.com>
Diffstat (limited to 'example/ipsec_crypto')
-rw-r--r--example/ipsec_crypto/odp_ipsec.c18
-rw-r--r--example/ipsec_crypto/odp_ipsec_misc.h18
2 files changed, 6 insertions, 30 deletions
diff --git a/example/ipsec_crypto/odp_ipsec.c b/example/ipsec_crypto/odp_ipsec.c
index c5dd7398e..dc56d671d 100644
--- a/example/ipsec_crypto/odp_ipsec.c
+++ b/example/ipsec_crypto/odp_ipsec.c
@@ -714,12 +714,9 @@ pkt_disposition_e do_ipsec_in_finish(odp_packet_t pkt,
odp_crypto_result(&result, pkt);
/* Check crypto result */
- if (!result.ok) {
- if (!is_crypto_op_status_ok(&result.cipher_status))
- return PKT_DROP;
- if (!is_crypto_op_status_ok(&result.auth_status))
- return PKT_DROP;
- }
+ if (!result.ok)
+ return PKT_DROP;
+
ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
/*
@@ -1025,12 +1022,9 @@ pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt,
odp_crypto_result(&result, pkt);
/* Check crypto result */
- if (!result.ok) {
- if (!is_crypto_op_status_ok(&result.cipher_status))
- return PKT_DROP;
- if (!is_crypto_op_status_ok(&result.auth_status))
- return PKT_DROP;
- }
+ if (!result.ok)
+ return PKT_DROP;
+
ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
/* Finalize the IPv4 header */
diff --git a/example/ipsec_crypto/odp_ipsec_misc.h b/example/ipsec_crypto/odp_ipsec_misc.h
index 6186a2369..9f9985c57 100644
--- a/example/ipsec_crypto/odp_ipsec_misc.h
+++ b/example/ipsec_crypto/odp_ipsec_misc.h
@@ -321,24 +321,6 @@ void ipv4_adjust_len(odph_ipv4hdr_t *ip, int adj)
ip->tot_len = odp_cpu_to_be_16(odp_be_to_cpu_16(ip->tot_len) + adj);
}
-/**
- * Verify crypto operation completed successfully
- *
- * @param status Pointer to cryto completion structure
- *
- * @return TRUE if all OK else FALSE
- */
-static inline
-odp_bool_t is_crypto_op_status_ok(odp_crypto_op_status_t *status)
-{
- if (status->alg_err != ODP_CRYPTO_ALG_ERR_NONE)
- return FALSE;
- if (status->hw_err != ODP_CRYPTO_HW_ERR_NONE)
- return FALSE;
- return TRUE;
-}
-
-
#ifdef __cplusplus
}
#endif