esp8266ndn
NDN Arduino library for ESP8266 and more
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | List of all members
ndnph::AesGcmIvHelper Class Reference

AES-GCM Initialization Vector generator and checker. More...

#include <iv.hpp>

Public Types

using IvLen = std::integral_constant< size_t, 12 >
 IV length. More...
 
using BlockSize = std::integral_constant< size_t, 16 >
 AES-GCM block size. More...
 

Public Member Functions

bool randomize ()
 Randomize the random number portion. More...
 
bool write (uint8_t room[12])
 Write IV to room . More...
 
bool advance (size_t size)
 Advance the counter portion. More...
 
bool check (const uint8_t *iv, size_t size)
 Check received IV. More...
 

Public Attributes

uint64_t random = 0
 
uint32_t counter = 0
 

Detailed Description

AES-GCM Initialization Vector generator and checker.

IV is 12 octets. Other sizes are not supported. IV is constructed from an 8-octet random number and a 4-octet counter. The random number portion is expected to stay the same. The counter portion is incremented for every encrypted block.

Member Typedef Documentation

◆ BlockSize

using ndnph::AesGcmIvHelper::BlockSize = std::integral_constant<size_t, 16>

AES-GCM block size.

◆ IvLen

using ndnph::AesGcmIvHelper::IvLen = std::integral_constant<size_t, 12>

IV length.

Member Function Documentation

◆ advance()

bool ndnph::AesGcmIvHelper::advance ( size_t  size)
inline

Advance the counter portion.

Parameters
sizeciphertext size.

◆ check()

bool ndnph::AesGcmIvHelper::check ( const uint8_t *  iv,
size_t  size 
)
inline

Check received IV.

Parameters
ivreceived IV.
sizeciphertext size.
Postcondition
counter is advanced.

◆ randomize()

bool ndnph::AesGcmIvHelper::randomize ( )
inline

Randomize the random number portion.

◆ write()

bool ndnph::AesGcmIvHelper::write ( uint8_t  room[12])
inline

Write IV to room .

Member Data Documentation

◆ counter

uint32_t ndnph::AesGcmIvHelper::counter = 0

◆ random

uint64_t ndnph::AesGcmIvHelper::random = 0

The documentation for this class was generated from the following file: