Lines Matching refs:status

199     status = psa_crypto_local_input_alloc(input, length, \
201 if (status != PSA_SUCCESS) { \
241 status = psa_crypto_local_output_alloc(output, length, \
243 if (status != PSA_SUCCESS) { \
265 status = local_output_status; \
590 static void psa_wipe_tag_output_buffer(uint8_t *output_buffer, psa_status_t status, in psa_wipe_tag_output_buffer() argument
601 if (status == PSA_SUCCESS) { in psa_wipe_tag_output_buffer()
731 psa_status_t status = psa_allocate_buffer_to_slot(slot, in psa_copy_key_material_into_slot() local
733 if (status != PSA_SUCCESS) { in psa_copy_key_material_into_slot()
734 return status; in psa_copy_key_material_into_slot()
747 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_import_key_into_slot() local
758 status = psa_validate_unstructured_key_bit_size(attributes->type, in psa_import_key_into_slot()
760 if (status != PSA_SUCCESS) { in psa_import_key_into_slot()
761 return status; in psa_import_key_into_slot()
1103 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_get_and_lock_key_slot_with_policy() local
1106 status = psa_get_and_lock_key_slot(key, p_slot); in psa_get_and_lock_key_slot_with_policy()
1107 if (status != PSA_SUCCESS) { in psa_get_and_lock_key_slot_with_policy()
1108 return status; in psa_get_and_lock_key_slot_with_policy()
1121 status = PSA_ERROR_NOT_PERMITTED; in psa_get_and_lock_key_slot_with_policy()
1127 status = psa_key_policy_permits(&slot->attr.policy, in psa_get_and_lock_key_slot_with_policy()
1130 if (status != PSA_SUCCESS) { in psa_get_and_lock_key_slot_with_policy()
1141 return status; in psa_get_and_lock_key_slot_with_policy()
1169 psa_status_t status = psa_get_and_lock_key_slot_with_policy(key, p_slot, in psa_get_and_lock_transparent_key_slot_with_policy() local
1171 if (status != PSA_SUCCESS) { in psa_get_and_lock_transparent_key_slot_with_policy()
1172 return status; in psa_get_and_lock_transparent_key_slot_with_policy()
1207 psa_status_t status = psa_remove_key_data_from_memory(slot); in psa_wipe_key_slot() local
1228 status = PSA_ERROR_CORRUPTION_DETECTED; in psa_wipe_key_slot()
1235 status = PSA_ERROR_CORRUPTION_DETECTED; in psa_wipe_key_slot()
1241 status = PSA_ERROR_CORRUPTION_DETECTED; in psa_wipe_key_slot()
1245 status = PSA_ERROR_CORRUPTION_DETECTED; in psa_wipe_key_slot()
1269 if (status == PSA_SUCCESS) { in psa_wipe_key_slot()
1270 status = psa_free_key_slot(slice_index, slot); in psa_wipe_key_slot()
1274 return status; in psa_wipe_key_slot()
1280 psa_status_t status; /* status of the last operation */ in psa_destroy_key() local
1297 status = psa_get_and_lock_key_slot(key, &slot); in psa_destroy_key()
1298 if (status != PSA_SUCCESS) { in psa_destroy_key()
1299 return status; in psa_destroy_key()
1314 status = psa_unregister_read(slot); in psa_destroy_key()
1318 return (status == PSA_SUCCESS) ? PSA_ERROR_INVALID_HANDLE : status; in psa_destroy_key()
1358 status = psa_crypto_save_transaction(); in psa_destroy_key()
1359 if (status != PSA_SUCCESS) { in psa_destroy_key()
1368 overall_status = status; in psa_destroy_key()
1372 status = psa_destroy_se_key(driver, in psa_destroy_key()
1375 overall_status = status; in psa_destroy_key()
1385 status = psa_destroy_persistent_key(slot->attr.id); in psa_destroy_key()
1387 overall_status = status; in psa_destroy_key()
1394 status = psa_save_se_persistent_data(driver); in psa_destroy_key()
1396 overall_status = status; in psa_destroy_key()
1398 status = psa_crypto_stop_transaction(); in psa_destroy_key()
1400 overall_status = status; in psa_destroy_key()
1408 status = psa_unregister_read(slot); in psa_destroy_key()
1411 if (status != PSA_SUCCESS) { in psa_destroy_key()
1412 overall_status = status; in psa_destroy_key()
1417 status = overall_status; in psa_destroy_key()
1430 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_get_key_attributes() local
1435 status = psa_get_and_lock_key_slot_with_policy(key, &slot, 0, 0); in psa_get_key_attributes()
1436 if (status != PSA_SUCCESS) { in psa_get_key_attributes()
1437 return status; in psa_get_key_attributes()
1509 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_export_key() local
1531 status = psa_get_and_lock_key_slot_with_policy(key, &slot, in psa_export_key()
1533 if (status != PSA_SUCCESS) { in psa_export_key()
1534 return status; in psa_export_key()
1539 status = psa_driver_wrapper_export_key(&slot->attr, in psa_export_key()
1549 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_export_key()
1624 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_export_public_key() local
1644 status = psa_get_and_lock_key_slot_with_policy(key, &slot, 0, 0); in psa_export_public_key()
1645 if (status != PSA_SUCCESS) { in psa_export_public_key()
1646 return status; in psa_export_public_key()
1652 status = PSA_ERROR_INVALID_ARGUMENT; in psa_export_public_key()
1656 status = psa_driver_wrapper_export_public_key( in psa_export_public_key()
1664 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_export_public_key()
1708 psa_status_t status = PSA_ERROR_INVALID_ARGUMENT; in psa_validate_key_attributes() local
1712 status = psa_validate_key_location(lifetime, p_drv); in psa_validate_key_attributes()
1713 if (status != PSA_SUCCESS) { in psa_validate_key_attributes()
1714 return status; in psa_validate_key_attributes()
1717 status = psa_validate_key_persistence(lifetime); in psa_validate_key_attributes()
1718 if (status != PSA_SUCCESS) { in psa_validate_key_attributes()
1719 return status; in psa_validate_key_attributes()
1732 status = psa_validate_key_policy(&attributes->policy); in psa_validate_key_attributes()
1733 if (status != PSA_SUCCESS) { in psa_validate_key_attributes()
1734 return status; in psa_validate_key_attributes()
1784 psa_status_t status; in psa_start_key_creation() local
1789 status = psa_validate_key_attributes(attributes, p_drv); in psa_start_key_creation()
1790 if (status != PSA_SUCCESS) { in psa_start_key_creation()
1791 return status; in psa_start_key_creation()
1801 status = psa_reserve_free_key_slot( in psa_start_key_creation()
1808 if (status != PSA_SUCCESS) { in psa_start_key_creation()
1809 return status; in psa_start_key_creation()
1850 status = psa_find_se_slot_for_key(attributes, method, *p_drv, in psa_start_key_creation()
1852 if (status != PSA_SUCCESS) { in psa_start_key_creation()
1853 return status; in psa_start_key_creation()
1861 status = psa_crypto_save_transaction(); in psa_start_key_creation()
1862 if (status != PSA_SUCCESS) { in psa_start_key_creation()
1864 return status; in psa_start_key_creation()
1868 status = psa_copy_key_material_into_slot( in psa_start_key_creation()
1870 if (status != PSA_SUCCESS) { in psa_start_key_creation()
1871 return status; in psa_start_key_creation()
1919 psa_status_t status = PSA_SUCCESS; in psa_finish_key_creation() local
1941 status = psa_save_persistent_key(&slot->attr, in psa_finish_key_creation()
1949 status = psa_save_persistent_key(&slot->attr, in psa_finish_key_creation()
1964 status = psa_save_se_persistent_data(driver); in psa_finish_key_creation()
1965 if (status != PSA_SUCCESS) { in psa_finish_key_creation()
1972 return status; in psa_finish_key_creation()
1974 status = psa_crypto_stop_transaction(); in psa_finish_key_creation()
1978 if (status == PSA_SUCCESS) { in psa_finish_key_creation()
1980 status = psa_key_slot_state_transition(slot, PSA_SLOT_FILLING, in psa_finish_key_creation()
1982 if (status != PSA_SUCCESS) { in psa_finish_key_creation()
1991 return status; in psa_finish_key_creation()
2079 psa_status_t status; in psa_import_key() local
2102 status = psa_start_key_creation(PSA_KEY_CREATION_IMPORT, attributes, in psa_import_key()
2104 if (status != PSA_SUCCESS) { in psa_import_key()
2114 status = psa_driver_wrapper_get_key_buffer_size_from_key_data( in psa_import_key()
2116 if (status != PSA_SUCCESS) { in psa_import_key()
2120 status = psa_allocate_buffer_to_slot(slot, storage_size); in psa_import_key()
2121 if (status != PSA_SUCCESS) { in psa_import_key()
2127 status = psa_driver_wrapper_import_key(attributes, in psa_import_key()
2132 if (status != PSA_SUCCESS) { in psa_import_key()
2139 status = PSA_ERROR_INVALID_ARGUMENT; in psa_import_key()
2146 status = PSA_ERROR_NOT_SUPPORTED; in psa_import_key()
2149 status = psa_validate_optional_attributes(slot, attributes); in psa_import_key()
2150 if (status != PSA_SUCCESS) { in psa_import_key()
2154 status = psa_finish_key_creation(slot, driver, key); in psa_import_key()
2157 if (status != PSA_SUCCESS) { in psa_import_key()
2161 return status; in psa_import_key()
2168 psa_status_t status; in mbedtls_psa_register_se_key() local
2192 status = psa_start_key_creation(PSA_KEY_CREATION_REGISTER, attributes, in mbedtls_psa_register_se_key()
2194 if (status != PSA_SUCCESS) { in mbedtls_psa_register_se_key()
2198 status = psa_finish_key_creation(slot, driver, &key); in mbedtls_psa_register_se_key()
2201 if (status != PSA_SUCCESS) { in mbedtls_psa_register_se_key()
2207 return status; in mbedtls_psa_register_se_key()
2215 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_copy_key() local
2225 status = psa_get_and_lock_key_slot_with_policy( in psa_copy_key()
2227 if (status != PSA_SUCCESS) { in psa_copy_key()
2231 status = psa_validate_optional_attributes(source_slot, in psa_copy_key()
2233 if (status != PSA_SUCCESS) { in psa_copy_key()
2246 status = psa_restrict_key_policy(source_slot->attr.type, in psa_copy_key()
2249 if (status != PSA_SUCCESS) { in psa_copy_key()
2253 status = psa_start_key_creation(PSA_KEY_CREATION_COPY, &actual_attributes, in psa_copy_key()
2255 if (status != PSA_SUCCESS) { in psa_copy_key()
2267 status = PSA_ERROR_NOT_SUPPORTED; in psa_copy_key()
2277 status = psa_driver_wrapper_get_key_buffer_size(&actual_attributes, in psa_copy_key()
2279 if (status != PSA_SUCCESS) { in psa_copy_key()
2283 status = psa_allocate_buffer_to_slot(target_slot, storage_size); in psa_copy_key()
2284 if (status != PSA_SUCCESS) { in psa_copy_key()
2288 status = psa_driver_wrapper_copy_key(&actual_attributes, in psa_copy_key()
2294 if (status != PSA_SUCCESS) { in psa_copy_key()
2298 status = psa_copy_key_material_into_slot(target_slot, in psa_copy_key()
2301 if (status != PSA_SUCCESS) { in psa_copy_key()
2305 status = psa_finish_key_creation(target_slot, driver, target_key); in psa_copy_key()
2307 if (status != PSA_SUCCESS) { in psa_copy_key()
2313 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_copy_key()
2381 psa_status_t status = psa_driver_wrapper_hash_abort(operation); in psa_hash_abort() local
2384 return status; in psa_hash_abort()
2390 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_hash_setup() local
2394 status = PSA_ERROR_BAD_STATE; in psa_hash_setup()
2399 status = PSA_ERROR_INVALID_ARGUMENT; in psa_hash_setup()
2410 status = psa_driver_wrapper_hash_setup(operation, alg); in psa_hash_setup()
2413 if (status != PSA_SUCCESS) { in psa_hash_setup()
2417 return status; in psa_hash_setup()
2424 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_hash_update() local
2428 status = PSA_ERROR_BAD_STATE; in psa_hash_update()
2439 status = psa_driver_wrapper_hash_update(operation, input, input_length); in psa_hash_update()
2442 if (status != PSA_SUCCESS) { in psa_hash_update()
2447 return status; in psa_hash_update()
2455 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_hash_finish_internal() local
2462 status = psa_driver_wrapper_hash_finish( in psa_hash_finish_internal()
2466 return status; in psa_hash_finish_internal()
2474 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_hash_finish() local
2478 status = psa_hash_finish_internal(operation, hash, hash_size, hash_length); in psa_hash_finish()
2484 return status; in psa_hash_finish()
2493 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_hash_verify() local
2496 status = psa_hash_finish_internal( in psa_hash_verify()
2501 if (status != PSA_SUCCESS) { in psa_hash_verify()
2506 status = PSA_ERROR_INVALID_SIGNATURE; in psa_hash_verify()
2512 status = PSA_ERROR_INVALID_SIGNATURE; in psa_hash_verify()
2517 if (status != PSA_SUCCESS) { in psa_hash_verify()
2521 return status; in psa_hash_verify()
2529 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_hash_compute() local
2540 status = psa_driver_wrapper_hash_compute(alg, input, input_length, in psa_hash_compute()
2548 return status; in psa_hash_compute()
2557 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_hash_compare() local
2563 status = PSA_ERROR_INVALID_ARGUMENT; in psa_hash_compare()
2564 return status; in psa_hash_compare()
2568 status = psa_driver_wrapper_hash_compute( in psa_hash_compare()
2572 if (status != PSA_SUCCESS) { in psa_hash_compare()
2576 status = PSA_ERROR_INVALID_SIGNATURE; in psa_hash_compare()
2582 status = PSA_ERROR_INVALID_SIGNATURE; in psa_hash_compare()
2591 return status; in psa_hash_compare()
2609 psa_status_t status = psa_driver_wrapper_hash_clone(source_operation, in psa_hash_clone() local
2611 if (status != PSA_SUCCESS) { in psa_hash_clone()
2615 return status; in psa_hash_clone()
2630 psa_status_t status = psa_driver_wrapper_mac_abort(operation); in psa_mac_abort() local
2635 return status; in psa_mac_abort()
2643 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_mac_finalize_alg_and_key_validation() local
2652 status = psa_mac_key_can_do(alg, key_type); in psa_mac_finalize_alg_and_key_validation()
2653 if (status != PSA_SUCCESS) { in psa_mac_finalize_alg_and_key_validation()
2654 return status; in psa_mac_finalize_alg_and_key_validation()
2696 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_mac_setup() local
2702 status = PSA_ERROR_BAD_STATE; in psa_mac_setup()
2713 status = psa_get_and_lock_key_slot_with_policy( in psa_mac_setup()
2718 if (status != PSA_SUCCESS) { in psa_mac_setup()
2722 status = psa_mac_finalize_alg_and_key_validation(alg, &slot->attr, in psa_mac_setup()
2724 if (status != PSA_SUCCESS) { in psa_mac_setup()
2731 status = psa_driver_wrapper_mac_sign_setup(operation, in psa_mac_setup()
2737 status = psa_driver_wrapper_mac_verify_setup(operation, in psa_mac_setup()
2745 if (status != PSA_SUCCESS) { in psa_mac_setup()
2751 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_mac_setup()
2772 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_mac_update() local
2776 status = PSA_ERROR_BAD_STATE; in psa_mac_update()
2777 return status; in psa_mac_update()
2783 status = PSA_SUCCESS; in psa_mac_update()
2784 return status; in psa_mac_update()
2788 status = psa_driver_wrapper_mac_update(operation, input, input_length); in psa_mac_update()
2790 if (status != PSA_SUCCESS) { in psa_mac_update()
2799 return status; in psa_mac_update()
2807 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_mac_sign_finish() local
2813 status = PSA_ERROR_BAD_STATE; in psa_mac_sign_finish()
2818 status = PSA_ERROR_BAD_STATE; in psa_mac_sign_finish()
2825 status = PSA_ERROR_BAD_STATE; in psa_mac_sign_finish()
2830 status = PSA_ERROR_BUFFER_TOO_SMALL; in psa_mac_sign_finish()
2835 status = psa_driver_wrapper_mac_sign_finish(operation, in psa_mac_sign_finish()
2846 if (status != PSA_SUCCESS) { in psa_mac_sign_finish()
2852 psa_wipe_tag_output_buffer(mac, status, mac_size, *mac_length); in psa_mac_sign_finish()
2858 return status == PSA_SUCCESS ? abort_status : status; in psa_mac_sign_finish()
2865 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_mac_verify_finish() local
2870 status = PSA_ERROR_BAD_STATE; in psa_mac_verify_finish()
2875 status = PSA_ERROR_BAD_STATE; in psa_mac_verify_finish()
2880 status = PSA_ERROR_INVALID_SIGNATURE; in psa_mac_verify_finish()
2885 status = psa_driver_wrapper_mac_verify_finish(operation, in psa_mac_verify_finish()
2892 return status == PSA_SUCCESS ? abort_status : status; in psa_mac_verify_finish()
2904 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_mac_compute_internal() local
2909 status = psa_get_and_lock_key_slot_with_policy( in psa_mac_compute_internal()
2914 if (status != PSA_SUCCESS) { in psa_mac_compute_internal()
2918 status = psa_mac_finalize_alg_and_key_validation(alg, &slot->attr, in psa_mac_compute_internal()
2920 if (status != PSA_SUCCESS) { in psa_mac_compute_internal()
2925 status = PSA_ERROR_BUFFER_TOO_SMALL; in psa_mac_compute_internal()
2929 status = psa_driver_wrapper_mac_compute( in psa_mac_compute_internal()
2943 if (status != PSA_SUCCESS) { in psa_mac_compute_internal()
2948 psa_wipe_tag_output_buffer(mac, status, mac_size, *mac_length); in psa_mac_compute_internal()
2952 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_mac_compute_internal()
2963 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_mac_compute() local
2969 status = psa_mac_compute_internal(key, alg, in psa_mac_compute()
2979 return status; in psa_mac_compute()
2989 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_mac_verify() local
2996 status = psa_mac_compute_internal(key, alg, in psa_mac_verify()
3000 if (status != PSA_SUCCESS) { in psa_mac_verify()
3005 status = PSA_ERROR_INVALID_SIGNATURE; in psa_mac_verify()
3011 status = PSA_ERROR_INVALID_SIGNATURE; in psa_mac_verify()
3020 return status; in psa_mac_verify()
3086 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_sign_internal() local
3092 status = psa_sign_verify_check_alg(input_is_message, alg); in psa_sign_internal()
3093 if (status != PSA_SUCCESS) { in psa_sign_internal()
3094 return status; in psa_sign_internal()
3105 status = psa_get_and_lock_key_slot_with_policy( in psa_sign_internal()
3111 if (status != PSA_SUCCESS) { in psa_sign_internal()
3116 status = PSA_ERROR_INVALID_ARGUMENT; in psa_sign_internal()
3121 status = psa_driver_wrapper_sign_message( in psa_sign_internal()
3127 status = psa_driver_wrapper_sign_hash( in psa_sign_internal()
3135 psa_wipe_tag_output_buffer(signature, status, signature_size, in psa_sign_internal()
3140 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_sign_internal()
3151 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_verify_internal() local
3155 status = psa_sign_verify_check_alg(input_is_message, alg); in psa_verify_internal()
3156 if (status != PSA_SUCCESS) { in psa_verify_internal()
3157 return status; in psa_verify_internal()
3160 status = psa_get_and_lock_key_slot_with_policy( in psa_verify_internal()
3166 if (status != PSA_SUCCESS) { in psa_verify_internal()
3167 return status; in psa_verify_internal()
3171 status = psa_driver_wrapper_verify_message( in psa_verify_internal()
3176 status = psa_driver_wrapper_verify_hash( in psa_verify_internal()
3184 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_verify_internal()
3199 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_sign_message_builtin() local
3205 status = psa_driver_wrapper_hash_compute( in psa_sign_message_builtin()
3210 if (status != PSA_SUCCESS) { in psa_sign_message_builtin()
3211 return status; in psa_sign_message_builtin()
3231 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_sign_message() local
3237 status = psa_sign_internal(key, 1, alg, input, input_length, signature, in psa_sign_message()
3245 return status; in psa_sign_message()
3258 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_verify_message_builtin() local
3264 status = psa_driver_wrapper_hash_compute( in psa_verify_message_builtin()
3269 if (status != PSA_SUCCESS) { in psa_verify_message_builtin()
3270 return status; in psa_verify_message_builtin()
3289 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_verify_message() local
3295 status = psa_verify_internal(key, 1, alg, input, input_length, signature, in psa_verify_message()
3304 return status; in psa_verify_message()
3363 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_sign_hash() local
3369 status = psa_sign_internal(key, 0, alg, hash, hash_length, signature, in psa_sign_hash()
3378 return status; in psa_sign_hash()
3435 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_verify_hash() local
3441 status = psa_verify_internal(key, 0, alg, hash, hash_length, signature, in psa_verify_hash()
3450 return status; in psa_verify_hash()
3463 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_asymmetric_encrypt() local
3483 status = psa_get_and_lock_key_slot_with_policy( in psa_asymmetric_encrypt()
3485 if (status != PSA_SUCCESS) { in psa_asymmetric_encrypt()
3486 return status; in psa_asymmetric_encrypt()
3490 status = PSA_ERROR_INVALID_ARGUMENT; in psa_asymmetric_encrypt()
3498 status = psa_driver_wrapper_asymmetric_encrypt( in psa_asymmetric_encrypt()
3509 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_asymmetric_encrypt()
3522 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_asymmetric_decrypt() local
3542 status = psa_get_and_lock_key_slot_with_policy( in psa_asymmetric_decrypt()
3544 if (status != PSA_SUCCESS) { in psa_asymmetric_decrypt()
3545 return status; in psa_asymmetric_decrypt()
3548 status = PSA_ERROR_INVALID_ARGUMENT; in psa_asymmetric_decrypt()
3556 status = psa_driver_wrapper_asymmetric_decrypt( in psa_asymmetric_decrypt()
3568 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_asymmetric_decrypt()
3609 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_sign_hash_abort_internal() local
3611 status = psa_driver_wrapper_sign_hash_abort(operation); in psa_sign_hash_abort_internal()
3619 return status; in psa_sign_hash_abort_internal()
3627 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_sign_hash_start() local
3646 status = psa_sign_verify_check_alg(0, alg); in psa_sign_hash_start()
3647 if (status != PSA_SUCCESS) { in psa_sign_hash_start()
3649 return status; in psa_sign_hash_start()
3652 status = psa_get_and_lock_key_slot_with_policy(key, &slot, in psa_sign_hash_start()
3656 if (status != PSA_SUCCESS) { in psa_sign_hash_start()
3661 status = PSA_ERROR_INVALID_ARGUMENT; in psa_sign_hash_start()
3670 status = psa_driver_wrapper_sign_hash_start(operation, &slot->attr, in psa_sign_hash_start()
3676 if (status != PSA_SUCCESS) { in psa_sign_hash_start()
3689 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_sign_hash_start()
3698 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_sign_hash_complete() local
3707 status = PSA_ERROR_BAD_STATE; in psa_sign_hash_complete()
3714 status = PSA_ERROR_BUFFER_TOO_SMALL; in psa_sign_hash_complete()
3720 status = psa_driver_wrapper_sign_hash_complete(operation, signature, in psa_sign_hash_complete()
3730 psa_wipe_tag_output_buffer(signature, status, signature_size, in psa_sign_hash_complete()
3734 if (status != PSA_OPERATION_INCOMPLETE) { in psa_sign_hash_complete()
3735 if (status != PSA_SUCCESS) { in psa_sign_hash_complete()
3744 return status; in psa_sign_hash_complete()
3750 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_sign_hash_abort() local
3752 status = psa_sign_hash_abort_internal(operation); in psa_sign_hash_abort()
3761 return status; in psa_sign_hash_abort()
3774 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_verify_hash_abort_internal() local
3776 status = psa_driver_wrapper_verify_hash_abort(operation); in psa_verify_hash_abort_internal()
3784 return status; in psa_verify_hash_abort_internal()
3793 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_verify_hash_start() local
3813 status = psa_sign_verify_check_alg(0, alg); in psa_verify_hash_start()
3814 if (status != PSA_SUCCESS) { in psa_verify_hash_start()
3816 return status; in psa_verify_hash_start()
3819 status = psa_get_and_lock_key_slot_with_policy(key, &slot, in psa_verify_hash_start()
3823 if (status != PSA_SUCCESS) { in psa_verify_hash_start()
3825 return status; in psa_verify_hash_start()
3834 status = psa_driver_wrapper_verify_hash_start(operation, &slot->attr, in psa_verify_hash_start()
3843 if (status != PSA_SUCCESS) { in psa_verify_hash_start()
3857 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_verify_hash_start()
3863 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_verify_hash_complete() local
3868 status = PSA_ERROR_BAD_STATE; in psa_verify_hash_complete()
3872 status = psa_driver_wrapper_verify_hash_complete(operation); in psa_verify_hash_complete()
3880 if (status != PSA_OPERATION_INCOMPLETE) { in psa_verify_hash_complete()
3881 if (status != PSA_SUCCESS) { in psa_verify_hash_complete()
3888 return status; in psa_verify_hash_complete()
3894 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_verify_hash_abort() local
3896 status = psa_verify_hash_abort_internal(operation); in psa_verify_hash_abort()
3905 return status; in psa_verify_hash_abort()
4000 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in mbedtls_psa_sign_hash_start() local
4024 status = mbedtls_psa_ecp_load_representation(attributes->type, in mbedtls_psa_sign_hash_start()
4030 if (status != PSA_SUCCESS) { in mbedtls_psa_sign_hash_start()
4031 return status; in mbedtls_psa_sign_hash_start()
4063 (void) status; in mbedtls_psa_sign_hash_start()
4081 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in mbedtls_psa_sign_hash_complete() local
4092 status = PSA_ERROR_BUFFER_TOO_SMALL; in mbedtls_psa_sign_hash_complete()
4099 status = mbedtls_to_psa_error( in mbedtls_psa_sign_hash_complete()
4111 status = PSA_ERROR_NOT_SUPPORTED; in mbedtls_psa_sign_hash_complete()
4115 status = mbedtls_to_psa_error( in mbedtls_psa_sign_hash_complete()
4133 if (status == PSA_SUCCESS) { in mbedtls_psa_sign_hash_complete()
4134 status = mbedtls_to_psa_error( in mbedtls_psa_sign_hash_complete()
4140 if (status != PSA_SUCCESS) { in mbedtls_psa_sign_hash_complete()
4144 status = mbedtls_to_psa_error( in mbedtls_psa_sign_hash_complete()
4151 if (status != PSA_SUCCESS) { in mbedtls_psa_sign_hash_complete()
4157 status = PSA_SUCCESS; in mbedtls_psa_sign_hash_complete()
4164 return status; in mbedtls_psa_sign_hash_complete()
4219 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in mbedtls_psa_verify_hash_start() local
4246 status = mbedtls_psa_ecp_load_representation(attributes->type, in mbedtls_psa_verify_hash_start()
4252 if (status != PSA_SUCCESS) { in mbedtls_psa_verify_hash_start()
4253 return status; in mbedtls_psa_verify_hash_start()
4262 status = mbedtls_to_psa_error( in mbedtls_psa_verify_hash_start()
4267 if (status != PSA_SUCCESS) { in mbedtls_psa_verify_hash_start()
4268 return status; in mbedtls_psa_verify_hash_start()
4271 status = mbedtls_to_psa_error( in mbedtls_psa_verify_hash_start()
4277 if (status != PSA_SUCCESS) { in mbedtls_psa_verify_hash_start()
4278 return status; in mbedtls_psa_verify_hash_start()
4281 status = mbedtls_psa_ecp_load_public_part(operation->ctx); in mbedtls_psa_verify_hash_start()
4283 if (status != PSA_SUCCESS) { in mbedtls_psa_verify_hash_start()
4284 return status; in mbedtls_psa_verify_hash_start()
4310 (void) status; in mbedtls_psa_verify_hash_start()
4328 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in mbedtls_psa_verify_hash_complete() local
4333 status = mbedtls_to_psa_error( in mbedtls_psa_verify_hash_complete()
4346 return status; in mbedtls_psa_verify_hash_complete()
4397 psa_status_t status; in psa_generate_random_internal() local
4399 status = mbedtls_psa_external_get_random(&global_data.rng, in psa_generate_random_internal()
4402 if (status != PSA_SUCCESS) { in psa_generate_random_internal()
4403 return status; in psa_generate_random_internal()
4445 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_cipher_setup() local
4454 status = PSA_ERROR_BAD_STATE; in psa_cipher_setup()
4459 status = PSA_ERROR_INVALID_ARGUMENT; in psa_cipher_setup()
4463 status = psa_get_and_lock_key_slot_with_policy(key, &slot, usage, alg); in psa_cipher_setup()
4464 if (status != PSA_SUCCESS) { in psa_cipher_setup()
4490 status = psa_driver_wrapper_cipher_encrypt_setup(operation, in psa_cipher_setup()
4496 status = psa_driver_wrapper_cipher_decrypt_setup(operation, in psa_cipher_setup()
4504 if (status != PSA_SUCCESS) { in psa_cipher_setup()
4510 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_cipher_setup()
4532 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_cipher_generate_iv() local
4538 status = PSA_ERROR_BAD_STATE; in psa_cipher_generate_iv()
4543 status = PSA_ERROR_BAD_STATE; in psa_cipher_generate_iv()
4549 status = PSA_ERROR_BUFFER_TOO_SMALL; in psa_cipher_generate_iv()
4554 status = PSA_ERROR_GENERIC_ERROR; in psa_cipher_generate_iv()
4560 status = psa_generate_random_internal(iv, default_iv_length); in psa_cipher_generate_iv()
4561 if (status != PSA_SUCCESS) { in psa_cipher_generate_iv()
4565 status = psa_driver_wrapper_cipher_set_iv(operation, in psa_cipher_generate_iv()
4569 if (status == PSA_SUCCESS) { in psa_cipher_generate_iv()
4581 return status; in psa_cipher_generate_iv()
4588 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_cipher_set_iv() local
4593 status = PSA_ERROR_BAD_STATE; in psa_cipher_set_iv()
4598 status = PSA_ERROR_BAD_STATE; in psa_cipher_set_iv()
4603 status = PSA_ERROR_INVALID_ARGUMENT; in psa_cipher_set_iv()
4609 status = psa_driver_wrapper_cipher_set_iv(operation, in psa_cipher_set_iv()
4614 if (status == PSA_SUCCESS) { in psa_cipher_set_iv()
4622 return status; in psa_cipher_set_iv()
4632 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_cipher_update() local
4638 status = PSA_ERROR_BAD_STATE; in psa_cipher_update()
4643 status = PSA_ERROR_BAD_STATE; in psa_cipher_update()
4650 status = psa_driver_wrapper_cipher_update(operation, in psa_cipher_update()
4658 if (status != PSA_SUCCESS) { in psa_cipher_update()
4665 return status; in psa_cipher_update()
4673 psa_status_t status = PSA_ERROR_GENERIC_ERROR; in psa_cipher_finish() local
4678 status = PSA_ERROR_BAD_STATE; in psa_cipher_finish()
4683 status = PSA_ERROR_BAD_STATE; in psa_cipher_finish()
4689 status = psa_driver_wrapper_cipher_finish(operation, in psa_cipher_finish()
4695 if (status == PSA_SUCCESS) { in psa_cipher_finish()
4696 status = psa_cipher_abort(operation); in psa_cipher_finish()
4704 return status; in psa_cipher_finish()
4733 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_cipher_encrypt() local
4743 status = PSA_ERROR_INVALID_ARGUMENT; in psa_cipher_encrypt()
4747 status = psa_get_and_lock_key_slot_with_policy(key, &slot, in psa_cipher_encrypt()
4750 if (status != PSA_SUCCESS) { in psa_cipher_encrypt()
4756 status = PSA_ERROR_GENERIC_ERROR; in psa_cipher_encrypt()
4762 status = PSA_ERROR_BUFFER_TOO_SMALL; in psa_cipher_encrypt()
4766 status = psa_generate_random_internal(local_iv, default_iv_length); in psa_cipher_encrypt()
4767 if (status != PSA_SUCCESS) { in psa_cipher_encrypt()
4775 status = psa_driver_wrapper_cipher_encrypt( in psa_cipher_encrypt()
4783 if (status == PSA_SUCCESS) { in psa_cipher_encrypt()
4784 status = unlock_status; in psa_cipher_encrypt()
4787 if (status == PSA_SUCCESS) { in psa_cipher_encrypt()
4799 return status; in psa_cipher_encrypt()
4810 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_cipher_decrypt() local
4818 status = PSA_ERROR_INVALID_ARGUMENT; in psa_cipher_decrypt()
4822 status = psa_get_and_lock_key_slot_with_policy(key, &slot, in psa_cipher_decrypt()
4825 if (status != PSA_SUCCESS) { in psa_cipher_decrypt()
4830 status = PSA_ERROR_INVALID_ARGUMENT; in psa_cipher_decrypt()
4837 status = psa_driver_wrapper_cipher_decrypt( in psa_cipher_decrypt()
4844 if (status == PSA_SUCCESS) { in psa_cipher_decrypt()
4845 status = unlock_status; in psa_cipher_decrypt()
4848 if (status != PSA_SUCCESS) { in psa_cipher_decrypt()
4855 return status; in psa_cipher_decrypt()
4934 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_encrypt() local
4944 status = psa_aead_check_algorithm(alg); in psa_aead_encrypt()
4945 if (status != PSA_SUCCESS) { in psa_aead_encrypt()
4946 return status; in psa_aead_encrypt()
4949 status = psa_get_and_lock_key_slot_with_policy( in psa_aead_encrypt()
4951 if (status != PSA_SUCCESS) { in psa_aead_encrypt()
4952 return status; in psa_aead_encrypt()
4960 status = psa_aead_check_nonce_length(alg, nonce_length); in psa_aead_encrypt()
4961 if (status != PSA_SUCCESS) { in psa_aead_encrypt()
4965 status = psa_driver_wrapper_aead_encrypt( in psa_aead_encrypt()
4973 if (status != PSA_SUCCESS && ciphertext_size != 0) { in psa_aead_encrypt()
4985 return status; in psa_aead_encrypt()
5000 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_decrypt() local
5010 status = psa_aead_check_algorithm(alg); in psa_aead_decrypt()
5011 if (status != PSA_SUCCESS) { in psa_aead_decrypt()
5012 return status; in psa_aead_decrypt()
5015 status = psa_get_and_lock_key_slot_with_policy( in psa_aead_decrypt()
5017 if (status != PSA_SUCCESS) { in psa_aead_decrypt()
5018 return status; in psa_aead_decrypt()
5027 status = psa_aead_check_nonce_length(alg, nonce_length); in psa_aead_decrypt()
5028 if (status != PSA_SUCCESS) { in psa_aead_decrypt()
5032 status = psa_driver_wrapper_aead_decrypt( in psa_aead_decrypt()
5040 if (status != PSA_SUCCESS && plaintext_size != 0) { in psa_aead_decrypt()
5052 return status; in psa_aead_decrypt()
5100 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_setup() local
5105 status = psa_aead_check_algorithm(alg); in psa_aead_setup()
5106 if (status != PSA_SUCCESS) { in psa_aead_setup()
5111 status = PSA_ERROR_BAD_STATE; in psa_aead_setup()
5117 status = PSA_ERROR_BAD_STATE; in psa_aead_setup()
5134 status = psa_get_and_lock_key_slot_with_policy(key, &slot, key_usage, in psa_aead_setup()
5136 if (status != PSA_SUCCESS) { in psa_aead_setup()
5140 if ((status = psa_validate_tag_length(alg)) != PSA_SUCCESS) { in psa_aead_setup()
5145 status = psa_driver_wrapper_aead_encrypt_setup(operation, in psa_aead_setup()
5151 status = psa_driver_wrapper_aead_decrypt_setup(operation, in psa_aead_setup()
5157 if (status != PSA_SUCCESS) { in psa_aead_setup()
5166 if (status == PSA_SUCCESS) { in psa_aead_setup()
5167 status = unlock_status; in psa_aead_setup()
5174 return status; in psa_aead_setup()
5197 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_set_nonce_internal() local
5200 status = PSA_ERROR_BAD_STATE; in psa_aead_set_nonce_internal()
5205 status = PSA_ERROR_BAD_STATE; in psa_aead_set_nonce_internal()
5209 status = psa_aead_check_nonce_length(operation->alg, nonce_length); in psa_aead_set_nonce_internal()
5210 if (status != PSA_SUCCESS) { in psa_aead_set_nonce_internal()
5211 status = PSA_ERROR_INVALID_ARGUMENT; in psa_aead_set_nonce_internal()
5215 status = psa_driver_wrapper_aead_set_nonce(operation, nonce, in psa_aead_set_nonce_internal()
5219 if (status == PSA_SUCCESS) { in psa_aead_set_nonce_internal()
5225 return status; in psa_aead_set_nonce_internal()
5234 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_generate_nonce() local
5244 status = PSA_ERROR_BAD_STATE; in psa_aead_generate_nonce()
5249 status = PSA_ERROR_BAD_STATE; in psa_aead_generate_nonce()
5265 status = PSA_ERROR_BUFFER_TOO_SMALL; in psa_aead_generate_nonce()
5269 status = psa_generate_random_internal(local_nonce, required_nonce_size); in psa_aead_generate_nonce()
5270 if (status != PSA_SUCCESS) { in psa_aead_generate_nonce()
5274 status = psa_aead_set_nonce_internal(operation, local_nonce, in psa_aead_generate_nonce()
5278 if (status == PSA_SUCCESS) { in psa_aead_generate_nonce()
5287 return status; in psa_aead_generate_nonce()
5296 psa_status_t status; in psa_aead_set_nonce() local
5301 status = psa_aead_set_nonce_internal(operation, nonce, nonce_length); in psa_aead_set_nonce()
5310 return status; in psa_aead_set_nonce()
5318 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_set_lengths() local
5321 status = PSA_ERROR_BAD_STATE; in psa_aead_set_lengths()
5327 status = PSA_ERROR_BAD_STATE; in psa_aead_set_lengths()
5340 status = PSA_ERROR_INVALID_ARGUMENT; in psa_aead_set_lengths()
5349 status = PSA_ERROR_INVALID_ARGUMENT; in psa_aead_set_lengths()
5363 status = psa_driver_wrapper_aead_set_lengths(operation, ad_length, in psa_aead_set_lengths()
5367 if (status == PSA_SUCCESS) { in psa_aead_set_lengths()
5375 return status; in psa_aead_set_lengths()
5383 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_update_ad() local
5389 status = PSA_ERROR_BAD_STATE; in psa_aead_update_ad()
5394 status = PSA_ERROR_BAD_STATE; in psa_aead_update_ad()
5400 status = PSA_SUCCESS; in psa_aead_update_ad()
5406 status = PSA_ERROR_INVALID_ARGUMENT; in psa_aead_update_ad()
5414 status = PSA_ERROR_BAD_STATE; in psa_aead_update_ad()
5419 status = psa_driver_wrapper_aead_update_ad(operation, input, in psa_aead_update_ad()
5423 if (status == PSA_SUCCESS) { in psa_aead_update_ad()
5431 return status; in psa_aead_update_ad()
5443 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_update() local
5455 status = PSA_ERROR_BAD_STATE; in psa_aead_update()
5460 status = PSA_ERROR_BAD_STATE; in psa_aead_update()
5468 status = PSA_ERROR_INVALID_ARGUMENT; in psa_aead_update()
5474 status = PSA_ERROR_INVALID_ARGUMENT; in psa_aead_update()
5482 status = PSA_ERROR_BAD_STATE; in psa_aead_update()
5487 status = psa_driver_wrapper_aead_update(operation, input, input_length, in psa_aead_update()
5492 if (status == PSA_SUCCESS) { in psa_aead_update()
5501 return status; in psa_aead_update()
5527 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_finish() local
5538 status = psa_aead_final_checks(operation); in psa_aead_finish()
5539 if (status != PSA_SUCCESS) { in psa_aead_finish()
5544 status = PSA_ERROR_BAD_STATE; in psa_aead_finish()
5548 status = psa_driver_wrapper_aead_finish(operation, ciphertext, in psa_aead_finish()
5561 psa_wipe_tag_output_buffer(tag, status, tag_size, *tag_length); in psa_aead_finish()
5568 return status; in psa_aead_finish()
5580 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_verify() local
5590 status = psa_aead_final_checks(operation); in psa_aead_verify()
5591 if (status != PSA_SUCCESS) { in psa_aead_verify()
5596 status = PSA_ERROR_BAD_STATE; in psa_aead_verify()
5600 status = psa_driver_wrapper_aead_verify(operation, plaintext, in psa_aead_verify()
5611 return status; in psa_aead_verify()
5617 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_aead_abort() local
5626 status = psa_driver_wrapper_aead_abort(operation); in psa_aead_abort()
5630 return status; in psa_aead_abort()
5665 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_key_derivation_start_hmac() local
5682 status = psa_driver_wrapper_mac_sign_setup(operation, in psa_key_derivation_start_hmac()
5688 return status; in psa_key_derivation_start_hmac()
5709 psa_status_t status = PSA_SUCCESS; in psa_key_derivation_abort() local
5719 status = psa_mac_abort(&operation->ctx.hkdf.hmac); in psa_key_derivation_abort()
5747 status = PSA_SUCCESS; in psa_key_derivation_abort()
5767 status = PSA_SUCCESS; in psa_key_derivation_abort()
5771 status = PSA_ERROR_BAD_STATE; in psa_key_derivation_abort()
5774 return status; in psa_key_derivation_abort()
5812 psa_status_t status; in psa_key_derivation_hkdf_read() local
5855 status = psa_key_derivation_start_hmac(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5859 if (status != PSA_SUCCESS) { in psa_key_derivation_hkdf_read()
5860 return status; in psa_key_derivation_hkdf_read()
5864 status = psa_mac_update(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5867 if (status != PSA_SUCCESS) { in psa_key_derivation_hkdf_read()
5868 return status; in psa_key_derivation_hkdf_read()
5871 status = psa_mac_update(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5874 if (status != PSA_SUCCESS) { in psa_key_derivation_hkdf_read()
5875 return status; in psa_key_derivation_hkdf_read()
5877 status = psa_mac_update(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5879 if (status != PSA_SUCCESS) { in psa_key_derivation_hkdf_read()
5880 return status; in psa_key_derivation_hkdf_read()
5882 status = psa_mac_sign_finish(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5886 if (status != PSA_SUCCESS) { in psa_key_derivation_hkdf_read()
5887 return status; in psa_key_derivation_hkdf_read()
5905 psa_status_t status, cleanup_status; in psa_key_derivation_tls12_prf_generate_next_block() local
5937 status = psa_key_derivation_start_hmac(&hmac, in psa_key_derivation_tls12_prf_generate_next_block()
5941 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
5950 status = psa_mac_update(&hmac, in psa_key_derivation_tls12_prf_generate_next_block()
5953 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
5956 status = psa_mac_update(&hmac, in psa_key_derivation_tls12_prf_generate_next_block()
5959 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
5964 status = psa_mac_update(&hmac, tls12_prf->Ai, hash_length); in psa_key_derivation_tls12_prf_generate_next_block()
5965 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
5970 status = psa_mac_sign_finish(&hmac, in psa_key_derivation_tls12_prf_generate_next_block()
5974 status = PSA_ERROR_CORRUPTION_DETECTED; in psa_key_derivation_tls12_prf_generate_next_block()
5976 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
5981 status = psa_key_derivation_start_hmac(&hmac, in psa_key_derivation_tls12_prf_generate_next_block()
5985 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
5988 status = psa_mac_update(&hmac, tls12_prf->Ai, hash_length); in psa_key_derivation_tls12_prf_generate_next_block()
5989 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
5992 status = psa_mac_update(&hmac, tls12_prf->label, tls12_prf->label_length); in psa_key_derivation_tls12_prf_generate_next_block()
5993 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
5996 status = psa_mac_update(&hmac, tls12_prf->seed, tls12_prf->seed_length); in psa_key_derivation_tls12_prf_generate_next_block()
5997 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
6000 status = psa_mac_sign_finish(&hmac, in psa_key_derivation_tls12_prf_generate_next_block()
6003 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
6010 if (status == PSA_SUCCESS && cleanup_status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_generate_next_block()
6011 status = cleanup_status; in psa_key_derivation_tls12_prf_generate_next_block()
6014 return status; in psa_key_derivation_tls12_prf_generate_next_block()
6025 psa_status_t status; in psa_key_derivation_tls12_prf_read() local
6041 status = psa_key_derivation_tls12_prf_generate_next_block(tls12_prf, in psa_key_derivation_tls12_prf_read()
6043 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_prf_read()
6044 return status; in psa_key_derivation_tls12_prf_read()
6074 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_key_derivation_tls12_ecjpake_to_pms_read() local
6081 status = psa_hash_compute(PSA_ALG_SHA_256, ecjpake->data, in psa_key_derivation_tls12_ecjpake_to_pms_read()
6084 if (status != PSA_SUCCESS) { in psa_key_derivation_tls12_ecjpake_to_pms_read()
6085 return status; in psa_key_derivation_tls12_ecjpake_to_pms_read()
6103 psa_status_t status; in psa_key_derivation_pbkdf2_generate_block() local
6122 status = psa_driver_wrapper_mac_sign_setup(&mac_operation, in psa_key_derivation_pbkdf2_generate_block()
6127 if (status != PSA_SUCCESS) { in psa_key_derivation_pbkdf2_generate_block()
6130 status = psa_mac_update(&mac_operation, pbkdf2->salt, pbkdf2->salt_length); in psa_key_derivation_pbkdf2_generate_block()
6131 if (status != PSA_SUCCESS) { in psa_key_derivation_pbkdf2_generate_block()
6134 status = psa_mac_update(&mac_operation, block_counter, sizeof(block_counter)); in psa_key_derivation_pbkdf2_generate_block()
6135 if (status != PSA_SUCCESS) { in psa_key_derivation_pbkdf2_generate_block()
6138 status = psa_mac_sign_finish(&mac_operation, U_i, sizeof(U_i), in psa_key_derivation_pbkdf2_generate_block()
6140 if (status != PSA_SUCCESS) { in psa_key_derivation_pbkdf2_generate_block()
6145 status = PSA_ERROR_CORRUPTION_DETECTED; in psa_key_derivation_pbkdf2_generate_block()
6155 status = psa_driver_wrapper_mac_compute(attributes, in psa_key_derivation_pbkdf2_generate_block()
6161 if (status != PSA_SUCCESS) { in psa_key_derivation_pbkdf2_generate_block()
6171 return status; in psa_key_derivation_pbkdf2_generate_block()
6180 psa_status_t status; in psa_key_derivation_pbkdf2_read() local
6229 status = psa_key_derivation_pbkdf2_generate_block(pbkdf2, prf_alg, in psa_key_derivation_pbkdf2_read()
6232 if (status != PSA_SUCCESS) { in psa_key_derivation_pbkdf2_read()
6233 return status; in psa_key_derivation_pbkdf2_read()
6246 psa_status_t status; in psa_key_derivation_output_bytes() local
6271 status = PSA_ERROR_INSUFFICIENT_DATA; in psa_key_derivation_output_bytes()
6279 status = psa_key_derivation_hkdf_read(&operation->ctx.hkdf, kdf_alg, in psa_key_derivation_output_bytes()
6287 status = psa_key_derivation_tls12_prf_read(&operation->ctx.tls12_prf, in psa_key_derivation_output_bytes()
6295 status = psa_key_derivation_tls12_ecjpake_to_pms_read( in psa_key_derivation_output_bytes()
6301 status = psa_key_derivation_pbkdf2_read(&operation->ctx.pbkdf2, kdf_alg, in psa_key_derivation_output_bytes()
6308 status = PSA_ERROR_BAD_STATE; in psa_key_derivation_output_bytes()
6311 return status; in psa_key_derivation_output_bytes()
6315 if (status != PSA_SUCCESS) { in psa_key_derivation_output_bytes()
6329 return status; in psa_key_derivation_output_bytes()
6389 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_generate_derived_ecc_key_weierstrass_helper() local
6430 if ((status = psa_key_derivation_output_bytes(operation, *data, m_bytes)) != 0) { in psa_generate_derived_ecc_key_weierstrass_helper()
6461 status = mbedtls_to_psa_error(ret); in psa_generate_derived_ecc_key_weierstrass_helper()
6463 if (status != PSA_SUCCESS) { in psa_generate_derived_ecc_key_weierstrass_helper()
6469 return status; in psa_generate_derived_ecc_key_weierstrass_helper()
6493 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_generate_derived_ecc_key_montgomery_helper() local
6513 status = psa_key_derivation_output_bytes(operation, *data, output_length); in psa_generate_derived_ecc_key_montgomery_helper()
6515 if (status != PSA_SUCCESS) { in psa_generate_derived_ecc_key_montgomery_helper()
6516 return status; in psa_generate_derived_ecc_key_montgomery_helper()
6534 return status; in psa_generate_derived_ecc_key_montgomery_helper()
6567 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_generate_derived_key_internal() local
6579 status = psa_generate_derived_ecc_key_weierstrass_helper(slot, bits, operation, &data); in psa_generate_derived_key_internal()
6580 if (status != PSA_SUCCESS) { in psa_generate_derived_key_internal()
6585 status = psa_generate_derived_ecc_key_montgomery_helper(bits, operation, &data); in psa_generate_derived_key_internal()
6586 if (status != PSA_SUCCESS) { in psa_generate_derived_key_internal()
6602 status = psa_key_derivation_output_bytes(operation, data, bytes); in psa_generate_derived_key_internal()
6603 if (status != PSA_SUCCESS) { in psa_generate_derived_key_internal()
6618 status = psa_driver_wrapper_get_key_buffer_size(&slot->attr, in psa_generate_derived_key_internal()
6620 if (status != PSA_SUCCESS) { in psa_generate_derived_key_internal()
6624 status = psa_allocate_buffer_to_slot(slot, storage_size); in psa_generate_derived_key_internal()
6625 if (status != PSA_SUCCESS) { in psa_generate_derived_key_internal()
6629 status = psa_driver_wrapper_import_key(&slot->attr, in psa_generate_derived_key_internal()
6635 status = PSA_ERROR_INVALID_ARGUMENT; in psa_generate_derived_key_internal()
6640 return status; in psa_generate_derived_key_internal()
6667 psa_status_t status; in psa_key_derivation_output_key_custom() local
6692 status = psa_start_key_creation(PSA_KEY_CREATION_DERIVE, attributes, in psa_key_derivation_output_key_custom()
6697 status = PSA_ERROR_NOT_SUPPORTED; in psa_key_derivation_output_key_custom()
6700 if (status == PSA_SUCCESS) { in psa_key_derivation_output_key_custom()
6701 status = psa_generate_derived_key_internal(slot, in psa_key_derivation_output_key_custom()
6705 if (status == PSA_SUCCESS) { in psa_key_derivation_output_key_custom()
6706 status = psa_finish_key_creation(slot, driver, key); in psa_key_derivation_output_key_custom()
6708 if (status != PSA_SUCCESS) { in psa_key_derivation_output_key_custom()
6712 return status; in psa_key_derivation_output_key_custom()
6794 psa_status_t status = psa_hash_setup(&operation, alg); in psa_hash_try_support() local
6796 return status; in psa_hash_try_support()
6834 psa_status_t status = psa_hash_try_support(hash_alg); in psa_key_derivation_set_maximum_capacity() local
6835 if (status != PSA_SUCCESS) { in psa_key_derivation_set_maximum_capacity()
6836 return status; in psa_key_derivation_set_maximum_capacity()
6879 status = PSA_ERROR_NOT_SUPPORTED; in psa_key_derivation_set_maximum_capacity()
6881 return status; in psa_key_derivation_set_maximum_capacity()
6897 psa_status_t status = psa_key_derivation_set_maximum_capacity(operation, in psa_key_derivation_setup_kdf() local
6899 return status; in psa_key_derivation_setup_kdf()
6934 psa_status_t status; in psa_key_derivation_setup() local
6946 status = psa_key_agreement_try_support(ka_alg); in psa_key_derivation_setup()
6947 if (status != PSA_SUCCESS) { in psa_key_derivation_setup()
6948 return status; in psa_key_derivation_setup()
6953 status = psa_key_derivation_setup_kdf(operation, kdf_alg); in psa_key_derivation_setup()
6959 status = psa_key_derivation_setup_kdf(operation, alg); in psa_key_derivation_setup()
6967 if (status == PSA_SUCCESS) { in psa_key_derivation_setup()
6970 return status; in psa_key_derivation_setup()
6981 psa_status_t status; in psa_hkdf_input() local
6992 status = psa_key_derivation_start_hmac(&hkdf->hmac, in psa_hkdf_input()
6995 if (status != PSA_SUCCESS) { in psa_hkdf_input()
6996 return status; in psa_hkdf_input()
7029 status = psa_key_derivation_start_hmac(&hkdf->hmac, in psa_hkdf_input()
7032 if (status != PSA_SUCCESS) { in psa_hkdf_input()
7033 return status; in psa_hkdf_input()
7040 status = psa_mac_update(&hkdf->hmac, in psa_hkdf_input()
7042 if (status != PSA_SUCCESS) { in psa_hkdf_input()
7043 return status; in psa_hkdf_input()
7045 status = psa_mac_sign_finish(&hkdf->hmac, in psa_hkdf_input()
7049 if (status != PSA_SUCCESS) { in psa_hkdf_input()
7050 return status; in psa_hkdf_input()
7201 psa_status_t status; in psa_tls12_prf_psk_to_ms_set_key() local
7254 status = psa_tls12_prf_set_key(prf, pms, (size_t) (cur - pms)); in psa_tls12_prf_psk_to_ms_set_key()
7257 return status; in psa_tls12_prf_psk_to_ms_set_key()
7402 psa_status_t status = PSA_SUCCESS; in psa_pbkdf2_hmac_set_password() local
7410 return status; in psa_pbkdf2_hmac_set_password()
7420 psa_status_t status = PSA_SUCCESS; in psa_pbkdf2_cmac_set_password() local
7430 status = psa_driver_wrapper_mac_compute(&attributes, in psa_pbkdf2_cmac_set_password()
7442 return status; in psa_pbkdf2_cmac_set_password()
7451 psa_status_t status = PSA_SUCCESS; in psa_pbkdf2_set_password() local
7459 status = psa_pbkdf2_hmac_set_password(hash_alg, data, data_length, in psa_pbkdf2_set_password()
7466 status = psa_pbkdf2_cmac_set_password(data, data_length, in psa_pbkdf2_set_password()
7477 return status; in psa_pbkdf2_set_password()
7560 psa_status_t status; in psa_key_derivation_input_internal() local
7565 status = PSA_ERROR_BAD_STATE; in psa_key_derivation_input_internal()
7569 status = psa_key_derivation_check_input_type(step, key_type); in psa_key_derivation_input_internal()
7570 if (status != PSA_SUCCESS) { in psa_key_derivation_input_internal()
7576 status = psa_hkdf_input(&operation->ctx.hkdf, kdf_alg, in psa_key_derivation_input_internal()
7582 status = psa_tls12_prf_input(&operation->ctx.tls12_prf, in psa_key_derivation_input_internal()
7588 status = psa_tls12_prf_psk_to_ms_input(&operation->ctx.tls12_prf, in psa_key_derivation_input_internal()
7594 status = psa_tls12_ecjpake_to_pms_input( in psa_key_derivation_input_internal()
7600 status = psa_pbkdf2_input(&operation->ctx.pbkdf2, kdf_alg, in psa_key_derivation_input_internal()
7613 if (status != PSA_SUCCESS) { in psa_key_derivation_input_internal()
7616 return status; in psa_key_derivation_input_internal()
7624 psa_status_t status; in psa_key_derivation_input_integer_internal() local
7629 status = PSA_ERROR_BAD_STATE; in psa_key_derivation_input_integer_internal()
7635 status = psa_pbkdf2_set_input_cost( in psa_key_derivation_input_integer_internal()
7643 status = PSA_ERROR_INVALID_ARGUMENT; in psa_key_derivation_input_integer_internal()
7647 if (status != PSA_SUCCESS) { in psa_key_derivation_input_integer_internal()
7650 return status; in psa_key_derivation_input_integer_internal()
7659 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_key_derivation_input_bytes() local
7664 status = psa_key_derivation_input_internal(operation, step, in psa_key_derivation_input_bytes()
7671 return status; in psa_key_derivation_input_bytes()
7687 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_key_derivation_input_key() local
7691 status = psa_get_and_lock_transparent_key_slot_with_policy( in psa_key_derivation_input_key()
7693 if (status != PSA_SUCCESS) { in psa_key_derivation_input_key()
7695 return status; in psa_key_derivation_input_key()
7705 status = psa_key_derivation_input_internal(operation, in psa_key_derivation_input_key()
7712 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_key_derivation_input_key()
7803 psa_status_t status; in psa_key_agreement_internal() local
7810 status = psa_key_agreement_raw_internal(ka_alg, in psa_key_agreement_internal()
7816 if (status != PSA_SUCCESS) { in psa_key_agreement_internal()
7823 status = psa_key_derivation_input_internal(operation, step, in psa_key_agreement_internal()
7829 return status; in psa_key_agreement_internal()
7838 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_key_derivation_key_agreement() local
7846 status = psa_get_and_lock_transparent_key_slot_with_policy( in psa_key_derivation_key_agreement()
7848 if (status != PSA_SUCCESS) { in psa_key_derivation_key_agreement()
7849 return status; in psa_key_derivation_key_agreement()
7853 status = psa_key_agreement_internal(operation, step, in psa_key_derivation_key_agreement()
7860 if (status != PSA_SUCCESS) { in psa_key_derivation_key_agreement()
7873 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_key_derivation_key_agreement()
7884 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_raw_key_agreement() local
7893 status = PSA_ERROR_INVALID_ARGUMENT; in psa_raw_key_agreement()
7896 status = psa_get_and_lock_transparent_key_slot_with_policy( in psa_raw_key_agreement()
7898 if (status != PSA_SUCCESS) { in psa_raw_key_agreement()
7913 status = PSA_ERROR_BUFFER_TOO_SMALL; in psa_raw_key_agreement()
7918 status = psa_key_agreement_raw_internal(alg, slot, in psa_raw_key_agreement()
7926 if (output != NULL && status != PSA_SUCCESS) { in psa_raw_key_agreement()
7947 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_raw_key_agreement()
8028 psa_status_t status; in psa_generate_random() local
8033 status = psa_generate_random_internal(output, output_size); in psa_generate_random()
8039 return status; in psa_generate_random()
8076 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_validate_key_type_and_size_for_key_generation() local
8079 status = psa_validate_unstructured_key_bit_size(type, bits); in psa_validate_key_type_and_size_for_key_generation()
8080 if (status != PSA_SUCCESS) { in psa_validate_key_type_and_size_for_key_generation()
8081 return status; in psa_validate_key_type_and_size_for_key_generation()
8129 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_generate_key_internal() local
8138 status = psa_generate_random_internal(key_buffer, key_buffer_size); in psa_generate_key_internal()
8139 if (status != PSA_SUCCESS) { in psa_generate_key_internal()
8140 return status; in psa_generate_key_internal()
8191 psa_status_t status; in psa_generate_key_custom() local
8220 status = psa_start_key_creation(PSA_KEY_CREATION_GENERATE, attributes, in psa_generate_key_custom()
8222 if (status != PSA_SUCCESS) { in psa_generate_key_custom()
8233 status = psa_validate_key_type_and_size_for_key_generation( in psa_generate_key_custom()
8235 if (status != PSA_SUCCESS) { in psa_generate_key_custom()
8243 status = psa_driver_wrapper_get_key_buffer_size( in psa_generate_key_custom()
8245 if (status != PSA_SUCCESS) { in psa_generate_key_custom()
8250 status = psa_allocate_buffer_to_slot(slot, key_buffer_size); in psa_generate_key_custom()
8251 if (status != PSA_SUCCESS) { in psa_generate_key_custom()
8256 status = psa_driver_wrapper_generate_key(attributes, in psa_generate_key_custom()
8261 if (status != PSA_SUCCESS) { in psa_generate_key_custom()
8266 if (status == PSA_SUCCESS) { in psa_generate_key_custom()
8267 status = psa_finish_key_creation(slot, driver, key); in psa_generate_key_custom()
8269 if (status != PSA_SUCCESS) { in psa_generate_key_custom()
8273 return status; in psa_generate_key_custom()
8308 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in mbedtls_psa_crypto_configure_entropy_sources() local
8315 status = PSA_ERROR_BAD_STATE; in mbedtls_psa_crypto_configure_entropy_sources()
8319 status = PSA_SUCCESS; in mbedtls_psa_crypto_configure_entropy_sources()
8326 return status; in mbedtls_psa_crypto_configure_entropy_sources()
8408 psa_status_t status = PSA_SUCCESS; in mbedtls_psa_crypto_init_subsystem() local
8420 status = psa_driver_wrapper_init(); in mbedtls_psa_crypto_init_subsystem()
8441 status = psa_initialize_key_slots(); in mbedtls_psa_crypto_init_subsystem()
8480 status = mbedtls_psa_random_seed(&global_data.rng); in mbedtls_psa_crypto_init_subsystem()
8481 if (status == PSA_SUCCESS) { in mbedtls_psa_crypto_init_subsystem()
8501 status = psa_crypto_load_transaction(); in mbedtls_psa_crypto_init_subsystem()
8502 if (status == PSA_SUCCESS) { in mbedtls_psa_crypto_init_subsystem()
8503 status = psa_crypto_recover_transaction(&psa_crypto_transaction); in mbedtls_psa_crypto_init_subsystem()
8504 if (status == PSA_SUCCESS) { in mbedtls_psa_crypto_init_subsystem()
8507 status = psa_crypto_stop_transaction(); in mbedtls_psa_crypto_init_subsystem()
8508 } else if (status == PSA_ERROR_DOES_NOT_EXIST) { in mbedtls_psa_crypto_init_subsystem()
8511 status = PSA_SUCCESS; in mbedtls_psa_crypto_init_subsystem()
8515 status = PSA_SUCCESS; in mbedtls_psa_crypto_init_subsystem()
8527 status = PSA_ERROR_CORRUPTION_DETECTED; in mbedtls_psa_crypto_init_subsystem()
8535 return status; in mbedtls_psa_crypto_init_subsystem()
8540 psa_status_t status; in psa_crypto_init() local
8548 status = mbedtls_psa_crypto_init_subsystem(PSA_CRYPTO_SUBSYSTEM_DRIVER_WRAPPERS); in psa_crypto_init()
8549 if (status != PSA_SUCCESS) { in psa_crypto_init()
8553 status = mbedtls_psa_crypto_init_subsystem(PSA_CRYPTO_SUBSYSTEM_KEY_SLOTS); in psa_crypto_init()
8554 if (status != PSA_SUCCESS) { in psa_crypto_init()
8558 status = mbedtls_psa_crypto_init_subsystem(PSA_CRYPTO_SUBSYSTEM_RNG); in psa_crypto_init()
8559 if (status != PSA_SUCCESS) { in psa_crypto_init()
8563 status = mbedtls_psa_crypto_init_subsystem(PSA_CRYPTO_SUBSYSTEM_TRANSACTION); in psa_crypto_init()
8567 if (status != PSA_SUCCESS) { in psa_crypto_init()
8571 return status; in psa_crypto_init()
8691 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_pake_setup() local
8694 status = PSA_ERROR_BAD_STATE; in psa_pake_setup()
8700 status = PSA_ERROR_INVALID_ARGUMENT; in psa_pake_setup()
8725 status = PSA_ERROR_NOT_SUPPORTED; in psa_pake_setup()
8734 return status; in psa_pake_setup()
8741 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_pake_set_password_key() local
8747 status = PSA_ERROR_BAD_STATE; in psa_pake_set_password_key()
8751 status = psa_get_and_lock_key_slot_with_policy(password, &slot, in psa_pake_set_password_key()
8754 if (status != PSA_SUCCESS) { in psa_pake_set_password_key()
8762 status = PSA_ERROR_INVALID_ARGUMENT; in psa_pake_set_password_key()
8768 status = PSA_ERROR_INSUFFICIENT_MEMORY; in psa_pake_set_password_key()
8777 if (status != PSA_SUCCESS) { in psa_pake_set_password_key()
8781 return (status == PSA_SUCCESS) ? unlock_status : status; in psa_pake_set_password_key()
8789 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_pake_set_user() local
8793 status = PSA_ERROR_BAD_STATE; in psa_pake_set_user()
8798 status = PSA_ERROR_INVALID_ARGUMENT; in psa_pake_set_user()
8803 status = PSA_ERROR_BAD_STATE; in psa_pake_set_user()
8809 status = PSA_ERROR_INSUFFICIENT_MEMORY; in psa_pake_set_user()
8818 status = PSA_SUCCESS; in psa_pake_set_user()
8822 if (status != PSA_SUCCESS) { in psa_pake_set_user()
8825 return status; in psa_pake_set_user()
8833 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_pake_set_peer() local
8837 status = PSA_ERROR_BAD_STATE; in psa_pake_set_peer()
8842 status = PSA_ERROR_INVALID_ARGUMENT; in psa_pake_set_peer()
8847 status = PSA_ERROR_BAD_STATE; in psa_pake_set_peer()
8853 status = PSA_ERROR_INSUFFICIENT_MEMORY; in psa_pake_set_peer()
8862 status = PSA_SUCCESS; in psa_pake_set_peer()
8866 if (status != PSA_SUCCESS) { in psa_pake_set_peer()
8869 return status; in psa_pake_set_peer()
8876 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_pake_set_role() local
8879 status = PSA_ERROR_BAD_STATE; in psa_pake_set_role()
8889 status = PSA_ERROR_INVALID_ARGUMENT; in psa_pake_set_role()
8894 status = PSA_ERROR_NOT_SUPPORTED; in psa_pake_set_role()
8899 return status; in psa_pake_set_role()
8934 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_pake_complete_inputs() local
8952 status = psa_driver_wrapper_pake_setup(operation, &inputs); in psa_pake_complete_inputs()
8961 if (status == PSA_SUCCESS) { in psa_pake_complete_inputs()
8968 status = PSA_ERROR_NOT_SUPPORTED; in psa_pake_complete_inputs()
8971 return status; in psa_pake_complete_inputs()
9058 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_pake_output() local
9064 status = psa_pake_complete_inputs(operation); in psa_pake_output()
9065 if (status != PSA_SUCCESS) { in psa_pake_output()
9071 status = PSA_ERROR_BAD_STATE; in psa_pake_output()
9076 status = PSA_ERROR_INVALID_ARGUMENT; in psa_pake_output()
9083 status = psa_jpake_prologue(operation, step, PSA_JPAKE_OUTPUT); in psa_pake_output()
9084 if (status != PSA_SUCCESS) { in psa_pake_output()
9093 status = PSA_ERROR_NOT_SUPPORTED; in psa_pake_output()
9099 status = psa_driver_wrapper_pake_output(operation, driver_step, in psa_pake_output()
9102 if (status != PSA_SUCCESS) { in psa_pake_output()
9109 status = psa_jpake_epilogue(operation, PSA_JPAKE_OUTPUT); in psa_pake_output()
9110 if (status != PSA_SUCCESS) { in psa_pake_output()
9116 status = PSA_ERROR_NOT_SUPPORTED; in psa_pake_output()
9122 if (status != PSA_SUCCESS) { in psa_pake_output()
9125 return status; in psa_pake_output()
9134 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_pake_input() local
9142 status = psa_pake_complete_inputs(operation); in psa_pake_input()
9143 if (status != PSA_SUCCESS) { in psa_pake_input()
9149 status = PSA_ERROR_BAD_STATE; in psa_pake_input()
9154 status = PSA_ERROR_INVALID_ARGUMENT; in psa_pake_input()
9161 status = psa_jpake_prologue(operation, step, PSA_JPAKE_INPUT); in psa_pake_input()
9162 if (status != PSA_SUCCESS) { in psa_pake_input()
9171 status = PSA_ERROR_NOT_SUPPORTED; in psa_pake_input()
9176 status = psa_driver_wrapper_pake_input(operation, driver_step, in psa_pake_input()
9179 if (status != PSA_SUCCESS) { in psa_pake_input()
9186 status = psa_jpake_epilogue(operation, PSA_JPAKE_INPUT); in psa_pake_input()
9187 if (status != PSA_SUCCESS) { in psa_pake_input()
9193 status = PSA_ERROR_NOT_SUPPORTED; in psa_pake_input()
9199 if (status != PSA_SUCCESS) { in psa_pake_input()
9202 return status; in psa_pake_input()
9209 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; in psa_pake_get_implicit_key() local
9215 status = PSA_ERROR_BAD_STATE; in psa_pake_get_implicit_key()
9224 status = PSA_ERROR_BAD_STATE; in psa_pake_get_implicit_key()
9230 status = PSA_ERROR_NOT_SUPPORTED; in psa_pake_get_implicit_key()
9234 status = psa_driver_wrapper_pake_get_implicit_key(operation, in psa_pake_get_implicit_key()
9239 if (status != PSA_SUCCESS) { in psa_pake_get_implicit_key()
9243 status = psa_key_derivation_input_bytes(output, in psa_pake_get_implicit_key()
9251 return status == PSA_SUCCESS ? abort_status : status; in psa_pake_get_implicit_key()
9257 psa_status_t status = PSA_SUCCESS; in psa_pake_abort() local
9260 status = psa_driver_wrapper_pake_abort(operation); in psa_pake_abort()
9277 return status; in psa_pake_abort()
9373 psa_status_t status; in psa_crypto_local_input_alloc() local
9391 status = psa_crypto_copy_input(input, input_len, in psa_crypto_local_input_alloc()
9393 if (status != PSA_SUCCESS) { in psa_crypto_local_input_alloc()
9403 return status; in psa_crypto_local_input_alloc()
9435 psa_status_t status; in psa_crypto_local_output_free() local
9446 status = psa_crypto_copy_output(local_output->buffer, local_output->length, in psa_crypto_local_output_free()
9448 if (status != PSA_SUCCESS) { in psa_crypto_local_output_free()
9449 return status; in psa_crypto_local_output_free()