TrustCore SDK Crypto Interface API reference  version 2.0
crypto_interface_dsa.h
Go to the documentation of this file.
1 /*
2  * crypto_interface_dsa.h
3  *
4  * Cryptographic Interface header file for declaring DSA methods
5  * for the Crypto Interface.
6  *
7  * Copyright 2019-2024 DigiCert, Inc. All Rights Reserved.
8  * Proprietary and Confidential Material.
9  *
10  */
11 
18 #ifndef __CRYPTO_INTERFACE_DSA_HEADER__
19 #define __CRYPTO_INTERFACE_DSA_HEADER__
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
51 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_createKey (
52  DSAKey **pp_dsaDescr
53  );
54 
78 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_cloneKey (
79  MOC_DSA(hwAccelDescr hwAccelCtx)
80  DSAKey** ppNew,
81  const DSAKey* pSrc
82  );
83 
111 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_freeKey (
112  DSAKey **pp_dsaDescr,
113  vlong **ppVlongQueue
114  );
115 
152 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_computeKeyPair(
153  MOC_DSA(hwAccelDescr hwAccelCtx) randomContext* pFipsRngCtx,
154  DSAKey *p_dsaDescr,
155  vlong **ppVlongQueue
156  );
157 
190 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_makeKeyBlob (
191  MOC_DSA(hwAccelDescr hwAccelCtx)
192  const DSAKey *p_dsaDescr,
193  ubyte *pKeyBlob,
194  ubyte4 *pRetKeyBlobLength
195  );
196 
222 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_extractKeyBlob (
223  MOC_DSA(hwAccelDescr hwAccelCtx)
224  DSAKey **pp_RetNewDsaDescr,
225  const ubyte *pKeyBlob,
226  ubyte4 keyBlobLength
227  );
228 
253 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_equalKey (
254  MOC_DSA(hwAccelDescr hwAccelCtx)
255  const DSAKey *pKey1,
256  const DSAKey *pKey2,
257  byteBoolean* pResult
258  );
259 
278 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_getCipherTextLength (
279  MOC_DSA(hwAccelDescr hwAccelCtx)
280  const DSAKey *pKey,
281  sbyte4* cipherTextLen
282  );
283 
284 
305 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_getSignatureLength (
306  MOC_DSA(hwAccelDescr hwAccelCtx)
307  DSAKey *pKey,
308  ubyte4 *pSigLen
309  );
310 
354 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_generatePQ (
355  MOC_DSA(hwAccelDescr hwAccelCtx) randomContext* pFipsRngCtx,
356  DSAKey *p_dsaDescr,
357  ubyte4 L,
358  ubyte4 Nin,
359  DSAHashType hashType,
360  ubyte4 *pRetC,
361  ubyte *pRetSeed,
362  vlong **ppVlongQueue
363  );
364 
397 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_generateKeyAux (
398  MOC_DSA(hwAccelDescr hwAccelCtx) randomContext* pFipsRngCtx,
399  DSAKey *p_dsaDescr,
400  ubyte4 keySize,
401  vlong **ppVlongQueue
402  );
403 
445 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_generateKeyAux2 (
446  MOC_DSA(hwAccelDescr hwAccelCtx) randomContext* pFipsRngCtx,
447  DSAKey *p_dsaDescr,
448  ubyte4 keySize,
449  ubyte4 qSize,
450  DSAHashType hashType,
451  vlong **ppVlongQueue
452  );
453 
489 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_computeSignatureAux (
490  MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pRngCtx,
491  DSAKey *pKey,
492  ubyte *pM,
493  ubyte4 mLen,
494  intBoolean *pVerify,
495  ubyte **ppR,
496  ubyte4 *pRLen,
497  ubyte **ppS,
498  ubyte4 *pSLen,
499  vlong **ppVlongQueue
500  );
501 
536 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_verifySignatureAux (
537  MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey,
538  ubyte *pM,
539  ubyte4 mLen,
540  ubyte *pR,
541  ubyte4 rLen,
542  ubyte *pS,
543  ubyte4 sLen,
544  intBoolean *pIsGoodSignature,
545  vlong **ppVlongQueue
546  );
547 
567 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_setKeyParametersAux (
568  MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey,
569  MDsaKeyTemplatePtr pTemplate
570  );
571 
595  MOC_DSA(hwAccelDescr hwAccelCtx)
596  DSAKey *pKey,
597  MDsaKeyTemplatePtr pTemplate,
598  ubyte keyType
599  );
600 
619 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_freeKeyTemplate (
620  DSAKey *pKey,
621  MDsaKeyTemplatePtr pTemplate
622  );
623 
654 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_generateRandomGAux (MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey,
655  randomContext *pRandomContext, ubyte **ppH, ubyte4 *pHLen, vlong **ppVlongQueue);
656 
692 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_computeSignature2Aux(MOC_DSA(hwAccelDescr hwAccelCtx) RNGFun rngfun, void *pRngArg, DSAKey *pKey, ubyte *pM, ubyte4 mLen,
693  ubyte **ppR, ubyte4 *pRLen, ubyte **ppS, ubyte4 *pSLen, vlong **ppVlongQueue);
694 
695 
730 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_verifySignature2Aux(MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, ubyte *pM, ubyte4 mLen,
731  ubyte *pR, ubyte4 rLen, ubyte *pS, ubyte4 sLen,
732  intBoolean *pIsGoodSignature, vlong **ppVlongQueue);
733 
755 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_verifyPublicKey(
756  MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey,
757  intBoolean *pIsValid,
758  vlong **ppVlongQueue);
759 
781 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_verifyKeyPair(
782  MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey,
783  intBoolean *pIsValid,
784  vlong **ppVlongQueue);
785 
786 
808 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_verifyPrivateKey(
809  MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey,
810  intBoolean *pIsValid,
811  vlong **ppVlongQueue);
812 
813 #ifdef __cplusplus
814 }
815 #endif
816 
817 #endif /* __CRYPTO_INTERFACE_DSA_HEADER__ */
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_getCipherTextLength(MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *pKey, sbyte4 *cipherTextLen)
Gets the length in bytes of the DSA prime p.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_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.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_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...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_computeSignature2Aux(MOC_DSA(hwAccelDescr hwAccelCtx) RNGFun rngfun, void *pRngArg, DSAKey *pKey, ubyte *pM, ubyte4 mLen, ubyte **ppR, ubyte4 *pRLen, ubyte **ppS, ubyte4 *pSLen, vlong **ppVlongQueue)
Computes the DSA signature after message truncation.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_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.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_freeKey(DSAKey **pp_dsaDescr, vlong **ppVlongQueue)
Free (delete) a DSA key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_generateRandomGAux(MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, randomContext *pRandomContext, ubyte **ppH, ubyte4 *pHLen, vlong **ppVlongQueue)
Randomly computes a generator g of the cyclic group of order q.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_extractKeyBlob(MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey **pp_RetNewDsaDescr, const ubyte *pKeyBlob, ubyte4 keyBlobLength)
Get DSA key data structure converted from DSA key blob.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_cloneKey(MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey **ppNew, const DSAKey *pSrc)
Clone (copy) a DSA key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_verifySignature2Aux(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 after message truncation.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_getKeyParametersAlloc(MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, MDsaKeyTemplatePtr pTemplate, ubyte keyType)
Gets DSA key and domain parameters.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_freeKeyTemplate(DSAKey *pKey, MDsaKeyTemplatePtr pTemplate)
Frees the fields within a key template.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_verifyPublicKey(MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, intBoolean *pIsValid, vlong **ppVlongQueue)
Validates a DSA public key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_makeKeyBlob(MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *p_dsaDescr, ubyte *pKeyBlob, ubyte4 *pRetKeyBlobLength)
Get DSA key blob converted from DSA key data structure.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_setKeyParametersAux(MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, MDsaKeyTemplatePtr pTemplate)
Sets DSA key and domain parameters.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_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.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_verifyPrivateKey(MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, intBoolean *pIsValid, vlong **ppVlongQueue)
Validates a DSA private key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_verifyKeyPair(MOC_DSA(hwAccelDescr hwAccelCtx) DSAKey *pKey, intBoolean *pIsValid, vlong **ppVlongQueue)
Validates a DSA private/public key pair.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_computeKeyPair(MOC_DSA(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, DSAKey *p_dsaDescr, vlong **ppVlongQueue)
Generate DSA key pair (but not their associated parameters).
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_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...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_equalKey(MOC_DSA(hwAccelDescr hwAccelCtx) const DSAKey *pKey1, const DSAKey *pKey2, byteBoolean *pResult)
Determine whether two DSA keys are equal.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DSA_createKey(DSAKey **pp_dsaDescr)
Create memory storage for a DSA key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_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.