| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/objects/obj_xref.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | struct stack_st_nid_triple { _STACK stack; }; | - | ||||||
| 3 | struct stack_st_nid_triple *sig_app, *sigx_app; | - | ||||||
| 4 | - | |||||||
| 5 | static int | - | ||||||
| 6 | sig_cmp(const nid_triple *a, const nid_triple *b) | - | ||||||
| 7 | { | - | ||||||
| 8 | return executed 684 times by 3 tests: a->sign_id - b->sign_id;return a->sign_id - b->sign_id;Executed by:
executed 684 times by 3 tests: return a->sign_id - b->sign_id;Executed by:
| 684 | ||||||
| 9 | } | - | ||||||
| 10 | - | |||||||
| 11 | static int sig_cmp_BSEARCH_CMP_FN(const void *, const void *); | - | ||||||
| 12 | static int sig_cmp(nid_triple const *, nid_triple const *); | - | ||||||
| 13 | static nid_triple *OBJ_bsearch_sig(nid_triple *key, nid_triple const *base, int num); | - | ||||||
| 14 | - | |||||||
| 15 | static int | - | ||||||
| 16 | sig_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: sig_cmp(a, b);return sig_cmp(a, b);Executed by:
executed 684 times by 3 tests: return sig_cmp(a, b);Executed by:
| 684 | ||||||
| 21 | } | - | ||||||
| 22 | - | |||||||
| 23 | static nid_triple * | - | ||||||
| 24 | OBJ_bsearch_sig(nid_triple *key, nid_triple const *base, int num) | - | ||||||
| 25 | { | - | ||||||
| 26 | return executed 138 times by 3 tests: (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple),return (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN);Executed by:
executed 138 times by 3 tests: return (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN);Executed by:
| 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:
| 138 | ||||||
| 28 | } | - | ||||||
| 29 | - | |||||||
| 30 | static int | - | ||||||
| 31 | sig_sk_cmp(const nid_triple * const *a, const nid_triple * const *b) | - | ||||||
| 32 | { | - | ||||||
| 33 | return never executed: (*a)->sign_id - (*b)->sign_id;return (*a)->sign_id - (*b)->sign_id;never executed: return (*a)->sign_id - (*b)->sign_id; | 0 | ||||||
| 34 | } | - | ||||||
| 35 | - | |||||||
| 36 | static int sigx_cmp_BSEARCH_CMP_FN(const void *, const void *); | - | ||||||
| 37 | static int sigx_cmp(const nid_triple * const *, const nid_triple * const *); | - | ||||||
| 38 | static const nid_triple * *OBJ_bsearch_sigx(const nid_triple * *key, const nid_triple * const *base, int num); | - | ||||||
| 39 | - | |||||||
| 40 | static int | - | ||||||
| 41 | sigx_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
| 2-4 | ||||||
| 47 | return executed 2 times by 1 test: ret;return ret;Executed by:
executed 2 times by 1 test: return ret;Executed by:
| 2 | ||||||
| 48 | return executed 4 times by 1 test: (*a)->pkey_id - (*b)->pkey_id;return (*a)->pkey_id - (*b)->pkey_id;Executed by:
executed 4 times by 1 test: return (*a)->pkey_id - (*b)->pkey_id;Executed by:
| 4 | ||||||
| 49 | } | - | ||||||
| 50 | - | |||||||
| 51 | - | |||||||
| 52 | static int | - | ||||||
| 53 | sigx_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: sigx_cmp(a, b);return sigx_cmp(a, b);Executed by:
executed 6 times by 1 test: return sigx_cmp(a, b);Executed by:
| 6 | ||||||
| 58 | } | - | ||||||
| 59 | - | |||||||
| 60 | static const nid_triple * * | - | ||||||
| 61 | OBJ_bsearch_sigx(const nid_triple * *key, const nid_triple * const *base, int num) | - | ||||||
| 62 | { | - | ||||||
| 63 | return executed 2 times by 1 test: (const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *),return (const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *), sigx_cmp_BSEARCH_CMP_FN);Executed by:
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:
| 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:
| 2 | ||||||
| 65 | } | - | ||||||
| 66 | - | |||||||
| 67 | int | - | ||||||
| 68 | OBJ_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
| 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
| 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 ==
| 0-138 | ||||||
| 84 | ((void *)0)
| 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 blockExecuted by:
| 138 | ||||||
| 89 | - | |||||||
| 90 | if (rv ==
| 0-138 | ||||||
| 91 | ((void *)0)
| 0-138 | ||||||
| 92 | ) | - | ||||||
| 93 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 94 | if (pdig_nid
| 60-78 | ||||||
| 95 | * executed 78 times by 3 tests: pdig_nid = rv->hash_id;*pdig_nid = rv->hash_id;Executed by:
executed 78 times by 3 tests: *pdig_nid = rv->hash_id;Executed by:
| 78 | ||||||
| 96 | if (ppkey_nid
| 0-138 | ||||||
| 97 | * executed 138 times by 3 tests: ppkey_nid = rv->pkey_id;*ppkey_nid = rv->pkey_id;Executed by:
executed 138 times by 3 tests: *ppkey_nid = rv->pkey_id;Executed by:
| 138 | ||||||
| 98 | return executed 138 times by 3 tests: 1;return 1;Executed by:
executed 138 times by 3 tests: return 1;Executed by:
| 138 | ||||||
| 99 | } | - | ||||||
| 100 | - | |||||||
| 101 | int | - | ||||||
| 102 | OBJ_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
| 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
| 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 ==
| 0-2 | ||||||
| 123 | ((void *)0)
| 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 blockExecuted by:
| 2 | ||||||
| 128 | - | |||||||
| 129 | if (rv ==
| 0-2 | ||||||
| 130 | ((void *)0)
| 0-2 | ||||||
| 131 | ) | - | ||||||
| 132 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 133 | if (psignid
| 0-2 | ||||||
| 134 | * executed 2 times by 1 test: psignid = (*rv)->sign_id;*psignid = (*rv)->sign_id;Executed by:
executed 2 times by 1 test: *psignid = (*rv)->sign_id;Executed by:
| 2 | ||||||
| 135 | return executed 2 times by 1 test: 1;return 1;Executed by:
executed 2 times by 1 test: return 1;Executed by:
| 2 | ||||||
| 136 | } | - | ||||||
| 137 | - | |||||||
| 138 | int | - | ||||||
| 139 | OBJ_add_sigid(int signid, int dig_id, int pkey_id) | - | ||||||
| 140 | { | - | ||||||
| 141 | nid_triple *ntr; | - | ||||||
| 142 | - | |||||||
| 143 | if (!sig_app
| 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
| 0 | ||||||
| 146 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 147 | if (!sigx_app
| 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
| 0 | ||||||
| 150 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 151 | ntr = reallocarray( | - | ||||||
| 152 | ((void *)0) | - | ||||||
| 153 | , 3, sizeof(int)); | - | ||||||
| 154 | if (!ntr
| 0 | ||||||
| 155 | return never executed: 0;return 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)))
| 0 | ||||||
| 161 | free(ntr); | - | ||||||
| 162 | return never executed: 0;return 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)))
| 0 | ||||||
| 166 | return never executed: 0;return 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: 1;return 1;never executed: return 1; | 0 | ||||||
| 172 | } | - | ||||||
| 173 | - | |||||||
| 174 | static void | - | ||||||
| 175 | sid_free(nid_triple *tt) | - | ||||||
| 176 | { | - | ||||||
| 177 | free(tt); | - | ||||||
| 178 | } never executed: end of block | 0 | ||||||
| 179 | - | |||||||
| 180 | void | - | ||||||
| 181 | OBJ_sigid_free(void) | - | ||||||
| 182 | { | - | ||||||
| 183 | if (sig_app
| 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
| 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 blockExecuted by:
| 263 | ||||||
| Switch to Source code | Preprocessed file |