![]() |
TrustCore SDK NanoCert API reference
version 7.0
|
Header file for the NanoCrypto general crypto APIs. More...
Go to the source code of this file.
Data Structures | |
struct | BulkEncryptionAlgo |
Structure to hold function pointers to symmetric key cipher methods. More... | |
struct | BulkHashAlgo |
Structure to hold function pointers to hashing or extenable output methods. More... | |
Macros | |
#define | CERT_MAXDIGESTSIZE (64) /*(SHA512_RESULT_SIZE)*/ |
#define | MAX_ENC_KEY_LENGTH (32) /* AES-256 */ |
#define | MAX_IV_LENGTH (16) /* AES */ |
Enumerations | |
enum | { rsaEncryption = 1, pkcs1Mgf = 8, rsaSsaPss = 10, md2withRSAEncryption = 2, md4withRSAEncryption = 3, md5withRSAEncryption = 4, sha1withRSAEncryption = 5, sha256withRSAEncryption = 11, sha384withRSAEncryption = 12, sha512withRSAEncryption = 13, sha224withRSAEncryption = 14, ht_none = 0, ht_md2 = 2, ht_md4 = 3, ht_md5 = 4, ht_sha1 = 5, ht_sha3_224 = 7, ht_sha3_256 = 8, ht_sha3_384 = 9, ht_sha3_512 = 10, ht_shake128 = 111, ht_shake256 = 112, ht_sha256 = 11, ht_sha384 = 12, ht_sha512 = 13, ht_sha224 = 14, ht_blake2b = 15, ht_blake2s = 16, sha1_with_no_sig = 31 } |
Enum of identifiers for the available hashing methods. More... | |
Functions | |
MOC_EXTERN MSTATUS | CRYPTO_computeBufferHash (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *buffer, ubyte4 bytesToHash, ubyte hash[], sbyte4 *hashSize, ubyte4 rsaAlgoId) |
Computes a hash of a buffer of data given a hash identifier. More... | |
MOC_EXTERN MSTATUS | CRYPTO_getECCHashAlgo (ubyte eccAlgoId, BulkHashAlgo **ppBulkHashAlgo) |
Gets a hash suite of function pointers, appropriate for ECC, given a hash identifier. More... | |
MOC_EXTERN MSTATUS | CRYPTO_getRSAHashAlgo (ubyte rsaAlgoId, const BulkHashAlgo **ppBulkHashAlgo) |
Gets a hash suite of function pointers, appropriate for RSA, given a hash identifier. More... | |
MOC_EXTERN MSTATUS | CRYPTO_Process (MOC_SYM(hwAccelDescr hwAccelCtx) const BulkEncryptionAlgo *pAlgo, ubyte *keyMaterial, sbyte4 keyLength, ubyte *iv, ubyte *data, sbyte4 dataLength, sbyte4 encrypt) |
Performs a symmetric key cipher algorithm on a buffer of data. More... | |
Variables | |
MOC_EXTERN const BulkEncryptionAlgo | CRYPTO_AESCtrSuite |
MOC_EXTERN const BulkEncryptionAlgo | CRYPTO_AESSuite |
MOC_EXTERN const BulkEncryptionAlgo | CRYPTO_RC4Suite |
MOC_EXTERN const BulkEncryptionAlgo | CRYPTO_TripleDESSuite |
MOC_EXTERN const BulkEncryptionAlgo | CRYPTO_TwoKeyTripleDESSuite |
Header file for the NanoCrypto general crypto APIs.
anonymous enum |
Enum of identifiers for the available hashing methods. When possible this is the suffix of the pkcs1_OID.
MOC_EXTERN MSTATUS CRYPTO_computeBufferHash | ( | MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte * | buffer, |
ubyte4 | bytesToHash, | ||
ubyte | hash[], | ||
sbyte4 * | hashSize, | ||
ubyte4 | rsaAlgoId | ||
) |
Computes a hash of a buffer of data given a hash identifier.
buffer | The buffer of data to be hashed. |
bytesToHash | The length of the data to hash in bytes. |
hash | Buffer to hold the resulting output data. |
hashSize | Contents will be set to the length of the output data in bytes. |
rsaAlgoId | The identifier for the hash algorithm to be used. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.MOC_EXTERN MSTATUS CRYPTO_getECCHashAlgo | ( | ubyte | eccAlgoId, |
BulkHashAlgo ** | ppBulkHashAlgo | ||
) |
Gets a hash suite of function pointers, appropriate for ECC, given a hash identifier.
eccAlgoId | The identifier for the hash algorithm. |
ppBulkHashAlgo | Pointer whose contents will be set to the location of the hash suite for the algorithm requested. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.MOC_EXTERN MSTATUS CRYPTO_getRSAHashAlgo | ( | ubyte | rsaAlgoId, |
const BulkHashAlgo ** | ppBulkHashAlgo | ||
) |
Gets a hash suite of function pointers, appropriate for RSA, given a hash identifier.
rsaAlgoId | The identifier for the hash algorithm. |
ppBulkHashAlgo | Pointer whose contents will be set to the location of the hash suite for the algorithm requested. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.MOC_EXTERN MSTATUS CRYPTO_Process | ( | MOC_SYM(hwAccelDescr hwAccelCtx) const BulkEncryptionAlgo * | pAlgo, |
ubyte * | keyMaterial, | ||
sbyte4 | keyLength, | ||
ubyte * | iv, | ||
ubyte * | data, | ||
sbyte4 | dataLength, | ||
sbyte4 | encrypt | ||
) |
Performs a symmetric key cipher algorithm on a buffer of data.
pAlgo | Pointer to a suite holding the function pointer cipher methods to be used. |
keyMaterial | Buffer holding the key material as a byte array. |
keyLength | The length of the key in bytes. This may vary depending on the cipher chosen. |
iv | Initialization vector (if required by the cipher chosen) |
data | Buffer holding the input data to be processed by the cipher chosen. This will be processed in place. |
dataLength | The length of the data in bytes. Whether this needs to be a multiple of the cipher blocklength depends on the cipher chosen. |
encrypt | Enter TRUE (1) for encryption and FALSE (0) for decryption. For stream ciphers or ciphers where the encryption operation is the same as the decryption operation, this parameter will be ignored. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h.