Skip to content

Commit b2eab5e

Browse files
authored
Merge pull request #214 from athoelke/crypto-pake-clarify-context
Documented use of context parameters in PAKE operations
2 parents b4d01c0 + d72289f commit b2eab5e

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

doc/crypto/api/ops/pake.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,8 @@ The same key value must be provided to the PAKE operation in both participants.
12081208
The key can be the password text itself, in an agreed character encoding, or some value derived from the password, as required by a higher level protocol.
12091209
For low-entropy passwords, it is recommended that a key-stretching derivation algorithm, such as PBKDF2, is used, and the resulting password hash is used as the key input to the PAKE operation.
12101210

1211+
.. _jpake-operation:
1212+
12111213
J-PAKE operation
12121214
~~~~~~~~~~~~~~~~
12131215

@@ -1230,6 +1232,9 @@ J-PAKE does not assign roles to the participants, so it is not necessary to call
12301232
J-PAKE requires both an application and a peer identity.
12311233
If the peer identity provided to `psa_pake_set_peer()` does not match the data received from the peer, then the call to `psa_pake_input()` for the `PSA_PAKE_STEP_ZK_PROOF` step will fail with :code:`PSA_ERROR_INVALID_SIGNATURE`.
12321234

1235+
J-PAKE does not use a context.
1236+
A call to `psa_pake_set_context()` for a J-PAKE operation will fail with :code:`PSA_ERROR_BAD_STATE`.
1237+
12331238
The following steps demonstrate the application code for 'User' in :numref:`fig-jpake`. The code flow for the 'Peer' is the same as for 'User', as J-PAKE is a balanced PAKE.
12341239

12351240
1. To prepare a J-PAKE operation, initialize and set up a :code:`psa_pake_operation_t` object by calling the following functions:
@@ -1575,6 +1580,15 @@ Both participants in SPAKE2+ have an optional identity.
15751580
If no identity value is provided, then a zero-length string is used for that identity in the protocol.
15761581
If the participants do not supply the same identity values to the protocol, the computed secrets will be different, and key confirmation will fail.
15771582

1583+
Participants in SPAKE2+ can optionally provide a context:
1584+
1585+
* If `psa_pake_set_context()` is called, then the context and its encoded length are included in the SPAKE2+ transcript computation.
1586+
This includes the case of a zero-length context.
1587+
* If `psa_pake_set_context()` is not called, then the context and its encoded length are omitted entirely from the SPAKE2+ transcript computation.
1588+
See :RFC:`9383#3.3`.
1589+
1590+
If the participants do not supply the same context value to the protocol, the computed secrets will be different, and key confirmation will fail.
1591+
15781592
The following steps demonstrate the application code for both Prover and Verifier in :numref:`fig-spake2p`.
15791593

15801594
**Prover**
@@ -1597,7 +1611,7 @@ The following steps demonstrate the application code for both Prover and Verifie
15971611
15981612
psa_pake_set_user(&spake2p_p, ...); // Prover identity
15991613
psa_pake_set_peer(&spake2p_p, ...); // Verifier identity
1600-
psa_pake_set_context(&spake2p_p, ...);
1614+
psa_pake_set_context(&spake2p_p, ...); // Optional context
16011615
16021616
**Verifier**
16031617
To prepare a SPAKE2+ operation for the Verifier, initialize and set up a :code:`psa_pake_operation_t` object by calling the following functions:
@@ -1619,7 +1633,7 @@ The following steps demonstrate the application code for both Prover and Verifie
16191633
16201634
psa_pake_set_user(&spake2p_v, ...); // Verifier identity
16211635
psa_pake_set_peer(&spake2p_v, ...); // Prover identity
1622-
psa_pake_set_context(&spake2p_v, ...);
1636+
psa_pake_set_context(&spake2p_v, ...); // Optional context
16231637
16241638
Key exchange
16251639
^^^^^^^^^^^^

doc/crypto/appendix/history.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ Clarifications and fixes
4141
* Clarified the constraint on `psa_key_derivation_output_key()` for algorithms that have a `PSA_KEY_DERIVATION_INPUT_PASSWORD` input step.
4242
* Removed the redundant key input constraints on `psa_key_derivation_verify_bytes()` and `psa_key_derivation_verify_key()`. These match the policy already checked in `psa_key_derivation_input_key()`.
4343

44+
* Documented the use of context parameters in J-PAKE and SPAKE2+ PAKE operations.
45+
See :secref:`jpake-operation` and :secref:`spake2p-operation`.
46+
4447
Other changes
4548
~~~~~~~~~~~~~
4649

0 commit comments

Comments
 (0)