Skip to content

Commit dc6f824

Browse files
committed
Add TLS-1.2 EC J-PAKE-to-PMS KDF algorithm
1 parent c9b79ad commit dc6f824

5 files changed

Lines changed: 41 additions & 0 deletions

File tree

doc/crypto/api.db/psa/crypto.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ typedef /* implementation-defined type */ psa_mac_operation_t;
142142
#define PSA_ALG_SHA_512_256 ((psa_algorithm_t)0x0200000d)
143143
#define PSA_ALG_SM3 ((psa_algorithm_t)0x02000014)
144144
#define PSA_ALG_STREAM_CIPHER ((psa_algorithm_t)0x04800100)
145+
#define PSA_ALG_TLS12_ECJPAKE_TO_PMS ((psa_algorithm_t)0x08000609)
145146
#define PSA_ALG_TLS12_PRF(hash_alg) /* specification-defined value */
146147
#define PSA_ALG_TLS12_PSK_TO_MS(hash_alg) /* specification-defined value */
147148
#define PSA_ALG_TRUNCATED_MAC(mac_alg, mac_length) \
@@ -300,6 +301,7 @@ typedef /* implementation-defined type */ psa_mac_operation_t;
300301
#define PSA_SIGNATURE_MAX_SIZE /* implementation-defined value */
301302
#define PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg) \
302303
/* implementation-defined value */
304+
#define PSA_TLS12_ECJPAKE_TO_PMS_OUTPUT_SIZE 32
303305
#define PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE /* implementation-defined value */
304306
psa_status_t psa_aead_abort(psa_aead_operation_t * operation);
305307
psa_status_t psa_aead_decrypt(psa_key_id_t key,

doc/crypto/api/ops/kdf.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,28 @@ Key derivation algorithms
226226
| `PSA_KEY_TYPE_DERIVE` (for the PSK)
227227
| `PSA_KEY_TYPE_RAW_DATA` (for the other inputs)
228228
229+
.. macro:: PSA_ALG_TLS12_ECJPAKE_TO_PMS
230+
:definition: ((psa_algorithm_t)0x08000609)
231+
232+
.. summary::
233+
The TLS 1.2 ECJPAKE-to-PMS key-derivation algorithm.
234+
235+
This KDF is defined in :cite-title:`TLS-ECJPAKE` §8.7. This specifies the use of a KDF to derive the TLS 1.2 session secrets from the output of EC J-PAKE over the secp256r1 Elliptic curve (the 256-bit curve in `PSA_ECC_FAMILY_SECP_R1`). EC J-PAKE operations can be performed using the extension to the |API| defined in :cite-title:`PSA-PAKE`.
236+
237+
This KDF takes the shared secret *K* (an uncompressed EC point in case of EC J-PAKE) and calculates SHA256(*K.X*).
238+
239+
This function takes a single input:
240+
241+
* `PSA_KEY_DERIVATION_INPUT_SECRET` is the shared secret K from EC J-PAKE. For secp256r1, the input is exactly 65 bytes.
242+
243+
The input can be supplied to the key derivation operation by calling :code:`psa_pake_get_implicit_key()`, part of the PAKE extension API defined in :cite:`PSA-PAKE`.
244+
245+
The 32-byte output has to be read in a single call to either `psa_key_derivation_output_bytes()` or `psa_key_derivation_output_key()`. The size of the output is defined as `PSA_TLS12_ECJPAKE_TO_PMS_OUTPUT_SIZE`.
246+
247+
.. subsection:: Compatible key types
248+
249+
None --- the secret input is extracted from a PAKE operation by calling :code:`psa_pake_get_implicit_key()`.
250+
229251
.. macro:: PSA_ALG_PBKDF2_HMAC
230252
:definition: /* specification-defined value */
231253
@@ -1139,3 +1161,11 @@ Support macros
11391161
TLS implementations supporting these cipher suites MUST support arbitrary PSK identities up to 128 octets in length, and arbitrary PSKs up to 64 octets in length. Supporting longer identities and keys is RECOMMENDED.
11401162

11411163
Therefore, it is recommended that implementations define `PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE` with a value greater than or equal to ``64``.
1164+
1165+
.. macro:: PSA_TLS12_ECJPAKE_TO_PMS_OUTPUT_SIZE
1166+
:definition: 32
1167+
1168+
.. summary::
1169+
The size of the output from the TLS 1.2 ECJPAKE-to-PMS key-derivation algorithm, in bytes.
1170+
1171+
This value can be used when extracting the result of a key-derivation operation that was set up with the `PSA_ALG_TLS12_ECJPAKE_TO_PMS` algorithm.

doc/crypto/appendix/encodings.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ The permitted values of HASH-TYPE (see :numref:`table-hash-type`) depend on the
268268
HKDF, 0, ``0x01``, :code:`PSA_ALG_HKDF(hash_alg)`, ``0x080001hh`` :sup:`a`
269269
TLS-1.2 PRF, 0, ``0x02``, :code:`PSA_ALG_TLS12_PRF(hash_alg)`, ``0x080002hh`` :sup:`a`
270270
TLS-1.2 PSK-to-MasterSecret, 0, ``0x03``, :code:`PSA_ALG_TLS12_PSK_TO_MS(hash_alg)`, ``0x080003hh`` :sup:`a`
271+
TLS 1.2 ECJPAKE-to-PMS, 0, ``0x06``, :code:`PSA_ALG_TLS12_ECJPAKE_TO_PMS`, ``0x08000609``
271272
HKDF-Extract, 0, ``0x04``, :code:`PSA_ALG_HKDF_EXTRACT(hash_alg)`, ``0x080004hh`` :sup:`a`
272273
HKDF-Expand, 0, ``0x05``, :code:`PSA_ALG_HKDF_EXPAND(hash_alg)`, ``0x080005hh`` :sup:`a`
273274
PBKDF2-HMAC, 1, ``0x01``, :code:`PSA_ALG_PBKDF2_HMAC(hash_alg)`, ``0x088001hh`` :sup:`a`

doc/crypto/appendix/history.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Changes between *1.1.2* and *1.2.0*
1717
Changes to the API
1818
~~~~~~~~~~~~~~~~~~
1919

20+
* Added support for TLS 1.2 ECJPAKE-to-PMS key-derivation. See `PSA_ALG_TLS12_ECJPAKE_TO_PMS`.
21+
2022
Clarifications and fixes
2123
~~~~~~~~~~~~~~~~~~~~~~~~
2224

doc/crypto/references

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,3 +335,9 @@
335335
:title: On the Security of PKCS #11
336336
:url: link.springer.com/chapter/10.1007/978-3-540-45238-6_32
337337
:publication: 2003
338+
339+
.. reference:: TLS-ECJPAKE
340+
:title: Elliptic Curve J-PAKE Cipher Suites for Transport Layer Security (TLS)
341+
:author: Cragie, Hao
342+
:publication: June 2016
343+
:url: datatracker.ietf.org/doc/html/draft-cragie-tls-ecjpake-01

0 commit comments

Comments
 (0)