![]() |
![]() |
OpenThread
1.05.03.02
|
#include <hmac_sha256.hpp>
Public Types | |
typedef Sha256::Hash | Hash |
Public Member Functions | |
void | Finish (Hash &aHash) |
HmacSha256 (void) | |
void | Start (const Key &aKey) |
void | Update (const void *aBuf, uint16_t aBufLength) |
template<typename ObjectType > | |
void | Update (const ObjectType &aObject) |
void | Update (const Message &aMessage, uint16_t aOffset, uint16_t aLength) |
~HmacSha256 (void) | |
Private Member Functions | |
OT_DEFINE_ALIGNED_VAR (mContextStorage, kHmacSha256ContextSize, uint64_t) | |
Private Attributes | |
otCryptoContext | mContext |
This class implements HMAC SHA-256 computation.
typedef Sha256::Hash Hash |
This type represents a HMAC SHA-256 hash.
HmacSha256 | ( | void | ) |
Constructor for HmacSha256
.
References otCryptoContext::mContext, HmacSha256::mContext, otCryptoContext::mContextSize, otPlatCryptoHmacSha256Init(), and SuccessOrAssert.
~HmacSha256 | ( | void | ) |
Destructor for HmacSha256
.
References HmacSha256::mContext, otPlatCryptoHmacSha256Deinit(), and SuccessOrAssert.
void Start | ( | const Key & | aKey | ) |
This method sets the key and starts the HMAC computation.
[in] | aKey | The key to use. |
References HmacSha256::mContext, otPlatCryptoHmacSha256Start(), and SuccessOrAssert.
Referenced by KeyManager::ComputeKeys(), otCryptoHmacSha256(), otPlatCryptoHkdfExpand(), and otPlatCryptoHkdfExtract().
void Update | ( | const void * | aBuf, |
uint16_t | aBufLength | ||
) |
This method inputs bytes into the HMAC computation.
[in] | aBuf | A pointer to the input buffer. |
[in] | aBufLength | The length of aBuf in bytes. |
References HmacSha256::mContext, otPlatCryptoHmacSha256Update(), and SuccessOrAssert.
Referenced by KeyManager::ComputeKeys(), otCryptoHmacSha256(), otPlatCryptoHkdfExpand(), otPlatCryptoHkdfExtract(), and HmacSha256::Update().
|
inline |
This method inputs an object (treated as a sequence of bytes) into the HMAC computation.
ObjectType | The object type. |
[in] | aObject | A reference to the object. |
References HmacSha256::Finish(), and HmacSha256::Update().
void Update | ( | const Message & | aMessage, |
uint16_t | aOffset, | ||
uint16_t | aLength | ||
) |
This method inputs the bytes read from a given message into the HMAC computation.
[in] | aMessage | The message to read the data from. |
[in] | aOffset | The offset into aMessage to start to read. |
[in] | aLength | The number of bytes to read. |
References Data< kDataLengthType >::GetBytes(), Message::GetFirstChunk(), Data< kDataLengthType >::GetLength(), Message::GetNextChunk(), and HmacSha256::Update().
void Finish | ( | Hash & | aHash | ) |
This method finalizes the hash computation.
[out] | aHash | A reference to a Hash to output the calculated hash. |
References Sha256::Hash::kSize, otCryptoSha256Hash::m8, HmacSha256::mContext, otPlatCryptoHmacSha256Finish(), and SuccessOrAssert.
Referenced by KeyManager::ComputeKeys(), otCryptoHmacSha256(), otPlatCryptoHkdfExpand(), otPlatCryptoHkdfExtract(), and HmacSha256::Update().
|
private |
|
private |
Referenced by HmacSha256::Finish(), HmacSha256::HmacSha256(), HmacSha256::Start(), HmacSha256::Update(), and HmacSha256::~HmacSha256().