1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Merge pull request #5642 from mprse/ecp_export

Add ECP keypair export function
This commit is contained in:
Paul Elliott
2022-03-29 17:19:04 +01:00
committed by GitHub
5 changed files with 126 additions and 0 deletions

View File

@ -1278,6 +1278,26 @@ int mbedtls_ecp_check_pub_priv(
const mbedtls_ecp_keypair *pub, const mbedtls_ecp_keypair *prv,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
/**
* \brief This function exports generic key-pair parameters.
*
* \param key The key pair to export from.
* \param grp Slot for exported ECP group.
* It must point to an initialized ECP group.
* \param d Slot for the exported secret value.
* It must point to an initialized mpi.
* \param Q Slot for the exported public value.
* It must point to an initialized ECP point.
*
* \return \c 0 on success,
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure.
* \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if key id doesn't
* correspond to a known group.
* \return Another negative error code on other kinds of failure.
*/
int mbedtls_ecp_export(const mbedtls_ecp_keypair *key, mbedtls_ecp_group *grp,
mbedtls_mpi *d, mbedtls_ecp_point *Q);
#if defined(MBEDTLS_SELF_TEST)
/**