![]() |
TrustCore SDK NanoCrypto API reference
version 7.0
|
Header for curve25519 and curve448 operations. More...
Go to the source code of this file.
Functions | |
MOC_EXTERN void | CURVE25519_addPoints (projPoint25519 *pResult, const projPoint25519 *pP, const projPoint25519 *pQ, sbyte4 *pTemps) |
Adds two projective form points on curve25519. More... | |
MOC_EXTERN MSTATUS | CURVE25519_convertEncodedToProjective (projPoint25519 *pResult, const ubyte *pEncodedInput) |
Converts an encoded point on curve25519 to a projective form. More... | |
MOC_EXTERN MSTATUS | CURVE25519_convertProjectiveToEncoded (ubyte *pBuffer, const projPoint25519 *pInput) |
Converts a projective form point on curve25519 to an encoded form point. More... | |
MOC_EXTERN MSTATUS | CURVE25519_createCombMutex (void) |
Creates a mutex for thread safety for curve25519 comb generation. More... | |
MOC_EXTERN MSTATUS | CURVE25519_deleteCombAndMutex (void) |
Zeroes and frees the persisted comb and mutex for curve25519. More... | |
MOC_EXTERN MSTATUS | CURVE25519_multiplyPoint (MOC_ECC(hwAccelDescr hwAccelCtx) projPoint25519 *pResult, const ubyte *pScalar, const projPoint25519 *pP) |
Performs a scalar point multiplication on curve25519. More... | |
MOC_EXTERN MSTATUS | CURVE25519_X25519 (MOC_ECC(hwAccelDescr hwAccelCtx) ubyte *pResult, ubyte *pScalar, ubyte *pU) |
Scalar point multiplication for EDDH on curve25519. More... | |
MOC_EXTERN void | CURVE448_addPoints (projPoint448 *pResult, const projPoint448 *pP, const projPoint448 *pQ, pf_unit *pTemps) |
Adds two projective form points on curve448. More... | |
MOC_EXTERN MSTATUS | CURVE448_convertEncodedToProjective (projPoint448 *pResult, const ubyte *pEncodedInput) |
Converts an encoded point on curve448 to a projective form. More... | |
MOC_EXTERN MSTATUS | CURVE448_convertProjectiveToEncoded (ubyte *pBuffer, const projPoint448 *pInput) |
Converts a projective form point on curve448 to an encoded form point. More... | |
MOC_EXTERN MSTATUS | CURVE448_createCombMutex (void) |
Creates a mutex for thread safety for curve448 comb generation. More... | |
MOC_EXTERN MSTATUS | CURVE448_deleteCombAndMutex (void) |
Zeroes and frees the persisted comb and mutex for curve448. More... | |
MOC_EXTERN MSTATUS | CURVE448_multiplyPoint (MOC_ECC(hwAccelDescr hwAccelCtx) projPoint448 *pResult, const ubyte *pScalar, const projPoint448 *pP) |
Performs a scalar point multiplication on curve448. More... | |
MOC_EXTERN MSTATUS | CURVE448_X448 (MOC_ECC(hwAccelDescr hwAccelCtx) ubyte *pResult, ubyte *pScalar, ubyte *pU) |
Scalar point multiplication for EDDH on curve448. More... | |
Documentation file for curve25519 and curve448 operations.
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_EDDSA_25519__
__ENABLE_MOCANA_ECC_EDDH_448__
__ENABLE_MOCANA_ECC_EDDSA_448__
MOC_EXTERN void CURVE25519_addPoints | ( | projPoint25519 * | pResult, |
const projPoint25519 * | pP, | ||
const projPoint25519 * | pQ, | ||
sbyte4 * | pTemps | ||
) |
Adds two projective form points on curve25519.
pResult | The resulting sum. This must be a distinct pointer from pP or pQ. |
pP | The first point to be added. |
pQ | The second point to be added. |
pTemps | Scratch memory space. This must have space for four finite field elements. |
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_25519__
MOC_EXTERN MSTATUS CURVE25519_convertEncodedToProjective | ( | projPoint25519 * | pResult, |
const ubyte * | pEncodedInput | ||
) |
Converts an encoded point on curve25519 to a projective form. See the description of CURVE25519_convertProjectiveToEncoded
for a description of an encoded point.
pResult | Pointer to the projective form point that will be set. |
pEncodedInput | Buffer holding The exising encoded point. This must be 32 bytes in length. |
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_25519__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN MSTATUS CURVE25519_convertProjectiveToEncoded | ( | ubyte * | pBuffer, |
const projPoint25519 * | pInput | ||
) |
Converts a projective form point to an encoded form point. The encoded form consists of the 255 bit affine Y coordinate in a 32 byte (256 bit) buffer in Little Endian (bytewise) form, and with the last bit of the 256 bit buffer set to the least significant bit of the affine X coordinate.
pBuffer | Buffer to hold the resulting encoded form point. This must be 32 bytes in space. |
pInput | Pointer to the input projective form point. |
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_25519__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN MSTATUS CURVE25519_createCombMutex | ( | void | ) |
Creates a mutex to be used for thread safety when creating a scalar point multiplication comb for the generator of the large cyclic group on curve25519.
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_25519__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN MSTATUS CURVE25519_deleteCombAndMutex | ( | void | ) |
Zeroes and frees the persisted comb made for the generator of the large cyclic group on curve25519. Also deletes the mutex made for thread safety.
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_25519__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN MSTATUS CURVE25519_multiplyPoint | ( | MOC_ECC(hwAccelDescr hwAccelCtx) projPoint25519 * | pResult, |
const ubyte * | pScalar, | ||
const projPoint25519 * | pP | ||
) |
Performs a scalar point multiplication on curve25519.
pResult | The result of the scalar point multiply. This must be a distinct pointer from pP. |
pScalar | The scalar in Little endian byte array form. This must be 32 bytes in length. |
pP | The point to be scaled. If this is NULL then the curve's large cyclic group generator will be scaled by the scalar. |
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_25519__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN MSTATUS CURVE25519_X25519 | ( | MOC_ECC(hwAccelDescr hwAccelCtx) ubyte * | pResult, |
ubyte * | pScalar, | ||
ubyte * | pU | ||
) |
The scalar point multiply "X25519" method as described in RFC 7748 Section 5. The pU and pResult are actually Montgomery form X-coordinates in Little Endian byte array form with the 256th bit of the buffer cleared. All 3 inputs to this method must be buffers of 32 bytes in length.
pResult | Buffer to hold the result of the scalar point multiply. It is ok for pResult to be the same buffer as pU. |
pScalar | Buffer holding the input scalar in Little Endian byte array form. |
pU | Buffer holding the input point. |
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDH_25519__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN void CURVE448_addPoints | ( | projPoint448 * | pResult, |
const projPoint448 * | pP, | ||
const projPoint448 * | pQ, | ||
pf_unit * | pTemps | ||
) |
Adds two projective form points on curve448.
pResult | The resulting sum. This must be a distinct pointer from pP or pQ. |
pP | The first point to be added. |
pQ | The second point to be added. |
pTemps | Scratch memory space. This must have space for seven finite field elements. |
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_448__
MOC_EXTERN MSTATUS CURVE448_convertEncodedToProjective | ( | projPoint448 * | pResult, |
const ubyte * | pEncodedInput | ||
) |
Converts an encoded point on curve448 to a projective form. See the description of CURVE448_convertProjectiveToEncoded
for a description of an encoded point.
pResult | Pointer to the projective form point that will be set. |
pEncodedInput | Buffer holding The exising encoded point. This must be 57 bytes in length. |
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_448__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN MSTATUS CURVE448_convertProjectiveToEncoded | ( | ubyte * | pBuffer, |
const projPoint448 * | pInput | ||
) |
Converts a projective form point to an encoded form point. The encoded form consists of the 448 bit affine Y coordinate in the first 56 bytes of a 57 byte buffer in Little Endian (bytewise) form, and with the most significant bit of the 57th byte being the least significant bit of the affine X coordinate.
pBuffer | Buffer to hold the resulting encoded form point. This must be 57 bytes in space. |
pInput | Pointer to the input projective form point. |
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_448__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN MSTATUS CURVE448_createCombMutex | ( | void | ) |
Creates a mutex to be used for thread safety when creating a scalar point multiplication comb for the generator of the large cyclic group on curve448.
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_448__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN MSTATUS CURVE448_deleteCombAndMutex | ( | void | ) |
Zeroes and frees the persisted comb made for the generator of the large cyclic group on curve448. Also deletes the mutex made for thread safety.
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_448__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN MSTATUS CURVE448_multiplyPoint | ( | MOC_ECC(hwAccelDescr hwAccelCtx) projPoint448 * | pResult, |
const ubyte * | pScalar, | ||
const projPoint448 * | pP | ||
) |
Performs a scalar point multiplication on curve448.
pResult | The result of the scalar point multiply. This must be a distinct pointer from pP. |
pScalar | The scalar in Little endian byte array form. This must be 57 bytes in length. |
pP | The point to be scaled. If this is NULL then the curve's large cyclic group generator will be scaled by the scalar. |
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDSA_448__
OK
(0) if successful, otherwise a negative number error code from merrors.h MOC_EXTERN MSTATUS CURVE448_X448 | ( | MOC_ECC(hwAccelDescr hwAccelCtx) ubyte * | pResult, |
ubyte * | pScalar, | ||
ubyte * | pU | ||
) |
The scalar point multiply "X448" method as described in RFC 7748 Section 5. The pU and pResult are actually Montgomery form X-coordinates in Little Endian byte array form. All 3 inputs to this method must be buffers of 56 bytes in length.
pResult | Buffer to hold the result of the scalar point multiply. It is ok for pResult to be the same buffer as pU. |
pScalar | Buffer holding the input scalar in Little Endian byte array form. |
pU | Buffer holding the input point. |
To enable this method one must define both flags
__ENABLE_MOCANA_ECC__
__ENABLE_MOCANA_ECC_EDDH_448__
OK
(0) if successful, otherwise a negative number error code from merrors.h