Skip to content

Commit b7b8551

Browse files
itayzafrirOren Cohen
authored andcommitted
crypto service: Add documentation
1 parent ea9f104 commit b7b8551

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ static psa_spm_hash_clone_t psa_spm_hash_clones[MAX_CONCURRENT_HASH_CLONES];
3636
// ------------------------- Internal Helper Functions -------------------------
3737
static inline psa_status_t reserve_hash_clone(int32_t partition_id, void *source_operation, size_t *index)
3838
{
39+
/* check if the the clone request source operation is already part of another active clone operation,
40+
* for the same source, if so then reuse it and increment its ref_count by 1. A scenario as such may happen
41+
* in case there was a context switch between calls of PSA_HASH_CLONE_BEGIN and PSA_HASH_CLONE_END (on the
42+
* client side) leading to PSA_HASH_CLONE_BEGIN being executed more than one time without a call to
43+
* PSA_HASH_CLONE_END */
3944
for (*index = 0; *index < MAX_CONCURRENT_HASH_CLONES; (*index)++) {
4045
if (psa_spm_hash_clones[*index].partition_id == partition_id &&
4146
psa_spm_hash_clones[*index].source_operation == source_operation) {
@@ -44,6 +49,7 @@ static inline psa_status_t reserve_hash_clone(int32_t partition_id, void *source
4449
}
4550
}
4651

52+
/* find an available empty entry in the array */
4753
for (*index = 0; *index < MAX_CONCURRENT_HASH_CLONES; (*index)++) {
4854
if (psa_spm_hash_clones[*index].partition_id == 0 &&
4955
psa_spm_hash_clones[*index].source_operation == NULL) {

0 commit comments

Comments
 (0)