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

Cryptographic Interface header file for declaring Signature based authentication methods. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_SIG_getSignatureLen (QS_CTX *pCtx, ubyte4 *pSigLen)
 Gets the length or maximum length of a signature associated with a QS context in bytes. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_SIG_signMessage (QS_CTX *pCtx, RNGFun rngFun, void *pRngFunArg, ubyte *pMessage, ubyte4 messageLen, ubyte *pSignature, ubyte4 sigBufferLen, ubyte4 *pActualSigLen)
 Performs the signature generation algorithm. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_SIG_signMessageAlloc (QS_CTX *pCtx, RNGFun rngFun, void *pRngFunArg, ubyte *pMessage, ubyte4 messageLen, ubyte **ppSignature, ubyte4 *pSignatureLen)
 Performs the signature generation algorithm. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_SIG_verifyMessage (QS_CTX *pCtx, ubyte *pMessage, ubyte4 messageLen, ubyte *pSignature, ubyte4 signatureLen, ubyte4 *pVerifyStatus)
 Performs the signature verification algorithm. More...
 

Detailed Description

Function Documentation

◆ CRYPTO_INTERFACE_QS_SIG_getSignatureLen()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_SIG_getSignatureLen ( QS_CTX pCtx,
ubyte4 *  pSigLen 
)

Gets the length of a signature associated with a QS context in bytes. For the algorithm FALCON this method gets the maximum length that a singature can be.

Parameters
pCtxPointer to the QS context.
pSigLenContents will be set to the length of the signature or maximum length in bytes.
Warning
For FALCON remember the contents of pSigLen just represent the maximum length of a signature.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ CRYPTO_INTERFACE_QS_SIG_signMessage()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_SIG_signMessage ( QS_CTX pCtx,
RNGFun  rngFun,
void *  pRngFunArg,
ubyte *  pMessage,
ubyte4  messageLen,
ubyte *  pSignature,
ubyte4  sigBufferLen,
ubyte4 *  pActualSigLen 
)

Performs the signature generation algorithm.

Parameters
pCtxPointer to a previously allocated context.
rngFunFunction pointer to a random number generation function.
pRngFunArgInput data or context into the random number generation function
pMessageBuffer holding the input messasge.
messageLenThe length of the message in bytes.
pSignatureBuffer that will hold the resulting signature.
sigBufferLenThe length of the pSignature buffer in bytes.
pActualSigLenContents will be set to the actual length of the signature, ie the number of bytes written to pSignature.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ CRYPTO_INTERFACE_QS_SIG_signMessageAlloc()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_SIG_signMessageAlloc ( QS_CTX pCtx,
RNGFun  rngFun,
void *  pRngFunArg,
ubyte *  pMessage,
ubyte4  messageLen,
ubyte **  ppSignature,
ubyte4 *  pSignatureLen 
)

Performs the signature generation algorithm. This method allocates a buffer for the signature. Be sure to free this buffer whwn done with it.

Parameters
pCtxPointer to a previously allocated context.
rngFunFunction pointer to a random number generation function.
pRngFunArgInput data or context into the random number generation function
pMessageBuffer holding the input messasge.
messageLenThe length of the message in bytes.
ppSignaturePointer to the location of the newly allocated buffer that will contain the output signature.
pSignatureLenContents will be set to the length of the signature in bytes. For FALCON This may be fewer bytes than what is allocated for ppSignature.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ CRYPTO_INTERFACE_QS_SIG_verifyMessage()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_SIG_verifyMessage ( QS_CTX pCtx,
ubyte *  pMessage,
ubyte4  messageLen,
ubyte *  pSignature,
ubyte4  signatureLen,
ubyte4 *  pVerifyStatus 
)

Performs the signature verification algorithm.

Parameters
pCtxPointer to a previously allocated context.
pMessageBuffer holding the input messasge.
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 non-zero otherwise.
Warning
Be sure to check both a status of OK (0) and a verify status of 0 before accepting that a signature is valid.
Returns
OK (0) for successful completion of the method regardless of whether the signature is valid for the input message, otherwise a negative number error code from merrors.h.