Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/rand/rand_lib.c |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /* $OpenBSD: rand_lib.c,v 1.20 2014/10/22 13:02:04 jsing Exp $ */ | - | ||||||
2 | /* | - | ||||||
3 | * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | - | ||||||
4 | * | - | ||||||
5 | * Permission to use, copy, modify, and distribute this software for any | - | ||||||
6 | * purpose with or without fee is hereby granted, provided that the above | - | ||||||
7 | * copyright notice and this permission notice appear in all copies. | - | ||||||
8 | * | - | ||||||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | - | ||||||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | - | ||||||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | - | ||||||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | - | ||||||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | - | ||||||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | - | ||||||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | - | ||||||
16 | */ | - | ||||||
17 | - | |||||||
18 | #include <stdlib.h> | - | ||||||
19 | - | |||||||
20 | #include <openssl/opensslconf.h> | - | ||||||
21 | - | |||||||
22 | #include <openssl/rand.h> | - | ||||||
23 | - | |||||||
24 | /* | - | ||||||
25 | * The useful functions in this file are at the bottom. | - | ||||||
26 | */ | - | ||||||
27 | int | - | ||||||
28 | RAND_set_rand_method(const RAND_METHOD *meth) | - | ||||||
29 | { | - | ||||||
30 | return 1; executed 54 times by 5 tests: return 1; Executed by:
| 54 | ||||||
31 | } | - | ||||||
32 | - | |||||||
33 | const RAND_METHOD * | - | ||||||
34 | RAND_get_rand_method(void) | - | ||||||
35 | { | - | ||||||
36 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||
37 | } | - | ||||||
38 | - | |||||||
39 | RAND_METHOD * | - | ||||||
40 | RAND_SSLeay(void) | - | ||||||
41 | { | - | ||||||
42 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||
43 | } | - | ||||||
44 | - | |||||||
45 | #ifndef OPENSSL_NO_ENGINE | - | ||||||
46 | int | - | ||||||
47 | RAND_set_rand_engine(ENGINE *engine) | - | ||||||
48 | { | - | ||||||
49 | return 1; never executed: return 1; | 0 | ||||||
50 | } | - | ||||||
51 | #endif | - | ||||||
52 | - | |||||||
53 | void | - | ||||||
54 | RAND_cleanup(void) | - | ||||||
55 | { | - | ||||||
56 | - | |||||||
57 | } | - | ||||||
58 | - | |||||||
59 | void | - | ||||||
60 | RAND_seed(const void *buf, int num) | - | ||||||
61 | { | - | ||||||
62 | - | |||||||
63 | } | - | ||||||
64 | - | |||||||
65 | void | - | ||||||
66 | RAND_add(const void *buf, int num, double entropy) | - | ||||||
67 | { | - | ||||||
68 | - | |||||||
69 | } | - | ||||||
70 | - | |||||||
71 | int | - | ||||||
72 | RAND_status(void) | - | ||||||
73 | { | - | ||||||
74 | return 1; never executed: return 1; | 0 | ||||||
75 | } | - | ||||||
76 | - | |||||||
77 | int | - | ||||||
78 | RAND_poll(void) | - | ||||||
79 | { | - | ||||||
80 | return 1; never executed: return 1; | 0 | ||||||
81 | } | - | ||||||
82 | - | |||||||
83 | /* | - | ||||||
84 | * Hurray. You've made it to the good parts. | - | ||||||
85 | */ | - | ||||||
86 | int | - | ||||||
87 | RAND_bytes(unsigned char *buf, int num) | - | ||||||
88 | { | - | ||||||
89 | if (num > 0)
| 0 | ||||||
90 | arc4random_buf(buf, num); never executed: arc4random_buf(buf, num); | 0 | ||||||
91 | return 1; never executed: return 1; | 0 | ||||||
92 | } | - | ||||||
93 | - | |||||||
94 | int | - | ||||||
95 | RAND_pseudo_bytes(unsigned char *buf, int num) | - | ||||||
96 | { | - | ||||||
97 | if (num > 0)
| 0-1 | ||||||
98 | arc4random_buf(buf, num); executed 1 time by 1 test: arc4random_buf(buf, num); Executed by:
| 1 | ||||||
99 | return 1; executed 1 time by 1 test: return 1; Executed by:
| 1 | ||||||
100 | } | - | ||||||
Source code | Switch to Preprocessed file |