WINC3400 Crypto API.
Copyright (c) 2016-2019 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | sha256ctxt |
Macros | |
#define | M2M_SHA256_CONTEXT_BUFF_LEN 128 |
#define | M2M_SHA256_DIGEST_LEN 32 |
Typedefs | |
typedef struct sha256ctxt | tstrM2mSha256Ctxt |
Enumerations | |
enum | tenuRsaSignStatus { M2M_RSA_SIGN_OK, M2M_RSA_SIGN_FAIL } |
RSA Signature status: pass or fail. More... | |
Functions | |
sint8 | m2m_rsa_sign_gen (uint8 *pu8N, uint16 u16NSize, uint8 *pu8d, uint16 u16dSize, uint8 *pu8SignedMsgHash, uint16 u16HashLength, uint8 *pu8RsaSignature) |
RSA Signature Generation. More... | |
sint8 | m2m_rsa_sign_verify (uint8 *pu8N, uint16 u16NSize, uint8 *pu8E, uint16 u16ESize, uint8 *pu8SignedMsgHash, uint16 u16HashLength, uint8 *pu8RsaSignature) |
RSA Signature Verification. More... | |
sint8 | m2m_sha256_hash_finish (tstrM2mSha256Ctxt *psha256Ctxt, uint8 *pu8Sha256Digest) |
SHA256 hash finalization. More... | |
sint8 | m2m_sha256_hash_init (tstrM2mSha256Ctxt *psha256Ctxt) |
SHA256 hash initialization. More... | |
sint8 | m2m_sha256_hash_update (tstrM2mSha256Ctxt *psha256Ctxt, uint8 *pu8Data, uint16 u16DataLength) |
SHA256 hash update. More... | |
#define M2M_SHA256_CONTEXT_BUFF_LEN 128 |
#define M2M_SHA256_DIGEST_LEN 32 |
typedef struct sha256ctxt tstrM2mSha256Ctxt |
enum tenuRsaSignStatus |
sint8 m2m_rsa_sign_gen | ( | uint8 * | pu8N, |
uint16 | u16NSize, | ||
uint8 * | pu8d, | ||
uint16 | u16dSize, | ||
uint8 * | pu8SignedMsgHash, | ||
uint16 | u16HashLength, | ||
uint8 * | pu8RsaSignature | ||
) |
RSA Signature Generation.
The function shall request the RSA Signature generation from the WINC Firmware for the given message. The signed message shall be compressed to the corresponding hash algorithm before calling this function. The hash type is identified by the given hash length. For example, if the hash length is 32 bytes, then it is SHA256.
[in] | pu8N | RSA Key modulus n. |
[in] | u16NSize | Size of the RSA modulus n in bytes. |
[in] | pu8d | RSA private exponent. |
[in] | u16dSize | Size of the RSA private exponent in bytes. |
[in] | pu8SignedMsgHash | The hash digest of the signed message. |
[in] | u16HashLength | The length of the hash digest. |
[out] | pu8RsaSignature | Pointer to a user buffer allocated by teh caller shall hold the generated signature. |
sint8 m2m_rsa_sign_verify | ( | uint8 * | pu8N, |
uint16 | u16NSize, | ||
uint8 * | pu8E, | ||
uint16 | u16ESize, | ||
uint8 * | pu8SignedMsgHash, | ||
uint16 | u16HashLength, | ||
uint8 * | pu8RsaSignature | ||
) |
RSA Signature Verification.
The function shall request the RSA Signature verification from the WINC Firmware for the given message. The signed message shall be compressed to the corresponding hash algorithm before calling this function. The hash type is identified by the given hash length. For example, if the hash length is 32 bytes, then it is SHA256.
[in] | pu8N | RSA Key modulus n. |
[in] | u16NSize | Size of the RSA modulus n in bytes. |
[in] | pu8E | RSA public exponent. |
[in] | u16ESize | Size of the RSA public exponent in bytes. |
[in] | pu8SignedMsgHash | The hash digest of the signed message. |
[in] | u16HashLength | The length of the hash digest. |
[out] | pu8RsaSignature | Signature value to be verified. |
sint8 m2m_sha256_hash_finish | ( | tstrM2mSha256Ctxt * | psha256Ctxt, |
uint8 * | pu8Sha256Digest | ||
) |
SHA256 hash finalization.
[in] | psha256Ctxt | Pointer to a sha256 context allocated by the caller. |
[in] | pu8Sha256Digest | Buffer allocated by the caller which will hold the resultant SHA256 Digest. It must be allocated no less than M2M_SHA256_DIGEST_LEN. |
sint8 m2m_sha256_hash_init | ( | tstrM2mSha256Ctxt * | psha256Ctxt | ) |
SHA256 hash initialization.
[in] | psha256Ctxt | Pointer to a sha256 context allocated by the caller. |
sint8 m2m_sha256_hash_update | ( | tstrM2mSha256Ctxt * | psha256Ctxt, |
uint8 * | pu8Data, | ||
uint16 | u16DataLength | ||
) |
SHA256 hash update.
[in] | psha256Ctxt | Pointer to the sha256 context. |
[in] | pu8Data | Buffer holding the data submitted to the hash. |
[in] | u16DataLength | Size of the data buffer in bytes. |