aboutsummaryrefslogtreecommitdiff
path: root/core/crypto
diff options
context:
space:
mode:
authorJerome Forissier <jerome.forissier@linaro.org>2018-02-09 09:13:15 +0100
committerJérôme Forissier <jerome.forissier@linaro.org>2018-02-09 11:08:01 +0100
commitce7a47f5e6c618287915a46c77646a755208c315 (patch)
treefbc27cc65f6743c5c6b60d35f650eb9fcd1ece4d /core/crypto
parentb924c494920f9197b4b6c9fc313b174306282f7b (diff)
core: crypto.c: crypto_*_free_ctx() stubs should allow NULL context
Update the crypto_*_free_ctx() functions so that they do nothing when passed a NULL ctx. Allows for easier error handling. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'core/crypto')
-rw-r--r--core/crypto/crypto.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/core/crypto/crypto.c b/core/crypto/crypto.c
index 77780fb7..6c1b3d91 100644
--- a/core/crypto/crypto.c
+++ b/core/crypto/crypto.c
@@ -18,9 +18,10 @@ TEE_Result crypto_hash_alloc_ctx(void **ctx __unused, uint32_t algo __unused)
return TEE_ERROR_NOT_IMPLEMENTED;
}
-void crypto_hash_free_ctx(void *ctx __unused, uint32_t algo __unused)
+void crypto_hash_free_ctx(void *ctx, uint32_t algo __unused)
{
- assert(0);
+ if (ctx)
+ assert(0);
}
void crypto_hash_copy_state(void *dst_ctx __unused, void *src_ctx __unused,
@@ -51,9 +52,10 @@ TEE_Result crypto_cipher_alloc_ctx(void **ctx __unused, uint32_t algo __unused)
return TEE_ERROR_NOT_IMPLEMENTED;
}
-void crypto_cipher_free_ctx(void *ctx __unused, uint32_t algo __unused)
+void crypto_cipher_free_ctx(void *ctx, uint32_t algo __unused)
{
- assert(0);
+ if (ctx)
+ assert(0);
}
void crypto_cipher_copy_state(void *dst_ctx __unused, void *src_ctx __unused,
@@ -100,9 +102,10 @@ TEE_Result crypto_mac_alloc_ctx(void **ctx __unused, uint32_t algo __unused)
return TEE_ERROR_NOT_IMPLEMENTED;
}
-void crypto_mac_free_ctx(void *ctx __unused, uint32_t algo __unused)
+void crypto_mac_free_ctx(void *ctx, uint32_t algo __unused)
{
- assert(0);
+ if (ctx)
+ assert(0);
}
void crypto_mac_copy_state(void *dst_ctx __unused, void *src_ctx __unused,
@@ -161,7 +164,8 @@ void crypto_authenc_free_ctx(void *ctx, uint32_t algo)
break;
#endif
default:
- assert(0);
+ if (ctx)
+ assert(0);
}
}