This module includes cryptographic functions.
Macros |
|
| #define | OT_CRYPTO_HMAC_SHA_HASH_SIZE 32 |
|
Length of HMAC SHA (in bytes).
|
|
Functions |
|
| void | otCryptoHmacSha256 (const uint8_t *aKey, uint16_t aKeyLength, const uint8_t *aBuf, uint16_t aBufLength, uint8_t *aHash) |
|
This function performs HMAC computation.
|
|
| void | otCryptoAesCcm (const uint8_t *aKey, uint16_t aKeyLength, uint8_t aTagLength, const void *aNonce, uint8_t aNonceLength, const void *aHeader, uint32_t aHeaderLength, void *aPlainText, void *aCipherText, uint32_t aLength, bool aEncrypt, void *aTag) |
|
This method performs AES CCM computation.
|
|
| otError | otCryptoEcdsaSign (uint8_t *aOutput, uint16_t *aOutputLength, const uint8_t *aInputHash, uint16_t aInputHashLength, const uint8_t *aPrivateKey, uint16_t aPrivateKeyLength) |
|
This method creates ECDSA sign.
|
|
Detailed Description
This module includes cryptographic functions.
Function Documentation
◆ otCryptoAesCcm()
| void otCryptoAesCcm | ( | const uint8_t * |
aKey,
|
| uint16_t |
aKeyLength,
|
||
| uint8_t |
aTagLength,
|
||
| const void * |
aNonce,
|
||
| uint8_t |
aNonceLength,
|
||
| const void * |
aHeader,
|
||
| uint32_t |
aHeaderLength,
|
||
| void * |
aPlainText,
|
||
| void * |
aCipherText,
|
||
| uint32_t |
aLength,
|
||
| bool |
aEncrypt,
|
||
| void * |
aTag
|
||
| ) |
This method performs AES CCM computation.
- Parameters
-
[in] aKeyA pointer to the key. [in] aKeyLengthLength of the key in bytes. [in] aTagLengthLength of tag in bytes. [in] aNonceA pointer to the nonce. [in] aNonceLengthLength of nonce in bytes. [in] aHeaderA pointer to the header. [in] aHeaderLengthLength of header in bytes. [in,out] aPlainTextA pointer to the plaintext. [in,out] aCipherTextA pointer to the ciphertext. [in] aLengthPlaintext length in bytes. [in] aEncrypttrueon encrypt andfalseon decrypt.[out] aTagA pointer to the tag.
◆ otCryptoEcdsaSign()
| otError otCryptoEcdsaSign | ( | uint8_t * |
aOutput,
|
| uint16_t * |
aOutputLength,
|
||
| const uint8_t * |
aInputHash,
|
||
| uint16_t |
aInputHashLength,
|
||
| const uint8_t * |
aPrivateKey,
|
||
| uint16_t |
aPrivateKeyLength
|
||
| ) |
This method creates ECDSA sign.
- Parameters
-
[out] aOutputAn output buffer where ECDSA sign should be stored. [in,out] aOutputLengthThe length of the aOutputbuffer.[in] aInputHashAn input hash. [in] aInputHashLengthThe length of the aClaimsbuffer.[in] aPrivateKeyA private key in PEM format. [in] aPrivateKeyLengthThe length of the aPrivateKeybuffer.
- Return values
-
OT_ERROR_NONEECDSA sign has been created successfully. OT_ERROR_NO_BUFSOutput buffer is too small. OT_ERROR_INVALID_ARGSPrivate key is not valid EC Private Key. OT_ERROR_FAILEDError during signing.
◆ otCryptoHmacSha256()
| void otCryptoHmacSha256 | ( | const uint8_t * |
aKey,
|
| uint16_t |
aKeyLength,
|
||
| const uint8_t * |
aBuf,
|
||
| uint16_t |
aBufLength,
|
||
| uint8_t * |
aHash
|
||
| ) |
This function performs HMAC computation.
- Parameters
-
[in] aKeyA pointer to the key. [in] aKeyLengthThe key length in bytes. [in] aBufA pointer to the input buffer. [in] aBufLengthThe length of aBufin bytes.[out] aHashA pointer to the output hash buffer.