mbed TLS v3.1.0
psa_util.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright The Mbed TLS Contributors
11  * SPDX-License-Identifier: Apache-2.0
12  *
13  * Licensed under the Apache License, Version 2.0 (the "License"); you may
14  * not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
21  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25 
26 #ifndef MBEDTLS_PSA_UTIL_H
27 #define MBEDTLS_PSA_UTIL_H
28 #include "mbedtls/private_access.h"
29 
30 #include "mbedtls/build_info.h"
31 
32 #if defined(MBEDTLS_USE_PSA_CRYPTO)
33 
34 #include "psa/crypto.h"
35 
36 #include "mbedtls/ecp.h"
37 #include "mbedtls/md.h"
38 #include "mbedtls/pk.h"
39 #include "mbedtls/oid.h"
40 #include "mbedtls/error.h"
41 
42 #include <string.h>
43 
44 /* Translations for symmetric crypto. */
45 
47  mbedtls_cipher_type_t cipher )
48 {
49  switch( cipher )
50  {
66  return( PSA_KEY_TYPE_AES );
67 
68  /* ARIA not yet supported in PSA. */
69  /* case MBEDTLS_CIPHER_ARIA_128_CCM:
70  case MBEDTLS_CIPHER_ARIA_192_CCM:
71  case MBEDTLS_CIPHER_ARIA_256_CCM:
72  case MBEDTLS_CIPHER_ARIA_128_CCM_STAR_NO_TAG:
73  case MBEDTLS_CIPHER_ARIA_192_CCM_STAR_NO_TAG:
74  case MBEDTLS_CIPHER_ARIA_256_CCM_STAR_NO_TAG:
75  case MBEDTLS_CIPHER_ARIA_128_GCM:
76  case MBEDTLS_CIPHER_ARIA_192_GCM:
77  case MBEDTLS_CIPHER_ARIA_256_GCM:
78  case MBEDTLS_CIPHER_ARIA_128_CBC:
79  case MBEDTLS_CIPHER_ARIA_192_CBC:
80  case MBEDTLS_CIPHER_ARIA_256_CBC:
81  return( PSA_KEY_TYPE_ARIA ); */
82 
83  default:
84  return( 0 );
85  }
86 }
87 
89  mbedtls_cipher_mode_t mode, size_t taglen )
90 {
91  switch( mode )
92  {
93  case MBEDTLS_MODE_ECB:
94  return( PSA_ALG_ECB_NO_PADDING );
95  case MBEDTLS_MODE_GCM:
96  return( PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_GCM, taglen ) );
97  case MBEDTLS_MODE_CCM:
98  return( PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_CCM, taglen ) );
101  case MBEDTLS_MODE_CBC:
102  if( taglen == 0 )
103  return( PSA_ALG_CBC_NO_PADDING );
104  else
105  return( 0 );
106  default:
107  return( 0 );
108  }
109 }
110 
113 {
114  switch( op )
115  {
116  case MBEDTLS_ENCRYPT:
117  return( PSA_KEY_USAGE_ENCRYPT );
118  case MBEDTLS_DECRYPT:
119  return( PSA_KEY_USAGE_DECRYPT );
120  default:
121  return( 0 );
122  }
123 }
124 
125 /* Translations for hashing. */
126 
128 {
129  switch( md_alg )
130  {
131 #if defined(MBEDTLS_MD5_C)
132  case MBEDTLS_MD_MD5:
133  return( PSA_ALG_MD5 );
134 #endif
135 #if defined(MBEDTLS_SHA1_C)
136  case MBEDTLS_MD_SHA1:
137  return( PSA_ALG_SHA_1 );
138 #endif
139 #if defined(MBEDTLS_SHA224_C)
140  case MBEDTLS_MD_SHA224:
141  return( PSA_ALG_SHA_224 );
142 #endif
143 #if defined(MBEDTLS_SHA256_C)
144  case MBEDTLS_MD_SHA256:
145  return( PSA_ALG_SHA_256 );
146 #endif
147 #if defined(MBEDTLS_SHA384_C)
148  case MBEDTLS_MD_SHA384:
149  return( PSA_ALG_SHA_384 );
150 #endif
151 #if defined(MBEDTLS_SHA512_C)
152  case MBEDTLS_MD_SHA512:
153  return( PSA_ALG_SHA_512 );
154 #endif
155 #if defined(MBEDTLS_RIPEMD160_C)
157  return( PSA_ALG_RIPEMD160 );
158 #endif
159  case MBEDTLS_MD_NONE:
160  return( 0 );
161  default:
162  return( 0 );
163  }
164 }
165 
166 /* Translations for ECC. */
167 
169  psa_ecc_family_t curve, size_t bits,
170  char const **oid, size_t *oid_len )
171 {
172  switch( curve )
173  {
175  switch( bits )
176  {
177 #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
178  case 192:
181  return( 0 );
182 #endif /* MBEDTLS_ECP_DP_SECP192R1_ENABLED */
183 #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
184  case 224:
187  return( 0 );
188 #endif /* MBEDTLS_ECP_DP_SECP224R1_ENABLED */
189 #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
190  case 256:
193  return( 0 );
194 #endif /* MBEDTLS_ECP_DP_SECP256R1_ENABLED */
195 #if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
196  case 384:
199  return( 0 );
200 #endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
201 #if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
202  case 521:
205  return( 0 );
206 #endif /* MBEDTLS_ECP_DP_SECP521R1_ENABLED */
207  }
208  break;
210  switch( bits )
211  {
212 #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
213  case 192:
216  return( 0 );
217 #endif /* MBEDTLS_ECP_DP_SECP192K1_ENABLED */
218 #if defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
219  case 224:
222  return( 0 );
223 #endif /* MBEDTLS_ECP_DP_SECP224K1_ENABLED */
224 #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
225  case 256:
228  return( 0 );
229 #endif /* MBEDTLS_ECP_DP_SECP256K1_ENABLED */
230  }
231  break;
233  switch( bits )
234  {
235 #if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
236  case 256:
239  return( 0 );
240 #endif /* MBEDTLS_ECP_DP_BP256R1_ENABLED */
241 #if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
242  case 384:
245  return( 0 );
246 #endif /* MBEDTLS_ECP_DP_BP384R1_ENABLED */
247 #if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
248  case 512:
251  return( 0 );
252 #endif /* MBEDTLS_ECP_DP_BP512R1_ENABLED */
253  }
254  break;
255  }
256  (void) oid;
257  (void) oid_len;
258  return( -1 );
259 }
260 
261 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH 1
262 
263 #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
264 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 192 + 7 ) / 8 ) + 1 )
265 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
266 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 192 + 7 ) / 8 ) + 1 )
267 #endif
268 #endif /* MBEDTLS_ECP_DP_SECP192R1_ENABLED */
269 
270 #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
271 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 224 + 7 ) / 8 ) + 1 )
272 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
273 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 224 + 7 ) / 8 ) + 1 )
274 #endif
275 #endif /* MBEDTLS_ECP_DP_SECP224R1_ENABLED */
276 
277 #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
278 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 256 + 7 ) / 8 ) + 1 )
279 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
280 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 256 + 7 ) / 8 ) + 1 )
281 #endif
282 #endif /* MBEDTLS_ECP_DP_SECP256R1_ENABLED */
283 
284 #if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
285 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 384 + 7 ) / 8 ) + 1 )
286 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
287 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 384 + 7 ) / 8 ) + 1 )
288 #endif
289 #endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
290 
291 #if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
292 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 521 + 7 ) / 8 ) + 1 )
293 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
294 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 521 + 7 ) / 8 ) + 1 )
295 #endif
296 #endif /* MBEDTLS_ECP_DP_SECP521R1_ENABLED */
297 
298 #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
299 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 192 + 7 ) / 8 ) + 1 )
300 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
301 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 192 + 7 ) / 8 ) + 1 )
302 #endif
303 #endif /* MBEDTLS_ECP_DP_SECP192K1_ENABLED */
304 
305 #if defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
306 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 224 + 7 ) / 8 ) + 1 )
307 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
308 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 224 + 7 ) / 8 ) + 1 )
309 #endif
310 #endif /* MBEDTLS_ECP_DP_SECP224K1_ENABLED */
311 
312 #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
313 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 256 + 7 ) / 8 ) + 1 )
314 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
315 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 256 + 7 ) / 8 ) + 1 )
316 #endif
317 #endif /* MBEDTLS_ECP_DP_SECP256K1_ENABLED */
318 
319 #if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
320 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 256 + 7 ) / 8 ) + 1 )
321 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
322 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 256 + 7 ) / 8 ) + 1 )
323 #endif
324 #endif /* MBEDTLS_ECP_DP_BP256R1_ENABLED */
325 
326 #if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
327 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 384 + 7 ) / 8 ) + 1 )
328 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
329 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 384 + 7 ) / 8 ) + 1 )
330 #endif
331 #endif /* MBEDTLS_ECP_DP_BP384R1_ENABLED */
332 
333 #if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
334 #if MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH < ( 2 * ( ( 512 + 7 ) / 8 ) + 1 )
335 #undef MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
336 #define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 512 + 7 ) / 8 ) + 1 )
337 #endif
338 #endif /* MBEDTLS_ECP_DP_BP512R1_ENABLED */
339 
340 
341 /* Translations for PK layer */
342 
343 static inline int mbedtls_psa_err_translate_pk( psa_status_t status )
344 {
345  switch( status )
346  {
347  case PSA_SUCCESS:
348  return( 0 );
352  return( MBEDTLS_ERR_PK_ALLOC_FAILED );
355  case PSA_ERROR_BAD_STATE:
357  /* All other failures */
362  default: /* We return the same as for the 'other failures',
363  * but list them separately nonetheless to indicate
364  * which failure conditions we have considered. */
366  }
367 }
368 
369 /* Translations for ECC */
370 
371 /* This function transforms an ECC group identifier from
372  * https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8
373  * into a PSA ECC group identifier. */
374 #if defined(MBEDTLS_ECP_C)
376  uint16_t tls_ecc_grp_reg_id, size_t *bits )
377 {
378  const mbedtls_ecp_curve_info *curve_info =
379  mbedtls_ecp_curve_info_from_tls_id( tls_ecc_grp_reg_id );
380  if( curve_info == NULL )
381  return( 0 );
383  mbedtls_ecc_group_to_psa( curve_info->grp_id, bits ) ) );
384 }
385 #endif /* MBEDTLS_ECP_C */
386 
387 /* This function takes a buffer holding an EC public key
388  * exported through psa_export_public_key(), and converts
389  * it into an ECPoint structure to be put into a ClientKeyExchange
390  * message in an ECDHE exchange.
391  *
392  * Both the present and the foreseeable future format of EC public keys
393  * used by PSA have the ECPoint structure contained in the exported key
394  * as a subbuffer, and the function merely selects this subbuffer instead
395  * of making a copy.
396  */
397 static inline int mbedtls_psa_tls_psa_ec_to_ecpoint( unsigned char *src,
398  size_t srclen,
399  unsigned char **dst,
400  size_t *dstlen )
401 {
402  *dst = src;
403  *dstlen = srclen;
404  return( 0 );
405 }
406 
407 /* This function takes a buffer holding an ECPoint structure
408  * (as contained in a TLS ServerKeyExchange message for ECDHE
409  * exchanges) and converts it into a format that the PSA key
410  * agreement API understands.
411  */
412 static inline int mbedtls_psa_tls_ecpoint_to_psa_ec( unsigned char const *src,
413  size_t srclen,
414  unsigned char *dst,
415  size_t dstlen,
416  size_t *olen )
417 {
418  if( srclen > dstlen )
420 
421  memcpy( dst, src, srclen );
422  *olen = srclen;
423  return( 0 );
424 }
425 
426 #endif /* MBEDTLS_USE_PSA_CRYPTO */
427 
428 /* Expose whatever RNG the PSA subsystem uses to applications using the
429  * mbedtls_xxx API. The declarations and definitions here need to be
430  * consistent with the implementation in library/psa_crypto_random_impl.h.
431  * See that file for implementation documentation. */
432 #if defined(MBEDTLS_PSA_CRYPTO_C)
433 
434 /* The type of a `f_rng` random generator function that many library functions
435  * take.
436  *
437  * This type name is not part of the Mbed TLS stable API. It may be renamed
438  * or moved without warning.
439  */
440 typedef int mbedtls_f_rng_t( void *p_rng, unsigned char *output, size_t output_size );
441 
442 #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
443 
479 int mbedtls_psa_get_random( void *p_rng,
480  unsigned char *output,
481  size_t output_size );
482 
493 #define MBEDTLS_PSA_RANDOM_STATE NULL
494 
495 #else /* !defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) */
496 
497 #if defined(MBEDTLS_CTR_DRBG_C)
498 #include "mbedtls/ctr_drbg.h"
499 typedef mbedtls_ctr_drbg_context mbedtls_psa_drbg_context_t;
501 #elif defined(MBEDTLS_HMAC_DRBG_C)
502 #include "mbedtls/hmac_drbg.h"
503 typedef mbedtls_hmac_drbg_context mbedtls_psa_drbg_context_t;
505 #endif
506 extern mbedtls_psa_drbg_context_t *const mbedtls_psa_random_state;
507 
508 #define MBEDTLS_PSA_RANDOM_STATE mbedtls_psa_random_state
509 
510 #endif /* !defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) */
511 
512 #endif /* MBEDTLS_PSA_CRYPTO_C */
513 
514 #endif /* MBEDTLS_PSA_UTIL_H */
static psa_ecc_family_t mbedtls_ecc_group_to_psa(mbedtls_ecp_group_id grpid, size_t *bits)
Definition: crypto_extra.h:593
The CTR_DRBG context structure.
Definition: ctr_drbg.h:170
mbedtls_operation_t
Definition: cipher.h:216
#define MBEDTLS_OID_EC_GRP_SECP192K1
Definition: oid.h:359
#define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
Definition: error.h:117
#define PSA_ERROR_COMMUNICATION_FAILURE
#define PSA_ALG_ECB_NO_PADDING
mbedtls_cipher_mode_t
Definition: cipher.h:189
static psa_key_type_t mbedtls_psa_translate_cipher_type(mbedtls_cipher_type_t cipher)
Definition: psa_util.h:46
#define PSA_SUCCESS
Definition: crypto_values.h:45
This file provides an API for Elliptic Curves over GF(P) (ECP).
Platform Security Architecture cryptography module.
#define MBEDTLS_OID_EC_GRP_SECP192R1
Definition: oid.h:339
int mbedtls_hmac_drbg_random(void *p_rng, unsigned char *output, size_t out_len)
This function uses HMAC_DRBG to generate random data.
int mbedtls_ctr_drbg_random(void *p_rng, unsigned char *output, size_t output_len)
This function uses CTR_DRBG to generate random data.
#define PSA_ALG_GCM
#define MBEDTLS_OID_EC_GRP_SECP384R1
Definition: oid.h:351
int mbedtls_psa_get_random(void *p_rng, unsigned char *output, size_t output_size)
#define PSA_ALG_SHA_256
mbedtls_cipher_type_t
Supported {cipher type, cipher mode} pairs.
Definition: cipher.h:101
Object Identifier (OID) database.
Public Key abstraction layer.
#define PSA_ALG_SHA_512
#define MBEDTLS_OID_SIZE(x)
Definition: asn1.h:125
#define PSA_ERROR_INSUFFICIENT_MEMORY
Error to string translation.
#define MBEDTLS_OID_EC_GRP_SECP256R1
Definition: oid.h:347
#define PSA_ALG_SHA_224
#define PSA_ALG_RIPEMD160
#define MBEDTLS_OID_EC_GRP_BP256R1
Definition: oid.h:378
int mbedtls_f_rng_t(void *p_rng, unsigned char *output, size_t output_size)
Definition: psa_util.h:440
static psa_key_usage_t mbedtls_psa_translate_cipher_operation(mbedtls_operation_t op)
Definition: psa_util.h:111
#define MBEDTLS_OID_EC_GRP_SECP224K1
Definition: oid.h:363
#define PSA_ALG_SHA_384
#define PSA_KEY_USAGE_DECRYPT
static int mbedtls_psa_get_ecc_oid_from_id(psa_ecc_family_t curve, size_t bits, char const **oid, size_t *oid_len)
Definition: psa_util.h:168
#define PSA_ALG_AEAD_WITH_SHORTENED_TAG(aead_alg, tag_length)
#define PSA_ALG_CBC_NO_PADDING
#define PSA_ECC_FAMILY_BRAINPOOL_P_R1
static psa_algorithm_t mbedtls_psa_translate_md(mbedtls_md_type_t md_alg)
Definition: psa_util.h:127
static int mbedtls_psa_err_translate_pk(psa_status_t status)
Definition: psa_util.h:343
#define MBEDTLS_OID_EC_GRP_BP512R1
Definition: oid.h:384
#define PSA_KEY_TYPE_ECC_KEY_PAIR(curve)
#define MBEDTLS_OID_EC_GRP_SECP521R1
Definition: oid.h:355
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: crypto_types.h:106
#define MBEDTLS_ERR_PK_ALLOC_FAILED
Definition: pk.h:53
#define PSA_ECC_FAMILY_SECP_R1
Macro wrapper for struct's memebrs.
#define MBEDTLS_ERR_PK_BAD_INPUT_DATA
Definition: pk.h:57
#define PSA_ERROR_CORRUPTION_DETECTED
uint32_t psa_key_usage_t
Encoding of permitted usage on a key.
Definition: crypto_types.h:251
#define PSA_KEY_TYPE_AES
uint16_t psa_key_type_t
Encoding of a key type.
Definition: crypto_types.h:74
Build-time configuration info.
const mbedtls_ecp_curve_info * mbedtls_ecp_curve_info_from_tls_id(uint16_t tls_id)
This function retrieves curve information from a TLS NamedCurve value.
#define MBEDTLS_OID_EC_GRP_SECP224R1
Definition: oid.h:343
static psa_algorithm_t mbedtls_psa_translate_cipher_mode(mbedtls_cipher_mode_t mode, size_t taglen)
Definition: psa_util.h:88
#define PSA_ERROR_HARDWARE_FAILURE
mbedtls_ecp_group_id grp_id
Definition: ecp.h:155
This file contains the generic message-digest wrapper.
#define PSA_ERROR_NOT_SUPPORTED
Definition: crypto_values.h:61
static int mbedtls_psa_tls_psa_ec_to_ecpoint(unsigned char *src, size_t srclen, unsigned char **dst, size_t *dstlen)
Definition: psa_util.h:397
#define PSA_ALG_CCM_STAR_NO_TAG
#define MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE
Definition: pk.h:77
#define PSA_ALG_CCM
static int mbedtls_psa_tls_ecpoint_to_psa_ec(unsigned char const *src, size_t srclen, unsigned char *dst, size_t dstlen, size_t *olen)
Definition: psa_util.h:412
#define MBEDTLS_OID_EC_GRP_BP384R1
Definition: oid.h:381
#define PSA_ECC_FAMILY_SECP_K1
#define MBEDTLS_OID_EC_GRP_SECP256K1
Definition: oid.h:367
#define PSA_ALG_SHA_1
#define PSA_ALG_MD5
#define PSA_ERROR_BAD_STATE
#define MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL
Definition: ecp.h:48
uint8_t psa_ecc_family_t
Definition: crypto_types.h:85
#define MBEDTLS_ERR_ECP_RANDOM_FAILED
Definition: ecp.h:56
mbedtls_md_type_t
Supported message digests.
Definition: md.h:55
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:63
#define PSA_KEY_USAGE_ENCRYPT
static psa_key_type_t mbedtls_psa_parse_tls_ecc_group(uint16_t tls_ecc_grp_reg_id, size_t *bits)
Definition: psa_util.h:375
#define PSA_ERROR_INSUFFICIENT_ENTROPY
This file contains definitions and functions for the CTR_DRBG pseudorandom generator.
The HMAC_DRBG pseudorandom generator.