Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
Data Structures | Macros | Functions
photon-beetle-hkdf.h File Reference

HMAC-based key derivation function based on PHOTON-Beetle-HMAC. More...

#include <stddef.h>

Go to the source code of this file.

Data Structures

struct  photon_beetle_hkdf_state_t
 State for incremental generation of key material from PHOTON-Beetle-HKDF. More...
 

Macros

#define PHOTON_BEETLE_HKDF_OUTPUT_SIZE   32
 Default output block size for PHOTON-Beetle-HKDF. Key material is generated in blocks of this size.
 

Functions

int photon_beetle_hkdf (unsigned char *out, size_t outlen, const unsigned char *key, size_t keylen, const unsigned char *salt, size_t saltlen, const unsigned char *info, size_t infolen)
 Derives key material using PHOTON-Beetle-HKDF. More...
 
void photon_beetle_hkdf_extract (photon_beetle_hkdf_state_t *state, const unsigned char *key, size_t keylen, const unsigned char *salt, size_t saltlen)
 Extracts entropy from a key and salt for PHOTON-Beetle-HKDF. More...
 
int photon_beetle_hkdf_expand (photon_beetle_hkdf_state_t *state, const unsigned char *info, size_t infolen, unsigned char *out, size_t outlen)
 Expands key material using a PHOTON-Beetle-HKDF state. More...
 
void photon_beetle_hkdf_free (photon_beetle_hkdf_state_t *state)
 Frees all sensitive material in a PHOTON-Beetle-HKDF state. More...
 

Detailed Description

HMAC-based key derivation function based on PHOTON-Beetle-HMAC.

Reference: https://tools.ietf.org/html/rfc5869

Function Documentation

int photon_beetle_hkdf ( unsigned char *  out,
size_t  outlen,
const unsigned char *  key,
size_t  keylen,
const unsigned char *  salt,
size_t  saltlen,
const unsigned char *  info,
size_t  infolen 
)

Derives key material using PHOTON-Beetle-HKDF.

Parameters
outPoints to the output buffer to receive the key material.
outlenNumber of bytes of key material to generate, maximum of PHOTON_BEETLE_HKDF_OUTPUT_SIZE * 255 bytes.
keyPoints to the bytes of the key.
keylenNumber of bytes in the key.
saltPoints to the bytes of the salt.
saltlenNumber of bytes in the salt.
infoPoints to the bytes of the informational data.
infolenNumber of bytes in the informational data.
Returns
Zero on success or -1 if outlen is out of range.
See Also
photon_beetle_hkdf_extract(), photon_beetle_hkdf_expand()
int photon_beetle_hkdf_expand ( photon_beetle_hkdf_state_t state,
const unsigned char *  info,
size_t  infolen,
unsigned char *  out,
size_t  outlen 
)

Expands key material using a PHOTON-Beetle-HKDF state.

Parameters
stateHKDF state to use to expand key material.
infoPoints to the bytes of the informational data.
infolenNumber of bytes in the informational data.
outPoints to the output buffer to receive the key material.
outlenNumber of bytes of key material to generate.
Returns
Zero on success or -1 if too many bytes have been generated so far. There is a limit of PHOTON_BEETLE_HKDF_OUTPUT_SIZE * 255 bytes.
void photon_beetle_hkdf_extract ( photon_beetle_hkdf_state_t state,
const unsigned char *  key,
size_t  keylen,
const unsigned char *  salt,
size_t  saltlen 
)

Extracts entropy from a key and salt for PHOTON-Beetle-HKDF.

Parameters
stateHKDF state to be initialized.
keyPoints to the bytes of the key.
keylenNumber of bytes in the key.
saltPoints to the bytes of the salt.
saltlenNumber of bytes in the salt.
See Also
photon_beetle_hkdf_expand(), photon_beetle_hkdf()
void photon_beetle_hkdf_free ( photon_beetle_hkdf_state_t state)

Frees all sensitive material in a PHOTON-Beetle-HKDF state.

Parameters
statePoints to the HKDF state.