xref: /optee_os/lib/libmbedtls/mbedtls/library/psa_crypto_rsa.h (revision b0563631928755fe864b97785160fb3088e9efdc)
1*b0563631STom Van Eyck /*
2*b0563631STom Van Eyck  *  PSA RSA layer on top of Mbed TLS crypto
3*b0563631STom Van Eyck  */
4*b0563631STom Van Eyck /*
5*b0563631STom Van Eyck  *  Copyright The Mbed TLS Contributors
6*b0563631STom Van Eyck  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
7*b0563631STom Van Eyck  */
8*b0563631STom Van Eyck 
9*b0563631STom Van Eyck #ifndef PSA_CRYPTO_RSA_H
10*b0563631STom Van Eyck #define PSA_CRYPTO_RSA_H
11*b0563631STom Van Eyck 
12*b0563631STom Van Eyck #include <psa/crypto.h>
13*b0563631STom Van Eyck #include <mbedtls/rsa.h>
14*b0563631STom Van Eyck 
15*b0563631STom Van Eyck /** Load the contents of a key buffer into an internal RSA representation
16*b0563631STom Van Eyck  *
17*b0563631STom Van Eyck  * \param[in] type          The type of key contained in \p data.
18*b0563631STom Van Eyck  * \param[in] data          The buffer from which to load the representation.
19*b0563631STom Van Eyck  * \param[in] data_length   The size in bytes of \p data.
20*b0563631STom Van Eyck  * \param[out] p_rsa        Returns a pointer to an RSA context on success.
21*b0563631STom Van Eyck  *                          The caller is responsible for freeing both the
22*b0563631STom Van Eyck  *                          contents of the context and the context itself
23*b0563631STom Van Eyck  *                          when done.
24*b0563631STom Van Eyck  */
25*b0563631STom Van Eyck psa_status_t mbedtls_psa_rsa_load_representation(psa_key_type_t type,
26*b0563631STom Van Eyck                                                  const uint8_t *data,
27*b0563631STom Van Eyck                                                  size_t data_length,
28*b0563631STom Van Eyck                                                  mbedtls_rsa_context **p_rsa);
29*b0563631STom Van Eyck 
30*b0563631STom Van Eyck /** Import an RSA key in binary format.
31*b0563631STom Van Eyck  *
32*b0563631STom Van Eyck  * \note The signature of this function is that of a PSA driver
33*b0563631STom Van Eyck  *       import_key entry point. This function behaves as an import_key
34*b0563631STom Van Eyck  *       entry point as defined in the PSA driver interface specification for
35*b0563631STom Van Eyck  *       transparent drivers.
36*b0563631STom Van Eyck  *
37*b0563631STom Van Eyck  * \param[in]  attributes       The attributes for the key to import.
38*b0563631STom Van Eyck  * \param[in]  data             The buffer containing the key data in import
39*b0563631STom Van Eyck  *                              format.
40*b0563631STom Van Eyck  * \param[in]  data_length      Size of the \p data buffer in bytes.
41*b0563631STom Van Eyck  * \param[out] key_buffer       The buffer containing the key data in output
42*b0563631STom Van Eyck  *                              format.
43*b0563631STom Van Eyck  * \param[in]  key_buffer_size  Size of the \p key_buffer buffer in bytes. This
44*b0563631STom Van Eyck  *                              size is greater or equal to \p data_length.
45*b0563631STom Van Eyck  * \param[out] key_buffer_length  The length of the data written in \p
46*b0563631STom Van Eyck  *                                key_buffer in bytes.
47*b0563631STom Van Eyck  * \param[out] bits             The key size in number of bits.
48*b0563631STom Van Eyck  *
49*b0563631STom Van Eyck  * \retval #PSA_SUCCESS  The RSA key was imported successfully.
50*b0563631STom Van Eyck  * \retval #PSA_ERROR_INVALID_ARGUMENT
51*b0563631STom Van Eyck  *         The key data is not correctly formatted.
52*b0563631STom Van Eyck  * \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription
53*b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
54*b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
55*b0563631STom Van Eyck  */
56*b0563631STom Van Eyck psa_status_t mbedtls_psa_rsa_import_key(
57*b0563631STom Van Eyck     const psa_key_attributes_t *attributes,
58*b0563631STom Van Eyck     const uint8_t *data, size_t data_length,
59*b0563631STom Van Eyck     uint8_t *key_buffer, size_t key_buffer_size,
60*b0563631STom Van Eyck     size_t *key_buffer_length, size_t *bits);
61*b0563631STom Van Eyck 
62*b0563631STom Van Eyck /** Export an RSA key to export representation
63*b0563631STom Van Eyck  *
64*b0563631STom Van Eyck  * \param[in] type          The type of key (public/private) to export
65*b0563631STom Van Eyck  * \param[in] rsa           The internal RSA representation from which to export
66*b0563631STom Van Eyck  * \param[out] data         The buffer to export to
67*b0563631STom Van Eyck  * \param[in] data_size     The length of the buffer to export to
68*b0563631STom Van Eyck  * \param[out] data_length  The amount of bytes written to \p data
69*b0563631STom Van Eyck  */
70*b0563631STom Van Eyck psa_status_t mbedtls_psa_rsa_export_key(psa_key_type_t type,
71*b0563631STom Van Eyck                                         mbedtls_rsa_context *rsa,
72*b0563631STom Van Eyck                                         uint8_t *data,
73*b0563631STom Van Eyck                                         size_t data_size,
74*b0563631STom Van Eyck                                         size_t *data_length);
75*b0563631STom Van Eyck 
76*b0563631STom Van Eyck /** Export a public RSA key or the public part of an RSA key pair in binary
77*b0563631STom Van Eyck  *  format.
78*b0563631STom Van Eyck  *
79*b0563631STom Van Eyck  * \note The signature of this function is that of a PSA driver
80*b0563631STom Van Eyck  *       export_public_key entry point. This function behaves as an
81*b0563631STom Van Eyck  *       export_public_key entry point as defined in the PSA driver interface
82*b0563631STom Van Eyck  *       specification.
83*b0563631STom Van Eyck  *
84*b0563631STom Van Eyck  * \param[in]  attributes       The attributes for the key to export.
85*b0563631STom Van Eyck  * \param[in]  key_buffer       Material or context of the key to export.
86*b0563631STom Van Eyck  * \param[in]  key_buffer_size  Size of the \p key_buffer buffer in bytes.
87*b0563631STom Van Eyck  * \param[out] data             Buffer where the key data is to be written.
88*b0563631STom Van Eyck  * \param[in]  data_size        Size of the \p data buffer in bytes.
89*b0563631STom Van Eyck  * \param[out] data_length      On success, the number of bytes written in
90*b0563631STom Van Eyck  *                              \p data.
91*b0563631STom Van Eyck  *
92*b0563631STom Van Eyck  * \retval #PSA_SUCCESS  The RSA public key was exported successfully.
93*b0563631STom Van Eyck  * \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription
94*b0563631STom Van Eyck  * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
95*b0563631STom Van Eyck  * \retval #PSA_ERROR_HARDWARE_FAILURE \emptydescription
96*b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
97*b0563631STom Van Eyck  * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
98*b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
99*b0563631STom Van Eyck  */
100*b0563631STom Van Eyck psa_status_t mbedtls_psa_rsa_export_public_key(
101*b0563631STom Van Eyck     const psa_key_attributes_t *attributes,
102*b0563631STom Van Eyck     const uint8_t *key_buffer, size_t key_buffer_size,
103*b0563631STom Van Eyck     uint8_t *data, size_t data_size, size_t *data_length);
104*b0563631STom Van Eyck 
105*b0563631STom Van Eyck /**
106*b0563631STom Van Eyck  * \brief Generate an RSA key.
107*b0563631STom Van Eyck  *
108*b0563631STom Van Eyck  * \note The signature of the function is that of a PSA driver generate_key
109*b0563631STom Van Eyck  *       entry point.
110*b0563631STom Van Eyck  *
111*b0563631STom Van Eyck  * \param[in]  attributes         The attributes for the RSA key to generate.
112*b0563631STom Van Eyck  * \param[in]  params             Production parameters for the key
113*b0563631STom Van Eyck  *                                generation. This function only uses
114*b0563631STom Van Eyck  *                                `params->data`,
115*b0563631STom Van Eyck  *                                which contains the public exponent.
116*b0563631STom Van Eyck  *                                This can be a null pointer if
117*b0563631STom Van Eyck  *                                \c params_data_length is 0.
118*b0563631STom Van Eyck  * \param params_data_length      Length of `params->data` in bytes.
119*b0563631STom Van Eyck  *                                This can be 0, in which case the
120*b0563631STom Van Eyck  *                                public exponent will be 65537.
121*b0563631STom Van Eyck  * \param[out] key_buffer         Buffer where the key data is to be written.
122*b0563631STom Van Eyck  * \param[in]  key_buffer_size    Size of \p key_buffer in bytes.
123*b0563631STom Van Eyck  * \param[out] key_buffer_length  On success, the number of bytes written in
124*b0563631STom Van Eyck  *                                \p key_buffer.
125*b0563631STom Van Eyck  *
126*b0563631STom Van Eyck  * \retval #PSA_SUCCESS
127*b0563631STom Van Eyck  *         The key was successfully generated.
128*b0563631STom Van Eyck  * \retval #PSA_ERROR_NOT_SUPPORTED
129*b0563631STom Van Eyck  *         Key length or type not supported.
130*b0563631STom Van Eyck  * \retval #PSA_ERROR_BUFFER_TOO_SMALL
131*b0563631STom Van Eyck  *         The size of \p key_buffer is too small.
132*b0563631STom Van Eyck  */
133*b0563631STom Van Eyck psa_status_t mbedtls_psa_rsa_generate_key(
134*b0563631STom Van Eyck     const psa_key_attributes_t *attributes,
135*b0563631STom Van Eyck     const psa_key_production_parameters_t *params, size_t params_data_length,
136*b0563631STom Van Eyck     uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length);
137*b0563631STom Van Eyck 
138*b0563631STom Van Eyck /** Sign an already-calculated hash with an RSA private key.
139*b0563631STom Van Eyck  *
140*b0563631STom Van Eyck  * \note The signature of this function is that of a PSA driver
141*b0563631STom Van Eyck  *       sign_hash entry point. This function behaves as a sign_hash
142*b0563631STom Van Eyck  *       entry point as defined in the PSA driver interface specification for
143*b0563631STom Van Eyck  *       transparent drivers.
144*b0563631STom Van Eyck  *
145*b0563631STom Van Eyck  * \param[in]  attributes       The attributes of the RSA key to use for the
146*b0563631STom Van Eyck  *                              operation.
147*b0563631STom Van Eyck  * \param[in]  key_buffer       The buffer containing the RSA key context.
148*b0563631STom Van Eyck  *                              format.
149*b0563631STom Van Eyck  * \param[in]  key_buffer_size  Size of the \p key_buffer buffer in bytes.
150*b0563631STom Van Eyck  * \param[in]  alg              A signature algorithm that is compatible with
151*b0563631STom Van Eyck  *                              an RSA key.
152*b0563631STom Van Eyck  * \param[in]  hash             The hash or message to sign.
153*b0563631STom Van Eyck  * \param[in]  hash_length      Size of the \p hash buffer in bytes.
154*b0563631STom Van Eyck  * \param[out] signature        Buffer where the signature is to be written.
155*b0563631STom Van Eyck  * \param[in]  signature_size   Size of the \p signature buffer in bytes.
156*b0563631STom Van Eyck  * \param[out] signature_length On success, the number of bytes
157*b0563631STom Van Eyck  *                              that make up the returned signature value.
158*b0563631STom Van Eyck  *
159*b0563631STom Van Eyck  * \retval #PSA_SUCCESS \emptydescription
160*b0563631STom Van Eyck  * \retval #PSA_ERROR_BUFFER_TOO_SMALL
161*b0563631STom Van Eyck  *         The size of the \p signature buffer is too small. You can
162*b0563631STom Van Eyck  *         determine a sufficient buffer size by calling
163*b0563631STom Van Eyck  *         #PSA_SIGN_OUTPUT_SIZE(\c PSA_KEY_TYPE_RSA_KEY_PAIR, \c key_bits,
164*b0563631STom Van Eyck  *         \p alg) where \c key_bits is the bit-size of the RSA key.
165*b0563631STom Van Eyck  * \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription
166*b0563631STom Van Eyck  * \retval #PSA_ERROR_INVALID_ARGUMENT \emptydescription
167*b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
168*b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
169*b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription
170*b0563631STom Van Eyck  */
171*b0563631STom Van Eyck psa_status_t mbedtls_psa_rsa_sign_hash(
172*b0563631STom Van Eyck     const psa_key_attributes_t *attributes,
173*b0563631STom Van Eyck     const uint8_t *key_buffer, size_t key_buffer_size,
174*b0563631STom Van Eyck     psa_algorithm_t alg, const uint8_t *hash, size_t hash_length,
175*b0563631STom Van Eyck     uint8_t *signature, size_t signature_size, size_t *signature_length);
176*b0563631STom Van Eyck 
177*b0563631STom Van Eyck /**
178*b0563631STom Van Eyck  * \brief Verify the signature a hash or short message using a public RSA key.
179*b0563631STom Van Eyck  *
180*b0563631STom Van Eyck  * \note The signature of this function is that of a PSA driver
181*b0563631STom Van Eyck  *       verify_hash entry point. This function behaves as a verify_hash
182*b0563631STom Van Eyck  *       entry point as defined in the PSA driver interface specification for
183*b0563631STom Van Eyck  *       transparent drivers.
184*b0563631STom Van Eyck  *
185*b0563631STom Van Eyck  * \param[in]  attributes       The attributes of the RSA key to use for the
186*b0563631STom Van Eyck  *                              operation.
187*b0563631STom Van Eyck  * \param[in]  key_buffer       The buffer containing the RSA key context.
188*b0563631STom Van Eyck  *                              format.
189*b0563631STom Van Eyck  * \param[in]  key_buffer_size  Size of the \p key_buffer buffer in bytes.
190*b0563631STom Van Eyck  * \param[in]  alg              A signature algorithm that is compatible with
191*b0563631STom Van Eyck  *                              an RSA key.
192*b0563631STom Van Eyck  * \param[in]  hash             The hash or message whose signature is to be
193*b0563631STom Van Eyck  *                              verified.
194*b0563631STom Van Eyck  * \param[in]  hash_length      Size of the \p hash buffer in bytes.
195*b0563631STom Van Eyck  * \param[in]  signature        Buffer containing the signature to verify.
196*b0563631STom Van Eyck  * \param[in]  signature_length Size of the \p signature buffer in bytes.
197*b0563631STom Van Eyck  *
198*b0563631STom Van Eyck  * \retval #PSA_SUCCESS
199*b0563631STom Van Eyck  *         The signature is valid.
200*b0563631STom Van Eyck  * \retval #PSA_ERROR_INVALID_SIGNATURE
201*b0563631STom Van Eyck  *         The calculation was performed successfully, but the passed
202*b0563631STom Van Eyck  *         signature is not a valid signature.
203*b0563631STom Van Eyck  * \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription
204*b0563631STom Van Eyck  * \retval #PSA_ERROR_INVALID_ARGUMENT \emptydescription
205*b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
206*b0563631STom Van Eyck  */
207*b0563631STom Van Eyck psa_status_t mbedtls_psa_rsa_verify_hash(
208*b0563631STom Van Eyck     const psa_key_attributes_t *attributes,
209*b0563631STom Van Eyck     const uint8_t *key_buffer, size_t key_buffer_size,
210*b0563631STom Van Eyck     psa_algorithm_t alg, const uint8_t *hash, size_t hash_length,
211*b0563631STom Van Eyck     const uint8_t *signature, size_t signature_length);
212*b0563631STom Van Eyck 
213*b0563631STom Van Eyck /**
214*b0563631STom Van Eyck  * \brief Encrypt a short message with a public key.
215*b0563631STom Van Eyck  *
216*b0563631STom Van Eyck  * \param attributes            The attributes for the key to import.
217*b0563631STom Van Eyck  * \param key_buffer            Buffer where the key data is to be written.
218*b0563631STom Van Eyck  * \param key_buffer_size       Size of the \p key_buffer buffer in bytes.
219*b0563631STom Van Eyck  * \param input_length          Size of the \p input buffer in bytes.
220*b0563631STom Van Eyck  * \param[in] salt              A salt or label, if supported by the
221*b0563631STom Van Eyck  *                              encryption algorithm.
222*b0563631STom Van Eyck  *                              If the algorithm does not support a
223*b0563631STom Van Eyck  *                              salt, pass \c NULL.
224*b0563631STom Van Eyck  *                              If the algorithm supports an optional
225*b0563631STom Van Eyck  *                              salt and you do not want to pass a salt,
226*b0563631STom Van Eyck  *                              pass \c NULL.
227*b0563631STom Van Eyck  *
228*b0563631STom Van Eyck  *                              - For #PSA_ALG_RSA_PKCS1V15_CRYPT, no salt is
229*b0563631STom Van Eyck  *                                supported.
230*b0563631STom Van Eyck  * \param salt_length           Size of the \p salt buffer in bytes.
231*b0563631STom Van Eyck  *                              If \p salt is \c NULL, pass 0.
232*b0563631STom Van Eyck  * \param[out] output           Buffer where the encrypted message is to
233*b0563631STom Van Eyck  *                              be written.
234*b0563631STom Van Eyck  * \param output_size           Size of the \p output buffer in bytes.
235*b0563631STom Van Eyck  * \param[out] output_length    On success, the number of bytes
236*b0563631STom Van Eyck  *                              that make up the returned output.
237*b0563631STom Van Eyck  *
238*b0563631STom Van Eyck  * \retval #PSA_SUCCESS \emptydescription
239*b0563631STom Van Eyck  * \retval #PSA_ERROR_BUFFER_TOO_SMALL
240*b0563631STom Van Eyck  *         The size of the \p output buffer is too small. You can
241*b0563631STom Van Eyck  *         determine a sufficient buffer size by calling
242*b0563631STom Van Eyck  *         #PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(\c key_type, \c key_bits, \p alg)
243*b0563631STom Van Eyck  *         where \c key_type and \c key_bits are the type and bit-size
244*b0563631STom Van Eyck  *         respectively of \p key.
245*b0563631STom Van Eyck  * \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription
246*b0563631STom Van Eyck  * \retval #PSA_ERROR_INVALID_ARGUMENT \emptydescription
247*b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
248*b0563631STom Van Eyck  * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
249*b0563631STom Van Eyck  * \retval #PSA_ERROR_HARDWARE_FAILURE \emptydescription
250*b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
251*b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription
252*b0563631STom Van Eyck  * \retval #PSA_ERROR_BAD_STATE
253*b0563631STom Van Eyck  *         The library has not been previously initialized by psa_crypto_init().
254*b0563631STom Van Eyck  *         It is implementation-dependent whether a failure to initialize
255*b0563631STom Van Eyck  *         results in this error code.
256*b0563631STom Van Eyck  */
257*b0563631STom Van Eyck psa_status_t mbedtls_psa_asymmetric_encrypt(const psa_key_attributes_t *attributes,
258*b0563631STom Van Eyck                                             const uint8_t *key_buffer,
259*b0563631STom Van Eyck                                             size_t key_buffer_size,
260*b0563631STom Van Eyck                                             psa_algorithm_t alg,
261*b0563631STom Van Eyck                                             const uint8_t *input,
262*b0563631STom Van Eyck                                             size_t input_length,
263*b0563631STom Van Eyck                                             const uint8_t *salt,
264*b0563631STom Van Eyck                                             size_t salt_length,
265*b0563631STom Van Eyck                                             uint8_t *output,
266*b0563631STom Van Eyck                                             size_t output_size,
267*b0563631STom Van Eyck                                             size_t *output_length);
268*b0563631STom Van Eyck 
269*b0563631STom Van Eyck /**
270*b0563631STom Van Eyck  * \brief Decrypt a short message with a private key.
271*b0563631STom Van Eyck  *
272*b0563631STom Van Eyck  * \param attributes            The attributes for the key to import.
273*b0563631STom Van Eyck  * \param key_buffer            Buffer where the key data is to be written.
274*b0563631STom Van Eyck  * \param key_buffer_size       Size of the \p key_buffer buffer in bytes.
275*b0563631STom Van Eyck  * \param[in] input             The message to decrypt.
276*b0563631STom Van Eyck  * \param input_length          Size of the \p input buffer in bytes.
277*b0563631STom Van Eyck  * \param[in] salt              A salt or label, if supported by the
278*b0563631STom Van Eyck  *                              encryption algorithm.
279*b0563631STom Van Eyck  *                              If the algorithm does not support a
280*b0563631STom Van Eyck  *                              salt, pass \c NULL.
281*b0563631STom Van Eyck  *                              If the algorithm supports an optional
282*b0563631STom Van Eyck  *                              salt and you do not want to pass a salt,
283*b0563631STom Van Eyck  *                              pass \c NULL.
284*b0563631STom Van Eyck  *
285*b0563631STom Van Eyck  *                              - For #PSA_ALG_RSA_PKCS1V15_CRYPT, no salt is
286*b0563631STom Van Eyck  *                                supported.
287*b0563631STom Van Eyck  * \param salt_length           Size of the \p salt buffer in bytes.
288*b0563631STom Van Eyck  *                              If \p salt is \c NULL, pass 0.
289*b0563631STom Van Eyck  * \param[out] output           Buffer where the decrypted message is to
290*b0563631STom Van Eyck  *                              be written.
291*b0563631STom Van Eyck  * \param output_size           Size of the \c output buffer in bytes.
292*b0563631STom Van Eyck  * \param[out] output_length    On success, the number of bytes
293*b0563631STom Van Eyck  *                              that make up the returned output.
294*b0563631STom Van Eyck  *
295*b0563631STom Van Eyck  * \retval #PSA_SUCCESS \emptydescription
296*b0563631STom Van Eyck  * \retval #PSA_ERROR_BUFFER_TOO_SMALL
297*b0563631STom Van Eyck  *         The size of the \p output buffer is too small. You can
298*b0563631STom Van Eyck  *         determine a sufficient buffer size by calling
299*b0563631STom Van Eyck  *         #PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(\c key_type, \c key_bits, \p alg)
300*b0563631STom Van Eyck  *         where \c key_type and \c key_bits are the type and bit-size
301*b0563631STom Van Eyck  *         respectively of \p key.
302*b0563631STom Van Eyck  * \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription
303*b0563631STom Van Eyck  * \retval #PSA_ERROR_INVALID_ARGUMENT \emptydescription
304*b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
305*b0563631STom Van Eyck  * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
306*b0563631STom Van Eyck  * \retval #PSA_ERROR_HARDWARE_FAILURE \emptydescription
307*b0563631STom Van Eyck  * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
308*b0563631STom Van Eyck  * \retval #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription
309*b0563631STom Van Eyck  * \retval #PSA_ERROR_INVALID_PADDING \emptydescription
310*b0563631STom Van Eyck  * \retval #PSA_ERROR_BAD_STATE
311*b0563631STom Van Eyck  *         The library has not been previously initialized by psa_crypto_init().
312*b0563631STom Van Eyck  *         It is implementation-dependent whether a failure to initialize
313*b0563631STom Van Eyck  *         results in this error code.
314*b0563631STom Van Eyck  */
315*b0563631STom Van Eyck psa_status_t mbedtls_psa_asymmetric_decrypt(const psa_key_attributes_t *attributes,
316*b0563631STom Van Eyck                                             const uint8_t *key_buffer,
317*b0563631STom Van Eyck                                             size_t key_buffer_size,
318*b0563631STom Van Eyck                                             psa_algorithm_t alg,
319*b0563631STom Van Eyck                                             const uint8_t *input,
320*b0563631STom Van Eyck                                             size_t input_length,
321*b0563631STom Van Eyck                                             const uint8_t *salt,
322*b0563631STom Van Eyck                                             size_t salt_length,
323*b0563631STom Van Eyck                                             uint8_t *output,
324*b0563631STom Van Eyck                                             size_t output_size,
325*b0563631STom Van Eyck                                             size_t *output_length);
326*b0563631STom Van Eyck 
327*b0563631STom Van Eyck #endif /* PSA_CRYPTO_RSA_H */
328