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

Header file for the Nanocrypto DSA API. More...

Go to the source code of this file.

Typedefs

typedef struct MDsaKeyTemplate * MDsaKeyTemplatePtr
 

Enumerations

enum  DSAHashType {
  DSA_sha1 = FFC_sha1, DSA_sha224 = FFC_sha224, DSA_sha256 = FFC_sha256, DSA_sha384 = FFC_sha384,
  DSA_sha512 = FFC_sha512
}
 
enum  DSAKeyType { DSA_186_2, DSA_186_4 }
 

Functions

MOC_EXTERN MSTATUS DSA_cloneKey (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey **ppNew, const DSAKey *pSrc)
 Clone (copy) a DSA key. More...
 
MOC_EXTERN MSTATUS DSA_computeKeyPair (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, DSAKey *p_dsaDescr, vlong **ppVlongQueue)
 Generate DSA key pair (but not their associated parameters). More...
 
MOC_EXTERN MSTATUS DSA_computeKeyPairEx (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, DSAKey *p_dsaDescr, ubyte4 Lin, ubyte4 Nin, vlong **ppVlongQueue)
 Generate DSA key pair (but not their associated parameters). More...
 
MOC_EXTERN MSTATUS DSA_computeSignature (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, const DSAKey *p_dsaDescr, vlong *m, intBoolean *pVerifySignature, vlong **ppR, vlong **ppS, vlong **ppVlongQueue)
 Generate DSA signature. More...
 
MOC_EXTERN MSTATUS DSA_computeSignatureAux (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pRngCtx, DSAKey *pKey, ubyte *pM, ubyte4 mLen, intBoolean *pVerify, ubyte **ppR, ubyte4 *pRLen, ubyte **ppS, ubyte4 *pSLen, vlong **ppVlongQueue)
 Computes the DSA signature. More...
 
MOC_EXTERN MSTATUS DSA_computeSignatureEx (MOC_DSA(hwAccelDescr hwAccelCtx) RNGFun rngfun, void *rngArg, const DSAKey *p_dsaDescr, vlong *m, intBoolean *pVerifySignature, vlong **ppR, vlong **ppS, vlong **ppVlongQueue)
 This is the same as DSAComputeSignature, except that it uses an RNGFun and rngArg to generate the random values, rather than a randomContext. More...
 
MOC_EXTERN MSTATUS DSA_createKey (DSAKey **pp_dsaDescr)
 Create memory storage for a DSA key. More...
 
MOC_EXTERN MSTATUS DSA_equalKey (MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *pKey1, const DSAKey *pKey2, byteBoolean *pResult)
 Determine whether two DSA keys are equal. More...
 
MOC_EXTERN MSTATUS DSA_extractKeyBlob (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey **pp_RetNewDsaDescr, const ubyte *pKeyBlob, ubyte4 keyBlobLength)
 Get DSA key data structure converted from DSA key blob. More...
 
MOC_EXTERN MSTATUS DSA_freeKey (DSAKey **pp_dsaDescr, vlong **ppVlongQueue)
 Free (delete) a DSA key. More...
 
MOC_EXTERN MSTATUS DSA_freeKeyTemplate (DSAKey *pKey, MDsaKeyTemplatePtr pTemplate)
 Frees the fields within a key template. More...
 
MOC_EXTERN MSTATUS DSA_generateKey (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, DSAKey *p_dsaDescr, ubyte4 keySize, ubyte4 *pRetC, ubyte *pRetSeed, vlong **ppRetH, vlong **ppVlongQueue)
 Generate DSA key pair (private and public keys) and associated parameters. More...
 
MOC_EXTERN MSTATUS DSA_generateKeyAux (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, DSAKey *p_dsaDescr, ubyte4 keySize, vlong **ppVlongQueue)
 Generate DSA key pair (private and public keys) and associated parameters. More...
 
MOC_EXTERN MSTATUS DSA_generateKeyAux2 (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, DSAKey *p_dsaDescr, ubyte4 keySize, ubyte4 qSize, DSAHashType hashType, vlong **ppVlongQueue)
 Generate DSA key pair (private and public keys) and associated parameters with flexibility to set the q size and hash algo. More...
 
MOC_EXTERN MSTATUS DSA_generateKeyEx (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, DSAKey *p_dsaDescr, ubyte4 keySize, ubyte4 qSize, DSAHashType hashType, ubyte4 *pRetC, ubyte *pRetSeed, vlong **ppRetH, vlong **ppVlongQueue)
 Generate DSA key pair (private and public keys). More...
 
MOC_EXTERN MSTATUS DSA_generateRandomG (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *p_dsaDescr, randomContext *pRandomContext, vlong **ppRetH, vlong **ppVlongQueue)
 Randomly computes a generator g of the cyclic group of order q. More...
 
MOC_EXTERN MSTATUS DSA_generateRandomGAux (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *p_dsaDescr, randomContext *pRandomContext, ubyte **ppH, ubyte4 *pHLen, vlong **ppVlongQueue)
 Randomly computes a generator g of the cyclic group of order q. More...
 
MOC_EXTERN MSTATUS DSA_getCipherTextLength (MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *pKey, sbyte4 *cipherTextLen)
 Gets the length in bytes of the DSA prime p. More...
 
MOC_EXTERN MSTATUS DSA_getKeyParametersAlloc (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, MDsaKeyTemplatePtr pTemplate, ubyte keyType)
 Gets DSA key and domain parameters. More...
 
MOC_EXTERN MSTATUS DSA_getSignatureLength (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, ubyte4 *pSigLen)
 Gets the length in bytes of the DSA prime q and therefore the signature components r and s. More...
 
MOC_EXTERN MSTATUS DSA_makeKeyBlob (MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *p_dsaDescr, ubyte *pKeyBlob, ubyte4 *pRetKeyBlobLength)
 Get DSA key blob converted from DSA key data structure. More...
 
MOC_EXTERN MSTATUS DSA_setAllKeyParameters (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, const ubyte *p, ubyte4 pLen, const ubyte *q, ubyte4 qLen, const ubyte *g, ubyte4 gLen, const ubyte *x, ubyte4 xLen, vlong **ppVlongQueue)
 Sets all the DSA domain and key parameters in a DSA key. More...
 
MOC_EXTERN MSTATUS DSA_setKeyParameters (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, const ubyte *p, ubyte4 pLen, const ubyte *q, ubyte4 qLen, const ubyte *g, ubyte4 gLen, vlong **ppVlongQueue)
 Sets the DSA domain parameters in a DSA key. More...
 
MOC_EXTERN MSTATUS DSA_setKeyParametersAux (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, MDsaKeyTemplatePtr pTemplate)
 Sets DSA key and domain parameters. More...
 
MOC_EXTERN MSTATUS DSA_setPublicKeyParameters (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, const ubyte *p, ubyte4 pLen, const ubyte *q, ubyte4 qLen, const ubyte *g, ubyte4 gLen, const ubyte *y, ubyte4 yLen, vlong **ppVlongQueue)
 Sets all the DSA domain and public key parameters in a DSA key. More...
 
MOC_EXTERN MSTATUS DSA_verifyG (MOC_DSA(hwAccelDescr hwAccelCtx) vlong *pP, vlong *pQ, vlong *pG, intBoolean *isValid, vlong **ppVlongQueue)
 Verifies that g generates a cyclic group of prime order q. More...
 
MOC_EXTERN MSTATUS DSA_verifyKeys (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, ubyte *pSeed, const DSAKey *p_dsaDescr, ubyte4 C, vlong *pH, intBoolean *isGoodKeys, vlong **ppVlongQueue)
 Verify DSA key. More...
 
MOC_EXTERN MSTATUS DSA_verifyKeysEx (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, ubyte *pSeed, ubyte4 seedSize, const DSAKey *p_dsaDescr, DSAHashType hashType, DSAKeyType keyType, ubyte4 C, vlong *pH, intBoolean *isGoodKeys, vlong **ppVlongQueue)
 Verify DSA key. More...
 
MOC_EXTERN MSTATUS DSA_verifyPQ (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, DSAKey *p_dsaDescr, ubyte4 L, ubyte4 Nin, DSAHashType hashType, DSAKeyType keyType, ubyte4 C, ubyte *pSeed, ubyte4 seedSize, intBoolean *pIsPrimePQ, vlong **ppVlongQueue)
 Verifies that the parameters p and q come from seed and initial domain parameters passed in. More...
 
MOC_EXTERN MSTATUS DSA_verifySignature (MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *p_dsaDescr, vlong *m, vlong *pR, vlong *pS, intBoolean *isGoodSignature, vlong **ppVlongQueue)
 Verify message's DSA signature. More...
 
MOC_EXTERN MSTATUS DSA_verifySignatureAux (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, ubyte *pM, ubyte4 mLen, ubyte *pR, ubyte4 rLen, ubyte *pS, ubyte4 sLen, intBoolean *pIsGoodSignature, vlong **ppVlongQueue)
 Verifies a DSA signature. More...
 
MOC_EXTERN MSTATUS generateG (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *p_dsaDescr, vlong **ppRetH, vlong **ppVlongQueue)
 Deterministically computes a generator g of the cyclic group of order q. More...
 
MOC_EXTERN MSTATUS generatePQ (MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, DSAKey *p_dsaDescr, ubyte4 L, ubyte4 Nin, DSAHashType hashType, ubyte4 *pRetC, ubyte *pRetSeed, vlong **ppVlongQueue)
 Generates the DSA domain parameters p and q. More...
 

Detailed Description

This file documents the APIs of NanoCrypto DSA.

To use these APIs one must define

  • __ENABLE_MOCANA_DSA__

dsa.h

Function Documentation

◆ DSA_cloneKey()

MOC_EXTERN MSTATUS DSA_cloneKey ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey **  ppNew,
const DSAKey *  pSrc 
)

This function clones (copies) a DSA key. To avoid memory leaks, your application should call DSA_freeKey() when it is done using the cloned key.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
ppNewOn return, double pointer to cloned (copied) DSA key.
pSrcPointer to DSA key to clone (copy).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_computeKeyPair()

MOC_EXTERN MSTATUS DSA_computeKeyPair ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pFipsRngCtx,
DSAKey *  p_dsaDescr,
vlong **  ppVlongQueue 
)

This function generates a DSA key pair, but not their associated parameters (which should already be within the DSA key). This method will obtain the key length and q length from the key, else use DSA_computeKeyPairEx.

Note
To generate a DSA key pair and their associated parameters, call the DSA_generateKey() function instead of this function.
FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing.
pFipsRngCtxPointer to RNG context to use for DSA key generation.
p_dsaDescrPointer to DSA key memory, previously allocated by calling DSA_createKey(), and already filled with associated parameters.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_computeKeyPairEx()

MOC_EXTERN MSTATUS DSA_computeKeyPairEx ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pFipsRngCtx,
DSAKey *  p_dsaDescr,
ubyte4  Lin,
ubyte4  Nin,
vlong **  ppVlongQueue 
)

This function generates a DSA key pair, but not their associated parameters (which should already be within the DSA key).

Note
To generate a DSA key pair and their associated parameters, call the DSA_generateKey() function instead of this function.

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing.
pFipsRngCtxPointer to RNG context to use for DSA key generation.
p_dsaDescrPointer to DSA key memory, previously allocated by calling DSA_createKey(), and already filled with associated parameters.
LinThe length in bytes of the DSA prime p. (not used by this method)
NinThe length in bytes of the DSA cyclic group order q.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_computeSignature()

MOC_EXTERN MSTATUS DSA_computeSignature ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pRandomContext,
const DSAKey *  p_dsaDescr,
vlong *  m,
intBoolean *  pVerifySignature,
vlong **  ppR,
vlong **  ppS,
vlong **  ppVlongQueue 
)

This function generates a DSA signature.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
pRandomContextPointer to RNG context to use for signature generation.
p_dsaDescrPointer to DSA key pair.
mPointer to digested input message.
pVerifySignatureOn return, pointer to TRUE if generated signature is valid; otherwise pointer to FALSE.
ppROn return, pointer to address of R portion of the resultant signature.
ppSOn return, pointer to address of S portion of the resultant signature.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_computeSignatureAux()

MOC_EXTERN MSTATUS DSA_computeSignatureAux ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pRngCtx,
DSAKey *  pKey,
ubyte *  pM,
ubyte4  mLen,
intBoolean *  pVerify,
ubyte **  ppR,
ubyte4 *  pRLen,
ubyte **  ppS,
ubyte4 *  pSLen,
vlong **  ppVlongQueue 
)

Computes the DSA signature. This method allocates buffers to hold the signature values R and S. Be sure to free these buffers when done.

Parameters
pRngCtxPointer to RNG context to use for DSA key and parameter generation.
pKeyPointer to DSA key memory, previously allocated by DSA_createKey().
pMThe message to be signed.
mLenThe length of the message in bytes.
pVerifyIf non-null the signature will be verified (as a sanity check) In that case contents will be set TRUE if valid and FALSE otherwise.
ppRContents will be set to the buffer holding the R value.
pRLenContents will be set to the length of R in bytes.
ppSContents will be set to the buffer holding the S value.
pSLenContents will be set to the length of S in bytes.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_computeSignatureEx()

