XenevaOS
Loading...
Searching...
No Matches
Functions
psa_crypto_ffdh.h File Reference
#include <psa/crypto.h>
Include dependency graph for psa_crypto_ffdh.h:

Go to the source code of this file.

Functions

psa_status_t mbedtls_psa_ffdh_key_agreement (const psa_key_attributes_t *attributes, const uint8_t *peer_key, size_t peer_key_length, const uint8_t *key_buffer, size_t key_buffer_size, uint8_t *shared_secret, size_t shared_secret_size, size_t *shared_secret_length)
 
psa_status_t mbedtls_psa_ffdh_export_public_key (const psa_key_attributes_t *attributes, const uint8_t *key_buffer, size_t key_buffer_size, uint8_t *data, size_t data_size, size_t *data_length)
 
psa_status_t mbedtls_psa_ffdh_generate_key (const psa_key_attributes_t *attributes, uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length)
 Generate DH key.
 
psa_status_t mbedtls_psa_ffdh_import_key (const psa_key_attributes_t *attributes, const uint8_t *data, size_t data_length, uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length, size_t *bits)
 Import DH key.
 

Function Documentation

◆ mbedtls_psa_ffdh_export_public_key()

psa_status_t mbedtls_psa_ffdh_export_public_key ( const psa_key_attributes_t *  attributes,
const uint8_t *  key_buffer,
size_t  key_buffer_size,
uint8_t *  data,
size_t  data_size,
size_t *  data_length 
)

Export a public key or the public part of a DH key pair in binary format.

Parameters
[in]attributesThe attributes for the key to export.
[in]key_bufferMaterial or context of the key to export.
[in]key_buffer_sizeSize of the key_buffer buffer in bytes.
[out]dataBuffer where the key data is to be written.
[in]data_sizeSize of the data buffer in bytes.
[out]data_lengthOn success, the number of bytes written in data
Return values
PSA_SUCCESSThe public key was exported successfully.
PSA_ERROR_BUFFER_TOO_SMALLThe size of key_buffer is too small.
PSA_ERROR_NOT_PERMITTED\emptydescription
PSA_ERROR_INSUFFICIENT_MEMORY\emptydescription
PSA_ERROR_CORRUPTION_DETECTED\emptydescription

◆ mbedtls_psa_ffdh_generate_key()

psa_status_t mbedtls_psa_ffdh_generate_key ( const psa_key_attributes_t *  attributes,
uint8_t *  key_buffer,
size_t  key_buffer_size,
size_t *  key_buffer_length 
)

Generate DH key.

Note
The signature of the function is that of a PSA driver generate_key entry point.
Parameters
[in]attributesThe attributes for the key to generate.
[out]key_bufferBuffer where the key data is to be written.
[in]key_buffer_sizeSize of key_buffer in bytes.
[out]key_buffer_lengthOn success, the number of bytes written in key_buffer.
Return values
PSA_SUCCESSThe key was generated successfully.
PSA_ERROR_NOT_SUPPORTEDKey size in bits is invalid.
PSA_ERROR_BUFFER_TOO_SMALLThe size of key_buffer is too small.
PSA_ERROR_INSUFFICIENT_MEMORY\emptydescription
PSA_ERROR_CORRUPTION_DETECTED\emptydescription

◆ mbedtls_psa_ffdh_import_key()

psa_status_t mbedtls_psa_ffdh_import_key ( const psa_key_attributes_t *  attributes,
const uint8_t *  data,
size_t  data_length,
uint8_t *  key_buffer,
size_t  key_buffer_size,
size_t *  key_buffer_length,
size_t *  bits 
)

Import DH key.

Note
The signature of the function is that of a PSA driver import_key entry point.
Parameters
[in]attributesThe attributes for the key to import.
[in]dataThe buffer containing the key data in import format.
[in]data_lengthSize of the data buffer in bytes.
[out]key_bufferThe buffer containing the key data in output format.
[in]key_buffer_sizeSize of the key_buffer buffer in bytes. This size is greater or equal to data_length.
[out]key_buffer_lengthThe length of the data written in key_buffer in bytes.
[out]bitsThe key size in number of bits.
Return values
PSA_SUCCESSThe key was generated successfully.
PSA_ERROR_BUFFER_TOO_SMALLThe size of key_buffer is too small.

◆ mbedtls_psa_ffdh_key_agreement()

psa_status_t mbedtls_psa_ffdh_key_agreement ( const psa_key_attributes_t *  attributes,
const uint8_t *  peer_key,
size_t  peer_key_length,
const uint8_t *  key_buffer,
size_t  key_buffer_size,
uint8_t *  shared_secret,
size_t  shared_secret_size,
size_t *  shared_secret_length 
)

Perform a key agreement and return the FFDH shared secret.

Parameters
[in]attributesThe attributes of the key to use for the operation.
[in]peer_keyThe buffer containing the key context of the peer's public key.
[in]peer_key_lengthSize of the peer_key buffer in bytes.
[in]key_bufferThe buffer containing the private key context.
[in]key_buffer_sizeSize of the key_buffer buffer in bytes.
[out]shared_secretThe buffer to which the shared secret is to be written.
[in]shared_secret_sizeSize of the shared_secret buffer in bytes.
[out]shared_secret_lengthOn success, the number of bytes that make up the returned shared secret.
Return values
PSA_SUCCESSSuccess. Shared secret successfully calculated.
PSA_ERROR_INVALID_ARGUMENTkey_buffer_size, peer_key_length, shared_secret_size do not match
PSA_ERROR_INSUFFICIENT_MEMORY\emptydescription
PSA_ERROR_CORRUPTION_DETECTED\emptydescription