ike_key_exchange.c File Reference

Diffie-Hellman key exchange. More...

#include "ike/ike.h"
#include "ike/ike_key_exchange.h"
#include "ike/ike_algorithms.h"
#include "ike/ike_dh_groups.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   IKE_TRACE_LEVEL
 

Functions

void ikeInitDhContext (IkeSaEntry *sa)
 Initialize Diffie-Hellman context. More...
 
void ikeFreeDhContext (IkeSaEntry *sa)
 Release Diffie-Hellman context. More...
 
error_t ikeGenerateDhKeyPair (IkeSaEntry *sa)
 Diffie-Hellman key pair generation. More...
 
error_t ikeComputeDhSharedSecret (IkeSaEntry *sa)
 Compute Diffie-Hellman shared secret. More...
 
error_t ikeFormatDhPublicKey (IkeSaEntry *sa, uint8_t *p, size_t *written)
 Format Diffie-Hellman public key. More...
 
error_t ikeParseDhPublicKey (IkeSaEntry *sa, const uint8_t *p, size_t length)
 Parse peer's Diffie-Hellman public key. More...
 

Detailed Description

Diffie-Hellman key exchange.

License

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

Copyright (C) 2022-2024 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.4.4

Definition in file ike_key_exchange.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   IKE_TRACE_LEVEL

Definition at line 32 of file ike_key_exchange.c.

Function Documentation

◆ ikeComputeDhSharedSecret()

error_t ikeComputeDhSharedSecret ( IkeSaEntry sa)

Compute Diffie-Hellman shared secret.

Parameters
[in]saPointer to the IKE SA
Returns
Error code

Definition at line 151 of file ike_key_exchange.c.

◆ ikeFormatDhPublicKey()

error_t ikeFormatDhPublicKey ( IkeSaEntry sa,
uint8_t *  p,
size_t *  written 
)

Format Diffie-Hellman public key.

Parameters
[in]saPointer to the IKE SA
[out]pBuffer where to format the Diffie-Hellman public key
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 199 of file ike_key_exchange.c.

◆ ikeFreeDhContext()

void ikeFreeDhContext ( IkeSaEntry sa)

Release Diffie-Hellman context.

Parameters
[in]saPointer to the IKE SA

Definition at line 69 of file ike_key_exchange.c.

◆ ikeGenerateDhKeyPair()

error_t ikeGenerateDhKeyPair ( IkeSaEntry sa)

Diffie-Hellman key pair generation.

Parameters
[in]saPointer to the IKE SA
Returns
Error code

Definition at line 89 of file ike_key_exchange.c.

◆ ikeInitDhContext()

void ikeInitDhContext ( IkeSaEntry sa)

Initialize Diffie-Hellman context.

Parameters
[in]saPointer to the IKE SA

Definition at line 50 of file ike_key_exchange.c.

◆ ikeParseDhPublicKey()

error_t ikeParseDhPublicKey ( IkeSaEntry sa,
const uint8_t *  p,
size_t  length 
)

Parse peer's Diffie-Hellman public key.

Parameters
[in]saPointer to the IKE SA
[out]pPointer the Diffie-Hellman public key
[out]lengthLength of the Diffie-Hellman public key, in bytes
Returns
Error code

Definition at line 318 of file ike_key_exchange.c.