S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_hash_based_crypto_lib_itf.h File Reference

Defines the cryptographic abstraction interface to performing hash mechanisms. A cryptographic implementation must define all the functions declared in this file. More...

#include "sopc_enums.h"
#include "sopc_secret_buffer.h"

Go to the source code of this file.

Functions

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.
 

Detailed Description

Defines the cryptographic abstraction interface to performing hash mechanisms. A cryptographic implementation must define all the functions declared in this file.

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.

Parameters
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.
Note
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.
Returns
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).