OpenCoverage

obj_xref.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/objects/obj_xref.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2struct stack_st_nid_triple { _STACK stack; };-
3struct stack_st_nid_triple *sig_app, *sigx_app;-
4-
5static int-
6sig_cmp(const nid_triple *a, const nid_triple *b)-
7{-
8 return
executed 684 times by 3 tests: return a->sign_id - b->sign_id;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
a->sign_id - b->sign_id;
executed 684 times by 3 tests: return a->sign_id - b->sign_id;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
684
9}-
10-
11static int sig_cmp_BSEARCH_CMP_FN(const void *, const void *);-
12static int sig_cmp(nid_triple const *, nid_triple const *);-
13static nid_triple *OBJ_bsearch_sig(nid_triple *key, nid_triple const *base, int num);-
14-
15static int-
16sig_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)-
17{-
18 nid_triple const *a = a_;-
19 nid_triple const *b = b_;-
20 return
executed 684 times by 3 tests: return sig_cmp(a, b);
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
sig_cmp(a, b);
executed 684 times by 3 tests: return sig_cmp(a, b);
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
684
21}-
22-
23static nid_triple *-
24OBJ_bsearch_sig(nid_triple *key, nid_triple const *base, int num)-
25{-
26 return
executed 138 times by 3 tests: return (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN);
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
(nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple),
executed 138 times by 3 tests: return (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN);
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
138
27 sig_cmp_BSEARCH_CMP_FN);
executed 138 times by 3 tests: return (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN);
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
138
28}-
29-
30static int-
31sig_sk_cmp(const nid_triple * const *a, const nid_triple * const *b)-
32{-
33 return
never executed: return (*a)->sign_id - (*b)->sign_id;
(*a)->sign_id - (*b)->sign_id;
never executed: return (*a)->sign_id - (*b)->sign_id;
0
34}-
35-
36static int sigx_cmp_BSEARCH_CMP_FN(const void *, const void *);-
37static int sigx_cmp(const nid_triple * const *, const nid_triple * const *);-
38static const nid_triple * *OBJ_bsearch_sigx(const nid_triple * *key, const nid_triple * const *base, int num);-
39-
40static int-
41sigx_cmp(const nid_triple * const *a, const nid_triple * const *b)-
42{-
43 int ret;-
44-
45 ret = (*a)->hash_id - (*b)->hash_id;-
46 if (ret
retDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
)
2-4
47 return
executed 2 times by 1 test: return ret;
Executed by:
  • libcrypto.so.44.0.1
ret;
executed 2 times by 1 test: return ret;
Executed by:
  • libcrypto.so.44.0.1
2
48 return
executed 4 times by 1 test: return (*a)->pkey_id - (*b)->pkey_id;
Executed by:
  • libcrypto.so.44.0.1
(*a)->pkey_id - (*b)->pkey_id;
executed 4 times by 1 test: return (*a)->pkey_id - (*b)->pkey_id;
Executed by:
  • libcrypto.so.44.0.1
4
49}-
50-
51-
52static int-
53sigx_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)-
54{-
55 const nid_triple * const *a = a_;-
56 const nid_triple * const *b = b_;-
57 return
executed 6 times by 1 test: return sigx_cmp(a, b);
Executed by:
  • libcrypto.so.44.0.1
sigx_cmp(a, b);
executed 6 times by 1 test: return sigx_cmp(a, b);
Executed by:
  • libcrypto.so.44.0.1
6
58}-
59-
60static const nid_triple * *-
61OBJ_bsearch_sigx(const nid_triple * *key, const nid_triple * const *base, int num)-
62{-
63 return
executed 2 times by 1 test: return (const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *), sigx_cmp_BSEARCH_CMP_FN);
Executed by:
  • libcrypto.so.44.0.1
(const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *),
executed 2 times by 1 test: return (const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *), sigx_cmp_BSEARCH_CMP_FN);
Executed by:
  • libcrypto.so.44.0.1
2
64 sigx_cmp_BSEARCH_CMP_FN);
executed 2 times by 1 test: return (const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *), sigx_cmp_BSEARCH_CMP_FN);
Executed by:
  • libcrypto.so.44.0.1
