TrustCore SDK NanoCrypto API reference  version 7.0
ecc_edwards_dh.h File Reference

Header for Edward's curve Diffie-Hellman related methods. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS edDH_GenerateSharedSecret (MOC_ECC(hwAccelDescr hwAccelCtx) edECCKey *pPrivateKey, ubyte *pOtherPartysPublicKey, ubyte4 publicKeyLen, ubyte **ppSharedSecret, ubyte4 *pSharedSecretLen, void *pExtCtx)
 Generates a Edward's form Diffie-Hellman shared secret. More...
 

Detailed Description

Documentation file for Edward's curve Diffie-Hellman related methods.

To enable the methods in this file one must define

  • __ENABLE_MOCANA_ECC__ and at least one or more of the following flags
  • __ENABLE_MOCANA_ECC_EDDH_25519__
  • __ENABLE_MOCANA_ECC_EDDH_448__

ecc_edwards_dh.h

Function Documentation

◆ edDH_GenerateSharedSecret()

MOC_EXTERN MSTATUS edDH_GenerateSharedSecret ( MOC_ECC(hwAccelDescr hwAccelCtx) edECCKey *  pPrivateKey,
ubyte *  pOtherPartysPublicKey,
ubyte4  publicKeyLen,
ubyte **  ppSharedSecret,
ubyte4 *  pSharedSecretLen,
void *  pExtCtx 
)

Generates a Edward's form Diffie-Hellman shared secret from an edECCKey form private key and the other party's public key. A buffer will be allocated and to hold the generated shared secret and be sure to FREE this buffer when done with it.

Parameters
pPrivateKeyPointer to our private key.
pOtherPartysPublicKeyBuffer holding the other party's public key.
publicKeyLenThe length of the other party's public key in bytes. This must be 32 for curve25519 and 56 for curve448.
ppSharedSecretPointer to a buffer that will be allocated and filled with the resulting shared secret.
pSharedSecretLenContents will be set to the number of bytes in the allocated buffer.
pExtCtxAn extended context reserved for future use.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h