ike_kdf.h File Reference

IKEv2 key derivation functions. More...

#include "core/crypto.h"
#include "mac/mac_algorithms.h"

Go to the source code of this file.

Data Structures

struct  IkePrfContext
 IKE PRF algorithm context. More...
 

Functions

error_t ikePrf (MacAlgo macAlgo, const HashAlgo *hashAlgo, const CipherAlgo *cipherAlgo, const uint8_t *key, size_t keyLen, const uint8_t *data, size_t dataLen, uint8_t *output)
 Pseudorandom function (prf function) More...
 
error_t ikePrfEx (MacAlgo macAlgo, const HashAlgo *hashAlgo, const CipherAlgo *cipherAlgo, const uint8_t *key, size_t keyLen, const DataFrag *dataFrags, uint_t dataNumFrags, uint8_t *output)
 Pseudorandom function (prf function) More...
 
error_t ikePrfPlus (MacAlgo macAlgo, const HashAlgo *hashAlgo, const CipherAlgo *cipherAlgo, const uint8_t *key, size_t keyLen, const uint8_t *data, size_t dataLen, uint8_t *output, size_t outputLen)
 Function that outputs a pseudorandom stream (prf+ function) More...
 
error_t ikePrfPlusEx (MacAlgo macAlgo, const HashAlgo *hashAlgo, const CipherAlgo *cipherAlgo, const uint8_t *key, size_t keyLen, const DataFrag *dataFrags, uint_t dataNumFrags, uint8_t *output, size_t outputLen)
 Function that outputs a pseudorandom stream (prf+ function) More...
 
error_t ikePrfInit (IkePrfContext *context, MacAlgo macAlgo, const HashAlgo *hashAlgo, const CipherAlgo *cipherAlgo, const uint8_t *key, size_t keyLen)
 Initialize PRF calculation. More...
 
void ikePrfUpdate (IkePrfContext *context, const uint8_t *data, size_t dataLen)
 Update PRF calculation. More...
 
error_t ikePrfFinal (IkePrfContext *context, uint8_t *output, size_t outputLen)
 Finalize PRF calculation. More...
 

Detailed Description

IKEv2 key derivation functions.

License

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

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

This file is part of CycloneCRYPTO 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 ike_kdf.h.

Function Documentation

◆ ikePrf()

error_t ikePrf ( MacAlgo  macAlgo,
const HashAlgo *  hashAlgo,
const CipherAlgo *  cipherAlgo,
const uint8_t *  key,
size_t  keyLen,
const uint8_t *  data,
size_t  dataLen,
uint8_t *  output 
)

Pseudorandom function (prf function)

Parameters
[in]macAlgoPRF algorithm (CMAC, HMAC, KMAC or XCBC-MAC)
[in]hashAlgoUnderlying hash function (for HMAC)
[in]cipherAlgoUnderlying cipher algorithm (for CMAC and XCBC-MAC)
[in]keyPointer to the key
[in]keyLenLength of the key, in bytes
[in]dataPointer to the data
[in]dataLenLength of the data, in bytes
[in]outputPseudorandom output
Returns
Error code

Definition at line 55 of file ike_kdf.c.

◆ ikePrfEx()

error_t ikePrfEx ( MacAlgo  macAlgo,
const HashAlgo *  hashAlgo,
const CipherAlgo *  cipherAlgo,
const uint8_t *  key,
size_t  keyLen,
const DataFrag *  dataFrags,
uint_t  dataNumFrags,
uint8_t *  output 
)

Pseudorandom function (prf function)

Parameters
[in]macAlgoPRF algorithm (CMAC, HMAC, KMAC or XCBC-MAC)
[in]hashAlgoUnderlying hash function (for HMAC)
[in]cipherAlgoUnderlying cipher algorithm (for CMAC and XCBC-MAC)
[in]keyPointer to the key
[in]keyLenLength of the key, in bytes
[in]dataFragsArray of fragments representing the data
[in]dataNumFragsNumber of fragments representing the data
[in]outputPseudorandom output
Returns
Error code

Definition at line 92 of file ike_kdf.c.

◆ ikePrfFinal()

error_t ikePrfFinal ( IkePrfContext *  context,
uint8_t *  output,
size_t  outputLen 
)

Finalize PRF calculation.

Parameters
[in]contextPointer to the IKE PRF context
[out]outputPseudorandom output
[in]outputLenDesired length of the pseudorandom output stream
Returns
Error code

Definition at line 546 of file ike_kdf.c.

◆ ikePrfInit()

error_t ikePrfInit ( IkePrfContext *  context,
MacAlgo  macAlgo,
const HashAlgo *  hashAlgo,
const CipherAlgo *  cipherAlgo,
const uint8_t *  key,
size_t  keyLen 
)

Initialize PRF calculation.

Parameters
[in]contextPointer to the IKE PRF context
[in]macAlgoPRF algorithm (CMAC, HMAC, KMAC or XCBC-MAC)
[in]hashAlgoUnderlying hash function (for HMAC)
[in]cipherAlgoUnderlying cipher algorithm (for CMAC and XCBC-MAC)
[in]keyPointer to the key
[in]keyLenLength of the key, in bytes
Returns
Error code

Definition at line 315 of file ike_kdf.c.

◆ ikePrfPlus()

error_t ikePrfPlus ( MacAlgo  macAlgo,
const HashAlgo *  hashAlgo,
const CipherAlgo *  cipherAlgo,
const uint8_t *  key,
size_t  keyLen,
const uint8_t *  data,
size_t  dataLen,
uint8_t *  output,
size_t  outputLen 
)

Function that outputs a pseudorandom stream (prf+ function)

Parameters
[in]macAlgoPRF algorithm (CMAC, HMAC, KMAC or XCBC-MAC)
[in]hashAlgoUnderlying hash function (for HMAC)
[in]cipherAlgoUnderlying cipher algorithm (for CMAC and XCBC-MAC)
[in]keyPointer to the key
[in]keyLenLength of the key, in bytes
[in]dataPointer to the data
[in]dataLenLength of the data, in bytes
[out]outputPseudorandom output stream
[in]outputLenDesired length of the pseudorandom output stream
Returns
Error code

Definition at line 152 of file ike_kdf.c.

◆ ikePrfPlusEx()

error_t ikePrfPlusEx ( MacAlgo  macAlgo,
const HashAlgo *  hashAlgo,
const CipherAlgo *  cipherAlgo,
const uint8_t *  key,
size_t  keyLen,
const DataFrag *  dataFrags,
uint_t  dataNumFrags,
uint8_t *  output,
size_t  outputLen 
)

Function that outputs a pseudorandom stream (prf+ function)

Parameters
[in]macAlgoPRF algorithm (CMAC, HMAC, KMAC or XCBC-MAC)
[in]hashAlgoUnderlying hash function (for HMAC)
[in]cipherAlgoUnderlying cipher algorithm (for CMAC and XCBC-MAC)
[in]keyPointer to the key
[in]keyLenLength of the key, in bytes
[in]dataFragsArray of fragments representing the data
[in]dataNumFragsNumber of fragments representing the data
[out]outputPseudorandom output stream
[in]outputLenDesired length of the pseudorandom output stream
Returns
Error code

Definition at line 191 of file ike_kdf.c.

◆ ikePrfUpdate()

void ikePrfUpdate ( IkePrfContext *  context,
const uint8_t *  data,
size_t  dataLen 
)

Update PRF calculation.

Parameters
[in]contextPointer to the IKE PRF context
[in]dataPointer to the data
[in]dataLenLength of the data, in bytes

Definition at line 492 of file ike_kdf.c.