My Project
Functions
Algorithms - Curve448

Functions

int wc_curve448_make_key (WC_RNG *rng, int keysize, curve448_key *key)
 This function generates a Curve448 key using the given random number generator, rng, of the size given (keysize), and stores it in the given curve448_key structure. It should be called after the key structure has been initialized through wc_curve448_init(). More...
 
int wc_curve448_shared_secret (curve448_key *private_key, curve448_key *public_key, byte *out, word32 *outlen)
 This function computes a shared secret key given a secret private key and a received public key. It stores the generated secret key in the buffer out and assigns the variable of the secret key to outlen. Only supports big endian. More...
 
int wc_curve448_shared_secret_ex (curve448_key *private_key, curve448_key *public_key, byte *out, word32 *outlen, int endian)
 This function computes a shared secret key given a secret private key and a received public key. It stores the generated secret key in the buffer out and assigns the variable of the secret key to outlen. Supports both big and little endian. More...
 
int wc_curve448_init (curve448_key *key)
 This function initializes a Curve448 key. It should be called before generating a key for the structure. More...
 
void wc_curve448_free (curve448_key *key)
 This function frees a Curve448 object. More...
 
int wc_curve448_import_private (const byte *priv, word32 privSz, curve448_key *key)
 This function imports a curve448 private key only. (Big endian). More...
 
int wc_curve448_import_private_ex (const byte *priv, word32 privSz, curve448_key *key, int endian)
 curve448 private key import only. (Big or Little endian). More...
 
int wc_curve448_import_private_raw (const byte *priv, word32 privSz, const byte *pub, word32 pubSz, curve448_key *key)
 This function imports a public-private key pair into a curve448_key structure. Big endian only. More...
 
int wc_curve448_import_private_raw_ex (const byte *priv, word32 privSz, const byte *pub, word32 pubSz, curve448_key *key, int endian)
 This function imports a public-private key pair into a curve448_key structure. Supports both big and little endian. More...
 
int wc_curve448_export_private_raw (curve448_key *key, byte *out, word32 *outLen)
 This function exports a private key from a curve448_key structure and stores it in the given out buffer. It also sets outLen to be the size of the exported key. Big Endian only. More...
 
int wc_curve448_export_private_raw_ex (curve448_key *key, byte *out, word32 *outLen, int endian)
 This function exports a private key from a curve448_key structure and stores it in the given out buffer. It also sets outLen to be the size of the exported key. Can specify whether it's big or little endian. More...
 
int wc_curve448_import_public (const byte *in, word32 inLen, curve448_key *key)
 This function imports a public key from the given in buffer and stores it in the curve448_key structure. More...
 
int wc_curve448_import_public_ex (const byte *in, word32 inLen, curve448_key *key, int endian)
 This function imports a public key from the given in buffer and stores it in the curve448_key structure. More...
 
int wc_curve448_check_public (const byte *pub, word32 pubSz, int endian)
 This function checks that a public key buffer holds a valid Curve448 key value given the endian ordering. More...
 
int wc_curve448_export_public (curve448_key *key, byte *out, word32 *outLen)
 This function exports a public key from the given key structure and stores the result in the out buffer. Big endian only. More...
 
int wc_curve448_export_public_ex (curve448_key *key, byte *out, word32 *outLen, int endian)
 This function exports a public key from the given key structure and stores the result in the out buffer. Supports both big and little endian. More...
 
int wc_curve448_export_key_raw (curve448_key *key, byte *priv, word32 *privSz, byte *pub, word32 *pubSz)
 This function exports a key pair from the given key structure and stores the result in the out buffer. Big endian only. More...
 
int wc_curve448_export_key_raw_ex (curve448_key *key, byte *priv, word32 *privSz, byte *pub, word32 *pubSz, int endian)
 Export curve448 key pair. Big or little endian. More...
 
int wc_curve448_size (curve448_key *key)
 This function returns the key size of the given key structure. More...
 

