Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/bio/bio_meth.c |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /* $OpenBSD: bio_meth.c,v 1.6 2018/06/02 04:41:12 tb Exp $ */ | - | ||||||
2 | /* | - | ||||||
3 | * Copyright (c) 2018 Theo Buehler <tb@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/bio.h> | - | ||||||
21 | - | |||||||
22 | BIO_METHOD * | - | ||||||
23 | BIO_meth_new(int type, const char *name) | - | ||||||
24 | { | - | ||||||
25 | BIO_METHOD *biom; | - | ||||||
26 | - | |||||||
27 | if ((biom = calloc(1, sizeof(*biom))) == NULL)
| 0 | ||||||
28 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||
29 | - | |||||||
30 | biom->type = type; | - | ||||||
31 | biom->name = name; | - | ||||||
32 | - | |||||||
33 | return biom; never executed: return biom; | 0 | ||||||
34 | } | - | ||||||
35 | - | |||||||
36 | void | - | ||||||
37 | BIO_meth_free(BIO_METHOD *biom) | - | ||||||
38 | { | - | ||||||
39 | free(biom); | - | ||||||
40 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||
41 | - | |||||||
42 | int | - | ||||||
43 | (*BIO_meth_get_write(const BIO_METHOD *biom))(BIO *, const char *, int) | - | ||||||
44 | { | - | ||||||
45 | return biom->bwrite; never executed: return biom->bwrite; | 0 | ||||||
46 | } | - | ||||||
47 | - | |||||||
48 | int | - | ||||||
49 | BIO_meth_set_write(BIO_METHOD *biom, int (*write)(BIO *, const char *, int)) | - | ||||||
50 | { | - | ||||||
51 | biom->bwrite = write; | - | ||||||
52 | return 1; never executed: return 1; | 0 | ||||||
53 | } | - | ||||||
54 | - | |||||||
55 | int | - | ||||||
56 | (*BIO_meth_get_read(const BIO_METHOD *biom))(BIO *, char *, int) | - | ||||||
57 | { | - | ||||||
58 | return biom->bread; never executed: return biom->bread; | 0 | ||||||
59 | } | - | ||||||
60 | - | |||||||
61 | int | - | ||||||
62 | BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int)) | - | ||||||
63 | { | - | ||||||
64 | biom->bread = read; | - | ||||||
65 | return 1; never executed: return 1; | 0 | ||||||
66 | } | - | ||||||
67 | - | |||||||
68 | int | - | ||||||
69 | (*BIO_meth_get_puts(const BIO_METHOD *biom))(BIO *, const char *) | - | ||||||
70 | { | - | ||||||
71 | return biom->bputs; never executed: return biom->bputs; | 0 | ||||||
72 | } | - | ||||||
73 | - | |||||||
74 | int | - | ||||||
75 | BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *)) | - | ||||||
76 | { | - | ||||||
77 | biom->bputs = puts; | - | ||||||
78 | return 1; never executed: return 1; | 0 | ||||||
79 | } | - | ||||||
80 | - | |||||||
81 | int | - | ||||||
82 | (*BIO_meth_get_gets(const BIO_METHOD *biom))(BIO *, char *, int) | - | ||||||
83 | { | - | ||||||
84 | return biom->bgets; never executed: return biom->bgets; | 0 | ||||||
85 | } | - | ||||||
86 | - | |||||||
87 | int | - | ||||||
88 | BIO_meth_set_gets(BIO_METHOD *biom, int (*gets)(BIO *, char *, int)) | - | ||||||
89 | { | - | ||||||
90 | biom->bgets = gets; | - | ||||||
91 | return 1; never executed: return 1; | 0 | ||||||
92 | } | - | ||||||
93 | - | |||||||
94 | long | - | ||||||
95 | (*BIO_meth_get_ctrl(const BIO_METHOD *biom))(BIO *, int, long, void *) | - | ||||||
96 | { | - | ||||||
97 | return biom->ctrl; never executed: return biom->ctrl; | 0 | ||||||
98 | } | - | ||||||
99 | - | |||||||
100 | int | - | ||||||
101 | BIO_meth_set_ctrl(BIO_METHOD *biom, long (*ctrl)(BIO *, int, long, void *)) | - | ||||||
102 | { | - | ||||||
103 | biom->ctrl = ctrl; | - | ||||||
104 | return 1; never executed: return 1; | 0 | ||||||
105 | } | - | ||||||
106 | - | |||||||
107 | int | - | ||||||
108 | (*BIO_meth_get_create(const BIO_METHOD *biom))(BIO *) | - | ||||||
109 | { | - | ||||||
110 | return biom->create; never executed: return biom->create; | 0 | ||||||
111 | } | - | ||||||
112 | - | |||||||
113 | int | - | ||||||
114 | BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *)) | - | ||||||
115 | { | - | ||||||
116 | biom->create = create; | - | ||||||
117 | return 1; never executed: return 1; | 0 | ||||||
118 | } | - | ||||||
119 | - | |||||||
120 | int | - | ||||||
121 | (*BIO_meth_get_destroy(const BIO_METHOD *biom))(BIO *) | - | ||||||
122 | { | - | ||||||
123 | return biom->destroy; never executed: return biom->destroy; | 0 | ||||||
124 | } | - | ||||||
125 | - | |||||||
126 | int | - | ||||||
127 | BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *)) | - | ||||||
128 | { | - | ||||||
129 | biom->destroy = destroy; | - | ||||||
130 | return 1; never executed: return 1; | 0 | ||||||
131 | } | - | ||||||
132 | - | |||||||
133 | long | - | ||||||
134 | (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom))(BIO *, int, BIO_info_cb *) | - | ||||||
135 | { | - | ||||||
136 | return never executed: return (long (*)(BIO *, int, BIO_info_cb *))biom->callback_ctrl; | 0 | ||||||
137 | (long (*)(BIO *, int, BIO_info_cb *))biom->callback_ctrl; /* XXX */ never executed: return (long (*)(BIO *, int, BIO_info_cb *))biom->callback_ctrl; | 0 | ||||||
138 | } | - | ||||||
139 | - | |||||||
140 | int | - | ||||||
141 | BIO_meth_set_callback_ctrl(BIO_METHOD *biom, | - | ||||||
142 | long (*callback_ctrl)(BIO *, int, BIO_info_cb *)) | - | ||||||
143 | { | - | ||||||
144 | biom->callback_ctrl = | - | ||||||
145 | (long (*)(BIO *, int, bio_info_cb *))callback_ctrl; /* XXX */ | - | ||||||
146 | return 1; never executed: return 1; | 0 | ||||||
147 | } | - | ||||||
Source code | Switch to Preprocessed file |