diff mbox

[API-NEXT,1/2] linux-generic: crypto: capability support

Message ID 1461573035-20748-1-git-send-email-balakrishna.garapati@linaro.org
State Superseded
Headers show

Commit Message

Balakrishna Garapati April 25, 2016, 8:30 a.m. UTC
Get the available cipher and authentication algorithms
in the odp sw implementation.

Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>
---
 include/odp/api/spec/crypto.h       |  8 ++++----
 platform/linux-generic/odp_crypto.c | 25 +++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index 3e78547..d8123e9 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -316,11 +316,11 @@  typedef struct odp_crypto_capability_t {
 	/** Maximum number of crypto sessions */
 	uint32_t max_sessions;
 
-	/** Supported chipher algorithms */
-	odp_crypto_cipher_algos_t chiphers;
+	/** Supported cipher algorithms */
+	odp_crypto_cipher_algos_t ciphers;
 
-	/** Chipher algorithms implemented with HW offload */
-	odp_crypto_cipher_algos_t hw_chiphers;
+	/** Cipher algorithms implemented with HW offload */
+	odp_crypto_cipher_algos_t hw_ciphers;
 
 	/** Supported authentication algorithms */
 	odp_crypto_auth_algos_t   auths;
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 7448575..89488fd 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -597,6 +597,31 @@  int process_sha256_params(odp_crypto_generic_session_t *session,
 	return 0;
 }
 
+int odp_crypto_capability(odp_crypto_capability_t *capa)
+{
+	if (NULL == capa)
+		return -1;
+
+	capa->ciphers.bit.null = 1;
+	capa->ciphers.bit.des = 1;
+	capa->ciphers.bit.trides_cbc  = 1;
+	capa->ciphers.bit.aes128_cbc  = 1;
+	capa->ciphers.bit.aes128_gcm  = 1;
+
+	capa->auths.bit.null = 1;
+	capa->auths.bit.md5_96 = 1;
+	capa->auths.bit.sha256_128 = 1;
+	capa->auths.bit.aes128_gcm  = 1;
+
+	/* turn off the hw offload capability */
+	capa->hw_ciphers.all_bits = 0;
+	capa->hw_auths.all_bits = 0;
+
+	capa->max_sessions = MAX_SESSIONS;
+
+	return 0;
+}
+
 int
 odp_crypto_session_create(odp_crypto_session_params_t *params,
 			  odp_crypto_session_t *session_out,