Detailed Description

Function Documentation

◆ wc_curve448_check_public()

int wc_curve448_check_public ( const byte *  pub,
word32  pubSz,
int  endian 
)

This function checks that a public key buffer holds a valid Curve448 key value given the endian ordering.

Returns
0 Returned when the public key value is valid.
ECC_BAD_ARG_E Returned if the public key value is not valid.
BAD_FUNC_ARG Returned if any of the input parameters are NULL.
Parameters
[in]pubPointer to the buffer containing the public key to check.
[in]pubLenLength of the public key to check.
[in]endianEC448_BIG_ENDIAN or EC448_LITTLE_ENDIAN to set which form to use.

Example

int ret;
byte pub[] = { Contents of public key };
ret = wc_curve448_check_public_ex(pub, sizeof(pub), EC448_BIG_ENDIAN);
if (ret != 0) {
// error importing key
}
See also
wc_curve448_init
wc_curve448_import_public
wc_curve448_import_public_ex
wc_curve448_size

◆ wc_curve448_export_key_raw()

int wc_curve448_export_key_raw ( curve448_key *  key,
byte *  priv,
word32 *  privSz,
byte *  pub,
word32 *  pubSz 
)

This function exports a key pair from the given key structure and stores the result in the out buffer. Big endian only.

Returns
0 Returned on successfully exporting the key pair from the curve448_key structure.
BAD_FUNC_ARG Returned if any input parameters are NULL.
ECC_BAD_ARG_E Returned if privSz is less than CURVE448_KEY_SIZE or pubSz is less than CURVE448_PUB_KEY_SIZE.
Parameters
[in]keyPointer to the curve448_key structure in from which to export the key pair.
[out]privPointer to the buffer in which to store the private key.
[in,out]privSzOn in, is the size of the priv buffer in bytes. On out, will store the bytes written to the priv buffer.
[out]pubPointer to the buffer in which to store the public key.
[in,out]pubSzOn in, is the size of the pub buffer in bytes. On out, will store the bytes written to the pub buffer.

Example

int ret;
byte pub[56];
byte priv[56];
int pubSz;
int privSz;
curve448_key key;
// initialize and make key
ret = wc_curve448_export_key_raw(&key, priv, &privSz, pub, &pubSz);
if (ret != 0) {
// error exporting key
}
int wc_curve448_export_key_raw(curve448_key *key, byte *priv, word32 *privSz, byte *pub, word32 *pubSz)
This function exports a key pair from the given key structure and stores the result in the out buffer...
See also
wc_curve448_export_key_raw_ex
wc_curve448_export_private_raw

◆ wc_curve448_export_key_raw_ex()

int wc_curve448_export_key_raw_ex ( curve448_key *  key,
byte *  priv,
word32 *  privSz,
byte *  pub,
word32 *  pubSz,
int  endian 
)

Export curve448 key pair. Big or little endian.

This function exports a key pair from the given key structure and stores the result in the out buffer. Big or little endian.

Returns
0 Success
BAD_FUNC_ARG Returned if any input parameters are NULL.
ECC_BAD_ARG_E Returned if privSz is less than CURVE448_KEY_SIZE or pubSz is less than CURVE448_PUB_KEY_SIZE.
Parameters
[in]keyPointer to the curve448_key structure in from which to export the key pair.
[out]privPointer to the buffer in which to store the private key.
[in,out]privSzOn in, is the size of the priv buffer in bytes. On out, will store the bytes written to the priv buffer.
[out]pubPointer to the buffer in which to store the public key.
[in,out]pubSzOn in, is the size of the pub buffer in bytes. On out, will store the bytes written to the pub buffer.
[in]endianEC448_BIG_ENDIAN or EC448_LITTLE_ENDIAN to set which form to use.

Example

