Skip to content

Commit abe35bb

Browse files
committed
core: Upgrade TFM v1.2 related files
These files have been imported/copied from: * ARMmbed/trusted-firmware-m * ARMmbed/tf-m-tests These are generic files, which are required for TF-M v1.2 integration with Mbed OS for PSA_V8M and PSA_DUAL_CORE targets.
1 parent 701312a commit abe35bb

35 files changed

+2905
-611
lines changed

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_2/include/psa/client.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
2+
* Copyright (c) 2018-2020, Arm Limited. All rights reserved.
33
*
44
* SPDX-License-Identifier: BSD-3-Clause
55
*
@@ -126,7 +126,7 @@ psa_handle_t psa_connect(uint32_t sid, uint32_t version);
126126
* \brief Call an RoT Service on an established connection.
127127
*
128128
* \param[in] handle A handle to an established connection.
129-
* \param[in] type The reuqest type.
129+
* \param[in] type The request type.
130130
* Must be zero( \ref PSA_IPC_CALL) or positive.
131131
* \param[in] in_vec Array of input \ref psa_invec structures.
132132
* \param[in] in_len Number of input \ref psa_invec structures.

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_2/include/psa/crypto.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -723,11 +723,12 @@ psa_status_t psa_import_key(const psa_key_attributes_t *attributes,
723723
* where `m` is the bit size associated with the curve, i.e. the bit size
724724
* of the order of the curve's coordinate field. This byte string is
725725
* in little-endian order for Montgomery curves (curve types
726-
* `PSA_ECC_CURVE_CURVEXXX`), and in big-endian order for Weierstrass
727-
* curves (curve types `PSA_ECC_CURVE_SECTXXX`, `PSA_ECC_CURVE_SECPXXX`
728-
* and `PSA_ECC_CURVE_BRAINPOOL_PXXX`).
729-
* This is the content of the `privateKey` field of the `ECPrivateKey`
730-
* format defined by RFC 5915.
726+
* `PSA_ECC_FAMILY_CURVEXXX`), and in big-endian order for Weierstrass
727+
* curves (curve types `PSA_ECC_FAMILY_SECTXXX`, `PSA_ECC_FAMILY_SECPXXX`
728+
* and `PSA_ECC_FAMILY_BRAINPOOL_PXXX`).
729+
* For Weierstrass curves, this is the content of the `privateKey` field of
730+
* the `ECPrivateKey` format defined by RFC 5915. For Montgomery curves,
731+
* the format is defined by RFC 7748, and output is masked according to §5.
731732
* - For Diffie-Hellman key exchange key pairs (key types for which
732733
* #PSA_KEY_TYPE_IS_DH_KEY_PAIR is true), the
733734
* format is the representation of the private key `x` as a big-endian byte
@@ -920,7 +921,7 @@ psa_status_t psa_hash_compare(psa_algorithm_t alg,
920921
const uint8_t *input,
921922
size_t input_length,
922923
const uint8_t *hash,
923-
const size_t hash_length);
924+
size_t hash_length);
924925

