Arduino Cryptography Library
|
Implementation of the GHASH message authenticator. More...
#include <GHASH.h>
Public Member Functions | |
GHASH () | |
Constructs a new GHASH message authenticator. | |
~GHASH () | |
Destroys this GHASH message authenticator. | |
void | reset (const void *key) |
Resets the GHASH message authenticator for a new session. More... | |
void | update (const void *data, size_t len) |
Updates the message authenticator with more data. More... | |
void | finalize (void *token, size_t len) |
Finalizes the authentication process and returns the token. More... | |
void | pad () |
Pads the input stream with zero bytes to a multiple of 16. More... | |
void | clear () |
Clears the authenticator's state, removing all sensitive data. | |
Implementation of the GHASH message authenticator.
GHASH is the message authentication part of Galois Counter Mode (GCM).
References: NIST SP 800-38D, http://en.wikipedia.org/wiki/Galois/Counter_Mode
void GHASH::finalize | ( | void * | token, |
size_t | len | ||
) |
Finalizes the authentication process and returns the token.
token | The buffer to return the token value in. |
len | The length of the token buffer between 0 and 16. |
If len is less than 16, then the token value will be truncated to the first len bytes. If len is greater than 16, then the remaining bytes will left unchanged.
If finalize() is called again, then the returned token value is undefined. Call reset() first to start a new authentication process.
void GHASH::pad | ( | ) |
void GHASH::reset | ( | const void * | key | ) |
Resets the GHASH message authenticator for a new session.
key | Points to the 16 byte authentication key. |
void GHASH::update | ( | const void * | data, |
size_t | len | ||
) |
Updates the message authenticator with more data.
data | Data to be hashed. |
len | Number of bytes of data to be hashed. |
If finalize() has already been called, then the behavior of update() will be undefined. Call reset() first to start a new authentication process.