ike_sign_generate.c File Reference

RSA/DSA/ECDSA/EdDSA signature generation. More...

#include "ike/ike.h"
#include "ike/ike_algorithms.h"
#include "ike/ike_sign_generate.h"
#include "pkix/pem_import.h"
#include "pkix/x509_sign_format.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   IKE_TRACE_LEVEL
 

Functions

error_t ikeGenerateSignature (IkeSaEntry *sa, const uint8_t *id, size_t idLen, uint8_t *authMethod, uint8_t *signature, size_t *signatureLen)
 Signature generation. More...
 
error_t ikeGenerateDigitalSignature (IkeSaEntry *sa, const uint8_t *id, size_t idLen, IkeAuthData *authData, size_t *authDataLen)
 Digital signature generation. More...
 
error_t ikeGenerateRsaSignature (IkeSaEntry *sa, const uint8_t *id, size_t idLen, const HashAlgo *hashAlgo, uint8_t *signature, size_t *signatureLen)
 RSA signature generation. More...
 
error_t ikeGenerateRsaPssSignature (IkeSaEntry *sa, const uint8_t *id, size_t idLen, const HashAlgo *hashAlgo, size_t saltLen, uint8_t *signature, size_t *signatureLen)
 RSA-PSS signature generation. More...
 
error_t ikeGenerateDsaSignature (IkeSaEntry *sa, const uint8_t *id, size_t idLen, const HashAlgo *hashAlgo, uint8_t *signature, size_t *signatureLen, IkeSignFormat format)
 DSA signature generation. More...
 
error_t ikeGenerateEcdsaSignature (IkeSaEntry *sa, const uint8_t *id, size_t idLen, const EcCurveInfo *curveInfo, const HashAlgo *hashAlgo, uint8_t *signature, size_t *signatureLen, IkeSignFormat format)
 ECDSA signature generation. More...
 
error_t ikeGenerateEd25519Signature (IkeSaEntry *sa, const uint8_t *id, size_t idLen, uint8_t *signature, size_t *signatureLen)
 Ed25519 signature generation. More...
 
error_t ikeGenerateEd448Signature (IkeSaEntry *sa, const uint8_t *id, size_t idLen, uint8_t *signature, size_t *signatureLen)
 Ed448 signature generation. More...
 

Detailed Description

RSA/DSA/ECDSA/EdDSA signature generation.

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

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   IKE_TRACE_LEVEL

Definition at line 32 of file ike_sign_generate.c.

Function Documentation

◆ ikeGenerateDigitalSignature()

error_t ikeGenerateDigitalSignature ( IkeSaEntry sa,
const uint8_t *  id,
size_t  idLen,
IkeAuthData authData,
size_t *  authDataLen 
)

Digital signature generation.

Parameters
[in]saPointer to the IKE SA
[in]idPointer to the identification data
[in]idLenLength of the identification data, in bytes
[out]authDataOutput stream where to write the authentication data
[out]authDataLenTotal number of bytes that have been written
Returns
Error code

Definition at line 172 of file ike_sign_generate.c.

◆ ikeGenerateDsaSignature()

error_t ikeGenerateDsaSignature ( IkeSaEntry sa,
const uint8_t *  id,
size_t  idLen,
const HashAlgo hashAlgo,
uint8_t *  signature,
size_t *  signatureLen,
IkeSignFormat  format 
)

DSA signature generation.

Parameters
[in]saPointer to the IKE SA
[in]idPointer to the identification data
[in]idLenLength of the identification data, in bytes
[in]hashAlgoHash algorithm
[out]signatureOutput stream where to write the signature
[out]signatureLenTotal number of bytes that have been written
[in]formatSignature format (raw or ASN.1)
Returns
Error code

Definition at line 462 of file ike_sign_generate.c.

◆ ikeGenerateEcdsaSignature()

error_t ikeGenerateEcdsaSignature ( IkeSaEntry sa,
const uint8_t *  id,
size_t  idLen,
const EcCurveInfo curveInfo,
const HashAlgo hashAlgo,
uint8_t *  signature,
size_t *  signatureLen,
IkeSignFormat  format 
)

ECDSA signature generation.

Parameters
[in]saPointer to the IKE SA
[in]idPointer to the identification data
[in]idLenLength of the identification data, in bytes
[in]curveInfoElliptic curve parameters
[in]hashAlgoHash algorithm
[out]signatureOutput stream where to write the signature
[out]signatureLenTotal number of bytes that have been written
[in]formatSignature format (raw or ASN.1)
Returns
Error code

Definition at line 535 of file ike_sign_generate.c.

◆ ikeGenerateEd25519Signature()

error_t ikeGenerateEd25519Signature ( IkeSaEntry sa,
const uint8_t *  id,
size_t  idLen,
uint8_t *  signature,
size_t *  signatureLen 
)

Ed25519 signature generation.

Parameters
[in]saPointer to the IKE SA
[in]idPointer to the identification data
[in]idLenLength of the identification data, in bytes
[out]signatureOutput stream where to write the signature
[out]signatureLenTotal number of bytes that have been written
Returns
Error code

Definition at line 617 of file ike_sign_generate.c.

◆ ikeGenerateEd448Signature()

error_t ikeGenerateEd448Signature ( IkeSaEntry sa,
const uint8_t *  id,
size_t  idLen,
uint8_t *  signature,
size_t *  signatureLen 
)

Ed448 signature generation.

Parameters
[in]saPointer to the IKE SA
[in]idPointer to the identification data
[in]idLenLength of the identification data, in bytes
[out]signatureOutput stream where to write the signature
[out]signatureLenTotal number of bytes that have been written
Returns
Error code

Definition at line 691 of file ike_sign_generate.c.

◆ ikeGenerateRsaPssSignature()

error_t ikeGenerateRsaPssSignature ( IkeSaEntry sa,
const uint8_t *  id,
size_t  idLen,
const HashAlgo hashAlgo,
size_t  saltLen,
uint8_t *  signature,
size_t *  signatureLen 
)

RSA-PSS signature generation.

Parameters
[in]saPointer to the IKE SA
[in]idPointer to the identification data
[in]idLenLength of the identification data, in bytes
[in]hashAlgoHash algorithm
[in]saltLenLength of the salt, in bytes
[out]signatureOutput stream where to write the signature
[out]signatureLenTotal number of bytes that have been written
Returns
Error code

Definition at line 402 of file ike_sign_generate.c.

◆ ikeGenerateRsaSignature()

error_t ikeGenerateRsaSignature ( IkeSaEntry sa,
const uint8_t *  id,
size_t  idLen,
const HashAlgo hashAlgo,
uint8_t *  signature,
size_t *  signatureLen 
)

RSA signature generation.

Parameters
[in]saPointer to the IKE SA
[in]idPointer to the identification data
[in]idLenLength of the identification data, in bytes
[in]hashAlgoHash algorithm
[out]signatureOutput stream where to write the signature
[out]signatureLenTotal number of bytes that have been written
Returns
Error code

Definition at line 342 of file ike_sign_generate.c.

◆ ikeGenerateSignature()

error_t ikeGenerateSignature ( IkeSaEntry sa,
const uint8_t *  id,
size_t  idLen,
uint8_t *  authMethod,
uint8_t *  signature,
size_t *  signatureLen 
)

Signature generation.

Parameters
[in]saPointer to the IKE SA
[in]idPointer to the identification data
[in]idLenLength of the identification data, in bytes
[out]authMethodAuthentication method
[out]signatureOutput stream where to write the signature
[out]signatureLenTotal number of bytes that have been written
Returns
Error code

Definition at line 57 of file ike_sign_generate.c.