MOC_EXTERN MSTATUS DSA_computeSignatureEx ( MOC_DSA(hwAccelDescr hwAccelCtx) RNGFun  rngfun,
void *  rngArg,
const DSAKey *  p_dsaDescr,
vlong *  m,
intBoolean *  pVerifySignature,
vlong **  ppR,
vlong **  ppS,
vlong **  ppVlongQueue 
)

This function generates a DSA signature.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
rngfunThe random number generating function used
rngArgAny info the rngfun needs to perform its operations
p_dsaDescrPointer to DSA key pair.
mPointer to digested input message.
pVerifySignatureOn return, pointer to TRUE if generated signature is valid; otherwise pointer to FALSE.
ppROn return, pointer to address of R portion of the resultant signature.
ppSOn return, pointer to address of S portion of the resultant signature.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_createKey()

MOC_EXTERN MSTATUS DSA_createKey ( DSAKey **  pp_dsaDescr)

This function creates storage (allocates memory) for a DSA key. After the memory is allocated, applications can use the DSA_generateKey() function to generate the DSA key.

Note
This function does not generate an actual DSA key value; to generate the DSA key pair, call the DSA_generateKey() function.
FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
pp_dsaDescrOn return, pointer to address of allocated memory (for a DSA key).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_equalKey()

MOC_EXTERN MSTATUS DSA_equalKey ( MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *  pKey1,
const DSAKey *  pKey2,
byteBoolean *  pResult 
)

This function determines whether two DSA keys are equal, and returns the result through the res parameter.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
pKey1Pointer to first DSA key.
pKey2Pointer to second DSA key.
pResultOn return, pointer to TRUE if the two keys are equal; otherwise pointer to FALSE.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_extractKeyBlob()

MOC_EXTERN MSTATUS DSA_extractKeyBlob ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey **  pp_RetNewDsaDescr,
const ubyte *  pKeyBlob,
ubyte4  keyBlobLength 
)

This function generates a DSA key data structure from information in a DSA key blob, and returns the resultant key data structure through the pp_RetNewDsaDescr parameter.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
pp_RetNewDsaDescrOn return, pointer to address of resultant DSA key variable.
pKeyBlobPointer to input key blob.
keyBlobLengthNumber of bytes in input key blob (pKeyBlob).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_freeKey()

MOC_EXTERN MSTATUS DSA_freeKey ( DSAKey **  pp_dsaDescr,
vlong **  ppVlongQueue 
)

This function frees (deletes) a DSA key. To avoid memory leaks, applications should call this function when an allocated DSA key is no longer needed.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
pp_dsaDescrPointer to address of DSA key to free (delete).
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_freeKeyTemplate()

MOC_EXTERN MSTATUS DSA_freeKeyTemplate ( DSAKey *  pKey,
MDsaKeyTemplatePtr  pTemplate 
)

Frees the fields within a key template.

Parameters
pKeyPointer to the DSA key associated with the template.
pTemplateTemplate whose fields will be freed.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_generateKey()

MOC_EXTERN MSTATUS DSA_generateKey ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pFipsRngCtx,
DSAKey *  p_dsaDescr,
ubyte4  keySize,
ubyte4 *  pRetC,
ubyte *  pRetSeed,
vlong **  ppRetH,
vlong **  ppVlongQueue 
)

