Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/objects/o_names.c |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /* | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 | * Copyright 1998-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 <stdlib.h> | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
12 | #include <string.h> | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
14 | #include <openssl/err.h> | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
15 | #include <openssl/lhash.h> | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
16 | #include <openssl/objects.h> | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
17 | #include <openssl/safestack.h> | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
18 | #include <openssl/e_os2.h> | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
19 | #include "internal/thread_once.h" | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
20 | #include "internal/lhash.h" | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
21 | #include "obj_lcl.h" | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
22 | #include "e_os.h" | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
24 | /* | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
25 | * We define this wrapper for two reasons. Firstly, later versions of | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
26 | * DEC C add linkage information to certain functions, which makes it | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
27 | * tricky to use them as values to regular function pointers. | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
28 | * Secondly, in the EDK2 build environment, the strcasecmp function is | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
29 | * actually an external function with the Microsoft ABI, so we can't | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
30 | * transparently assign function pointers to it. | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
31 | */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
32 | #if defined(OPENSSL_SYS_VMS_DECC) || defined(OPENSSL_SYS_UEFI) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33 | static int obj_strcasecmp(const char *a, const char *b) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
34 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
35 | return strcasecmp(a, b); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
36 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
37 | #else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
38 | #define obj_strcasecmp strcasecmp | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
39 | #endif | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
41 | /* | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
42 | * I use the ex_data stuff to manage the identifiers for the obj_name_types | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
43 | * that applications may define. I only really use the free function field. | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
44 | */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
45 | static LHASH_OF(OBJ_NAME) *names_lh = NULL; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
46 | static int names_type_num = OBJ_NAME_TYPE_NUM; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
47 | static CRYPTO_RWLOCK *obj_lock = NULL; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
49 | struct name_funcs_st { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
50 | unsigned long (*hash_func) (const char *name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
51 | int (*cmp_func) (const char *a, const char *b); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
52 | void (*free_func) (const char *, int, const char *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
53 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
54 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
55 | static STACK_OF(NAME_FUNCS) *name_funcs_stack; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
56 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
57 | /* | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
58 | * The LHASH callbacks now use the raw "void *" prototypes and do | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
59 | * per-variable casting in the functions. This prevents function pointer | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
60 | * casting without the need for macro-generated wrapper functions. | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
61 | */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
63 | static unsigned long obj_name_hash(const OBJ_NAME *a); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
64 | static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
66 | static CRYPTO_ONCE init = CRYPTO_ONCE_STATIC_INIT; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
67 | DEFINE_RUN_ONCE_STATIC(o_names_init) executed 1971 times by 1 test: end of block Executed by:
| 1971 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
68 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
69 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
70 | names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
71 | obj_lock = CRYPTO_THREAD_lock_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
72 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
73 | return names_lh != NULL && obj_lock != NULL; executed 1971 times by 1 test: return names_lh != ((void *)0) && obj_lock != ((void *)0) ; Executed by:
| 0-1971 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
74 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
75 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
76 | int OBJ_NAME_init(void) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
77 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
78 | return RUN_ONCE(&init, o_names_init); executed 1476511 times by 1 test: return (CRYPTO_THREAD_run_once(&init, o_names_init_ossl_) ? o_names_init_ossl_ret_ : 0); Executed by:
| 0-1476511 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
79 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
81 | int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
82 | int (*cmp_func) (const char *, const char *), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
83 | void (*free_func) (const char *, int, const char *)) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
84 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
85 | int ret = 0, i, push; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
86 | NAME_FUNCS *name_funcs; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
88 | if (!OBJ_NAME_init())
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
89 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
91 | CRYPTO_THREAD_write_lock(obj_lock); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
93 | if (name_funcs_stack == NULL) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
94 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
95 | name_funcs_stack = sk_NAME_FUNCS_new_null(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
96 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
97 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
98 | if (name_funcs_stack == NULL) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
99 | /* ERROR */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
100 | goto out; never executed: goto out; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
101 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
102 | ret = names_type_num; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
103 | names_type_num++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
104 | for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
105 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
106 | name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
107 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
108 | if (name_funcs == NULL) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
109 | OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
110 | ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
111 | goto out; never executed: goto out; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
112 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
113 | name_funcs->hash_func = openssl_lh_strcasehash; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
114 | name_funcs->cmp_func = obj_strcasecmp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
115 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
116 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
117 | push = sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
118 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
119 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
120 | if (!push) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
121 | OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
122 | OPENSSL_free(name_funcs); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
123 | ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
124 | goto out; never executed: goto out; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
125 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
126 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
127 | name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
128 | if (hash_func != NULL)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
129 | name_funcs->hash_func = hash_func; never executed: name_funcs->hash_func = hash_func; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
130 | if (cmp_func != NULL)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
131 | name_funcs->cmp_func = cmp_func; never executed: name_funcs->cmp_func = cmp_func; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
132 | if (free_func != NULL)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
133 | name_funcs->free_func = free_func; never executed: name_funcs->free_func = free_func; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
134 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
135 | out: code before this statement never executed: out: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
136 | CRYPTO_THREAD_unlock(obj_lock); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
137 | return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
138 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
139 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
140 | static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
141 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
142 | int ret; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
144 | ret = a->type - b->type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
145 | if (ret == 0) {
| 0-1026618 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
146 | if ((name_funcs_stack != NULL)
| 0-1026618 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
147 | && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
148 | ret = sk_NAME_FUNCS_value(name_funcs_stack, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
149 | a->type)->cmp_func(a->name, b->name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
150 | } else never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
151 | ret = strcasecmp(a->name, b->name); executed 1026618 times by 1 test: ret = strcasecmp(a->name, b->name); Executed by:
| 1026618 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
152 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
153 | return ret; executed 1026618 times by 1 test: return ret; Executed by:
| 1026618 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
154 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
155 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
156 | static unsigned long obj_name_hash(const OBJ_NAME *a) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
157 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
158 | unsigned long ret; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
160 | if ((name_funcs_stack != NULL)
| 0-1492672 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
161 | && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
162 | ret = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
163 | sk_NAME_FUNCS_value(name_funcs_stack, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
164 | a->type)->hash_func(a->name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
165 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
166 | ret = openssl_lh_strcasehash(a->name); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
167 | } executed 1492672 times by 1 test: end of block Executed by:
| 1492672 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
168 | ret ^= a->type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
169 | return ret; executed 1492672 times by 1 test: return ret; Executed by:
| 1492672 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
170 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
171 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
172 | const char *OBJ_NAME_get(const char *name, int type) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
173 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
174 | OBJ_NAME on, *ret; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
175 | int num = 0, alias; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
176 | const char *value = NULL; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
178 | if (name == NULL)
| 0-98483 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
179 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
180 | if (!OBJ_NAME_init())
| 0-98483 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
181 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
182 | CRYPTO_THREAD_read_lock(obj_lock); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
183 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
184 | alias = type & OBJ_NAME_ALIAS; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
185 | type &= ~OBJ_NAME_ALIAS; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
186 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
187 | on.name = name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
188 | on.type = type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
190 | for (;;) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
191 | ret = lh_OBJ_NAME_retrieve(names_lh, &on); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
192 | if (ret == NULL)
| 14381-100263 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
193 | break; executed 14381 times by 1 test: break; Executed by:
| 14381 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
194 | if ((ret->alias) && !alias) {
| 0-84102 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
195 | if (++num > 10)
| 0-16161 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
196 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
197 | on.name = ret->data; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
198 | } else { executed 16161 times by 1 test: end of block Executed by:
| 16161 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
199 | value = ret->data; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
200 | break; executed 84102 times by 1 test: break; Executed by:
| 84102 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
201 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
202 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
204 | CRYPTO_THREAD_unlock(obj_lock); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
205 | return value; executed 98483 times by 1 test: return value; Executed by:
| 98483 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
206 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
207 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
208 | int OBJ_NAME_add(const char *name, int type, const char *data) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
209 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
210 | OBJ_NAME *onp, *ret; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
211 | int alias, ok = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
213 | if (!OBJ_NAME_init())
| 0-926355 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
214 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
215 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
216 | alias = type & OBJ_NAME_ALIAS; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
217 | type &= ~OBJ_NAME_ALIAS; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
218 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
219 | onp = OPENSSL_malloc(sizeof(*onp)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
220 | if (onp == NULL) {
| 0-926355 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
221 | /* ERROR */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
222 | goto unlock; never executed: goto unlock; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
223 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
224 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
225 | onp->name = name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
226 | onp->alias = alias; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
227 | onp->type = type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
228 | onp->data = data; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
229 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
230 | CRYPTO_THREAD_write_lock(obj_lock); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
232 | ret = lh_OBJ_NAME_insert(names_lh, onp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
233 | if (ret != NULL) {
| 451673-474682 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
234 | /* free things */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
235 | if ((name_funcs_stack != NULL)
| 0-474682 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
236 | && (sk_NAME_FUNCS_num(name_funcs_stack) > ret->type)) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
237 | /* | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
238 | * XXX: I'm not sure I understand why the free function should | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
239 | * get three arguments... -- Richard Levitte | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
240 | */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
241 | sk_NAME_FUNCS_value(name_funcs_stack, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
242 | ret->type)->free_func(ret->name, ret->type, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
243 | ret->data); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
244 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
245 | OPENSSL_free(ret); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
246 | } else { executed 474682 times by 1 test: end of block Executed by:
| 474682 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
247 | if (lh_OBJ_NAME_error(names_lh)) {
| 0-451673 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
248 | /* ERROR */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
249 | OPENSSL_free(onp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
250 | goto unlock; never executed: goto unlock; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
251 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
252 | } executed 451673 times by 1 test: end of block Executed by:
| 451673 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
254 | ok = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
256 | unlock: code before this statement executed 926355 times by 1 test: unlock: Executed by:
| 926355 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
257 | CRYPTO_THREAD_unlock(obj_lock); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
258 | return ok; executed 926355 times by 1 test: return ok; Executed by:
| 926355 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
259 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
261 | int OBJ_NAME_remove(const char *name, int type) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
262 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
263 | OBJ_NAME on, *ret; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
264 | int ok = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
266 | if (!OBJ_NAME_init())
| 0-451673 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
267 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
268 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
269 | CRYPTO_THREAD_write_lock(obj_lock); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
270 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
271 | type &= ~OBJ_NAME_ALIAS; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
272 | on.name = name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
273 | on.type = type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
274 | ret = lh_OBJ_NAME_delete(names_lh, &on); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
275 | if (ret != NULL) {
| 0-451673 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
276 | /* free things */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
277 | if ((name_funcs_stack != NULL)
| 0-451673 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
278 | && (sk_NAME_FUNCS_num(name_funcs_stack) > ret->type)) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
279 | /* | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
280 | * XXX: I'm not sure I understand why the free function should | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
281 | * get three arguments... -- Richard Levitte | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
282 | */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
283 | sk_NAME_FUNCS_value(name_funcs_stack, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
284 | ret->type)->free_func(ret->name, ret->type, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
285 | ret->data); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
286 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
287 | OPENSSL_free(ret); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
288 | ok = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
289 | } executed 451673 times by 1 test: end of block Executed by:
| 451673 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
290 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
291 | CRYPTO_THREAD_unlock(obj_lock); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
292 | return ok; executed 451673 times by 1 test: return ok; Executed by:
| 451673 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
293 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
295 | typedef struct { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
296 | int type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
297 | void (*fn) (const OBJ_NAME *, void *arg); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
298 | void *arg; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
299 | } OBJ_DOALL; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
300 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
301 | static void do_all_fn(const OBJ_NAME *name, OBJ_DOALL *d) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
302 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
303 | if (name->type == d->type)
| 59-171 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
304 | d->fn(name, d->arg); executed 171 times by 1 test: d->fn(name, d->arg); Executed by:
| 171 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
305 | } executed 230 times by 1 test: end of block Executed by:
| 230 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
306 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
307 | IMPLEMENT_LHASH_DOALL_ARG_CONST(OBJ_NAME, OBJ_DOALL); executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
308 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
309 | void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
310 | void *arg) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
311 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
312 | OBJ_DOALL d; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
313 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
314 | d.type = type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
315 | d.fn = fn; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
316 | d.arg = arg; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
317 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
318 | lh_OBJ_NAME_doall_OBJ_DOALL(names_lh, do_all_fn, &d); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
319 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
321 | struct doall_sorted { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
322 | int type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
323 | int n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
324 | const OBJ_NAME **names; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
325 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
326 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
327 | static void do_all_sorted_fn(const OBJ_NAME *name, void *d_) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
328 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
329 | struct doall_sorted *d = d_; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
330 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
331 | if (name->type != d->type)
| 0-171 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
332 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
334 | d->names[d->n++] = name; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
335 | } executed 171 times by 1 test: end of block Executed by:
| 171 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
336 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
337 | static int do_all_sorted_cmp(const void *n1_, const void *n2_) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
338 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
339 | const OBJ_NAME *const *n1 = n1_; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
340 | const OBJ_NAME *const *n2 = n2_; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
341 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
342 | return strcmp((*n1)->name, (*n2)->name); executed 1056 times by 1 test: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( (*n1)->name ) && __builtin_constant_p ( (*n2)->name ) && (__s1_len = __builtin_strlen ( (*n1)->name ), __s2_len = __builtin_strlen ( (*n2)->name ), (!((size_t)(const void *)(( (*n1...gned char *) (const char *) ( (*n2)->name ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( (*n2)->name ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( (*n1)->name , (*n2)->name )))); }) ; Executed by:
never executed: __result = (((const unsigned char *) (const char *) ( (*n1)->name ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( (*n2)->name ))[3] - __s2[3]); never executed: end of block never executed: end of block
| 0-1056 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
343 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
344 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
345 | void OBJ_NAME_do_all_sorted(int type, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
346 | void (*fn) (const OBJ_NAME *, void *arg), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
347 | void *arg) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
348 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
349 | struct doall_sorted d; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
350 | int n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
351 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
352 | d.type = type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
353 | d.names = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
354 | OPENSSL_malloc(sizeof(*d.names) * lh_OBJ_NAME_num_items(names_lh)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
355 | /* Really should return an error if !d.names...but its a void function! */ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
356 | if (d.names != NULL) {
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
357 | d.n = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
358 | OBJ_NAME_do_all(type, do_all_sorted_fn, &d); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
359 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
360 | qsort((void *)d.names, d.n, sizeof(*d.names), do_all_sorted_cmp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
361 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
362 | for (n = 0; n < d.n; ++n)
| 1-171 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
363 | fn(d.names[n], arg); executed 171 times by 1 test: fn(d.names[n], arg); Executed by:
| 171 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
364 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
365 | OPENSSL_free((void *)d.names); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
366 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
367 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
368 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
369 | static int free_type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
370 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
371 | static void names_lh_free_doall(OBJ_NAME *onp) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
372 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
373 | if (onp == NULL)
| 0-567844 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
374 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
375 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
376 | if (free_type < 0 || free_type == onp->type)
| 0-567844 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
377 | OBJ_NAME_remove(onp->name, onp->type); executed 451673 times by 1 test: OBJ_NAME_remove(onp->name, onp->type); Executed by:
| 451673 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
378 | } executed 567844 times by 1 test: end of block Executed by:
| 567844 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
379 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
380 | static void name_funcs_free(NAME_FUNCS *ptr) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
381 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
382 | OPENSSL_free(ptr); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
383 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
384 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
385 | void OBJ_NAME_cleanup(int type) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
386 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
387 | unsigned long down_load; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
388 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
389 | if (names_lh == NULL)
| 315-5913 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
390 | return; executed 315 times by 12 tests: return; Executed by:
| 315 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
391 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
392 | free_type = type; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
393 | down_load = lh_OBJ_NAME_get_down_load(names_lh); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
394 | lh_OBJ_NAME_set_down_load(names_lh, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
395 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
396 | lh_OBJ_NAME_doall(names_lh, names_lh_free_doall); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
397 | if (type < 0) {
| 1971-3942 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
398 | lh_OBJ_NAME_free(names_lh); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
399 | sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
400 | CRYPTO_THREAD_lock_free(obj_lock); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
401 | names_lh = NULL; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
402 | name_funcs_stack = NULL; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
403 | obj_lock = NULL; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
404 | } else executed 1971 times by 1 test: end of block Executed by:
| 1971 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
405 | lh_OBJ_NAME_set_down_load(names_lh, down_load); executed 3942 times by 1 test: lh_OBJ_NAME_set_down_load(names_lh, down_load); Executed by:
| 3942 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
406 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Source code | Switch to Preprocessed file |