aboutsummaryrefslogtreecommitdiff
path: root/include/odp
diff options
context:
space:
mode:
Diffstat (limited to 'include/odp')
-rw-r--r--include/odp/api/abi-default/buffer.h15
-rw-r--r--include/odp/api/abi-default/buffer_types.h34
-rw-r--r--include/odp/api/abi-default/crypto.h19
-rw-r--r--include/odp/api/abi-default/crypto_types.h37
-rw-r--r--include/odp/api/buffer_types.h28
-rw-r--r--include/odp/api/crypto.h12
-rw-r--r--include/odp/api/crypto_types.h28
-rw-r--r--include/odp/api/spec/buffer.h15
-rw-r--r--include/odp/api/spec/buffer_types.h45
-rw-r--r--include/odp/api/spec/crypto.h1162
-rw-r--r--include/odp/api/spec/crypto_types.h1102
-rw-r--r--include/odp/api/spec/ipsec.h2
-rw-r--r--include/odp/api/spec/ipsec_types.h2
-rw-r--r--include/odp/api/spec/packet_flags.h37
-rw-r--r--include/odp/api/spec/packet_io.h33
-rw-r--r--include/odp/api/spec/packet_io_stats.h15
-rw-r--r--include/odp/api/spec/packet_io_types.h1
-rw-r--r--include/odp/api/spec/shared_memory.h13
-rw-r--r--include/odp/api/spec/timer.h5
-rw-r--r--include/odp/api/spec/timer_types.h42
-rw-r--r--include/odp/api/spec/traffic_mngr.h45
-rw-r--r--include/odp/arch/arm32-linux/odp/api/abi/buffer_types.h7
-rw-r--r--include/odp/arch/arm32-linux/odp/api/abi/crypto_types.h7
-rw-r--r--include/odp/arch/arm64-linux/odp/api/abi/buffer_types.h7
-rw-r--r--include/odp/arch/arm64-linux/odp/api/abi/crypto_types.h7
-rw-r--r--include/odp/arch/default-linux/odp/api/abi/buffer_types.h7
-rw-r--r--include/odp/arch/default-linux/odp/api/abi/crypto_types.h7
-rw-r--r--include/odp/arch/power64-linux/odp/api/abi/buffer_types.h7
-rw-r--r--include/odp/arch/power64-linux/odp/api/abi/crypto_types.h7
-rw-r--r--include/odp/arch/x86_32-linux/odp/api/abi/buffer_types.h7
-rw-r--r--include/odp/arch/x86_32-linux/odp/api/abi/crypto_types.h7
-rw-r--r--include/odp/arch/x86_64-linux/odp/api/abi/buffer_types.h7
-rw-r--r--include/odp/arch/x86_64-linux/odp/api/abi/crypto_types.h7
-rw-r--r--include/odp/autoheader_external.h.in3
-rw-r--r--include/odp/autoheader_internal.h.in3
35 files changed, 1534 insertions, 1248 deletions
diff --git a/include/odp/api/abi-default/buffer.h b/include/odp/api/abi-default/buffer.h
index 2bc27bba7..59b81186b 100644
--- a/include/odp/api/abi-default/buffer.h
+++ b/include/odp/api/abi-default/buffer.h
@@ -11,20 +11,7 @@
extern "C" {
#endif
-/** @internal Dummy type for strong typing */
-typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_buffer_t;
-
-/** @ingroup odp_buffer
- * @{
- */
-
-typedef _odp_abi_buffer_t *odp_buffer_t;
-
-#define ODP_BUFFER_INVALID ((odp_buffer_t)0)
-
-/**
- * @}
- */
+/* Empty header required due to the inline functions */
#ifdef __cplusplus
}
diff --git a/include/odp/api/abi-default/buffer_types.h b/include/odp/api/abi-default/buffer_types.h
new file mode 100644
index 000000000..f01466151
--- /dev/null
+++ b/include/odp/api/abi-default/buffer_types.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2017-2018, Linaro Limited
+ * Copyright (c) 2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_ABI_BUFFER_TYPES_H_
+#define ODP_ABI_BUFFER_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @internal Dummy type for strong typing */
+typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_buffer_t;
+
+/** @ingroup odp_buffer
+ * @{
+ */
+
+typedef _odp_abi_buffer_t *odp_buffer_t;
+
+#define ODP_BUFFER_INVALID ((odp_buffer_t)0)
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/odp/api/abi-default/crypto.h b/include/odp/api/abi-default/crypto.h
index e7c0a651c..0e9e8506a 100644
--- a/include/odp/api/abi-default/crypto.h
+++ b/include/odp/api/abi-default/crypto.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2017-2018, Linaro Limited
+ * Copyright (c) 2022, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -11,23 +12,7 @@
extern "C" {
#endif
-#include <stdint.h>
-
-/** @internal Dummy type for strong typing */
-typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_crypto_compl_t;
-
-/** @ingroup odp_crypto
- * @{
- */
-
-#define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL)
-
-typedef uint64_t odp_crypto_session_t;
-typedef _odp_abi_crypto_compl_t *odp_crypto_compl_t;
-
-/**
- * @}
- */
+/* Empty header required due to the inline functions */
#ifdef __cplusplus
}
diff --git a/include/odp/api/abi-default/crypto_types.h b/include/odp/api/abi-default/crypto_types.h
new file mode 100644
index 000000000..cc9155bfa
--- /dev/null
+++ b/include/odp/api/abi-default/crypto_types.h
@@ -0,0 +1,37 @@
+/* Copyright (c) 2017-2018, Linaro Limited
+ * Copyright (c) 2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_ABI_CRYPTO_TYPES_H_
+#define ODP_ABI_CRYPTO_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/** @internal Dummy type for strong typing */
+typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_crypto_compl_t;
+
+/** @ingroup odp_crypto
+ * @{
+ */
+
+#define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL)
+
+typedef uint64_t odp_crypto_session_t;
+typedef _odp_abi_crypto_compl_t *odp_crypto_compl_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/odp/api/buffer_types.h b/include/odp/api/buffer_types.h
new file mode 100644
index 000000000..767aae560
--- /dev/null
+++ b/include/odp/api/buffer_types.h
@@ -0,0 +1,28 @@
+/* Copyright (c) 2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP buffer types
+ */
+
+#ifndef ODP_API_BUFFER_TYPES_H_
+#define ODP_API_BUFFER_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/abi/buffer_types.h>
+
+#include <odp/api/spec/buffer_types.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index ec7c8370b..336304553 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -17,19 +17,7 @@
extern "C" {
#endif
-#include <odp/api/std_types.h>
-#include <odp/api/abi/packet_types.h>
#include <odp/api/abi/crypto.h>
-#include <odp/api/abi/buffer.h>
-#include <odp/api/abi/queue_types.h>
-
-/** @ingroup odp_crypto
- * @{
- */
-
-/**
- * @}
- */
#include <odp/api/spec/crypto.h>
diff --git a/include/odp/api/crypto_types.h b/include/odp/api/crypto_types.h
new file mode 100644
index 000000000..225ff7df0
--- /dev/null
+++ b/include/odp/api/crypto_types.h
@@ -0,0 +1,28 @@
+/* Copyright (c) 2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP crypto
+ */
+
+#ifndef ODP_API_CRYPTO_TYPES_H_
+#define ODP_API_CRYPTO_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/abi/crypto_types.h>
+
+#include <odp/api/spec/crypto_types.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/odp/api/spec/buffer.h b/include/odp/api/spec/buffer.h
index cfb85df17..dd3749afe 100644
--- a/include/odp/api/spec/buffer.h
+++ b/include/odp/api/spec/buffer.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2013-2018, Linaro Limited
- * Copyright (c) 2022, Nokia
+ * Copyright (c) 2022-2023, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -8,7 +8,7 @@
/**
* @file
*
- * ODP buffer descriptor
+ * ODP buffer
*/
#ifndef ODP_API_SPEC_BUFFER_H_
@@ -19,6 +19,7 @@
extern "C" {
#endif
+#include <odp/api/buffer_types.h>
#include <odp/api/event_types.h>
#include <odp/api/pool_types.h>
#include <odp/api/std_types.h>
@@ -29,16 +30,6 @@ extern "C" {
*/
/**
- * @typedef odp_buffer_t
- * ODP buffer
- */
-
-/**
- * @def ODP_BUFFER_INVALID
- * Invalid buffer
- */
-
-/**
* Get buffer handle from event
*
* Converts an ODP_EVENT_BUFFER type event to a buffer.
diff --git a/include/odp/api/spec/buffer_types.h b/include/odp/api/spec/buffer_types.h
new file mode 100644
index 000000000..7a7bc770f
--- /dev/null
+++ b/include/odp/api/spec/buffer_types.h
@@ -0,0 +1,45 @@
+/* Copyright (c) 2013-2018, Linaro Limited
+ * Copyright (c) 2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP buffer types
+ */
+
+#ifndef ODP_API_SPEC_BUFFER_TYPES_H_
+#define ODP_API_SPEC_BUFFER_TYPES_H_
+#include <odp/visibility_begin.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup odp_buffer
+ * @{
+ */
+
+/**
+ * @typedef odp_buffer_t
+ * ODP buffer
+ */
+
+/**
+ * @def ODP_BUFFER_INVALID
+ * Invalid buffer
+ */
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <odp/visibility_end.h>
+#endif
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index a79a05ad3..4292b78c1 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2014-2018, Linaro Limited
- * Copyright (c) 2021-2022, Nokia
+ * Copyright (c) 2021-2023, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -15,9 +15,9 @@
#define ODP_API_SPEC_CRYPTO_H_
#include <odp/visibility_begin.h>
+#include <odp/api/crypto_types.h>
#include <odp/api/deprecated.h>
#include <odp/api/packet_types.h>
-#include <odp/api/pool_types.h>
#include <odp/api/std_types.h>
#ifdef __cplusplus
@@ -30,1062 +30,6 @@ extern "C" {
*/
/**
- * @def ODP_CRYPTO_SESSION_INVALID
- * Invalid session handle
- */
-
-/**
- * @typedef odp_crypto_session_t
- * Crypto API opaque session handle
- */
-
-/**
- * @typedef odp_crypto_compl_t
-* @deprecated Crypto API completion event (platform dependent).
-*/
-
-/**
- * Crypto API operation mode
- */
-typedef enum {
- /** Synchronous, return results immediately */
- ODP_CRYPTO_SYNC,
- /** Asynchronous, return results via posted event */
- ODP_CRYPTO_ASYNC,
-} odp_crypto_op_mode_t;
-
-/**
- * Crypto API operation type
- */
-typedef enum {
- /** Encrypt and/or compute authentication ICV */
- ODP_CRYPTO_OP_ENCODE,
- /** Decrypt and/or verify authentication ICV */
- ODP_CRYPTO_OP_DECODE,
-} odp_crypto_op_t;
-
-/**
- * Crypto API cipher algorithm
- */
-typedef enum {
- /** No cipher algorithm specified */
- ODP_CIPHER_ALG_NULL,
-
- /** DES */
- ODP_CIPHER_ALG_DES,
-
- /** Triple DES with cipher block chaining */
- ODP_CIPHER_ALG_3DES_CBC,
-
- /** Triple DES with Electronic Codebook */
- ODP_CIPHER_ALG_3DES_ECB,
-
- /** AES with cipher block chaining */
- ODP_CIPHER_ALG_AES_CBC,
-
- /** AES with counter mode */
- ODP_CIPHER_ALG_AES_CTR,
-
- /** AES with electronic codebook */
- ODP_CIPHER_ALG_AES_ECB,
-
- /** AES with 128-bit cipher feedback */
- ODP_CIPHER_ALG_AES_CFB128,
-
- /** AES with XEX-based tweaked-codebook mode with ciphertext stealing
- * (XTS) */
- ODP_CIPHER_ALG_AES_XTS,
-
- /** AES-GCM
- *
- * AES in Galois/Counter Mode (GCM) algorithm. GCM provides both
- * authentication and ciphering of data (authenticated encryption)
- * in the same operation. Hence this algorithm must be paired always
- * with ODP_AUTH_ALG_AES_GCM authentication.
- */
- ODP_CIPHER_ALG_AES_GCM,
-
- /** AES-CCM
- *
- * AES in Counter with CBC-MAC (CCM) mode algorithm. CCM provides both
- * authentication and ciphering of data (authenticated encryption)
- * in the same operation. Hence this algorithm must be paired always
- * with ODP_AUTH_ALG_AES_CCM authentication.
- */
- ODP_CIPHER_ALG_AES_CCM,
-
- /** ChaCha20-Poly1305
- *
- * ChaCha20 with Poly1305 provide both authentication and ciphering of
- * data (authenticated encryption) in the same operation. Hence this
- * algorithm must be paired always with ODP_AUTH_ALG_CHACHA20_POLY1305
- * authentication.
- */
- ODP_CIPHER_ALG_CHACHA20_POLY1305,
-
- /** Confidentiality F8 algorithm (UEA1)
- *
- * KASUMI-based F8 algorithm (also known as UEA1).
- *
- * IV should be formatted according to the 3GPP TS 35.201:
- * COUNT || BEARER || DIRECTION || 0...0
- */
- ODP_CIPHER_ALG_KASUMI_F8,
-
- /** Confidentiality UEA2 algorithm (128-EEA1)
- *
- * SNOW 3G-based UEA2 algorithm (also known as 128-EEA1).
- *
- * IV (128 bit) should be formatted according to the ETSI/SAGE
- * UEA2 & UIA2 specification:
- * COUNT || BEARER || DIRECTION || 0...0 ||
- * COUNT || BEARER || DIRECTION || 0...0 ||
- */
- ODP_CIPHER_ALG_SNOW3G_UEA2,
-
- /** Confidentiality 128-EEA2 algorithm
- *
- * AES-CTR-based 128-EEA2 algorithm.
- *
- * IV (128 bit) should be formatted according to the ETSI/SAGE
- * 128-EA2 & 128-EIA2 specification:
- * COUNT || BEARER ||
- * DIRECTION || 0....0
- */
- ODP_CIPHER_ALG_AES_EEA2,
-
- /** ZUC based confidentiality algorithm
- *
- * 128-EEA3/128-NEA3 algorithm when key length is 128 bits.
- *
- * IV (128 bit) should be formatted according to the ETSI/SAGE
- * 128-EEA3 & 128-EIA3 specification:
- * COUNT || BEARER || DIRECTION || 0...0 ||
- * COUNT || BEARER || DIRECTION || 0...0 ||
- *
- * 256-bit key length support is experimental and subject to
- * change. The following variants may be supported:
- *
- * - ZUC-256 with 25 byte IV (of which 184 bits are variable)
- * as specified in "The ZUC-256 Stream Cipher".
- * - ZUC-256 with 16 byte IV as specified in
- * "An Addendum to the ZUC-256 Stream Cipher",
- * https://eprint.iacr.org/2021/1439
- */
- ODP_CIPHER_ALG_ZUC_EEA3,
-
-} odp_cipher_alg_t;
-
-/**
- * Crypto API authentication algorithm
- */
-typedef enum {
- /** No authentication algorithm specified */
- ODP_AUTH_ALG_NULL,
-
- /** HMAC-MD5
- *
- * MD5 algorithm in HMAC mode
- */
- ODP_AUTH_ALG_MD5_HMAC,
-
- /** HMAC-SHA-1
- *
- * SHA-1 algorithm in HMAC mode
- */
- ODP_AUTH_ALG_SHA1_HMAC,
-
- /** HMAC-SHA-224
- *
- * SHA-224 algorithm in HMAC mode
- */
- ODP_AUTH_ALG_SHA224_HMAC,
-
- /** HMAC-SHA-256
- *
- * SHA-256 algorithm in HMAC mode
- */
- ODP_AUTH_ALG_SHA256_HMAC,
-
- /** HMAC-SHA-384
- *
- * SHA-384 algorithm in HMAC mode
- */
- ODP_AUTH_ALG_SHA384_HMAC,
-
- /** HMAC-SHA-512
- *
- * SHA-512 algorithm in HMAC mode
- */
- ODP_AUTH_ALG_SHA512_HMAC,
-
- /** AES-GCM
- *
- * AES in Galois/Counter Mode (GCM) algorithm. GCM provides both
- * authentication and ciphering of data (authenticated encryption)
- * in the same operation. Hence this algorithm must be paired always
- * with ODP_CIPHER_ALG_AES_GCM cipher.
- */
- ODP_AUTH_ALG_AES_GCM,
-
- /** AES-GMAC
- *
- * AES Galois Message Authentication Code (GMAC) algorithm. AES-GMAC
- * is based on AES-GCM operation, but provides authentication only.
- * Hence this algorithm can be paired only with ODP_CIPHER_ALG_NULL
- * cipher.
- *
- * NIST and RFC specifications of GMAC refer to all data to be
- * authenticated as AAD. In ODP the data to be authenticated, i.e.
- * AAD, is ODP packet data and specified using the auth_range
- * parameter. The aad_length and aad_ptr parameters, which would
- * require the data to be contiguous in memory, are ignored with
- * AES-GMAC.
- *
- * GMAC needs an initialization vector, which can be passed via
- * session (auth_iv) or packet (auth_iv_ptr) level parameters.
- */
- ODP_AUTH_ALG_AES_GMAC,
-
- /** AES-CCM
- *
- * AES in Counter with CBC-MAC (CCM) mode algorithm. CCM provides both
- * authentication and ciphering of data (authenticated encryption)
- * in the same operation. Hence this algorithm must be paired always
- * with ODP_CIPHER_ALG_AES_CCM cipher.
- */
- ODP_AUTH_ALG_AES_CCM,
-
- /** AES-CMAC
- *
- * AES Cipher-based Message Authentication Code (CMAC) algorithm. CMAC
- * is a keyed hash function that is based on a symmetric key block
- * cipher, such as the AES.
- */
- ODP_AUTH_ALG_AES_CMAC,
-
- /** AES-XCBC-MAC
- *
- * AES CBC MAC for arbitrary-length messages (XCBC-MAC).
- *
- */
- ODP_AUTH_ALG_AES_XCBC_MAC,
-
- /** ChaCha20-Poly1305 AEAD
- *
- * ChaCha20 with Poly1305 provide both authentication and ciphering of
- * data (authenticated encryption) in the same operation. Hence this
- * algorithm must be paired always with
- * ODP_CIPHER_ALG_CHACHA20_POLY1305 cipher.
- */
- ODP_AUTH_ALG_CHACHA20_POLY1305,
-
- /** Integrity F9 algorithm (UIA1)
- *
- * KASUMI-based F9 algorithm (also known as UIA1).
- *
- * IV (9 bytes) is a concatenation of COUNT (32b), FRESH (32b) and
- * DIRECTION (LSB-aligned, 1b).
- * IV (8 bytes) is a concatenation of COUNT (32b) and FRESH (32b)
- * DIRECTION (1b) and padding should come at the end of message.
- */
- ODP_AUTH_ALG_KASUMI_F9,
-
- /** Integrity UIA2 algorithm (128-EIA1)
- *
- * SNOW 3G-based UIA2 algorithm (also known as 128-EIA1).
- * IV (128 bit) should be formatted according to the ETSI/SAGE
- * UEA2 & UIA2 specification:
- * COUNT || FRESH ||
- * DIRECTION XOR COUNT0 || COUNT1 .. COUNT31 ||
- * FRESH0 .. FRESH15 || FRESH16 XOR DIRECTION || FRESH17 .. FRESH31
- */
- ODP_AUTH_ALG_SNOW3G_UIA2,
-
- /** Integrity 128-EIA2 algorithm
- *
- * AES_CMAC-based 128-EIA2 algorithm.
- *
- * IV (128 bit) should be formatted according to the ETSI/SAGE
- * 128-EA2 & 128-EIA2 specification:
- * COUNT || BEARER ||
- * DIRECTION || 0....0
- */
- ODP_AUTH_ALG_AES_EIA2,
-
- /** ZUC-based integrity algorithm.
- *
- * 128-EIA3/128-NIA3 algorithm when key length is 128 bits.
- *
- * IV (128 bit) should be formatted according to the ETSI/SAGE
- * 128-EA3 & 128-EIA2 specification:
- * COUNT || BEARER ||
- * DIRECTION XOR COUNT0 || COUNT1 .. COUNT31 ||
- * BEARER || 0...0 || DIRECTION || 0...0
- *
- * 256-bit key length support is experimental and subject to
- * change. The following variants may be supported:
- *
- * - ZUC-256 with 25 byte IV (of which 184 bits are variable) and
- * 32/64/128 bit MAC as specified in "The ZUC-256 Stream Cipher".
- * - ZUC-256 with 16 byte IV and 32/64/128 bit MAC as specified in
- * "An Addendum to the ZUC-256 Stream Cipher",
- * https://eprint.iacr.org/2021/1439
- */
- ODP_AUTH_ALG_ZUC_EIA3,
-
- /** MD5 algorithm */
- ODP_AUTH_ALG_MD5,
-
- /** SHA1 algorithm */
- ODP_AUTH_ALG_SHA1,
-
- /** 224 bit SHA2 algorithm */
- ODP_AUTH_ALG_SHA224,
-
- /** 256 bit SHA2 algorithm */
- ODP_AUTH_ALG_SHA256,
-
- /** 384 bit SHA2 algorithm */
- ODP_AUTH_ALG_SHA384,
-
- /** 512 bit SHA2 algorithm */
- ODP_AUTH_ALG_SHA512,
-
-} odp_auth_alg_t;
-
-/**
- * Cipher algorithms in a bit field structure
- */
-typedef union odp_crypto_cipher_algos_t {
- /** Cipher algorithms */
- struct {
- /** ODP_CIPHER_ALG_NULL */
- uint32_t null : 1;
-
- /** ODP_CIPHER_ALG_DES */
- uint32_t des : 1;
-
- /** ODP_CIPHER_ALG_3DES_CBC */
- uint32_t trides_cbc : 1;
-
- /** ODP_CIPHER_ALG_3DES_ECB */
- uint32_t trides_ecb : 1;
-
- /** ODP_CIPHER_ALG_AES_CBC */
- uint32_t aes_cbc : 1;
-
- /** ODP_CIPHER_ALG_AES_CTR */
- uint32_t aes_ctr : 1;
-
- /** ODP_CIPHER_ALG_AES_ECB */
- uint32_t aes_ecb : 1;
-
- /** ODP_CIPHER_ALG_AES_CFB128 */
- uint32_t aes_cfb128 : 1;
-
- /** ODP_CIPHER_ALG_AES_XTS */
- uint32_t aes_xts : 1;
-
- /** ODP_CIPHER_ALG_AES_GCM */
- uint32_t aes_gcm : 1;
-
- /** ODP_CIPHER_ALG_AES_CCM */
- uint32_t aes_ccm : 1;
-
- /** ODP_CIPHER_ALG_CHACHA20_POLY1305 */
- uint32_t chacha20_poly1305 : 1;
-
- /** ODP_CIPHER_ALG_KASUMI_F8 */
- uint32_t kasumi_f8 : 1;
-
- /** ODP_CIPHER_ALG_SNOW3G_UEA2 */
- uint32_t snow3g_uea2 : 1;
-
- /** ODP_CIPHER_ALG_AES_EEA2 */
- uint32_t aes_eea2 : 1;
-
- /** ODP_CIPHER_ALG_ZUC_EEA3 */
- uint32_t zuc_eea3 : 1;
-
- } bit;
-
- /** All bits of the bit field structure
- *
- * This field can be used to set/clear all flags, or bitwise
- * operations over the entire structure. */
- uint32_t all_bits;
-} odp_crypto_cipher_algos_t;
-
-/**
- * Authentication algorithms in a bit field structure
- */
-typedef union odp_crypto_auth_algos_t {
- /** Authentication algorithms */
- struct {
- /** ODP_AUTH_ALG_NULL */
- uint32_t null : 1;
-
- /** ODP_AUTH_ALG_MD5_HMAC */
- uint32_t md5_hmac : 1;
-
- /** ODP_AUTH_ALG_SHA1_HMAC */
- uint32_t sha1_hmac : 1;
-
- /** ODP_AUTH_ALG_SHA224_HMAC */
- uint32_t sha224_hmac : 1;
-
- /** ODP_AUTH_ALG_SHA256_HMAC */
- uint32_t sha256_hmac : 1;
-
- /** ODP_AUTH_ALG_SHA384_HMAC */
- uint32_t sha384_hmac : 1;
-
- /** ODP_AUTH_ALG_SHA512_HMAC */
- uint32_t sha512_hmac : 1;
-
- /** ODP_AUTH_ALG_AES_GCM */
- uint32_t aes_gcm : 1;
-
- /** ODP_AUTH_ALG_AES_GMAC*/
- uint32_t aes_gmac : 1;
-
- /** ODP_AUTH_ALG_AES_CCM */
- uint32_t aes_ccm : 1;
-
- /** ODP_AUTH_ALG_AES_CMAC*/
- uint32_t aes_cmac : 1;
-
- /** ODP_AUTH_ALG_AES_XCBC_MAC*/
- uint32_t aes_xcbc_mac : 1;
-
- /** ODP_AUTH_ALG_CHACHA20_POLY1305 */
- uint32_t chacha20_poly1305 : 1;
-
- /** ODP_AUTH_ALG_KASUMI_F9 */
- uint32_t kasumi_f9 : 1;
-
- /** ODP_AUTH_ALG_SNOW3G_UIA2 */
- uint32_t snow3g_uia2 : 1;
-
- /** ODP_AUTH_ALG_AES_EIA2 */
- uint32_t aes_eia2 : 1;
-
- /** ODP_AUTH_ALG_ZUC_EIA3 */
- uint32_t zuc_eia3 : 1;
-
- /** ODP_AUTH_ALG_MD5 */
- uint32_t md5 : 1;
-
- /** ODP_AUTH_ALG_SHA1 */
- uint32_t sha1 : 1;
-
- /** ODP_AUTH_ALG_SHA224 */
- uint32_t sha224 : 1;
-
- /** ODP_AUTH_ALG_SHA256 */
- uint32_t sha256 : 1;
-
- /** ODP_AUTH_ALG_SHA384 */
- uint32_t sha384 : 1;
-
- /** ODP_AUTH_ALG_SHA512 */
- uint32_t sha512 : 1;
-
- } bit;
-
- /** All bits of the bit field structure
- *
- * This field can be used to set/clear all flags, or bitwise
- * operations over the entire structure. */
- uint32_t all_bits;
-} odp_crypto_auth_algos_t;
-
-/**
- * Crypto API key structure
- */
-typedef struct odp_crypto_key {
- /** Key data */
- uint8_t *data;
-
- /** Key length in bytes */
- uint32_t length;
-
-} odp_crypto_key_t;
-
-/**
- * Crypto API IV structure
- *
- * @deprecated Use per-packet IV in crypto operation parameters
- */
-typedef struct odp_crypto_iv {
- /** IV data
- *
- * Ignored when length is zero. Null value indicates that an
- * IV will be provided for each packet through the crypto
- * operation parameters. In that case the per-operation
- * IV parameter must always point to a valid IV.
- *
- * Default value is NULL.
- */
- uint8_t *data;
-
- /** IV length in bytes. Default value is zero. */
- uint32_t length;
-
-} ODP_DEPRECATE(odp_crypto_iv_t);
-
-/**
- * Crypto API session creation parameters
- */
-typedef struct odp_crypto_session_param_t {
- /** Encode vs. decode operation
- *
- * The default value is ODP_CRYPTO_OP_ENCODE.
- */
- odp_crypto_op_t op;
-
- /** Authenticate cipher vs. plain text
- *
- * Controls ordering of authentication and cipher operations,
- * and is relative to the operation (encode vs decode). When encoding,
- * TRUE indicates the authentication operation should be performed
- * after the cipher operation else before. When decoding, TRUE
- * indicates the reverse order of operation.
- *
- * The value is ignored with authenticated encryption algorithms
- * such as AES-GCM.
- *
- * true: Authenticate cipher text
- * false: Authenticate plain text
- *
- * The default value is false.
- */
- odp_bool_t auth_cipher_text;
-
- /** Hash result location may overlap authentication range
- *
- * This flag indicates that the hash result location may (but is
- * not required to) overlap authentication range. Setting this
- * flag may reduce performance.
- *
- * Default value is false.
- */
- odp_bool_t hash_result_in_auth_range;
-
- /** Preferred sync vs. async for odp_crypto_operation()
- *
- * The default value is ODP_CRYPTO_SYNC.
- *
- * @deprecated Used only with deprecated odp_crypto_operation()
- */
- odp_crypto_op_mode_t ODP_DEPRECATE(pref_mode);
-
- /** Operation mode when using packet interface: sync or async
- *
- * The default value is ODP_CRYPTO_SYNC.
- */
- odp_crypto_op_mode_t op_mode;
-
- /** Cipher algorithm
- *
- * Select cipher algorithm to be used. ODP_CIPHER_ALG_NULL indicates
- * that ciphering is disabled. Use odp_crypto_capability() for
- * supported algorithms. Note that some algorithms restrict choice of
- * the pairing authentication algorithm. When ciphering is enabled
- * cipher key and IV need to be set. The default value is
- * ODP_CIPHER_ALG_NULL.
- */
- odp_cipher_alg_t cipher_alg;
-
- /** Cipher key
- *
- * Use odp_crypto_cipher_capa() for supported key and IV lengths.
- */
- odp_crypto_key_t cipher_key;
-
- /** Cipher Initialization Vector (IV)
- *
- * Unless using the deprecated API, this specifies the length of
- * the IV only. The actual IV must then be provided in per-packet
- * parameters of crypto operations.
- */
- union {
-#if ODP_DEPRECATED_API
- /** @deprecated Cipher IV */
- odp_crypto_iv_t ODP_DEPRECATE(cipher_iv);
-#endif
- /** Cipher IV length */
- struct {
-#if ODP_DEPRECATED_API
- /** @cond
- * Unused padding field
- */
- uint8_t *dummy_padding_0;
- /** @endcond */
-#endif
- /** Length of cipher initialization vector.
- * Default value is zero.
- */
- uint32_t cipher_iv_len;
- };
- };
-
- /** Authentication algorithm
- *
- * Select authentication algorithm to be used. ODP_AUTH_ALG_NULL
- * indicates that authentication is disabled. Use
- * odp_crypto_capability() for supported algorithms. Note that some
- * algorithms restrict choice of the pairing cipher algorithm. When
- * single algorithm provides both ciphering and authentication
- * (i.e. Authenticated Encryption), authentication side key
- * (auth_key) and IV (auth_iv) are ignored, and cipher side values are
- * used instead. These algorithms ignore authentication side key
- * and IV: ODP_AUTH_ALG_AES_GCM, ODP_AUTH_ALG_AES_CCM and
- * ODP_AUTH_ALG_CHACHA20_POLY1305. Otherwise, all authentication side
- * parameters must be set when authentication is enabled. The default
- * value is ODP_AUTH_ALG_NULL.
- */
- odp_auth_alg_t auth_alg;
-
- /** Authentication key
- *
- * Use odp_crypto_auth_capability() for supported key lengths.
- */
- odp_crypto_key_t auth_key;
-
- /** Authentication Initialization Vector (IV)
- *
- * Unless using the deprecated API, this specifies the length of
- * the IV only. The actual IV must then be provided in per-packet
- * parameters of crypto operations.
- */
- union {
-#if ODP_DEPRECATED_API
- /** @deprecated Authentication IV */
- odp_crypto_iv_t ODP_DEPRECATE(auth_iv);
-#endif
- /** Authentication IV length */
- struct {
-#if ODP_DEPRECATED_API
- /** @cond
- * Unused padding field
- */
- uint8_t *dummy_padding_1;
- /** @endcond */
-#endif
- /** Length of authentication initialization vector.
- * Default value is zero.
- */
- uint32_t auth_iv_len;
- };
- };
-
- /** Authentication digest length in bytes
- *
- * Use odp_crypto_auth_capability() for supported digest lengths.
- */
- uint32_t auth_digest_len;
-
- /** Additional Authenticated Data (AAD) length in bytes
- *
- * AAD length is constant for all operations (packets) of the session.
- * Set to zero when AAD is not used. Use odp_crypto_auth_capability()
- * for supported AAD lengths. The default value is zero.
- */
- uint32_t auth_aad_len;
-
- /** Async mode completion event queue
- *
- * The completion queue is used to return completions from
- * odp_crypto_op_enq() (and the deprecated odp_crypto_operation())
- * to the application.
- */
- odp_queue_t compl_queue;
-
- /** Output pool
- *
- * When the output packet is not specified during the call to
- * crypto operation, the output packet will be allocated
- * from this pool.
- */
- odp_pool_t output_pool;
-
-} odp_crypto_session_param_t;
-
-/**
- * Crypto API per packet operation parameters
- *
- * @deprecated Use odp_crypto_packet_op_param_t instead.
- */
-typedef struct odp_crypto_op_param_t {
- /** Session handle from creation */
- odp_crypto_session_t session;
-
- /** User context */
- void *ctx;
-
- /** Input packet
- *
- * Specifies the input packet for the crypto operation. When the
- * 'out_pkt' variable is set to ODP_PACKET_INVALID (indicating a new
- * packet should be allocated for the resulting packet).
- */
- odp_packet_t pkt;
-
- /** Output packet
- *
- * Both "in place" (the original packet 'pkt' is modified) and
- * "copy" (the packet is replicated to a new packet which contains
- * the modified data) modes are supported. The "in place" mode of
- * operation is indicated by setting 'out_pkt' equal to 'pkt'.
- * For the copy mode of operation, setting 'out_pkt' to a valid packet
- * value indicates the caller wishes to specify the destination packet.
- * Setting 'out_pkt' to ODP_PACKET_INVALID indicates the caller wishes
- * the destination packet be allocated from the output pool specified
- * during session creation.
- */
- odp_packet_t out_pkt;
-
- /** IV pointer for cipher */
- uint8_t *cipher_iv_ptr;
-
- /** Authentication IV pointer */
- uint8_t *auth_iv_ptr;
-
- /** Offset from start of packet for hash result
- *
- * In case of decode sessions, the expected hash will be read from
- * this offset and compared with the calculated hash. After the
- * operation the hash bytes will have undefined values.
- *
- * In case of encode sessions the calculated hash will be stored in
- * this offset.
- *
- * If the hash_result_in_auth_range session parameter is true,
- * the hash result location may overlap auth_range. In that case
- * the result location will be zeroed in decode sessions before
- * hash calculation. Zeroing is not done in encode sessions.
- */
- uint32_t hash_result_offset;
-
- /** Pointer to AAD. AAD length is defined by 'auth_aad_len'
- * session parameter.
- */
- uint8_t *aad_ptr;
-
- /** Data range to be ciphered */
- odp_packet_data_range_t cipher_range;
-
- /** Data range to be authenticated
- *
- * The value is ignored with authenticated encryption algorithms,
- * such as AES-GCM, which authenticate data in the cipher range
- * and the AAD.
- *
- * As a special case AES-GMAC uses this field instead of aad_ptr
- * for the data bytes to be authenticated.
- */
- odp_packet_data_range_t auth_range;
-
-} ODP_DEPRECATE(odp_crypto_op_param_t);
-
-/**
- * Crypto packet API per packet operation parameters
- */
-typedef struct odp_crypto_packet_op_param_t {
- /** Session handle from creation */
- odp_crypto_session_t session;
-
- /** IV pointer for cipher */
- uint8_t *cipher_iv_ptr;
-
- /** IV pointer for authentication */
- uint8_t *auth_iv_ptr;
-
- /** Offset from start of packet for hash result
- *
- * In case of decode sessions, the expected hash will be read from
- * this offset and compared with the calculated hash. After the
- * operation the hash bytes will have undefined values.
- *
- * In case of encode sessions the calculated hash will be stored in
- * this offset.
- *
- * If the hash_result_in_auth_range session parameter is true,
- * the hash result location may overlap auth_range. In that case the
- * result location will be zeroed in decode sessions before hash
- * calculation. Zeroing is not done in encode sessions.
- */
- uint32_t hash_result_offset;
-
- /** Pointer to AAD. AAD length is defined by 'auth_aad_len'
- * session parameter.
- */
- uint8_t *aad_ptr;
-
- /** Data range to apply cipher */
- odp_packet_data_range_t cipher_range;
-
- /** Data range to authenticate */
- odp_packet_data_range_t auth_range;
-
-} odp_crypto_packet_op_param_t;
-
-/**
- * Crypto API session creation return code
- */
-typedef enum {
- /** Session created */
- ODP_CRYPTO_SES_ERR_NONE,
- /** Creation failed, no resources */
- ODP_CRYPTO_SES_ERR_ENOMEM,
- /** Creation failed, bad cipher params */
- ODP_CRYPTO_SES_ERR_CIPHER,
- /** Creation failed, bad auth params */
- ODP_CRYPTO_SES_ERR_AUTH,
-
- /** Unsupported combination of algorithms
- *
- * The combination of cipher and auth algorithms with their
- * specific parameters is not supported even if the algorithms
- * appear in capabilities and are supported in combination with
- * other algorithms or other algorithm specific parameters.
- */
- ODP_CRYPTO_SES_ERR_ALG_COMBO,
-
- /** Unsupported order of cipher and auth
- *
- * The requested mutual order of ciphering and authentication
- * is not supported with the chosen individual cipher and
- * authentication algorithms.
- */
- ODP_CRYPTO_SES_ERR_ALG_ORDER,
-
- /** Unsupported combination of session creation parameters
- *
- * The combination of provided session creation parameters is not
- * supported. This error can occur when there are limitations that
- * are not expressible through crypto capabilities or other error
- * status values.
- */
- ODP_CRYPTO_SES_ERR_PARAMS,
-} odp_crypto_ses_create_err_t;
-
-/** This synonym for backward compatibility will be deprecated later */
-#define ODP_CRYPTO_SES_CREATE_ERR_NONE ODP_CRYPTO_SES_ERR_NONE
-/** This synonym for backward compatibility will be deprecated later */
-#define ODP_CRYPTO_SES_CREATE_ERR_ENOMEM ODP_CRYPTO_SES_ERR_ENOMEM
-/** This synonym for backward compatibility will be deprecated later */
-#define ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER ODP_CRYPTO_SES_ERR_CIPHER
-/** This synonym for backward compatibility will be deprecated later */
-#define ODP_CRYPTO_SES_CREATE_ERR_INV_AUTH ODP_CRYPTO_SES_ERR_AUTH
-
-/**
- * Crypto API algorithm return code
- */
-typedef enum {
- /** Algorithm successful */
- ODP_CRYPTO_ALG_ERR_NONE,
- /** Invalid data block size */
- ODP_CRYPTO_ALG_ERR_DATA_SIZE,
- /** Key size invalid for algorithm */
- ODP_CRYPTO_ALG_ERR_KEY_SIZE,
- /** Computed ICV value mismatch */
- ODP_CRYPTO_ALG_ERR_ICV_CHECK,
- /** IV value not specified */
- ODP_CRYPTO_ALG_ERR_IV_INVALID,
-} odp_crypto_alg_err_t;
-
-/**
- * Crypto API hardware centric return code
- */
-typedef enum {
- /** Operation completed successfully */
- ODP_CRYPTO_HW_ERR_NONE,
- /** Error detected during DMA of data */
- ODP_CRYPTO_HW_ERR_DMA,
- /** Operation failed due to pool depletion */
- ODP_CRYPTO_HW_ERR_BP_DEPLETED,
-} odp_crypto_hw_err_t;
-
-/**
- * Cryto API per packet operation completion status
- */
-typedef struct odp_crypto_op_status {
- /** Algorithm specific return code */
- odp_crypto_alg_err_t alg_err;
-
- /** Hardware specific return code */
- odp_crypto_hw_err_t hw_err;
-
-} odp_crypto_op_status_t;
-
-/**
- * Crypto API operation result
- *
- * @deprecated Use odp_crypto_packet_result_t instead.
- */
-typedef struct odp_crypto_op_result {
- /** Request completed successfully */
- odp_bool_t ok;
-
- /** User context from request */
- void *ctx;
-
- /** Output packet */
- odp_packet_t pkt;
-
- /** Cipher status */
- odp_crypto_op_status_t cipher_status;
-
- /** Authentication status */
- odp_crypto_op_status_t auth_status;
-
-} ODP_DEPRECATE(odp_crypto_op_result_t);
-
-/**
- * Crypto packet API operation result
- */
-typedef struct odp_crypto_packet_result_t {
- /** Request completed successfully */
- odp_bool_t ok;
-
- /** Cipher status */
- odp_crypto_op_status_t cipher_status;
-
- /** Authentication status */
- odp_crypto_op_status_t auth_status;
-
-} odp_crypto_packet_result_t;
-
-/**
- * Crypto capabilities
- */
-typedef struct odp_crypto_capability_t {
- /** Maximum number of crypto sessions */
- uint32_t max_sessions;
-
- /** Supported packet operation in SYNC mode */
- odp_support_t sync_mode;
-
- /** Supported packet operation in ASYNC mode */
- odp_support_t async_mode;
-
- /** Supported cipher algorithms */
- odp_crypto_cipher_algos_t ciphers;
-
- /** Cipher algorithms implemented with HW offload */
- odp_crypto_cipher_algos_t hw_ciphers;
-
- /** Supported authentication algorithms */
- odp_crypto_auth_algos_t auths;
-
- /** Authentication algorithms implemented with HW offload */
- odp_crypto_auth_algos_t hw_auths;
-
- /**
- * Scheduled crypto completion queue support
- *
- * This defines whether scheduled queues are supported as crypto
- * compl_queue.
- * 0: Scheduled queues are not supported as crypto completion queues
- * 1: Scheduled queues are supported as crypto completion queues
- * @see odp_crypto_session_param_t
- */
- odp_bool_t queue_type_sched;
-
- /**
- * Plain crypto completion queue support
- *
- * This defines whether plain queues are supported as crypto
- * compl_queue.
- * 0: Plain queues are not supported as crypto completion queues
- * 1: Plain queues are supported as crypto completion queues
- * @see odp_crypto_session_param_t
- */
- odp_bool_t queue_type_plain;
-} odp_crypto_capability_t;
-
-/**
- * Cipher algorithm capabilities
- */
-typedef struct odp_crypto_cipher_capability_t {
- /** Key length in bytes */
- uint32_t key_len;
-
- /** IV length in bytes */
- uint32_t iv_len;
-
- /** Cipher is operating in bitwise mode
- *
- * This cipher works on series of bits, rather than sequences of bytes:
- * cipher_range in odp_crypto_op_param_t and
- * odp_crypto_packet_op_param_t will use bits, rather than bytes.
- *
- * Note: data buffer MUST start on the byte boundary, using offset
- * which is not divisible by 8 is unsupported and will result in
- * unspecified behaviour.
- *
- * Note2: If the data length is not a multiple of 8, the remaining
- * bits of the data in the last byte of the input/output will be the
- * most significant bits, i.e. the most significant bit is considered
- * to be the first bit of a byte for the purpose of input and output
- * data range. The output bits that fall out of the output range are
- * undefined.
- */
- odp_bool_t bit_mode;
-
-} odp_crypto_cipher_capability_t;
-
-/**
- * Authentication algorithm capabilities
- */
-typedef struct odp_crypto_auth_capability_t {
- /** Digest length in bytes */
- uint32_t digest_len;
-
- /** Key length in bytes */
- uint32_t key_len;
-
- /** IV length in bytes */
- uint32_t iv_len;
-
- /** Additional Authenticated Data (AAD) lengths */
- struct {
- /** Minimum AAD length in bytes */
- uint32_t min;
-
- /** Maximum AAD length in bytes */
- uint32_t max;
-
- /** Increment of supported lengths between min and max
- * (in bytes) */
- uint32_t inc;
- } aad_len;
-
- /** Auth is operating in bitstring mode
- *
- * This auth works on series of bits, rather than sequences of bytes:
- * auth_range in odp_crypto_op_param_t and
- * odp_crypto_packet_op_param_t will use bits, rather than bytes.
- *
- * Note: data buffer MUST start on the byte boundary, using offset
- * which is not divisible by 8 is unsupported and will result in
- * unpredictable behaviour.
- *
- * Note2: If the data length is not a multiple of 8, the remaining
- * bits of the data in the last byte of the input/output will be the
- * most significant bits, i.e. the most significant bit is considered
- * to be the first bit of a byte for the purpose of input and output
- * data range. The output bits that fall out of the output range are
- * undefined.
- */
- odp_bool_t bit_mode;
-
-} odp_crypto_auth_capability_t;
-
-/**
* Query crypto capabilities
*
* Outputs crypto capabilities on success.
@@ -1212,6 +156,9 @@ void odp_crypto_compl_free(odp_crypto_compl_t completion_event);
*
* @deprecated Use odp_crypto_op() or odp_crypto_op_enq() instead.
*
+ * This function may be called only for sessions configured with
+ * the ODP_CRYPTO_OP_TYPE_LEGACY operation type.
+ *
* Performs the cryptographic operations specified during session creation
* on the packet. If the operation is performed synchronously, "posted"
* will return FALSE and the result of the operation is immediately available.
@@ -1310,15 +257,15 @@ odp_packet_t odp_crypto_packet_from_event(odp_event_t ev);
odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt);
/**
- * Get crypto operation results from an crypto processed packet
+ * Get crypto operation results from a crypto processed packet
*
* Successful crypto operations of all types (SYNC and ASYNC) produce packets
* which contain crypto result metadata. This function copies the operation
- * results from an crypto processed packet. Event subtype of this kind of
+ * results from a crypto processed packet. Event subtype of this kind of
* packet is ODP_EVENT_PACKET_CRYPTO. Results are undefined if a non-crypto
* processed packet is passed as input.
*
- * @param packet An crypto processed packet (ODP_EVENT_PACKET_CRYPTO)
+ * @param packet A crypto processed packet (ODP_EVENT_PACKET_CRYPTO)
* @param[out] result Pointer to operation result for output
*
* @retval 0 On success
@@ -1331,16 +278,77 @@ int odp_crypto_result(odp_crypto_packet_result_t *result,
* Crypto packet operation
*
* Performs the SYNC cryptographic operations specified during session creation
- * on the packets. Caller should initialize pkt_out either with desired output
- * packet handles or with ODP_PACKET_INVALID to make ODP allocate new packets
- * from provided pool. All arrays should be of num_pkt size.
+ * on the packets. All arrays should be of num_pkt size.
+ *
+ * Use of the pkt_out parameter depends on the configured crypto operation
+ * type as described below.
+ *
+ * ODP_CRYPTO_OP_TYPE_LEGACY:
+ *
+ * Caller should initialize each element of pkt_out either with the desired
+ * output packet handle or with ODP_PACKET_INVALID to make ODP allocate a new
+ * packet from provided pool.
+ *
+ * All packet data and metadata are copied from the input packet to the output
+ * packet before the requested crypto operation is performed to the output
+ * packet. If an output packet is given to the operation, it must be at least
+ * as long as the input packet and, in encode operations, long enough for the
+ * hash result to be fully inside the packet data. Memory layout of the output
+ * packet may change during the crypto operation. If the output packet is
+ * longer than needed, it is not truncated and the extra data bytes retain
+ * their content.
+ *
+ * It is ok to pass the same packet handle as both the input packet and the
+ * output packet for the same crypto operation. In that case the input packet
+ * is consumed but returned as the output packet (with possibly different
+ * memory layout).
+ *
+ * ODP_CRYPTO_OP_TYPE_BASIC:
+ *
+ * ODP allocates the output packet from the pool from which the input
+ * packet was allocated. The processed input packet is consumed. All
+ * packet data and metadata are copied from the input packet to the output
+ * packet before the requested crypto operation is applied to the output
+ * packet. Memory layout (including packet data pointers, head and tail room,
+ * segmentation) of the output packet may differ from that of the input
+ * packet.
+ *
+ * The value of pktout[n] is ignored as pktout[n] is used purely as an
+ * output parameter that returns the handle of the newly allocated packet.
+ *
+ * ODP_CRYPTO_OP_TYPE_OOP:
+ *
+ * Writes the output bytes of the crypto operation in a caller provided
+ * output packet passed through pkt_out[n]. Input packets are not consumed
+ * nor modified. Memory layout (including packet data pointers, head and
+ * tail room, segmentation) of the output packet may change during the
+ * operation.
+ *
+ * Crypto output is the processed crypto_range, auth_range and
+ * MAC/digest (in encode sessions) of the input packet. The operation
+ * behaves as if crypto range and auth range were first copied from the
+ * input packet to the output packet and then the crypto operation
+ * was applied to the output packet.
+ *
+ * Crypto range and auth range of null cipher and auth algorithms are
+ * ignored, i.e. not copied in the output packet. Auth range of (AEAD)
+ * algorithms that ignore auth range is not copied.
+ *
+ * The offset of the crypto range and auth range in the output packet is
+ * the same as in the input packet, adjusted by dst_offset_shift operation
+ * parameter.
+ *
+ * pkt_out[n] must be a valid handle to a packet that is long enough to
+ * contain the shifted crypto range, auth range and, in encode sessions,
+ * the MAC/digest result. pkt_out[n] must not be the same as any input
+ * packet or any other output packet.
*
* @param pkt_in Packets to be processed
- * @param[in,out] pkt_out Packet handle array specifyint resulting packets
+ * @param[in,out] pkt_out Packet handle array for resulting packets
* @param param Operation parameters array
* @param num_pkt Number of packets to be processed
*
- * @return Number of input packets consumed (0 ... num_pkt)
+ * @return Number of input packets processed (0 ... num_pkt)
* @retval <0 on failure
*/
int odp_crypto_op(const odp_packet_t pkt_in[],
@@ -1351,14 +359,24 @@ int odp_crypto_op(const odp_packet_t pkt_in[],
/**
* Crypto packet operation
*
- * Performs the ASYNC cryptographic operations specified during session creation
- * on the packets. Caller should initialize pkt_out either with desired output
- * packet handles or with ODP_PACKET_INVALID to make ODP allocate new packets
- * from provided pool. All arrays should be of num_pkt size. Resulting packets
- * are returned through events.
+ * Performs the ASYNC cryptographic operations specified during session
+ * creation on the packets. Behaves otherwise like odp_crypto_op() but
+ * returns output packets through events.
+ *
+ * With operation types other than ODP_CRYPTO_OP_TYPE_LEGACY, packet
+ * data of processed packets may not be valid before odp_crypto_result()
+ * has been called.
+ *
+ * With ODP_CRYPTO_OP_TYPE_OOP, an enqueued input packet is consumed but
+ * returned back unmodified after the crypto operation is complete. The
+ * caller may not access the input packet until getting the handle back
+ * through odp_crypto_result().
+ *
+ * All arrays should be of num_pkt size, except that pkt_out parameter
+ * is ignored when the crypto operation type is ODP_CRYPTO_OP_TYPE_BASIC.
*
* @param pkt_in Packets to be processed
- * @param pkt_out Packet handle array specifying resulting packets
+ * @param pkt_out Packet handle array for resulting packets
* @param param Operation parameters array
* @param num_pkt Number of packets to be processed
*
diff --git a/include/odp/api/spec/crypto_types.h b/include/odp/api/spec/crypto_types.h
new file mode 100644
index 000000000..574f56445
--- /dev/null
+++ b/include/odp/api/spec/crypto_types.h
@@ -0,0 +1,1102 @@
+/* Copyright (c) 2014-2018, Linaro Limited
+ * Copyright (c) 2021-2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP crypto types */
+
+#ifndef ODP_API_SPEC_CRYPTO_TYPES_H_
+#define ODP_API_SPEC_CRYPTO_TYPES_H_
+#include <odp/visibility_begin.h>
+
+#include <odp/api/deprecated.h>
+#include <odp/api/packet_types.h>
+#include <odp/api/pool_types.h>
+#include <odp/api/std_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup odp_crypto
+ * @{
+ */
+
+/**
+ * @def ODP_CRYPTO_SESSION_INVALID
+ * Invalid session handle
+ */
+
+/**
+ * @typedef odp_crypto_session_t
+ * Crypto API opaque session handle
+ */
+
+/**
+ * @typedef odp_crypto_compl_t
+* @deprecated Crypto API completion event (platform dependent).
+*/
+
+/**
+ * Crypto API operation mode
+ */
+typedef enum {
+ /** Synchronous, return results immediately */
+ ODP_CRYPTO_SYNC,
+ /** Asynchronous, return results via posted event */
+ ODP_CRYPTO_ASYNC,
+} odp_crypto_op_mode_t;
+
+/**
+ * Crypto API operation
+ */
+typedef enum {
+ /** Encrypt and/or compute authentication ICV */
+ ODP_CRYPTO_OP_ENCODE,
+ /** Decrypt and/or verify authentication ICV */
+ ODP_CRYPTO_OP_DECODE,
+} odp_crypto_op_t;
+
+/**
+ * Crypto API cipher algorithm
+ */
+typedef enum {
+ /** No cipher algorithm specified */
+ ODP_CIPHER_ALG_NULL,
+
+ /** DES */
+ ODP_CIPHER_ALG_DES,
+
+ /** Triple DES with cipher block chaining */
+ ODP_CIPHER_ALG_3DES_CBC,
+
+ /** Triple DES with Electronic Codebook */
+ ODP_CIPHER_ALG_3DES_ECB,
+
+ /** AES with cipher block chaining */
+ ODP_CIPHER_ALG_AES_CBC,
+
+ /** AES with counter mode */
+ ODP_CIPHER_ALG_AES_CTR,
+
+ /** AES with electronic codebook */
+ ODP_CIPHER_ALG_AES_ECB,
+
+ /** AES with 128-bit cipher feedback */
+ ODP_CIPHER_ALG_AES_CFB128,
+
+ /** AES with XEX-based tweaked-codebook mode with ciphertext stealing
+ * (XTS) */
+ ODP_CIPHER_ALG_AES_XTS,
+
+ /** AES-GCM
+ *
+ * AES in Galois/Counter Mode (GCM) algorithm. GCM provides both
+ * authentication and ciphering of data (authenticated encryption)
+ * in the same operation. Hence this algorithm must be paired always
+ * with ODP_AUTH_ALG_AES_GCM authentication.
+ */
+ ODP_CIPHER_ALG_AES_GCM,
+
+ /** AES-CCM
+ *
+ * AES in Counter with CBC-MAC (CCM) mode algorithm. CCM provides both
+ * authentication and ciphering of data (authenticated encryption)
+ * in the same operation. Hence this algorithm must be paired always
+ * with ODP_AUTH_ALG_AES_CCM authentication.
+ */
+ ODP_CIPHER_ALG_AES_CCM,
+
+ /** ChaCha20-Poly1305
+ *
+ * ChaCha20 with Poly1305 provide both authentication and ciphering of
+ * data (authenticated encryption) in the same operation. Hence this
+ * algorithm must be paired always with ODP_AUTH_ALG_CHACHA20_POLY1305
+ * authentication.
+ */
+ ODP_CIPHER_ALG_CHACHA20_POLY1305,
+
+ /** Confidentiality F8 algorithm (UEA1)
+ *
+ * KASUMI-based F8 algorithm (also known as UEA1).
+ *
+ * IV should be formatted according to the 3GPP TS 35.201:
+ * COUNT || BEARER || DIRECTION || 0...0
+ */
+ ODP_CIPHER_ALG_KASUMI_F8,
+
+ /** Confidentiality UEA2 algorithm (128-EEA1)
+ *
+ * SNOW 3G-based UEA2 algorithm (also known as 128-EEA1).
+ *
+ * IV (128 bits) should be formatted according to the ETSI/SAGE
+ * UEA2 & UIA2 specification:
+ * COUNT || BEARER || DIRECTION || 0...0 ||
+ * COUNT || BEARER || DIRECTION || 0...0 ||
+ */
+ ODP_CIPHER_ALG_SNOW3G_UEA2,
+
+ /** Confidentiality 128-EEA2 algorithm
+ *
+ * AES-CTR-based 128-EEA2 algorithm.
+ *
+ * IV (128 bits) should be formatted according to the ETSI/SAGE
+ * 128-EAA2 & 128-EIA2 specification:
+ * COUNT || BEARER || DIRECTION || 0....0
+ */
+ ODP_CIPHER_ALG_AES_EEA2,
+
+ /** ZUC based confidentiality algorithm
+ *
+ * 128-EEA3/128-NEA3 algorithm when key length is 128 bits.
+ *
+ * IV (128 bits) should be formatted according to the ETSI/SAGE
+ * 128-EEA3 & 128-EIA3 specification:
+ * COUNT || BEARER || DIRECTION || 0...0 ||
+ * COUNT || BEARER || DIRECTION || 0...0 ||
+ *
+ * 256-bit key length support is experimental and subject to
+ * change. The following variants may be supported:
+ *
+ * - ZUC-256 with 25 byte IV (of which 184 bits are variable)
+ * as specified in "The ZUC-256 Stream Cipher".
+ * - ZUC-256 with 16 byte IV as specified in
+ * "An Addendum to the ZUC-256 Stream Cipher",
+ * https://eprint.iacr.org/2021/1439
+ */
+ ODP_CIPHER_ALG_ZUC_EEA3,
+
+} odp_cipher_alg_t;
+
+/**
+ * Crypto API authentication algorithm
+ */
+typedef enum {
+ /** No authentication algorithm specified */
+ ODP_AUTH_ALG_NULL,
+
+ /** HMAC-MD5
+ *
+ * MD5 algorithm in HMAC mode
+ */
+ ODP_AUTH_ALG_MD5_HMAC,
+
+ /** HMAC-SHA-1
+ *
+ * SHA-1 algorithm in HMAC mode
+ */
+ ODP_AUTH_ALG_SHA1_HMAC,
+
+ /** HMAC-SHA-224
+ *
+ * SHA-224 algorithm in HMAC mode
+ */
+ ODP_AUTH_ALG_SHA224_HMAC,
+
+ /** HMAC-SHA-256
+ *
+ * SHA-256 algorithm in HMAC mode
+ */
+ ODP_AUTH_ALG_SHA256_HMAC,
+
+ /** HMAC-SHA-384
+ *
+ * SHA-384 algorithm in HMAC mode
+ */
+ ODP_AUTH_ALG_SHA384_HMAC,
+
+ /** HMAC-SHA-512
+ *
+ * SHA-512 algorithm in HMAC mode
+ */
+ ODP_AUTH_ALG_SHA512_HMAC,
+
+ /** AES-GCM
+ *
+ * AES in Galois/Counter Mode (GCM) algorithm. GCM provides both
+ * authentication and ciphering of data (authenticated encryption)
+ * in the same operation. Hence this algorithm must be paired always
+ * with ODP_CIPHER_ALG_AES_GCM cipher.
+ */
+ ODP_AUTH_ALG_AES_GCM,
+
+ /** AES-GMAC
+ *
+ * AES Galois Message Authentication Code (GMAC) algorithm. AES-GMAC
+ * is based on AES-GCM operation, but provides authentication only.
+ * Hence this algorithm can be paired only with ODP_CIPHER_ALG_NULL
+ * cipher.
+ *
+ * NIST and RFC specifications of GMAC refer to all data to be
+ * authenticated as AAD. In ODP the data to be authenticated, i.e.
+ * AAD, is ODP packet data and specified using the auth_range
+ * parameter. The aad_length and aad_ptr parameters, which would
+ * require the data to be contiguous in memory, are ignored with
+ * AES-GMAC.
+ *
+ * GMAC needs an initialization vector, which must be passed via
+ * operation parameters (auth_iv_ptr).
+ */
+ ODP_AUTH_ALG_AES_GMAC,
+
+ /** AES-CCM
+ *
+ * AES in Counter with CBC-MAC (CCM) mode algorithm. CCM provides both
+ * authentication and ciphering of data (authenticated encryption)
+ * in the same operation. Hence this algorithm must be paired always
+ * with ODP_CIPHER_ALG_AES_CCM cipher.
+ */
+ ODP_AUTH_ALG_AES_CCM,
+
+ /** AES-CMAC
+ *
+ * AES Cipher-based Message Authentication Code (CMAC) algorithm. CMAC
+ * is a keyed hash function that is based on a symmetric key block
+ * cipher, such as the AES.
+ */
+ ODP_AUTH_ALG_AES_CMAC,
+
+ /** AES-XCBC-MAC
+ *
+ * AES CBC MAC for arbitrary-length messages (XCBC-MAC).
+ *
+ */
+ ODP_AUTH_ALG_AES_XCBC_MAC,
+
+ /** ChaCha20-Poly1305 AEAD
+ *
+ * ChaCha20 with Poly1305 provide both authentication and ciphering of
+ * data (authenticated encryption) in the same operation. Hence this
+ * algorithm must be paired always with
+ * ODP_CIPHER_ALG_CHACHA20_POLY1305 cipher.
+ */
+ ODP_AUTH_ALG_CHACHA20_POLY1305,
+
+ /** Integrity F9 algorithm (UIA1)
+ *
+ * KASUMI-based F9 algorithm (also known as UIA1).
+ *
+ * IV (9 bytes) is a concatenation of COUNT (32b), FRESH (32b) and
+ * DIRECTION (LSB-aligned, 1b).
+ * IV (8 bytes) is a concatenation of COUNT (32b) and FRESH (32b)
+ * DIRECTION (1b) and padding should come at the end of message.
+ */
+ ODP_AUTH_ALG_KASUMI_F9,
+
+ /** Integrity UIA2 algorithm (128-EIA1)
+ *
+ * SNOW 3G-based UIA2 algorithm (also known as 128-EIA1).
+ * IV (128 bits) should be formatted according to the ETSI/SAGE
+ * UEA2 & UIA2 specification:
+ * COUNT || FRESH ||
+ * DIRECTION XOR COUNT0 || COUNT1 .. COUNT31 ||
+ * FRESH0 .. FRESH15 || FRESH16 XOR DIRECTION || FRESH17 .. FRESH31
+ */
+ ODP_AUTH_ALG_SNOW3G_UIA2,
+
+ /** Integrity 128-EIA2 algorithm
+ *
+ * AES_CMAC-based 128-EIA2 algorithm.
+ *
+ * IV (64 bits) should be formatted according to the ETSI/SAGE
+ * 128-EEA2 & 128-EIA2 specification:
+ * COUNT || BEARER || DIRECTION || 0....0
+ */
+ ODP_AUTH_ALG_AES_EIA2,
+
+ /** ZUC-based integrity algorithm.
+ *
+ * 128-EIA3/128-NIA3 algorithm when key length is 128 bits.
+ *
+ * IV (128 bits) should be formatted according to the ETSI/SAGE
+ * 128-EEA3 & 128-EIA2 specification:
+ * COUNT || BEARER ||
+ * DIRECTION XOR COUNT0 || COUNT1 .. COUNT31 ||
+ * BEARER || 0...0 || DIRECTION || 0...0
+ *
+ * 256-bit key length support is experimental and subject to
+ * change. The following variants may be supported:
+ *
+ * - ZUC-256 with 25 byte IV (of which 184 bits are variable) and
+ * 32/64/128 bit MAC as specified in "The ZUC-256 Stream Cipher".
+ * - ZUC-256 with 16 byte IV and 32/64/128 bit MAC as specified in
+ * "An Addendum to the ZUC-256 Stream Cipher",
+ * https://eprint.iacr.org/2021/1439
+ */
+ ODP_AUTH_ALG_ZUC_EIA3,
+
+ /** MD5 algorithm */
+ ODP_AUTH_ALG_MD5,
+
+ /** SHA1 algorithm */
+ ODP_AUTH_ALG_SHA1,
+
+ /** 224 bit SHA2 algorithm */
+ ODP_AUTH_ALG_SHA224,
+
+ /** 256 bit SHA2 algorithm */
+ ODP_AUTH_ALG_SHA256,
+
+ /** 384 bit SHA2 algorithm */
+ ODP_AUTH_ALG_SHA384,
+
+ /** 512 bit SHA2 algorithm */
+ ODP_AUTH_ALG_SHA512,
+
+} odp_auth_alg_t;
+
+/**
+ * Cipher algorithms in a bit field structure
+ */
+typedef union odp_crypto_cipher_algos_t {
+ /** Cipher algorithms */
+ struct {
+ /** ODP_CIPHER_ALG_NULL */
+ uint32_t null : 1;
+
+ /** ODP_CIPHER_ALG_DES */
+ uint32_t des : 1;
+
+ /** ODP_CIPHER_ALG_3DES_CBC */
+ uint32_t trides_cbc : 1;
+
+ /** ODP_CIPHER_ALG_3DES_ECB */
+ uint32_t trides_ecb : 1;
+
+ /** ODP_CIPHER_ALG_AES_CBC */
+ uint32_t aes_cbc : 1;
+
+ /** ODP_CIPHER_ALG_AES_CTR */
+ uint32_t aes_ctr : 1;
+
+ /** ODP_CIPHER_ALG_AES_ECB */
+ uint32_t aes_ecb : 1;
+
+ /** ODP_CIPHER_ALG_AES_CFB128 */
+ uint32_t aes_cfb128 : 1;
+
+ /** ODP_CIPHER_ALG_AES_XTS */
+ uint32_t aes_xts : 1;
+
+ /** ODP_CIPHER_ALG_AES_GCM */
+ uint32_t aes_gcm : 1;
+
+ /** ODP_CIPHER_ALG_AES_CCM */
+ uint32_t aes_ccm : 1;
+
+ /** ODP_CIPHER_ALG_CHACHA20_POLY1305 */
+ uint32_t chacha20_poly1305 : 1;
+
+ /** ODP_CIPHER_ALG_KASUMI_F8 */
+ uint32_t kasumi_f8 : 1;
+
+ /** ODP_CIPHER_ALG_SNOW3G_UEA2 */
+ uint32_t snow3g_uea2 : 1;
+
+ /** ODP_CIPHER_ALG_AES_EEA2 */
+ uint32_t aes_eea2 : 1;
+
+ /** ODP_CIPHER_ALG_ZUC_EEA3 */
+ uint32_t zuc_eea3 : 1;
+
+ } bit;
+
+ /** All bits of the bit field structure
+ *
+ * This field can be used to set/clear all flags, or bitwise
+ * operations over the entire structure. */
+ uint32_t all_bits;
+} odp_crypto_cipher_algos_t;
+
+/**
+ * Authentication algorithms in a bit field structure
+ */
+typedef union odp_crypto_auth_algos_t {
+ /** Authentication algorithms */
+ struct {
+ /** ODP_AUTH_ALG_NULL */
+ uint32_t null : 1;
+
+ /** ODP_AUTH_ALG_MD5_HMAC */
+ uint32_t md5_hmac : 1;
+
+ /** ODP_AUTH_ALG_SHA1_HMAC */
+ uint32_t sha1_hmac : 1;
+
+ /** ODP_AUTH_ALG_SHA224_HMAC */
+ uint32_t sha224_hmac : 1;
+
+ /** ODP_AUTH_ALG_SHA256_HMAC */
+ uint32_t sha256_hmac : 1;
+
+ /** ODP_AUTH_ALG_SHA384_HMAC */
+ uint32_t sha384_hmac : 1;
+
+ /** ODP_AUTH_ALG_SHA512_HMAC */
+ uint32_t sha512_hmac : 1;
+
+ /** ODP_AUTH_ALG_AES_GCM */
+ uint32_t aes_gcm : 1;
+
+ /** ODP_AUTH_ALG_AES_GMAC*/
+ uint32_t aes_gmac : 1;
+
+ /** ODP_AUTH_ALG_AES_CCM */
+ uint32_t aes_ccm : 1;
+
+ /** ODP_AUTH_ALG_AES_CMAC*/
+ uint32_t aes_cmac : 1;
+
+ /** ODP_AUTH_ALG_AES_XCBC_MAC*/
+ uint32_t aes_xcbc_mac : 1;
+
+ /** ODP_AUTH_ALG_CHACHA20_POLY1305 */
+ uint32_t chacha20_poly1305 : 1;
+
+ /** ODP_AUTH_ALG_KASUMI_F9 */
+ uint32_t kasumi_f9 : 1;
+
+ /** ODP_AUTH_ALG_SNOW3G_UIA2 */
+ uint32_t snow3g_uia2 : 1;
+
+ /** ODP_AUTH_ALG_AES_EIA2 */
+ uint32_t aes_eia2 : 1;
+
+ /** ODP_AUTH_ALG_ZUC_EIA3 */
+ uint32_t zuc_eia3 : 1;
+
+ /** ODP_AUTH_ALG_MD5 */
+ uint32_t md5 : 1;
+
+ /** ODP_AUTH_ALG_SHA1 */
+ uint32_t sha1 : 1;
+
+ /** ODP_AUTH_ALG_SHA224 */
+ uint32_t sha224 : 1;
+
+ /** ODP_AUTH_ALG_SHA256 */
+ uint32_t sha256 : 1;
+
+ /** ODP_AUTH_ALG_SHA384 */
+ uint32_t sha384 : 1;
+
+ /** ODP_AUTH_ALG_SHA512 */
+ uint32_t sha512 : 1;
+
+ } bit;
+
+ /** All bits of the bit field structure
+ *
+ * This field can be used to set/clear all flags, or bitwise
+ * operations over the entire structure. */
+ uint32_t all_bits;
+} odp_crypto_auth_algos_t;
+
+/**
+ * Crypto API key structure
+ */
+typedef struct odp_crypto_key {
+ /** Key data */
+ uint8_t *data;
+
+ /** Key length in bytes */
+ uint32_t length;
+
+} odp_crypto_key_t;
+
+/**
+ * Type of odp_crypto_op()/odp_crypto_op_enq() calls.
+ */
+typedef enum odp_crypto_op_type_t {
+ /**
+ * Input packet data and metadata are copied in the output packet
+ * and then processed. Output packet is allocated by the caller
+ * or by ODP. odp_crypto_op(), odp_crypto_op_enq() and
+ * odp_crypto_operation() can be used.
+ *
+ * This is the default value but will be deprecated in the future.
+ */
+ ODP_CRYPTO_OP_TYPE_LEGACY,
+
+ /**
+ * Input packet data and metadata are copied in the output packet
+ * and then processed. Output packet is allocated by ODP.
+ * odp_crypto_op() and odp_crypto_op_enq() can be used.
+ */
+ ODP_CRYPTO_OP_TYPE_BASIC,
+
+ /**
+ * Out-of-place crypto operation. Output packet is provided by
+ * the caller and the input packet is not consumed nor modified.
+ *
+ * Output of the crypto operation is written in the caller provided
+ * output packet without affecting other data and metadata of the
+ * output packet. Memory layout of the output packet may change
+ * during the operation.
+ *
+ * Crypto output is the processed crypto_range, auth_range and
+ * MAC/digest (in encode sessions) of the input packet.
+ *
+ * odp_crypto_op() and odp_crypto_op_enq() can be used.
+ */
+ ODP_CRYPTO_OP_TYPE_OOP,
+} odp_crypto_op_type_t;
+
+/**
+ * Crypto API session creation parameters
+ */
+typedef struct odp_crypto_session_param_t {
+ /** Encode vs. decode operation
+ *
+ * The default value is ODP_CRYPTO_OP_ENCODE.
+ */
+ odp_crypto_op_t op;
+
+ /** Crypto operation type
+ *
+ * This field defines how the crypto operation functions are
+ * to be called and what they return. In particular, this field
+ * specifies the interpretation of the output packet parameter,
+ * how output packets are allocated and what data and metadata
+ * they contain.
+ *
+ * The default value is ODP_CRYPTO_OP_TYPE_LEGACY.
+ */
+ odp_crypto_op_type_t op_type;
+
+ /** Authenticate cipher vs. plain text
+ *
+ * Controls ordering of authentication and cipher operations,
+ * and is relative to the operation (encode vs decode). When encoding,
+ * TRUE indicates the authentication operation should be performed
+ * after the cipher operation else before. When decoding, TRUE
+ * indicates the reverse order of operation.
+ *
+ * The value is ignored with authenticated encryption algorithms
+ * such as AES-GCM.
+ *
+ * true: Authenticate cipher text
+ * false: Authenticate plain text
+ *
+ * The default value is false.
+ */
+ odp_bool_t auth_cipher_text;
+
+ /** Hash result location may overlap authentication range
+ *
+ * This flag indicates that the hash result location may (but is
+ * not required to) overlap authentication range. Setting this
+ * flag may reduce performance.
+ *
+ * Default value is false.
+ */
+ odp_bool_t hash_result_in_auth_range;
+
+ /** Preferred sync vs. async for odp_crypto_operation()
+ *
+ * The default value is ODP_CRYPTO_SYNC.
+ *
+ * @deprecated Used only with deprecated odp_crypto_operation()
+ */
+ odp_crypto_op_mode_t ODP_DEPRECATE(pref_mode);
+
+ /** Operation mode when using packet interface: sync or async
+ *
+ * The default value is ODP_CRYPTO_SYNC.
+ */
+ odp_crypto_op_mode_t op_mode;
+
+ /** Cipher algorithm
+ *
+ * Select cipher algorithm to be used. ODP_CIPHER_ALG_NULL indicates
+ * that ciphering is disabled. Use odp_crypto_capability() for
+ * supported algorithms. Note that some algorithms restrict choice of
+ * the pairing authentication algorithm. When ciphering is enabled
+ * cipher key and IV need to be set. The default value is
+ * ODP_CIPHER_ALG_NULL.
+ */
+ odp_cipher_alg_t cipher_alg;
+
+ /** Cipher key
+ *
+ * Use odp_crypto_cipher_capa() for supported key and IV lengths.
+ */
+ odp_crypto_key_t cipher_key;
+
+ /** Cipher IV length. The default value is zero. */
+ uint32_t cipher_iv_len;
+
+ /** Authentication algorithm
+ *
+ * Select authentication algorithm to be used. ODP_AUTH_ALG_NULL
+ * indicates that authentication is disabled. Use
+ * odp_crypto_capability() for supported algorithms. Note that some
+ * algorithms restrict choice of the pairing cipher algorithm. When
+ * single algorithm provides both ciphering and authentication
+ * (i.e. Authenticated Encryption), authentication side key
+ * (auth_key) and IV (auth_iv) are ignored, and cipher side values are
+ * used instead. These algorithms ignore authentication side key
+ * and IV: ODP_AUTH_ALG_AES_GCM, ODP_AUTH_ALG_AES_CCM and
+ * ODP_AUTH_ALG_CHACHA20_POLY1305. Otherwise, all authentication side
+ * parameters must be set when authentication is enabled. The default
+ * value is ODP_AUTH_ALG_NULL.
+ */
+ odp_auth_alg_t auth_alg;
+
+ /** Authentication key
+ *
+ * Use odp_crypto_auth_capability() for supported key lengths.
+ */
+ odp_crypto_key_t auth_key;
+
+ /** Authentication IV length. The default value is zero. */
+ uint32_t auth_iv_len;
+
+ /** Authentication digest length in bytes
+ *
+ * Use odp_crypto_auth_capability() for supported digest lengths.
+ */
+ uint32_t auth_digest_len;
+
+ /** Additional Authenticated Data (AAD) length in bytes
+ *
+ * AAD length is constant for all operations (packets) of the session.
+ * Set to zero when AAD is not used. Use odp_crypto_auth_capability()
+ * for supported AAD lengths. The default value is zero.
+ */
+ uint32_t auth_aad_len;
+
+ /** Async mode completion event queue
+ *
+ * The completion queue is used to return completions from
+ * odp_crypto_op_enq() (and the deprecated odp_crypto_operation())
+ * to the application.
+ */
+ odp_queue_t compl_queue;
+
+ /** Output pool
+ *
+ * When the output packet is not specified during the call to
+ * crypto operation in the legacy operation type, the output
+ * packet will be allocated from this pool.
+ *
+ * In ODP_CRYPTO_OP_TYPE_BASIC and ODP_CRYPTO_OP_TYPE_OOP
+ * operation types this must be set to ODP_POOL_INVALID.
+ */
+ odp_pool_t output_pool;
+
+} odp_crypto_session_param_t;
+
+/**
+ * Crypto API per packet operation parameters
+ *
+ * @deprecated Use odp_crypto_packet_op_param_t instead.
+ */
+typedef struct odp_crypto_op_param_t {
+ /** Session handle from creation */
+ odp_crypto_session_t session;
+
+ /** User context */
+ void *ctx;
+
+ /** Input packet
+ *
+ * Specifies the input packet for the crypto operation. When the
+ * 'out_pkt' variable is set to ODP_PACKET_INVALID (indicating a new
+ * packet should be allocated for the resulting packet).
+ */
+ odp_packet_t pkt;
+
+ /** Output packet
+ *
+ * Both "in place" (the original packet 'pkt' is modified) and
+ * "copy" (the packet is replicated to a new packet which contains
+ * the modified data) modes are supported. The "in place" mode of
+ * operation is indicated by setting 'out_pkt' equal to 'pkt'.
+ * For the copy mode of operation, setting 'out_pkt' to a valid packet
+ * value indicates the caller wishes to specify the destination packet.
+ * Setting 'out_pkt' to ODP_PACKET_INVALID indicates the caller wishes
+ * the destination packet be allocated from the output pool specified
+ * during session creation.
+ */
+ odp_packet_t out_pkt;
+
+ /** IV pointer for cipher */
+ uint8_t *cipher_iv_ptr;
+
+ /** Authentication IV pointer */
+ uint8_t *auth_iv_ptr;
+
+ /** Offset from start of packet for hash result
+ *
+ * In case of decode sessions, the expected hash will be read from
+ * this offset and compared with the calculated hash. After the
+ * operation the hash bytes will have undefined values.
+ *
+ * In case of encode sessions the calculated hash will be stored in
+ * this offset.
+ *
+ * If the hash_result_in_auth_range session parameter is true,
+ * the hash result location may overlap auth_range. In that case
+ * the result location will be zeroed in decode sessions before
+ * hash calculation. Zeroing is not done in encode sessions.
+ */
+ uint32_t hash_result_offset;
+
+ /** Pointer to AAD. AAD length is defined by 'auth_aad_len'
+ * session parameter.
+ */
+ uint8_t *aad_ptr;
+
+ /** Data range to be ciphered */
+ odp_packet_data_range_t cipher_range;
+
+ /** Data range to be authenticated
+ *
+ * The value is ignored with authenticated encryption algorithms,
+ * such as AES-GCM, which authenticate data in the cipher range
+ * and the AAD.
+ *
+ * As a special case AES-GMAC uses this field instead of aad_ptr
+ * for the data bytes to be authenticated.
+ */
+ odp_packet_data_range_t auth_range;
+
+} ODP_DEPRECATE(odp_crypto_op_param_t);
+
+/**
+ * Crypto packet API per packet operation parameters
+ */
+typedef struct odp_crypto_packet_op_param_t {
+ /** Session handle from creation */
+ odp_crypto_session_t session;
+
+ /** IV pointer for cipher */
+ uint8_t *cipher_iv_ptr;
+
+ /** IV pointer for authentication */
+ uint8_t *auth_iv_ptr;
+
+ /** Offset from start of packet for hash result
+ *
+ * In case of decode sessions, the expected hash will be read from
+ * this offset from the input packet and compared with the calculated
+ * hash. After the operation the hash bytes will have undefined
+ * values except with out-of-place sessions (ODP_CRYPTO_OP_TYPE_OOP
+ * operation type).
+ *
+ * With out-of-place decode sessions the input packet is not modified
+ * but if the hash location overlaps the cipher range or the auth
+ * range, then the corresponding location in the output packet will
+ * have undefined content.
+ *
+ * In case of encode sessions the calculated hash will be stored in
+ * this offset in the output packet.
+ *
+ * If the hash_result_in_auth_range session parameter is true,
+ * the hash result location may overlap auth_range. In that case the
+ * result location will be treated as containing zero bytes for the
+ * purpose of hash calculation in decode sessions.
+ */
+ uint32_t hash_result_offset;
+
+ /** Pointer to AAD. AAD length is defined by 'auth_aad_len'
+ * session parameter.
+ */
+ uint8_t *aad_ptr;
+
+ /** Data range to apply cipher */
+ odp_packet_data_range_t cipher_range;
+
+ /** Data range to authenticate */
+ odp_packet_data_range_t auth_range;
+
+ /** Shift of the output offsets with ODP_CRYPTO_OP_TYPE_OOP
+ *
+ * The processed crypto range and auth range of the input packet
+ * will be written in the output packet at the offset specified
+ * in the ranges (i.e. the same as in the input packet), shifted
+ * by this many bytes. This allows directing the output to
+ * a different packet offset than the offset of the input data.
+ *
+ * This is ignored if the crypto operation type is not
+ * ODP_CRYPTO_OP_TYPE_OOP.
+ */
+ int32_t dst_offset_shift;
+
+} odp_crypto_packet_op_param_t;
+
+/**
+ * Crypto API session creation return code
+ */
+typedef enum {
+ /** Session created */
+ ODP_CRYPTO_SES_ERR_NONE,
+ /** Creation failed, no resources */
+ ODP_CRYPTO_SES_ERR_ENOMEM,
+ /** Creation failed, bad cipher params */
+ ODP_CRYPTO_SES_ERR_CIPHER,
+ /** Creation failed, bad auth params */
+ ODP_CRYPTO_SES_ERR_AUTH,
+
+ /** Unsupported combination of algorithms
+ *
+ * The combination of cipher and auth algorithms with their
+ * specific parameters is not supported even if the algorithms
+ * appear in capabilities and are supported in combination with
+ * other algorithms or other algorithm specific parameters.
+ */
+ ODP_CRYPTO_SES_ERR_ALG_COMBO,
+
+ /** Unsupported order of cipher and auth
+ *
+ * The requested mutual order of ciphering and authentication
+ * is not supported with the chosen individual cipher and
+ * authentication algorithms.
+ */
+ ODP_CRYPTO_SES_ERR_ALG_ORDER,
+
+ /** Unsupported combination of session creation parameters
+ *
+ * The combination of provided session creation parameters is not
+ * supported. This error can occur when there are limitations that
+ * are not expressible through crypto capabilities or other error
+ * status values.
+ */
+ ODP_CRYPTO_SES_ERR_PARAMS,
+} odp_crypto_ses_create_err_t;
+
+/** This synonym for backward compatibility will be deprecated later */
+#define ODP_CRYPTO_SES_CREATE_ERR_NONE ODP_CRYPTO_SES_ERR_NONE
+/** This synonym for backward compatibility will be deprecated later */
+#define ODP_CRYPTO_SES_CREATE_ERR_ENOMEM ODP_CRYPTO_SES_ERR_ENOMEM
+/** This synonym for backward compatibility will be deprecated later */
+#define ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER ODP_CRYPTO_SES_ERR_CIPHER
+/** This synonym for backward compatibility will be deprecated later */
+#define ODP_CRYPTO_SES_CREATE_ERR_INV_AUTH ODP_CRYPTO_SES_ERR_AUTH
+
+/**
+ * Crypto API algorithm return code
+ */
+typedef enum {
+ /** Algorithm successful */
+ ODP_CRYPTO_ALG_ERR_NONE,
+ /** Invalid data block size */
+ ODP_CRYPTO_ALG_ERR_DATA_SIZE,
+ /** Key size invalid for algorithm */
+ ODP_CRYPTO_ALG_ERR_KEY_SIZE,
+ /** Computed ICV value mismatch */
+ ODP_CRYPTO_ALG_ERR_ICV_CHECK,
+ /** IV value not specified */
+ ODP_CRYPTO_ALG_ERR_IV_INVALID,
+} odp_crypto_alg_err_t;
+
+/**
+ * Crypto API hardware centric return code
+ */
+typedef enum {
+ /** Operation completed successfully */
+ ODP_CRYPTO_HW_ERR_NONE,
+ /** Error detected during DMA of data */
+ ODP_CRYPTO_HW_ERR_DMA,
+ /** Operation failed due to pool depletion */
+ ODP_CRYPTO_HW_ERR_BP_DEPLETED,
+} odp_crypto_hw_err_t;
+
+/**
+ * Cryto API per packet operation completion status
+ */
+typedef struct odp_crypto_op_status {
+ /** Algorithm specific return code */
+ odp_crypto_alg_err_t alg_err;
+
+ /** Hardware specific return code */
+ odp_crypto_hw_err_t hw_err;
+
+} odp_crypto_op_status_t;
+
+/**
+ * Crypto API operation result
+ *
+ * @deprecated Use odp_crypto_packet_result_t instead.
+ */
+typedef struct odp_crypto_op_result {
+ /** Request completed successfully */
+ odp_bool_t ok;
+
+ /** User context from request */
+ void *ctx;
+
+ /** Output packet */
+ odp_packet_t pkt;
+
+ /** Cipher status */
+ odp_crypto_op_status_t cipher_status;
+
+ /** Authentication status */
+ odp_crypto_op_status_t auth_status;
+
+} ODP_DEPRECATE(odp_crypto_op_result_t);
+
+/**
+ * Crypto packet API operation result
+ */
+typedef struct odp_crypto_packet_result_t {
+ /** Request completed successfully */
+ odp_bool_t ok;
+
+ /** Input packet passed to odp_crypo_op_enq() when the operation
+ * type of the session is ODP_CRYPTO_OP_TYPE_OOP. In other cases
+ * this field does not have a valid value.
+ */
+ odp_packet_t pkt_in;
+
+ /** Cipher status */
+ odp_crypto_op_status_t cipher_status;
+
+ /** Authentication status */
+ odp_crypto_op_status_t auth_status;
+
+} odp_crypto_packet_result_t;
+
+/**
+ * Crypto capabilities
+ */
+typedef struct odp_crypto_capability_t {
+ /** Maximum number of crypto sessions */
+ uint32_t max_sessions;
+
+ /** Supported packet operation in SYNC mode */
+ odp_support_t sync_mode;
+
+ /** Supported packet operation in ASYNC mode */
+ odp_support_t async_mode;
+
+ /** Supported cipher algorithms */
+ odp_crypto_cipher_algos_t ciphers;
+
+ /** Cipher algorithms implemented with HW offload */
+ odp_crypto_cipher_algos_t hw_ciphers;
+
+ /** Supported authentication algorithms */
+ odp_crypto_auth_algos_t auths;
+
+ /** Authentication algorithms implemented with HW offload */
+ odp_crypto_auth_algos_t hw_auths;
+
+ /**
+ * Scheduled crypto completion queue support
+ *
+ * This defines whether scheduled queues are supported as crypto
+ * compl_queue.
+ * 0: Scheduled queues are not supported as crypto completion queues
+ * 1: Scheduled queues are supported as crypto completion queues
+ * @see odp_crypto_session_param_t
+ */
+ odp_bool_t queue_type_sched;
+
+ /**
+ * Plain crypto completion queue support
+ *
+ * This defines whether plain queues are supported as crypto
+ * compl_queue.
+ * 0: Plain queues are not supported as crypto completion queues
+ * 1: Plain queues are supported as crypto completion queues
+ * @see odp_crypto_session_param_t
+ */
+ odp_bool_t queue_type_plain;
+} odp_crypto_capability_t;
+
+/**
+ * Cipher algorithm capabilities
+ */
+typedef struct odp_crypto_cipher_capability_t {
+ /** Key length in bytes */
+ uint32_t key_len;
+
+ /** IV length in bytes */
+ uint32_t iv_len;
+
+ /** Cipher is operating in bitwise mode
+ *
+ * This cipher works on series of bits, rather than sequences of bytes:
+ * cipher_range in odp_crypto_op_param_t and
+ * odp_crypto_packet_op_param_t will use bits, rather than bytes.
+ *
+ * Note: data buffer MUST start on the byte boundary, using offset
+ * which is not divisible by 8 is unsupported and will result in
+ * unspecified behaviour.
+ *
+ * Note2: If the data length is not a multiple of 8, the remaining
+ * bits of the data in the last byte of the input/output will be the
+ * most significant bits, i.e. the most significant bit is considered
+ * to be the first bit of a byte for the purpose of input and output
+ * data range. The output bits that fall out of the output range are
+ * undefined.
+ */
+ odp_bool_t bit_mode;
+
+} odp_crypto_cipher_capability_t;
+
+/**
+ * Authentication algorithm capabilities
+ */
+typedef struct odp_crypto_auth_capability_t {
+ /** Digest length in bytes */
+ uint32_t digest_len;
+
+ /** Key length in bytes */
+ uint32_t key_len;
+
+ /** IV length in bytes */
+ uint32_t iv_len;
+
+ /** Additional Authenticated Data (AAD) lengths */
+ struct {
+ /** Minimum AAD length in bytes */
+ uint32_t min;
+
+ /** Maximum AAD length in bytes */
+ uint32_t max;
+
+ /** Increment of supported lengths between min and max
+ * (in bytes) */
+ uint32_t inc;
+ } aad_len;
+
+ /** Auth is operating in bitstring mode
+ *
+ * This auth works on series of bits, rather than sequences of bytes:
+ * auth_range in odp_crypto_op_param_t and
+ * odp_crypto_packet_op_param_t will use bits, rather than bytes.
+ *
+ * Note: data buffer MUST start on the byte boundary, using offset
+ * which is not divisible by 8 is unsupported and will result in
+ * unpredictable behaviour.
+ *
+ * Note2: If the data length is not a multiple of 8, the remaining
+ * bits of the data in the last byte of the input/output will be the
+ * most significant bits, i.e. the most significant bit is considered
+ * to be the first bit of a byte for the purpose of input and output
+ * data range. The output bits that fall out of the output range are
+ * undefined.
+ */
+ odp_bool_t bit_mode;
+
+} odp_crypto_auth_capability_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <odp/visibility_end.h>
+#endif
diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index b091961cc..603bf3aef 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -19,7 +19,7 @@
extern "C" {
#endif
-#include <odp/api/crypto.h>
+#include <odp/api/crypto_types.h>
#include <odp/api/event_types.h>
#include <odp/api/ipsec_types.h>
#include <odp/api/packet_types.h>
diff --git a/include/odp/api/spec/ipsec_types.h b/include/odp/api/spec/ipsec_types.h
index b74d26d4f..b34fb5982 100644
--- a/include/odp/api/spec/ipsec_types.h
+++ b/include/odp/api/spec/ipsec_types.h
@@ -20,7 +20,7 @@ extern "C" {
#endif
#include <odp/api/classification.h>
-#include <odp/api/crypto.h>
+#include <odp/api/crypto_types.h>
#include <odp/api/packet_io_types.h>
#include <odp/api/protocols.h>
#include <odp/api/std_types.h>
diff --git a/include/odp/api/spec/packet_flags.h b/include/odp/api/spec/packet_flags.h
index 98bf2b7bf..c62e50885 100644
--- a/include/odp/api/spec/packet_flags.h
+++ b/include/odp/api/spec/packet_flags.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2014-2018, Linaro Limited
+ * Copyright (c) 2023, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -22,7 +23,13 @@ extern "C" {
#include <odp/api/packet_types.h>
/** @addtogroup odp_packet
- * Operations on packet metadata flags.
+ * @par Operations on packet metadata flags
+ *
+ * If user sets multiple conflicting packet metadata flags
+ * using odp_packet_has_XX_set() functions, only the last set flag value is
+ * guaranteed to hold. The values of other conflicting flags are implementation
+ * specific. The conflicting flag combinations are defined in function
+ * documentations.
* @{
*/
@@ -172,6 +179,8 @@ int odp_packet_has_jumbo(odp_packet_t pkt);
/**
* Check for VLAN
*
+ * Check if packet contains normal or QinQ VLAN header.
+ *
* @param pkt Packet handle
*
* @retval non-zero Packet contains a VLAN header
@@ -182,6 +191,8 @@ int odp_packet_has_vlan(odp_packet_t pkt);
/**
* Check for VLAN QinQ (stacked VLAN)
*
+ * Check if packet contains QinQ VLAN header.
+ *
* @param pkt Packet handle
*
* @retval non-zero Packet contains a VLAN QinQ header
@@ -401,6 +412,9 @@ void odp_packet_has_jumbo_set(odp_packet_t pkt, int val);
/**
* Set flag for VLAN
*
+ * Set when packet contains normal VLAN header. Only one VLAN flag
+ * (VLAN/VLAN QinQ) can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
@@ -409,6 +423,9 @@ void odp_packet_has_vlan_set(odp_packet_t pkt, int val);
/**
* Set flag for VLAN QinQ (stacked VLAN)
*
+ * Set when packet contains QinQ VLAN header. Only one VLAN flag
+ * (VLAN/VLAN QinQ) can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
@@ -417,6 +434,8 @@ void odp_packet_has_vlan_qinq_set(odp_packet_t pkt, int val);
/**
* Set flag for ARP
*
+ * Only one of ARP/IPv4/IPv6 flags can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
@@ -425,6 +444,8 @@ void odp_packet_has_arp_set(odp_packet_t pkt, int val);
/**
* Set flag for IPv4
*
+ * Only one of ARP/IPv4/IPv6 flags can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
@@ -433,6 +454,8 @@ void odp_packet_has_ipv4_set(odp_packet_t pkt, int val);
/**
* Set flag for IPv6
*
+ * Only one of ARP/IPv4/IPv6 flags can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
@@ -441,6 +464,8 @@ void odp_packet_has_ipv6_set(odp_packet_t pkt, int val);
/**
* Set flag for IP broadcast address
*
+ * Only one of IP broadcast/multicast flags can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
@@ -449,6 +474,8 @@ void odp_packet_has_ip_bcast_set(odp_packet_t pkt, int val);
/**
* Set flag for IP multicast address
*
+ * Only one of IP broadcast/multicast flags can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
@@ -481,6 +508,8 @@ void odp_packet_has_ipsec_set(odp_packet_t pkt, int val);
/**
* Set flag for UDP
*
+ * Only one of TCP/UDP/SCTP/ICMP flags can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
@@ -489,6 +518,8 @@ void odp_packet_has_udp_set(odp_packet_t pkt, int val);
/**
* Set flag for TCP
*
+ * Only one of TCP/UDP/SCTP/ICMP flags can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
@@ -497,6 +528,8 @@ void odp_packet_has_tcp_set(odp_packet_t pkt, int val);
/**
* Set flag for SCTP
*
+ * Only one of TCP/UDP/SCTP/ICMP flags can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
@@ -505,6 +538,8 @@ void odp_packet_has_sctp_set(odp_packet_t pkt, int val);
/**
* Set flag for ICMP
*
+ * Only one of TCP/UDP/SCTP/ICMP flags can be set simultaneously.
+ *
* @param pkt Packet handle
* @param val Value
*/
diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index e8f0cd0b9..9a6117cee 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -20,7 +20,6 @@ extern "C" {
#endif
#include <odp/api/classification.h>
-#include <odp/api/deprecated.h>
#include <odp/api/packet_types.h>
#include <odp/api/packet_io_stats.h>
#include <odp/api/packet_io_types.h>
@@ -833,38 +832,6 @@ int odp_pktio_info(odp_pktio_t pktio, odp_pktio_info_t *info);
int odp_pktio_link_info(odp_pktio_t pktio, odp_pktio_link_info_t *info);
/**
- * Packet input timestamp resolution in hertz
- *
- * @deprecated Use odp_pktio_ts_res() instead, which returns resolution for
- * both packet input and output timestamps.
- *
- * This is the resolution of packet input timestamps. Returns zero on a failure
- * or when timestamping is disabled.
- *
- * @param pktio Packet IO handle
- *
- * @return Packet input timestamp resolution in hertz
- * @retval 0 on failure
- */
-uint64_t ODP_DEPRECATE(odp_pktin_ts_res)(odp_pktio_t pktio);
-
-/**
- * Convert nanoseconds to packet input time
- *
- * @deprecated Use odp_pktio_ts_from_ns() instead, which can be used with both
- * packet input and output timestamps.
- *
- * Packet input time source is used for timestamping incoming packets.
- * This function is used convert nanosecond time to packet input timestamp time.
- *
- * @param pktio Packet IO handle
- * @param ns Time in nanoseconds
- *
- * @return Packet input timestamp
- */
-odp_time_t ODP_DEPRECATE(odp_pktin_ts_from_ns)(odp_pktio_t pktio, uint64_t ns);
-
-/**
* Packet IO timestamp resolution in hertz
*
* This is the resolution of packet input and output timestamps using a packet
diff --git a/include/odp/api/spec/packet_io_stats.h b/include/odp/api/spec/packet_io_stats.h
index c6b782d5a..156a3a95e 100644
--- a/include/odp/api/spec/packet_io_stats.h
+++ b/include/odp/api/spec/packet_io_stats.h
@@ -19,7 +19,6 @@
extern "C" {
#endif
-#include <odp/api/deprecated.h>
#include <odp/api/queue_types.h>
/** @addtogroup odp_packet_io
@@ -68,20 +67,6 @@ typedef struct odp_pktio_stats_t {
* configuration, packets with errors may be dropped or not. */
uint64_t in_errors;
- /**
- * For packet-oriented interfaces, the number of packets received via
- * the interface which were discarded because of an unknown or
- * unsupported protocol. For character-oriented or fixed-length
- * interfaces that support protocol multiplexing the number of
- * transmission units received via the interface which were discarded
- * because of an unknown or unsupported protocol. For any interface
- * that does not support protocol multiplexing, this counter will always
- * be 0. See ifInUnknownProtos in RFC 2863, RFC 3635.
- *
- * @deprecated This counter has been deprecated.
- */
- uint64_t ODP_DEPRECATE(in_unknown_protos);
-
/** Number of octets in successfully transmitted packets. In case of
* Ethernet, packet size includes MAC header. */
uint64_t out_octets;
diff --git a/include/odp/api/spec/packet_io_types.h b/include/odp/api/spec/packet_io_types.h
index fe86f6f12..a46668c30 100644
--- a/include/odp/api/spec/packet_io_types.h
+++ b/include/odp/api/spec/packet_io_types.h
@@ -19,7 +19,6 @@
extern "C" {
#endif
-#include <odp/api/deprecated.h>
#include <odp/api/packet_types.h>
#include <odp/api/packet_io_stats.h>
#include <odp/api/pool_types.h>
diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h
index 36b38782f..eebf288c9 100644
--- a/include/odp/api/spec/shared_memory.h
+++ b/include/odp/api/spec/shared_memory.h
@@ -51,19 +51,6 @@ extern "C" {
*/
/**
- * Application SW only, no HW access
- *
- * @deprecated When set, application will not share the reserved memory with HW
- * accelerators. However, leaving this flag to zero does not guarantee that
- * the reserved memory can be accessed from HW, and thus usage of this flag is
- * considered deprecated. If HW accessible memory is required, set
- * ODP_SHM_HW_ACCESS instead.
- *
- * This flag must not be combined with ODP_SHM_HW_ACCESS.
- */
-#define ODP_SHM_SW_ONLY 0x1
-
-/**
* Share with external processes
*/
#define ODP_SHM_PROC 0x2
diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h
index edfa423e7..0e1f07f09 100644
--- a/include/odp/api/spec/timer.h
+++ b/include/odp/api/spec/timer.h
@@ -20,6 +20,7 @@
extern "C" {
#endif
+#include <odp/api/deprecated.h>
#include <odp/api/timer_types.h>
#include <odp/api/event_types.h>
#include <odp/api/pool_types.h>
@@ -387,7 +388,7 @@ int odp_timer_periodic_cancel(odp_timer_t timer);
*
* @deprecated Use odp_timer_start() or odp_timer_restart() instead
*/
-int odp_timer_set_abs(odp_timer_t timer, uint64_t abs_tick, odp_event_t *tmo_ev);
+int ODP_DEPRECATE(odp_timer_set_abs)(odp_timer_t timer, uint64_t abs_tick, odp_event_t *tmo_ev);
/**
* Set (or reset) a timer with relative expiration time
@@ -416,7 +417,7 @@ int odp_timer_set_abs(odp_timer_t timer, uint64_t abs_tick, odp_event_t *tmo_ev)
*
* @deprecated Use odp_timer_start() or odp_timer_restart() instead
*/
-int odp_timer_set_rel(odp_timer_t timer, uint64_t rel_tick, odp_event_t *tmo_ev);
+int ODP_DEPRECATE(odp_timer_set_rel)(odp_timer_t timer, uint64_t rel_tick, odp_event_t *tmo_ev);
/**
* Cancel a timer
diff --git a/include/odp/api/spec/timer_types.h b/include/odp/api/spec/timer_types.h
index 754c831b2..d61992fba 100644
--- a/include/odp/api/spec/timer_types.h
+++ b/include/odp/api/spec/timer_types.h
@@ -20,8 +20,9 @@
extern "C" {
#endif
-#include <odp/api/std_types.h>
+#include <odp/api/deprecated.h>
#include <odp/api/event_types.h>
+#include <odp/api/std_types.h>
/** @defgroup odp_timer ODP TIMER
* Timer generating timeout events.
@@ -245,13 +246,21 @@ typedef enum {
/** The default clock source */
#define ODP_CLOCK_DEFAULT ODP_CLOCK_SRC_0
-/** For backwards compatibility, ODP_CLOCK_CPU is synonym of ODP_CLOCK_DEFAULT.
- * This will be deprecated in the future. */
+#if ODP_DEPRECATED_API
+/**
+ * For backwards compatibility, ODP_CLOCK_CPU is synonym of ODP_CLOCK_DEFAULT.
+ *
+ * @deprecated Use #ODP_CLOCK_DEFAULT instead.
+ */
#define ODP_CLOCK_CPU ODP_CLOCK_DEFAULT
-/** For backwards compatibility, ODP_CLOCK_EXT is synonym of ODP_CLOCK_SRC_1.
- * This will be deprecated in the future. */
+/**
+ * For backwards compatibility, ODP_CLOCK_EXT is synonym of ODP_CLOCK_SRC_1.
+ *
+ * @deprecated Use #ODP_CLOCK_SRC_1 instead.
+ */
#define ODP_CLOCK_EXT ODP_CLOCK_SRC_1
+#endif
/**
* Timer expiration mode
@@ -514,17 +523,28 @@ typedef enum {
} odp_timer_set_t;
-/** For backwards compatibility, ODP_TIMER_TOOEARLY is synonym of ODP_TIMER_TOO_NEAR.
- * This will be deprecated in the future. */
+#if ODP_DEPRECATED_API
+/**
+ * For backwards compatibility, ODP_TIMER_TOOEARLY is synonym of ODP_TIMER_TOO_NEAR.
+ *
+ * @deprecated Use #ODP_TIMER_TOO_NEAR instead.
+ */
#define ODP_TIMER_TOOEARLY ODP_TIMER_TOO_NEAR
-/** For backwards compatibility, ODP_TIMER_TOOLATE is synonym of ODP_TIMER_TOO_FAR.
- * This will be deprecated in the future. */
+/**
+ * For backwards compatibility, ODP_TIMER_TOOLATE is synonym of ODP_TIMER_TOO_FAR.
+ *
+ * @deprecated Use #ODP_TIMER_TOO_FAR instead.
+ */
#define ODP_TIMER_TOOLATE ODP_TIMER_TOO_FAR
-/** For backwards compatibility, ODP_TIMER_NOEVENT is synonym of ODP_TIMER_FAIL.
- * This will be deprecated in the future. */
+/**
+ * For backwards compatibility, ODP_TIMER_NOEVENT is synonym of ODP_TIMER_FAIL.
+ *
+ * @deprecated Use #ODP_TIMER_FAIL instead.
+ */
#define ODP_TIMER_NOEVENT ODP_TIMER_FAIL
+#endif
/**
* Timer tick information
diff --git a/include/odp/api/spec/traffic_mngr.h b/include/odp/api/spec/traffic_mngr.h
index f634cfb44..9bd735a7a 100644
--- a/include/odp/api/spec/traffic_mngr.h
+++ b/include/odp/api/spec/traffic_mngr.h
@@ -745,39 +745,6 @@ void odp_tm_requirements_init(odp_tm_requirements_t *requirements);
*/
void odp_tm_egress_init(odp_tm_egress_t *egress);
-/** Query All TM Capabilities
- *
- * @deprecated Use odp_tm_egress_capabilities() instead that also additionally
- * takes egress as input to provide capabilities specific to a given egress.
- *
- * This function returns the set of TM capabilities that are common for all
- * egresses. The reason that this returns a SET of capabilities and not just
- * one, is because it is expected that many HW based implementations may have
- * one set of limits for the HW and also support a SW TM implementation with a
- * (presumably larger) different set of limits. There are also cases where
- * there could be more than one SW implementation (one supporting say tens of
- * thousands of tm_queues and a variant supporting tens of millions of
- * tm_queues). It returns capabilities that are valid for all egresses.
- * The caller passes in an array of odp_tm_capabilities_t records and the
- * maximum number of such records to output. If number of such records
- * implementation supports is larger than caller requested number, then
- * only caller requested number of records are written and return value is
- * max number of records implementation supports.
- * Caller then may again call with larger number of records to be returned.
- *
- * @param[out] capabilities An array of odp_tm_capabilities_t records to
- * be filled in.
- * @param capabilities_size The number of odp_tm_capabilities_t records
- * in the capabilities array.
- * @return Returns < 0 upon failure. Returns N > 0,
- * where N is the maximum number of different
- * odp_tm_capabilities_t records that the
- * implementations supports. *NOTE* that this
- * number can be > capabilities_size!
- */
-int ODP_DEPRECATE(odp_tm_capabilities)(odp_tm_capabilities_t capabilities[],
- uint32_t capabilities_size);
-
/** Query TM Capabilities specific to an egress
*
* The function returns the set of TM limits supported by this implementation
@@ -1094,22 +1061,14 @@ typedef struct {
* for this integer is in bits per second when packet_mode is
* not TRUE while packets per second when packet mode is TRUE.
*/
- union {
- /** @deprecated Use commit_rate instead */
- uint64_t ODP_DEPRECATE(commit_bps);
- uint64_t commit_rate; /**< Commit information rate */
- };
+ uint64_t commit_rate;
/** The peak information rate for this shaper profile. The units for
* this integer is in bits per second when packet_mode is
* not TRUE while in packets per second when packet mode is TRUE.
* This field is ignored when dual_rate is FALSE.
*/
- union {
- /** @deprecated Use peak_rate instead */
- uint64_t ODP_DEPRECATE(peak_bps);
- uint64_t peak_rate; /**< Peak information rate */
- };
+ uint64_t peak_rate;
/** The commit burst tolerance for this shaper profile. The units for
* this field is bits when packet_mode is not TRUE and packets when
diff --git a/include/odp/arch/arm32-linux/odp/api/abi/buffer_types.h b/include/odp/arch/arm32-linux/odp/api/abi/buffer_types.h
new file mode 100644
index 000000000..8dd78321f
--- /dev/null
+++ b/include/odp/arch/arm32-linux/odp/api/abi/buffer_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/buffer_types.h>
diff --git a/include/odp/arch/arm32-linux/odp/api/abi/crypto_types.h b/include/odp/arch/arm32-linux/odp/api/abi/crypto_types.h
new file mode 100644
index 000000000..ddadec1c1
--- /dev/null
+++ b/include/odp/arch/arm32-linux/odp/api/abi/crypto_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/crypto_types.h>
diff --git a/include/odp/arch/arm64-linux/odp/api/abi/buffer_types.h b/include/odp/arch/arm64-linux/odp/api/abi/buffer_types.h
new file mode 100644
index 000000000..8dd78321f
--- /dev/null
+++ b/include/odp/arch/arm64-linux/odp/api/abi/buffer_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/buffer_types.h>
diff --git a/include/odp/arch/arm64-linux/odp/api/abi/crypto_types.h b/include/odp/arch/arm64-linux/odp/api/abi/crypto_types.h
new file mode 100644
index 000000000..ddadec1c1
--- /dev/null
+++ b/include/odp/arch/arm64-linux/odp/api/abi/crypto_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/crypto_types.h>
diff --git a/include/odp/arch/default-linux/odp/api/abi/buffer_types.h b/include/odp/arch/default-linux/odp/api/abi/buffer_types.h
new file mode 100644
index 000000000..8dd78321f
--- /dev/null
+++ b/include/odp/arch/default-linux/odp/api/abi/buffer_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/buffer_types.h>
diff --git a/include/odp/arch/default-linux/odp/api/abi/crypto_types.h b/include/odp/arch/default-linux/odp/api/abi/crypto_types.h
new file mode 100644
index 000000000..ddadec1c1
--- /dev/null
+++ b/include/odp/arch/default-linux/odp/api/abi/crypto_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/crypto_types.h>
diff --git a/include/odp/arch/power64-linux/odp/api/abi/buffer_types.h b/include/odp/arch/power64-linux/odp/api/abi/buffer_types.h
new file mode 100644
index 000000000..8dd78321f
--- /dev/null
+++ b/include/odp/arch/power64-linux/odp/api/abi/buffer_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/buffer_types.h>
diff --git a/include/odp/arch/power64-linux/odp/api/abi/crypto_types.h b/include/odp/arch/power64-linux/odp/api/abi/crypto_types.h
new file mode 100644
index 000000000..ddadec1c1
--- /dev/null
+++ b/include/odp/arch/power64-linux/odp/api/abi/crypto_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/crypto_types.h>
diff --git a/include/odp/arch/x86_32-linux/odp/api/abi/buffer_types.h b/include/odp/arch/x86_32-linux/odp/api/abi/buffer_types.h
new file mode 100644
index 000000000..8dd78321f
--- /dev/null
+++ b/include/odp/arch/x86_32-linux/odp/api/abi/buffer_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/buffer_types.h>
diff --git a/include/odp/arch/x86_32-linux/odp/api/abi/crypto_types.h b/include/odp/arch/x86_32-linux/odp/api/abi/crypto_types.h
new file mode 100644
index 000000000..ddadec1c1
--- /dev/null
+++ b/include/odp/arch/x86_32-linux/odp/api/abi/crypto_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/crypto_types.h>
diff --git a/include/odp/arch/x86_64-linux/odp/api/abi/buffer_types.h b/include/odp/arch/x86_64-linux/odp/api/abi/buffer_types.h
new file mode 100644
index 000000000..8dd78321f
--- /dev/null
+++ b/include/odp/arch/x86_64-linux/odp/api/abi/buffer_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/buffer_types.h>
diff --git a/include/odp/arch/x86_64-linux/odp/api/abi/crypto_types.h b/include/odp/arch/x86_64-linux/odp/api/abi/crypto_types.h
new file mode 100644
index 000000000..ddadec1c1
--- /dev/null
+++ b/include/odp/arch/x86_64-linux/odp/api/abi/crypto_types.h
@@ -0,0 +1,7 @@
+/* Copyright (c) 2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/abi-default/crypto_types.h>
diff --git a/include/odp/autoheader_external.h.in b/include/odp/autoheader_external.h.in
index dd60fa0b2..74662b2e0 100644
--- a/include/odp/autoheader_external.h.in
+++ b/include/odp/autoheader_external.h.in
@@ -11,4 +11,7 @@
/* Define cache line size */
#undef _ODP_CACHE_LINE_SIZE
+/* Define to 1 or 2 to enable event validation */
+#undef _ODP_EVENT_VALIDATION
+
#endif
diff --git a/include/odp/autoheader_internal.h.in b/include/odp/autoheader_internal.h.in
index 33d9f280f..a42b34ad0 100644
--- a/include/odp/autoheader_internal.h.in
+++ b/include/odp/autoheader_internal.h.in
@@ -35,4 +35,7 @@
/* Define to 1 to enable XDP support */
#undef _ODP_PKTIO_XDP
+/* Define to 1 to enable IPSec MB crypto support */
+#undef _ODP_IPSECMB
+
#endif