ike_auth.c File Reference

Authentication of the IKE SA. More...

#include "ike/ike.h"
#include "ike/ike_auth.h"
#include "ike/ike_sign_generate.h"
#include "ike/ike_sign_verify.h"
#include "ike/ike_key_material.h"
#include "encoding/asn1.h"
#include "encoding/oid.h"
#include "pkix/x509_cert_parse.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   IKE_TRACE_LEVEL
 

Functions

error_t ikeGenerateAuth (IkeSaEntry *sa, const IkeIdPayload *idPayload, uint8_t *authMethod, uint8_t *authData, size_t *authDataLen)
 Generate signature or MAC. More...
 
error_t ikeVerifyAuth (IkeSaEntry *sa, IpsecPadEntry *padEntry, const IkeIdPayload *idPayload, const IkeCertPayload *certPayload, const IkeAuthPayload *authPayload)
 Verify signature or MAC. More...
 
error_t ikeComputeMacAuth (IkeSaEntry *sa, const uint8_t *key, size_t keyLen, const uint8_t *id, size_t idLen, uint8_t *mac, bool_t initiator)
 Compute MAC authentication data. More...
 

Detailed Description

Authentication of the IKE SA.

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_auth.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   IKE_TRACE_LEVEL

Definition at line 32 of file ike_auth.c.

Function Documentation

◆ ikeComputeMacAuth()

error_t ikeComputeMacAuth ( IkeSaEntry sa,
const uint8_t *  key,
size_t  keyLen,
const uint8_t *  id,
size_t  idLen,
uint8_t *  mac,
bool_t  initiator 
)

Compute MAC authentication data.

Parameters
[in]saPointer to the IKE SA
[in]keyPre-shared key
[in]keyLenLength of the pre-shared key
[in]idMAC authentication data
[in]idLenMAC authentication data
[out]macMAC authentication data
[in]initiatorSpecifies whether the computation is performed at initiator or responder side
Returns
Error code

Definition at line 310 of file ike_auth.c.

◆ ikeGenerateAuth()

error_t ikeGenerateAuth ( IkeSaEntry sa,
const IkeIdPayload idPayload,
uint8_t *  authMethod,
uint8_t *  authData,
size_t *  authDataLen 
)

Generate signature or MAC.

Parameters
[in]saPointer to the IKE SA
[in]idPayloadPointer to the Identification payload
[out]authMethodAuthentication method
[out]authDataPointer to the authentication data
[out]authDataLenLength of the authentication data
Returns
Error code

Definition at line 59 of file ike_auth.c.

◆ ikeVerifyAuth()

error_t ikeVerifyAuth ( IkeSaEntry sa,
IpsecPadEntry padEntry,
const IkeIdPayload idPayload,
const IkeCertPayload certPayload,
const IkeAuthPayload authPayload 
)

Verify signature or MAC.

Parameters
[in]saPointer to the IKE SA
[in]padEntryPointer to the PAD entry
[in]idPayloadPointer to the Identification payload
[in]certPayloadPointer to the Certificate payload
[out]authPayloadPointer to the Authentication payload
Returns
Error code

Definition at line 137 of file ike_auth.c.