TrustCore SDK Crypto Interface API reference  version 2.0
crypto_interface_eddsa.h File Reference

Cryptographic Interface header file for declaring EdDSA functions. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_finalSign (MOC_ECC(hwAccelDescr hwAccelCtx) edDSA_CTX *pEdDSA_ctx, ubyte *pSignature, ubyte4 bufferSize, ubyte4 *pSignatureLen, void *pExtCtx)
 Finalizes an edDSA_CTX and outputs the signature. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_finalVerify (MOC_ECC(hwAccelDescr hwAccelCtx) edDSA_CTX *pEdDSA_ctx, ubyte4 *pVerifyStatus, void *pExtCtx)
 Finalizes an edDSA_CTX context and writes the verify status. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_initSignPreHash (MOC_ECC(hwAccelDescr hwAccelCtx) edDSA_CTX *pEdDSA_ctx, ECCKey *pKey, ubyte *pCtx, ubyte4 ctxLen, void *pExtCtx)
 Initializes an edDSA_CTX for use in the EdDSA sign algorithm. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_initVerify (MOC_ECC(hwAccelDescr hwAccelCtx) edDSA_CTX *pEdDSA_ctx, ECCKey *pKey, ubyte *pSignature, ubyte4 signatureLen, byteBoolean preHash, ubyte *pCtx, ubyte4 ctxLen, void *pExtCtx)
 Initializes an edDSA_CTX for use in the EdDSA verify algorithm. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_Sign (MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, ubyte *pMessage, ubyte4 messageLen, ubyte *pSignature, ubyte4 bufferSize, ubyte4 *pSignatureLen, byteBoolean preHash, ubyte *pCtx, ubyte4 ctxLen, void *pExtCtx)
 Signs a message via the EdDSA algorithm. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_update (MOC_ECC(hwAccelDescr hwAccelCtx) edDSA_CTX *pEdDSA_ctx, ubyte *pMessage, ubyte4 messageLen, void *pExtCtx)
 Updates an edDSA_CTX with data. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_VerifySignature (MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, ubyte *pMessage, ubyte4 messageLen, ubyte *pSignature, ubyte4 signatureLen, ubyte4 *pVerifyStatus, byteBoolean preHash, ubyte *pCtx, ubyte4 ctxLen, void *pExtCtx)
 A one shot verify of a message via the EdDSA algorithm. More...
 

Detailed Description

Cryptographic Interface header file for declaring EdDSA functions.

crypto_interface_eddsa.h

Function Documentation

◆ CRYPTO_INTERFACE_EdDSA_finalSign()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_finalSign ( MOC_ECC(hwAccelDescr hwAccelCtx) edDSA_CTX *  pEdDSA_ctx,
ubyte *  pSignature,
ubyte4  bufferSize,
ubyte4 *  pSignatureLen,
void *  pExtCtx 
)

Finalizes an edDSA_CTX and outputs the signature.

Parameters
pEdDSA_ctxPointer to a previous initialized context.
pSignatureBuffer that will hold the resulting signature.
bufferSizeThe length of the buffer pSignature in bytes.
pSignatureLenContents will be set to the number of bytes actually written to the pSignature buffer.
pExtCtxAn extended context reserved for future use.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_EdDSA_finalVerify()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_finalVerify ( MOC_ECC(hwAccelDescr hwAccelCtx) edDSA_CTX *  pEdDSA_ctx,
ubyte4 *  pVerifyStatus,
void *  pExtCtx 
)

Finalizes an edDSA_CTX context and writes the verify status.

Parameters
pEdDSA_ctxPointer to a previous initialized and updated context.
pVerifyStatusContents will be set to 0 for a valid signature and a nonzero value for an invalid signature.
pExtCtxAn extended context reserved for future use.
Warning
Be sure to check for both a return status of OK and a verify status of 0 before accepting that a signature is valid.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_EdDSA_initSignPreHash()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_initSignPreHash ( MOC_ECC(hwAccelDescr hwAccelCtx) edDSA_CTX *  pEdDSA_ctx,
ECCKey *  pKey,
ubyte *  pCtx,
ubyte4  ctxLen,
void *  pExtCtx 
)

Initializes an edDSA_CTX for use in the EdDSA sign algorithm.

