mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-15 10:08:30 -04:00
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>
This commit is contained in:
parent
6108ee7c2d
commit
b06e1c0d68
@ -658,11 +658,6 @@ psa_status_t mbedtls_psa_aead_update( mbedtls_psa_aead_operation_t *operation,
|
|||||||
operation->tag_buffer,
|
operation->tag_buffer,
|
||||||
operation->tag_length ) );
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -784,9 +779,6 @@ psa_status_t mbedtls_psa_aead_finish( mbedtls_psa_aead_operation_t *operation,
|
|||||||
/* Copy the previously generated tag into place */
|
/* Copy the previously generated tag into place */
|
||||||
memcpy( tag, operation->tag_buffer, operation->tag_length );
|
memcpy( tag, operation->tag_buffer, operation->tag_length );
|
||||||
|
|
||||||
mbedtls_free(operation->tag_buffer);
|
|
||||||
operation->tag_buffer = NULL;
|
|
||||||
|
|
||||||
status = PSA_SUCCESS;
|
status = PSA_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -815,8 +807,6 @@ psa_status_t mbedtls_psa_aead_finish( mbedtls_psa_aead_operation_t *operation,
|
|||||||
*tag_length = operation->tag_length;
|
*tag_length = operation->tag_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
mbedtls_psa_aead_abort(operation);
|
|
||||||
|
|
||||||
return ( status );
|
return ( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,9 +848,6 @@ psa_status_t mbedtls_psa_aead_verify( mbedtls_psa_aead_operation_t *operation,
|
|||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CCM)
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CCM)
|
||||||
if( operation->alg == PSA_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
|
/* Perform oneshot CCM decryption *again*, as its the
|
||||||
* only way to get the tag, but this time throw away the
|
* only way to get the tag, but this time throw away the
|
||||||
results, as verify cannot write that much data. */
|
results, as verify cannot write that much data. */
|
||||||
@ -895,13 +882,6 @@ psa_status_t mbedtls_psa_aead_verify( mbedtls_psa_aead_operation_t *operation,
|
|||||||
|
|
||||||
/* Even if the above operation fails, we no longer need the data */
|
/* Even if the above operation fails, we no longer need the data */
|
||||||
mbedtls_free(temp_buffer);
|
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
|
else
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_CCM */
|
#endif /* MBEDTLS_PSA_BUILTIN_ALG_CCM */
|
||||||
@ -933,8 +913,6 @@ psa_status_t mbedtls_psa_aead_verify( mbedtls_psa_aead_operation_t *operation,
|
|||||||
status = PSA_ERROR_INVALID_SIGNATURE;
|
status = PSA_ERROR_INVALID_SIGNATURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mbedtls_psa_aead_abort(operation);
|
|
||||||
|
|
||||||
return ( status );
|
return ( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user