Remove redundant NULL check
A NULL buffer with a non-zero length is an internal error, so just
check the length.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 6b65d60..0679368 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -5585,9 +5585,7 @@
input_copy->buffer = NULL;
input_copy->len = 0;
- /* Treat NULL and zero-length input the same.
- * This is simpler than potentially calling calloc(0). */
- if (input == NULL || input_len == 0) {
+ if (input_len == 0) {
return PSA_SUCCESS;
}
@@ -5630,9 +5628,7 @@
output_copy->buffer = NULL;
output_copy->len = 0;
- /* Treat NULL and zero-length input the same.
- * This is simpler than potentially calling calloc(0). */
- if (output == NULL || output_len == 0) {
+ if (output_len == 0) {
return PSA_SUCCESS;
}
output_copy->buffer = mbedtls_calloc(output_len, 1);