925926
/** The type of the state data structure for multipart hash operations.
926927
*
@@ -1288,7 +1289,7 @@ psa_status_t psa_mac_verify(psa_key_handle_t handle,
12881289
const uint8_t *input,
12891290
size_t input_length,
12901291
const uint8_t *mac,
1291-
const size_t mac_length);
1292+
size_t mac_length);
12921293

12931294
/** The type of the state data structure for multipart MAC operations.
12941295
*
@@ -3490,10 +3491,10 @@ psa_status_t psa_key_derivation_output_bytes(
34903491
* length is determined by the curve, and sets the mandatory bits
34913492
* accordingly. That is:
34923493
*
3493-
* - #PSA_ECC_CURVE_CURVE25519: draw a 32-byte string
3494-
* and process it as specified in RFC 7748 §5.
3495-
* - #PSA_ECC_CURVE_CURVE448: draw a 56-byte string
3496-
* and process it as specified in RFC 7748 §5.
3494+
* - Curve25519 (#PSA_ECC_FAMILY_MONTGOMERY, 255 bits): draw a 32-byte
3495+
* string and process it as specified in RFC 7748 §5.
3496+
* - Curve448 (#PSA_ECC_FAMILY_MONTGOMERY, 448 bits): draw a 56-byte
3497+
* string and process it as specified in RFC 7748 §5.
34973498
*
34983499
* - For key types for which the key is represented by a single sequence of
34993500
* \p bits bits with constraints as to which bit sequences are acceptable,

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_2/include/psa/crypto_client_struct.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@ extern "C" {
3131
* data structure internally. */
3232
struct psa_client_key_attributes_s
3333
{
34-
uint32_t type;
3534
uint32_t lifetime;
3635
uint32_t id;
3736
uint32_t alg;
38-
uint32_t alg2;
3937
uint32_t usage;
40-
uint16_t bits;
38+
size_t bits;
39+
uint16_t type;
4140
};
4241

43-
#define PSA_CLIENT_KEY_ATTRIBUTES_INIT {0, 0, 0, 0, 0, 0, 0}
42+
#define PSA_CLIENT_KEY_ATTRIBUTES_INIT {0, 0, 0, 0, 0, 0}
4443

4544
#ifdef __cplusplus
4645
}

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_2/include/psa/crypto_compat.h

Lines changed: 119 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2019-2020, Arm Limited. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*
6+
*/
17
/**
28
* \file psa/crypto_compat.h
39
*
@@ -10,24 +16,6 @@
1016
* \note This file may not be included directly. Applications must
1117
* include psa/crypto.h.
1218
*/
13-
/*
14-
* Copyright (C) 2019-2020, ARM Limited, All Rights Reserved
15-
* SPDX-License-Identifier: Apache-2.0
16-
*
17-
* Licensed under the Apache License, Version 2.0 (the "License"); you may
18-
* not use this file except in compliance with the License.
19-
* You may obtain a copy of the License at
20-
*
21-
* http://www.apache.org/licenses/LICENSE-2.0
22-
*
23-
* Unless required by applicable law or agreed to in writing, software
24-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
25-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26-
* See the License for the specific language governing permissions and
27-
* limitations under the License.
28-
*
29-
* This file is part of mbed TLS (https://tls.mbed.org)
30-
*/
3119

