Skip to content

Commit 6623c5b

Browse files
committed
Update PSA services for v7 single-core targets
1 parent f8b3221 commit 6623c5b

24 files changed

+1303
-732
lines changed

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/inc/psa/crypto.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* \brief Platform Security Architecture cryptography module
44
*/
55
/*
6-
* Copyright (C) 2018, ARM Limited, All Rights Reserved
6+
* Copyright The Mbed TLS Contributors
77
* SPDX-License-Identifier: Apache-2.0
88
*
99
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -735,11 +735,12 @@ psa_status_t psa_import_key(const psa_key_attributes_t *attributes,
735735
* where `m` is the bit size associated with the curve, i.e. the bit size
736736
* of the order of the curve's coordinate field. This byte string is
737737
* in little-endian order for Montgomery curves (curve types
738-
* `PSA_ECC_CURVE_CURVEXXX`), and in big-endian order for Weierstrass
739-
* curves (curve types `PSA_ECC_CURVE_SECTXXX`, `PSA_ECC_CURVE_SECPXXX`
740-
* and `PSA_ECC_CURVE_BRAINPOOL_PXXX`).
741-
* This is the content of the `privateKey` field of the `ECPrivateKey`
742-
* format defined by RFC 5915.
738+
* `PSA_ECC_FAMILY_CURVEXXX`), and in big-endian order for Weierstrass
739+
* curves (curve types `PSA_ECC_FAMILY_SECTXXX`, `PSA_ECC_FAMILY_SECPXXX`
740+
* and `PSA_ECC_FAMILY_BRAINPOOL_PXXX`).
741+
* For Weierstrass curves, this is the content of the `privateKey` field of
742+
* the `ECPrivateKey` format defined by RFC 5915. For Montgomery curves,
743+
* the format is defined by RFC 7748, and output is masked according to §5.
743744
* - For Diffie-Hellman key exchange key pairs (key types for which
744745
* #PSA_KEY_TYPE_IS_DH_KEY_PAIR is true), the
745746
* format is the representation of the private key `x` as a big-endian byte
@@ -3502,9 +3503,9 @@ psa_status_t psa_key_derivation_output_bytes(
35023503
* length is determined by the curve, and sets the mandatory bits
35033504
* accordingly. That is:
35043505
*
3505-
* - Curve25519 (#PSA_ECC_CURVE_MONTGOMERY, 255 bits): draw a 32-byte
3506+
* - Curve25519 (#PSA_ECC_FAMILY_MONTGOMERY, 255 bits): draw a 32-byte
35063507
* string and process it as specified in RFC 7748 §5.
3507-
* - Curve448 (#PSA_ECC_CURVE_MONTGOMERY, 448 bits): draw a 56-byte
3508+
* - Curve448 (#PSA_ECC_FAMILY_MONTGOMERY, 448 bits): draw a 56-byte
35083509
* string and process it as specified in RFC 7748 §5.
35093510
*
35103511
* - For key types for which the key is represented by a single sequence of

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/inc/psa/crypto_accel_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
/*
17-
* Copyright (C) 2018, ARM Limited, All Rights Reserved
17+
* Copyright The Mbed TLS Contributors
1818
* SPDX-License-Identifier: Apache-2.0
1919
*
2020
* Licensed under the Apache License, Version 2.0 (the "License"); you may

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/inc/psa/crypto_compat.h

Lines changed: 75 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* include psa/crypto.h.
1212
*/
1313
/*
14-
* Copyright (C) 2019, ARM Limited, All Rights Reserved
14+
* Copyright The Mbed TLS Contributors
1515
* SPDX-License-Identifier: Apache-2.0
1616
*
1717
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -25,8 +25,6 @@
2525
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2626
* See the License for the specific language governing permissions and
2727
* limitations under the License.
28-
*
29-
* This file is part of mbed TLS (https://tls.mbed.org)
3028
*/
3129

