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-2024 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, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23
24/* Minimal set of mocked function/globals to get unit tests to
25 * compile that use the ssl_* files */
26
27#ifdef HAVE_CONFIG_H
28#include "config.h"
29#endif
30
31#include "syshead.h"
32
33#include <setjmp.h>
34#include <cmocka.h>
35
36
37#include "ssl.h"
38#include "ssl_verify.h"
39
40int
41parse_line(const char *line, char **p, const int n, const char *file,
42 const int line_num, int msglevel, struct gc_arena *gc)
43{
44 /* Dummy function to get the linker happy, should never be called */
45 assert_true(false);
46 return 0;
47}
48
49
50int
51pem_password_callback(char *buf, int size, int rwflag, void *u)
52{
53 return 0;
54}
55
56void
57cert_hash_remember(struct tls_session *session, const int cert_depth,
58 const struct buffer *cert_hash)
59{
60 assert_false(true);
61}
62
64verify_cert(struct tls_session *session, openvpn_x509_cert_t *cert, int cert_depth)
65{
66 return FAILURE;
67}
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:61
Structure containing the hash for a single certificate.
Definition ssl_verify.h:55
Garbage collection arena used to keep track of dynamically allocated memory.
Definition buffer.h:117
Security parameter state of a single session within a VPN tunnel.
Definition ssl_common.h:480
struct gc_arena gc
Definition test_ssl.c:155