File crypto_extra.h

PSA cryptography module: Mbed TLS vendor extensions.

This file is reserved for vendor-specific definitions.

Note

This file may not be included directly. Applications must include psa/crypto.h.

Defines

PSA_CRYPTO_ITS_RANDOM_SEED_UID
PSA_PAKE_OUTPUT_SIZE(alg, primitive, output_step)

A sufficient output buffer size for psa_pake_output().

If the size of the output buffer is at least this large, it is guaranteed that psa_pake_output() will not fail due to an insufficient output buffer size. The actual size of the output might be smaller in any given call.

See also PSA_PAKE_OUTPUT_MAX_SIZE

Parameters:
  • alg – A PAKE algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_PAKE(alg) is true).

  • primitive – A primitive of type psa_pake_primitive_t that is compatible with algorithm alg.

  • output_step – A value of type psa_pake_step_t that is valid for the algorithm alg.

Returns:

A sufficient output buffer size for the specified PAKE algorithm, primitive, and output step. If the PAKE algorithm, primitive, or output step is not recognized, or the parameters are incompatible, return 0.

PSA_PAKE_INPUT_SIZE(alg, primitive, input_step)

A sufficient input buffer size for psa_pake_input().

The value returned by this macro is guaranteed to be large enough for any valid input to psa_pake_input() in an operation with the specified parameters.

See also PSA_PAKE_INPUT_MAX_SIZE

Parameters:
  • alg – A PAKE algorithm (PSA_ALG_XXX value such that PSA_ALG_IS_PAKE(alg) is true).

  • primitive – A primitive of type psa_pake_primitive_t that is compatible with algorithm alg.

  • input_step – A value of type psa_pake_step_t that is valid for the algorithm alg.

Returns:

A sufficient input buffer size for the specified input, cipher suite and algorithm. If the cipher suite, the input type or PAKE algorithm is not recognized, or the parameters are incompatible, return 0.

PSA_PAKE_OUTPUT_MAX_SIZE

Output buffer size for psa_pake_output() for any of the supported PAKE algorithm and primitive suites and output step.

This macro must expand to a compile-time constant integer.

The value of this macro must be at least as large as the largest value returned by PSA_PAKE_OUTPUT_SIZE()

See also PSA_PAKE_OUTPUT_SIZE(alg, primitive, output_step).

PSA_PAKE_INPUT_MAX_SIZE

Input buffer size for psa_pake_input() for any of the supported PAKE algorithm and primitive suites and input step.

This macro must expand to a compile-time constant integer.

The value of this macro must be at least as large as the largest value returned by PSA_PAKE_INPUT_SIZE()

See also PSA_PAKE_INPUT_SIZE(alg, primitive, output_step).

PSA_PAKE_CIPHER_SUITE_INIT

Returns a suitable initializer for a PAKE cipher suite object of type psa_pake_cipher_suite_t.

PSA_PAKE_OPERATION_INIT

Returns a suitable initializer for a PAKE operation object of type psa_pake_operation_t.

PSA_PAKE_CONFIRMED_KEY

A key confirmation value that indicates an confirmed key in a PAKE cipher suite.

This key confirmation value will result in the PAKE algorithm exchanging data to verify that the shared key is identical for both parties. This is the default key confirmation value in an initialized PAKE cipher suite object.

Some algorithms do not include confirmation of the shared key.

PSA_PAKE_UNCONFIRMED_KEY

A key confirmation value that indicates an unconfirmed key in a PAKE cipher suite.

This key confirmation value will result in the PAKE algorithm terminating prior to confirming that the resulting shared key is identical for both parties.

Some algorithms do not support returning an unconfirmed shared key.

Warning

When the shared key is not confirmed as part of the PAKE operation, the application is responsible for mitigating risks that arise from the possible mismatch in the output keys.

PSA_JPAKE_EXPECTED_INPUTS(round)
PSA_JPAKE_EXPECTED_OUTPUTS(round)

Typedefs

typedef struct mbedtls_psa_stats_s mbedtls_psa_stats_t

Statistics about resource consumption related to the PSA keystore.

Note

The content of this structure is not part of the stable API and ABI of Mbed TLS and may change arbitrarily from version to version.

typedef enum psa_crypto_driver_pake_step psa_crypto_driver_pake_step_t
typedef enum psa_jpake_round psa_jpake_round_t
typedef enum psa_jpake_io_mode psa_jpake_io_mode_t

Enums

enum psa_crypto_driver_pake_step

