You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/crypto/api/keys/policy.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ The following algorithm policies are supported:
33
33
* `PSA_ALG_NONE` does not permit any cryptographic operation with the key. The key can still be used for non-cryptographic actions such as exporting, if permitted by the usage flags.
34
34
* A specific algorithm value permits exactly that particular algorithm.
35
35
* A signature algorithm constructed with `PSA_ALG_ANY_HASH` permits the specified signature scheme with any hash algorithm. In addition, :code:`PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_ANY_HASH)` also permits the `PSA_ALG_RSA_PKCS1V15_SIGN_RAW` signature algorithm.
36
-
* A raw key agreement algorithm also permits the specified key agreement scheme to be combined with any key derivation algorithm.
36
+
* A standalone key agreement algorithm also permits the specified key agreement scheme to be combined with any key derivation algorithm.
37
37
* An algorithm built from `PSA_ALG_AT_LEAST_THIS_LENGTH_MAC()` permits any MAC algorithm from the same base class (for example, CMAC) which computes or verifies a MAC length greater than or equal to the length encoded in the wildcard algorithm.
38
38
* An algorithm built from `PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG()` permits any AEAD algorithm from the same base class (for example, CCM) which computes or verifies a tag length greater than or equal to the length encoded in the wildcard algorithm.
Copy file name to clipboardExpand all lines: doc/crypto/api/ops/ka.rst
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@
9
9
Key agreement
10
10
=============
11
11
12
-
Three functions are provided for a Diffie-Hellman-style key agreement where each party combines its own private key with the peer’s public key:
12
+
Three functions are provided for a Diffie-Hellman-style key agreement where each party combines its own private key with the peer’s public key, to produce a shared secret value:
13
13
14
14
* A call to `psa_key_agreement()` will compute the shared secret and store the result in a new derivation key.
15
15
@@ -34,7 +34,7 @@ Key agreement algorithms
34
34
.. summary::
35
35
The finite-field Diffie-Hellman (DH) key agreement algorithm.
36
36
37
-
This algorithm can be used directly in a call to `psa_key_agreement()` or `psa_raw_key_agreement()`, or combined with a key derivation operation using `PSA_ALG_KEY_AGREEMENT()` for use with `psa_key_derivation_key_agreement()`.
37
+
This standalone key agreement algorithm can be used directly in a call to `psa_key_agreement()` or `psa_raw_key_agreement()`, or combined with a key derivation operation using `PSA_ALG_KEY_AGREEMENT()` for use with `psa_key_derivation_key_agreement()`.
38
38
39
39
When used as a key's permitted-algorithm policy, the following uses are permitted:
40
40
@@ -57,7 +57,7 @@ Key agreement algorithms
57
57
.. summary::
58
58
The elliptic curve Diffie-Hellman (ECDH) key agreement algorithm.
59
59
60
-
This algorithm can be used directly in a call to `psa_key_agreement()` or `psa_raw_key_agreement()`, or combined with a key derivation operation using `PSA_ALG_KEY_AGREEMENT()` for use with `psa_key_derivation_key_agreement()`.
60
+
This standalone key agreement algorithm can be used directly in a call to `psa_key_agreement()` or `psa_raw_key_agreement()`, or combined with a key derivation operation using `PSA_ALG_KEY_AGREEMENT()` for use with `psa_key_derivation_key_agreement()`.
61
61
62
62
When used as a key's permitted-algorithm policy, the following uses are permitted:
63
63
@@ -116,7 +116,7 @@ Key agreement algorithms
116
116
117
117
.. subsection:: Compatible key types
118
118
119
-
The resulting combined key agreement algorithm is compatible with the same key types as the raw key agreement algorithm used to construct it.
119
+
The resulting combined key agreement algorithm is compatible with the same key types as the standalone key agreement algorithm used to construct it.
120
120
121
121
122
122
Standalone key agreement
@@ -131,7 +131,7 @@ Standalone key agreement
131
131
Identifier of the private key to use.
132
132
It must permit the usage `PSA_KEY_USAGE_DERIVE`.
133
133
.. param:: const uint8_t * peer_key
134
-
Public key of the peer. The peer key data is parsed with the type :code:`PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type)` where ``type`` is the type of ``private_key``, and with the same bit-size as ``private_key``. The peer key must be in the format that `psa_import_key()` accepts for this public key type. These formats are described in :secref:`key-formats`.
134
+
Public key of the peer. The peer key data is parsed with the type :code:`PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type)` where ``type`` is the type of ``private_key``, and with the same bit-size as ``private_key``. The peer key must be in the format that `psa_import_key()` accepts for this public key type. These formats are described in :secref:`key_formats`.
135
135
.. param:: size_t peer_key_length
136
136
Size of ``peer_key`` in bytes.
137
137
.. param:: psa_algorithm_t alg
@@ -206,38 +206,38 @@ Standalone key agreement
206
206
A key agreement algorithm takes two inputs: a private key ``private_key``, and a public key ``peer_key``. The result of this function is a shared secret, returned as a derivation key. This key can be input to a key derivation operation using `psa_key_derivation_input_key()`.
207
207
208
208
.. warning::
209
-
The raw result of a key agreement algorithm such as finite-field Diffie-Hellman or elliptic curve Diffie-Hellman has biases, and is not suitable for direct use as key material, for example, as an AES key. Instead it is recommended that the result is used as input to a key derivation algorithm.
209
+
The shared secret resulting from a key agreement algorithm such as finite-field Diffie-Hellman or elliptic curve Diffie-Hellman has biases. This makes it unsuitable for use as key material, for example, as an AES key. Instead, it is recommended that a key derivation algorithm is applied to the result, to derive unbiased cryptographic keys.
210
210
211
211
.. function:: psa_raw_key_agreement
212
212
213
213
.. summary::
214
-
Perform a key agreement and return the raw shared secret.
214
+
Perform a key agreement and return the shared secret.
215
215
216
216
.. param:: psa_algorithm_t alg
217
217
The key agreement algorithm to compute: a value of type `psa_algorithm_t` such that :code:`PSA_ALG_IS_RAW_KEY_AGREEMENT(alg)` is true.
218
218
.. param:: psa_key_id_t private_key
219
219
Identifier of the private key to use.
220
220
It must permit the usage `PSA_KEY_USAGE_DERIVE`.
221
221
.. param:: const uint8_t * peer_key
222
-
Public key of the peer. The peer key data is parsed with the type :code:`PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type)` where ``type`` is the type of ``private_key``, and with the same bit-size as ``private_key``. The peer key must be in the format that `psa_import_key()` accepts for this public key type. These formats are described in :secref:`key-formats`.
222
+
Public key of the peer. The peer key data is parsed with the type :code:`PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type)` where ``type`` is the type of ``private_key``, and with the same bit-size as ``private_key``. The peer key must be in the format that `psa_import_key()` accepts for this public key type. These formats are described in :secref:`key_formats`.
223
223
.. param:: size_t peer_key_length
224
224
Size of ``peer_key`` in bytes.
225
225
.. param:: uint8_t * output
226
-
Buffer where the raw shared secret is to be written.
226
+
Buffer where the shared secret is to be written.
227
227
.. param:: size_t output_size
228
228
Size of the ``output`` buffer in bytes.
229
229
This must be appropriate for the keys:
230
230
231
231
* The required output size is :code:`PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(type, bits)`, where ``type`` and ``bits`` are the type and bit-size of ``private_key``.
232
-
* `PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE` evaluates to the maximum output size of any supported raw key agreement algorithm.
232
+
* `PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE` evaluates to the maximum output size of any supported standalone key agreement algorithm.
233
233
234
234
.. param:: size_t * output_length
235
235
On success, the number of bytes that make up the returned output.
236
236
237
237
.. return:: psa_status_t
238
238
.. retval:: PSA_SUCCESS
239
239
Success.
240
-
The first ``(*output_length)`` bytes of ``output`` contain the raw shared secret.
240
+
The first ``(*output_length)`` bytes of ``output`` contain the shared secret.
241
241
.. retval:: PSA_ERROR_INVALID_HANDLE
242
242
``private_key`` is not a valid key identifier.
243
243
.. retval:: PSA_ERROR_NOT_PERMITTED
@@ -290,7 +290,7 @@ Combining key agreement and key derivation
290
290
Identifier of the private key to use.
291
291
It must permit the usage `PSA_KEY_USAGE_DERIVE`.
292
292
.. param:: const uint8_t * peer_key
293
-
Public key of the peer. The peer key data is parsed with the type :code:`PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type)` where ``type`` is the type of ``private_key``, and with the same bit-size as ``private_key``. The peer key must be in the format that `psa_import_key()` accepts for this public key type. These formats are described in :secref:`key-formats`.
293
+
Public key of the peer. The peer key data is parsed with the type :code:`PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type)` where ``type`` is the type of ``private_key``, and with the same bit-size as ``private_key``. The peer key must be in the format that `psa_import_key()` accepts for this public key type. These formats are described in :secref:`key_formats`.
294
294
.. param:: size_t peer_key_length
295
295
Size of ``peer_key`` in bytes.
296
296
@@ -339,13 +339,13 @@ Support macros
339
339
:definition: /* specification-defined value */
340
340
341
341
.. summary::
342
-
Get the raw key agreement algorithm from a full key agreement algorithm.
342
+
Get the standalone key agreement algorithm from a combined key agreement and key derivation algorithm.
343
343
344
344
.. param:: alg
345
345
A key agreement algorithm: a value of type `psa_algorithm_t` such that :code:`PSA_ALG_IS_KEY_AGREEMENT(alg)` is true.
346
346
347
347
.. return::
348
-
The underlying raw key agreement algorithm if ``alg`` is a key agreement algorithm.
348
+
The underlying standalone key agreement algorithm if ``alg`` is a key agreement algorithm.
349
349
350
350
Unspecified if ``alg`` is not a key agreement algorithm or if it is not supported by the implementation.
351
351
@@ -355,7 +355,7 @@ Support macros
355
355
:definition: /* specification-defined value */
356
356
357
357
.. summary::
358
-
Get the key derivation algorithm used in a full key agreement algorithm.
358
+
Get the key derivation algorithm used in a combined key agreement and key derivation algorithm.
359
359
360
360
.. param:: alg
361
361
A key agreement algorithm: a value of type `psa_algorithm_t` such that :code:`PSA_ALG_IS_KEY_AGREEMENT(alg)` is true.
@@ -371,17 +371,17 @@ Support macros
371
371
:definition: /* specification-defined value */
372
372
373
373
.. summary::
374
-
Whether the specified algorithm is a raw key agreement algorithm.
374
+
Whether the specified algorithm is a standalone key agreement algorithm.
375
375
376
376
.. param:: alg
377
377
An algorithm identifier: a value of type `psa_algorithm_t`.
378
378
379
379
.. return::
380
-
``1`` if ``alg`` is a raw key agreement algorithm, ``0`` otherwise. This macro can return either ``0`` or ``1`` if ``alg`` is not a supported algorithm identifier.
380
+
``1`` if ``alg`` is a standalone key agreement algorithm, ``0`` otherwise. This macro can return either ``0`` or ``1`` if ``alg`` is not a supported algorithm identifier.
381
381
382
-
A raw key agreement algorithm is one that does not specify a key derivation function. Usually, raw key agreement algorithms are constructed directly with a ``PSA_ALG_xxx`` macro while non-raw key agreement algorithms are constructed with `PSA_ALG_KEY_AGREEMENT()`.
382
+
A standalone key agreement algorithm is one that does not specify a key derivation function. Usually, standalone key agreement algorithms are constructed directly with a ``PSA_ALG_xxx`` macro while combined key agreement algorithms are constructed with `PSA_ALG_KEY_AGREEMENT()`.
383
383
384
-
The raw key agreement algorithm can be extracted from a full key agreement algorithm identifier using `PSA_ALG_KEY_AGREEMENT_GET_BASE()`.
384
+
The standalone key agreement algorithm can be extracted from a combined key agreement algorithm identifier using `PSA_ALG_KEY_AGREEMENT_GET_BASE()`.
385
385
386
386
.. macro:: PSA_ALG_IS_FFDH
387
387
:definition: /* specification-defined value */
@@ -395,7 +395,7 @@ Support macros
395
395
.. return::
396
396
``1`` if ``alg`` is a finite field Diffie-Hellman algorithm, ``0`` otherwise. This macro can return either ``0`` or ``1`` if ``alg`` is not a supported key agreement algorithm identifier.
397
397
398
-
This includes the raw finite field Diffie-Hellman algorithm as well as finite-field Diffie-Hellman followed by any supported key derivation algorithm.
398
+
This includes the standalone finite field Diffie-Hellman algorithm, as well as finite-field Diffie-Hellman combined with any supported key derivation algorithm.
399
399
400
400
.. macro:: PSA_ALG_IS_ECDH
401
401
:definition: /* specification-defined value */
@@ -409,7 +409,7 @@ Support macros
409
409
.. return::
410
410
``1`` if ``alg`` is an elliptic curve Diffie-Hellman algorithm, ``0`` otherwise. This macro can return either ``0`` or ``1`` if ``alg`` is not a supported key agreement algorithm identifier.
411
411
412
-
This includes the raw elliptic curve Diffie-Hellman algorithm as well as elliptic curve Diffie-Hellman followed by any supporter key derivation algorithm.
412
+
This includes the standalone elliptic curve Diffie-Hellman algorithm, as well as elliptic curve Diffie-Hellman combined with any supported key derivation algorithm.
Copy file name to clipboardExpand all lines: doc/crypto/appendix/encodings.rst
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -348,14 +348,14 @@ a. ``hh`` is the HASH-TYPE for the hash algorithm, ``hash_alg``, used to constr
348
348
Key agreement algorithm encoding
349
349
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
350
350
351
-
A key agreement algorithm identifier can either be for the raw key agreement algorithm, or for a combined key agreement with key derivation algorithm. The former can only be used with `psa_key_agreement()` and `psa_raw_key_agreement()`, while the latter are used with `psa_key_derivation_key_agreement()` and the shared secret is not exposed to the client.
351
+
A key agreement algorithm identifier can either be for the standalone key agreement algorithm, or for a combined key agreement with key derivation algorithm. The former can only be used with `psa_key_agreement()` and `psa_raw_key_agreement()`, while the latter are used with `psa_key_derivation_key_agreement()`.
352
352
353
-
The algorithm identifier for raw key agreement algorithms defined in this specification are encoded as shown in :numref:`fig-ka-raw-fields`.
353
+
The algorithm identifier for standalone key agreement algorithms defined in this specification are encoded as shown in :numref:`fig-ka-raw-fields`.
354
354
355
355
.. figure:: ../figure/encoding/ka_raw.*
356
356
:name:fig-ka-raw-fields
357
357
358
-
Raw key agreement algorithm encoding
358
+
Standalone key agreement algorithm encoding
359
359
360
360
The defined values for KA-TYPE are shown in :numref:`table-ka-type`.
361
361
@@ -369,13 +369,13 @@ The defined values for KA-TYPE are shown in :numref:`table-ka-type`.
369
369
FFDH, ``0x01``, `PSA_ALG_FFDH`, ``0x09010000``
370
370
ECDH, ``0x02``, `PSA_ALG_ECDH`, ``0x09020000``
371
371
372
-
A combined key agreement is constructed by a bitwise OR of the raw key agreement algorithm identifier and the key derivation algorithm identifier. This operation is provided by the `PSA_ALG_KEY_AGREEMENT()` macro.
372
+
A combined key agreement is constructed by a bitwise OR of the standalone key agreement algorithm identifier and the key derivation algorithm identifier. This operation is provided by the `PSA_ALG_KEY_AGREEMENT()` macro.
373
373
374
374
.. figure:: ../figure/encoding/ka_combined.*
375
375
376
376
Combined key agreement algorithm encoding
377
377
378
-
The underlying raw key agreement algorithm can be extracted from the KA-TYPE field, and the key derivation algorithm from the KDF-TYPE and HASH-TYPE fields.
378
+
The underlying standalone key agreement algorithm can be extracted from the KA-TYPE field, and the key derivation algorithm from the KDF-TYPE and HASH-TYPE fields.
Copy file name to clipboardExpand all lines: doc/crypto/appendix/history.rst
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,8 @@ Clarifications and fixes
29
29
* Clarified the behavior of a key derivation operation when there is insufficient capacity for a call to `psa_key_derivation_output_bytes()`, `psa_key_derivation_output_key()`, `psa_key_derivation_verify_bytes()`, or `psa_key_derivation_verify_key()`.
30
30
* Reserved the value `0` for most enum-like integral types.
31
31
32
+
* Changed terminology for clarification: a 'raw key agreement' algorithm is now a 'standalone key agreement', and a 'full key agreement' is a 'combined key agreement'.
33
+
32
34
Other changes
33
35
~~~~~~~~~~~~~
34
36
@@ -71,7 +73,7 @@ Changes between *1.0.1* and *1.1.0*
71
73
Changes to the API
72
74
~~~~~~~~~~~~~~~~~~
73
75
74
-
* Relaxation when a raw key agreement is used as a key's permitted-algorithm policy. This now also permits the key agreement to be combined with any key derivation algorithm. See `PSA_ALG_FFDH` and `PSA_ALG_ECDH`.
76
+
* Relaxation when a standalone key agreement is used as a key's permitted-algorithm policy. This now also permits the key agreement to be combined with any key derivation algorithm. See `PSA_ALG_FFDH` and `PSA_ALG_ECDH`.
75
77
76
78
* Provide wildcard permitted-algorithm polices for MAC and AEAD that can specify a minimum MAC or tag length. The following elements are added to the API:
0 commit comments