Skip to content

Commit 667c155

Browse files
committed
Terminology improvement for key agreement
* 'raw key agreement' -> 'standalone key agreement' * 'full key agreement' -> 'combined key agreement'
1 parent 8ca83aa commit 667c155

4 files changed

Lines changed: 30 additions & 28 deletions

File tree

doc/crypto/api/keys/policy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The following algorithm policies are supported:
3333
* `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.
3434
* A specific algorithm value permits exactly that particular algorithm.
3535
* 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.
3737
* 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.
3838
* 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.
3939

doc/crypto/api/ops/ka.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Key agreement
1010
=============
1111

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:
1313

1414
* A call to `psa_key_agreement()` will compute the shared secret and store the result in a new derivation key.
1515

@@ -34,7 +34,7 @@ Key agreement algorithms
3434
.. summary::
3535
The finite-field Diffie-Hellman (DH) key agreement algorithm.
3636

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()`.
3838

3939
When used as a key's permitted-algorithm policy, the following uses are permitted:
4040

@@ -57,7 +57,7 @@ Key agreement algorithms
5757
.. summary::
5858
The elliptic curve Diffie-Hellman (ECDH) key agreement algorithm.
5959

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()`.
6161

6262
When used as a key's permitted-algorithm policy, the following uses are permitted:
6363

@@ -116,7 +116,7 @@ Key agreement algorithms
116116

117117
.. subsection:: Compatible key types
118118

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.
120120

121121

122122
Standalone key agreement
@@ -131,7 +131,7 @@ Standalone key agreement
131131
Identifier of the private key to use.
132132
It must permit the usage `PSA_KEY_USAGE_DERIVE`.
133133
.. 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`.
135135
.. param:: size_t peer_key_length
136136
Size of ``peer_key`` in bytes.
137137
.. param:: psa_algorithm_t alg
@@ -206,38 +206,38 @@ Standalone key agreement
206206
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()`.
207207

208208
.. 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.
210210

211211
.. function:: psa_raw_key_agreement
212212

213213
.. summary::
214-
Perform a key agreement and return the raw shared secret.
214+
Perform a key agreement and return the shared secret.
215215

216216
.. param:: psa_algorithm_t alg
217217
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.
218218
.. param:: psa_key_id_t private_key
219219
Identifier of the private key to use.
220220
It must permit the usage `PSA_KEY_USAGE_DERIVE`.
221221
.. 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`.
223223
.. param:: size_t peer_key_length
224224
Size of ``peer_key`` in bytes.
225225
.. 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.
227227
.. param:: size_t output_size
228228
Size of the ``output`` buffer in bytes.
229229
This must be appropriate for the keys:
230230

231231
* 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.
233233

234234
.. param:: size_t * output_length
235235
On success, the number of bytes that make up the returned output.
236236

237237
.. return:: psa_status_t
238238
.. retval:: PSA_SUCCESS
239239
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.
241241
.. retval:: PSA_ERROR_INVALID_HANDLE
242242
``private_key`` is not a valid key identifier.
243243
.. retval:: PSA_ERROR_NOT_PERMITTED
@@ -290,7 +290,7 @@ Combining key agreement and key derivation
290290
Identifier of the private key to use.
291291
It must permit the usage `PSA_KEY_USAGE_DERIVE`.
292292
.. 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`.
294294
.. param:: size_t peer_key_length
295295
Size of ``peer_key`` in bytes.
296296

@@ -339,13 +339,13 @@ Support macros
339339
:definition: /* specification-defined value */
340340
341341
.. 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.
343343

344344
.. param:: alg
345345
A key agreement algorithm: a value of type `psa_algorithm_t` such that :code:`PSA_ALG_IS_KEY_AGREEMENT(alg)` is true.
346346

347347
.. 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.
349349

350350
Unspecified if ``alg`` is not a key agreement algorithm or if it is not supported by the implementation.
351351

@@ -355,7 +355,7 @@ Support macros
355355
:definition: /* specification-defined value */
356356
357357
.. 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.
359359

360360
.. param:: alg
361361
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
371371
:definition: /* specification-defined value */
372372
373373
.. summary::
374-
Whether the specified algorithm is a raw key agreement algorithm.
374+
Whether the specified algorithm is a standalone key agreement algorithm.
375375

376376
.. param:: alg
377377
An algorithm identifier: a value of type `psa_algorithm_t`.
378378

379379
.. 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.
381381

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()`.
383383

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()`.
385385

386386
.. macro:: PSA_ALG_IS_FFDH
387387
:definition: /* specification-defined value */
@@ -395,7 +395,7 @@ Support macros
395395
.. return::
396396
``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.
397397

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.
399399

400400
.. macro:: PSA_ALG_IS_ECDH
401401
:definition: /* specification-defined value */
@@ -409,7 +409,7 @@ Support macros
409409
.. return::
410410
``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.
411411

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.
413413

414414
.. macro:: PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE
415415
:definition: /* implementation-defined value */

doc/crypto/appendix/encodings.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,14 @@ a. ``hh`` is the HASH-TYPE for the hash algorithm, ``hash_alg``, used to constr
348348
Key agreement algorithm encoding
349349
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
350350

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()`.
352352

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`.
354354

355355
.. figure:: ../figure/encoding/ka_raw.*
356356
:name: fig-ka-raw-fields
357357

358-
Raw key agreement algorithm encoding
358+
Standalone key agreement algorithm encoding
359359

360360
The defined values for KA-TYPE are shown in :numref:`table-ka-type`.
361361

@@ -369,13 +369,13 @@ The defined values for KA-TYPE are shown in :numref:`table-ka-type`.
369369
FFDH, ``0x01``, `PSA_ALG_FFDH`, ``0x09010000``
370370
ECDH, ``0x02``, `PSA_ALG_ECDH`, ``0x09020000``
371371

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.
373373

374374
.. figure:: ../figure/encoding/ka_combined.*
375375

376376
Combined key agreement algorithm encoding
377377

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.
379379

380380

381381
.. _key-type-encoding:

doc/crypto/appendix/history.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Clarifications and fixes
2929
* 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()`.
3030
* Reserved the value `0` for most enum-like integral types.
3131

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+
3234
Other changes
3335
~~~~~~~~~~~~~
3436

@@ -71,7 +73,7 @@ Changes between *1.0.1* and *1.1.0*
7173
Changes to the API
7274
~~~~~~~~~~~~~~~~~~
7375

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`.
7577

7678
* 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:
7779

0 commit comments

Comments
 (0)