Crypto - Thread Stack

This module includes cryptographic functions.


struct  otCryptoSha256Hash
 This structure represents a SHA-256 hash.


typedef otPlatCryptoSha256Hash otCryptoSha256Hash


void otCryptoHmacSha256 (const otCryptoKey *aKey, const uint8_t *aBuf, uint16_t aBufLength, otCryptoSha256Hash *aHash)
 This function performs HMAC computation.
void otCryptoAesCcm (const otCryptoKey *aKey, 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 otCryptoKey aKey,
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.

[in]aKeyA pointer to the key.
[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]aEncrypttrue on encrypt and false on 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.

[out]aOutputAn output buffer where ECDSA sign should be stored.
[in,out]aOutputLengthThe length of the aOutput buffer.
[in]aInputHashAn input hash.
[in]aInputHashLengthThe length of the aInputHash buffer.
[in]aPrivateKeyA private key in PEM format.
[in]aPrivateKeyLengthThe length of the aPrivateKey buffer.
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 otCryptoKey aKey,
const uint8_t *  aBuf,
uint16_t  aBufLength,
otCryptoSha256Hash aHash 

This function performs HMAC computation.

[in]aKeyA pointer to the key.
[in]aBufA pointer to the input buffer.
[in]aBufLengthThe length of aBuf in bytes.
[out]aHashA pointer to a otCryptoSha256Hash structure to output the hash value.