]> git.ipfire.org Git - thirdparty/strongswan.git/blame - src/libstrongswan/plugins/wolfssl/wolfssl_common.h
wolfssl: Avoid conflict with RNG when built without EdDSA or FIPS enabled
[thirdparty/strongswan.git] / src / libstrongswan / plugins / wolfssl / wolfssl_common.h
CommitLineData
c92eade8 1/*
142b5e79 2 * Copyright (C) 2020 Tobias Brunner
142b5e79 3 *
c92eade8
SP
4 * Copyright (C) 2019 Sean Parkinson, wolfSSL Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
1a256ca6
DG
25#ifndef WOLFSSL_PLUGIN_COMMON_H_
26#define WOLFSSL_PLUGIN_COMMON_H_
c92eade8
SP
27
28#include <library.h>
29
30/* Undefine these as they are enum entries in wolfSSL - same values */
31#ifdef AES_BLOCK_SIZE
32#undef AES_BLOCK_SIZE
33#endif
34
35#ifdef CAMELLIA_BLOCK_SIZE
36#undef CAMELLIA_BLOCK_SIZE
37#endif
38
39#ifdef DES_BLOCK_SIZE
40#undef DES_BLOCK_SIZE
41#endif
42
846dde91
TB
43#ifdef RSA_PSS_SALT_LEN_DEFAULT
44#undef RSA_PSS_SALT_LEN_DEFAULT
45#endif
46
c92eade8 47/* PARSE_ERROR is an enum entry in wolfSSL - not used in this plugin */
1a256ca6
DG
48#define PARSE_ERROR WOLFSSL_PARSE_ERROR
49
c92eade8
SP
50#ifndef WOLFSSL_USER_SETTINGS
51 #include <wolfssl/options.h>
52#endif
af71f14b
TW
53
54/* Disable inclusion of the wolfSSL OpenSSL compatibility layer header (if
55 * configured) as it is not used by the plugin and causes conflicts */
56#define WOLFSSL_OPENSSL_H_
57
58#if defined(HAVE_FIPS) && \
59 (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
60 #include <wolfssl/wolfcrypt/fips_test.h>
61#endif
c92eade8 62
142b5e79
TB
63/* Special type used to handle EdDSA keys depending on config options */
64#if defined(HAVE_ED25519) || defined(HAVE_ED448)
65#ifdef HAVE_ED25519
66#include <wolfssl/wolfcrypt/ed25519.h>
67#endif
68#ifdef HAVE_ED448
69#include <wolfssl/wolfcrypt/ed448.h>
70#endif
71typedef union {
72#ifdef HAVE_ED25519
73 ed25519_key ed25519;
74#endif
75#ifdef HAVE_ED448
76 ed448_key ed448;
77#endif
78} wolfssl_ed_key;
79#endif /* HAVE_ED25519 || HAVE_ED448 */
80
c92eade8
SP
81#undef PARSE_ERROR
82
1a256ca6 83#endif /* WOLFSSL_PLUGIN_COMMON_H_ */