OpenVPN
mock_ssl_dependencies.c
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single 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 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23/* Minimal set of mocked function/globals to get unit tests to
24 * compile that use the ssl_* files */
25
26#ifdef HAVE_CONFIG_H
27#include "config.h"
28#endif
29
30#include "syshead.h"
31
32#include <setjmp.h>
33#include <cmocka.h>
34
35
36#include "ssl.h"
37#include "ssl_verify.h"
38
39int
40parse_line(const char *line, char **p, const int n, const char *file, const int line_num,
41 int msglevel, struct gc_arena *gc)
42{
43 /* Dummy function to get the linker happy, should never be called */
44 assert_true(false);
45 return 0;
46}
47
48
49int
50pem_password_callback(char *buf, int size, int rwflag, void *u)
51{
52 return 0;
53}
54
55void
56cert_hash_remember(struct tls_session *session, const int cert_depth,
57 const struct buffer *cert_hash)
58{
59 assert_false(true);
60}
61
63verify_cert(struct tls_session *session, openvpn_x509_cert_t *cert, int cert_depth)
64{
65 return FAILURE;
66}
void cert_hash_remember(struct tls_session *session, const int cert_depth, const struct buffer *cert_hash)
int pem_password_callback(char *buf, int size, int rwflag, void *u)
Callback to retrieve the user's password.
result_t verify_cert(struct tls_session *session, openvpn_x509_cert_t *cert, int cert_depth)
int parse_line(const char *line, char **p, const int n, const char *file, const int line_num, int msglevel, struct gc_arena *gc)
Control Channel SSL/Data channel negotiation module.
Control Channel Verification Module.
result_t
Result of verification function.
@ FAILURE
mbedtls_x509_crt openvpn_x509_cert_t
Wrapper structure for dynamically allocated memory.
Definition buffer.h:60
Structure containing the hash for a single certificate.
Definition ssl_verify.h:58
Garbage collection arena used to keep track of dynamically allocated memory.
Definition buffer.h:116
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