int ret;
byte pub[56];
byte priv[56];
int pubSz;
int privSz;
curve448_key key;
// initialize and make key
ret = wc_curve448_export_key_raw_ex(&key,priv, &privSz, pub, &pubSz,
EC448_BIG_ENDIAN);
if (ret != 0) {
// error exporting key
}
int wc_curve448_export_key_raw_ex(curve448_key *key, byte *priv, word32 *privSz, byte *pub, word32 *pubSz, int endian)
Export curve448 key pair. Big or little endian.
See also
wc_curve448_export_key_raw
wc_curve448_export_private_raw_ex
wc_curve448_export_public_ex

◆ wc_curve448_export_private_raw()

int wc_curve448_export_private_raw ( curve448_key *  key,
byte *  out,
word32 *  outLen 
)

This function exports a private key from a curve448_key structure and stores it in the given out buffer. It also sets outLen to be the size of the exported key. Big Endian only.

Returns
0 Returned on successfully exporting the private key from the curve448_key structure.
BAD_FUNC_ARG Returned if any input parameters are NULL.
ECC_BAD_ARG_E Returned if wc_curve448_size() is not equal to key.
Parameters
[in]keyPointer to the structure from which to export the key.
[out]outPointer to the buffer in which to store the exported key.
[in,out]outLenOn in, is the size of the out in bytes. On out, will store the bytes written to the output buffer.

Example

int ret;
byte priv[56];
int privSz;
curve448_key key;
// initialize and make key
ret = wc_curve448_export_private_raw(&key, priv, &privSz);
if (ret != 0) {
// error exporting key
}
int wc_curve448_export_private_raw(curve448_key *key, byte *out, word32 *outLen)
This function exports a private key from a curve448_key structure and stores it in the given out buff...
See also
wc_curve448_init
wc_curve448_make_key
wc_curve448_import_private_raw
wc_curve448_export_private_raw_ex

◆ wc_curve448_export_private_raw_ex()

int wc_curve448_export_private_raw_ex ( curve448_key *  key,
byte *  out,
word32 *  outLen,
int  endian 
)

This function exports a private key from a curve448_key structure and stores it in the given out buffer. It also sets outLen to be the size of the exported key. Can specify whether it's big or little endian.

Returns
0 Returned on successfully exporting the private key from the curve448_key structure.
BAD_FUNC_ARG Returned if any input parameters are NULL.
ECC_BAD_ARG_E Returned if wc_curve448_size() is not equal to key.
Parameters
[in]keyPointer to the structure from which to export the key.
[out]outPointer to the buffer in which to store the exported key.
[in,out]outLenOn in, is the size of the out in bytes. On out, will store the bytes written to the output buffer.
[in]endianEC448_BIG_ENDIAN or EC448_LITTLE_ENDIAN to set which form to use.

Example

int ret;
byte priv[56];
int privSz;
curve448_key key;
// initialize and make key
ret = wc_curve448_export_private_raw_ex(&key, priv, &privSz,
EC448_BIG_ENDIAN);
if (ret != 0) {
// error exporting key
}
int wc_curve448_export_private_raw_ex(curve448_key *key, byte *out, word32 *outLen, int endian)
This function exports a private key from a curve448_key structure and stores it in the given out buff...
See also
wc_curve448_init
wc_curve448_make_key
wc_curve448_import_private_raw
wc_curve448_export_private_raw
wc_curve448_size

◆ wc_curve448_export_public()

int wc_curve448_export_public ( curve448_key *  key,
byte *  out,
word32 *  outLen 
)

This function exports a public key from the given key structure and stores the result in the out buffer. Big endian only.

Returns
0 Returned on successfully exporting the public key from the curve448_key structure.
ECC_BAD_ARG_E Returned if outLen is less than CURVE448_PUB_KEY_SIZE.
BAD_FUNC_ARG Returned if any of the input parameters are NULL.
Parameters
[in]keyPointer to the curve448_key structure in from which to export the key.
[out]outPointer to the buffer in which to store the public key.
[in,out]outLenOn in, is the size of the out in bytes. On out, will store the bytes written to the output buffer.

