diff --git a/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c b/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c index 7bbaa04081..52936dacf2 100644 --- a/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c +++ b/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c @@ -534,7 +534,8 @@ odp_crypto_session_create(const odp_crypto_session_param_t *param, *session_out = ODP_CRYPTO_SESSION_INVALID; return -1; } - if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP) { + if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP || + param->op_type == ODP_CRYPTO_OP_TYPE_BASIC_AND_OOP) { *status = ODP_CRYPTO_SES_ERR_PARAMS; *session_out = ODP_CRYPTO_SESSION_INVALID; return -1; diff --git a/platform/linux-generic/odp_crypto_ipsecmb.c b/platform/linux-generic/odp_crypto_ipsecmb.c index 6a847cc6f3..e588440985 100644 --- a/platform/linux-generic/odp_crypto_ipsecmb.c +++ b/platform/linux-generic/odp_crypto_ipsecmb.c @@ -555,7 +555,8 @@ odp_crypto_session_create(const odp_crypto_session_param_t *param, *session_out = ODP_CRYPTO_SESSION_INVALID; return -1; } - if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP) { + if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP || + param->op_type == ODP_CRYPTO_OP_TYPE_BASIC_AND_OOP) { *status = ODP_CRYPTO_SES_ERR_PARAMS; *session_out = ODP_CRYPTO_SESSION_INVALID; return -1; diff --git a/platform/linux-generic/odp_crypto_null.c b/platform/linux-generic/odp_crypto_null.c index 5e3a4e8373..6eda0f4558 100644 --- a/platform/linux-generic/odp_crypto_null.c +++ b/platform/linux-generic/odp_crypto_null.c @@ -219,7 +219,8 @@ odp_crypto_session_create(const odp_crypto_session_param_t *param, *session_out = ODP_CRYPTO_SESSION_INVALID; return -1; } - if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP) { + if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP || + param->op_type == ODP_CRYPTO_OP_TYPE_BASIC_AND_OOP) { *status = ODP_CRYPTO_SES_ERR_PARAMS; *session_out = ODP_CRYPTO_SESSION_INVALID; return -1; diff --git a/platform/linux-generic/odp_crypto_openssl.c b/platform/linux-generic/odp_crypto_openssl.c index 13b027f3ed..879ce0b97a 100644 --- a/platform/linux-generic/odp_crypto_openssl.c +++ b/platform/linux-generic/odp_crypto_openssl.c @@ -2592,6 +2592,9 @@ int crypto_int(odp_packet_t pkt_in, if (odp_likely(session->p.op_type == ODP_CRYPTO_OP_TYPE_BASIC)) { out_pkt = pkt_in; + } else if (session->p.op_type == ODP_CRYPTO_OP_TYPE_BASIC_AND_OOP && + *pkt_out == ODP_PACKET_INVALID) { + out_pkt = pkt_in; } else { out_pkt = get_output_packet(session, pkt_in, *pkt_out); if (odp_unlikely(out_pkt == ODP_PACKET_INVALID)) @@ -2762,10 +2765,19 @@ int odp_crypto_op(const odp_packet_t pkt_in[], session = (odp_crypto_generic_session_t *)(intptr_t)param[i].session; _ODP_ASSERT(ODP_CRYPTO_SYNC == session->p.op_mode); - if (odp_unlikely(session->p.op_type == ODP_CRYPTO_OP_TYPE_OOP)) + if (odp_likely(session->p.op_type == ODP_CRYPTO_OP_TYPE_BASIC)) { + rc = crypto_int(pkt_in[i], &pkt_out[i], ¶m[i]); + } else if (session->p.op_type == ODP_CRYPTO_OP_TYPE_OOP) { rc = crypto_int_oop(pkt_in[i], &pkt_out[i], ¶m[i]); - else + } else if (session->p.op_type == ODP_CRYPTO_OP_TYPE_BASIC_AND_OOP) { + if (pkt_out[i] == ODP_PACKET_INVALID) /* basic */ + rc = crypto_int(pkt_in[i], &pkt_out[i], ¶m[i]); + else /* oop */ + rc = crypto_int_oop(pkt_in[i], &pkt_out[i], ¶m[i]); + } else { + _ODP_ASSERT(session->p.op_type == ODP_CRYPTO_OP_TYPE_LEGACY); rc = crypto_int(pkt_in[i], &pkt_out[i], ¶m[i]); + } if (rc < 0) break; } @@ -2788,13 +2800,22 @@ int odp_crypto_op_enq(const odp_packet_t pkt_in[], _ODP_ASSERT(ODP_CRYPTO_ASYNC == session->p.op_mode); _ODP_ASSERT(ODP_QUEUE_INVALID != session->p.compl_queue); - if (session->p.op_type != ODP_CRYPTO_OP_TYPE_BASIC) + if (odp_likely(session->p.op_type == ODP_CRYPTO_OP_TYPE_BASIC)) { + rc = crypto_int(pkt_in[i], &pkt, ¶m[i]); + } else if (session->p.op_type == ODP_CRYPTO_OP_TYPE_OOP) { pkt = pkt_out[i]; - - if (odp_unlikely(session->p.op_type == ODP_CRYPTO_OP_TYPE_OOP)) rc = crypto_int_oop(pkt_in[i], &pkt, ¶m[i]); - else + } else if (session->p.op_type == ODP_CRYPTO_OP_TYPE_BASIC_AND_OOP) { + pkt = pkt_out[i]; + if (pkt_out[i] == ODP_PACKET_INVALID) /* basic */ + rc = crypto_int(pkt_in[i], &pkt, ¶m[i]); + else /* oop */ + rc = crypto_int_oop(pkt_in[i], &pkt, ¶m[i]); + } else { + _ODP_ASSERT(session->p.op_type == ODP_CRYPTO_OP_TYPE_LEGACY); + pkt = pkt_out[i]; rc = crypto_int(pkt_in[i], &pkt, ¶m[i]); + } if (rc < 0) break;