@@ -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
@@ -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;