19 #ifndef __CRYPTO_INTERFACE_ECC_HEADER__ 20 #define __CRYPTO_INTERFACE_ECC_HEADER__ 22 #include "../cap/capasym.h" 88 MOC_ECC(hwAccelDescr hwAccelCtx)
137 MOC_ECC(hwAccelDescr hwAccelCtx)
155 MOC_ECC(hwAccelDescr hwAccelCtx)
179 MOC_ECC(hwAccelDescr hwAccelCtx)
199 MOC_ECC(hwAccelDescr hwAccelCtx)
201 byteBoolean *pIsValid
294 MOC_ECC(hwAccelDescr hwAccelCtx)
296 MEccKeyTemplate *pTemplate,
312 MEccKeyTemplate *pTemplate
339 MOC_ECC(hwAccelDescr hwAccelCtx)
363 MOC_ECC(hwAccelDescr hwAccelCtx)
393 MOC_ECC(hwAccelDescr hwAccelCtx)
419 MOC_ECC(hwAccelDescr hwAccelCtx)
447 MOC_ECC(hwAccelDescr hwAccelCtx)
472 MOC_ECC(hwAccelDescr hwAccelCtx)
498 MOC_ECC(hwAccelDescr hwAccelCtx)
538 MOC_ECC(hwAccelDescr hwAccelCtx)
546 ubyte4 *pSignatureLen
579 MOC_ECC(hwAccelDescr hwAccelCtx)
587 ubyte4 *pVerifyFailures
617 MOC_ECC(hwAccelDescr hwAccelCtx)
620 ubyte **ppSharedSecret,
621 ubyte4 *pSharedSecretLen,
656 MOC_ECC(hwAccelDescr hwAccelCtx)
658 ubyte *pPublicPointByteString,
659 ubyte4 pointByteStringLen,
660 ubyte **ppSharedSecret,
661 ubyte4 *pSharedSecretLen,
699 MOC_ECC(hwAccelDescr hwAccelCtx)
703 ubyte *pOtherPartysStatic,
704 ubyte4 otherStaticLen,
705 ubyte *pOtherPartysEphemeral,
706 ubyte4 otherEphemeralLen,
707 ubyte **ppSharedSecret,
708 ubyte4 *pSharedSecretLen);
741 MOC_ECC(hwAccelDescr hwAccelCtx)
750 ubyte4 *pSignatureLen,
776 MOC_ECC(hwAccelDescr hwAccelCtx)
783 ubyte4 *pVerifyFailures,
805 MOC_ECC(hwAccelDescr hwAccelCtx)
828 MOC_ECC(hwAccelDescr hwAccelCtx)
849 MOC_ECC(hwAccelDescr hwAccelCtx)
851 ubyte4 *pVerifyFailures,
880 MOC_ECC(hwAccelDescr hwAccelCtx)
884 byteBoolean isPreHash,
889 ubyte4 *pSignatureLen,
915 MOC_ECC(hwAccelDescr hwAccelCtx)
919 byteBoolean isPreHash,
924 ubyte4 *pVerifyFailures,
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_ECDSA_signDigestAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, RNGFun rngFun, void *rngArg, ubyte *pHash, ubyte4 hashLen, ubyte *pSignature, ubyte4 bufferSize, ubyte4 *pSignatureLen)
Perform an ECDSA signing operation on the provided digest, producing the raw signature value...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_freeKeyTemplateAux(ECCKey *pKey, MEccKeyTemplate *pTemplate)
Frees the key data stored within the provided template structure.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_verifyInput(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, ubyte *pInput, ubyte4 inputLen, byteBoolean isPreHash, ubyte *pCtx, ubyte4 ctxLen, ubyte *pSignature, ubyte4 signatureLen, ubyte4 *pVerifyFailures, void *pExtCtx)
Performs an EdDSA verify operation on the input provided.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_getElementByteStringLenAux(ECCKey *pKey, ubyte4 *pLen)
Get the length of an individual prime field element when represented as a bytestring.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_ECDSA_verifyMessageExt(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pPublicKey, ubyte hashAlgo, ubyte *pMessage, ubyte4 messageLen, ubyte *pSignature, ubyte4 signatureLen, ubyte4 *pVerifyFailures, void *pExtCtx)
Performs an ECDSA verify operation on the message provided.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_newKeyAux(ubyte4 curveId, ECCKey **ppNewKey)
Create a new key from a curve identifier.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_generateKeyPairAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, RNGFun rngFun, void *pRngFunArg)
Generate a key pair previously allocated with CRYPTO_INTERFACE_EC_newKeyAux.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_ECDSA_updateVerifyExt(MOC_ECC(hwAccelDescr hwAccelCtx) ECDSA_CTX *pCtx, ubyte *pMessage, ubyte4 messageLen, void *pExtCtx)
Updates a context for an ECDSA verify operation.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_verifyKeyPairAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pPrivateKey, ECCKey *pPublicKey, byteBoolean *pVfy)
Validate that a given public and private key are consistent.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_ECDSA_initVerifyExt(MOC_ECC(hwAccelDescr hwAccelCtx) ECDSA_CTX *pCtx, ECCKey *pPublicKey, ubyte hashAlgo, ubyte *pSignature, ubyte4 signatureLen, void *pExtCtx)
Initializes a context for an ECDSA verify operation.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_getCurveIdFromKeyAux(ECCKey *pKey, ubyte4 *pCurveId)
Retrieve the curve identifier from a key previously created with CRYPTO_INTERFACE_EC_newKeyAux or gen...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_deleteAllCombsAndMutexes(void)
Delete's all created global combs for ecc and the associated mutex's.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_generateKeyPairAlloc(MOC_ECC(hwAccelDescr hwAccelCtx) ubyte4 curveId, void **ppNewKey, RNGFun rngFun, void *rngArg, ubyte4 keyType, void *pKeyAttributes)
Generate a key pair on the curve specified from the curve id.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_ECDH_generateSharedSecretFromKeysAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pPrivateKey, ECCKey *pPublicKey, ubyte **ppSharedSecret, ubyte4 *pSharedSecretLen, sbyte4 flag, void *pKdfInfo)
Generate an ECDH shared secret from a public and private key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_deleteKeyAux(ECCKey **ppKey)
Free an ECC Key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_getPointByteStringLenAux(ECCKey *pKey, ubyte4 *pLen)
Get the length of the bytestring representation of the public key, typically used to determine the bu...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_newKeyEx(ubyte4 curveId, ECCKey **ppNewKey, ubyte4 keyType, void *pKeyAttributes)
Create a new key from a curve identifier.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_ECDH_generateSharedSecretFromPublicByteStringAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pPrivateKey, ubyte *pPublicPointByteString, ubyte4 pointByteStringLen, ubyte **ppSharedSecret, ubyte4 *pSharedSecretLen, sbyte4 flag, void *pKdfInfo)
Generate an ECDH shared secret from private key and bytestring representation of the public point...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_newPublicKeyFromByteStringAux(MOC_ECC(hwAccelDescr hwAccelCtx) ubyte4 curveId, ECCKey **ppNewKey, ubyte *pByteString, ubyte4 byteStringLen)
Create a new ECC public key from the bytestring representation of public point.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_createCombMutexes(void)
Creates mutex's for ecc combs so that only a single thread can create and persist a globally used com...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_verifyPublicKeyAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, byteBoolean *pIsValid)
Check that the public key is valid, which ensures the public point is valid and lies on the curve...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_equalKeyAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey1, ECCKey *pKey2, byteBoolean *pRes)
Tests if the public key portion of two ECCKeys are equal.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_ECDSA_finalVerifyExt(MOC_ECC(hwAccelDescr hwAccelCtx) ECDSA_CTX *pCtx, ubyte4 *pVerifyFailures, void *pExtCtx)
Finalizes a context for an ECDSA verify operation and computes whether the signature is valid...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_getPointByteStringLenByCurveId(ubyte4 curveId, ubyte4 *pLen)
Get the length of the public value based on the curve ID.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_writePublicKeyToBufferAllocAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, ubyte **ppBuffer, ubyte4 *pBufferSize)
Allocate a new buffer and writes the public point to it.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_isKeyPrivate(ECCKey *pKey, intBoolean *pResult)
Determines if a key is a private key or a public key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_writePublicKeyToBufferAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, ubyte *pBuffer, ubyte4 bufferSize)
Write the public point to a buffer.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_ECDSA_verifySignatureDigestAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pPublicKey, ubyte *pHash, ubyte4 hashLen, ubyte *pR, ubyte4 rLen, ubyte *pS, ubyte4 sLen, ubyte4 *pVerifyFailures)
Verify individual signature values with the provided public key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_generateKeyPairAllocAux(MOC_ECC(hwAccelDescr hwAccelCtx) ubyte4 curveId, ECCKey **ppKey, RNGFun rngFun, void *pRngFunArg)
Generate a key pair on the curve specified from the curve id.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EdDSA_signInput(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, ubyte *pInput, ubyte4 inputLen, byteBoolean isPreHash, ubyte *pCtx, ubyte4 ctxLen, ubyte *pSignature, ubyte4 bufferSize, ubyte4 *pSignatureLen, void *pExtCtx)
Perform an EdDSA signing operation on the provided input.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_getKeyParametersAllocAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, MEccKeyTemplate *pTemplate, ubyte reqType)
Allocates and sets the appropriate keys parameters of pTemplate with that from the passed in pKey...
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_ECDH_keyAgreementScheme(MOC_ECC(hwAccelDescr hwAccelCtx) ubyte4 mode, ECCKey *pStatic, ECCKey *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_ECDSA_signMessageExt(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pPrivateKey, RNGFun rngFUN, void *pRngArg, ubyte hashAlgo, ubyte *pMessage, ubyte4 messageLen, ubyte *pSignature, ubyte4 bufferSize, ubyte4 *pSignatureLen, void *pExtCtx)
Performs an ECDSA sign operation on the message provided.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_cloneKeyAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey **ppNewKey, ECCKey *pSrc)
Allocates and clones an existing key.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_setPrivateKey(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, ubyte *pScalar, ubyte4 scalarLen)
Sets the private key parameter of an ECCKey.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_EC_setKeyParametersAux(MOC_ECC(hwAccelDescr hwAccelCtx) ECCKey *pKey, ubyte *pPoint, ubyte4 pointLen, ubyte *pScalar, ubyte4 scalarLen)
Sets the public key portion of an ECCKey and optionally the private key portion.