My Project
Functions
kdf.h File Reference

Go to the source code of this file.

Functions

int wc_SRTP_KDF (const byte *key, word32 keySz, const byte *salt, word32 saltSz, int kdrIdx, const byte *index, byte *key1, word32 key1Sz, byte *key2, word32 key2Sz, byte *key3, word32 key3Sz)
 This function derives keys using SRTP KDF algorithm. More...
 
int wc_SRTCP_KDF (const byte *key, word32 keySz, const byte *salt, word32 saltSz, int kdrIdx, const byte *index, byte *key1, word32 key1Sz, byte *key2, word32 key2Sz, byte *key3, word32 key3Sz)
 This function derives keys using SRTCP KDF algorithm. More...
 
int wc_SRTP_KDF_label (const byte *key, word32 keySz, const byte *salt, word32 saltSz, int kdrIdx, const byte *index, byte label, byte *outKey, word32 outKeySz)
 This function derives a key with label using SRTP KDF algorithm. More...
 
int wc_SRTP_KDF_kdr_to_idx (word32 kdr)
 This function converts a kdr value to an index to use in SRTP/SRTCP KDF API. More...
 
int wc_KDA_KDF_onestep (const byte *z, word32 zSz, const byte *fixedInfo, word32 fixedInfoSz, word32 derivedSecretSz, enum wc_HashType hashType, byte *output, word32 outputSz)
 Performs the single-step key derivation function (KDF) as specified in SP800-56C option 1. More...
 

Function Documentation

◆ wc_KDA_KDF_onestep()

int wc_KDA_KDF_onestep ( const byte *  z,
word32  zSz,
const byte *  fixedInfo,
word32  fixedInfoSz,
word32  derivedSecretSz,
enum wc_HashType  hashType,
byte *  output,
word32  outputSz 
)

Performs the single-step key derivation function (KDF) as specified in SP800-56C option 1.

Parameters
[in]zThe input keying material.
[in]zSzThe size of the input keying material.
[in]fixedInfoThe fixed information to be included in the KDF.
[in]fixedInfoSzThe size of the fixed information.
[in]derivedSecretSzThe desired size of the derived secret.
[in]hashTypeThe hash algorithm to be used in the KDF.
[out]outputThe buffer to store the derived secret.
[in]outputSzThe size of the output buffer.
Returns
0 if the KDF operation is successful,
BAD_FUNC_ARG if the input parameters are invalid.
negative error code if the KDF operation fails.

Example

unsigned char z[32] = { ... };
unsigned char fixedInfo[16] = { ... };
unsigned char output[32];
int ret;
ret = wc_KDA_KDF_onestep(z, sizeof(z), fixedInfo, sizeof(fixedInfo),
sizeof(output), WC_HASH_TYPE_SHA256, output, sizeof(output));
if (ret != 0) {
WOLFSSL_MSG("wc_KDA_KDF_onestep failed");
}
int wc_KDA_KDF_onestep(const byte *z, word32 zSz, const byte *fixedInfo, word32 fixedInfoSz, word32 derivedSecretSz, enum wc_HashType hashType, byte *output, word32 outputSz)
Performs the single-step key derivation function (KDF) as specified in SP800-56C option 1.