NCBI C++ ToolKit
Functions
psa_crypto_ecp.h File Reference
#include <psa/crypto.h>
#include <mbedtls/ecp.h>
+ Include dependency graph for psa_crypto_ecp.h:

Go to the source code of this file.

Go to the SVN repository for this file.

Functions

psa_status_t mbedtls_psa_ecp_load_representation (psa_key_type_t type, size_t curve_bits, const uint8_t *data, size_t data_length, mbedtls_ecp_keypair **p_ecp)
 Load the contents of a key buffer into an internal ECP representation. More...
 
psa_status_t mbedtls_psa_ecp_load_public_part (mbedtls_ecp_keypair *ecp)
 Load the public part of an internal ECP, if required. More...
 
psa_status_t mbedtls_psa_ecp_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 an ECP key in binary format. More...
 
psa_status_t mbedtls_psa_ecp_export_key (psa_key_type_t type, mbedtls_ecp_keypair *ecp, uint8_t *data, size_t data_size, size_t *data_length)
 Export an ECP key to export representation. More...
 
psa_status_t mbedtls_psa_ecp_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 an ECP public key or the public part of an ECP key pair in binary format. More...
 
psa_status_t mbedtls_psa_ecp_generate_key (const psa_key_attributes_t *attributes, uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length)
 Generate an ECP key. More...
 
psa_status_t mbedtls_psa_ecdsa_sign_hash (const psa_key_attributes_t *attributes, const uint8_t *key_buffer, size_t key_buffer_size, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, uint8_t *signature, size_t signature_size, size_t *signature_length)
 Sign an already-calculated hash with ECDSA. More...
 
psa_status_t mbedtls_psa_ecdsa_verify_hash (const psa_key_attributes_t *attributes, const uint8_t *key_buffer, size_t key_buffer_size, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, const uint8_t *signature, size_t signature_length)
 Verify an ECDSA hash or short message signature. More...
 
psa_status_t mbedtls_psa_key_agreement_ecdh (const psa_key_attributes_t *attributes, const uint8_t *key_buffer, size_t key_buffer_size, psa_algorithm_t alg, const uint8_t *peer_key, size_t peer_key_length, uint8_t *shared_secret, size_t shared_secret_size, size_t *shared_secret_length)
 Perform a key agreement and return the raw ECDH shared secret. More...
 

Function Documentation

◆ mbedtls_psa_ecdsa_sign_hash()

psa_status_t mbedtls_psa_ecdsa_sign_hash ( const psa_key_attributes_t attributes,
const uint8_t key_buffer,
size_t  key_buffer_size,
psa_algorithm_t  alg,
const uint8_t hash,
size_t  hash_length,
uint8_t signature,
size_t  signature_size,
size_t *  signature_length 
)

Sign an already-calculated hash with ECDSA.

Note
The signature of this function is that of a PSA driver sign_hash entry point. This function behaves as a sign_hash entry point as defined in the PSA driver interface specification for transparent drivers.
Parameters
[in]attributesThe attributes of the ECC key to use for the operation.
[in]key_bufferThe buffer containing the ECC key context. format.
[in]key_buffer_sizeSize of the key_buffer buffer in bytes.
[in]algRandomized or deterministic ECDSA algorithm.
[in]hashThe hash or message to sign.
[in]hash_lengthSize of the hash buffer in bytes.
[out]signatureBuffer where the signature is to be written.
[in]signature_sizeSize of the signature buffer in bytes.
[out]signature_lengthOn success, the number of bytes that make up the returned signature value.
Return values
PSA_SUCCESS\emptydescription
PSA_ERROR_BUFFER_TOO_SMALLThe size of the signature buffer is too small. You can determine a sufficient buffer size by calling PSA_SIGN_OUTPUT_SIZE(PSA_KEY_TYPE_ECC_KEY_PAIR, key_bits, alg) where key_bits is the bit-size of the ECC key.
PSA_ERROR_NOT_SUPPORTED\emptydescription
PSA_ERROR_INVALID_ARGUMENT\emptydescription
PSA_ERROR_INSUFFICIENT_MEMORY\emptydescription
PSA_ERROR_CORRUPTION_DETECTED\emptydescription
PSA_ERROR_INSUFFICIENT_ENTROPY\emptydescription

◆ mbedtls_psa_ecdsa_verify_hash()

psa_status_t mbedtls_psa_ecdsa_verify_hash ( const psa_key_attributes_t attributes,
const uint8_t key_buffer,
size_t  key_buffer_size,
psa_algorithm_t  alg,
const uint8_t hash,
size_t  hash_length,
const uint8_t signature,
size_t  signature_length 
)

Verify an ECDSA hash or short message signature.

Note
The signature of this function is that of a PSA driver verify_hash entry point. This function behaves as a verify_hash entry point as defined in the PSA driver interface specification for transparent drivers.
Parameters
[in]attributesThe attributes of the ECC key to use for the operation.
[in]key_bufferThe buffer containing the ECC key context. format.
[in]key_buffer_sizeSize of the key_buffer buffer in bytes.
[in]algRandomized or deterministic ECDSA algorithm.
[in]hashThe hash or message whose signature is to be verified.
[in]hash_lengthSize of the hash buffer in bytes.
[in]signatureBuffer containing the signature to verify.
[in]signature_lengthSize of the signature buffer in bytes.
Return values
PSA_SUCCESSThe signature is valid.
PSA_ERROR_INVALID_SIGNATUREThe calculation was performed successfully, but the passed signature is not a valid signature.
PSA_ERROR_NOT_SUPPORTED\emptydescription
PSA_ERROR_INVALID_ARGUMENT\emptydescription
PSA_ERROR_INSUFFICIENT_MEMORY\emptydescription

