![]() |
TrustCore SDK Crypto Interface API reference
version 2.0
|
Cryptographic Interface header file for declaring PKCS1 functions. More...
Go to the source code of this file.
Functions | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_PKCS1_MGF1 (MOC_RSA(hwAccelDescr hwAccelCtx) const ubyte *mgfSeed, ubyte4 mgfSeedLen, ubyte4 maskLen, BulkHashAlgo *H, ubyte **ppRetMask) |
Generate an MGF1 mask based on a given hash function, as defined in RFC 3447. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_PKCS1_rsaOaepDecrypt (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pCipherText, ubyte4 cLen, const ubyte *pLabel, ubyte4 lLen, ubyte **ppPlainText, ubyte4 *pPlainTextLen) |
Perform RSA-OAEP decryption. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_PKCS1_rsaOaepEncrypt (MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, const ubyte *pLabel, ubyte4 lLen, ubyte **ppCipherText, ubyte4 *pCipherTextLen) |
Perform RSA-OAEP encryption. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_PKCS1_rsaPssPad (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, RNGFun rngFun, void *rngFunArg, ubyte *M, ubyte4 mLen, ubyte4 sLen, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, ubyte **ppRetEM, ubyte4 *pRetEMLen) |
Used to generated RSA-PSS padded data. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_PKCS1_rsaPssSign (MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, ubyte4 saltLen, ubyte **ppSignature, ubyte4 *pSignatureLen) |
Use the provided RSA Key to sign some data using the PSS scheme. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_PKCS1_rsaPssSignExt (MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, ubyte4 saltLen, ubyte **ppSignature, ubyte4 *pSignatureLen, void *pExtCtx) |
Use the provided RSA Key to sign some data using the PSS scheme. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_PKCS1_rsaPssVerify (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, const ubyte *pSignature, ubyte4 signatureLen, sbyte4 saltLen, ubyte4 *pVerify) |
Use the provided RSA Key to verify a PSS signature. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_PKCS1_rsaPssVerifyExt (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, const ubyte *pSignature, ubyte4 signatureLen, sbyte4 saltLen, ubyte4 *pVerify, void *pExtCtx) |
Use the provided RSA Key to verify a PSS signature. More... | |
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_PKCS1_rsassaPssVerify (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pRSAKey, ubyte H_rsaAlgoId, mgfFunc MGF, const ubyte *const pMessage, ubyte4 mesgLen, const ubyte *pSignature, ubyte4 signatureLen, sbyte4 saltLen, intBoolean *pRetIsSignatureValid) |
Use the provided RSA Key to verify a PSS signature. More... | |
Add details here.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_MGF1 | ( | MOC_RSA(hwAccelDescr hwAccelCtx) const ubyte * | mgfSeed, |
ubyte4 | mgfSeedLen, | ||
ubyte4 | maskLen, | ||
BulkHashAlgo * | H, | ||
ubyte ** | ppRetMask | ||
) |
This function generates an MGF1 mask mask of a given length, based a given hash function, as defined in RFC 3447.
pkcs1.h
hwAccelCtx | Hardware acceleration context. |
mgfSeed | Seed generated from a pRandomContext. |
mgfSeedLen | Number of bytes in the MGF seed, mgfSeed . |
maskLen | Number of bytes in the returned mask, ppRetMask . |
H | Hash function. |
ppRetMask | On return, pointer to address of generated mask. |
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.crypto_interface_pkcs1.c
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaOaepDecrypt | ( | MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey * | pRSAKey, |
ubyte | hashAlgo, | ||
ubyte | mgfAlgo, | ||
ubyte | mgfHashAlgo, | ||
const ubyte * | pCipherText, | ||
ubyte4 | cLen, | ||
const ubyte * | pLabel, | ||
ubyte4 | lLen, | ||
ubyte ** | ppPlainText, | ||
ubyte4 * | pPlainTextLen | ||
) |
pRSAKey | The RSA private key to use for this operation. |
hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
pCipherText | The ciphertext to be decrypted |
cLen | Length in bytes of the ciphertext to be decrypted. |
pLabel | Optional label to use in the decoding. |
lLen | Length in bytes of the label. |
ppPlainText | Pointer to the pointer which will be allocated by this function and which will recieve the resulting plaintext. |
pPlainTextLen | Pointer to the location that will recieve the byte length of the resulting plaintext. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaOaepEncrypt | ( | MOC_RSA(hwAccelDescr hwAccelCtx) randomContext * | pRandomContext, |
const RSAKey * | pRSAKey, | ||
ubyte | hashAlgo, | ||
ubyte | mgfAlgo, | ||
ubyte | mgfHashAlgo, | ||
const ubyte * | pMessage, | ||
ubyte4 | mLen, | ||
const ubyte * | pLabel, | ||
ubyte4 | lLen, | ||
ubyte ** | ppCipherText, | ||
ubyte4 * | pCipherTextLen | ||
) |
pRandomContext | The random context to use for this operation. |
pRSAKey | The RSA public key to use for this operation. |
hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
pMessage | The plaintext message to be encrypted, the length must be less than or equal to (k - 2hlen - 2) where k is the length in octets of the RSA modulus N. |
mLen | Length in bytes of the input message to be encrypted. |
pLabel | Optional label to use in the encoding. |
lLen | Length in bytes of the label. |
ppCipherText | Pointer to the pointer which will be allocated by this function and which will recieve the resulting ciphertext. |
pCipherTextLen | Pointer to the location that will recieve the byte length of the resulting ciphertext. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssPad | ( | MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey * | pKey, |
RNGFun | rngFun, | ||
void * | rngFunArg, | ||
ubyte * | M, | ||
ubyte4 | mLen, | ||
ubyte4 | sLen, | ||
ubyte | hashAlgo, | ||
ubyte | mgfAlgo, | ||
ubyte | mgfHashAlgo, | ||
ubyte ** | ppRetEM, | ||
ubyte4 * | pRetEMLen | ||
) |
This API does NOT perform the RSA sign operation on the padded data.
pKey | The RSA key to use for this operation. |
hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
rngFun | The RNG function pointer used to generated random bytes. |
rngFunArg | The RNG function pointer argument. |
M | The plaintext message to be padded. |
mLen | Length in bytes of the input message to be padded. |
sLen | Length in bytes of the salt. |
hashAlgo | RSA-PSS hash algorithm to use. |
mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
mgfHashAlgo | MGF1 hash algorithm. Must be the same as the message hash algorithm. |
ppRetEM | Pointer to the pointer which will be allocated by this function and which will recieve the resulting RSA-PSS encoded message. |
pRetEMLen | Pointer to the location that will recieve the byte length of the resulting RSA-PSS encoded message. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssSign | ( | MOC_RSA(hwAccelDescr hwAccelCtx) randomContext * | pRandomContext, |
const RSAKey * | pRSAKey, | ||
ubyte | hashAlgo, | ||
ubyte | mgfAlgo, | ||
ubyte | mgfHashAlgo, | ||
const ubyte * | pMessage, | ||
ubyte4 | mLen, | ||
ubyte4 | saltLen, | ||
ubyte ** | ppSignature, | ||
ubyte4 * | pSignatureLen | ||
) |
pRandomContext | The random context to use for this operation. |
pRSAKey | The RSA private key to use for this operation. |
hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
pMessage | The plaintext message to be signed, note this is not the digest of the data to be signed. |
mLen | Length in bytes of the input message to be signed. |
saltLen | Length in bytes of the salt. |
ppSignature | Pointer to the pointer which will be allocated by this function and which will recieve the resulting signature. |
pSignatureLen | Pointer to the location that will recieve the byte length of the resulting signature. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssSignExt | ( | MOC_RSA(hwAccelDescr hwAccelCtx) randomContext * | pRandomContext, |
const RSAKey * | pRSAKey, | ||
ubyte | hashAlgo, | ||
ubyte | mgfAlgo, | ||
ubyte | mgfHashAlgo, | ||
const ubyte * | pMessage, | ||
ubyte4 | mLen, | ||
ubyte4 | saltLen, | ||
ubyte ** | ppSignature, | ||
ubyte4 * | pSignatureLen, | ||
void * | pExtCtx | ||
) |
pRandomContext | The random context to use for this operation. |
pRSAKey | The RSA private key to use for this operation. |
hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
pMessage | The plaintext message to be signed, note this is not the digest of the data to be signed. |
mLen | Length in bytes of the input message to be signed. |
saltLen | Length in bytes of the salt. |
ppSignature | Pointer to the pointer which will be allocated by this function and which will recieve the resulting signature. |
pSignatureLen | Pointer to the location that will recieve the byte length of the resulting signature. |
pExtCtx | Extended Context for future use. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssVerify | ( | MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey * | pRSAKey, |
ubyte | hashAlgo, | ||
ubyte | mgfAlgo, | ||
ubyte | mgfHashAlgo, | ||
const ubyte * | pMessage, | ||
ubyte4 | mLen, | ||
const ubyte * | pSignature, | ||
ubyte4 | signatureLen, | ||
sbyte4 | saltLen, | ||
ubyte4 * | pVerify | ||
) |
pRSAKey | The RSA public key to use for this operation. |
hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
pMessage | The plaintext message to be verified, note this is not the digest of the data to be verified. |
mLen | Length in bytes of the input message to be signed. |
pSignature | Pointer to the signature to be verified. |
signatureLen | Length in bytes of the signature value. |
saltLen | Length in bytes of the salt. Pass in -1 if the salt length should be calculated rather than verified. |
pVerify | Pointer to the value which will recieve the verification result, zero if it verified successfully, nonzero otherwise. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssVerifyExt | ( | MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey * | pRSAKey, |
ubyte | hashAlgo, | ||
ubyte | mgfAlgo, | ||
ubyte | mgfHashAlgo, | ||
const ubyte * | pMessage, | ||
ubyte4 | mLen, | ||
const ubyte * | pSignature, | ||
ubyte4 | signatureLen, | ||
sbyte4 | saltLen, | ||
ubyte4 * | pVerify, | ||
void * | pExtCtx | ||
) |
pRSAKey | The RSA public key to use for this operation. |
hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
pMessage | The plaintext message to be verified, note this is not the digest of the data to be verified. |
mLen | Length in bytes of the input message to be signed. |
pSignature | Pointer to the signature to be verified. |
signatureLen | Length in bytes of the signature value. |
saltLen | Length in bytes of the salt. Pass in -1 if the salt length should be calculated rather than verified. |
pVerify | Pointer to the value which will recieve the verification result, zero if it verified successfully, nonzero otherwise. |
pExtCtx | Extended Context for future use. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsassaPssVerify | ( | MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey * | pRSAKey, |
ubyte | H_rsaAlgoId, | ||
mgfFunc | MGF, | ||
const ubyte *const | pMessage, | ||
ubyte4 | mesgLen, | ||
const ubyte * | pSignature, | ||
ubyte4 | signatureLen, | ||
sbyte4 | saltLen, | ||
intBoolean * | pRetIsSignatureValid | ||
) |
hwAccelCtx | Hardware acceleration context. |
pRSAKey | The RSA public key to use for this operation. |
H_rsaAlgoId | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
MGF | The Mask Generation Function (MGF) to use in function pointer form. |
pMessage | The plaintext message to be verified, note this is not the digest of the data to be verified. |
mesgLen | Length in bytes of the input message to be signed. |
pSignature | Pointer to the signature to be verified. |
signatureLen | Length in bytes of the signature value. |
saltLen | Length in bytes of the salt. Pass in -1 if the salt length should be calculated rather than verified. |
pRetIsSignatureValid | Contents will be set to TRUE for a valid signature and FALSE otherwise. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.