OpenVPN
dco_internal.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) 2022-2025 Antonio Quartulli <a@unstable.cc>
9 * Copyright (C) 2022-2025 OpenVPN Inc <sales@openvpn.net>
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
21 * along with this program (see the file COPYING included with this
22 * distribution); if not, see <https://www.gnu.org/licenses/>.
23 */
24#ifndef DCO_INTERNAL_H
25#define DCO_INTERNAL_H
26
27#if defined(ENABLE_DCO)
28
29#include "dco_freebsd.h"
30#include "dco_linux.h"
31#include "dco_win.h"
32
39static inline dco_cipher_t
40dco_get_cipher(const char *cipher)
41{
42 if (strcmp(cipher, "AES-256-GCM") == 0 || strcmp(cipher, "AES-128-GCM") == 0
43 || strcmp(cipher, "AES-192-GCM") == 0)
44 {
46 }
47 else if (strcmp(cipher, "CHACHA20-POLY1305") == 0)
48 {
50 }
51 else
52 {
53 msg(M_FATAL, "DCO: provided unsupported cipher: %s", cipher);
54 }
55}
56
62int dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd, struct sockaddr *localaddr,
63 struct sockaddr *remoteaddr, struct in_addr *vpn_ipv4, struct in6_addr *vpn_ipv6);
64
65int dco_del_peer(dco_context_t *dco, unsigned int peerid);
66
67int dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid, dco_key_slot_t slot,
68 const uint8_t *encrypt_key, const uint8_t *encrypt_iv, const uint8_t *decrypt_key,
69 const uint8_t *decrypt_iv, const char *ciphername);
70
71int dco_del_key(dco_context_t *dco, unsigned int peerid, dco_key_slot_t slot);
72
73int dco_swap_keys(dco_context_t *dco, unsigned int peerid);
74
75#endif /* defined(ENABLE_DCO) */
76#endif /* ifndef DCO_INTERNAL_H */
void * dco_context_t
Definition dco.h:261
int dco_del_key(dco_context_t *dco, unsigned int peerid, dco_key_slot_t slot)
Definition dco_win.c:568
int dco_del_peer(dco_context_t *dco, unsigned int peerid)
Definition dco_win.c:469
int dco_swap_keys(dco_context_t *dco, unsigned int peer_id)
Definition dco_win.c:576
int dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd, struct sockaddr *localaddr, struct sockaddr *remoteaddr, struct in_addr *vpn_ipv4, struct in6_addr *vpn_ipv6)
Definition dco_win.c:418
int dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid, dco_key_slot_t slot, const uint8_t *encrypt_key, const uint8_t *encrypt_iv, const uint8_t *decrypt_key, const uint8_t *decrypt_iv, const char *ciphername)
Definition dco_win.c:529
#define M_FATAL
Definition error.h:88
#define msg(flags,...)
Definition error.h:150
@ OVPN_CIPHER_ALG_CHACHA20_POLY1305
@ OVPN_CIPHER_ALG_AES_GCM