OpenCoverage

obj_xref.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/objects/obj_xref.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2static struct stack_st_nid_triple *sig_app, *sigx_app;-
3-
4static int sig_cmp(const nid_triple *a, const nid_triple *b)-
5{-
6 return
executed 75759 times by 1 test: return a->sign_id - b->sign_id;
Executed by:
  • libcrypto.so.1.1
a->sign_id - b->sign_id;
executed 75759 times by 1 test: return a->sign_id - b->sign_id;
Executed by:
  • libcrypto.so.1.1
75759
7}-
8-
9static int sig_cmp_BSEARCH_CMP_FN(const void *, const void *); static int sig_cmp(nid_triple const *, nid_triple const *); static nid_triple * OBJ_bsearch_sig(nid_triple *key, nid_triple const *base, int num);-
10static int sig_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) { nid_triple const *a = a_; nid_triple const *b = b_; return
executed 75759 times by 1 test: return sig_cmp(a,b);
Executed by:
  • libcrypto.so.1.1
sig_cmp(a,b);
executed 75759 times by 1 test: return sig_cmp(a,b);
Executed by:
  • libcrypto.so.1.1
} static nid_triple *OBJ_bsearch_sig(nid_triple *key, nid_triple const *base, int num) { return
executed 15550 times by 1 test: return (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN);
Executed by:
  • libcrypto.so.1.1
(nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN);
executed 15550 times by 1 test: return (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN);
Executed by:
  • libcrypto.so.1.1
} extern void dummy_prototype(void);
15550-75759
11-
12static int sig_sk_cmp(const nid_triple *const *a, const nid_triple *const *b)-
13{-
14 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
15}-
16-
17static int sigx_cmp_BSEARCH_CMP_FN(const void *, const void *); static int sigx_cmp(const nid_triple * const *, const nid_triple * const *); static const nid_triple * * OBJ_bsearch_sigx(const nid_triple * *key, const nid_triple * const *base, int num);-
18-
19static int sigx_cmp(const nid_triple *const *a, const nid_triple *const *b)-
20{-
21 int ret;-
22 ret = (*a)->hash_id - (*b)->hash_id;-
23 if (ret
retDescription
TRUEevaluated 124 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 91 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
91-124
24 return
executed 124 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 124 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
124
25 return
executed 91 times by 1 test: return (*a)->pkey_id - (*b)->pkey_id;
Executed by:
  • libcrypto.so.1.1
(*a)->pkey_id - (*b)->pkey_id;
executed 91 times by 1 test: return (*a)->pkey_id - (*b)->pkey_id;
Executed by:
  • libcrypto.so.1.1
91
26}-
27-
28static int sigx_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) { const nid_triple * const *a = a_; const nid_triple * const *b = b_; return
executed 215 times by 1 test: return sigx_cmp(a,b);
Executed by:
  • libcrypto.so.1.1
sigx_cmp(a,b);
executed 215 times by 1 test: return sigx_cmp(a,b);
Executed by:
  • libcrypto.so.1.1
} static const nid_triple * *OBJ_bsearch_sigx(const nid_triple * *key, const nid_triple * const *base, int num) { return
executed 65 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.1.1
(const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *), sigx_cmp_BSEARCH_CMP_FN);
executed 65 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.1.1
} extern void dummy_prototype(void);
65-215
29-
30int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid)-
31{-
32 nid_triple tmp;-
33 const nid_triple *rv = -
34 ((void *)0)-
35 ;-
36 tmp.sign_id = signid;-
37-
38 if (sig_app !=
sig_app != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 15550 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15550
39 ((void *)0)
sig_app != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 15550 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15550
40 ) {-
41 int idx = sk_nid_triple_find(sig_app, &tmp);-
42 rv = sk_nid_triple_value(sig_app, idx);-
43 }
never executed: end of block
0
44-
45 if (rv ==
rv == ((void *)0)Description
TRUEevaluated 15550 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-15550
46 ((void *)0)
rv == ((void *)0)Description
TRUEevaluated 15550 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-15550
47 ) {-
48 rv = OBJ_bsearch_sig(&tmp, sigoid_srt, (sizeof(sigoid_srt)/sizeof((sigoid_srt)[0])));-
49 }
executed 15550 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
15550
50-
51 if (rv ==
rv == ((void *)0)Description
TRUEevaluated 828 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14722 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
828-14722
52 ((void *)0)
rv == ((void *)0)Description
TRUEevaluated 828 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14722 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
828-14722
53 )-
54 return
executed 828 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 828 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
828
55 if (pdig_nid
pdig_nidDescription
TRUEevaluated 14722 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-14722
56 *
executed 14722 times by 1 test: *pdig_nid = rv->hash_id;
Executed by:
  • libcrypto.so.1.1
pdig_nid = rv->hash_id;
executed 14722 times by 1 test: *pdig_nid = rv->hash_id;
Executed by:
  • libcrypto.so.1.1
14722
57 if (ppkey_nid
ppkey_nidDescription
TRUEevaluated 14722 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-14722
58 *
executed 14722 times by 1 test: *ppkey_nid = rv->pkey_id;
Executed by:
  • libcrypto.so.1.1
ppkey_nid = rv->pkey_id;
executed 14722 times by 1 test: *ppkey_nid = rv->pkey_id;
Executed by:
  • libcrypto.so.1.1
14722
59 return
executed 14722 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 14722 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
14722
60}-
61-
62int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid)-
63{-
64 nid_triple tmp;-
65 const nid_triple *t = &tmp;-
66 const nid_triple **rv = -
67 ((void *)0)-
68 ;-
69-
70 tmp.hash_id = dig_nid;-
71 tmp.pkey_id = pkey_nid;-
72-
73 if (sigx_app
sigx_appDescription
TRUEnever evaluated
FALSEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-65
74 int idx = sk_nid_triple_find(sigx_app, &tmp);-
75 if (idx >= 0
idx >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
76 t = sk_nid_triple_value(sigx_app, idx);-
77 rv = &t;-
78 }
never executed: end of block
0
79 }
never executed: end of block
0
80-
81 if (rv ==
rv == ((void *)0)Description
TRUEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-65
82 ((void *)0)
rv == ((void *)0)Description
TRUEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-65
83 ) {-
84 rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref, (sizeof(sigoid_srt_xref)/sizeof((sigoid_srt_xref)[0])));-
85 }
executed 65 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
65
86-
87 if (rv ==
rv == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-65
88 ((void *)0)
rv == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-65
89 )-
90 return
never executed: return 0;
0;
never executed: return 0;
0
91 if (psignid
psignidDescription
TRUEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-65
92 *
executed 65 times by 1 test: *psignid = (*rv)->sign_id;
Executed by:
  • libcrypto.so.1.1
psignid = (*rv)->sign_id;
executed 65 times by 1 test: *psignid = (*rv)->sign_id;
Executed by:
  • libcrypto.so.1.1
65
93 return
executed 65 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 65 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
65
94}-
95-
96int OBJ_add_sigid(int signid, int dig_id, int pkey_id)-
97{-
98 nid_triple *ntr;-
99 if (sig_app ==
sig_app == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
100 ((void *)0)
sig_app == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
101 )-
102 sig_app = sk_nid_triple_new(sig_sk_cmp);
never executed: sig_app = sk_nid_triple_new(sig_sk_cmp);
0
103 if (sig_app ==
sig_app == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
104 ((void *)0)
sig_app == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
105 )-
106 return
never executed: return 0;
0;
never executed: return 0;
0
107 if (sigx_app ==
sigx_app == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
108 ((void *)0)
sigx_app == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
109 )-
110 sigx_app = sk_nid_triple_new(sigx_cmp);
never executed: sigx_app = sk_nid_triple_new(sigx_cmp);
0
111 if (sigx_app ==
sigx_app == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
112 ((void *)0)
sigx_app == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
113 )-
114 return
never executed: return 0;
0;
never executed: return 0;
0
115 if ((
(ntr = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
ntr = CRYPTO_malloc(sizeof(*ntr), __FILE__, 106)) ==
(ntr = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
116 ((void *)0)
(ntr = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
117 ) {-
118 ERR_put_error(8,(107),((1|64)),__FILE__,107);-
119 return
never executed: return 0;
0;
never executed: return 0;
0
120 }-
121 ntr->sign_id = signid;-
122 ntr->hash_id = dig_id;-
123 ntr->pkey_id = pkey_id;-
124-
125 if (!sk_nid_triple_push(sig_app, ntr)
!sk_nid_triple...(sig_app, ntr)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
126 CRYPTO_free(ntr, __FILE__, 115);-
127 return
never executed: return 0;
0;
never executed: return 0;
0
128 }-
129-
130 if (!sk_nid_triple_push(sigx_app, ntr)
!sk_nid_triple...sigx_app, ntr)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
131 return
never executed: return 0;
0;
never executed: return 0;
0
132-
133 sk_nid_triple_sort(sig_app);-
134 sk_nid_triple_sort(sigx_app);-
135-
136 return
never executed: return 1;
1;
never executed: return 1;
0
137}-
138-
139static void sid_free(nid_triple *tt)-
140{-
141 CRYPTO_free(tt, __FILE__, 130);-
142}
never executed: end of block
0
143-
144void OBJ_sigid_free(void)-
145{-
146 sk_nid_triple_pop_free(sig_app, sid_free);-
147 sig_app = -
148 ((void *)0)-
149 ;-
150 sk_nid_triple_free(sigx_app);-
151 sigx_app = -
152 ((void *)0)-
153 ;-
154}
executed 2076 times by 12 tests: end of block
Executed by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm2_internal_test
  • sm4_internal_test
  • x509_internal_test
2076
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2