psa_crypto_stubs.c (3615B)
1 /** \file psa_crypto_stubs.c 2 * 3 * \brief Stub functions when MBEDTLS_PSA_CRYPTO_CLIENT is enabled but 4 * MBEDTLS_PSA_CRYPTO_C is disabled. 5 */ 6 7 /* 8 * Copyright The Mbed TLS Contributors 9 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 10 */ 11 12 #include <psa/crypto.h> 13 14 #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C) 15 16 psa_status_t psa_generate_random(uint8_t *output, 17 size_t output_size) 18 { 19 (void) output; 20 (void) output_size; 21 22 return PSA_ERROR_COMMUNICATION_FAILURE; 23 } 24 25 psa_status_t psa_export_key(mbedtls_svc_key_id_t key, 26 uint8_t *data, 27 size_t data_size, 28 size_t *data_length) 29 { 30 (void) key; 31 (void) data; 32 (void) data_size; 33 (void) data_length; 34 return PSA_ERROR_COMMUNICATION_FAILURE; 35 } 36 37 psa_status_t psa_export_public_key(mbedtls_svc_key_id_t key, 38 uint8_t *data, 39 size_t data_size, 40 size_t *data_length) 41 { 42 (void) key; 43 (void) data; 44 (void) data_size; 45 (void) data_length; 46 return PSA_ERROR_COMMUNICATION_FAILURE; 47 } 48 49 psa_status_t psa_get_key_attributes(mbedtls_svc_key_id_t key, 50 psa_key_attributes_t *attributes) 51 { 52 (void) key; 53 (void) attributes; 54 return PSA_ERROR_COMMUNICATION_FAILURE; 55 } 56 57 psa_status_t psa_hash_abort(psa_hash_operation_t *operation) 58 { 59 (void) operation; 60 return PSA_ERROR_COMMUNICATION_FAILURE; 61 } 62 63 psa_status_t psa_import_key(const psa_key_attributes_t *attributes, 64 const uint8_t *data, 65 size_t data_length, 66 mbedtls_svc_key_id_t *key) 67 { 68 (void) attributes; 69 (void) data; 70 (void) data_length; 71 (void) key; 72 return PSA_ERROR_COMMUNICATION_FAILURE; 73 } 74 75 int psa_can_do_hash(psa_algorithm_t hash_alg) 76 { 77 (void) hash_alg; 78 return 0; 79 } 80 81 psa_status_t psa_hash_clone(const psa_hash_operation_t *source_operation, 82 psa_hash_operation_t *target_operation) 83 { 84 (void) source_operation; 85 (void) target_operation; 86 return PSA_ERROR_COMMUNICATION_FAILURE; 87 } 88 89 psa_status_t psa_hash_setup(psa_hash_operation_t *operation, 90 psa_algorithm_t alg) 91 { 92 (void) operation; 93 (void) alg; 94 return PSA_ERROR_COMMUNICATION_FAILURE; 95 } 96 97 psa_status_t psa_hash_update(psa_hash_operation_t *operation, 98 const uint8_t *input_external, 99 size_t input_length) 100 { 101 (void) operation; 102 (void) input_external; 103 (void) input_length; 104 return PSA_ERROR_COMMUNICATION_FAILURE; 105 } 106 107 psa_status_t psa_hash_finish(psa_hash_operation_t *operation, 108 uint8_t *hash_external, 109 size_t hash_size, 110 size_t *hash_length) 111 { 112 (void) operation; 113 (void) hash_external; 114 (void) hash_size; 115 (void) hash_length; 116 return PSA_ERROR_COMMUNICATION_FAILURE; 117 } 118 119 psa_status_t psa_hash_compute(psa_algorithm_t alg, 120 const uint8_t *input_external, size_t input_length, 121 uint8_t *hash_external, size_t hash_size, 122 size_t *hash_length) 123 { 124 (void) alg; 125 (void) input_external; 126 (void) input_length; 127 (void) hash_external; 128 (void) hash_size; 129 (void) hash_length; 130 return PSA_ERROR_COMMUNICATION_FAILURE; 131 } 132 133 #endif /* MBEDTLS_PSA_CRYPTO_CLIENT && !MBEDTLS_PSA_CRYPTO_C */