ARM-software / psa-api

Documentation source and development of the PSA Certified API
https://arm-software.github.io/psa-api/
Other
58 stars 28 forks source link

Missing information about contexts in PAKE protocols #209

Closed athoelke closed 2 months ago

athoelke commented 2 months ago

Some PAKE algorithms use a context parameter, and there is an API for each participant to set the context value. However, none of the documented PAKE protocols describe if, or how this parameter should be set, or what happens if none is set.

J-PAKE

J-PAKE does not use a context. The documentation should state that setting the context is an error for J-PAKE.

SPAKE2+

SPAKE2+ does have a context, which is used when generated the transcript input to the key derivation process.

We presently say nothing in the specification, other than showing psa_pake_set_context() being used in the SPAKE2+ protocol flow.

So I'd say that a clarification is necessary for both the MATTER and RFC variants of SPAKE2+. For the latter, we need to choose between the following ways of handling omitted and zero-length context values:

  1. A zero-length context is treated the same as not setting a context: both are encoded as len(nil) || nil || ... in the transcript.
  2. A zero-length context is treated the same as not setting a context: both are omitted from the transcript.
  3. If no context is set, the context and encoded-length are omitted from the transcript; if a zero-length context is set, it is encoded as len(nil) || nil || ... in the transcript.

Option 3 gives the full range of possible transcript encodings to the application; though it creates a different behavior to the handling of user-id and peer-id which treat an unset value as a zero-length string.

Have any implementations made a specific choice for this parameter to SPAKE2+?