ike_sign_generate.h
Go to the documentation of this file.
1 /**
2  * @file ike_sign_generate.h
3  * @brief RSA/DSA/ECDSA/EdDSA signature generation
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2022-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneIPSEC Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _IKE_SIGN_GENERATE_H
32 #define _IKE_SIGN_GENERATE_H
33 
34 //Dependencies
35 #include "ike/ike.h"
36 #include "ike/ike_sign_misc.h"
37 #include "pkix/x509_common.h"
38 
39 //C++ guard
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 //IKEv2 related functions
45 error_t ikeGenerateSignature(IkeSaEntry *sa, const uint8_t *id, size_t idLen,
46  uint8_t *authMethod, uint8_t *signature, size_t *signatureLen);
47 
48 error_t ikeGenerateDigitalSignature(IkeSaEntry *sa, const uint8_t *id,
49  size_t idLen, IkeAuthData *authData, size_t *authDataLen);
50 
51 error_t ikeGenerateRsaSignature(IkeSaEntry *sa, const uint8_t *id,
52  size_t idLen, const HashAlgo *hashAlgo, uint8_t *signature,
53  size_t *signatureLen);
54 
55 error_t ikeGenerateRsaPssSignature(IkeSaEntry *sa, const uint8_t *id,
56  size_t idLen, const HashAlgo *hashAlgo, size_t saltLen, uint8_t *signature,
57  size_t *signatureLen);
58 
59 error_t ikeGenerateDsaSignature(IkeSaEntry *sa, const uint8_t *id,
60  size_t idLen, const HashAlgo *hashAlgo, uint8_t *signature,
61  size_t *signatureLen, IkeSignFormat format);
62 
63 error_t ikeGenerateEcdsaSignature(IkeSaEntry *sa, const uint8_t *id,
64  size_t idLen, const EcCurveInfo *curveInfo, const HashAlgo *hashAlgo,
65  uint8_t *signature, size_t *signatureLen, IkeSignFormat format);
66 
67 error_t ikeGenerateEd25519Signature(IkeSaEntry *sa, const uint8_t *id,
68  size_t idLen, uint8_t *signature, size_t *signatureLen);
69 
70 error_t ikeGenerateEd448Signature(IkeSaEntry *sa, const uint8_t *id,
71  size_t idLen, uint8_t *signature, size_t *signatureLen);
72 
73 //C++ guard
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
X.509 common definitions.
IkeAuthData
Definition: ike.h:1414
Elliptic curve parameters.
Definition: ec_curves.h:302
Helper functions for signature generation and verification.
error_t
Error codes.
Definition: error.h:43
error_t ikeGenerateSignature(IkeSaEntry *sa, const uint8_t *id, size_t idLen, uint8_t *authMethod, uint8_t *signature, size_t *signatureLen)
Signature generation.
error_t ikeGenerateRsaSignature(IkeSaEntry *sa, const uint8_t *id, size_t idLen, const HashAlgo *hashAlgo, uint8_t *signature, size_t *signatureLen)
RSA signature generation.
uint8_t authMethod
Definition: ike.h:1400
error_t ikeGenerateEd25519Signature(IkeSaEntry *sa, const uint8_t *id, size_t idLen, uint8_t *signature, size_t *signatureLen)
Ed25519 signature generation.
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.
error_t ikeGenerateDigitalSignature(IkeSaEntry *sa, const uint8_t *id, size_t idLen, IkeAuthData *authData, size_t *authDataLen)
Digital signature generation.
IKEv2 (Internet Key Exchange Protocol)
IkeSignFormat
Signature format.
Definition: ike_sign_misc.h:48
#define IkeSaEntry
Definition: ike.h:682
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.
uint8_t authData[]
Definition: ipv6.h:353
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.
Common interface for hash algorithms.
Definition: crypto.h:1046
error_t ikeGenerateEd448Signature(IkeSaEntry *sa, const uint8_t *id, size_t idLen, uint8_t *signature, size_t *signatureLen)
Ed448 signature generation.