diff mbox series

[v4,3/4] linux-gen: crypto: move session type to odp_crypto module

Message ID 1513249216-2411-4-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v4,1/4] performance: add AES tests to crypto performance tests | expand

Commit Message

Github ODP bot Dec. 14, 2017, 11 a.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


There is no point in having odp_crypto_generic_session_t definition in
global include file. Move it to odp_crypto module.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 342 (lumag:openssl-ctx)
 ** https://github.com/Linaro/odp/pull/342
 ** Patch: https://github.com/Linaro/odp/pull/342.patch
 ** Base sha: 6b5cdc77eb9759a2349b10372a964648559bc92c
 ** Merge commit sha: 3f12a06ef07bd4cf8b6a4d8350ba06e75299b8f6
 **/
 .../linux-generic/include/odp_crypto_internal.h    | 50 ----------------------
 platform/linux-generic/odp_crypto.c                | 41 +++++++++++++++++-
 2 files changed, 40 insertions(+), 51 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/include/odp_crypto_internal.h b/platform/linux-generic/include/odp_crypto_internal.h
index c3b70b231..bdbbf7379 100644
--- a/platform/linux-generic/include/odp_crypto_internal.h
+++ b/platform/linux-generic/include/odp_crypto_internal.h
@@ -11,50 +11,8 @@ 
 extern "C" {
 #endif
 
-#include <openssl/evp.h>
-
-#define MAX_IV_LEN      64
 #define OP_RESULT_MAGIC 0x91919191
 
-/** Forward declaration of session structure */
-typedef struct odp_crypto_generic_session odp_crypto_generic_session_t;
-
-/**
- * Algorithm handler function prototype
- */
-typedef
-odp_crypto_alg_err_t (*crypto_func_t)(odp_crypto_op_param_t *param,
-				      odp_crypto_generic_session_t *session);
-
-/**
- * Per crypto session data structure
- */
-struct odp_crypto_generic_session {
-	struct odp_crypto_generic_session *next;
-
-	/* Session creation parameters */
-	odp_crypto_session_param_t p;
-
-	odp_bool_t do_cipher_first;
-
-	struct {
-		/* Copy of session IV data */
-		uint8_t iv_data[MAX_IV_LEN];
-		uint8_t key_data[EVP_MAX_KEY_LENGTH];
-
-		const EVP_CIPHER *evp_cipher;
-		crypto_func_t func;
-	} cipher;
-
-	struct {
-		uint8_t  key[EVP_MAX_KEY_LENGTH];
-		uint32_t key_length;
-		uint32_t bytes;
-		const EVP_MD *evp_md;
-		crypto_func_t func;
-	} auth;
-};
-
 /**
  * Per packet operation result
  */
@@ -63,14 +21,6 @@  typedef struct odp_crypto_generic_op_result {
 	odp_crypto_op_result_t result;
 } odp_crypto_generic_op_result_t;
 
-/**
- * Per session creation operation result
- */
-typedef struct odp_crypto_generic_session_result {
-	odp_crypto_ses_create_err_t    rc;
-	odp_crypto_session_t           session;
-} odp_crypto_generic_session_result_t;
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 4c708931a..9b5d94034 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -75,6 +75,45 @@  static const odp_crypto_auth_capability_t auth_capa_sha512_hmac[] = {
 static const odp_crypto_auth_capability_t auth_capa_aes_gcm[] = {
 {.digest_len = 16, .key_len = 0, .aad_len = {.min = 8, .max = 12, .inc = 4} } };
 
+/** Forward declaration of session structure */
+typedef struct odp_crypto_generic_session_t odp_crypto_generic_session_t;
+
+/**
+ * Algorithm handler function prototype
+ */
+typedef
+odp_crypto_alg_err_t (*crypto_func_t)(odp_crypto_op_param_t *param,
+				      odp_crypto_generic_session_t *session);
+
+/**
+ * Per crypto session data structure
+ */
+struct odp_crypto_generic_session_t {
+	odp_crypto_generic_session_t *next;
+
+	/* Session creation parameters */
+	odp_crypto_session_param_t p;
+
+	odp_bool_t do_cipher_first;
+
+	struct {
+		/* Copy of session IV data */
+		uint8_t iv_data[EVP_MAX_IV_LENGTH];
+		uint8_t key_data[EVP_MAX_KEY_LENGTH];
+
+		const EVP_CIPHER *evp_cipher;
+		crypto_func_t func;
+	} cipher;
+
+	struct {
+		uint8_t  key[EVP_MAX_KEY_LENGTH];
+		uint32_t key_length;
+		uint32_t bytes;
+		const EVP_MD *evp_md;
+		crypto_func_t func;
+	} auth;
+};
+
 typedef struct odp_crypto_global_s odp_crypto_global_t;
 
 struct odp_crypto_global_s {
@@ -705,7 +744,7 @@  odp_crypto_session_create(odp_crypto_session_param_t *param,
 	/* Copy parameters */
 	session->p = *param;
 
-	if (session->p.iv.length > MAX_IV_LEN) {
+	if (session->p.iv.length > EVP_MAX_IV_LENGTH) {
 		ODP_DBG("Maximum IV length exceeded\n");
 		free_session(session);
 		return -1;