Functions | |
cy_en_cryptolite_status_t | Cy_Cryptolite_ECC_Init (CRYPTOLITE_Type *base, cy_stc_cryptolite_context_ecdsa_t *cfContext, cy_stc_cryptolite_ecc_buffer_t *eccBuffer) |
Init ECC Context. More... | |
cy_en_cryptolite_status_t | Cy_Cryptolite_ECC_Free (CRYPTOLITE_Type *base, cy_stc_cryptolite_context_ecdsa_t *cfContext) |
Clean up ECC Context. More... | |
cy_en_cryptolite_status_t | Cy_Cryptolite_ECC_SignHash (CRYPTOLITE_Type *base, cy_stc_cryptolite_context_ecdsa_t *cfContext, const uint8_t *hash, uint32_t hashlen, uint8_t *sig, const cy_stc_cryptolite_ecc_key *key, const uint8_t *messageKey) |
Function to generate an ECC signature. More... | |
cy_en_cryptolite_status_t | Cy_Cryptolite_ECC_VerifyHash (CRYPTOLITE_Type *base, cy_stc_cryptolite_context_ecdsa_t *cfContext, const uint8_t *sig, uint32_t siglen, const uint8_t *hash, uint32_t hashlen, cy_en_cryptolite_sig_verify_result_t *stat, const cy_stc_cryptolite_ecc_key *key) |
Verify an ECC signature. More... | |
cy_en_cryptolite_status_t | Cy_Cryptolite_ECC_SharedSecret (CRYPTOLITE_Type *base, cy_stc_cryptolite_context_ecdsa_t *cfContext, cy_en_cryptolite_ecc_curve_id_t curveID, const uint8_t *privateKey, const cy_stc_cryptolite_ecc_key *key, uint8_t const *sharedSecret) |
Generate a Shared Secret key from one private key and others public key. More... | |
cy_en_cryptolite_status_t | Cy_Cryptolite_Rsa_Init (CRYPTOLITE_Type *base, cy_stc_cryptolite_context_rsa_t *cfContext, cy_stc_cryptolite_rsa_buffer_t *rsaBuffers) |
Initialize the RSA context. More... | |
cy_en_cryptolite_status_t | Cy_Cryptolite_Rsa_Proc (CRYPTOLITE_Type *base, cy_stc_cryptolite_context_rsa_t *cfContext, cy_stc_cryptolite_rsa_pub_key_t *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_cryptolite_status_t | Cy_Cryptolite_Rsa_Coef (CRYPTOLITE_Type *base, cy_stc_cryptolite_context_rsa_t *cfContext, cy_stc_cryptolite_rsa_pub_key_t *key) |
Calculation constant coefficients to speed-up Montgomery algorithm. More... | |
cy_en_cryptolite_status_t | Cy_Cryptolite_Rsa_Free (CRYPTOLITE_Type *base, cy_stc_cryptolite_context_rsa_t *cfContext) |
Cleanup the RSA context. More... | |
cy_en_cryptolite_status_t | Cy_Cryptolite_Rsa_Verify (CRYPTOLITE_Type *base, cy_stc_cryptolite_context_rsa_t *cfContext, cy_en_cryptolite_sig_verify_result_t *verResult, cy_en_cryptolite_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_cryptolite_status_t Cy_Cryptolite_ECC_Init | ( | CRYPTOLITE_Type * | base, |
cy_stc_cryptolite_context_ecdsa_t * | cfContext, | ||
cy_stc_cryptolite_ecc_buffer_t * | eccBuffer | ||
) |
Init ECC Context.
base | The pointer to a Cryptolite instance. |
cfContext | The pointer to the cy_stc_cryptolite_context_ecdsa_t. |
eccBuffer | The pointer to the cy_stc_cryptolite_ecc_buffer_t. |
cy_en_cryptolite_status_t Cy_Cryptolite_ECC_Free | ( | CRYPTOLITE_Type * | base, |
cy_stc_cryptolite_context_ecdsa_t * | cfContext | ||
) |
Clean up ECC Context.
base | The pointer to a Cryptolite instance. |
cfContext | The pointer to the cy_stc_cryptolite_context_ecdsa_t. |
cy_en_cryptolite_status_t Cy_Cryptolite_ECC_SignHash | ( | CRYPTOLITE_Type * | base, |
cy_stc_cryptolite_context_ecdsa_t * | cfContext, | ||
const uint8_t * | hash, | ||
uint32_t | hashlen, | ||
uint8_t * | sig, | ||
const cy_stc_cryptolite_ecc_key * | key, | ||
const uint8_t * | messageKey | ||
) |
Function to generate an ECC signature.
key, hash and messageKey must be in little endian. Cy_Cryptolite_InvertEndianness() function is used for converting the endianness.
base | The pointer to a Cryptolite instance. |
cfContext | The pointer to the cy_stc_cryptolite_context_ecdsa_t. |
hash | The hash (message digest) to be signed. |
hashlen | The length of the hash (octets). |
sig | The pointer to the buffer to store the generated signature 'R' followed by 'S'. |
key | The private ECC key to sign the hash. See cy_stc_cryptolite_ecc_key. |
messageKey | The random number for generating the signature. |
cy_en_cryptolite_status_t Cy_Cryptolite_ECC_VerifyHash | ( | CRYPTOLITE_Type * | base, |
cy_stc_cryptolite_context_ecdsa_t * | cfContext, | ||
const uint8_t * | sig, | ||
uint32_t | siglen, | ||
const uint8_t * | hash, | ||
uint32_t | hashlen, | ||
cy_en_cryptolite_sig_verify_result_t * | stat, | ||
const cy_stc_cryptolite_ecc_key * | key | ||
) |
Verify an ECC signature.
sig, hash and key must be in little endian. Cy_Cryptolite_InvertEndianness() function is used for converting the endianness.
base | The pointer to a Cryptolite instance. |
cfContext | The pointer to the ecdsa context. |
sig | The signature to verify, 'R' followed by 'S'. |
siglen | The length of signature. |
hash | The hash (message digest) that was signed. |
hashlen | The length of the hash (octets). |
stat | Result of signature, 0xAAAAAAAA = invalid, 0x55555555 = valid. |
key | The corresponding public ECC key. See cy_stc_cryptolite_ecc_key. |
cy_en_cryptolite_status_t Cy_Cryptolite_ECC_SharedSecret | ( | CRYPTOLITE_Type * | base, |
cy_stc_cryptolite_context_ecdsa_t * | cfContext, | ||
cy_en_cryptolite_ecc_curve_id_t | curveID, | ||
const uint8_t * | privateKey, | ||
const cy_stc_cryptolite_ecc_key * | key, | ||
uint8_t const * | sharedSecret | ||
) |
Generate a Shared Secret key from one private key and others public key.
base | The pointer to a Cryptolite instance. |
cfContext | The pointer to the cy_stc_cryptolite_context_ecdsa_t. |
curveID | The ECC curve id. |
privateKey | The pointer to the ECC private key. |
key | The generated public ECC key. See cy_stc_cryptolite_ecc_key. |
sharedSecret | The pointer to store the generated shared Secret. |
cy_en_cryptolite_status_t Cy_Cryptolite_Rsa_Init | ( | CRYPTOLITE_Type * | base, |
cy_stc_cryptolite_context_rsa_t * | cfContext, | ||
cy_stc_cryptolite_rsa_buffer_t * | rsaBuffers | ||
) |
Initialize the RSA context.
base | The pointer to the CRYPTOLITE instance. |
cfContext | The pointer to the CRYPTOLITE context. |
rsaBuffers | The pointer to the RSA buffers. |
cy_en_cryptolite_status_t Cy_Cryptolite_Rsa_Proc | ( | CRYPTOLITE_Type * | base, |
cy_stc_cryptolite_context_rsa_t * | cfContext, | ||
cy_stc_cryptolite_rsa_pub_key_t * | key, | ||
uint8_t const * | message, | ||
uint32_t | messageSize, | ||
uint8_t * | processedMessage | ||
) |
RSA process algorithm based on the Montgomery algorithm using Barrett reduction.
https://en.wikipedia.org/wiki/RSA_%28cryptosystem%29
Key, message, processedMessage buffers must be 4 byte aligned and end with 4 byte boundary.
base | The pointer to the CRYPTOLITE instance. |
cfContext | The pointer to the CRYPTOLITE context. |
key | The pointer to the cy_stc_cryptolite_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_cryptolite_status_t Cy_Cryptolite_Rsa_Coef | ( | CRYPTOLITE_Type * | base, |
cy_stc_cryptolite_context_rsa_t * | cfContext, | ||
cy_stc_cryptolite_rsa_pub_key_t * | key | ||
) |
Calculation constant coefficients to speed-up Montgomery algorithm.
These coefficients are: coefficient for Barrett reduction, binary inverse of the modulo, result of (2^moduloLength mod modulo)
base | The pointer to the CRYPTOLITE instance. |
cfContext | The pointer to the CRYPTOLITE context. |
key | The pointer to the cy_stc_cryptolite_rsa_pub_key_t structure that stores a public key. |
cy_en_cryptolite_status_t Cy_Cryptolite_Rsa_Free | ( | CRYPTOLITE_Type * | base, |
cy_stc_cryptolite_context_rsa_t * | cfContext | ||
) |
Cleanup the RSA context.
base | The pointer to the CRYPTOLITE instance. |
cfContext | The pointer to the CRYPTOLITE context. |
cy_en_cryptolite_status_t Cy_Cryptolite_Rsa_Verify | ( | CRYPTOLITE_Type * | base, |
cy_stc_cryptolite_context_rsa_t * | cfContext, | ||
cy_en_cryptolite_sig_verify_result_t * | verResult, | ||
cy_en_cryptolite_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
The digest and decryptedSignature buffers must be 4 byte aligned
Returns the verification result cy_en_cryptolite_sig_verify_result_t.
base | The pointer to the CRYPTOLITE instance. |
cfContext | The pointer to the CRYPTOLITE context. |
verResult | The pointer to the verification result cy_en_cryptolite_sig_verify_result_t. |
digestType | SHA mode used for hash calculation cy_en_cryptolite_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_CRYPTOLITE_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) |