Frequently used name: caps
odp_crypto_capablity_t -> odp_crypto_caps_t
On 14.04.16 11:50, Savolainen, Petri (Nokia - FI/Espoo) wrote:
Hi,
See under my proposal on using bit fields and a capability struct similar to
what we have already for other APIs. Application may easily check if multiple
ciphers are support and especially if those are implemented with HW offload.
-Petri
odp_crypto_ciphers_t ciphers;
odp_pktio_capability_t capa;
ciphers.all_bits = 0;
ciphers.3des_cbc = 1;
ciphers.aes128_cbc = 1;
odp_crypto_capability(&capa);
if (capa.chiphers.all_bits & ciphers.all_bits == 0) {
// 3des or aes are not supported
...
return -1;
}
if (capa.hw_chiphers.all_bits & ciphers.all_bits == 0) {
// 3des or aes are not supported in HW
...
}
typedef union odp_crypto_ciphers_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 3des_cbc : 1;
/** ODP_CIPHER_ALG_AES128_CBC */
uint32_t aes128_cbc : 1;
/** ODP_CIPHER_ALG_AES128_GCM */
uint32_t aes128_gcm : 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_ciphers_t;
typedef union odp_crypto_auths_t {
/** Cipher algorithms */
struct {
/** ODP_AUTH_ALG_NULL */
uint32_t null : 1;
/** ODP_AUTH_ALG_MD5_96 */
uint32_t md5_96 : 1;
/** ODP_AUTH_ALG_SHA256_128 */
uint32_t sha256_128 : 1;
/** ODP_AUTH_ALG_AES128_GCM */
uint32_t aes128_gcm : 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_auths_t;
typedef struct odp_crypto_capability_t {
/** Maximum number of crypto sessions */
uint32_t max_sessions;
/** Supported chipher algorithms */
odp_crypto_ciphers_t chiphers;
/** Chipher algorithms implemented with HW offload */
odp_crypto_ciphers_t hw_chiphers;
/** Supported authentication algorithms */
odp_crypto_auths_t auths;
/** Authentication algorithms implemented with HW offload */
odp_crypto_auths_t hw_auths;
} odp_crypto_capability_t;
/**
* Query crypto capabilities
*
* Outputs crypto capabilities on success.
*
* @param[out] capa Pointer to capability structure for output
*
* @retval 0 on success
* @retval <0 on failure
*/
int odp_crypto_capability(odp_pktio_capability_t *capa);
-----Original Message-----
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
Balakrishna Garapati
Sent: Wednesday, April 13, 2016 3:33 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [RFC] api: crypto capability support
This RFC provides the support for the applicationis to inquire the given
cipher, authentication algorithms
Signed-off-by: Balakrishna Garapati <balakrishna.garap...@linaro.org>
---
include/odp/api/spec/crypto.h | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index 41beedb..0def211 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -254,6 +254,18 @@ typedef struct odp_crypto_op_result {
} odp_crypto_op_result_t;
/**
+ * Crypto API capability result
+ */
+typedef enum odp_crypto_capability_t {
+ /** crypto algorithm not supported */
+ ODP_CRYPTO_NO_SUPPORT = 0,
+ /** crypto algorithm supported in hardware */
+ ODP_CRYPTO_HW_SUPPORT,
+ /** crypto algortihm supported in software */
+ ODP_CRYPTO_SW_SUPPORT
+} odp_crypto_capability_t;
+
+/**
* Crypto session creation (synchronous)
*
* @param params Session parameters
@@ -368,6 +380,24 @@ uint64_t
odp_crypto_session_to_u64(odp_crypto_session_t hdl);
uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl);
/**
+ * Verify the given crypto cipher algorithm support
+ *
+ * @param alg odp_cipher_alg_t to be verified
+ * @return odp_crypto_capability_t
+ *
+ */
+odp_crypto_capability_t odp_crypto_cipher_inquiry(odp_cipher_alg_t alg);
+
+/**
+ * Verify the given crypto authentication algorithm support
+ *
+ * @param alg odp_auth_alg_t to be verified
+ * @return odp_crypto_capability_t
+ *
+ */
+odp_crypto_capability_t odp_crypto_auth_inquiry(odp_auth_alg_t alg);
+
+/**
* @}
*/
--
1.9.1
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp
--
Regards,
Ivan Khoronzhuk
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp