Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509/x509_meth.c |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /* | - | ||||||
2 | * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. | - | ||||||
3 | * | - | ||||||
4 | * Licensed under the OpenSSL license (the "License"). You may not use | - | ||||||
5 | * this file except in compliance with the License. You can obtain a copy | - | ||||||
6 | * in the file LICENSE in the source distribution or at | - | ||||||
7 | * https://www.openssl.org/source/license.html | - | ||||||
8 | */ | - | ||||||
9 | - | |||||||
10 | #include <stdio.h> | - | ||||||
11 | #include <time.h> | - | ||||||
12 | #include <errno.h> | - | ||||||
13 | - | |||||||
14 | #include "internal/cryptlib.h" | - | ||||||
15 | #include <openssl/asn1.h> | - | ||||||
16 | #include <openssl/x509.h> | - | ||||||
17 | #include <openssl/ossl_typ.h> | - | ||||||
18 | #include "x509_lcl.h" | - | ||||||
19 | - | |||||||
20 | X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name) | - | ||||||
21 | { | - | ||||||
22 | X509_LOOKUP_METHOD *method = OPENSSL_zalloc(sizeof(X509_LOOKUP_METHOD)); | - | ||||||
23 | - | |||||||
24 | if (method != NULL) {
| 0 | ||||||
25 | method->name = OPENSSL_strdup(name); | - | ||||||
26 | if (method->name == NULL) {
| 0 | ||||||
27 | X509err(X509_F_X509_LOOKUP_METH_NEW, ERR_R_MALLOC_FAILURE); | - | ||||||
28 | goto err; never executed: goto err; | 0 | ||||||
29 | } | - | ||||||
30 | } never executed: end of block | 0 | ||||||
31 | - | |||||||
32 | return method; never executed: return method; | 0 | ||||||
33 | - | |||||||
34 | err: | - | ||||||
35 | OPENSSL_free(method); | - | ||||||
36 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||
37 | } | - | ||||||
38 | - | |||||||
39 | void X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method) | - | ||||||
40 | { | - | ||||||
41 | if (method != NULL)
| 0 | ||||||
42 | OPENSSL_free(method->name); never executed: CRYPTO_free(method->name, __FILE__, 42); | 0 | ||||||
43 | OPENSSL_free(method); | - | ||||||
44 | } never executed: end of block | 0 | ||||||
45 | - | |||||||
46 | int X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method, | - | ||||||
47 | int (*new_item) (X509_LOOKUP *ctx)) | - | ||||||
48 | { | - | ||||||
49 | method->new_item = new_item; | - | ||||||
50 | return 1; never executed: return 1; | 0 | ||||||
51 | } | - | ||||||
52 | - | |||||||
53 | int (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method)) | - | ||||||
54 | (X509_LOOKUP *ctx) | - | ||||||
55 | { | - | ||||||
56 | return method->new_item; never executed: return method->new_item; | 0 | ||||||
57 | } | - | ||||||
58 | - | |||||||
59 | int X509_LOOKUP_meth_set_free( | - | ||||||
60 | X509_LOOKUP_METHOD *method, | - | ||||||
61 | void (*free_fn) (X509_LOOKUP *ctx)) | - | ||||||
62 | { | - | ||||||
63 | method->free = free_fn; | - | ||||||
64 | return 1; never executed: return 1; | 0 | ||||||
65 | } | - | ||||||
66 | - | |||||||
67 | void (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method)) | - | ||||||
68 | (X509_LOOKUP *ctx) | - | ||||||
69 | { | - | ||||||
70 | return method->free; never executed: return method->free; | 0 | ||||||
71 | } | - | ||||||
72 | - | |||||||
73 | int X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method, | - | ||||||
74 | int (*init) (X509_LOOKUP *ctx)) | - | ||||||
75 | { | - | ||||||
76 | method->init = init; | - | ||||||
77 | return 1; never executed: return 1; | 0 | ||||||
78 | } | - | ||||||
79 | - | |||||||
80 | int (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method)) | - | ||||||
81 | (X509_LOOKUP *ctx) | - | ||||||
82 | { | - | ||||||
83 | return method->init; never executed: return method->init; | 0 | ||||||
84 | } | - | ||||||
85 | - | |||||||
86 | int X509_LOOKUP_meth_set_shutdown( | - | ||||||
87 | X509_LOOKUP_METHOD *method, | - | ||||||
88 | int (*shutdown) (X509_LOOKUP *ctx)) | - | ||||||
89 | { | - | ||||||
90 | method->shutdown = shutdown; | - | ||||||
91 | return 1; never executed: return 1; | 0 | ||||||
92 | } | - | ||||||
93 | - | |||||||
94 | int (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method)) | - | ||||||
95 | (X509_LOOKUP *ctx) | - | ||||||
96 | { | - | ||||||
97 | return method->shutdown; never executed: return method->shutdown; | 0 | ||||||
98 | } | - | ||||||
99 | - | |||||||
100 | int X509_LOOKUP_meth_set_ctrl( | - | ||||||
101 | X509_LOOKUP_METHOD *method, | - | ||||||
102 | X509_LOOKUP_ctrl_fn ctrl) | - | ||||||
103 | { | - | ||||||
104 | method->ctrl = ctrl; | - | ||||||
105 | return 1; never executed: return 1; | 0 | ||||||
106 | } | - | ||||||
107 | - | |||||||
108 | X509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method) | - | ||||||
109 | { | - | ||||||
110 | return method->ctrl; never executed: return method->ctrl; | 0 | ||||||
111 | } | - | ||||||
112 | - | |||||||
113 | int X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method, | - | ||||||
114 | X509_LOOKUP_get_by_subject_fn get_by_subject) | - | ||||||
115 | { | - | ||||||
116 | method->get_by_subject = get_by_subject; | - | ||||||
117 | return 1; never executed: return 1; | 0 | ||||||
118 | } | - | ||||||
119 | - | |||||||
120 | X509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject( | - | ||||||
121 | const X509_LOOKUP_METHOD *method) | - | ||||||
122 | { | - | ||||||
123 | return method->get_by_subject; never executed: return method->get_by_subject; | 0 | ||||||
124 | } | - | ||||||
125 | - | |||||||
126 | - | |||||||
127 | int X509_LOOKUP_meth_set_get_by_issuer_serial(X509_LOOKUP_METHOD *method, | - | ||||||
128 | X509_LOOKUP_get_by_issuer_serial_fn get_by_issuer_serial) | - | ||||||
129 | { | - | ||||||
130 | method->get_by_issuer_serial = get_by_issuer_serial; | - | ||||||
131 | return 1; never executed: return 1; | 0 | ||||||
132 | } | - | ||||||
133 | - | |||||||
134 | X509_LOOKUP_get_by_issuer_serial_fn | - | ||||||
135 | X509_LOOKUP_meth_get_get_by_issuer_serial(const X509_LOOKUP_METHOD *method) | - | ||||||
136 | { | - | ||||||
137 | return method->get_by_issuer_serial; never executed: return method->get_by_issuer_serial; | 0 | ||||||
138 | } | - | ||||||
139 | - | |||||||
140 | - | |||||||
141 | int X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method, | - | ||||||
142 | X509_LOOKUP_get_by_fingerprint_fn get_by_fingerprint) | - | ||||||
143 | { | - | ||||||
144 | method->get_by_fingerprint = get_by_fingerprint; | - | ||||||
145 | return 1; never executed: return 1; | 0 | ||||||
146 | } | - | ||||||
147 | - | |||||||
148 | X509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint( | - | ||||||
149 | const X509_LOOKUP_METHOD *method) | - | ||||||
150 | { | - | ||||||
151 | return method->get_by_fingerprint; never executed: return method->get_by_fingerprint; | 0 | ||||||
152 | } | - | ||||||
153 | - | |||||||
154 | int X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method, | - | ||||||
155 | X509_LOOKUP_get_by_alias_fn get_by_alias) | - | ||||||
156 | { | - | ||||||
157 | method->get_by_alias = get_by_alias; | - | ||||||
158 | return 1; never executed: return 1; | 0 | ||||||
159 | } | - | ||||||
160 | - | |||||||
161 | X509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias( | - | ||||||
162 | const X509_LOOKUP_METHOD *method) | - | ||||||
163 | { | - | ||||||
164 | return method->get_by_alias; never executed: return method->get_by_alias; | 0 | ||||||
165 | } | - | ||||||
166 | - | |||||||
Source code | Switch to Preprocessed file |