This function generates a DSA key pair (private and public keys) and associated parameters. Typically, your application calls this function after calling the DSA_createKey() function.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. But... what does the user specify? In the 5.3.1 docs, we just said that this was "Reserved for future use." Ditto this for all dsa.{c,h} functions.
pFipsRngCtxPointer to RNG context to use for DSA key and parameter generation.
p_dsaDescrPointer to DSA key memory, previously allocated by DSA_createKey().
keySizeBit length of the generated DSA key. (For details, refer to the appropriate FIPS Publication, accessible from the following Web page: http://www.nist.gov/itl/fips.cfm.) Currently supported are lengths of 1024, 2048, and 3072.
pRetCOn return, pointer to C value to use for DSK key verification.
pRetSeedIf NULL, the function does not return the seed, otherwise, it is a user-supplied buffer into which the function will place the seed value. This is a value related to FIPS certification. It must be the same size as the subprime (160 bits for 1024-bit DSA keys, 256 bits for 2048-bit or 3072-bit DSA keys)
ppRetHOn return, pointer to address of H value to use for DSA key verification (see DSA_verifyKeys). Call VLONG_freeVlong when you are done with this value.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used (see DSA_verifyKeys). (Before ending, your application should be sure to free the entire queue by calling VLONG_freeVlongQueue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_generateKeyAux()

MOC_EXTERN MSTATUS DSA_generateKeyAux ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pFipsRngCtx,
DSAKey *  p_dsaDescr,
ubyte4  keySize,
vlong **  ppVlongQueue 
)

Generate DSA key pair (private and public keys) and associated parameters.

Parameters
pFipsRngCtxPointer to RNG context to use for DSA key and parameter generation.
p_dsaDescrPointer to DSA key memory, previously allocated by DSA_createKey().
keySizeBit length of the generated DSA key. (For details, refer to the appropriate FIPS Publication, accessible from the following Web page: http://www.nist.gov/itl/fips.cfm.) Currently supported are lengths of 1024, 2048, and 3072.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_generateKeyAux2()

MOC_EXTERN MSTATUS DSA_generateKeyAux2 ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pFipsRngCtx,
DSAKey *  p_dsaDescr,
ubyte4  keySize,
ubyte4  qSize,
DSAHashType  hashType,
vlong **  ppVlongQueue 
)

Generate DSA key pair (private and public keys) and associated parameters with flexibility to set the q size and hash algo.

Parameters
pFipsRngCtxPointer to RNG context to use for DSA key and parameter generation.
p_dsaDescrPointer to DSA key memory, previously allocated by DSA_createKey().
keySizeBit length of the generated DSA domain parameter p. (For details, refer to the appropriate FIPS Publication, accessible from the following Web page: http://www.nist.gov/itl/fips.cfm.) Currently supported are lengths of 1024, 2048, and 3072.
qSizeBit length of the generated DSA domain parameter q. Currently supported lengths are 160, 224, and 256.
hashTypeThe hash algorithm to use in domain parameter generation. Valid values are... DSA_sha1 DSA_sha224 DSA_sha256 DSA_sha384 DSA_sha512
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_generateKeyEx()

MOC_EXTERN MSTATUS DSA_generateKeyEx ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pFipsRngCtx,
DSAKey *  p_dsaDescr,
ubyte4  keySize,
ubyte4  qSize,
DSAHashType  hashType,
ubyte4 *  pRetC,
ubyte *  pRetSeed,
vlong **  ppRetH,
vlong **  ppVlongQueue 
)

Generate DSA key pair (private and public keys) and associated parameters. This method allows for a hash type and qSize to be passed in only the configurations allowed via FIPS 186-4 are allowed.

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing.
pFipsRngCtxPointer to RNG context to use for DSA key and parameter generation.
p_dsaDescrPointer to DSA key memory, previously allocated by DSA_createKey().
keySizeBit length of the generated DSA key.
qSizeBit length of the cyclic group order q.
hashTypeThe hash algorithm to use in key generation.
pRetCOn return, pointer to C value to use for DSK key verification.
pRetSeedIf NULL, the function does not return the seed, otherwise, it is a user-supplied buffer into which the function will place the seed value. This is a value related to FIPS certification. It must be the same size as the subprime (160 bits for 1024-bit DSA keys, 256 bits for 2048-bit or 3072-bit DSA keys)
ppRetHOn return, pointer to address of H value to use for DSA key verification (see DSA_verifyKeys). Call VLONG_freeVlong when you are done with this value.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used (see DSA_verifyKeys). (Before ending, your application should be sure to free the entire queue by calling VLONG_freeVlongQueue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_generateRandomG()

MOC_EXTERN MSTATUS DSA_generateRandomG ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *  p_dsaDescr,
randomContext *  pRandomContext,
vlong **  ppRetH,
vlong **  ppVlongQueue 
)

Randomly computes a generator g of the cyclic group of order q. Optionally, the intermediate value h can be be output by this method in vlong form. If exercising that option be sure to call VLONG_freeVlong when done with it.

Parameters
p_dsaDescrPointer to a previously allocated DSA key that already has the domain parameters p and q set. The new value g will be set within this DSA key too.
pRandomContextPointer to RNG context to be used.
ppRetHOptional. If provided, pointer to the location that will receive receive a newly allocated vlong with the base h used to compute g, ie g = h^((p-1)/q).
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_generateRandomGAux()

MOC_EXTERN MSTATUS DSA_generateRandomGAux ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *  p_dsaDescr,
randomContext *  pRandomContext,
ubyte **  ppH,
ubyte4 *  pHLen,
vlong **  ppVlongQueue 
)

