Lines Matching refs:operation
283 mbedtls_psa_cipher_operation_t *operation, in psa_cipher_setup() argument
296 mbedtls_cipher_init(&operation->ctx.cipher); in psa_cipher_setup()
298 operation->alg = alg; in psa_cipher_setup()
306 ret = mbedtls_cipher_setup(&operation->ctx.cipher, cipher_info); in psa_cipher_setup()
317 ret = mbedtls_cipher_setkey(&operation->ctx.cipher, in psa_cipher_setup()
323 ret = mbedtls_cipher_setkey(&operation->ctx.cipher, key_buffer, in psa_cipher_setup()
334 ret = mbedtls_cipher_set_padding_mode(&operation->ctx.cipher, in psa_cipher_setup()
338 ret = mbedtls_cipher_set_padding_mode(&operation->ctx.cipher, in psa_cipher_setup()
352 operation->block_length = (PSA_ALG_IS_STREAM_CIPHER(alg) ? 1 : in psa_cipher_setup()
354 operation->iv_length = PSA_CIPHER_IV_LENGTH(key_type, alg); in psa_cipher_setup()
361 mbedtls_psa_cipher_operation_t *operation, in mbedtls_psa_cipher_encrypt_setup() argument
366 return psa_cipher_setup(operation, attributes, in mbedtls_psa_cipher_encrypt_setup()
372 mbedtls_psa_cipher_operation_t *operation, in mbedtls_psa_cipher_decrypt_setup() argument
377 return psa_cipher_setup(operation, attributes, in mbedtls_psa_cipher_decrypt_setup()
383 mbedtls_psa_cipher_operation_t *operation, in mbedtls_psa_cipher_set_iv() argument
386 if (iv_length != operation->iv_length) { in mbedtls_psa_cipher_set_iv()
391 mbedtls_cipher_set_iv(&operation->ctx.cipher, in mbedtls_psa_cipher_set_iv()
500 mbedtls_psa_cipher_operation_t *operation, in mbedtls_psa_cipher_update() argument
507 if (!PSA_ALG_IS_STREAM_CIPHER(operation->alg)) { in mbedtls_psa_cipher_update()
513 (operation->ctx.cipher.unprocessed_len + input_length) in mbedtls_psa_cipher_update()
514 / operation->block_length * operation->block_length; in mbedtls_psa_cipher_update()
524 if (operation->alg == PSA_ALG_ECB_NO_PADDING) { in mbedtls_psa_cipher_update()
528 status = psa_cipher_update_ecb(&operation->ctx.cipher, in mbedtls_psa_cipher_update()
541 mbedtls_cipher_update(&operation->ctx.cipher, input, in mbedtls_psa_cipher_update()
553 mbedtls_psa_cipher_operation_t *operation, in mbedtls_psa_cipher_finish() argument
559 if (operation->ctx.cipher.unprocessed_len != 0) { in mbedtls_psa_cipher_finish()
560 if (operation->alg == PSA_ALG_ECB_NO_PADDING || in mbedtls_psa_cipher_finish()
561 operation->alg == PSA_ALG_CBC_NO_PADDING) { in mbedtls_psa_cipher_finish()
568 mbedtls_cipher_finish(&operation->ctx.cipher, in mbedtls_psa_cipher_finish()
591 mbedtls_psa_cipher_operation_t *operation) in mbedtls_psa_cipher_abort() argument
595 if (!PSA_ALG_IS_CIPHER(operation->alg)) { in mbedtls_psa_cipher_abort()
599 mbedtls_cipher_free(&operation->ctx.cipher); in mbedtls_psa_cipher_abort()
618 mbedtls_psa_cipher_operation_t operation = MBEDTLS_PSA_CIPHER_OPERATION_INIT; in mbedtls_psa_cipher_encrypt() local
621 status = mbedtls_psa_cipher_encrypt_setup(&operation, attributes, in mbedtls_psa_cipher_encrypt()
629 status = mbedtls_psa_cipher_set_iv(&operation, iv, iv_length); in mbedtls_psa_cipher_encrypt()
635 status = mbedtls_psa_cipher_update(&operation, input, input_length, in mbedtls_psa_cipher_encrypt()
643 &operation, in mbedtls_psa_cipher_encrypt()
654 status = mbedtls_psa_cipher_abort(&operation); in mbedtls_psa_cipher_encrypt()
656 mbedtls_psa_cipher_abort(&operation); in mbedtls_psa_cipher_encrypt()
674 mbedtls_psa_cipher_operation_t operation = MBEDTLS_PSA_CIPHER_OPERATION_INIT; in mbedtls_psa_cipher_decrypt() local
677 status = mbedtls_psa_cipher_decrypt_setup(&operation, attributes, in mbedtls_psa_cipher_decrypt()
684 if (operation.iv_length > 0) { in mbedtls_psa_cipher_decrypt()
685 status = mbedtls_psa_cipher_set_iv(&operation, in mbedtls_psa_cipher_decrypt()
686 input, operation.iv_length); in mbedtls_psa_cipher_decrypt()
693 &operation, in mbedtls_psa_cipher_decrypt()
694 mbedtls_buffer_offset_const(input, operation.iv_length), in mbedtls_psa_cipher_decrypt()
695 input_length - operation.iv_length, in mbedtls_psa_cipher_decrypt()
704 &operation, in mbedtls_psa_cipher_decrypt()
715 status = mbedtls_psa_cipher_abort(&operation); in mbedtls_psa_cipher_decrypt()
717 mbedtls_psa_cipher_abort(&operation); in mbedtls_psa_cipher_decrypt()