lcx_pbkdf2.h | Developers

lcx_pbkdf2.h

Back to the files list

PBKDF2 (Password-Based Key Derivation Function) More...

Macros

#define cx_pbkdf2_sha512(password, password_len, salt, salt_len, iterations, out, out_len)   cx_pbkdf2_no_throw(CX_SHA512, password, password_len, salt, salt_len, iterations, out, out_len)
 Computes a PBKDF2 bytes sequence with SHA512. More...

Functions

cx_err_t cx_pbkdf2_no_throw (cx_md_t md_type, const uint8_t *password, size_t passwordlen, uint8_t *salt, size_t saltlen, uint32_t iterations, uint8_t *out, size_t outLength)
 Computes a PBKDF2 bytes sequence. More...
static void cx_pbkdf2 (cx_md_t md_type, const unsigned char *password, unsigned short passwordlen, unsigned char *salt, unsigned short saltlen, unsigned int iterations, unsigned char *out, unsigned int outLength)
 Computes a PBKDF2 bytes sequence. More...

Detailed Description

PBKDF2 (Password-Based Key Derivation Function)

PBKDF2 is a key derivation function i.e. it produces a key from a base key (a password) and other parameters (a salt and an iteration counter). It consists in iteratively deriving HMAC.

Macro Definition Documentation

cx_pbkdf2_sha512

#define cx_pbkdf2_sha512 ( password,
password_len,
salt,
salt_len,
iterations,
out,
out_len 
)    cx_pbkdf2_no_throw(CX_SHA512, password, password_len, salt, salt_len, iterations, out, out_len)

Computes a PBKDF2 bytes sequence with SHA512.

It computes the bytes sequence according to RFC 2898 with SHA512 as the underlying hash function.

Parameters
[in]passwordPassword used as a base key to compute the HMAC.
[in]password_lenLength of the password i.e. the length of the HMAC key.
[in]saltInitial salt.
[in]salt_lenLength of the salt.
[in]iterationsPer block iteration.
[out]outBuffer where to store the output.
[in]out_lenLengh of the output.
Returns
Error code:
  • CX_OK
  • CX_INVALID_PARAMETER

Function Documentation

cx_pbkdf2()

static void cx_pbkdf2 ( cx_md_t  md_type,
const unsigned char *  password,
unsigned short  passwordlen,
unsigned char *  salt,
unsigned short  saltlen,
unsigned int  iterations,
unsigned char *  out,
unsigned int  outLength 
)

Computes a PBKDF2 bytes sequence.

It computes the bytes sequence according to RFC 2898 . This function throws an exception if the computation doesn't succeed.

Warning
It is recommended to use cx_pbkdf2_no_throw rather than this function.
Parameters
[in]md_typeMessage digest algorithm identifier.
[in]passwordPassword used as a base key to compute the HMAC.
[in]passwordlenLength of the password i.e. the length of the HMAC key.
[in]saltInitial salt.
[in]saltlenLength of the salt.
[in]iterationsPer block iteration.
[out]outBuffer where to store the output.
[in]outLengthLengh of the output.
Exceptions
CX_INVALID_PARAMETER

cx_pbkdf2_no_throw()

cx_err_t cx_pbkdf2_no_throw ( cx_md_t  md_type,
const uint8_t *  password,
size_t  passwordlen,
uint8_t *  salt,
size_t  saltlen,
uint32_t  iterations,
uint8_t *  out,
size_t  outLength 
)

Computes a PBKDF2 bytes sequence.

It computes the bytes sequence according to RFC 2898 .

Parameters
[in]md_typeMessage digest algorithm identifier.
[in]passwordPassword used as a base key to compute the HMAC.
[in]passwordlenLength of the password i.e. the length of the HMAC key.
[in]saltInitial salt.
[in]saltlenLength of the salt.
[in]iterationsPer block iteration.
[out]outBuffer where to store the output.
[in]outLengthLengh of the output.
Returns
Error code:
  • CX_OK
  • CX_INVALID_PARAMETER

Back to the files list


Did you find this page helpful?


How would you improve this page for developers?



Getting Started
Theme Features
Customization

Embedded Apps