Example

int ret;
byte pub[56];
int pubSz;
curve448_key key;
// initialize and make key
ret = wc_curve448_export_public(&key, pub, &pubSz);
if (ret != 0) {
// error exporting key
}
int wc_curve448_export_public(curve448_key *key, byte *out, word32 *outLen)
This function exports a public key from the given key structure and stores the result in the out buff...
See also
wc_curve448_init
wc_curve448_export_private_raw
wc_curve448_import_public

◆ wc_curve448_export_public_ex()

int wc_curve448_export_public_ex ( curve448_key *  key,
byte *  out,
word32 *  outLen,
int  endian 
)

This function exports a public key from the given key structure and stores the result in the out buffer. Supports both big and little endian.

Returns
0 Returned on successfully exporting the public key from the curve448_key structure.
ECC_BAD_ARG_E Returned if outLen is less than CURVE448_PUB_KEY_SIZE.
BAD_FUNC_ARG Returned if any of the input parameters are NULL.
Parameters
[in]keyPointer to the curve448_key structure in from which to export the key.
[out]outPointer to the buffer in which to store the public key.
[in,out]outLenOn in, is the size of the out in bytes. On out, will store the bytes written to the output buffer.
[in]endianEC448_BIG_ENDIAN or EC448_LITTLE_ENDIAN to set which form to use.

Example

int ret;
byte pub[56];
int pubSz;
curve448_key key;
// initialize and make key
ret = wc_curve448_export_public_ex(&key, pub, &pubSz, EC448_BIG_ENDIAN);
if (ret != 0) {
// error exporting key
}
int wc_curve448_export_public_ex(curve448_key *key, byte *out, word32 *outLen, int endian)
This function exports a public key from the given key structure and stores the result in the out buff...
See also
wc_curve448_init
wc_curve448_export_private_raw
wc_curve448_import_public

◆ wc_curve448_free()

void wc_curve448_free ( curve448_key *  key)

This function frees a Curve448 object.

Parameters
[in,out]keyPointer to the key object to free.

Example

curve448_key privKey;
// initialize key, use it to generate shared secret key
wc_curve448_free(&privKey);
void wc_curve448_free(curve448_key *key)
This function frees a Curve448 object.
See also
wc_curve448_init
wc_curve448_make_key

◆ wc_curve448_import_private()

int wc_curve448_import_private ( const byte *  priv,
word32  privSz,
curve448_key *  key 
)

This function imports a curve448 private key only. (Big endian).

Returns
0 Returned on successfully importing private key.
BAD_FUNC_ARG Returns if key or priv is null.
ECC_BAD_ARG_E Returns if privSz is not equal to CURVE448_KEY_SIZE.
Parameters
[in]privPointer to a buffer containing the private key to import.
[in]privSzLength of the private key to import.
[in,out]keyPointer to the structure in which to store the imported key.

Example

int ret;
byte priv[] = { Contents of private key };
curve448_key key;
ret = wc_curve448_import_private(priv, sizeof(priv), &key);
if (ret != 0) {
// error importing key
}
int wc_curve448_import_private(const byte *priv, word32 privSz, curve448_key *key)
This function imports a curve448 private key only. (Big endian).
int wc_curve448_init(curve448_key *key)
This function initializes a Curve448 key. It should be called before generating a key for the structu...
See also
wc_curve448_import_private_ex
wc_curve448_size

◆ wc_curve448_import_private_ex()

int wc_curve448_import_private_ex ( const byte *  priv,
word32  privSz,
curve448_key *  key,
int  endian 
)

curve448 private key import only. (Big or Little endian).

Returns
0 Returned on successfully importing private key.
BAD_FUNC_ARG Returns if key or priv is null.
ECC_BAD_ARG_E Returns if privSz is not equal to CURVE448_KEY_SIZE.
Parameters
[in]privPointer to a buffer containing the private key to import.
[in]privSzLength of the private key to import.
[in,out]keyPointer to the structure in which to store the imported key.
[in]endianEC448_BIG_ENDIAN or EC448_LITTLE_ENDIAN to set which form to use.

