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-2024 Antonio Quartulli <a@unstable.cc>
9 * Copyright (C) 2022-2024 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, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#ifndef DCO_INTERNAL_H
26#define DCO_INTERNAL_H
27
28#if defined(ENABLE_DCO)
29
30#include "dco_freebsd.h"
31#include "dco_linux.h"
32#include "dco_win.h"
33
40static inline dco_cipher_t
41dco_get_cipher(const char *cipher)
42{
43 if (strcmp(cipher, "AES-256-GCM") == 0 || strcmp(cipher, "AES-128-GCM") == 0
44 || strcmp(cipher, "AES-192-GCM") == 0)
45 {
47 }
48 else if (strcmp(cipher, "CHACHA20-POLY1305") == 0)
49 {
51 }
52 else
53 {
54 msg(M_FATAL, "DCO: provided unsupported cipher: %s", cipher);
55 }
56}
57
63int dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd,
64 struct sockaddr *localaddr, struct sockaddr *remoteaddr,
65 struct in_addr *vpn_ipv4, struct in6_addr *vpn_ipv6);
66
67int dco_del_peer(dco_context_t *dco, unsigned int peerid);
68
69int dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid,
70 dco_key_slot_t slot,
71 const uint8_t *encrypt_key, const uint8_t *encrypt_iv,
72 const uint8_t *decrypt_key, const uint8_t *decrypt_iv,
73 const char *ciphername);
74
75int dco_del_key(dco_context_t *dco, unsigned int peerid, dco_key_slot_t slot);
76
77int dco_swap_keys(dco_context_t *dco, unsigned int peerid);
78
79#endif /* defined(ENABLE_DCO) */
80#endif /* ifndef DCO_INTERNAL_H */
void * dco_context_t
Definition dco.h:267
int dco_del_key(dco_context_t *dco, unsigned int peerid, dco_key_slot_t slot)
Definition dco_win.c:566
int dco_del_peer(dco_context_t *dco, unsigned int peerid)
Definition dco_win.c:465
int dco_swap_keys(dco_context_t *dco, unsigned int peer_id)
Definition dco_win.c:575
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:414
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:525
#define M_FATAL
Definition error.h:89
#define msg(flags,...)
Definition error.h:144
@ OVPN_CIPHER_ALG_CHACHA20_POLY1305
@ OVPN_CIPHER_ALG_AES_GCM