Lines Matching refs:operation
156 mbedtls_psa_cipher_operation_t *operation, in cipher_setup() argument
169 mbedtls_cipher_init( &operation->ctx.cipher ); in cipher_setup()
171 operation->alg = alg; in cipher_setup()
178 ret = mbedtls_cipher_setup( &operation->ctx.cipher, cipher_info ); in cipher_setup()
189 ret = mbedtls_cipher_setkey( &operation->ctx.cipher, in cipher_setup()
196 ret = mbedtls_cipher_setkey( &operation->ctx.cipher, key_buffer, in cipher_setup()
207 ret = mbedtls_cipher_set_padding_mode( &operation->ctx.cipher, in cipher_setup()
211 ret = mbedtls_cipher_set_padding_mode( &operation->ctx.cipher, in cipher_setup()
223 operation->block_length = ( PSA_ALG_IS_STREAM_CIPHER( alg ) ? 1 : in cipher_setup()
225 operation->iv_length = PSA_CIPHER_IV_LENGTH( key_type, alg ); in cipher_setup()
232 mbedtls_psa_cipher_operation_t *operation, in cipher_encrypt_setup() argument
237 return( cipher_setup( operation, attributes, in cipher_encrypt_setup()
243 mbedtls_psa_cipher_operation_t *operation, in cipher_decrypt_setup() argument
248 return( cipher_setup( operation, attributes, in cipher_decrypt_setup()
253 static psa_status_t cipher_set_iv( mbedtls_psa_cipher_operation_t *operation, in cipher_set_iv() argument
256 if( iv_length != operation->iv_length ) in cipher_set_iv()
260 mbedtls_cipher_set_iv( &operation->ctx.cipher, in cipher_set_iv()
368 static psa_status_t cipher_update( mbedtls_psa_cipher_operation_t *operation, in cipher_update() argument
378 if( ! PSA_ALG_IS_STREAM_CIPHER( operation->alg ) ) in cipher_update()
385 ( operation->ctx.cipher.unprocessed_len + input_length ) in cipher_update()
386 / operation->block_length * operation->block_length; in cipher_update()
396 if( operation->alg == PSA_ALG_ECB_NO_PADDING ) in cipher_update()
401 status = psa_cipher_update_ecb( &operation->ctx.cipher, in cipher_update()
410 mbedtls_cipher_update( &operation->ctx.cipher, input, in cipher_update()
420 static psa_status_t cipher_finish( mbedtls_psa_cipher_operation_t *operation, in cipher_finish() argument
428 if( operation->ctx.cipher.unprocessed_len != 0 ) in cipher_finish()
430 if( operation->alg == PSA_ALG_ECB_NO_PADDING || in cipher_finish()
431 operation->alg == PSA_ALG_CBC_NO_PADDING ) in cipher_finish()
439 mbedtls_cipher_finish( &operation->ctx.cipher, in cipher_finish()
459 static psa_status_t cipher_abort( mbedtls_psa_cipher_operation_t *operation ) in cipher_abort() argument
463 if( ! PSA_ALG_IS_CIPHER( operation->alg ) ) in cipher_abort()
466 mbedtls_cipher_free( &operation->ctx.cipher ); in cipher_abort()
482 mbedtls_psa_cipher_operation_t operation = MBEDTLS_PSA_CIPHER_OPERATION_INIT; in cipher_encrypt() local
485 status = cipher_encrypt_setup( &operation, attributes, in cipher_encrypt()
491 if( operation.iv_length > 0 ) in cipher_encrypt()
493 status = cipher_set_iv( &operation, output, operation.iv_length ); in cipher_encrypt()
497 accumulated_length = operation.iv_length; in cipher_encrypt()
500 status = cipher_update( &operation, input, input_length, in cipher_encrypt()
501 output + operation.iv_length, in cipher_encrypt()
502 output_size - operation.iv_length, in cipher_encrypt()
509 status = cipher_finish( &operation, output + accumulated_length, in cipher_encrypt()
518 status = cipher_abort( &operation ); in cipher_encrypt()
520 cipher_abort( &operation ); in cipher_encrypt()
535 mbedtls_psa_cipher_operation_t operation = MBEDTLS_PSA_CIPHER_OPERATION_INIT; in cipher_decrypt() local
538 status = cipher_decrypt_setup( &operation, attributes, in cipher_decrypt()
543 if( operation.iv_length > 0 ) in cipher_decrypt()
545 status = cipher_set_iv( &operation, input, operation.iv_length ); in cipher_decrypt()
550 status = cipher_update( &operation, input + operation.iv_length, in cipher_decrypt()
551 input_length - operation.iv_length, in cipher_decrypt()
558 status = cipher_finish( &operation, output + accumulated_length, in cipher_decrypt()
567 status = cipher_abort( &operation ); in cipher_decrypt()
569 cipher_abort( &operation ); in cipher_decrypt()
576 mbedtls_psa_cipher_operation_t *operation, in mbedtls_psa_cipher_encrypt_setup() argument
582 operation, attributes, key_buffer, key_buffer_size, alg ) ); in mbedtls_psa_cipher_encrypt_setup()
586 mbedtls_psa_cipher_operation_t *operation, in mbedtls_psa_cipher_decrypt_setup() argument
592 operation, attributes, key_buffer, key_buffer_size, alg ) ); in mbedtls_psa_cipher_decrypt_setup()
595 psa_status_t mbedtls_psa_cipher_set_iv( mbedtls_psa_cipher_operation_t *operation, in mbedtls_psa_cipher_set_iv() argument
599 return( cipher_set_iv( operation, iv, iv_length ) ); in mbedtls_psa_cipher_set_iv()
602 psa_status_t mbedtls_psa_cipher_update( mbedtls_psa_cipher_operation_t *operation, in mbedtls_psa_cipher_update() argument
609 return( cipher_update( operation, input, input_length, in mbedtls_psa_cipher_update()
613 psa_status_t mbedtls_psa_cipher_finish( mbedtls_psa_cipher_operation_t *operation, in mbedtls_psa_cipher_finish() argument
618 return( cipher_finish( operation, output, output_size, output_length ) ); in mbedtls_psa_cipher_finish()
621 psa_status_t mbedtls_psa_cipher_abort( mbedtls_psa_cipher_operation_t *operation ) in mbedtls_psa_cipher_abort() argument
623 return( cipher_abort( operation ) ); in mbedtls_psa_cipher_abort()
663 mbedtls_psa_cipher_operation_t *operation, in mbedtls_transparent_test_driver_cipher_encrypt_setup() argument
669 operation, attributes, key_buffer, key_buffer_size, alg ) ); in mbedtls_transparent_test_driver_cipher_encrypt_setup()
673 mbedtls_psa_cipher_operation_t *operation, in mbedtls_transparent_test_driver_cipher_decrypt_setup() argument
679 operation, attributes, key_buffer, key_buffer_size, alg ) ); in mbedtls_transparent_test_driver_cipher_decrypt_setup()
683 mbedtls_psa_cipher_operation_t *operation, in mbedtls_transparent_test_driver_cipher_set_iv() argument
686 return( cipher_set_iv( operation, iv, iv_length ) ); in mbedtls_transparent_test_driver_cipher_set_iv()
690 mbedtls_psa_cipher_operation_t *operation, in mbedtls_transparent_test_driver_cipher_update() argument
694 return( cipher_update( operation, input, input_length, in mbedtls_transparent_test_driver_cipher_update()
699 mbedtls_psa_cipher_operation_t *operation, in mbedtls_transparent_test_driver_cipher_finish() argument
702 return( cipher_finish( operation, output, output_size, output_length ) ); in mbedtls_transparent_test_driver_cipher_finish()
706 mbedtls_psa_cipher_operation_t *operation ) in mbedtls_transparent_test_driver_cipher_abort() argument
708 return( cipher_abort( operation ) ); in mbedtls_transparent_test_driver_cipher_abort()