2
65}-
66-
67int-
68OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid)-
69{-
70 nid_triple tmp;-
71 const nid_triple *rv = -
72 ((void *)0)-
73 ;-
74 tmp.sign_id = signid;-
75-
76 if (sig_app
sig_appDescription
TRUEnever evaluated
FALSEevaluated 138 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
) {
0-138
77 int idx = sk_find(((_STACK*) (1 ? (sig_app) : (struct stack_st_nid_triple*)0)), ((void*) (1 ? (&tmp) : (nid_triple*)0)));-
78 if (idx >= 0
idx >= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
79 rv = ((nid_triple *)sk_value(((_STACK*) (1 ? (sig_app) : (struct stack_st_nid_triple*)0)), (idx)));
never executed: rv = ((nid_triple *)sk_value(((_STACK*) (1 ? (sig_app) : (struct stack_st_nid_triple*)0)), (idx)));
0
80 }
never executed: end of block
0
81-
82-
83 if (rv ==
rv == ((void *)0)Description
TRUEevaluated 138 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
FALSEnever evaluated
0-138
84 ((void *)0)
rv == ((void *)0)Description
TRUEevaluated 138 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
FALSEnever evaluated
0-138
85 ) {-
86 rv = OBJ_bsearch_sig(&tmp, sigoid_srt,-
87 sizeof(sigoid_srt) / sizeof(nid_triple));-
88 }
executed 138 times by 3 tests: end of block
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
138
89-
90 if (rv ==
rv == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 138 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
0-138
91 ((void *)0)
rv == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 138 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
0-138
92 )-
93 return
never executed: return 0;
0;
never executed: return 0;
0
94 if (pdig_nid
pdig_nidDescription
TRUEevaluated 78 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
FALSEevaluated 60 times by 2 tests
Evaluated by:
  • ssltest
  • tlstest
)
60-78
95 *
executed 78 times by 3 tests: *pdig_nid = rv->hash_id;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
pdig_nid = rv->hash_id;
executed 78 times by 3 tests: *pdig_nid = rv->hash_id;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
78
96 if (ppkey_nid
ppkey_nidDescription
TRUEevaluated 138 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
FALSEnever evaluated
)
0-138
97 *
executed 138 times by 3 tests: *ppkey_nid = rv->pkey_id;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
ppkey_nid = rv->pkey_id;
executed 138 times by 3 tests: *ppkey_nid = rv->pkey_id;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
138
98 return
executed 138 times by 3 tests: return 1;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
1;
executed 138 times by 3 tests: return 1;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
  • tlstest
138
99}-
100-
101int-
102OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid)-
103{-
104 nid_triple tmp;-
105 const nid_triple *t = &tmp;-
106 const nid_triple **rv = -
107 ((void *)0)-
108 ;-
109-
110 tmp.hash_id = dig_nid;-
111 tmp.pkey_id = pkey_nid;-
112-
113 if (sigx_app
sigx_appDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
) {
0-2
114 int idx = sk_find(((_STACK*) (1 ? (sigx_app) : (struct stack_st_nid_triple*)0)), ((void*) (1 ? (&tmp) : (nid_triple*)0)));-
115 if (idx >= 0
idx >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
116 t = ((nid_triple *)sk_value(((_STACK*) (1 ? (sigx_app) : (struct stack_st_nid_triple*)0)), (idx)));-
117 rv = &t;-
118 }
never executed: end of block
0
119 }
never executed: end of block
0
120-
121-
122 if (rv ==
rv == ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEnever evaluated
0-2
123 ((void *)0)
rv == ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEnever evaluated
0-2
124 ) {-
125 rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref,-
126 sizeof(sigoid_srt_xref) / sizeof(nid_triple *));-
127 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.44.0.1
2
128-
129 if (rv ==
rv == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
0-2
130 ((void *)0)
rv == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
0-2
131 )-
132 return
never executed: return 0;
0;
never executed: return 0;
0
133 if (psignid
psignidDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEnever evaluated
)
0-2
134 *
executed 2 times by 1 test: *psignid = (*rv)->sign_id;
Executed by:
  • libcrypto.so.44.0.1
psignid = (*rv)->sign_id;
executed 2 times by 1 test: *psignid = (*rv)->sign_id;
Executed by:
  • libcrypto.so.44.0.1
2
135 return
executed 2 times by 1 test: return 1;
Executed by:
  • libcrypto.so.44.0.1
1;
executed 2 times by 1 test: return 1;
Executed by:
  • libcrypto.so.44.0.1
2
136}-
137-
138int-
139OBJ_add_sigid(int signid, int dig_id, int pkey_id)-
140{-
141 nid_triple *ntr;-
142-
143 if (!sig_app
!sig_appDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
144 sig_app = ((struct stack_st_nid_triple *)sk_new(((int (*)(const void *, const void *)) ((1 ? (sig_sk_cmp) : (int (*)(const nid_triple * const *, const nid_triple * const *))0)))));
never executed: sig_app = ((struct stack_st_nid_triple *)sk_new(((int (*)(const void *, const void *)) ((1 ? (sig_sk_cmp) : (int (*)(const nid_triple * const *, const nid_triple * const *))0)))));
0
145 if (!sig_app
!sig_appDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
146 return
never executed: return 0;
0;
never executed: return 0;
0
147 if (!sigx_app
!sigx_appDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
148 sigx_app = ((struct stack_st_nid_triple *)sk_new(((int (*)(const void *, const void *)) ((1 ? (sigx_cmp) : (int (*)(const nid_triple * const *, const nid_triple * const *))0)))));
never executed: sigx_app = ((struct stack_st_nid_triple *)sk_new(((int (*)(const void *, const void *)) ((1 ? (sigx_cmp) : (int (*)(const nid_triple * const *, const nid_triple * const *))0)))));
0
149 if (!sigx_app
!sigx_appDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
150 return
never executed: return 0;
0;
never executed: return 0;
0
151 ntr = reallocarray(-
152 ((void *)0)-
153 , 3, sizeof(int));-
154 if (!ntr
!ntrDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
155 return
never executed: return 0;
0;
never executed: return 0;
0
156 ntr->sign_id = signid;-
157 ntr->hash_id = dig_id;-
158 ntr->pkey_id = pkey_id;-
159-
160 if (!sk_push(((_STACK*) (1 ? (sig_app) : (struct stack_st_nid_triple*)0)), ((void*) (1 ? (ntr) : (nid_triple*)0)))
!sk_push(((_ST...d_triple*)0)))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
161 free(ntr);-
162 return
never executed: return 0;
0;
never executed: return 0;
0
163 }-
164-
165 if (!sk_push(((_STACK*) (1 ? (sigx_app) : (struct stack_st_nid_triple*)0)), ((void*) (1 ? (ntr) : (nid_triple*)0)))
!sk_push(((_ST...d_triple*)0)))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
166 return
never executed: return 0;
0;
never executed: return 0;
0
167-
168 sk_sort(((_STACK*) (1 ? (sig_app) : (struct stack_st_nid_triple*)0)));-
169 sk_sort(((_STACK*) (1 ? (sigx_app) : (struct stack_st_nid_triple*)0)));-
170-
171 return
never executed: return 1;
1;
never executed: return 1;
0
172}-
173-
174static void-
175sid_free(nid_triple *tt)-
176{-
177 free(tt);-
178}
never executed: end of block
0
179-
180void-
181OBJ_sigid_free(void)-
182{-
183 if (sig_app
sig_appDescription
TRUEnever evaluated
FALSEevaluated 263 times by 4 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
  • pbkdf2
  • ssltest
) {
0-263
184 sk_pop_free(((_STACK*) (1 ? (sig_app) : (struct stack_st_nid_triple*)0)), ((void (*)(void *)) ((1 ? (sid_free) : (void (*)(nid_triple *))0))));-
185 sig_app = -
186 ((void *)0)-
187 ;-
188 }
never executed: end of block
0
189 if (sigx_app
sigx_appDescription
TRUEnever evaluated
FALSEevaluated 263 times by 4 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
  • pbkdf2
  • ssltest
) {
0-263
190 sk_free(((_STACK*) (1 ? (sigx_app) : (struct stack_st_nid_triple*)0)));-
191 sigx_app = -
192 ((void *)0)-
193 ;-
194 }
never executed: end of block
0
195}
executed 263 times by 4 tests: end of block
Executed by:
  • evptest
  • libcrypto.so.44.0.1
  • pbkdf2
  • ssltest
263
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2