diff mbox

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

Message ID 1461649434-801-1-git-send-email-balakrishna.garapati@linaro.org
State Accepted
Commit c05e53db3bbc57917067cf20c0504fded2d3640f
Headers show

Commit Message

Balakrishna Garapati April 26, 2016, 5:43 a.m. UTC
Get the available cipher and authentication algorithms
in the odp sw implementation.

Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>
---
 v3: capability initialization (Bill)

 include/odp/api/spec/crypto.h       |  8 ++++----
 platform/linux-generic/odp_crypto.c | 24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 4 deletions(-)

--
1.9.1
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..ffe2988 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -597,6 +597,30 @@  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;
+
+	/* Initialize crypto capability structure */
+	memset(capa, 0, sizeof(odp_crypto_capability_t));
+
+	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;
+
+	capa->max_sessions = MAX_SESSIONS;
+
+	return 0;
+}
+
 int
 odp_crypto_session_create(odp_crypto_session_params_t *params,
 			  odp_crypto_session_t *session_out,