ike_key_exchange.h File Reference

Diffie-Hellman key exchange. More...

#include "ike/ike.h"

Go to the source code of this file.

Functions

void ikeInitKeContext (IkeKeContext *keContext)
 Initialize key exchange context. More...
 
void ikeFreeKeContext (IkeKeContext *keContext)
 Release key exchange context. More...
 
error_t ikeGenerateKeyPair (IkeKeContext *keContext, const PrngAlgo *prngAlgo, void *prngContext)
 Key pair generation. More...
 
error_t ikeComputeSharedSecret (IkeKeContext *keContext, uint8_t *output, size_t *outputLen)
 Compute shared secret. More...
 
error_t ikeFormatPublicKey (IkeKeContext *keContext, uint8_t *p, size_t *written)
 Format public key. More...
 
error_t ikeParsePublicKey (IkeKeContext *keContext, const uint8_t *p, size_t length)
 Parse peer's public key. More...
 

Detailed Description

Diffie-Hellman key exchange.

License

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

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

This file is part of CycloneIPSEC 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_key_exchange.h.

Function Documentation

◆ ikeComputeSharedSecret()

error_t ikeComputeSharedSecret ( IkeKeContext *  keContext,
uint8_t *  output,
size_t *  outputLen 
)

Compute shared secret.

Parameters
[in]keContextPointer to the key exchange context
[out]outputBuffer where to store the shared secret
[out]outputLenLength of the resulting shared secret
Returns
Error code

Definition at line 166 of file ike_key_exchange.c.

◆ ikeFormatPublicKey()

error_t ikeFormatPublicKey ( IkeKeContext *  keContext,
uint8_t *  p,
size_t *  written 
)

Format public key.

Parameters
[in]keContextPointer to the key exchange context
[out]pBuffer where to format the public key
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 215 of file ike_key_exchange.c.

◆ ikeFreeKeContext()

void ikeFreeKeContext ( IkeKeContext *  keContext)

Release key exchange context.

Parameters
[in]keContextPointer to the key exchange context

Definition at line 69 of file ike_key_exchange.c.

◆ ikeGenerateKeyPair()

error_t ikeGenerateKeyPair ( IkeKeContext *  keContext,
const PrngAlgo *  prngAlgo,
void *  prngContext 
)

Key pair generation.

Parameters
[in]keContextPointer to the key exchange context
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
Returns
Error code

Definition at line 91 of file ike_key_exchange.c.

◆ ikeInitKeContext()

void ikeInitKeContext ( IkeKeContext *  keContext)

Initialize key exchange context.

Parameters
[in]keContextPointer to the key exchange context

Definition at line 50 of file ike_key_exchange.c.

◆ ikeParsePublicKey()

error_t ikeParsePublicKey ( IkeKeContext *  keContext,
const uint8_t *  p,
size_t  length 
)

Parse peer's public key.

Parameters
[in]keContextPointer to the key exchange context
[out]pPointer the public key
[out]lengthLength of the public key, in bytes
Returns
Error code

Definition at line 263 of file ike_key_exchange.c.