17 #ifndef __CRYPTO_INTERFACE_DH_HEADER__ 18 #define __CRYPTO_INTERFACE_DH_HEADER__ 20 #include "../cap/capdecl.h" 50 diffieHellmanContext **ppNewCtx,
76 diffieHellmanContext **ppNewCtx
114 MOC_DH(hwAccelDescr hwAccelCtx)
115 randomContext *pRandomContext,
116 diffieHellmanContext **ppNewCtx,
155 MOC_DH(hwAccelDescr hwAccelCtx)
156 randomContext *pRandomContext,
157 diffieHellmanContext **ppNewCtx,
194 MOC_DH(hwAccelDescr hwAccelCtx)
195 randomContext *pRandomContext,
196 diffieHellmanContext **ppNewCtx,
233 MOC_DH(hwAccelDescr hwAccelCtx)
234 randomContext *pRandomContext,
235 diffieHellmanContext **ppNewCtx,
264 diffieHellmanContext **ppDhCtx,
265 vlong **ppVlongQueue,
293 diffieHellmanContext **ppDhCtx,
316 MOC_DH(hwAccelDescr hwAccelCtx)
317 diffieHellmanContext *pTargetCtx,
318 MDhKeyTemplate *pSrcTemplate,
340 MOC_DH(hwAccelDescr hwAccelCtx)
341 diffieHellmanContext *pTargetCtx,
342 MDhKeyTemplate *pSrcTemplate
363 MOC_DH(hwAccelDescr hwAccelCtx)
364 MDhKeyTemplate *pTargetTemplate,
365 diffieHellmanContext *pSrcCtx,
387 MOC_DH(hwAccelDescr hwAccelCtx)
388 MDhKeyTemplate *pTargetTemplate,
389 diffieHellmanContext *pSrcCtx,
407 diffieHellmanContext *pCtx,
408 MDhKeyTemplate *pTemplate,
424 diffieHellmanContext *pCtx,
425 MDhKeyTemplate *pTemplate
444 MOC_DH(hwAccelDescr hwAccelCtx)
445 diffieHellmanContext *pCtx,
446 randomContext *pRandomContext,
466 MOC_DH(hwAccelDescr hwAccelCtx)
467 diffieHellmanContext *pCtx,
468 randomContext *pRandomContext,
488 MOC_DH(hwAccelDescr hwAccelCtx)
489 diffieHellmanContext *pCtx,
491 ubyte4 *pPublicKeyLen,
510 MOC_DH(hwAccelDescr hwAccelCtx)
511 diffieHellmanContext *pCtx,
513 ubyte4 *pPublicKeyLen
538 MOC_DH(hwAccelDescr hwAccelCtx)
539 diffieHellmanContext *pCtx,
540 randomContext *pRandomContext,
541 ubyte *pOtherPartysPublicKey,
543 ubyte **ppSharedSecret,
544 ubyte4 *pSharedSecretLen,
569 MOC_DH(hwAccelDescr hwAccelCtx)
570 diffieHellmanContext *pCtx,
571 randomContext *pRandomContext,
572 ubyte *pOtherPartysPublicKey,
574 ubyte **ppSharedSecret,
575 ubyte4 *pSharedSecretLen
613 MOC_DH(hwAccelDescr hwAccelCtx)
615 randomContext *pRandomContext,
616 diffieHellmanContext *pStatic,
617 diffieHellmanContext *pEphemeral,
618 ubyte *pOtherPartysStatic,
619 ubyte4 otherStaticLen,
620 ubyte *pOtherPartysEphemeral,
621 ubyte4 otherEphemeralLen,
622 ubyte **ppSharedSecret,
623 ubyte4 *pSharedSecretLen);
667 diffieHellmanContext *pCtx, FFCHashType hashType, ubyte4 C,
668 ubyte *pSeed, ubyte4 seedSize, intBoolean *pIsValid, ubyte4 *pPriKeyLen, vlong **ppVlongQueue);
737 diffieHellmanContext *pCtx, FFCHashType hashType, ubyte4 C,
738 ubyte *pSeed, ubyte4 seedSize, intBoolean *pIsValid, vlong **ppVlongQueue);
765 MOC_EXTERN MSTATUS
CRYPTO_INTERFACE_DH_verifyG(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, intBoolean *pIsValid, vlong **ppVlongQueue);
821 MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx,
822 intBoolean *pIsValid,
823 vlong **ppVlongQueue);
848 MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx,
849 intBoolean *pIsValid,
850 vlong **ppVlongQueue);
875 MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx,
876 intBoolean *pIsValid,
877 vlong **ppVlongQueue);
904 MOC_FFC(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx,
905 randomContext* pFipsRngCtx,
908 FFCHashType hashType,
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_allocateExt(diffieHellmanContext **ppNewCtx, void *pExtCtx)
Allocate and initialize a diffieHellmanContext structure.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_computeKeyExchangeExExt(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, randomContext *pRandomContext, ubyte *pOtherPartysPublicKey, ubyte4 publicKeyLen, ubyte **ppSharedSecret, ubyte4 *pSharedSecretLen, void *pExtCtx)
Generates a shared secret from the domain parameters and our private key stored in the context...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_setKeyParameters(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pTargetCtx, MDhKeyTemplate *pSrcTemplate)
Sets the key parameters stored in pSrcTemplate in the pTargetCtx.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_verifyPrivateKey(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, intBoolean *pIsValid, vlong **ppVlongQueue)
Validates a DH private key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_validateDomainParams(MOC_DH(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, diffieHellmanContext *pCtx, FFCHashType hashType, ubyte4 C, ubyte *pSeed, ubyte4 seedSize, intBoolean *pIsValid, ubyte4 *pPriKeyLen, vlong **ppVlongQueue)
Validates the Diffie-Hellman domain parameters.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_getKeyParametersAllocExt(MOC_DH(hwAccelDescr hwAccelCtx) MDhKeyTemplate *pTargetTemplate, diffieHellmanContext *pSrcCtx, ubyte keyType, void *pExtCtx)
For each parameter value g, p, q, y, f that is stored in the pSrcCtx, this method will allocate space...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_verifyG(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, intBoolean *pIsValid, vlong **ppVlongQueue)
Verifies the domain parameter G is valid with respect to the P and Q parameters in a diffieHellmanCon...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_allocateClientAuxExt(MOC_DH(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, diffieHellmanContext **ppNewCtx, ubyte4 groupNum, void *pExtCtx)
Allocate and initialize resources for a DH client.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_freeDhContext(diffieHellmanContext **ppDhCtx, vlong **ppVlongQueue)
Free the memory allocated for a diffieHellmanContext structure.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_verifyKeyPair(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, intBoolean *pIsValid, vlong **ppVlongQueue)
Validates a DH private/public key pair.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_setKeyParametersExt(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pTargetCtx, MDhKeyTemplate *pSrcTemplate, void *pExtCtx)
Sets the key parameters stored in pSrcTemplate in the pTargetCtx.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_freeKeyTemplateExt(diffieHellmanContext *pCtx, MDhKeyTemplate *pTemplate, void *pExtCtx)
Zeros and frees each parameter stored in pTemplate.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_getKeyParametersAlloc(MOC_DH(hwAccelDescr hwAccelCtx) MDhKeyTemplate *pTargetTemplate, diffieHellmanContext *pSrcCtx, ubyte keyType)
For each parameter value g, p, q, y, f that is stored in the pSrcCtx, this method will allocate space...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_allocateClientAux(MOC_DH(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, diffieHellmanContext **ppNewCtx, ubyte4 groupNum)
Allocate and initialize resources for a DH client.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_verifyPQ_FIPS1864(MOC_DH(hwAccelDescr hwAccelCtx) randomContext *pFipsRngCtx, diffieHellmanContext *pCtx, FFCHashType hashType, ubyte4 C, ubyte *pSeed, ubyte4 seedSize, intBoolean *pIsValid, vlong **ppVlongQueue)
Verifies the domain parameters P and Q in a context come from the FIPS 186-4 algorithm.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_getPublicKey(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, ubyte **ppPublicKey, ubyte4 *pPublicKeyLen)
This method will allocate a buffer and fill it with our public key in Big Endian binary.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_computeKeyExchangeEx(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, randomContext *pRandomContext, ubyte *pOtherPartysPublicKey, ubyte4 publicKeyLen, ubyte **ppSharedSecret, ubyte4 *pSharedSecretLen)
Generates a shared secret from the domain parameters and our private key stored in the context...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_generateKeyPairExt(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, randomContext *pRandomContext, ubyte4 numBytes, void *pExtCtx)
This method generates a key pair (y,f) within a context that has already had had the domain params p ...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_verifySafePG(diffieHellmanContext *pCtx, intBoolean *pIsValid, ubyte4 *pPriKeyLen, vlong **ppVlongQueue)
Validates that the P and G domain parameters come from one of the pre approved safe prime groups...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_allocateServer(MOC_DH(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, diffieHellmanContext **ppNewCtx, ubyte4 groupNum)
Allocate and initialize resources for a DH server.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_verifyPublicKey(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, intBoolean *pIsValid, vlong **ppVlongQueue)
Validates a DH public key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_generateDomainParams(MOC_FFC(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, randomContext *pFipsRngCtx, ubyte4 keySize, ubyte4 qSize, FFCHashType hashType, vlong **ppVlongQueue)
Generates Diffie-Hellman domain params P,Q,G.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_allocateServerExt(MOC_DH(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, diffieHellmanContext **ppNewCtx, ubyte4 groupNum, void *pExtCtx)
Allocate and initialize resources for a DH server.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_freeDhContextExt(diffieHellmanContext **ppDhCtx, vlong **ppVlongQueue, void *pExtCtx)
Free the memory allocated for a diffieHellmanContext structure.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_generateKeyPair(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, randomContext *pRandomContext, ubyte4 numBytes)
This method generates a key pair (y,f) within a context that has already had had the domain params p ...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_getPByteString(ubyte4 groupNum, const ubyte **ppBytes, sbyte4 *pLen)
Get a large prime number to use as your DH private key as a Big Endian byte array.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_keyAgreementScheme(MOC_DH(hwAccelDescr hwAccelCtx) ubyte4 mode, randomContext *pRandomContext, diffieHellmanContext *pStatic, diffieHellmanContext *pEphemeral, ubyte *pOtherPartysStatic, ubyte4 otherStaticLen, ubyte *pOtherPartysEphemeral, ubyte4 otherEphemeralLen, ubyte **ppSharedSecret, ubyte4 *pSharedSecretLen)
Generates a Diffie-Hellman shared secret via one of the major modes.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_allocate(diffieHellmanContext **ppNewCtx)
Allocate and initialize a diffieHellmanContext structure.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_freeKeyTemplate(diffieHellmanContext *pCtx, MDhKeyTemplate *pTemplate)
Zeros and frees each parameter stored in pTemplate.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_DH_getPublicKeyExt(MOC_DH(hwAccelDescr hwAccelCtx) diffieHellmanContext *pCtx, ubyte **ppPublicKey, ubyte4 *pPublicKeyLen, void *pExtCtx)
This method will allocate a buffer and fill it with our public key in Big Endian binary.