3230
#ifndef PSA_CRYPTO_COMPAT_H
@@ -50,8 +48,13 @@ extern "C" {
5048
typedef MBEDTLS_PSA_DEPRECATED size_t mbedtls_deprecated_size_t;
5149
typedef MBEDTLS_PSA_DEPRECATED psa_status_t mbedtls_deprecated_psa_status_t;
5250
typedef MBEDTLS_PSA_DEPRECATED psa_key_usage_t mbedtls_deprecated_psa_key_usage_t;
53-
typedef MBEDTLS_PSA_DEPRECATED psa_ecc_curve_t mbedtls_deprecated_psa_ecc_curve_t;
54-
typedef MBEDTLS_PSA_DEPRECATED psa_dh_group_t mbedtls_deprecated_psa_dh_group_t;
51+
typedef MBEDTLS_PSA_DEPRECATED psa_ecc_family_t mbedtls_deprecated_psa_ecc_family_t;
52+
typedef MBEDTLS_PSA_DEPRECATED psa_dh_family_t mbedtls_deprecated_psa_dh_family_t;
53+
typedef MBEDTLS_PSA_DEPRECATED psa_ecc_family_t psa_ecc_curve_t;
54+
typedef MBEDTLS_PSA_DEPRECATED psa_dh_family_t psa_dh_group_t;
55+
56+
#define PSA_KEY_TYPE_GET_CURVE PSA_KEY_TYPE_ECC_GET_FAMILY
57+
#define PSA_KEY_TYPE_GET_GROUP PSA_KEY_TYPE_DH_GET_FAMILY
5558

5659
#define MBEDTLS_DEPRECATED_CONSTANT( type, value ) \
5760
( (mbedtls_deprecated_##type) ( value ) )
@@ -115,79 +118,110 @@ MBEDTLS_PSA_DEPRECATED static inline psa_status_t psa_asymmetric_verify( psa_key
115118
#endif /* MBEDTLS_DEPRECATED_REMOVED */
116119

117120
/*
118-
* Size-specific elliptic curve and Diffie-Hellman group names
121+
* Size-specific elliptic curve families.
119122
*/
120123
#define PSA_ECC_CURVE_SECP160K1 \
121-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_K1 )
124+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
122125
#define PSA_ECC_CURVE_SECP192K1 \
123-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_K1 )
126+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
124127
#define PSA_ECC_CURVE_SECP224K1 \
125-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_K1 )
128+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
126129
#define PSA_ECC_CURVE_SECP256K1 \
127-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_K1 )
130+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
128131
#define PSA_ECC_CURVE_SECP160R1 \
129-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_R1 )
132+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
130133
#define PSA_ECC_CURVE_SECP192R1 \
131-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_R1 )
134+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
132135
#define PSA_ECC_CURVE_SECP224R1 \
133-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_R1 )
136+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
134137
#define PSA_ECC_CURVE_SECP256R1 \
135-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_R1 )
138+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
136139
#define PSA_ECC_CURVE_SECP384R1 \
137-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_R1 )
140+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
138141
#define PSA_ECC_CURVE_SECP521R1 \
139-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_R1 )
142+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
140143
#define PSA_ECC_CURVE_SECP160R2 \
141-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECP_R2 )
144+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R2 )
142145
#define PSA_ECC_CURVE_SECT163K1 \
143-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_K1 )
146+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
144147
#define PSA_ECC_CURVE_SECT233K1 \
145-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_K1 )
148+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
146149
#define PSA_ECC_CURVE_SECT239K1 \
147-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_K1 )
150+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
148151
#define PSA_ECC_CURVE_SECT283K1 \
149-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_K1 )
152+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
150153
#define PSA_ECC_CURVE_SECT409K1 \
151-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_K1 )
154+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
152155
#define PSA_ECC_CURVE_SECT571K1 \
153-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_K1 )
156+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
154157
#define PSA_ECC_CURVE_SECT163R1 \
155-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_R1 )
158+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
156159
#define PSA_ECC_CURVE_SECT193R1 \
157-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_R1 )
160+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
158161
#define PSA_ECC_CURVE_SECT233R1 \
159-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_R1 )
162+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
160163
#define PSA_ECC_CURVE_SECT283R1 \
161-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_R1 )
164+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
162165
#define PSA_ECC_CURVE_SECT409R1 \
163-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_R1 )
166+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
164167
#define PSA_ECC_CURVE_SECT571R1 \
165-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_R1 )
168+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
166169
#define PSA_ECC_CURVE_SECT163R2 \
167-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_R2 )
170+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R2 )
168171
#define PSA_ECC_CURVE_SECT193R2 \
169-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_SECT_R2 )
172+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R2 )
170173
#define PSA_ECC_CURVE_BRAINPOOL_P256R1 \
171-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_BRAINPOOL_P_R1 )
174+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
172175
#define PSA_ECC_CURVE_BRAINPOOL_P384R1 \
173-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_BRAINPOOL_P_R1 )
176+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
174177
#define PSA_ECC_CURVE_BRAINPOOL_P512R1 \
175-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_BRAINPOOL_P_R1 )
178+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
176179
#define PSA_ECC_CURVE_CURVE25519 \
177-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_MONTGOMERY )
180+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_MONTGOMERY )
178181
#define PSA_ECC_CURVE_CURVE448 \
179-
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_curve_t, PSA_ECC_CURVE_MONTGOMERY )
182+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_MONTGOMERY )
183+
184+
/*
185+
* Curves that changed name due to PSA specification.
186+
*/
187+
#define PSA_ECC_CURVE_SECP_K1 \
188+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
189+
#define PSA_ECC_CURVE_SECP_R1 \
190+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
191+
#define PSA_ECC_CURVE_SECP_R2 \
192+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R2 )
193+
#define PSA_ECC_CURVE_SECT_K1 \
194+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
195+
#define PSA_ECC_CURVE_SECT_R1 \
196+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
197+
#define PSA_ECC_CURVE_SECT_R2 \
198+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R2 )
199+
#define PSA_ECC_CURVE_BRAINPOOL_P_R1 \
200+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
201+
#define PSA_ECC_CURVE_MONTGOMERY \
202+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_MONTGOMERY )
180203