Parameters
pEdDSA_ctxPointer to the context to be initialized.
pKeyPointer to the public key.
pSignatureBuffer holding the signature to be verified.
signatureLenThe length of the signature in bytes.
pCtxOptional. For curve25519 set to non-null for Ed25519ctx mode. For curve448 the context is optional for pre-hash mode.
ctxLenThe length of the context in bytes. This cannot be more than 255.
pExtCtxAn extended context reserved for future use.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_EdDSA_initVerify()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_initVerify ( MOC_ECC(hwAccelDescr hwAccelCtx) edDSA_CTX *  pEdDSA_ctx,
ECCKey *  pKey,
ubyte *  pSignature,
ubyte4  signatureLen,
byteBoolean  preHash,
ubyte *  pCtx,
ubyte4  ctxLen,
void *  pExtCtx 
)

Initializes an edDSA_CTX for use in the EdDSA verify algorithm.

Parameters
pEdDSA_ctxPointer to the context to be initialized.
pKeyPointer to the public key.
pSignatureBuffer holding the signature to be verified.
signatureLenThe length of the signature in bytes.
preHashSet to TRUE (1) for EdDSAph "pre-hash" mode.
pCtxOptional. For curve25519 set to non-null for Ed25519ctx mode. For curve448 the context is optional for pure Ed448 or pre-hash mode.
ctxLenThe length of the context in bytes. This cannot be more than 255.
pExtCtxAn extended context reserved for future use.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_EdDSA_Sign()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_Sign ( MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *  pKey,
ubyte *  pMessage,
ubyte4  messageLen,
ubyte *  pSignature,
ubyte4  bufferSize,
ubyte4 *  pSignatureLen,
byteBoolean  preHash,
ubyte *  pCtx,
ubyte4  ctxLen,
void *  pExtCtx 
)

Signs a message via the EdDSA algorithm.

Parameters
pKeyPointer to the private signing key.
pMessageBuffer holding the message to be signed.
messageLenThe length of the message in bytes.
pSignatureBuffer that will hold the resulting signature.
bufferSizeThe length of the buffer pSignature in bytes.
pSignatureLenContents will be set to the number of bytes actually written to the pSignature buffer.
preHashSet to TRUE (1) for EdDSAph "pre-hash" mode.
pCtxOptional. For curve25519 set to non-null for Ed25519ctx mode. For curve448 the context is optional for pure Ed448 or pre-hash mode.
ctxLenThe length of the context in bytes. This cannot be more than 255.
pExtCtxAn extended context reserved for future use.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_EdDSA_update()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_update ( MOC_ECC(hwAccelDescr hwAccelCtx) edDSA_CTX *  pEdDSA_ctx,
ubyte *  pMessage,
ubyte4  messageLen,
void *  pExtCtx 
)

Updates an edDSA_CTX with some portion of the data to be signed or verified. You may call this API as many times as is appropriate.

Parameters
pEdDSA_ctxPointer to a previous initialized context.
pMessageBuffer holding the message or portion of the message to be signed or verified.
messageLenThe length of the message or portion of the message in bytes.
pExtCtxAn extended context reserved for future use.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_EdDSA_VerifySignature()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_VerifySignature ( MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *  pKey,
ubyte *  pMessage,
ubyte4  messageLen,
ubyte *  pSignature,
ubyte4  signatureLen,
ubyte4 *  pVerifyStatus,
byteBoolean  preHash,
ubyte *  pCtx,
ubyte4  ctxLen,
void *  pExtCtx 
)

A one shot verify of a message via the EdDSA algorithm.

Parameters
pKeyPointer to the public key.
pMessageBuffer holding the message to be verified.
messageLenThe length of the message in bytes.
pSignatureBuffer holding the signature to be verified.
signatureLenThe length of the signature in bytes.
pVerifyStatusContents will be set to 0 for a valid signature and a nonzero value for an invalid signature.
preHashSet to TRUE (1) for EdDSAph "pre-hash" mode.
pCtxOptional. For curve25519 set to non-null for Ed25519ctx mode. For curve448 the context is optional for pure Ed448 or pre-hash mode.
ctxLenThe length of the context in bytes. This cannot be more than 255.
pExtCtxAn extended context reserved for future use.
Warning
Be sure to check for both a return status of OK and a verify status of 0 before accepting that a signature is valid.
Returns
OK (0) if successful execution of the method, otherwise a negative number error code from merrors.h