Skip to content

psk: Add basic support for RFC 9258 external PSK importer interface

This adds a minimal, callback-based API to import external PSK, following RFC 9258. The client and the server importing external PSK are supposed to set a callback to retrieve PSK, which returns flags that may indicate the PSK is imported, along with the key:

  typedef int gnutls_psk_client_credentials_function3(
          gnutls_session_t session,
          gnutls_datum_t *username, gnutls_datum_t *key,
          gnutls_psk_key_flags *flags);

  typedef int gnutls_psk_server_credentials_function3(
          gnutls_session_t session,
          const gnutls_datum_t *username, gnutls_datum_t *key,
          gnutls_psk_key_flags *flags);

Those callbacks are responsible to call gnutls_psk_format_imported_identity() for external PSKs to build a serialized PSK identity, and set GNUTLS_PSK_KEY_EXT in flags if the identity is an imported one.

Fixes: #1355 (closed)

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • Code modified for feature
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated / NEWS entry present (for non-trivial changes)
  • CI timeout is 2h or higher (see Settings/CICD/General pipelines/Timeout)

Reviewer's checklist:

  • Any issues marked for closing are addressed
  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTION.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code
Edited by Zoltán Fridrich

Merge request reports