Skip to content

Commit bf05154

Browse files
author
itayzafrir
committed
Use PSA_NULL_HANDLE when testing for invalid handles
1 parent caafc34 commit bf05154

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ psa_status_t psa_crypto_init(void)
8989

9090
psa_status_t psa_mac_abort(psa_mac_operation_t *operation)
9191
{
92-
if (operation->handle <= 0) {
92+
if (operation->handle <= PSA_NULL_HANDLE) {
9393
return (PSA_SUCCESS);
9494
}
9595

@@ -193,7 +193,7 @@ psa_status_t psa_mac_verify_finish(psa_mac_operation_t *operation,
193193

194194
psa_status_t psa_hash_abort(psa_hash_operation_t *operation)
195195
{
196-
if (operation->handle <= 0) {
196+
if (operation->handle <= PSA_NULL_HANDLE) {
197197
return (PSA_SUCCESS);
198198
}
199199

@@ -933,7 +933,7 @@ psa_status_t psa_generator_read(psa_crypto_generator_t *generator,
933933
{ output, output_length }
934934
};
935935

936-
if (generator->handle <= 0) {
936+
if (generator->handle <= PSA_NULL_HANDLE) {
937937
return (PSA_ERROR_BAD_STATE);
938938
}
939939

@@ -1161,7 +1161,7 @@ psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation,
11611161

11621162
psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation)
11631163
{
1164-
if (operation->handle <= 0) {
1164+
if (operation->handle <= PSA_NULL_HANDLE) {
11651165
return (PSA_SUCCESS);
11661166
}
11671167

0 commit comments

Comments
 (0)