Skip to content

Commit 9f6ee7d

Browse files
author
Cruz Monrreal
authored
Merge pull request #9754 from netanelgonen/SPM_return_value
Fix SPM returning the wrong value
2 parents 2234dac + d0dae03 commit 9f6ee7d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ psa_status_t psa_mac_update(psa_mac_operation_t *operation,
140140
};
141141

142142
if (operation->handle <= 0) {
143-
return (PSA_ERROR_INVALID_ARGUMENT);
143+
return (PSA_ERROR_BAD_STATE);
144144
}
145145

146146
err = psa_call(operation->handle, in_vec, 2, NULL, 0);
@@ -167,7 +167,7 @@ psa_status_t psa_mac_sign_finish(psa_mac_operation_t *operation,
167167
psa_outvec out_vec[2] = { { mac, mac_size }, { mac_length, sizeof(*mac_length) } };
168168

169169
if (operation->handle <= 0) {
170-
return (PSA_ERROR_INVALID_ARGUMENT);
170+
return (PSA_ERROR_BAD_STATE);
171171
}
172172

173173
err_call = psa_call(operation->handle, in_vec, 2, out_vec, 2);
@@ -196,7 +196,7 @@ psa_status_t psa_mac_verify_finish(psa_mac_operation_t *operation,
196196
};
197197

198198
if (operation->handle <= 0) {
199-
return (PSA_ERROR_INVALID_ARGUMENT);
199+
return (PSA_ERROR_BAD_STATE);
200200
}
201201

202202
err_call = psa_call(operation->handle, in_vec, 3, NULL, 0);
@@ -277,7 +277,7 @@ psa_status_t psa_hash_update(psa_hash_operation_t *operation,
277277
};
278278

279279
if (operation->handle <= 0) {
280-
return (PSA_ERROR_INVALID_ARGUMENT);
280+
return (PSA_ERROR_BAD_STATE);
281281
}
282282

283283
err = psa_call(operation->handle, in_vec, 2, NULL, 0);
@@ -306,7 +306,7 @@ psa_status_t psa_hash_finish(psa_hash_operation_t *operation,
306306
};
307307

308308
if (operation->handle <= 0) {
309-
return (PSA_ERROR_INVALID_ARGUMENT);
309+
return (PSA_ERROR_BAD_STATE);
310310
}
311311

312312
err_call = psa_call(operation->handle, in_vec, 2, out_vec, 2);
@@ -335,7 +335,7 @@ psa_status_t psa_hash_verify(psa_hash_operation_t *operation,
335335
};
336336

337337
if (operation->handle <= 0) {
338-
return (PSA_ERROR_INVALID_ARGUMENT);
338+
return (PSA_ERROR_BAD_STATE);
339339
}
340340

341341
err_call = psa_call(operation->handle, in_vec, 3, NULL, 0);
@@ -1206,7 +1206,7 @@ psa_status_t psa_get_generator_capacity(const psa_crypto_generator_t *generator,
12061206
psa_outvec out_vec = { capacity, sizeof(*capacity) };
12071207

12081208
if (generator->handle <= 0) {
1209-
return (PSA_ERROR_INVALID_ARGUMENT);
1209+
return (PSA_ERROR_BAD_STATE);
12101210
}
12111211

12121212
err_call = psa_call(generator->handle, &in_vec, 1, &out_vec, 1);
@@ -1228,7 +1228,7 @@ psa_status_t psa_generator_read(psa_crypto_generator_t *generator,
12281228
psa_outvec out_vec = { output, output_length };
12291229

12301230
if (generator->handle <= 0) {
1231-
return (PSA_ERROR_INVALID_ARGUMENT);
1231+
return (PSA_ERROR_BAD_STATE);
12321232
}
12331233

12341234
err_call = psa_call(generator->handle, &in_vec, 1, &out_vec, 1);
@@ -1254,7 +1254,7 @@ psa_status_t psa_generator_import_key(psa_key_handle_t key_handle,
12541254
};
12551255

12561256
if (generator->handle <= 0) {
1257-
return (PSA_ERROR_INVALID_ARGUMENT);
1257+
return (PSA_ERROR_BAD_STATE);
12581258
}
12591259

12601260
err_call = psa_call(generator->handle, in_vec, 3, NULL, 0);
@@ -1432,7 +1432,7 @@ psa_status_t psa_cipher_generate_iv(psa_cipher_operation_t *operation,
14321432
};
14331433

14341434
if (operation->handle <= 0) {
1435-
return (PSA_ERROR_INVALID_ARGUMENT);
1435+
return (PSA_ERROR_BAD_STATE);
14361436
}
14371437

14381438
err = psa_call(operation->handle, &in_vec, 1, out_vec, 2);
@@ -1460,7 +1460,7 @@ psa_status_t psa_cipher_set_iv(psa_cipher_operation_t *operation,
14601460
};
14611461

14621462
if (operation->handle <= 0) {
1463-
return (PSA_ERROR_INVALID_ARGUMENT);
1463+
return (PSA_ERROR_BAD_STATE);
14641464
}
14651465

14661466
err = psa_call(operation->handle, in_vec, 2, NULL, 0);
@@ -1500,7 +1500,7 @@ psa_status_t psa_cipher_update(psa_cipher_operation_t *operation,
15001500
};
15011501

15021502
if (operation->handle <= 0) {
1503-
return (PSA_ERROR_INVALID_ARGUMENT);
1503+
return (PSA_ERROR_BAD_STATE);
15041504
}
15051505

15061506
err = psa_call(operation->handle, in_vec, 2, out_vec, 2);
@@ -1535,7 +1535,7 @@ psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation,
15351535
};
15361536

15371537
if (operation->handle <= 0) {
1538-
return (PSA_ERROR_INVALID_ARGUMENT);
1538+
return (PSA_ERROR_BAD_STATE);
15391539
}
15401540

15411541
err_call = psa_call(operation->handle, &in_vec, 1, out_vec, 2);

0 commit comments

Comments
 (0)