Remove unnecessary code
Calls to abort that are now being done by the psa_crypto layer, freeing
of tempory allocations (done by abort) and a couple of checks that had
already been done prior to that point
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
diff --git a/library/psa_crypto_aead.c b/library/psa_crypto_aead.c
index 0a84888..848889a 100644
--- a/library/psa_crypto_aead.c
+++ b/library/psa_crypto_aead.c
@@ -658,11 +658,6 @@
operation->tag_buffer,
operation->tag_length ) );
- /* Even if the above operation fails, we no longer need the
- additional data.*/
- mbedtls_free( operation->ad_buffer );
- operation->ad_buffer = NULL;
- operation->ad_length = 0;
}
else
{
@@ -784,9 +779,6 @@
/* Copy the previously generated tag into place */
memcpy( tag, operation->tag_buffer, operation->tag_length );
- mbedtls_free(operation->tag_buffer);
- operation->tag_buffer = NULL;
-
status = PSA_SUCCESS;
}
else
@@ -815,8 +807,6 @@
*tag_length = operation->tag_length;
}
- mbedtls_psa_aead_abort(operation);
-
return ( status );
}
@@ -858,9 +848,6 @@
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CCM)
if( operation->alg == PSA_ALG_CCM )
{
- if( !operation->ad_buffer || !operation->body_buffer )
- return( PSA_ERROR_BAD_STATE );
-
/* Perform oneshot CCM decryption *again*, as its the
* only way to get the tag, but this time throw away the
results, as verify cannot write that much data. */
@@ -895,13 +882,6 @@
/* Even if the above operation fails, we no longer need the data */
mbedtls_free(temp_buffer);
-
- mbedtls_free(operation->body_buffer);
- operation->body_buffer = NULL;
- operation->body_length = 0;
-
- mbedtls_free(operation->tag_buffer);
- operation->tag_buffer = NULL;
}
else
#endif /* MBEDTLS_PSA_BUILTIN_ALG_CCM */
@@ -933,8 +913,6 @@
status = PSA_ERROR_INVALID_SIGNATURE;
}
- mbedtls_psa_aead_abort(operation);
-
return ( status );
}