OpenVPN
ssl_ncp.h
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
7 *
8 * Copyright (C) 2002-2025 OpenVPN Inc <sales@openvpn.net>
9 * Copyright (C) 2010-2021 Fox Crypto B.V. <openvpn@foxcrypto.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, see <https://www.gnu.org/licenses/>.
22 */
23
30#ifndef OPENVPN_SSL_NCP_H
31#define OPENVPN_SSL_NCP_H
32
33#include "buffer.h"
34#include "options.h"
35#include "ssl_common.h"
36
41bool tls_peer_supports_ncp(const char *peer_info);
42
43/* forward declaration to break include dependency loop */
44struct context;
45
52bool check_pull_client_ncp(struct context *c, unsigned int found);
53
74char *ncp_get_best_cipher(const char *server_list, const char *peer_info, const char *remote_cipher,
75 struct gc_arena *gc);
76
77
86const char *tls_peer_ncp_list(const char *peer_info, struct gc_arena *gc);
87
101char *mutate_ncp_cipher_list(const char *list, struct gc_arena *gc);
102
109void append_cipher_to_ncp_list(struct options *o, const char *ciphername);
110
115bool tls_item_in_cipher_list(const char *item, const char *list);
116
123#define MAX_NCP_CIPHERS_LENGTH 127
124
131void p2p_mode_ncp(struct tls_multi *multi, struct tls_session *session);
132
145const char *get_p2p_ncp_cipher(struct tls_session *session, const char *peer_info,
146 struct gc_arena *gc);
147
148
154
164
171const char *ncp_expanded_ciphers(struct options *o, struct gc_arena *gc);
172#endif /* ifndef OPENVPN_SSL_NCP_H */
Control Channel Common Data Structures.
char * ncp_get_best_cipher(const char *server_list, const char *peer_info, const char *remote_cipher, struct gc_arena *gc)
Iterates through the ciphers in server_list and return the first cipher that is also supported by the...
Definition ssl_ncp.c:246
const char * tls_peer_ncp_list(const char *peer_info, struct gc_arena *gc)
Returns the support cipher list from the peer according to the IV_NCP and IV_CIPHER values in peer_in...
Definition ssl_ncp.c:225
void options_postprocess_setdefault_ncpciphers(struct options *o)
Checks for availability of Chacha20-Poly1305 and sets the ncp_cipher to either AES-256-GCM:AES-128-GC...
Definition ssl_ncp.c:575
const char * ncp_expanded_ciphers(struct options *o, struct gc_arena *gc)
returns the o->ncp_ciphers in brackets, e.g.
Definition ssl_ncp.c:618
bool check_session_cipher(struct tls_session *session, struct options *options)
Checks if the cipher is allowed, otherwise returns false and reset the cipher to the config cipher.
Definition ssl_ncp.c:515
void p2p_mode_ncp(struct tls_multi *multi, struct tls_session *session)
Determines if there is common cipher of both peer by looking at the IV_CIPHER peer info.
Definition ssl_ncp.c:472
bool tls_item_in_cipher_list(const char *item, const char *list)
Return true iff item is present in the colon-separated zero-terminated cipher list.
Definition ssl_ncp.c:206
void append_cipher_to_ncp_list(struct options *o, const char *ciphername)
Appends the cipher specified by the ciphernamer parameter to to the o->ncp_ciphers list.
Definition ssl_ncp.c:195
bool tls_peer_supports_ncp(const char *peer_info)
Returns whether the client supports NCP either by announcing IV_NCP>=2 or the IV_CIPHERS list.
Definition ssl_ncp.c:79
bool check_pull_client_ncp(struct context *c, unsigned int found)
Checks whether the cipher negotiation is in an acceptable state and we continue to connect or should ...
Definition ssl_ncp.c:310
char * mutate_ncp_cipher_list(const char *list, struct gc_arena *gc)
Check whether the ciphers in the supplied list are supported.
Definition ssl_ncp.c:96
const char * get_p2p_ncp_cipher(struct tls_session *session, const char *peer_info, struct gc_arena *gc)
Determines the best common cipher from both peers IV_CIPHER lists.
Definition ssl_ncp.c:355
Contains all state information for one tunnel.
Definition openvpn.h:474
struct multi_context * multi
Pointer to the main P2MP context.
Definition openvpn.h:492
Garbage collection arena used to keep track of dynamically allocated memory.
Definition buffer.h:116
Security parameter state for a single VPN tunnel.
Definition ssl_common.h:612
Security parameter state of a single session within a VPN tunnel.
Definition ssl_common.h:490
struct gc_arena gc
Definition test_ssl.c:154