Skip to content

Commit c580f2a

Browse files
authored
Merge pull request #21 from ericeberry/Issue_20
Issue 20: Fix cipher when bytes_to_process is 0
2 parents 9450c9d + ace0a53 commit c580f2a

1 file changed

Lines changed: 2 additions & 19 deletions

File tree

reference/src/taimpl/src/ta_sa_crypto_cipher_process.c

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
static size_t get_required_length(
3131
cipher_t* cipher,
3232
size_t bytes_to_process,
33-
bool apply_padding,
34-
sa_digest_algorithm digest_algorithm,
35-
sa_digest_algorithm mgf1_digest_algorithm) {
33+
bool apply_padding) {
3634
sa_cipher_algorithm cipher_algorithm = cipher_get_algorithm(cipher);
3735

3836
switch (cipher_algorithm) {
@@ -415,23 +413,8 @@ sa_status ta_sa_crypto_cipher_process(
415413
}
416414

417415
sa_cipher_mode cipher_mode = cipher_get_mode(cipher);
418-
sa_digest_algorithm digest_algorithm;
419-
sa_digest_algorithm mgf1_digest_algorithm;
420-
const void* label;
421-
size_t label_length;
422-
status = cipher_get_oaep_parameters(cipher, &digest_algorithm, &mgf1_digest_algorithm, &label, &label_length);
423-
if (status != SA_STATUS_OK) {
424-
ERROR("cipher_get_oaep_parameters failed");
425-
break;
426-
}
427-
428416
size_t required_length = get_required_length(cipher, *bytes_to_process,
429-
!out && cipher_mode == SA_CIPHER_MODE_ENCRYPT, digest_algorithm, mgf1_digest_algorithm);
430-
if (required_length == 0) {
431-
status = SA_STATUS_INVALID_PARAMETER;
432-
break;
433-
}
434-
417+
!out && cipher_mode == SA_CIPHER_MODE_ENCRYPT);
435418
if (out == NULL) {
436419
*bytes_to_process = required_length;
437420
status = SA_STATUS_OK;

0 commit comments

Comments
 (0)