Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion reference/src/clientimpl/src/sa_crypto_cipher_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ sa_status sa_crypto_cipher_process(
#endif // ENABLE_SVP

*bytes_to_process = cipher_process->bytes_to_process;
ERROR("bytes_to_process = %d\n", cipher_process->bytes_to_process);
} while (false);

RELEASE_COMMAND(cipher_process);
Expand Down
3 changes: 2 additions & 1 deletion reference/src/clientimpl/src/sa_process_common_encryption.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ sa_status sa_process_common_encryption(
subsample_length_s[j].bytes_of_protected_data = samples[i].subsample_lengths[j].bytes_of_protected_data;
}

CREATE_PARAM(param1, samples[i].subsample_lengths, param1_size);
// Fix for 32-bit: use the converted sa_subsample_length_s array, not the original
CREATE_PARAM(param1, subsample_length_s, param1_size);
uint32_t param1_type = TA_PARAM_IN;
size_t param2_size;
uint32_t param2_type;
Expand Down
11 changes: 8 additions & 3 deletions reference/src/taimpl/src/internal/ta.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ static sa_status ta_invoke_key_unwrap(
sa_unwrap_parameters_aes_gcm_s parameters_aes_gcm_s;
sa_unwrap_parameters_chacha20_s parameters_chacha_20_s;
sa_unwrap_parameters_chacha20_poly1305_s parameters_chacha_20_poly_1305_s;
sa_unwrap_parameters_ec_elgamal_s parameters_ec_elgamal_s;
sa_unwrap_parameters_rsa_oaep_s parameters_rsa_oaep_s;
sa_unwrap_parameters_aes_cbc parameters_aes_cbc;
sa_unwrap_parameters_aes_ctr parameters_aes_ctr;
Expand Down Expand Up @@ -608,8 +609,11 @@ static sa_status ta_invoke_key_unwrap(
return SA_STATUS_INVALID_PARAMETER;
}

memcpy(&parameters_ec_elgamal, params[2].mem_ref, params[2].mem_ref_size);
algorithm_parameters = params[2].mem_ref;
// Fix for 32-bit platforms: convert uint64_t fields to size_t
memcpy(&parameters_ec_elgamal_s, params[2].mem_ref, params[2].mem_ref_size);
parameters_ec_elgamal.offset = (size_t)parameters_ec_elgamal_s.offset;
parameters_ec_elgamal.key_length = (size_t)parameters_ec_elgamal_s.key_length;
algorithm_parameters = &parameters_ec_elgamal;
break;

case SA_CIPHER_ALGORITHM_RSA_OAEP:
Expand Down Expand Up @@ -1826,7 +1830,8 @@ static sa_status ta_invoke_process_common_encryption(
sa_sample sample;
do {
sample.subsample_count = process_common_encryption->subsample_count;
if (params[1].mem_ref_size != sizeof(sa_subsample_length) * sample.subsample_count) {
// Fix for 32-bit: client sends sa_subsample_length_s (uint64_t fields)
if (params[1].mem_ref_size != sizeof(sa_subsample_length_s) * sample.subsample_count) {
ERROR("params[1].mem_ref_size is invalid");
return SA_STATUS_INVALID_PARAMETER;
}
Expand Down