◆ mbedtls_psa_ecp_export_key()

psa_status_t mbedtls_psa_ecp_export_key ( psa_key_type_t  type,
mbedtls_ecp_keypair ecp,
uint8_t data,
size_t  data_size,
size_t *  data_length 
)

Export an ECP key to export representation.

Parameters
[in]typeThe type of key (public/private) to export
[in]ecpThe internal ECP representation from which to export
[out]dataThe buffer to export to
[in]data_sizeThe length of the buffer to export to
[out]data_lengthThe amount of bytes written to data

◆ mbedtls_psa_ecp_export_public_key()

psa_status_t mbedtls_psa_ecp_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 an ECP public key or the public part of an ECP key pair in binary format.

Note
The signature of this function is that of a PSA driver export_public_key entry point. This function behaves as an export_public_key entry point as defined in the PSA driver interface specification.
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 ECP public key was exported successfully.
PSA_ERROR_NOT_SUPPORTED\emptydescription
PSA_ERROR_COMMUNICATION_FAILURE\emptydescription
PSA_ERROR_HARDWARE_FAILURE\emptydescription
PSA_ERROR_CORRUPTION_DETECTED\emptydescription
PSA_ERROR_STORAGE_FAILURE\emptydescription
PSA_ERROR_INSUFFICIENT_MEMORY\emptydescription

◆ mbedtls_psa_ecp_generate_key()

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

Generate an ECP key.

Note
The signature of the function is that of a PSA driver generate_key entry point.
Parameters
[in]attributesThe attributes for the ECP 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 successfully generated.
PSA_ERROR_NOT_SUPPORTEDKey length or type not supported.
PSA_ERROR_BUFFER_TOO_SMALLThe size of key_buffer is too small.

◆ mbedtls_psa_ecp_import_key()

psa_status_t mbedtls_psa_ecp_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 an ECP key in binary format.

Note
The signature of this function is that of a PSA driver import_key entry point. This function behaves as an import_key entry point as defined in the PSA driver interface specification for transparent drivers.
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 ECP key was imported successfully.
PSA_ERROR_INVALID_ARGUMENTThe key data is not correctly formatted.
PSA_ERROR_NOT_SUPPORTED\emptydescription
PSA_ERROR_INSUFFICIENT_MEMORY\emptydescription
PSA_ERROR_CORRUPTION_DETECTED\emptydescription

◆ mbedtls_psa_ecp_load_public_part()

psa_status_t mbedtls_psa_ecp_load_public_part ( mbedtls_ecp_keypair ecp)

Load the public part of an internal ECP, if required.

Parameters
ecpThe ECP context to load the public part for.
Returns
PSA_SUCCESS on success, otherwise an MPI error.

◆ mbedtls_psa_ecp_load_representation()

psa_status_t mbedtls_psa_ecp_load_representation ( psa_key_type_t  type,
size_t  curve_bits,
const uint8_t data,
size_t  data_length,
mbedtls_ecp_keypair **  p_ecp 
)

Load the contents of a key buffer into an internal ECP representation.

Parameters
[in]typeThe type of key contained in data.
[in]curve_bitsThe nominal bit-size of the curve. It must be consistent with the representation passed in data. This can be 0, in which case the bit-size is inferred from data_length (which is possible for all key types and representation formats formats that are currently supported or will be in the foreseeable future).
[in]dataThe buffer from which to load the representation.
[in]data_lengthThe size in bytes of data.
[out]p_ecpReturns a pointer to an ECP context on success. The caller is responsible for freeing both the contents of the context and the context itself when done.

◆ mbedtls_psa_key_agreement_ecdh()

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

Perform a key agreement and return the raw ECDH shared secret.

Note
The signature of this function is that of a PSA driver key_agreement entry point. This function behaves as a key_agreement entry point as defined in the PSA driver interface specification for transparent drivers.
Parameters
[in]attributesThe attributes of the key to use for the operation.
[in]key_bufferThe buffer containing the private key context.
[in]key_buffer_sizeSize of the key_buffer buffer in bytes.
[in]algA key agreement algorithm that is compatible with the type of the key.
[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.
[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_HANDLE\emptydescription
PSA_ERROR_NOT_PERMITTED\emptydescription
PSA_ERROR_INVALID_ARGUMENTalg is not a key agreement algorithm, or private_key is not compatible with alg, or peer_key is not valid for alg or not compatible with private_key.
PSA_ERROR_BUFFER_TOO_SMALLshared_secret_size is too small
PSA_ERROR_NOT_SUPPORTEDalg is not a supported key agreement algorithm.
PSA_ERROR_INSUFFICIENT_MEMORY\emptydescription
PSA_ERROR_CORRUPTION_DETECTED\emptydescription
Modified on Tue Jul 16 13:25:03 2024 by modify_doxy.py rev. 669887