hash_based_crypto_lib.h File Reference
#include "sopc_enums.h"
#include "sopc_secret_buffer.h"

Go to the source code of this file.


SOPC_ReturnStatus HashBasedCrypto_DeriveSecret_PBKDF2_HMAC_SHA256 (const SOPC_ExposedBuffer *pSecret, uint32_t lenSecret, const SOPC_ExposedBuffer *pSalt, uint32_t lenSalt, uint32_t iteration_count, SOPC_ExposedBuffer **ppOutput, uint32_t lenOutput)
 Password-Based Key Derivation Function. More...

Detailed Description

Gathers the definitions of the lib-specific and crypto-related functions to performing hash mechanisms.

Function Documentation

◆ HashBasedCrypto_DeriveSecret_PBKDF2_HMAC_SHA256()

SOPC_ReturnStatus HashBasedCrypto_DeriveSecret_PBKDF2_HMAC_SHA256 ( const SOPC_ExposedBuffer pSecret,
uint32_t  lenSecret,
const SOPC_ExposedBuffer pSalt,
uint32_t  lenSalt,
uint32_t  iteration_count,
SOPC_ExposedBuffer **  ppOutput,
uint32_t  lenOutput 

Password-Based Key Derivation Function.

pSecretA valid pointer which contains the data to use when generating output.
lenSecretLength of pSecret (bytes).
pSaltA valid pointer which contains the salt when generating output.
lenSaltLength of pSalt (bytes).
iteration_countDesired iteration count (as large as possible).
ppOutputA valid pointer to the newly created buffer which will contain the generated output. You should free it.
lenOutputLength of ppOutput desired.
lenSecret should not exceed 32 bytes because a secret longer than digest size does not protect more, because, HMAC-SHA256 is considered to have 256 bits maximum input entropy.
You doesn't have to free the content of ppOutput when there is an error.
SOPC_STATUS_OK when successful, SOPC_STATUS_INVALID_PARAMETERS when parameters are NULL, and SOPC_STATUS_NOK when there was an error (e.g. no entropy source).