diff mbox

[2/5] linux-generic: crypto: odp_crypto_session_create in failure set session to invalid

Message ID 1410397827-2758-3-git-send-email-victor.kamensky@linaro.org
State New
Headers show

Commit Message

vkamensky Sept. 11, 2014, 1:10 a.m. UTC
According to odp_crypto_session_create it should either return
session handle in session_out out parameter or set it to
ODP_CRYPTO_SESSION_INVALID. Genetic crypto implementation did not do
that. Fix it by presetting *session_out to ODP_CRYPTO_SESSION_INVALID.

Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
---
 platform/linux-generic/odp_crypto.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 8782d99..ef91a34 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -262,9 +262,12 @@  odp_crypto_session_create(odp_crypto_session_params_t *params,
 	int rc;
 	odp_crypto_generic_session_t *session;
 
-	/* Default to successful result */
+	/* Default return to successful result */
 	*status = ODP_CRYPTO_SES_CREATE_ERR_NONE;
 
+	/* Default session to failure result */
+	*session_out = ODP_CRYPTO_SESSION_INVALID;
+
 	/* Allocate memory for this session */
 	session = alloc_session();
 	if (NULL == session) {