Randomly computes a generator g of the cyclic group of order q.

Parameters
p_dsaDescrPointer to a previously allocated DSA key that already has the domain parameters p and q set. The new value g will be set within this DSA key too.
pRandomContextPointer to RNG context to be used.
ppHOptional. If provided, pointer to the location that will receive receive a newly allocated buffer with the base h used to compute g, ie g = h^((p-1)/q). h will be in Big Endian.
pHLenRequired if ppH is not NULL. Contents will be set to the length of h in bytes.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_getCipherTextLength()

MOC_EXTERN MSTATUS DSA_getCipherTextLength ( MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *  pKey,
sbyte4 *  cipherTextLen 
)

Gets the length in bytes of the DSA prime p.

Parameters
pKeyPointer to a DSA key that has its domain parameters set.
cipherTextLenContents will be set to the length in bytes of the DSA prime p.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_getKeyParametersAlloc()

MOC_EXTERN MSTATUS DSA_getKeyParametersAlloc ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *  pKey,
MDsaKeyTemplatePtr  pTemplate,
ubyte  keyType 
)

Gets DSA key and domain parameters. This method will allocated the fields within the passed in template. Be sure to call DSA_freeKeyTemplate to free these fields when done with them.

Parameters
pKeyPointer to the DSA key memory containing key and domain parameters.
pTemplateTarget template that will hold all parameters that were contained in pKey.
keyTypeType of key data to receive, must be one of MOC_GET_PUBLIC_KEY_DATA or MOC_GET_PRIVATE_KEY_DATA.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_getSignatureLength()

MOC_EXTERN MSTATUS DSA_getSignatureLength ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *  pKey,
ubyte4 *  pSigLen 
)

Gets the length in bytes of the DSA prime q and therefore the signature components r and s.

Parameters
pKeyPointer to a DSA key that has its domain parameters set.
pSigLenContents will be set to the length in bytes of the DSA prime q.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_makeKeyBlob()

MOC_EXTERN MSTATUS DSA_makeKeyBlob ( MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *  p_dsaDescr,
ubyte *  pKeyBlob,
ubyte4 *  pRetKeyBlobLength 
)

This function generates a DSA key blob from information in a DSA key data structure, and returns the resultant key blob through the pKeyBlob parameter.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

Warning
Before calling this function, be sure that the buffer pointed to by the pKeyBlob parameter is large enough; otherwise, buffer overflow will occur.

dsa.h

Parameters
p_dsaDescrPointer to DSA key variable's data structure.
pKeyBlobOn return, pointer to resultant key blob. (The calling function must allocate sufficient memory for the result; otherwise buffer overflow will occur.)
pRetKeyBlobLengthOn return, pointer to number of bytes in resultant key blob buffer (pKeyBlob).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_setAllKeyParameters()

MOC_EXTERN MSTATUS DSA_setAllKeyParameters ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *  pKey,
const ubyte *  p,
ubyte4  pLen,
const ubyte *  q,
ubyte4  qLen,
const ubyte *  g,
ubyte4  gLen,
const ubyte *  x,
ubyte4  xLen,
vlong **  ppVlongQueue 
)

Sets all the DSA domain and key parameters in a DSA key from Big Endian byte arrays. The public key will be computed from the private key.

Parameters
pKeyPointer to a previously allocated DSA key.
pThe DSA large prime number p as a Big Endian byte array.
pLenThe length of p in bytes.
qThe cyclic group order q as a Big Endian byte array.
qLenThe length of q in bytes.
gThe cyclic group generator g as a Big Endian byte array.
gLenThe length of g in bytes.
xThe private key x as a Big Endian byte array.
xLenThe length of x in bytes.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_setKeyParameters()

MOC_EXTERN MSTATUS DSA_setKeyParameters ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *  pKey,
const ubyte *  p,
ubyte4  pLen,
const ubyte *  q,
ubyte4  qLen,
const ubyte *  g,
ubyte4  gLen,
vlong **  ppVlongQueue 
)

Sets the DSA domain parameters in a DSA key from Big Endian byte arrays. Setting the generator g is optional.

Parameters
pKeyPointer to a previously allocated DSA key.
pThe DSA large prime number p as a Big Endian byte array.
pLenThe length of p in bytes.
qThe cyclic group order q as a Big Endian byte array.
qLenThe length of q in bytes.
gOptional. The cyclic group generator g as a Big Endian byte array.
gLenThe length of g in bytes.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_setKeyParametersAux()

