ASCON Suite
Macros | Functions
pbkdf2.h File Reference

Password-based key derivation function based on ASCON. More...

#include <stddef.h>

Go to the source code of this file.

Macros

#define ASCON_PBKDF2_SIZE   32
 Default output block size for ASCON-PBKDF2. Key material is generated in blocks of this size. More...
 

Functions

void ascon_pbkdf2 (unsigned char *out, size_t outlen, const unsigned char *password, size_t passwordlen, const unsigned char *salt, size_t saltlen, unsigned long count)
 Derives key material using ASCON-PBKDF2. More...
 
void ascon_pbkdf2_hmac (unsigned char *out, size_t outlen, const unsigned char *password, size_t passwordlen, const unsigned char *salt, size_t saltlen, unsigned long count)
 Derives key material using ASCON-PBKDF2 (legacy HMAC version). More...
 

Detailed Description

Password-based key derivation function based on ASCON.

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

Definition in file pbkdf2.h.

Macro Definition Documentation

◆ ASCON_PBKDF2_SIZE

#define ASCON_PBKDF2_SIZE   32

Default output block size for ASCON-PBKDF2. Key material is generated in blocks of this size.

Definition at line 43 of file pbkdf2.h.

Function Documentation

◆ ascon_pbkdf2()

void ascon_pbkdf2 ( unsigned char *  out,
size_t  outlen,
const unsigned char *  password,
size_t  passwordlen,
const unsigned char *  salt,
size_t  saltlen,
unsigned long  count 
)

Derives key material using ASCON-PBKDF2.

Parameters
outPoints to the output buffer to receive the key material.
outlenNumber of bytes of key material to generate.
passwordPoints to the bytes of the password.
passwordlenNumber of bytes in the password.
saltPoints to the bytes of the salt.
saltlenNumber of bytes in the salt.
countNumber of iterations to perform. If this is set to zero, then the value will be changed to 1.

This function can generate a maximum of (2^32 - 1) * ASCON_PBKDF2_SIZE bytes, but this limit is not checked. The count value should be large enough to provide resistance against dictionary attacks on the password.

Note
This function uses ASCON-XOF to implement the pseudorandom function PRF from RFC 8018 rather than HMAC. This is more efficient in terms of time and code size.
See also
ascon_pbkdf2_hmac()
Examples
asconcrypt/asconcrypt.c.

Definition at line 82 of file ascon-pbkdf2.c.

◆ ascon_pbkdf2_hmac()

void ascon_pbkdf2_hmac ( unsigned char *  out,
size_t  outlen,
const unsigned char *  password,
size_t  passwordlen,
const unsigned char *  salt,
size_t  saltlen,
unsigned long  count 
)

Derives key material using ASCON-PBKDF2 (legacy HMAC version).

Parameters
outPoints to the output buffer to receive the key material.
outlenNumber of bytes of key material to generate.
passwordPoints to the bytes of the password.
passwordlenNumber of bytes in the password.
saltPoints to the bytes of the salt.
saltlenNumber of bytes in the salt.
countNumber of iterations to perform. If this is set to zero, then the value will be changed to 1.

This function can generate a maximum of (2^32 - 1) * ASCON_PBKDF2_SIZE bytes, but this limit is not checked. The count value should be large enough to provide resistance against dictionary attacks on the password.

Note
This function uses ASCON-HMAC to implement the pseudorandom function PRF from RFC 8018 for compatibility with existing designs.

Definition at line 58 of file ascon-pbkdf2-hmac.c.