Values:

enumerator PSA_JPAKE_STEP_INVALID
enumerator PSA_JPAKE_X1_STEP_KEY_SHARE
enumerator PSA_JPAKE_X1_STEP_ZK_PUBLIC
enumerator PSA_JPAKE_X1_STEP_ZK_PROOF
enumerator PSA_JPAKE_X2_STEP_KEY_SHARE
enumerator PSA_JPAKE_X2_STEP_ZK_PUBLIC
enumerator PSA_JPAKE_X2_STEP_ZK_PROOF
enumerator PSA_JPAKE_X2S_STEP_KEY_SHARE
enumerator PSA_JPAKE_X2S_STEP_ZK_PUBLIC
enumerator PSA_JPAKE_X2S_STEP_ZK_PROOF
enumerator PSA_JPAKE_X4S_STEP_KEY_SHARE
enumerator PSA_JPAKE_X4S_STEP_ZK_PUBLIC
enumerator PSA_JPAKE_X4S_STEP_ZK_PROOF
enum psa_jpake_round

Values:

enumerator PSA_JPAKE_FIRST
enumerator PSA_JPAKE_SECOND
enumerator PSA_JPAKE_FINISHED
enum psa_jpake_io_mode

Values:

enumerator PSA_JPAKE_INPUT
enumerator PSA_JPAKE_OUTPUT

Functions

void mbedtls_psa_crypto_free(void)

Library deinitialization.

This function clears all data associated with the PSA layer, including the whole key store. This function is not thread safe, it wipes every key slot regardless of state and reader count. It should only be called when no slot is in use.

This is an Mbed TLS extension.

void mbedtls_psa_get_stats(mbedtls_psa_stats_t *stats)

Get statistics about resource consumption related to the PSA keystore.

Note

When Mbed TLS is built as part of a service, with isolation between the application and the keystore, the service may or may not expose this function.

struct mbedtls_psa_stats_s
#include <crypto_extra.h>

Statistics about resource consumption related to the PSA keystore.

Note

The content of this structure is not part of the stable API and ABI of Mbed TLS and may change arbitrarily from version to version.

Public Members

size_t private_volatile_slots

Number of slots containing key material for a volatile key.

size_t private_persistent_slots

Number of slots containing key material for a key which is in internal persistent storage.

size_t private_external_slots

Number of slots containing a reference to a key in a secure element.

size_t private_half_filled_slots

Number of slots which are occupied, but do not contain key material yet.

size_t private_cache_slots

Number of slots that contain cache data.

size_t private_empty_slots

Number of slots that are not used for anything.

size_t private_locked_slots

Number of slots that are locked.

psa_key_id_t private_max_open_internal_key_id

Largest key id value among open keys in internal persistent storage.

psa_key_id_t private_max_open_external_key_id

Largest key id value among open keys in secure elements.

struct psa_pake_cipher_suite_s
#include <crypto_extra.h>

Public Members

psa_algorithm_t algorithm
psa_pake_primitive_type_t type
psa_pake_family_t family
uint16_t bits
uint32_t key_confirmation
struct psa_crypto_driver_pake_inputs_s
#include <crypto_extra.h>

Public Members

uint8_t *private_password
size_t private_password_len
uint8_t *private_user
size_t private_user_len
uint8_t *private_peer
size_t private_peer_len
psa_key_attributes_t private_attributes
struct psa_pake_cipher_suite_s private_cipher_suite
struct psa_jpake_computation_stage_s
#include <crypto_extra.h>

Public Members

psa_jpake_round_t private_round
psa_jpake_io_mode_t private_io_mode
uint8_t private_inputs
uint8_t private_outputs
psa_pake_step_t private_step
struct psa_pake_operation_s
#include <crypto_extra.h>

Public Members

unsigned int private_id

Unique ID indicating which driver got assigned to do the operation. Since driver contexts are driver-specific, swapping drivers halfway through the operation is not supported. ID values are auto-generated in psa_crypto_driver_wrappers.h ID value zero means the context is not valid or not assigned to any driver (i.e. none of the driver contexts are active).

psa_algorithm_t private_alg
psa_pake_primitive_t private_primitive
uint8_t private_stage
uint8_t private_dummy
struct psa_jpake_computation_stage_s private_jpake
union psa_pake_operation_s private_computation_stage
psa_driver_pake_context_t private_ctx
struct psa_crypto_driver_pake_inputs_s private_inputs
union psa_pake_operation_s private_data