Example

int ret;
byte priv[] = { // Contents of private key };
curve448_key key;
ret = wc_curve448_import_private_ex(priv, sizeof(priv), &key,
EC448_BIG_ENDIAN);
if (ret != 0) {
// error importing key
}
int wc_curve448_import_private_ex(const byte *priv, word32 privSz, curve448_key *key, int endian)
curve448 private key import only. (Big or Little endian).
See also
wc_curve448_import_private
wc_curve448_size

◆ wc_curve448_import_private_raw()

int wc_curve448_import_private_raw ( const byte *  priv,
word32  privSz,
const byte *  pub,
word32  pubSz,
curve448_key *  key 
)

This function imports a public-private key pair into a curve448_key structure. Big endian only.

Returns
0 Returned on importing into the curve448_key structure.
BAD_FUNC_ARG Returns if any of the input parameters are null.
ECC_BAD_ARG_E Returned if the input key’s key size does not match the public or private key sizes.
Parameters
[in]privPointer to a buffer containing the private key to import.
[in]privSzLength of the private key to import.
[in]pubPointer to a buffer containing the public key to import.
[in]pubSzLength of the public key to import.
[in,out]keyPointer to the structure in which to store the imported keys

Example

int ret;
byte priv[56];
byte pub[56];
// initialize with public and private keys
curve448_key key;
// initialize key
ret = wc_curve448_import_private_raw(&priv, sizeof(priv), pub, sizeof(pub),
&key);
if (ret != 0) {
// error importing keys
}
int wc_curve448_import_private_raw(const byte *priv, word32 privSz, const byte *pub, word32 pubSz, curve448_key *key)
This function imports a public-private key pair into a curve448_key structure. Big endian only.
See also
wc_curve448_init
wc_curve448_make_key
wc_curve448_import_public
wc_curve448_export_private_raw

◆ wc_curve448_import_private_raw_ex()

int wc_curve448_import_private_raw_ex ( const byte *  priv,
word32  privSz,
const byte *  pub,
word32  pubSz,
curve448_key *  key,
int  endian 
)

This function imports a public-private key pair into a curve448_key structure. Supports both big and little endian.

Returns
0 Returned on importing into the curve448_key structure.
BAD_FUNC_ARG Returns if any of the input parameters are null.
ECC_BAD_ARG_E Returned if the input key’s key size does not match the public or private key sizes.
Parameters
[in]privPointer to a buffer containing the private key to import.
[in]privSzLength of the private key to import.
[in]pubPointer to a buffer containing the public key to import.
[in]pubSzLength of the public key to import.
[in,out]keyPointer to the structure in which to store the imported keys.
[in]endianEC448_BIG_ENDIAN or EC448_LITTLE_ENDIAN to set which form to use.

Example

int ret;
byte priv[56];
byte pub[56];
// initialize with public and private keys
curve448_key key;
// initialize key
ret = wc_curve448_import_private_raw_ex(&priv, sizeof(priv), pub,
sizeof(pub), &key, EC448_BIG_ENDIAN);
if (ret != 0) {
// error importing keys
}
int wc_curve448_import_private_raw_ex(const byte *priv, word32 privSz, const byte *pub, word32 pubSz, curve448_key *key, int endian)
This function imports a public-private key pair into a curve448_key structure. Supports both big and ...
See also
wc_curve448_init
wc_curve448_make_key
wc_curve448_import_public
wc_curve448_export_private_raw
wc_curve448_import_private_raw

◆ wc_curve448_import_public()

int wc_curve448_import_public ( const byte *  in,
word32  inLen,
curve448_key *  key 
)

This function imports a public key from the given in buffer and stores it in the curve448_key structure.

Returns
0 Returned on successfully importing the public key into the curve448_key structure.
ECC_BAD_ARG_E Returned if the inLen parameter does not match the key size of the key structure.
BAD_FUNC_ARG Returned if any of the input parameters are NULL.
Parameters
[in]inPointer to the buffer containing the public key to import.
[in]inLenLength of the public key to import.
[in,out]keyPointer to the curve448_key structure in which to store the key.

Example

int ret;
byte pub[56];
// initialize pub with public key
curve448_key key;
// initialize key
ret = wc_curve448_import_public(pub,sizeof(pub), &key);
if (ret != 0) {
// error importing key
}
int wc_curve448_import_public(const byte *in, word32 inLen, curve448_key *key)
This function imports a public key from the given in buffer and stores it in the curve448_key structu...
See also
wc_curve448_init
wc_curve448_export_public
wc_curve448_import_private_raw
wc_curve448_import_public_ex
wc_curve448_check_public
wc_curve448_size

◆ wc_curve448_import_public_ex()

int wc_curve448_import_public_ex ( const byte *  in,
word32  inLen,
curve448_key *  key,
int  endian 
)

This function imports a public key from the given in buffer and stores it in the curve448_key structure.

Returns
0 Returned on successfully importing the public key into the curve448_key structure.
ECC_BAD_ARG_E Returned if the inLen parameter does not match the key size of the key structure.
BAD_FUNC_ARG Returned if any of the input parameters are NULL.
Parameters
[in]inPointer to the buffer containing the public key to import.
[in]inLenLength of the public key to import.
[in,out]keyPointer to the curve448_key structure in which to store the key.
[in]endianEC448_BIG_ENDIAN or EC448_LITTLE_ENDIAN to set which form to use.

Example

int ret;
byte pub[56];
// initialize pub with public key
curve448_key key;
// initialize key
ret = wc_curve448_import_public_ex(pub, sizeof(pub), &key,
EC448_BIG_ENDIAN);
if (ret != 0) {
// error importing key
}
int wc_curve448_import_public_ex(const byte *in, word32 inLen, curve448_key *key, int endian)
This function imports a public key from the given in buffer and stores it in the curve448_key structu...
See also
wc_curve448_init
wc_curve448_export_public
wc_curve448_import_private_raw
wc_curve448_import_public
wc_curve448_check_public
wc_curve448_size

◆ wc_curve448_init()

int wc_curve448_init ( curve448_key *  key)

This function initializes a Curve448 key. It should be called before generating a key for the structure.

Returns
0 Returned on successfully initializing the curve448_key structure.
BAD_FUNC_ARG Returned when key is NULL.
Parameters
[in,out]keyPointer to the curve448_key structure to initialize.

Example

curve448_key key;
wc_curve448_init(&key); // initialize key
// make key and proceed to encryption
See also
wc_curve448_make_key

◆ wc_curve448_make_key()

int wc_curve448_make_key ( WC_RNG *  rng,
int  keysize,
curve448_key *  key 
)

This function generates a Curve448 key using the given random number generator, rng, of the size given (keysize), and stores it in the given curve448_key structure. It should be called after the key structure has been initialized through wc_curve448_init().

Returns
0 Returned on successfully generating the key and and storing it in the given curve448_key structure.
ECC_BAD_ARG_E Returned if the input keysize does not correspond to the keysize for a curve448 key (56 bytes).
RNG_FAILURE_E Returned if the rng internal status is not DRBG_OK or if there is in generating the next random block with rng.
BAD_FUNC_ARG Returned if any of the input parameters passed in are NULL.
Parameters
[in]rngPointer to the RNG object used to generate the ecc key.
[in]keysizeSize of the key to generate. Must be 56 bytes for curve448.
[in,out]keyPointer to the curve448_key structure in which to store the generated key.

Example

int ret;
curve448_key key;
wc_curve448_init(&key); // initialize key
WC_RNG rng;
wc_InitRng(&rng); // initialize random number generator
ret = wc_curve448_make_key(&rng, 56, &key);
if (ret != 0) {
// error making Curve448 key
}
int wc_curve448_make_key(WC_RNG *rng, int keysize, curve448_key *key)
This function generates a Curve448 key using the given random number generator, rng,...
int wc_InitRng(WC_RNG *)
Gets the seed (from OS) and key cipher for rng. rng->drbg (deterministic random bit generator) alloca...
See also
wc_curve448_init

◆ wc_curve448_shared_secret()

int wc_curve448_shared_secret ( curve448_key *  private_key,
curve448_key *  public_key,
byte *  out,
word32 *  outlen 
)

This function computes a shared secret key given a secret private key and a received public key. It stores the generated secret key in the buffer out and assigns the variable of the secret key to outlen. Only supports big endian.

Returns
0 Returned on successfully computing a shared secret key
BAD_FUNC_ARG Returned if any of the input parameters passed in are NULL
Parameters
[in]private_keyPointer to the curve448_key structure initialized with the user’s private key.
[in]public_keyPointer to the curve448_key structure containing the received public key.
[out]outPointer to a buffer in which to store the 56 byte computed secret key.
[in,out]outlenPointer in which to store the length written to the output buffer.

Example

int ret;
byte sharedKey[56];
word32 keySz;
curve448_key privKey, pubKey;
// initialize both keys
ret = wc_curve448_shared_secret(&privKey, &pubKey, sharedKey, &keySz);
if (ret != 0) {
// error generating shared key
}
int wc_curve448_shared_secret(curve448_key *private_key, curve448_key *public_key, byte *out, word32 *outlen)
This function computes a shared secret key given a secret private key and a received public key....
See also
wc_curve448_init
wc_curve448_make_key
wc_curve448_shared_secret_ex

◆ wc_curve448_shared_secret_ex()

int wc_curve448_shared_secret_ex ( curve448_key *  private_key,
curve448_key *  public_key,
byte *  out,
word32 *  outlen,
int  endian 
)

This function computes a shared secret key given a secret private key and a received public key. It stores the generated secret key in the buffer out and assigns the variable of the secret key to outlen. Supports both big and little endian.

Returns
0 Returned on successfully computing a shared secret key.
BAD_FUNC_ARG Returned if any of the input parameters passed in are NULL.
Parameters
[in]private_keyPointer to the curve448_key structure initialized with the user’s private key.
[in]public_keyPointer to the curve448_key structure containing the received public key.
[out]outPointer to a buffer in which to store the 56 byte computed secret key.
[in,out]outlenPointer in which to store the length written to the output buffer.
[in]endianEC448_BIG_ENDIAN or EC448_LITTLE_ENDIAN to set which form to use.

Example

int ret;
byte sharedKey[56];
word32 keySz;
curve448_key privKey, pubKey;
// initialize both keys
ret = wc_curve448_shared_secret_ex(&privKey, &pubKey, sharedKey, &keySz,
EC448_BIG_ENDIAN);
if (ret != 0) {
// error generating shared key
}
int wc_curve448_shared_secret_ex(curve448_key *private_key, curve448_key *public_key, byte *out, word32 *outlen, int endian)
This function computes a shared secret key given a secret private key and a received public key....
See also
wc_curve448_init
wc_curve448_make_key
wc_curve448_shared_secret

◆ wc_curve448_size()

int wc_curve448_size ( curve448_key *  key)

This function returns the key size of the given key structure.

Returns
Success Given a valid, initialized curve448_key structure, returns the size of the key.
0 Returned if key is NULL.
Parameters
[in]keyPointer to the curve448_key structure in for which to determine the key size.

Example

int keySz;
curve448_key key;
// initialize and make key
keySz = wc_curve448_size(&key);
int wc_curve448_size(curve448_key *key)
This function returns the key size of the given key structure.
See also
wc_curve448_init
wc_curve448_make_key