OpenThread  1.05.03.02
Public Types | Public Member Functions | Private Member Functions | Private Attributes
HmacSha256 Class Reference

#include <hmac_sha256.hpp>

+ Collaboration diagram for HmacSha256:

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
 

Detailed Description

This class implements HMAC SHA-256 computation.

Member Typedef Documentation

§ Hash

typedef Sha256::Hash Hash

This type represents a HMAC SHA-256 hash.

Constructor & Destructor Documentation

§ HmacSha256()

HmacSha256 ( void  )

§ ~HmacSha256()

~HmacSha256 ( void  )

Member Function Documentation

§ Start()

void Start ( const Key aKey)

This method sets the key and starts the HMAC computation.

Parameters
[in]aKeyThe key to use.

References HmacSha256::mContext, otPlatCryptoHmacSha256Start(), and SuccessOrAssert.

Referenced by KeyManager::ComputeKeys(), otCryptoHmacSha256(), otPlatCryptoHkdfExpand(), and otPlatCryptoHkdfExtract().

§ Update() [1/3]

void Update ( const void *  aBuf,
uint16_t  aBufLength 
)

This method inputs bytes into the HMAC computation.

Parameters
[in]aBufA pointer to the input buffer.
[in]aBufLengthThe length of aBuf in bytes.

References HmacSha256::mContext, otPlatCryptoHmacSha256Update(), and SuccessOrAssert.

Referenced by KeyManager::ComputeKeys(), otCryptoHmacSha256(), otPlatCryptoHkdfExpand(), otPlatCryptoHkdfExtract(), and HmacSha256::Update().

§ Update() [2/3]

void Update ( const ObjectType &  aObject)
inline

This method inputs an object (treated as a sequence of bytes) into the HMAC computation.

Template Parameters
ObjectTypeThe object type.
Parameters
[in]aObjectA reference to the object.

References HmacSha256::Finish(), and HmacSha256::Update().

§ Update() [3/3]

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.

Parameters
[in]aMessageThe message to read the data from.
[in]aOffsetThe offset into aMessage to start to read.
[in]aLengthThe number of bytes to read.

References Data< kDataLengthType >::GetBytes(), Message::GetFirstChunk(), Data< kDataLengthType >::GetLength(), Message::GetNextChunk(), and HmacSha256::Update().

§ Finish()

void Finish ( Hash aHash)

This method finalizes the hash computation.

Parameters
[out]aHashA 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().

§ OT_DEFINE_ALIGNED_VAR()

OT_DEFINE_ALIGNED_VAR ( mContextStorage  ,
kHmacSha256ContextSize  ,
uint64_t   
)
private

Field Documentation

§ mContext

otCryptoContext mContext
private

The documentation for this class was generated from the following files:
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale