OpenVPN
tests
unit_tests
openvpn
mock_get_random.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) 2017-2021 Fox Crypto B.V. <openvpn@foxcrypto.com>
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
#include <stdarg.h>
24
#include <stddef.h>
25
#include <stdio.h>
26
#include <stdlib.h>
27
#include <setjmp.h>
28
#include <stdint.h>
29
#include <cmocka.h>
30
31
unsigned
long
32
get_random
(
void
)
33
{
34
/* rand() is not very random, but it's C99 and this is just for testing */
35
return
rand();
36
}
37
38
void
39
prng_bytes
(uint8_t *output,
int
len)
40
{
41
for
(
int
i
= 0;
i
< len;
i
++)
42
{
43
output[
i
] = (uint8_t)rand();
44
}
45
}
prng_bytes
void prng_bytes(uint8_t *output, int len)
Definition
mock_get_random.c:39
get_random
unsigned long get_random(void)
Definition
mock_get_random.c:32
i
int i
Definition
test_push_update_msg.c:120
Generated by
1.9.8