Typedefs | |
typedef int(* | cy_func_get_random_data_t) (void *rndInfo, uint8_t *rndData, size_t rndSize) |
Pointer to a random number supplier function. | |
Functions | |
cy_en_crypto_status_t | Cy_Crypto_Core_Rsa_Verify (CRYPTO_Type *base, cy_en_crypto_rsa_ver_result_t *verResult, cy_en_crypto_sha_mode_t digestType, uint8_t const *digest, uint8_t const *decryptedSignature, uint32_t decryptedSignatureLength) |
RSA verification with checks for content, paddings and signature format. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_Rsa_Verify_Ext (CRYPTO_Type *base, cy_en_crypto_rsa_ver_result_t *verResult, cy_en_crypto_sha_mode_t digestType, uint8_t const *digest, uint32_t digestLength, uint8_t const *decryptedSignature, uint32_t decryptedSignatureLength) |
RSA verification with checks for content, paddings and signature format. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_Rsa_Proc (CRYPTO_Type *base, cy_stc_crypto_rsa_pub_key_t const *key, uint8_t const *message, uint32_t messageSize, uint8_t *processedMessage) |
RSA process algorithm based on the Montgomery algorithm using Barrett reduction. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_Rsa_Coef (CRYPTO_Type *base, cy_stc_crypto_rsa_pub_key_t const *key) |
Calculation constant coefficients to to speed-up Montgomery algorithm. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_ECC_MakePrivateKey (CRYPTO_Type *base, cy_en_crypto_ecc_curve_id_t curveID, uint8_t *key, cy_func_get_random_data_t GetRandomDataFunc, void *randomDataInfo) |
Make a new ECC private key. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_ECC_MakePublicKey (CRYPTO_Type *base, cy_en_crypto_ecc_curve_id_t curveID, const uint8_t *privateKey, cy_stc_crypto_ecc_key *publicKey) |
Make a new ECC public key. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_ECC_MakeKeyPair (CRYPTO_Type *base, cy_en_crypto_ecc_curve_id_t curveID, cy_stc_crypto_ecc_key *key, cy_func_get_random_data_t GetRandomDataFunc, void *randomDataInfo) |
Make a new ECC key pair. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_ECC_SignHash (CRYPTO_Type *base, const uint8_t *hash, uint32_t hashlen, uint8_t *sig, const cy_stc_crypto_ecc_key *key, const uint8_t *messageKey) |
Sign a message digest. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_ECC_VerifyHash (CRYPTO_Type *base, const uint8_t *sig, const uint8_t *hash, uint32_t hashlen, uint8_t *stat, const cy_stc_crypto_ecc_key *key) |
Verify an ECC signature. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_ED25519_Sign (CRYPTO_Type *base, const uint8_t *hash, uint32_t hashlen, uint8_t *sig, const cy_stc_crypto_ecc_key *key, cy_en_eddsa_sig_type_t sigType, const uint8_t *sigctx, uint32_t sigctx_len) |
Sign a message. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_ED25519_PointMultiplication (CRYPTO_Type *base, cy_en_crypto_ecc_curve_id_t curveID, const uint8_t *ecpGX, const uint8_t *ecpGY, const uint8_t *ecpD, uint8_t *ecpQX, uint8_t *ecpQY) |
Edwards 25519 elliptic curve point multiplication in GF(p). More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_ED25519_PointDecode (CRYPTO_Type *base, cy_en_crypto_ecc_curve_id_t curveID, const uint8_t *publicKey, uint8_t *pubKey_x, uint8_t *pubKey_y) |
Decode ED25519 encoded public key in to x and y. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_ED25519_Verify (CRYPTO_Type *base, uint8_t *sig, const uint8_t *hash, uint32_t hashlen, const cy_stc_crypto_ecc_key *key, uint32_t *stat, cy_en_eddsa_sig_type_t sigType, const uint8_t *sigctx, uint32_t sigctx_len) |
Verify ED25519 signed message. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_ED25519_MakePublicKey (CRYPTO_Type *base, cy_en_crypto_ecc_curve_id_t curveID, const uint8_t *privateKey, cy_stc_crypto_ecc_key *publicKey) |
Make a new ED25519 public key. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_EC25519_MakePublicKey (CRYPTO_Type *base, const uint8_t *privateKey, cy_stc_crypto_ecc_key *publicKey) |
Make a new EC25519 public key. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_EC25519_MakePrivateKey (CRYPTO_Type *base, uint8_t *key, cy_func_get_random_data_t GetRandomDataFunc, void *randomDataInfo) |
Make a new EC25519 private key. More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_EC25519_PointMultiplication (CRYPTO_Type *base, uint8_t *p_r, const uint8_t *p_x, const uint8_t *p_d) |
EC25519 Elliptic curve point multiplication in GF(p). More... | |
cy_en_crypto_status_t | Cy_Crypto_Core_EC_NistP_PointMultiplication (CRYPTO_Type *base, cy_en_crypto_ecc_curve_id_t curveID, const uint8_t *ecpGX, const uint8_t *ecpGY, const uint8_t *ecpD, uint8_t *ecpQX, uint8_t *ecpQY) |
Elliptic curve point multiplication in GF(p). More... | |
cy_en_crypto_status_t Cy_Crypto_Core_Rsa_Verify | ( | CRYPTO_Type * | base, |
cy_en_crypto_rsa_ver_result_t * | verResult, | ||
cy_en_crypto_sha_mode_t | digestType, | ||
uint8_t const * | digest, | ||
uint8_t const * | decryptedSignature, | ||
uint32_t | decryptedSignatureLength | ||
) |
RSA verification with checks for content, paddings and signature format.
SHA digest of the message and decrypted message should be calculated before. Supports only PKCS1-v1_5 format, inside of this format supported padding using only SHA, cases with MD2 and MD5 are not supported. PKCS1-v1_5 described here, page 31: http://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf
For CAT1C & CAT1D devices when D-Cache is enabled parameter decryptedSignature must align and end in 32 byte boundary.
Returns the verification result cy_en_crypto_rsa_ver_result_t.
base | The pointer to the CRYPTO instance. |
verResult | The pointer to the verification result cy_en_crypto_rsa_ver_result_t. |
digestType | SHA mode used for hash calculation cy_en_crypto_sha_mode_t. |
digest | The pointer to the hash of the message or the message whose signature is to be verified. |
decryptedSignature | The pointer to the decrypted signature to be verified. |
decryptedSignatureLength | The length of the decrypted signature to be verified (in bytes) |
cy_en_crypto_status_t Cy_Crypto_Core_Rsa_Verify_Ext | ( | CRYPTO_Type * | base, |
cy_en_crypto_rsa_ver_result_t * | verResult, | ||
cy_en_crypto_sha_mode_t | digestType, | ||
uint8_t const * | digest, | ||
uint32_t | digestLength, | ||
uint8_t const * | decryptedSignature, | ||
uint32_t | decryptedSignatureLength | ||
) |
RSA verification with checks for content, paddings and signature format.
SHA digest of the message and decrypted message should be calculated before. Supports only PKCS1-v1_5 format, inside of this format supported padding using only SHA, cases with MD2 and MD5 are not supported. PKCS1-v1_5 described here, page 31: http://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf
For CAT1C & CAT1D devices when D-Cache is enabled parameter decryptedSignature must align and end in 32 byte boundary.
Returns the verification result cy_en_crypto_rsa_ver_result_t.
base | The pointer to the CRYPTO instance. |
verResult | The pointer to the verification result cy_en_crypto_rsa_ver_result_t. |
digestType | SHA mode used for hash calculation cy_en_crypto_sha_mode_t. |
digest | The pointer to the hash of the message or the message whose signature is to be verified. |
digestLength | The length of the message whose signature is to be verified and is applicable for CY_CRYPTO_MODE_SHA_NONE mode. |
decryptedSignature | The pointer to the decrypted signature to be verified. |
decryptedSignatureLength | The length of the decrypted signature to be verified (in bytes) |
cy_en_crypto_status_t Cy_Crypto_Core_Rsa_Proc | ( | CRYPTO_Type * | base, |
cy_stc_crypto_rsa_pub_key_t const * | key, | ||
uint8_t const * | message, | ||
uint32_t | messageSize, | ||
uint8_t * | processedMessage | ||
) |
RSA process algorithm based on the Montgomery algorithm using Barrett reduction.
For CAT1C & CAT1D devices when D-Cache is enabled parameters message, processedMessage and key(pubExpPtr, moduloPtr, barretCoefPtr, inverseModuloPtr and rBarPtr) must align and end in 32 byte boundary.
https://en.wikipedia.org/wiki/RSA_%28cryptosystem%29
base | The pointer to the CRYPTO instance. |
key | The pointer to the cy_stc_crypto_rsa_pub_key_t structure that stores public key. |
message | The pointer to the message to be processed. |
messageSize | The length of the message to be processed. |
processedMessage | The pointer to processed message. |
cy_en_crypto_status_t Cy_Crypto_Core_Rsa_Coef | ( | CRYPTO_Type * | base, |
cy_stc_crypto_rsa_pub_key_t const * | key | ||
) |
Calculation constant coefficients to to speed-up Montgomery algorithm.
These coefficients are: coefficient for Barrett reduction, binary inverse of the modulo, result of (2^moduloLength mod modulo)
For CAT1C & CAT1D(CM55) devices when D-Cache is enabled parameters key(moduloPtr, barretCoefPtr, inverseModuloPtr and rBarPtr) must align and end in 32 byte boundary.
base | The pointer to the CRYPTO instance. |
key | The pointer to the cy_stc_crypto_rsa_pub_key_t structure that stores a public key. |
cy_en_crypto_status_t Cy_Crypto_Core_ECC_MakePrivateKey | ( | CRYPTO_Type * | base, |
cy_en_crypto_ecc_curve_id_t | curveID, | ||
uint8_t * | key, | ||
cy_func_get_random_data_t | GetRandomDataFunc, | ||
void * | randomDataInfo | ||
) |
Make a new ECC private key.
For CAT1C & CAT1D devices when D-Cache is enabled parameter key must align and end in 32 byte boundary.
base | The pointer to a Crypto instance. |
curveID | See cy_en_crypto_ecc_curve_id_t. |
key | [out] Destination of the newly created key. |
GetRandomDataFunc | See cy_func_get_random_data_t. |
randomDataInfo |
cy_en_crypto_status_t Cy_Crypto_Core_ECC_MakePublicKey | ( | CRYPTO_Type * | base, |
cy_en_crypto_ecc_curve_id_t | curveID, | ||
const uint8_t * | privateKey, | ||
cy_stc_crypto_ecc_key * | publicKey | ||
) |
Make a new ECC public key.
For CAT1C & CAT1D devices when D-Cache is enabled parameters privateKey and x & y of publicKey must align and end in 32 byte boundary.
base | The pointer to a Crypto instance. |
curveID | See cy_en_crypto_ecc_curve_id_t. |
privateKey | [out] Destination of the newly created key. |
publicKey | See cy_stc_crypto_ecc_key. |
cy_en_crypto_status_t Cy_Crypto_Core_ECC_MakeKeyPair | ( | CRYPTO_Type * | base, |
cy_en_crypto_ecc_curve_id_t | curveID, | ||
cy_stc_crypto_ecc_key * | key, | ||
cy_func_get_random_data_t | GetRandomDataFunc, | ||
void * | randomDataInfo | ||
) |
Make a new ECC key pair.
base | The pointer to a Crypto instance. |
curveID | See cy_en_crypto_ecc_curve_id_t. |
key | [out] Destination of the newly created key. See cy_stc_crypto_ecc_key. |
GetRandomDataFunc | See cy_func_get_random_data_t. |
randomDataInfo |
cy_en_crypto_status_t Cy_Crypto_Core_ECC_SignHash | ( | CRYPTO_Type * | base, |
const uint8_t * | hash, | ||
uint32_t | hashlen, | ||
uint8_t * | sig, | ||
const cy_stc_crypto_ecc_key * | key, | ||
const uint8_t * | messageKey | ||
) |
Sign a message digest.
For CAT1C & CAT1D devices when D-Cache is enabled parameters hash, sign, messageKey and key( k, x&y of pubkey) must align and end in 32 byte boundary.
base | The pointer to a Crypto instance. |
hash | The message digest to sign. Provided as is in data buffer. |
hashlen | The length of the digest in bytes. |
sig | [out] The destination for the signature, 'r' followed by 's'. |
key | Key used for signature generation. See cy_stc_crypto_ecc_key. |
messageKey | Message key. |
cy_en_crypto_status_t Cy_Crypto_Core_ECC_VerifyHash | ( | CRYPTO_Type * | base, |
const uint8_t * | sig, | ||
const uint8_t * | hash, | ||
uint32_t | hashlen, | ||
uint8_t * | stat, | ||
const cy_stc_crypto_ecc_key * | key | ||
) |
Verify an ECC signature.
For CAT1C & CAT1D devices when D-Cache is enabled parameters sig, hash and key( x&y of pubkey) must align and end in 32 byte boundary.
base | The pointer to a Crypto instance. |
sig | The signature to verify, 'R' followed by 'S'. |
hash | The hash (message digest) that was signed. |
hashlen | The length of the hash (octets). |
stat | Result of signature, 1==valid, 0==invalid. |
key | The corresponding public ECC key. See cy_stc_crypto_ecc_key. |
cy_en_crypto_status_t Cy_Crypto_Core_ED25519_Sign | ( | CRYPTO_Type * | base, |
const uint8_t * | hash, | ||
uint32_t | hashlen, | ||
uint8_t * | sig, | ||
const cy_stc_crypto_ecc_key * | key, | ||
cy_en_eddsa_sig_type_t | sigType, | ||
const uint8_t * | sigctx, | ||
uint32_t | sigctx_len | ||
) |
Sign a message.
For CAT1C & CAT1D devices with DCache enabled this API is not supported.
base | The pointer to a Crypto instance. |
hash | The message to sign. Provided as is in data buffer. This is usually the hash of the original data to be signed. |
hashlen | The length of the message in bytes. |
sig | [out] The destination for the signature, 'r' followed by 's'. |
key | Key used for signature generation. See cy_stc_crypto_ecc_key. |
sigType | signature Type. CY_CRYPTO_EDDSA_PURE,CY_CRYPTO_EDDSA_CTX or CY_CRYPTO_EDDSA_PREHASH |
sigctx | signature context. can be NULL if EDDSA_PURE is used or if no context is provided. |
sigctx_len | The length of the signature context |
cy_en_crypto_status_t Cy_Crypto_Core_ED25519_PointMultiplication | ( | CRYPTO_Type * | base, |
cy_en_crypto_ecc_curve_id_t | curveID, | ||
const uint8_t * | ecpGX, | ||
const uint8_t * | ecpGY, | ||
const uint8_t * | ecpD, | ||
uint8_t * | ecpQX, | ||
uint8_t * | ecpQY | ||
) |
Edwards 25519 elliptic curve point multiplication in GF(p).
For CAT1C & CAT1D devices with DCache enabled this API is not supported.
base | The pointer to a Crypto instance. |
curveID | See cy_en_crypto_ecc_curve_id_t. |
ecpGX | X coordinate of base point. |
ecpGY | Y coordinate of base point. |
ecpD | multiplication scalar value. |
ecpQX | X coordinate of result point. |
ecpQY | Y coordinate of result point. |
cy_en_crypto_status_t Cy_Crypto_Core_ED25519_PointDecode | ( | CRYPTO_Type * | base, |
cy_en_crypto_ecc_curve_id_t | curveID, | ||
const uint8_t * | publicKey, | ||
uint8_t * | pubKey_x, | ||
uint8_t * | pubKey_y | ||
) |
Decode ED25519 encoded public key in to x and y.
For CAT1C & CAT1D devices with DCache enabled this API is not supported.
base | The pointer to a Crypto instance. |
curveID | See cy_en_crypto_ecc_curve_id_t. |
publicKey | [in] encoded 32 byte Public key. |
pubKey_x | [out] Decoded 32 bytes Public key x in little-endian format. |
pubKey_y | [out] Decoded 32 bytes Public key y in little-endian format. |
cy_en_crypto_status_t Cy_Crypto_Core_ED25519_Verify | ( | CRYPTO_Type * | base, |
uint8_t * | sig, | ||
const uint8_t * | hash, | ||
uint32_t | hashlen, | ||
const cy_stc_crypto_ecc_key * | key, | ||
uint32_t * | stat, | ||
cy_en_eddsa_sig_type_t | sigType, | ||
const uint8_t * | sigctx, | ||
uint32_t | sigctx_len | ||
) |
Verify ED25519 signed message.
For CAT1C & CAT1D devices with DCache enabled this API is not supported.
base | The pointer to a Crypto instance. |
sig | The signature to verify, 'R' followed by 'S'. |
hash | The hash or message that was signed. |
hashlen | The length of the hash or message (octets). |
stat | Result of signature verification, 0xA1A1A1A1==valid, 0x00BADBAD==invalid. |
key | The corresponding uncompressed public key to use (little-endian). See cy_stc_crypto_ecc_key. |
sigType | signature Type. CY_CRYPTO_EDDSA_PURE,CY_CRYPTO_EDDSA_CTX or CY_CRYPTO_EDDSA_PREHASH |
sigctx | signature context. can be NULL if EDDSA_PURE is used or if no context is provided. |
sigctx_len | The length of the signature context |
cy_en_crypto_status_t Cy_Crypto_Core_ED25519_MakePublicKey | ( | CRYPTO_Type * | base, |
cy_en_crypto_ecc_curve_id_t | curveID, | ||
const uint8_t * | privateKey, | ||
cy_stc_crypto_ecc_key * | publicKey | ||
) |
Make a new ED25519 public key.
For CAT1C & CAT1D devices with DCache enabled this API is not supported.
base | The pointer to a Crypto instance. |
curveID | See cy_en_crypto_ecc_curve_id_t. |
privateKey | [in] Private key. |
publicKey | [out] Newly created Public key. See cy_stc_crypto_ecc_key. |
cy_en_crypto_status_t Cy_Crypto_Core_EC25519_MakePublicKey | ( | CRYPTO_Type * | base, |
const uint8_t * | privateKey, | ||
cy_stc_crypto_ecc_key * | publicKey | ||
) |
Make a new EC25519 public key.
For CAT1C & CAT1D devices when D-Cache is enabled parameters privateKey and x of publicKey must align and end in 32 byte boundary.
base | The pointer to a Crypto instance. |
privateKey | [out] Destination of the newly created key. |
publicKey | See cy_stc_crypto_ecc_key. |
cy_en_crypto_status_t Cy_Crypto_Core_EC25519_MakePrivateKey | ( | CRYPTO_Type * | base, |
uint8_t * | key, | ||
cy_func_get_random_data_t | GetRandomDataFunc, | ||
void * | randomDataInfo | ||
) |
Make a new EC25519 private key.
For CAT1C & CAT1D devices when D-Cache is enabled parameter key must align and end in 32 byte boundary.
base | The pointer to a Crypto instance. |
key | [out] Destination of the newly created key. |
GetRandomDataFunc | See cy_func_get_random_data_t. |
randomDataInfo |
cy_en_crypto_status_t Cy_Crypto_Core_EC25519_PointMultiplication | ( | CRYPTO_Type * | base, |
uint8_t * | p_r, | ||
const uint8_t * | p_x, | ||
const uint8_t * | p_d | ||
) |
EC25519 Elliptic curve point multiplication in GF(p).
base | The pointer to a Crypto instance. |
p_r | Pointer to result point. |
p_x | Pointer to X coordinate of base point. |
p_d | Pointer to Scalar multiplication value. |
cy_en_crypto_status_t Cy_Crypto_Core_EC_NistP_PointMultiplication | ( | CRYPTO_Type * | base, |
cy_en_crypto_ecc_curve_id_t | curveID, | ||
const uint8_t * | ecpGX, | ||
const uint8_t * | ecpGY, | ||
const uint8_t * | ecpD, | ||
uint8_t * | ecpQX, | ||
uint8_t * | ecpQY | ||
) |
Elliptic curve point multiplication in GF(p).
For CAT1C & CAT1D devices when D-Cache is enabled parameter ecpGX, ecpGY, ecpD, ecpQX & ecpQY must align and end in 32 byte boundary.
base | The pointer to a Crypto instance. |
curveID | See cy_en_crypto_ecc_curve_id_t. |
ecpGX | Register index for affine X coordinate of base point. |
ecpGY | Register index for affine Y coordinate of base point. |
ecpD | Register index for multiplication value. |
ecpQX | Register index for affine X coordinate of result point. |
ecpQY | Register index for affine Y coordinate of result point. |