MOC_EXTERN MSTATUS DSA_setKeyParametersAux ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *  pKey,
MDsaKeyTemplatePtr  pTemplate 
)

Sets DSA key and domain parameters.

Parameters
pKeyPointer to the target DSA key memory, previously allocated by DSA_createKey().
pTemplateTemplate holding the paramters to be set.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_setPublicKeyParameters()

MOC_EXTERN MSTATUS DSA_setPublicKeyParameters ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *  pKey,
const ubyte *  p,
ubyte4  pLen,
const ubyte *  q,
ubyte4  qLen,
const ubyte *  g,
ubyte4  gLen,
const ubyte *  y,
ubyte4  yLen,
vlong **  ppVlongQueue 
)

Sets all the DSA domain and public key parameters in a DSA key from Big Endian byte arrays.

Parameters
pKeyPointer to a previously allocated DSA key.
pThe DSA large prime number p as a Big Endian byte array.
pLenThe length of p in bytes.
qThe cyclic group order q as a Big Endian byte array.
qLenThe length of q in bytes.
gThe cyclic group generator g as a Big Endian byte array.
gLenThe length of g in bytes.
yThe public key y as a Big Endian byte array.
yLenThe length of y in bytes.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ DSA_verifyG()

MOC_EXTERN MSTATUS DSA_verifyG ( MOC_DSA(hwAccelDescr hwAccelCtx) vlong *  pP,
vlong *  pQ,
vlong *  pG,
intBoolean *  isValid,
vlong **  ppVlongQueue 
)

Verifies that g generates a cyclic group of prime order q. This method does not verify q is prime. If q is not prime then g will also not be properly verified as a generator of the cyclic group.

Parameters
pPThe DSA large prime number p.
pQThe cyclic group order q.
pGThe integer g to be verified.
isValidContents will be set to TRUE if p and q are successfully verified and FALSE otherwise.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

◆ DSA_verifyKeys()

MOC_EXTERN MSTATUS DSA_verifyKeys ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pFipsRngCtx,
ubyte *  pSeed,
const DSAKey *  p_dsaDescr,
ubyte4  C,
vlong *  pH,
intBoolean *  isGoodKeys,
vlong **  ppVlongQueue 
)

This function verifies a DSA key that was generated by the DSA_generateKey() function with a default seed length of 20 bytes, a default hashType of SHA-1, and a default keyType of DSA_186_4.

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing.
pFipsRngCtxPointer to RNG context used for DSA key generation.
pSeedPointer to seed value returned from DSA_generateKey().
p_dsaDescrPointer to DSA key to verify.
CThe iteration count C value returned from DSA_generateKey().
pHPointer to H value returned from DSA_generateKey().
isGoodKeysOn return, pointer to TRUE if the key is valid; otherwise pointer to FALSE.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_verifyKeysEx()

MOC_EXTERN MSTATUS DSA_verifyKeysEx ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pFipsRngCtx,
ubyte *  pSeed,
ubyte4  seedSize,
const DSAKey *  p_dsaDescr,
DSAHashType  hashType,
DSAKeyType  keyType,
ubyte4  C,
vlong *  pH,
intBoolean *  isGoodKeys,
vlong **  ppVlongQueue 
)

This function verifies a DSA key that was generated by the DSA_generateKey() function.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing.
pFipsRngCtxPointer to RNG context used for DSA key generation.
pSeedPointer to seed value returned from DSA_generateKey().
seedSizeThe size of the seed in bytes.
p_dsaDescrPointer to DSA key to verify.
hashTypeThe hash algorithm used within DSA_generateKey().
keyTypeEither DSA_186_2 or DSA_186_4.
CThe iteration count C value returned from DSA_generateKey().
pHPointer to H value returned from DSA_generateKey().
isGoodKeysOn return, pointer to TRUE if the key is valid; otherwise pointer to FALSE.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_verifyPQ()

MOC_EXTERN MSTATUS DSA_verifyPQ ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pFipsRngCtx,
DSAKey *  p_dsaDescr,
ubyte4  L,
ubyte4  Nin,
DSAHashType  hashType,
DSAKeyType  keyType,
ubyte4  C,
ubyte *  pSeed,
ubyte4  seedSize,
intBoolean *  pIsPrimePQ,
vlong **  ppVlongQueue 
)