3220
#ifndef PSA_CRYPTO_COMPAT_H
3321
#define PSA_CRYPTO_COMPAT_H
@@ -50,6 +38,13 @@ extern "C" {
5038
typedef MBEDTLS_PSA_DEPRECATED size_t mbedtls_deprecated_size_t;
5139
typedef MBEDTLS_PSA_DEPRECATED psa_status_t mbedtls_deprecated_psa_status_t;
5240
typedef MBEDTLS_PSA_DEPRECATED psa_key_usage_t mbedtls_deprecated_psa_key_usage_t;
41+
typedef MBEDTLS_PSA_DEPRECATED psa_ecc_family_t mbedtls_deprecated_psa_ecc_family_t;
42+
typedef MBEDTLS_PSA_DEPRECATED psa_dh_family_t mbedtls_deprecated_psa_dh_family_t;
43+
typedef MBEDTLS_PSA_DEPRECATED psa_ecc_family_t psa_ecc_curve_t;
44+
typedef MBEDTLS_PSA_DEPRECATED psa_dh_family_t psa_dh_group_t;
45+
46+
#define PSA_KEY_TYPE_GET_CURVE PSA_KEY_TYPE_ECC_GET_FAMILY
47+
#define PSA_KEY_TYPE_GET_GROUP PSA_KEY_TYPE_DH_GET_FAMILY
5348

5449
#define MBEDTLS_DEPRECATED_CONSTANT( type, value ) \
5550
( (mbedtls_deprecated_##type) ( value ) )
@@ -104,6 +99,112 @@ MBEDTLS_PSA_DEPRECATED psa_status_t psa_asymmetric_verify( psa_key_handle_t key,
10499

105100
#endif /* MBEDTLS_DEPRECATED_REMOVED */
106101

102+
/*
103+
* Size-specific elliptic curve families.
104+
*/
105+
#define PSA_ECC_CURVE_SECP160K1 \
106+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
107+
#define PSA_ECC_CURVE_SECP192K1 \
108+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
109+
#define PSA_ECC_CURVE_SECP224K1 \
110+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
111+
#define PSA_ECC_CURVE_SECP256K1 \
112+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
113+
#define PSA_ECC_CURVE_SECP160R1 \
114+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
115+
#define PSA_ECC_CURVE_SECP192R1 \
116+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
117+
#define PSA_ECC_CURVE_SECP224R1 \
118+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
119+
#define PSA_ECC_CURVE_SECP256R1 \
120+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
121+
#define PSA_ECC_CURVE_SECP384R1 \
122+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
123+
#define PSA_ECC_CURVE_SECP521R1 \
124+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
125+
#define PSA_ECC_CURVE_SECP160R2 \
126+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R2 )
127+
#define PSA_ECC_CURVE_SECT163K1 \
128+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
129+
#define PSA_ECC_CURVE_SECT233K1 \
130+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
131+
#define PSA_ECC_CURVE_SECT239K1 \
132+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
133+
#define PSA_ECC_CURVE_SECT283K1 \
134+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
135+
#define PSA_ECC_CURVE_SECT409K1 \
136+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
137+
#define PSA_ECC_CURVE_SECT571K1 \
138+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
139+
#define PSA_ECC_CURVE_SECT163R1 \
140+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
141+
#define PSA_ECC_CURVE_SECT193R1 \
142+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
143+
#define PSA_ECC_CURVE_SECT233R1 \
144+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
145+
#define PSA_ECC_CURVE_SECT283R1 \
146+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
147+
#define PSA_ECC_CURVE_SECT409R1 \
148+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
149+
#define PSA_ECC_CURVE_SECT571R1 \
150+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
151+
#define PSA_ECC_CURVE_SECT163R2 \
152+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R2 )
153+
#define PSA_ECC_CURVE_SECT193R2 \
154+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R2 )
155+
#define PSA_ECC_CURVE_BRAINPOOL_P256R1 \
156+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
157+
#define PSA_ECC_CURVE_BRAINPOOL_P384R1 \
158+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
159+
#define PSA_ECC_CURVE_BRAINPOOL_P512R1 \
160+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
161+
#define PSA_ECC_CURVE_CURVE25519 \
162+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_MONTGOMERY )
163+
#define PSA_ECC_CURVE_CURVE448 \
164+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_MONTGOMERY )
165+
166+
/*
167+
* Curves that changed name due to PSA specification.
168+
*/
169+
#define PSA_ECC_CURVE_SECP_K1 \
170+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
171+
#define PSA_ECC_CURVE_SECP_R1 \
172+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
173+
#define PSA_ECC_CURVE_SECP_R2 \
174+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R2 )
175+
#define PSA_ECC_CURVE_SECT_K1 \
176+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
177+
#define PSA_ECC_CURVE_SECT_R1 \
178+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
179+
#define PSA_ECC_CURVE_SECT_R2 \
180+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R2 )
181+
#define PSA_ECC_CURVE_BRAINPOOL_P_R1 \
182+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
183+
#define PSA_ECC_CURVE_MONTGOMERY \
184+
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_MONTGOMERY )
185+
186+
/*
187+
* Finite-field Diffie-Hellman families.
188+
*/
189+
#define PSA_DH_GROUP_FFDHE2048 \
190+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
191+
#define PSA_DH_GROUP_FFDHE3072 \
192+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
193+
#define PSA_DH_GROUP_FFDHE4096 \
194+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
195+
#define PSA_DH_GROUP_FFDHE6144 \
196+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
197+
#define PSA_DH_GROUP_FFDHE8192 \
198+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
199+
200+
/*
201+
* Diffie-Hellman families that changed name due to PSA specification.
202+
*/
203+
#define PSA_DH_GROUP_RFC7919 \
204+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
205+
#define PSA_DH_GROUP_CUSTOM \
206+
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_CUSTOM )
207+
107208
#ifdef __cplusplus
108209
}
109210
#endif

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_2/include/psa/crypto_extra.h

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern "C" {
3535
* string. The length of the byte string is the length of the base prime `p`
3636
* in bytes.
3737
*/
38-
#define PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t)0x60020000)
38+
#define PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t)0x4002)
3939

4040
/** DSA key pair (private and public key).
4141
*
@@ -53,48 +53,10 @@ extern "C" {
5353
* Add 1 to the resulting integer and use this as the private key *x*.
5454
*
5555
*/
56-
#define PSA_KEY_TYPE_DSA_KEY_PAIR ((psa_key_type_t)0x70020000)
56+
#define PSA_KEY_TYPE_DSA_KEY_PAIR ((psa_key_type_t)0x7002)
5757

5858
/**@}*/
5959

60-
/** \brief Declare the enrollment algorithm for a key.
61-
*
62-
* An operation on a key may indifferently use the algorithm set with
63-
* psa_set_key_algorithm() or with this function.
64-
*
65-
* \param[out] attributes The attribute structure to write to.
66-
* \param alg2 A second algorithm that the key may be used
67-
* for, in addition to the algorithm set with
68-
* psa_set_key_algorithm().
69-
*
70-
* \warning Setting an enrollment algorithm is not recommended, because
71-
* using the same key with different algorithms can allow some
72-
* attacks based on arithmetic relations between different
73-
* computations made with the same key, or can escalate harmless
74-
* side channels into exploitable ones. Use this function only
75-
* if it is necessary to support a protocol for which it has been
76-
* verified that the usage of the key with multiple algorithms
77-
* is safe.
78-
*/
79-
static inline void psa_set_key_enrollment_algorithm(
80-
psa_key_attributes_t *attributes,
81-
psa_algorithm_t alg2)
82-
{
83-
attributes->alg2 = alg2;
84-
}
85-
86-
/** Retrieve the enrollment algorithm policy from key attributes.
87-
*
88-
* \param[in] attributes The key attribute structure to query.
89-
*
90-
* \return The enrollment algorithm stored in the attribute structure.
91-
*/
92-
static inline psa_algorithm_t psa_get_key_enrollment_algorithm(
93-
const psa_key_attributes_t *attributes)
94-
{
95-
return attributes->alg2;
96-
}
97-
9860
#ifdef __cplusplus
9961
}
10062
#endif

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_2/include/psa/crypto_sizes.h

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -133,51 +133,9 @@
133133
* operations, and does not need to accept all key sizes up to the limit. */
134134
#define PSA_VENDOR_RSA_MAX_KEY_BITS 4096
135135

