@@ -406,6 +406,10 @@ psa_status_t psa_cipher_set_iv(psa_cipher_operation_t *operation,
406406 const uint8_t * iv ,
407407 size_t iv_length )
408408{
409+ if (operation == NULL || (iv == NULL && iv_length > 0 )) {
410+ return PSA_ERROR_INVALID_ARGUMENT ;
411+ }
412+
409413 struct arm_tee_crypto_pack_iovec iov = {
410414 .function_id = ARM_TEE_CRYPTO_CIPHER_SET_IV_SID ,
411415 .op_handle = (uint32_t )operation -> opaque ,
@@ -415,10 +419,6 @@ psa_status_t psa_cipher_set_iv(psa_cipher_operation_t *operation,
415419 {.base = iv , .len = iv_length },
416420 };
417421
418- if (operation == NULL || (iv == NULL && iv_length > 0 )) {
419- return PSA_ERROR_INVALID_ARGUMENT ;
420- }
421-
422422 return API_DISPATCH_NO_OUTVEC (in_vec );
423423}
424424
@@ -487,6 +487,12 @@ psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation,
487487
488488psa_status_t psa_cipher_abort (psa_cipher_operation_t * operation )
489489{
490+ psa_status_t status ;
491+
492+ if (operation == NULL ) {
493+ return PSA_ERROR_INVALID_ARGUMENT ;
494+ }
495+
490496 struct arm_tee_crypto_pack_iovec iov = {
491497 .function_id = ARM_TEE_CRYPTO_CIPHER_ABORT_SID ,
492498 .op_handle = (uint32_t )operation -> opaque ,
@@ -495,12 +501,11 @@ psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation)
495501 {.base = & iov , .len = sizeof (struct arm_tee_crypto_pack_iovec )},
496502 };
497503
498- if (operation == NULL ) {
499- return PSA_ERROR_INVALID_ARGUMENT ;
504+ status = API_DISPATCH_NO_OUTVEC (in_vec );
505+ if (status == PSA_SUCCESS ) {
506+ operation -> opaque = 0 ;
500507 }
501-
502- operation -> opaque = 0 ;
503- return API_DISPATCH_NO_OUTVEC (in_vec );
508+ return status ;
504509}
505510
506511psa_status_t psa_sign_hash (psa_key_id_t key ,
0 commit comments