Verifies that the parameters p and q come from seed and initial domain parameters passed in.

Parameters
pFipsRngCtxPointer to RNG context used during DSA key generation.
p_dsaDescrPointer to DSA key to with the p and q to verify.
LThe key size in bits.
NinThe cyclic group order q's size in bits.
hashTypeThe original hash type used when key generation was done.
keyTypeThe original key type DSA_186_2 or DSA_186_4 used when key generation was done.
CThe iteration count C value returned when original key generation was done.
pSeedBuffer holding the original seed used to generate p and q.
seedSizeThe length of the seed in bytes.
pIsPrimePQContents will be set to TRUE if p and q are successfully verified and FALSE otherwise.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

◆ DSA_verifySignature()

MOC_EXTERN MSTATUS DSA_verifySignature ( MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *  p_dsaDescr,
vlong *  m,
vlong *  pR,
vlong *  pS,
intBoolean *  isGoodSignature,
vlong **  ppVlongQueue 
)

This function verifies a message's DSA signature.

FIPS Approved
check-green.gif
Suite B Algorithm
x-red.gif
Flowchart DSA

To use this API one must define + __ENABLE_MOCANA_DSA__

dsa.h

Parameters
hwAccelCtxIf a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing.
p_dsaDescrPointer to DSA key.
mPointer to digested input message.
pRPointer to R portion of the signature to verify.
pSPointer to S portion of the signature to verify.
isGoodSignatureOn return, pointer to TRUE if the signature is valid; otherwise pointer to FALSE.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

dsa.h

◆ DSA_verifySignatureAux()

MOC_EXTERN MSTATUS DSA_verifySignatureAux ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *  pKey,
ubyte *  pM,
ubyte4  mLen,
ubyte *  pR,
ubyte4  rLen,
ubyte *  pS,
ubyte4  sLen,
intBoolean *  pIsGoodSignature,
vlong **  ppVlongQueue 
)

Verifies a DSA signature.

Parameters
pKeyPointer to DSA key memory, previously allocated by DSA_createKey().
pMThe message to be verified.
mLenThe length of the message in bytes.
pRBuffer holding the R value.
rLenThe length of R in bytes.
pSBuffer holding the S value.
sLenThe length of S in bytes.
pIsGoodSignatureContents will be set to TRUE if the signature is valid and FALSE otherwise.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Warning
Be sure to check BOTH a status of OK and a pIsGoodSignature of TRUE before accepting that a signature is valid.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ generateG()

MOC_EXTERN MSTATUS generateG ( MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *  p_dsaDescr,
vlong **  ppRetH,
vlong **  ppVlongQueue 
)

Deterministically computes a generator g of the cyclic group of order q. Optionally, the intermediate value h can be be output by this method in vlong form. If exercising that option be sure to call VLONG_freeVlong when done with it.

Parameters
p_dsaDescrPointer to a previously allocated DSA key that already has the domain parameters p and q set. The new value g will be set within this DSA key too.
ppRetHOptional. If provided, pointer to the location that will receive receive a newly allocated vlong with the base h used to compute g, ie g = h^((p-1)/q).
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h

◆ generatePQ()

MOC_EXTERN MSTATUS generatePQ ( MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *  pFipsRngCtx,
DSAKey *  p_dsaDescr,
ubyte4  L,
ubyte4  Nin,
DSAHashType  hashType,
ubyte4 *  pRetC,
ubyte *  pRetSeed,
vlong **  ppVlongQueue 
)

Generates the DSA prime number p of the appropriate size, such that the associated mutliplicative group contains a cyclic subgroup of a prime order q of the appropriate size. The C value and seed used to generate these parameters are also given as output values.

Parameters
pFipsRngCtxPointer to RNG context to be used during DSA domain parameter generation.
p_dsaDescrPointer to a previously allocated DSA key. The domain parameters p and q will be set within this key.
LThe desired size of p in bits.
NinThe desired cyclic group order q's size in bits.
hashTypeThe hash algorithm you wish to use in domain parameter generation. This should be one of...
  • DSA_sha1
  • DSA_sha224
  • DSA_sha256
  • DSA_sha384
  • DSA_sha512
Parameters
pRetCContents will be set to the number of iterations used to compute the prime p.
pRetSeedBuffer that will be filled with the seed to the prime generation algorithm. The length of this seed in bytes is Nin/8 and this buffer should have enough space.
ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

To use this API one must define + __ENABLE_MOCANA_DSA__ dsa.h dsa.h