204+
/*
205+
* Finite-field Diffie-Hellman families.
206+
*/
181207
#define PSA_DH_GROUP_FFDHE2048 \
182-
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_group_t, PSA_DH_GROUP_RFC7919 )
208+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
183209
#define PSA_DH_GROUP_FFDHE3072 \
184-
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_group_t, PSA_DH_GROUP_RFC7919 )
210+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
185211
#define PSA_DH_GROUP_FFDHE4096 \
186-
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_group_t, PSA_DH_GROUP_RFC7919 )
212+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
187213
#define PSA_DH_GROUP_FFDHE6144 \
188-
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_group_t, PSA_DH_GROUP_RFC7919 )
214+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
189215
#define PSA_DH_GROUP_FFDHE8192 \
190-
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_group_t, PSA_DH_GROUP_RFC7919 )
216+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
217+
218+
/*
219+
* Diffie-Hellman families that changed name due to PSA specification.
220+
*/
221+
#define PSA_DH_GROUP_RFC7919 \
222+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
223+
#define PSA_DH_GROUP_CUSTOM \
224+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_CUSTOM )
191225

192226
#ifdef __cplusplus
193227
}

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/inc/psa/crypto_driver_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818

1919
/*
20-
* Copyright (C) 2018, ARM Limited, All Rights Reserved
20+
* Copyright The Mbed TLS Contributors
2121
* SPDX-License-Identifier: Apache-2.0
2222
*
2323
* Licensed under the Apache License, Version 2.0 (the "License"); you may

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/inc/psa/crypto_entropy_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313

1414
/*
15-
* Copyright (C) 2018, ARM Limited, All Rights Reserved
15+
* Copyright The Mbed TLS Contributors
1616
* SPDX-License-Identifier: Apache-2.0
1717
*
1818
* Licensed under the Apache License, Version 2.0 (the "License"); you may

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/inc/psa/crypto_extra.h

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* This file is reserved for vendor-specific definitions.
1010
*/
1111
/*
12-
* Copyright (C) 2018, ARM Limited, All Rights Reserved
12+
* Copyright The Mbed TLS Contributors
1313
* SPDX-License-Identifier: Apache-2.0
1414
*
1515
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -23,8 +23,6 @@
2323
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2424
* See the License for the specific language governing permissions and
2525
* limitations under the License.
26-
*
27-
* This file is part of mbed TLS (https://tls.mbed.org)
2826
*/
2927

