one_step_kdf.h File Reference

One-Step KDF. More...

#include "core/crypto.h"

Go to the source code of this file.

Macros

#define ONE_STEP_KDF_KMAC128_DEFAULT_SALT_LEN   164
 
#define ONE_STEP_KDF_KMAC256_DEFAULT_SALT_LEN   132
 

Enumerations

enum  OneStepKdfType { ONE_STEP_KDF_TYPE_HASH = 1, ONE_STEP_KDF_TYPE_HMAC = 2, ONE_STEP_KDF_TYPE_KMAC128 = 3, ONE_STEP_KDF_TYPE_KMAC256 = 4 }
 One-Step KDF auxiliary functions. More...
 

Functions

error_t oneStepKdf (OneStepKdfType type, const HashAlgo *hashAlgo, const uint8_t *z, size_t zLen, const uint8_t *salt, size_t saltLen, const uint8_t *otherInfo, size_t otherInfoLen, uint8_t *dk, size_t dkLen)
 One-Step KDF function. More...
 
error_t oneStepKdfHash (const HashAlgo *hashAlgo, const uint8_t *z, size_t zLen, const uint8_t *otherInfo, size_t otherInfoLen, uint8_t *dk, size_t dkLen)
 One-Step KDF function (with hash-based auxiliary function) More...
 
error_t oneStepKdfHmac (const HashAlgo *hashAlgo, const uint8_t *z, size_t zLen, const uint8_t *salt, size_t saltLen, const uint8_t *otherInfo, size_t otherInfoLen, uint8_t *dk, size_t dkLen)
 One-Step KDF function (with HMAC-based auxiliary function) More...
 
error_t oneStepKdfKmac (uint_t strength, size_t hLen, const uint8_t *z, size_t zLen, const uint8_t *salt, size_t saltLen, const uint8_t *otherInfo, size_t otherInfoLen, uint8_t *dk, size_t dkLen)
 One-Step KDF function (with KMAC-based auxiliary function) More...
 

Detailed Description

One-Step KDF.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2026 Oryx Embedded SARL. All rights reserved.

This file is part of CyclSINGLE_CRYPTO Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.6.6

Definition in file one_step_kdf.h.

Macro Definition Documentation

◆ ONE_STEP_KDF_KMAC128_DEFAULT_SALT_LEN

#define ONE_STEP_KDF_KMAC128_DEFAULT_SALT_LEN   164

Definition at line 38 of file one_step_kdf.h.

◆ ONE_STEP_KDF_KMAC256_DEFAULT_SALT_LEN

#define ONE_STEP_KDF_KMAC256_DEFAULT_SALT_LEN   132

Definition at line 40 of file one_step_kdf.h.

Enumeration Type Documentation

◆ OneStepKdfType

One-Step KDF auxiliary functions.

Enumerator
ONE_STEP_KDF_TYPE_HASH 
ONE_STEP_KDF_TYPE_HMAC 
ONE_STEP_KDF_TYPE_KMAC128 
ONE_STEP_KDF_TYPE_KMAC256 

Definition at line 52 of file one_step_kdf.h.

Function Documentation

◆ oneStepKdf()

error_t oneStepKdf ( OneStepKdfType  type,
const HashAlgo *  hashAlgo,
const uint8_t *  z,
size_t  zLen,
const uint8_t *  salt,
size_t  saltLen,
const uint8_t *  otherInfo,
size_t  otherInfoLen,
uint8_t *  dk,
size_t  dkLen 
)

One-Step KDF function.

Parameters
[in]typeAuxiliary function H (hash, HMAC or KMAC)
[in]hashAlgoUnderlying hash function (for hash and HMAC-based auxiliary functions only)
[in]zShared secret Z
[in]zLenLength of the shared secret Z, in bytes
[in]saltSalt value (for HMAC and KMAC-based auxiliary functions only)
[in]saltLenLength of the salt value, in bytes
[in]otherInfoContext-specific information (optional parameter)
[in]otherInfoLenLength of the context-specific information, in bytes
[out]dkDerived keying material
[in]dkLenLength of the keying material to be generated, in bytes
Returns
Error code

Definition at line 80 of file one_step_kdf.c.

◆ oneStepKdfHash()

error_t oneStepKdfHash ( const HashAlgo *  hashAlgo,
const uint8_t *  z,
size_t  zLen,
const uint8_t *  otherInfo,
size_t  otherInfoLen,
uint8_t *  dk,
size_t  dkLen 
)

One-Step KDF function (with hash-based auxiliary function)

Parameters
[in]hashAlgoUnderlying hash function
[in]zShared secret Z
[in]zLenLength of the shared secret Z, in bytes
[in]otherInfoContext-specific information (optional parameter)
[in]otherInfoLenLength of the context-specific information, in bytes
[out]dkDerived keying material
[in]dkLenLength of the keying material to be generated, in bytes
Returns
Error code

Definition at line 131 of file one_step_kdf.c.

◆ oneStepKdfHmac()

error_t oneStepKdfHmac ( const HashAlgo *  hashAlgo,
const uint8_t *  z,
size_t  zLen,
const uint8_t *  salt,
size_t  saltLen,
const uint8_t *  otherInfo,
size_t  otherInfoLen,
uint8_t *  dk,
size_t  dkLen 
)

One-Step KDF function (with HMAC-based auxiliary function)

Parameters
[in]hashAlgoUnderlying hash function
[in]zShared secret Z
[in]zLenLength of the shared secret Z, in bytes
[in]saltSalt value
[in]saltLenLength of the salt, in bytes
[in]otherInfoContext-specific information (optional parameter)
[in]otherInfoLenLength of the context-specific information, in bytes
[out]dkDerived keying material
[in]dkLenLength of the keying material to be generated, in bytes
Returns
Error code

Definition at line 212 of file one_step_kdf.c.

◆ oneStepKdfKmac()

error_t oneStepKdfKmac ( uint_t  strength,
size_t  hLen,
const uint8_t *  z,
size_t  zLen,
const uint8_t *  salt,
size_t  saltLen,
const uint8_t *  otherInfo,
size_t  otherInfoLen,
uint8_t *  dk,
size_t  dkLen 
)

One-Step KDF function (with KMAC-based auxiliary function)

Parameters
[in]strengthNumber of bits of security (128 for KMAC128 and 256 for KMAC256)
[in]hLenLength of of the auxiliary function output, in bytes
[in]zShared secret Z
[in]zLenLength of the shared secret Z, in bytes
[in]saltSalt value
[in]saltLenLength of the salt, in bytes
[in]otherInfoContext-specific information (optional parameter)
[in]otherInfoLenLength of the context-specific information, in bytes
[out]dkDerived keying material
[in]dkLenLength of the keying material to be generated, in bytes
Returns
Error code

Definition at line 314 of file one_step_kdf.c.