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] aKey A pointer to the key.
[in] aKeyLength Length of the key in bytes.
[in] aTagLength Length of tag in bytes.
[in] aNonce A pointer to the nonce.
[in] aNonceLength Length of nonce in bytes.
[in] aHeader A pointer to the header.
[in] aHeaderLength Length of header in bytes.
[in,out] aPlainText A pointer to the plaintext.
[in,out] aCipherText A pointer to the ciphertext.
[in] aLength Plaintext length in bytes.
[in] aEncrypt true on encrypt and false on decrypt.
[out] aTag A 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] aOutput An output buffer where ECDSA sign should be stored.
[in,out] aOutputLength The length of the aOutput buffer.
[in] aInputHash An input hash.
[in] aInputHashLength The length of the aClaims buffer.
[in] aPrivateKey A private key in PEM format.
[in] aPrivateKeyLength The length of the aPrivateKey buffer.
Return values
OT_ERROR_NONE ECDSA sign has been created successfully.
OT_ERROR_NO_BUFS Output buffer is too small.
OT_ERROR_INVALID_ARGS Private key is not valid EC Private Key.
OT_ERROR_FAILED Error 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] aKey A pointer to the key.
[in] aKeyLength The key length in bytes.
[in] aBuf A pointer to the input buffer.
[in] aBufLength The length of aBuf in bytes.
[out] aHash A pointer to the output hash buffer.