3028
#ifndef PSA_CRYPTO_EXTRA_H
@@ -414,11 +412,11 @@ psa_status_t mbedtls_psa_inject_entropy(const uint8_t *seed,
414412

415413
/** Custom Diffie-Hellman group.
416414
*
417-
* For keys of type #PSA_KEY_TYPE_DH_PUBLIC_KEY(#PSA_DH_GROUP_CUSTOM) or
418-
* #PSA_KEY_TYPE_DH_KEY_PAIR(#PSA_DH_GROUP_CUSTOM), the group data comes
415+
* For keys of type #PSA_KEY_TYPE_DH_PUBLIC_KEY(#PSA_DH_FAMILY_CUSTOM) or
416+
* #PSA_KEY_TYPE_DH_KEY_PAIR(#PSA_DH_FAMILY_CUSTOM), the group data comes
419417
* from domain parameters set by psa_set_key_domain_parameters().
420418
*/
421-
#define PSA_DH_GROUP_CUSTOM ((psa_dh_group_t) 0x7e)
419+
#define PSA_DH_FAMILY_CUSTOM ((psa_dh_family_t) 0x7e)
422420

423421

424422
/**
@@ -448,8 +446,8 @@ psa_status_t mbedtls_psa_inject_entropy(const uint8_t *seed,
448446
* }
449447
* ```
450448
* - For Diffie-Hellman key exchange keys
451-
* (#PSA_KEY_TYPE_DH_PUBLIC_KEY(#PSA_DH_GROUP_CUSTOM) or
452-
* #PSA_KEY_TYPE_DH_KEY_PAIR(#PSA_DH_GROUP_CUSTOM)), the
449+
* (#PSA_KEY_TYPE_DH_PUBLIC_KEY(#PSA_DH_FAMILY_CUSTOM) or
450+
* #PSA_KEY_TYPE_DH_KEY_PAIR(#PSA_DH_FAMILY_CUSTOM)), the
453451
* `DomainParameters` format as defined by RFC 3279 §2.3.3.
454452
* ```
455453
* DomainParameters ::= SEQUENCE {
@@ -575,54 +573,55 @@ psa_status_t psa_get_key_domain_parameters(
575573
* \param[out] bits On success, the bit size of the curve.
576574
*
577575
* \return The corresponding PSA elliptic curve identifier
578-
* (`PSA_ECC_CURVE_xxx`).
576+
* (`PSA_ECC_FAMILY_xxx`).
579577
* \return \c 0 on failure (\p grpid is not recognized).
580578
*/
581-
static inline psa_ecc_curve_t mbedtls_ecc_group_to_psa( mbedtls_ecp_group_id grpid,
579+
static inline psa_ecc_family_t mbedtls_ecc_group_to_psa( mbedtls_ecp_group_id grpid,
582580
size_t *bits )
583581
{
584582
switch( grpid )
585583
{
586584
case MBEDTLS_ECP_DP_SECP192R1:
587585
*bits = 192;
588-
return( PSA_ECC_CURVE_SECP_R1 );
586+
return( PSA_ECC_FAMILY_SECP_R1 );
589587
case MBEDTLS_ECP_DP_SECP224R1:
590588
*bits = 224;
591-
return( PSA_ECC_CURVE_SECP_R1 );
589+
return( PSA_ECC_FAMILY_SECP_R1 );
592590
case MBEDTLS_ECP_DP_SECP256R1:
593591
*bits = 256;
594-
return( PSA_ECC_CURVE_SECP_R1 );
592+
return( PSA_ECC_FAMILY_SECP_R1 );
595593
case MBEDTLS_ECP_DP_SECP384R1:
596594
*bits = 384;
597-
return( PSA_ECC_CURVE_SECP_R1 );
595+
return( PSA_ECC_FAMILY_SECP_R1 );
598596
case MBEDTLS_ECP_DP_SECP521R1:
599597
*bits = 521;
600-
return( PSA_ECC_CURVE_SECP_R1 );
598+
return( PSA_ECC_FAMILY_SECP_R1 );
601599
case MBEDTLS_ECP_DP_BP256R1:
602600
*bits = 256;
603-
return( PSA_ECC_CURVE_BRAINPOOL_P_R1 );
601+
return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
604602
case MBEDTLS_ECP_DP_BP384R1:
605603
*bits = 384;
606-
return( PSA_ECC_CURVE_BRAINPOOL_P_R1 );
604+
return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
607605
case MBEDTLS_ECP_DP_BP512R1:
608606
*bits = 512;
609-
return( PSA_ECC_CURVE_BRAINPOOL_P_R1 );
607+
return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
610608
case MBEDTLS_ECP_DP_CURVE25519:
611609
*bits = 255;
612-
return( PSA_ECC_CURVE_MONTGOMERY );
610+
return( PSA_ECC_FAMILY_MONTGOMERY );
613611
case MBEDTLS_ECP_DP_SECP192K1:
614612
*bits = 192;
615-
return( PSA_ECC_CURVE_SECP_K1 );
613+
return( PSA_ECC_FAMILY_SECP_K1 );
616614
case MBEDTLS_ECP_DP_SECP224K1:
617615
*bits = 224;
618-
return( PSA_ECC_CURVE_SECP_K1 );
616+
return( PSA_ECC_FAMILY_SECP_K1 );
619617
case MBEDTLS_ECP_DP_SECP256K1:
620618
*bits = 256;
621-
return( PSA_ECC_CURVE_SECP_K1 );
619+
return( PSA_ECC_FAMILY_SECP_K1 );
622620
case MBEDTLS_ECP_DP_CURVE448:
623621
*bits = 448;
624-
return( PSA_ECC_CURVE_MONTGOMERY );
622+
return( PSA_ECC_FAMILY_MONTGOMERY );
625623
default:
624+
*bits = 0;
626625
return( 0 );
627626
}
628627
}
@@ -633,7 +632,7 @@ static inline psa_ecc_curve_t mbedtls_ecc_group_to_psa( mbedtls_ecp_group_id grp
633632
* Mbed TLS and may be removed at any time without notice.
634633
*
635634
* \param curve A PSA elliptic curve identifier
636-
* (`PSA_ECC_CURVE_xxx`).
635+
* (`PSA_ECC_FAMILY_xxx`).
637636
* \param byte_length The byte-length of a private key on \p curve.
638637
*
639638
* \return The corresponding Mbed TLS elliptic curve identifier
@@ -642,7 +641,7 @@ static inline psa_ecc_curve_t mbedtls_ecc_group_to_psa( mbedtls_ecp_group_id grp
642641
* \return #MBEDTLS_ECP_DP_NONE if \p byte_length is not
643642
* correct for \p curve.
644643
*/
645-
mbedtls_ecp_group_id mbedtls_ecc_group_of_psa( psa_ecc_curve_t curve,
644+
mbedtls_ecp_group_id mbedtls_ecc_group_of_psa( psa_ecc_family_t curve,
646645
size_t byte_length );
647646
#endif /* MBEDTLS_ECP_C */
648647

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/inc/psa/crypto_platform.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* module implements.
1515
*/
1616
/*
17-
* Copyright (C) 2018, ARM Limited, All Rights Reserved
17+
* Copyright The Mbed TLS Contributors
1818
* SPDX-License-Identifier: Apache-2.0
1919
*
2020
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -28,8 +28,6 @@
2828
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2929
* See the License for the specific language governing permissions and
3030
* limitations under the License.
31-
*
32-
* This file is part of mbed TLS (https://tls.mbed.org)
3331
*/
3432

3533
#ifndef PSA_CRYPTO_PLATFORM_H

0 commit comments

Comments
 (0)