Change the default value of initialized cipher operation to NONE
This way, an initialized cipher context but without a key set can be identified.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
diff --git a/library/cipher.c b/library/cipher.c
index 7164741..e0fd39d 100644
--- a/library/cipher.c
+++ b/library/cipher.c
@@ -186,6 +186,7 @@
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
mbedtls_platform_memset( ctx, 0, sizeof( mbedtls_cipher_context_t ) );
+ ctx->operation = MBEDTLS_OPERATION_NONE;
if( NULL == ( ctx->cipher_ctx = cipher_info->base->ctx_alloc_func() ) )
return( MBEDTLS_ERR_CIPHER_ALLOC_FAILED );