136-
/* The maximum size of an ECC key on this implementation, in bits.
137-
* This is a vendor-specific macro. */
136+
/* The maximum size of an ECC key on this implementation, in bits */
138137
#define PSA_VENDOR_ECC_MAX_CURVE_BITS 521
139138

140-
/** Bit size associated with an elliptic curve.
141-
*
142-
* \param curve An elliptic curve (value of type #psa_ecc_curve_t).
143-
*
144-
* \return The size associated with \p curve, in bits.
145-
* This may be 0 if the implementation does not support
146-
* the specified curve.
147-
*/
148-
#define PSA_ECC_CURVE_BITS(curve) \
149-
((curve) == PSA_ECC_CURVE_SECT163K1 ? 163 : \
150-
(curve) == PSA_ECC_CURVE_SECT163R1 ? 163 : \
151-
(curve) == PSA_ECC_CURVE_SECT163R2 ? 163 : \
152-
(curve) == PSA_ECC_CURVE_SECT193R1 ? 193 : \
153-
(curve) == PSA_ECC_CURVE_SECT193R2 ? 193 : \
154-
(curve) == PSA_ECC_CURVE_SECT233K1 ? 233 : \
155-
(curve) == PSA_ECC_CURVE_SECT233R1 ? 233 : \
156-
(curve) == PSA_ECC_CURVE_SECT239K1 ? 239 : \
157-
(curve) == PSA_ECC_CURVE_SECT283K1 ? 283 : \
158-
(curve) == PSA_ECC_CURVE_SECT283R1 ? 283 : \
159-
(curve) == PSA_ECC_CURVE_SECT409K1 ? 409 : \
160-
(curve) == PSA_ECC_CURVE_SECT409R1 ? 409 : \
161-
(curve) == PSA_ECC_CURVE_SECT571K1 ? 571 : \
162-
(curve) == PSA_ECC_CURVE_SECT571R1 ? 571 : \
163-
(curve) == PSA_ECC_CURVE_SECP160K1 ? 160 : \
164-
(curve) == PSA_ECC_CURVE_SECP160R1 ? 160 : \
165-
(curve) == PSA_ECC_CURVE_SECP160R2 ? 160 : \
166-
(curve) == PSA_ECC_CURVE_SECP192K1 ? 192 : \
167-
(curve) == PSA_ECC_CURVE_SECP192R1 ? 192 : \
168-
(curve) == PSA_ECC_CURVE_SECP224K1 ? 224 : \
169-
(curve) == PSA_ECC_CURVE_SECP224R1 ? 224 : \
170-
(curve) == PSA_ECC_CURVE_SECP256K1 ? 256 : \
171-
(curve) == PSA_ECC_CURVE_SECP256R1 ? 256 : \
172-
(curve) == PSA_ECC_CURVE_SECP384R1 ? 384 : \
173-
(curve) == PSA_ECC_CURVE_SECP521R1 ? 521 : \
174-
(curve) == PSA_ECC_CURVE_BRAINPOOL_P256R1 ? 256 : \
175-
(curve) == PSA_ECC_CURVE_BRAINPOOL_P384R1 ? 384 : \
176-
(curve) == PSA_ECC_CURVE_BRAINPOOL_P512R1 ? 512 : \
177-
(curve) == PSA_ECC_CURVE_CURVE25519 ? 255 : \
178-
(curve) == PSA_ECC_CURVE_CURVE448 ? 448 : \
179-
0)
180-
181139
/** \def PSA_ALG_TLS12_PSK_TO_MS_MAX_PSK_LEN
182140
*
183141
* This macro returns the maximum length of the PSK supported
@@ -419,7 +377,7 @@
419377
* \param key_type An asymmetric key type (this may indifferently be a
420378
* key pair type or a public key type).
421379
* \param key_bits The size of the key in bits.
422-
* \param alg The signature algorithm.
380+
* \param alg The asymmetric encryption algorithm.
423381
*
424382
* \return If the parameters are valid and supported, return
425383
* a buffer size in bytes that guarantees that
@@ -438,9 +396,9 @@
438396

439397
/** Sufficient output buffer size for psa_asymmetric_decrypt().
440398
*
441-
* This macro returns a sufficient buffer size for a ciphertext produced using
399+
* This macro returns a sufficient buffer size for a plaintext produced using
442400
* a key of the specified type and size, with the specified algorithm.
443-
* Note that the actual size of the ciphertext may be smaller, depending
401+
* Note that the actual size of the plaintext may be smaller, depending
444402
* on the algorithm.
445403
*
446404
* \warning This function may call its arguments multiple times or
@@ -450,7 +408,7 @@
450408
* \param key_type An asymmetric key type (this may indifferently be a
451409
* key pair type or a public key type).
452410
* \param key_bits The size of the key in bits.
453-
* \param alg The signature algorithm.
411+
* \param alg The asymmetric encryption algorithm.
454412
*
455413
* \return If the parameters are valid and supported, return
456414
* a buffer size in bytes that guarantees that

0 commit comments

Comments
 (0)