Lines Matching refs:status

193  * - psa_status_t status exists
199 status = psa_crypto_local_input_alloc(input, length, \
201 if (status != PSA_SUCCESS) { \
235 * - psa_status_t status exists
241 status = psa_crypto_local_output_alloc(output, length, \
243 if (status != PSA_SUCCESS) { \
252 * - psa_status_t status exists
264 * status. */ \
265 status = local_output_status; \
579 * return status properly.
583 * \param status Status of function called to generate
590 static void psa_wipe_tag_output_buffer(uint8_t *output_buffer, psa_status_t status,
601 if (status == PSA_SUCCESS) {
725 psa_status_t status = psa_allocate_buffer_to_slot(slot,
727 if (status != PSA_SUCCESS) {
728 return status;
741 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
752 status = psa_validate_unstructured_key_bit_size(attributes->type,
754 if (status != PSA_SUCCESS) {
755 return status;
1097 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
1100 status = psa_get_and_lock_key_slot(key, p_slot);
1101 if (status != PSA_SUCCESS) {
1102 return status;
1115 status = PSA_ERROR_NOT_PERMITTED;
1121 status = psa_key_policy_permits(&slot->attr.policy,
1124 if (status != PSA_SUCCESS) {
1135 return status;
1163 psa_status_t status = psa_get_and_lock_key_slot_with_policy(key, p_slot,
1165 if (status != PSA_SUCCESS) {
1166 return status;
1194 psa_status_t status = psa_remove_key_data_from_memory(slot);
1215 status = PSA_ERROR_CORRUPTION_DETECTED;
1222 status = PSA_ERROR_CORRUPTION_DETECTED;
1228 status = PSA_ERROR_CORRUPTION_DETECTED;
1232 status = PSA_ERROR_CORRUPTION_DETECTED;
1245 return status;
1251 psa_status_t status; /* status of the last operation */
1268 status = psa_get_and_lock_key_slot(key, &slot);
1269 if (status != PSA_SUCCESS) {
1270 return status;
1285 status = psa_unregister_read(slot);
1289 return (status == PSA_SUCCESS) ? PSA_ERROR_INVALID_HANDLE : status;
1329 status = psa_crypto_save_transaction();
1330 if (status != PSA_SUCCESS) {
1339 overall_status = status;
1343 status = psa_destroy_se_key(driver,
1346 overall_status = status;
1356 status = psa_destroy_persistent_key(slot->attr.id);
1358 overall_status = status;
1365 status = psa_save_se_persistent_data(driver);
1367 overall_status = status;
1369 status = psa_crypto_stop_transaction();
1371 overall_status = status;
1379 status = psa_unregister_read(slot);
1382 if (status != PSA_SUCCESS) {
1383 overall_status = status;
1388 status = overall_status;
1401 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
1406 status = psa_get_and_lock_key_slot_with_policy(key, &slot, 0, 0);
1407 if (status != PSA_SUCCESS) {
1408 return status;
1480 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
1502 status = psa_get_and_lock_key_slot_with_policy(key, &slot,
1504 if (status != PSA_SUCCESS) {
1505 return status;
1510 status = psa_driver_wrapper_export_key(&slot->attr,
1520 return (status == PSA_SUCCESS) ? unlock_status : status;
1595 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
1615 status = psa_get_and_lock_key_slot_with_policy(key, &slot, 0, 0);
1616 if (status != PSA_SUCCESS) {
1617 return status;
1623 status = PSA_ERROR_INVALID_ARGUMENT;
1627 status = psa_driver_wrapper_export_public_key(
1635 return (status == PSA_SUCCESS) ? unlock_status : status;
1679 psa_status_t status = PSA_ERROR_INVALID_ARGUMENT;
1683 status = psa_validate_key_location(lifetime, p_drv);
1684 if (status != PSA_SUCCESS) {
1685 return status;
1688 status = psa_validate_key_persistence(lifetime);
1689 if (status != PSA_SUCCESS) {
1690 return status;
1703 status = psa_validate_key_policy(&attributes->policy);
1704 if (status != PSA_SUCCESS) {
1705 return status;
1755 psa_status_t status;
1762 status = psa_validate_key_attributes(attributes, p_drv);
1763 if (status != PSA_SUCCESS) {
1764 return status;
1771 status = psa_reserve_free_key_slot(&volatile_key_id, p_slot);
1776 if (status != PSA_SUCCESS) {
1777 return status;
1818 status = psa_find_se_slot_for_key(attributes, method, *p_drv,
1820 if (status != PSA_SUCCESS) {
1821 return status;
1829 status = psa_crypto_save_transaction();
1830 if (status != PSA_SUCCESS) {
1832 return status;
1836 status = psa_copy_key_material_into_slot(
1884 psa_status_t status = PSA_SUCCESS;
1906 status = psa_save_persistent_key(&slot->attr,
1914 status = psa_save_persistent_key(&slot->attr,
1929 status = psa_save_se_persistent_data(driver);
1930 if (status != PSA_SUCCESS) {
1937 return status;
1939 status = psa_crypto_stop_transaction();
1943 if (status == PSA_SUCCESS) {
1945 status = psa_key_slot_state_transition(slot, PSA_SLOT_FILLING,
1947 if (status != PSA_SUCCESS) {
1956 return status;
2044 psa_status_t status;
2067 status = psa_start_key_creation(PSA_KEY_CREATION_IMPORT, attributes,
2069 if (status != PSA_SUCCESS) {
2079 status = psa_driver_wrapper_get_key_buffer_size_from_key_data(
2081 if (status != PSA_SUCCESS) {
2085 status = psa_allocate_buffer_to_slot(slot, storage_size);
2086 if (status != PSA_SUCCESS) {
2092 status = psa_driver_wrapper_import_key(attributes,
2097 if (status != PSA_SUCCESS) {
2104 status = PSA_ERROR_INVALID_ARGUMENT;
2111 status = PSA_ERROR_NOT_SUPPORTED;
2114 status = psa_validate_optional_attributes(slot, attributes);
2115 if (status != PSA_SUCCESS) {
2119 status = psa_finish_key_creation(slot, driver, key);
2122 if (status != PSA_SUCCESS) {
2126 return status;
2133 psa_status_t status;
2149 status = psa_start_key_creation(PSA_KEY_CREATION_REGISTER, attributes,
2151 if (status != PSA_SUCCESS) {
2155 status = psa_finish_key_creation(slot, driver, &key);
2158 if (status != PSA_SUCCESS) {
2164 return status;
2172 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2182 status = psa_get_and_lock_key_slot_with_policy(
2184 if (status != PSA_SUCCESS) {
2188 status = psa_validate_optional_attributes(source_slot,
2190 if (status != PSA_SUCCESS) {
2203 status = psa_restrict_key_policy(source_slot->attr.type,
2206 if (status != PSA_SUCCESS) {
2210 status = psa_start_key_creation(PSA_KEY_CREATION_COPY, &actual_attributes,
2212 if (status != PSA_SUCCESS) {
2224 status = PSA_ERROR_NOT_SUPPORTED;
2234 status = psa_driver_wrapper_get_key_buffer_size(&actual_attributes,
2236 if (status != PSA_SUCCESS) {
2240 status = psa_allocate_buffer_to_slot(target_slot, storage_size);
2241 if (status != PSA_SUCCESS) {
2245 status = psa_driver_wrapper_copy_key(&actual_attributes,
2251 if (status != PSA_SUCCESS) {
2255 status = psa_copy_key_material_into_slot(target_slot,
2258 if (status != PSA_SUCCESS) {
2262 status = psa_finish_key_creation(target_slot, driver, target_key);
2264 if (status != PSA_SUCCESS) {
2270 return (status == PSA_SUCCESS) ? unlock_status : status;
2286 psa_status_t status = psa_driver_wrapper_hash_abort(operation);
2289 return status;
2295 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2299 status = PSA_ERROR_BAD_STATE;
2304 status = PSA_ERROR_INVALID_ARGUMENT;
2312 status = psa_driver_wrapper_hash_setup(operation, alg);
2315 if (status != PSA_SUCCESS) {
2319 return status;
2326 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2330 status = PSA_ERROR_BAD_STATE;
2341 status = psa_driver_wrapper_hash_update(operation, input, input_length);
2344 if (status != PSA_SUCCESS) {
2349 return status;
2357 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2364 status = psa_driver_wrapper_hash_finish(
2368 return status;
2376 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2380 status = psa_hash_finish_internal(operation, hash, hash_size, hash_length);
2386 return status;
2395 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2398 status = psa_hash_finish_internal(
2403 if (status != PSA_SUCCESS) {
2408 status = PSA_ERROR_INVALID_SIGNATURE;
2414 status = PSA_ERROR_INVALID_SIGNATURE;
2419 if (status != PSA_SUCCESS) {
2423 return status;
2431 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2442 status = psa_driver_wrapper_hash_compute(alg, input, input_length,
2450 return status;
2459 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2465 status = PSA_ERROR_INVALID_ARGUMENT;
2466 return status;
2470 status = psa_driver_wrapper_hash_compute(
2474 if (status != PSA_SUCCESS) {
2478 status = PSA_ERROR_INVALID_SIGNATURE;
2484 status = PSA_ERROR_INVALID_SIGNATURE;
2493 return status;
2504 psa_status_t status = psa_driver_wrapper_hash_clone(source_operation,
2506 if (status != PSA_SUCCESS) {
2510 return status;
2525 psa_status_t status = psa_driver_wrapper_mac_abort(operation);
2530 return status;
2538 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2547 status = psa_mac_key_can_do(alg, key_type);
2548 if (status != PSA_SUCCESS) {
2549 return status;
2591 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2597 status = PSA_ERROR_BAD_STATE;
2601 status = psa_get_and_lock_key_slot_with_policy(
2606 if (status != PSA_SUCCESS) {
2610 status = psa_mac_finalize_alg_and_key_validation(alg, &slot->attr,
2612 if (status != PSA_SUCCESS) {
2619 status = psa_driver_wrapper_mac_sign_setup(operation,
2625 status = psa_driver_wrapper_mac_verify_setup(operation,
2633 if (status != PSA_SUCCESS) {
2639 return (status == PSA_SUCCESS) ? unlock_status : status;
2660 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2664 status = PSA_ERROR_BAD_STATE;
2665 return status;
2671 status = PSA_SUCCESS;
2672 return status;
2676 status = psa_driver_wrapper_mac_update(operation, input, input_length);
2678 if (status != PSA_SUCCESS) {
2687 return status;
2695 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2701 status = PSA_ERROR_BAD_STATE;
2706 status = PSA_ERROR_BAD_STATE;
2713 status = PSA_ERROR_BAD_STATE;
2718 status = PSA_ERROR_BUFFER_TOO_SMALL;
2723 status = psa_driver_wrapper_mac_sign_finish(operation,
2734 if (status != PSA_SUCCESS) {
2740 psa_wipe_tag_output_buffer(mac, status, mac_size, *mac_length);
2746 return status == PSA_SUCCESS ? abort_status : status;
2753 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2758 status = PSA_ERROR_BAD_STATE;
2763 status = PSA_ERROR_BAD_STATE;
2768 status = PSA_ERROR_INVALID_SIGNATURE;
2773 status = psa_driver_wrapper_mac_verify_finish(operation,
2780 return status == PSA_SUCCESS ? abort_status : status;
2792 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2797 status = psa_get_and_lock_key_slot_with_policy(
2802 if (status != PSA_SUCCESS) {
2806 status = psa_mac_finalize_alg_and_key_validation(alg, &slot->attr,
2808 if (status != PSA_SUCCESS) {
2813 status = PSA_ERROR_BUFFER_TOO_SMALL;
2817 status = psa_driver_wrapper_mac_compute(
2831 if (status != PSA_SUCCESS) {
2836 psa_wipe_tag_output_buffer(mac, status, mac_size, *mac_length);
2840 return (status == PSA_SUCCESS) ? unlock_status : status;
2851 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2857 status = psa_mac_compute_internal(key, alg,
2867 return status;
2877 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2884 status = psa_mac_compute_internal(key, alg,
2888 if (status != PSA_SUCCESS) {
2893 status = PSA_ERROR_INVALID_SIGNATURE;
2899 status = PSA_ERROR_INVALID_SIGNATURE;
2908 return status;
2946 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
2952 status = psa_sign_verify_check_alg(input_is_message, alg);
2953 if (status != PSA_SUCCESS) {
2954 return status;
2965 status = psa_get_and_lock_key_slot_with_policy(
2971 if (status != PSA_SUCCESS) {
2976 status = PSA_ERROR_INVALID_ARGUMENT;
2981 status = psa_driver_wrapper_sign_message(
2987 status = psa_driver_wrapper_sign_hash(
2995 psa_wipe_tag_output_buffer(signature, status, signature_size,
3000 return (status == PSA_SUCCESS) ? unlock_status : status;
3011 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3015 status = psa_sign_verify_check_alg(input_is_message, alg);
3016 if (status != PSA_SUCCESS) {
3017 return status;
3020 status = psa_get_and_lock_key_slot_with_policy(
3026 if (status != PSA_SUCCESS) {
3027 return status;
3031 status = psa_driver_wrapper_verify_message(
3036 status = psa_driver_wrapper_verify_hash(
3044 return (status == PSA_SUCCESS) ? unlock_status : status;
3059 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3065 status = psa_driver_wrapper_hash_compute(
3070 if (status != PSA_SUCCESS) {
3071 return status;
3091 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3097 status = psa_sign_internal(key, 1, alg, input, input_length, signature,
3105 return status;
3118 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3124 status = psa_driver_wrapper_hash_compute(
3129 if (status != PSA_SUCCESS) {
3130 return status;
3149 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3155 status = psa_verify_internal(key, 1, alg, input, input_length, signature,
3164 return status;
3223 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3229 status = psa_sign_internal(key, 0, alg, hash, hash_length, signature,
3238 return status;
3295 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3301 status = psa_verify_internal(key, 0, alg, hash, hash_length, signature,
3310 return status;
3323 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3342 status = psa_get_and_lock_key_slot_with_policy(
3344 if (status != PSA_SUCCESS) {
3345 return status;
3349 status = PSA_ERROR_INVALID_ARGUMENT;
3356 status = psa_driver_wrapper_asymmetric_encrypt(
3367 return (status == PSA_SUCCESS) ? unlock_status : status;
3380 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3399 status = psa_get_and_lock_key_slot_with_policy(
3401 if (status != PSA_SUCCESS) {
3402 return status;
3405 status = PSA_ERROR_INVALID_ARGUMENT;
3412 status = psa_driver_wrapper_asymmetric_decrypt(
3424 return (status == PSA_SUCCESS) ? unlock_status : status;
3465 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3467 status = psa_driver_wrapper_sign_hash_abort(operation);
3475 return status;
3483 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3495 status = psa_sign_verify_check_alg(0, alg);
3496 if (status != PSA_SUCCESS) {
3498 return status;
3501 status = psa_get_and_lock_key_slot_with_policy(key, &slot,
3505 if (status != PSA_SUCCESS) {
3510 status = PSA_ERROR_INVALID_ARGUMENT;
3519 status = psa_driver_wrapper_sign_hash_start(operation, &slot->attr,
3525 if (status != PSA_SUCCESS) {
3538 return (status == PSA_SUCCESS) ? unlock_status : status;
3547 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3556 status = PSA_ERROR_BAD_STATE;
3563 status = PSA_ERROR_BUFFER_TOO_SMALL;
3569 status = psa_driver_wrapper_sign_hash_complete(operation, signature,
3579 psa_wipe_tag_output_buffer(signature, status, signature_size,
3583 if (status != PSA_OPERATION_INCOMPLETE) {
3584 if (status != PSA_SUCCESS) {
3593 return status;
3599 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3601 status = psa_sign_hash_abort_internal(operation);
3610 return status;
3623 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3625 status = psa_driver_wrapper_verify_hash_abort(operation);
3633 return status;
3642 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3655 status = psa_sign_verify_check_alg(0, alg);
3656 if (status != PSA_SUCCESS) {
3658 return status;
3661 status = psa_get_and_lock_key_slot_with_policy(key, &slot,
3665 if (status != PSA_SUCCESS) {
3667 return status;
3676 status = psa_driver_wrapper_verify_hash_start(operation, &slot->attr,
3685 if (status != PSA_SUCCESS) {
3699 return (status == PSA_SUCCESS) ? unlock_status : status;
3705 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3710 status = PSA_ERROR_BAD_STATE;
3714 status = psa_driver_wrapper_verify_hash_complete(operation);
3722 if (status != PSA_OPERATION_INCOMPLETE) {
3723 if (status != PSA_SUCCESS) {
3730 return status;
3736 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3738 status = psa_verify_hash_abort_internal(operation);
3747 return status;
3814 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3834 status = mbedtls_psa_ecp_load_representation(attributes->type,
3840 if (status != PSA_SUCCESS) {
3841 return status;
3873 (void) status;
3891 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
3902 status = PSA_ERROR_BUFFER_TOO_SMALL;
3909 status = mbedtls_to_psa_error(
3921 status = PSA_ERROR_NOT_SUPPORTED;
3925 status = mbedtls_to_psa_error(
3943 if (status == PSA_SUCCESS) {
3944 status = mbedtls_to_psa_error(
3950 if (status != PSA_SUCCESS) {
3954 status = mbedtls_to_psa_error(
3961 if (status != PSA_SUCCESS) {
3967 status = PSA_SUCCESS;
3974 return status;
4029 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4052 status = mbedtls_psa_ecp_load_representation(attributes->type,
4058 if (status != PSA_SUCCESS) {
4059 return status;
4068 status = mbedtls_to_psa_error(
4073 if (status != PSA_SUCCESS) {
4074 return status;
4077 status = mbedtls_to_psa_error(
4083 if (status != PSA_SUCCESS) {
4084 return status;
4087 status = mbedtls_psa_ecp_load_public_part(operation->ctx);
4089 if (status != PSA_SUCCESS) {
4090 return status;
4116 (void) status;
4134 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4139 status = mbedtls_to_psa_error(
4152 return status;
4203 psa_status_t status;
4205 status = mbedtls_psa_external_get_random(&global_data.rng,
4208 if (status != PSA_SUCCESS) {
4209 return status;
4251 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4260 status = PSA_ERROR_BAD_STATE;
4265 status = PSA_ERROR_INVALID_ARGUMENT;
4269 status = psa_get_and_lock_key_slot_with_policy(key, &slot, usage, alg);
4270 if (status != PSA_SUCCESS) {
4288 status = psa_driver_wrapper_cipher_encrypt_setup(operation,
4294 status = psa_driver_wrapper_cipher_decrypt_setup(operation,
4302 if (status != PSA_SUCCESS) {
4308 return (status == PSA_SUCCESS) ? unlock_status : status;
4330 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4336 status = PSA_ERROR_BAD_STATE;
4341 status = PSA_ERROR_BAD_STATE;
4347 status = PSA_ERROR_BUFFER_TOO_SMALL;
4352 status = PSA_ERROR_GENERIC_ERROR;
4358 status = psa_generate_random_internal(iv, default_iv_length);
4359 if (status != PSA_SUCCESS) {
4363 status = psa_driver_wrapper_cipher_set_iv(operation,
4367 if (status == PSA_SUCCESS) {
4379 return status;
4386 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4391 status = PSA_ERROR_BAD_STATE;
4396 status = PSA_ERROR_BAD_STATE;
4401 status = PSA_ERROR_INVALID_ARGUMENT;
4407 status = psa_driver_wrapper_cipher_set_iv(operation,
4412 if (status == PSA_SUCCESS) {
4420 return status;
4430 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4436 status = PSA_ERROR_BAD_STATE;
4441 status = PSA_ERROR_BAD_STATE;
4448 status = psa_driver_wrapper_cipher_update(operation,
4456 if (status != PSA_SUCCESS) {
4463 return status;
4471 psa_status_t status = PSA_ERROR_GENERIC_ERROR;
4476 status = PSA_ERROR_BAD_STATE;
4481 status = PSA_ERROR_BAD_STATE;
4487 status = psa_driver_wrapper_cipher_finish(operation,
4493 if (status == PSA_SUCCESS) {
4494 status = psa_cipher_abort(operation);
4502 return status;
4531 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4541 status = PSA_ERROR_INVALID_ARGUMENT;
4545 status = psa_get_and_lock_key_slot_with_policy(key, &slot,
4548 if (status != PSA_SUCCESS) {
4554 status = PSA_ERROR_GENERIC_ERROR;
4560 status = PSA_ERROR_BUFFER_TOO_SMALL;
4564 status = psa_generate_random_internal(local_iv, default_iv_length);
4565 if (status != PSA_SUCCESS) {
4573 status = psa_driver_wrapper_cipher_encrypt(
4581 if (status == PSA_SUCCESS) {
4582 status = unlock_status;
4585 if (status == PSA_SUCCESS) {
4597 return status;
4608 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4616 status = PSA_ERROR_INVALID_ARGUMENT;
4620 status = psa_get_and_lock_key_slot_with_policy(key, &slot,
4623 if (status != PSA_SUCCESS) {
4629 status = PSA_ERROR_INVALID_ARGUMENT;
4632 status = PSA_ERROR_INVALID_ARGUMENT;
4639 status = psa_driver_wrapper_cipher_decrypt(
4646 if (status == PSA_SUCCESS) {
4647 status = unlock_status;
4650 if (status != PSA_SUCCESS) {
4657 return status;
4736 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4746 status = psa_aead_check_algorithm(alg);
4747 if (status != PSA_SUCCESS) {
4748 return status;
4751 status = psa_get_and_lock_key_slot_with_policy(
4753 if (status != PSA_SUCCESS) {
4754 return status;
4762 status = psa_aead_check_nonce_length(alg, nonce_length);
4763 if (status != PSA_SUCCESS) {
4767 status = psa_driver_wrapper_aead_encrypt(
4775 if (status != PSA_SUCCESS && ciphertext_size != 0) {
4787 return status;
4802 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4812 status = psa_aead_check_algorithm(alg);
4813 if (status != PSA_SUCCESS) {
4814 return status;
4817 status = psa_get_and_lock_key_slot_with_policy(
4819 if (status != PSA_SUCCESS) {
4820 return status;
4829 status = psa_aead_check_nonce_length(alg, nonce_length);
4830 if (status != PSA_SUCCESS) {
4834 status = psa_driver_wrapper_aead_decrypt(
4842 if (status != PSA_SUCCESS && plaintext_size != 0) {
4854 return status;
4902 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4907 status = psa_aead_check_algorithm(alg);
4908 if (status != PSA_SUCCESS) {
4913 status = PSA_ERROR_BAD_STATE;
4919 status = PSA_ERROR_BAD_STATE;
4929 status = psa_get_and_lock_key_slot_with_policy(key, &slot, key_usage,
4931 if (status != PSA_SUCCESS) {
4935 if ((status = psa_validate_tag_length(alg)) != PSA_SUCCESS) {
4940 status = psa_driver_wrapper_aead_encrypt_setup(operation,
4946 status = psa_driver_wrapper_aead_decrypt_setup(operation,
4952 if (status != PSA_SUCCESS) {
4961 if (status == PSA_SUCCESS) {
4962 status = unlock_status;
4969 return status;
4992 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
4995 status = PSA_ERROR_BAD_STATE;
5000 status = PSA_ERROR_BAD_STATE;
5004 status = psa_aead_check_nonce_length(operation->alg, nonce_length);
5005 if (status != PSA_SUCCESS) {
5006 status = PSA_ERROR_INVALID_ARGUMENT;
5010 status = psa_driver_wrapper_aead_set_nonce(operation, nonce,
5014 if (status == PSA_SUCCESS) {
5020 return status;
5029 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
5039 status = PSA_ERROR_BAD_STATE;
5044 status = PSA_ERROR_BAD_STATE;
5060 status = PSA_ERROR_BUFFER_TOO_SMALL;
5064 status = psa_generate_random_internal(local_nonce, required_nonce_size);
5065 if (status != PSA_SUCCESS) {
5069 status = psa_aead_set_nonce_internal(operation, local_nonce,
5073 if (status == PSA_SUCCESS) {
5082 return status;
5091 psa_status_t status;
5096 status = psa_aead_set_nonce_internal(operation, nonce, nonce_length);
5105 return status;
5113 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
5116 status = PSA_ERROR_BAD_STATE;
5122 status = PSA_ERROR_BAD_STATE;
5135 status = PSA_ERROR_INVALID_ARGUMENT;
5144 status = PSA_ERROR_INVALID_ARGUMENT;
5158 status = psa_driver_wrapper_aead_set_lengths(operation, ad_length,
5162 if (status == PSA_SUCCESS) {
5170 return status;
5178 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
5184 status = PSA_ERROR_BAD_STATE;
5189 status = PSA_ERROR_BAD_STATE;
5195 status = PSA_ERROR_INVALID_ARGUMENT;
5203 status = PSA_ERROR_BAD_STATE;
5208 status = psa_driver_wrapper_aead_update_ad(operation, input,
5212 if (status == PSA_SUCCESS) {
5220 return status;
5232 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
5244 status = PSA_ERROR_BAD_STATE;
5249 status = PSA_ERROR_BAD_STATE;
5257 status = PSA_ERROR_INVALID_ARGUMENT;
5263 status = PSA_ERROR_INVALID_ARGUMENT;
5271 status = PSA_ERROR_BAD_STATE;
5276 status = psa_driver_wrapper_aead_update(operation, input, input_length,
5281 if (status == PSA_SUCCESS) {
5290 return status;
5316 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
5327 status = psa_aead_final_checks(operation);
5328 if (status != PSA_SUCCESS) {
5333 status = PSA_ERROR_BAD_STATE;
5337 status = psa_driver_wrapper_aead_finish(operation, ciphertext,
5350 psa_wipe_tag_output_buffer(tag, status, tag_size, *tag_length);
5357 return status;
5369 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
5379 status = psa_aead_final_checks(operation);
5380 if (status != PSA_SUCCESS) {
5385 status = PSA_ERROR_BAD_STATE;
5389 status = psa_driver_wrapper_aead_verify(operation, plaintext,
5400 return status;
5406 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
5415 status = psa_driver_wrapper_aead_abort(operation);
5419 return status;
5443 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
5452 status = psa_driver_wrapper_mac_sign_setup(operation,
5458 return status;
5479 psa_status_t status = PSA_SUCCESS;
5489 status = psa_mac_abort(&operation->ctx.hkdf.hmac);
5517 status = PSA_SUCCESS;
5537 status = PSA_SUCCESS;
5541 status = PSA_ERROR_BAD_STATE;
5544 return status;
5582 psa_status_t status;
5625 status = psa_key_derivation_start_hmac(&hkdf->hmac,
5629 if (status != PSA_SUCCESS) {
5630 return status;
5634 status = psa_mac_update(&hkdf->hmac,
5637 if (status != PSA_SUCCESS) {
5638 return status;
5641 status = psa_mac_update(&hkdf->hmac,
5644 if (status != PSA_SUCCESS) {
5645 return status;
5647 status = psa_mac_update(&hkdf->hmac,
5649 if (status != PSA_SUCCESS) {
5650 return status;
5652 status = psa_mac_sign_finish(&hkdf->hmac,
5656 if (status != PSA_SUCCESS) {
5657 return status;
5675 psa_status_t status, cleanup_status;
5707 status = psa_key_derivation_start_hmac(&hmac,
5711 if (status != PSA_SUCCESS) {
5720 status = psa_mac_update(&hmac,
5723 if (status != PSA_SUCCESS) {
5726 status = psa_mac_update(&hmac,
5729 if (status != PSA_SUCCESS) {
5734 status = psa_mac_update(&hmac, tls12_prf->Ai, hash_length);
5735 if (status != PSA_SUCCESS) {
5740 status = psa_mac_sign_finish(&hmac,
5744 status = PSA_ERROR_CORRUPTION_DETECTED;
5746 if (status != PSA_SUCCESS) {
5751 status = psa_key_derivation_start_hmac(&hmac,
5755 if (status != PSA_SUCCESS) {
5758 status = psa_mac_update(&hmac, tls12_prf->Ai, hash_length);
5759 if (status != PSA_SUCCESS) {
5762 status = psa_mac_update(&hmac, tls12_prf->label, tls12_prf->label_length);
5763 if (status != PSA_SUCCESS) {
5766 status = psa_mac_update(&hmac, tls12_prf->seed, tls12_prf->seed_length);
5767 if (status != PSA_SUCCESS) {
5770 status = psa_mac_sign_finish(&hmac,
5773 if (status != PSA_SUCCESS) {
5780 if (status == PSA_SUCCESS && cleanup_status != PSA_SUCCESS) {
5781 status = cleanup_status;
5784 return status;
5795 psa_status_t status;
5811 status = psa_key_derivation_tls12_prf_generate_next_block(tls12_prf,
5813 if (status != PSA_SUCCESS) {
5814 return status;
5844 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
5851 status = psa_hash_compute(PSA_ALG_SHA_256, ecjpake->data,
5854 if (status != PSA_SUCCESS) {
5855 return status;
5873 psa_status_t status;
5885 status = psa_driver_wrapper_mac_sign_setup(&mac_operation,
5890 if (status != PSA_SUCCESS) {
5893 status = psa_mac_update(&mac_operation, pbkdf2->salt, pbkdf2->salt_length);
5894 if (status != PSA_SUCCESS) {
5897 status = psa_mac_update(&mac_operation, block_counter, sizeof(block_counter));
5898 if (status != PSA_SUCCESS) {
5901 status = psa_mac_sign_finish(&mac_operation, U_i, sizeof(U_i),
5903 if (status != PSA_SUCCESS) {
5908 status = PSA_ERROR_CORRUPTION_DETECTED;
5918 status = psa_driver_wrapper_mac_compute(attributes,
5924 if (status != PSA_SUCCESS) {
5934 return status;
5943 psa_status_t status;
5992 status = psa_key_derivation_pbkdf2_generate_block(pbkdf2, prf_alg,
5995 if (status != PSA_SUCCESS) {
5996 return status;
6009 psa_status_t status;
6034 status = PSA_ERROR_INSUFFICIENT_DATA;
6042 status = psa_key_derivation_hkdf_read(&operation->ctx.hkdf, kdf_alg,
6050 status = psa_key_derivation_tls12_prf_read(&operation->ctx.tls12_prf,
6058 status = psa_key_derivation_tls12_ecjpake_to_pms_read(
6064 status = psa_key_derivation_pbkdf2_read(&operation->ctx.pbkdf2, kdf_alg,
6071 status = PSA_ERROR_BAD_STATE;
6074 return status;
6078 if (status != PSA_SUCCESS) {
6092 return status;
6152 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
6193 if ((status = psa_key_derivation_output_bytes(operation, *data, m_bytes)) != 0) {
6224 status = mbedtls_to_psa_error(ret);
6226 if (status != PSA_SUCCESS) {
6232 return status;
6256 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
6276 status = psa_key_derivation_output_bytes(operation, *data, output_length);
6278 if (status != PSA_SUCCESS) {
6279 return status;
6297 return status;
6330 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
6342 status = psa_generate_derived_ecc_key_weierstrass_helper(slot, bits, operation, &data);
6343 if (status != PSA_SUCCESS) {
6348 status = psa_generate_derived_ecc_key_montgomery_helper(bits, operation, &data);
6349 if (status != PSA_SUCCESS) {
6365 status = psa_key_derivation_output_bytes(operation, data, bytes);
6366 if (status != PSA_SUCCESS) {
6381 status = psa_driver_wrapper_get_key_buffer_size(&slot->attr,
6383 if (status != PSA_SUCCESS) {
6387 status = psa_allocate_buffer_to_slot(slot, storage_size);
6388 if (status != PSA_SUCCESS) {
6392 status = psa_driver_wrapper_import_key(&slot->attr,
6398 status = PSA_ERROR_INVALID_ARGUMENT;
6403 return status;
6429 psa_status_t status;
6453 status = psa_start_key_creation(PSA_KEY_CREATION_DERIVE, attributes,
6458 status = PSA_ERROR_NOT_SUPPORTED;
6461 if (status == PSA_SUCCESS) {
6462 status = psa_generate_derived_key_internal(slot,
6466 if (status == PSA_SUCCESS) {
6467 status = psa_finish_key_creation(slot, driver, key);
6469 if (status != PSA_SUCCESS) {
6473 return status;
6540 psa_status_t status = psa_hash_setup(&operation, alg);
6542 return status;
6580 psa_status_t status = psa_hash_try_support(hash_alg);
6581 if (status != PSA_SUCCESS) {
6582 return status;
6625 status = PSA_ERROR_NOT_SUPPORTED;
6627 return status;
6643 psa_status_t status = psa_key_derivation_set_maximum_capacity(operation,
6645 return status;
6680 psa_status_t status;
6692 status = psa_key_agreement_try_support(ka_alg);
6693 if (status != PSA_SUCCESS) {
6694 return status;
6699 status = psa_key_derivation_setup_kdf(operation, kdf_alg);
6705 status = psa_key_derivation_setup_kdf(operation, alg);
6713 if (status == PSA_SUCCESS) {
6716 return status;
6727 psa_status_t status;
6738 status = psa_key_derivation_start_hmac(&hkdf->hmac,
6741 if (status != PSA_SUCCESS) {
6742 return status;
6775 status = psa_key_derivation_start_hmac(&hkdf->hmac,
6778 if (status != PSA_SUCCESS) {
6779 return status;
6786 status = psa_mac_update(&hkdf->hmac,
6788 if (status != PSA_SUCCESS) {
6789 return status;
6791 status = psa_mac_sign_finish(&hkdf->hmac,
6795 if (status != PSA_SUCCESS) {
6796 return status;
6947 psa_status_t status;
7000 status = psa_tls12_prf_set_key(prf, pms, (size_t) (cur - pms));
7003 return status;
7148 psa_status_t status = PSA_SUCCESS;
7156 return status;
7166 psa_status_t status = PSA_SUCCESS;
7176 status = psa_driver_wrapper_mac_compute(&attributes,
7188 return status;
7197 psa_status_t status = PSA_SUCCESS;
7205 status = psa_pbkdf2_hmac_set_password(hash_alg, data, data_length,
7212 status = psa_pbkdf2_cmac_set_password(data, data_length,
7223 return status;
7306 psa_status_t status;
7309 status = psa_key_derivation_check_input_type(step, key_type);
7310 if (status != PSA_SUCCESS) {
7316 status = psa_hkdf_input(&operation->ctx.hkdf, kdf_alg,
7322 status = psa_tls12_prf_input(&operation->ctx.tls12_prf,
7328 status = psa_tls12_prf_psk_to_ms_input(&operation->ctx.tls12_prf,
7334 status = psa_tls12_ecjpake_to_pms_input(
7340 status = psa_pbkdf2_input(&operation->ctx.pbkdf2, kdf_alg,
7353 if (status != PSA_SUCCESS) {
7356 return status;
7364 psa_status_t status;
7369 status = psa_pbkdf2_set_input_cost(
7377 status = PSA_ERROR_INVALID_ARGUMENT;
7380 if (status != PSA_SUCCESS) {
7383 return status;
7392 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
7397 status = psa_key_derivation_input_internal(operation, step,
7404 return status;
7420 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
7424 status = psa_get_and_lock_transparent_key_slot_with_policy(
7426 if (status != PSA_SUCCESS) {
7428 return status;
7438 status = psa_key_derivation_input_internal(operation,
7445 return (status == PSA_SUCCESS) ? unlock_status : status;
7536 psa_status_t status;
7543 status = psa_key_agreement_raw_internal(ka_alg,
7549 if (status != PSA_SUCCESS) {
7556 status = psa_key_derivation_input_internal(operation, step,
7562 return status;
7571 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
7579 status = psa_get_and_lock_transparent_key_slot_with_policy(
7581 if (status != PSA_SUCCESS) {
7582 return status;
7586 status = psa_key_agreement_internal(operation, step,
7593 if (status != PSA_SUCCESS) {
7606 return (status == PSA_SUCCESS) ? unlock_status : status;
7617 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
7626 status = PSA_ERROR_INVALID_ARGUMENT;
7629 status = psa_get_and_lock_transparent_key_slot_with_policy(
7631 if (status != PSA_SUCCESS) {
7646 status = PSA_ERROR_BUFFER_TOO_SMALL;
7651 status = psa_key_agreement_raw_internal(alg, slot,
7658 * with an unsuccessful status. */
7659 if (output != NULL && status != PSA_SUCCESS) {
7680 return (status == PSA_SUCCESS) ? unlock_status : status;
7761 psa_status_t status;
7766 status = psa_generate_random_internal(output, output_size);
7772 return status;
7809 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
7812 status = psa_validate_unstructured_key_bit_size(type, bits);
7813 if (status != PSA_SUCCESS) {
7814 return status;
7860 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
7868 status = psa_generate_random_internal(key_buffer, key_buffer_size);
7869 if (status != PSA_SUCCESS) {
7870 return status;
7920 psa_status_t status;
7949 status = psa_start_key_creation(PSA_KEY_CREATION_GENERATE, attributes,
7951 if (status != PSA_SUCCESS) {
7962 status = psa_validate_key_type_and_size_for_key_generation(
7964 if (status != PSA_SUCCESS) {
7972 status = psa_driver_wrapper_get_key_buffer_size(
7974 if (status != PSA_SUCCESS) {
7979 status = psa_allocate_buffer_to_slot(slot, key_buffer_size);
7980 if (status != PSA_SUCCESS) {
7985 status = psa_driver_wrapper_generate_key(attributes,
7989 if (status != PSA_SUCCESS) {
7994 if (status == PSA_SUCCESS) {
7995 status = psa_finish_key_creation(slot, driver, key);
7997 if (status != PSA_SUCCESS) {
8001 return status;
8021 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
8028 status = PSA_ERROR_BAD_STATE;
8032 status = PSA_SUCCESS;
8039 return status;
8098 * returns. If this function returns a failure status, the initialization
8121 psa_status_t status = PSA_SUCCESS;
8133 status = psa_driver_wrapper_init();
8154 status = psa_initialize_key_slots();
8193 status = mbedtls_psa_random_seed(&global_data.rng);
8194 if (status == PSA_SUCCESS) {
8214 status = psa_crypto_load_transaction();
8215 if (status == PSA_SUCCESS) {
8216 status = psa_crypto_recover_transaction(&psa_crypto_transaction);
8217 if (status == PSA_SUCCESS) {
8220 status = psa_crypto_stop_transaction();
8221 } else if (status == PSA_ERROR_DOES_NOT_EXIST) {
8224 status = PSA_SUCCESS;
8228 status = PSA_SUCCESS;
8240 status = PSA_ERROR_CORRUPTION_DETECTED;
8248 return status;
8253 psa_status_t status;
8261 status = mbedtls_psa_crypto_init_subsystem(PSA_CRYPTO_SUBSYSTEM_DRIVER_WRAPPERS);
8262 if (status != PSA_SUCCESS) {
8266 status = mbedtls_psa_crypto_init_subsystem(PSA_CRYPTO_SUBSYSTEM_KEY_SLOTS);
8267 if (status != PSA_SUCCESS) {
8271 status = mbedtls_psa_crypto_init_subsystem(PSA_CRYPTO_SUBSYSTEM_RNG);
8272 if (status != PSA_SUCCESS) {
8276 status = mbedtls_psa_crypto_init_subsystem(PSA_CRYPTO_SUBSYSTEM_TRANSACTION);
8280 if (status != PSA_SUCCESS) {
8284 return status;
8398 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
8401 status = PSA_ERROR_BAD_STATE;
8407 status = PSA_ERROR_INVALID_ARGUMENT;
8428 status = PSA_ERROR_NOT_SUPPORTED;
8437 return status;
8444 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
8450 status = PSA_ERROR_BAD_STATE;
8454 status = psa_get_and_lock_key_slot_with_policy(password, &slot,
8457 if (status != PSA_SUCCESS) {
8465 status = PSA_ERROR_INVALID_ARGUMENT;
8471 status = PSA_ERROR_INSUFFICIENT_MEMORY;
8480 if (status != PSA_SUCCESS) {
8484 return (status == PSA_SUCCESS) ? unlock_status : status;
8492 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
8496 status = PSA_ERROR_BAD_STATE;
8501 status = PSA_ERROR_INVALID_ARGUMENT;
8506 status = PSA_ERROR_BAD_STATE;
8512 status = PSA_ERROR_INSUFFICIENT_MEMORY;
8521 status = PSA_SUCCESS;
8525 if (status != PSA_SUCCESS) {
8528 return status;
8536 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
8540 status = PSA_ERROR_BAD_STATE;
8545 status = PSA_ERROR_INVALID_ARGUMENT;
8550 status = PSA_ERROR_BAD_STATE;
8556 status = PSA_ERROR_INSUFFICIENT_MEMORY;
8565 status = PSA_SUCCESS;
8569 if (status != PSA_SUCCESS) {
8572 return status;
8579 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
8582 status = PSA_ERROR_BAD_STATE;
8592 status = PSA_ERROR_INVALID_ARGUMENT;
8597 status = PSA_ERROR_NOT_SUPPORTED;
8602 return status;
8637 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
8655 status = psa_driver_wrapper_pake_setup(operation, &inputs);
8664 if (status == PSA_SUCCESS) {
8671 status = PSA_ERROR_NOT_SUPPORTED;
8674 return status;
8761 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
8767 status = psa_pake_complete_inputs(operation);
8768 if (status != PSA_SUCCESS) {
8774 status = PSA_ERROR_BAD_STATE;
8779 status = PSA_ERROR_INVALID_ARGUMENT;
8786 status = psa_jpake_prologue(operation, step, PSA_JPAKE_OUTPUT);
8787 if (status != PSA_SUCCESS) {
8796 status = PSA_ERROR_NOT_SUPPORTED;
8802 status = psa_driver_wrapper_pake_output(operation, driver_step,
8805 if (status != PSA_SUCCESS) {
8812 status = psa_jpake_epilogue(operation, PSA_JPAKE_OUTPUT);
8813 if (status != PSA_SUCCESS) {
8819 status = PSA_ERROR_NOT_SUPPORTED;
8825 if (status != PSA_SUCCESS) {
8828 return status;
8837 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
8845 status = psa_pake_complete_inputs(operation);
8846 if (status != PSA_SUCCESS) {
8852 status = PSA_ERROR_BAD_STATE;
8857 status = PSA_ERROR_INVALID_ARGUMENT;
8864 status = psa_jpake_prologue(operation, step, PSA_JPAKE_INPUT);
8865 if (status != PSA_SUCCESS) {
8874 status = PSA_ERROR_NOT_SUPPORTED;
8879 status = psa_driver_wrapper_pake_input(operation, driver_step,
8882 if (status != PSA_SUCCESS) {
8889 status = psa_jpake_epilogue(operation, PSA_JPAKE_INPUT);
8890 if (status != PSA_SUCCESS) {
8896 status = PSA_ERROR_NOT_SUPPORTED;
8902 if (status != PSA_SUCCESS) {
8905 return status;
8912 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
8918 status = PSA_ERROR_BAD_STATE;
8927 status = PSA_ERROR_BAD_STATE;
8933 status = PSA_ERROR_NOT_SUPPORTED;
8937 status = psa_driver_wrapper_pake_get_implicit_key(operation,
8942 if (status != PSA_SUCCESS) {
8946 status = psa_key_derivation_input_bytes(output,
8954 return status == PSA_SUCCESS ? abort_status : status;
8960 psa_status_t status = PSA_SUCCESS;
8963 status = psa_driver_wrapper_pake_abort(operation);
8980 return status;
9076 psa_status_t status;
9094 status = psa_crypto_copy_input(input, input_len,
9096 if (status != PSA_SUCCESS) {
9106 return status;
9138 psa_status_t status;
9149 status = psa_crypto_copy_output(local_output->buffer, local_output->length,
9151 if (status != PSA_SUCCESS) {
9152 return status;