| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/pmeth_gn.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx) | - | ||||||||||||||||||
| 3 | { | - | ||||||||||||||||||
| 4 | int ret; | - | ||||||||||||||||||
| 5 | if (!ctx
| 0-229 | ||||||||||||||||||
| 6 | ERR_put_error(6,(149),(150),__FILE__,24) | - | ||||||||||||||||||
| 7 | ; | - | ||||||||||||||||||
| 8 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||
| 9 | } | - | ||||||||||||||||||
| 10 | ctx->operation = (1<<1); | - | ||||||||||||||||||
| 11 | if (!ctx->pmeth->paramgen_init
| 0-229 | ||||||||||||||||||
| 12 | return executed 229 times by 1 test: 1;return 1;Executed by:
executed 229 times by 1 test: return 1;Executed by:
| 229 | ||||||||||||||||||
| 13 | ret = ctx->pmeth->paramgen_init(ctx); | - | ||||||||||||||||||
| 14 | if (ret <= 0
| 0 | ||||||||||||||||||
| 15 | ctx->operation = 0; never executed: ctx->operation = 0; | 0 | ||||||||||||||||||
| 16 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 17 | } | - | ||||||||||||||||||
| 18 | - | |||||||||||||||||||
| 19 | int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey) | - | ||||||||||||||||||
| 20 | { | - | ||||||||||||||||||
| 21 | int ret; | - | ||||||||||||||||||
| 22 | if (!ctx
| 0-229 | ||||||||||||||||||
| 23 | ERR_put_error(6,(148),(150),__FILE__,41) | - | ||||||||||||||||||
| 24 | ; | - | ||||||||||||||||||
| 25 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||
| 26 | } | - | ||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | if (ctx->operation != (1<<1)
| 0-229 | ||||||||||||||||||
| 29 | ERR_put_error(6,(148),(151),__FILE__,46); | - | ||||||||||||||||||
| 30 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 31 | } | - | ||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | if (ppkey ==
| 0-229 | ||||||||||||||||||
| 34 | ((void *)0)
| 0-229 | ||||||||||||||||||
| 35 | ) | - | ||||||||||||||||||
| 36 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 37 | - | |||||||||||||||||||
| 38 | if (*
| 0-229 | ||||||||||||||||||
| 39 | ((void *)0)
| 0-229 | ||||||||||||||||||
| 40 | ) | - | ||||||||||||||||||
| 41 | * executed 229 times by 1 test: ppkey = EVP_PKEY_new();*ppkey = EVP_PKEY_new();Executed by:
executed 229 times by 1 test: *ppkey = EVP_PKEY_new();Executed by:
| 229 | ||||||||||||||||||
| 42 | - | |||||||||||||||||||
| 43 | if (*
| 0-229 | ||||||||||||||||||
| 44 | ((void *)0)
| 0-229 | ||||||||||||||||||
| 45 | ) { | - | ||||||||||||||||||
| 46 | ERR_put_error(6,(148),((1|64)),__FILE__,57); | - | ||||||||||||||||||
| 47 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 48 | } | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | ret = ctx->pmeth->paramgen(ctx, *ppkey); | - | ||||||||||||||||||
| 51 | if (ret <= 0
| 0-229 | ||||||||||||||||||
| 52 | EVP_PKEY_free(*ppkey); | - | ||||||||||||||||||
| 53 | *ppkey = | - | ||||||||||||||||||
| 54 | ((void *)0) | - | ||||||||||||||||||
| 55 | ; | - | ||||||||||||||||||
| 56 | } never executed: end of block | 0 | ||||||||||||||||||
| 57 | return executed 229 times by 1 test: ret;return ret;Executed by:
executed 229 times by 1 test: return ret;Executed by:
| 229 | ||||||||||||||||||
| 58 | } | - | ||||||||||||||||||
| 59 | - | |||||||||||||||||||
| 60 | int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx) | - | ||||||||||||||||||
| 61 | { | - | ||||||||||||||||||
| 62 | int ret; | - | ||||||||||||||||||
| 63 | if (!ctx
| 0-10113 | ||||||||||||||||||
| 64 | ERR_put_error(6,(147),(150),__FILE__,74) | - | ||||||||||||||||||
| 65 | ; | - | ||||||||||||||||||
| 66 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||
| 67 | } | - | ||||||||||||||||||
| 68 | ctx->operation = (1<<2); | - | ||||||||||||||||||
| 69 | if (!ctx->pmeth->keygen_init
| 0-10113 | ||||||||||||||||||
| 70 | return executed 10113 times by 1 test: 1;return 1;Executed by:
executed 10113 times by 1 test: return 1;Executed by:
| 10113 | ||||||||||||||||||
| 71 | ret = ctx->pmeth->keygen_init(ctx); | - | ||||||||||||||||||
| 72 | if (ret <= 0
| 0 | ||||||||||||||||||
| 73 | ctx->operation = 0; never executed: ctx->operation = 0; | 0 | ||||||||||||||||||
| 74 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 75 | } | - | ||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey) | - | ||||||||||||||||||
| 78 | { | - | ||||||||||||||||||
| 79 | int ret; | - | ||||||||||||||||||
| 80 | - | |||||||||||||||||||
| 81 | if (!ctx
| 0-10112 | ||||||||||||||||||
| 82 | ERR_put_error(6,(146),(150),__FILE__,92) | - | ||||||||||||||||||
| 83 | ; | - | ||||||||||||||||||
| 84 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||
| 85 | } | - | ||||||||||||||||||
| 86 | if (ctx->operation != (1<<2)
| 0-10112 | ||||||||||||||||||
| 87 | ERR_put_error(6,(146),(151),__FILE__,96); | - | ||||||||||||||||||
| 88 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 89 | } | - | ||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | if (ppkey ==
| 0-10112 | ||||||||||||||||||
| 92 | ((void *)0)
| 0-10112 | ||||||||||||||||||
| 93 | ) | - | ||||||||||||||||||
| 94 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 95 | - | |||||||||||||||||||
| 96 | if (*
| 0-10112 | ||||||||||||||||||
| 97 | ((void *)0)
| 0-10112 | ||||||||||||||||||
| 98 | ) | - | ||||||||||||||||||
| 99 | * executed 10112 times by 1 test: ppkey = EVP_PKEY_new();*ppkey = EVP_PKEY_new();Executed by:
executed 10112 times by 1 test: *ppkey = EVP_PKEY_new();Executed by:
| 10112 | ||||||||||||||||||
| 100 | if (*
| 0-10112 | ||||||||||||||||||
| 101 | ((void *)0)
| 0-10112 | ||||||||||||||||||
| 102 | ) | - | ||||||||||||||||||
| 103 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | ret = ctx->pmeth->keygen(ctx, *ppkey); | - | ||||||||||||||||||
| 106 | if (ret <= 0
| 0-10112 | ||||||||||||||||||
| 107 | EVP_PKEY_free(*ppkey); | - | ||||||||||||||||||
| 108 | *ppkey = | - | ||||||||||||||||||
| 109 | ((void *)0) | - | ||||||||||||||||||
| 110 | ; | - | ||||||||||||||||||
| 111 | } never executed: end of block | 0 | ||||||||||||||||||
| 112 | return executed 10112 times by 1 test: ret;return ret;Executed by:
executed 10112 times by 1 test: return ret;Executed by:
| 10112 | ||||||||||||||||||
| 113 | } | - | ||||||||||||||||||
| 114 | - | |||||||||||||||||||
| 115 | void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb) | - | ||||||||||||||||||
| 116 | { | - | ||||||||||||||||||
| 117 | ctx->pkey_gencb = cb; | - | ||||||||||||||||||
| 118 | } executed 13 times by 1 test: end of blockExecuted by:
| 13 | ||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx) | - | ||||||||||||||||||
| 121 | { | - | ||||||||||||||||||
| 122 | return never executed: ctx->pkey_gencb;return ctx->pkey_gencb;never executed: return ctx->pkey_gencb; | 0 | ||||||||||||||||||
| 123 | } | - | ||||||||||||||||||
| 124 | - | |||||||||||||||||||
| 125 | - | |||||||||||||||||||
| 126 | - | |||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | - | |||||||||||||||||||
| 130 | static int trans_cb(int a, int b, BN_GENCB *gcb) | - | ||||||||||||||||||
| 131 | { | - | ||||||||||||||||||
| 132 | EVP_PKEY_CTX *ctx = BN_GENCB_get_arg(gcb); | - | ||||||||||||||||||
| 133 | ctx->keygen_info[0] = a; | - | ||||||||||||||||||
| 134 | ctx->keygen_info[1] = b; | - | ||||||||||||||||||
| 135 | return executed 2168 times by 1 test: ctx->pkey_gencb(ctx);return ctx->pkey_gencb(ctx);Executed by:
executed 2168 times by 1 test: return ctx->pkey_gencb(ctx);Executed by:
| 2168 | ||||||||||||||||||
| 136 | } | - | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx) | - | ||||||||||||||||||
| 139 | { | - | ||||||||||||||||||
| 140 | BN_GENCB_set(cb, trans_cb, ctx); | - | ||||||||||||||||||
| 141 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 142 | - | |||||||||||||||||||
| 143 | int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx) | - | ||||||||||||||||||
| 144 | { | - | ||||||||||||||||||
| 145 | if (idx == -1
| 0-2168 | ||||||||||||||||||
| 146 | return never executed: ctx->keygen_info_count;return ctx->keygen_info_count;never executed: return ctx->keygen_info_count; | 0 | ||||||||||||||||||
| 147 | if (idx < 0
| 0-2168 | ||||||||||||||||||
| 148 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 149 | return executed 2168 times by 1 test: ctx->keygen_info[idx];return ctx->keygen_info[idx];Executed by:
executed 2168 times by 1 test: return ctx->keygen_info[idx];Executed by:
| 2168 | ||||||||||||||||||
| 150 | } | - | ||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, | - | ||||||||||||||||||
| 153 | const unsigned char *key, int keylen) | - | ||||||||||||||||||
| 154 | { | - | ||||||||||||||||||
| 155 | EVP_PKEY_CTX *mac_ctx = | - | ||||||||||||||||||
| 156 | ((void *)0) | - | ||||||||||||||||||
| 157 | ; | - | ||||||||||||||||||
| 158 | EVP_PKEY *mac_key = | - | ||||||||||||||||||
| 159 | ((void *)0) | - | ||||||||||||||||||
| 160 | ; | - | ||||||||||||||||||
| 161 | mac_ctx = EVP_PKEY_CTX_new_id(type, e); | - | ||||||||||||||||||
| 162 | if (!mac_ctx
| 0-2746 | ||||||||||||||||||
| 163 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 164 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 165 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 166 | if (EVP_PKEY_keygen_init(mac_ctx) <= 0
| 0-2746 | ||||||||||||||||||
| 167 | goto never executed: merr;goto merr;never executed: goto merr; | 0 | ||||||||||||||||||
| 168 | if (EVP_PKEY_CTX_ctrl(mac_ctx, -1, (1<<2), 6, keylen, (void *)(key)) <= 0
| 0-2746 | ||||||||||||||||||
| 169 | goto never executed: merr;goto merr;never executed: goto merr; | 0 | ||||||||||||||||||
| 170 | if (EVP_PKEY_keygen(mac_ctx, &mac_key) <= 0
| 0-2746 | ||||||||||||||||||
| 171 | goto never executed: merr;goto merr;never executed: goto merr; | 0 | ||||||||||||||||||
| 172 | merr: code before this statement executed 2746 times by 1 test: merr:Executed by:
| 2746 | ||||||||||||||||||
| 173 | EVP_PKEY_CTX_free(mac_ctx); | - | ||||||||||||||||||
| 174 | return executed 2746 times by 1 test: mac_key;return mac_key;Executed by:
executed 2746 times by 1 test: return mac_key;Executed by:
| 2746 | ||||||||||||||||||
| 175 | } | - | ||||||||||||||||||
| 176 | - | |||||||||||||||||||
| 177 | int EVP_PKEY_check(EVP_PKEY_CTX *ctx) | - | ||||||||||||||||||
| 178 | { | - | ||||||||||||||||||
| 179 | EVP_PKEY *pkey = ctx->pkey; | - | ||||||||||||||||||
| 180 | - | |||||||||||||||||||
| 181 | if (pkey ==
| 0-10 | ||||||||||||||||||
| 182 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 183 | ) { | - | ||||||||||||||||||
| 184 | ERR_put_error(6,(186),(154),__FILE__,177); | - | ||||||||||||||||||
| 185 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 186 | } | - | ||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | if (ctx->pmeth->check !=
| 5 | ||||||||||||||||||
| 190 | ((void *)0)
| 5 | ||||||||||||||||||
| 191 | ) | - | ||||||||||||||||||
| 192 | return executed 5 times by 1 test: ctx->pmeth->check(pkey);return ctx->pmeth->check(pkey);Executed by:
executed 5 times by 1 test: return ctx->pmeth->check(pkey);Executed by:
| 5 | ||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | if (pkey->ameth ==
| 0-5 | ||||||||||||||||||
| 196 | ((void *)0)
| 0-5 | ||||||||||||||||||
| 197 | || pkey->ameth->pkey_check ==
| 0-5 | ||||||||||||||||||
| 198 | ((void *)0)
| 0-5 | ||||||||||||||||||
| 199 | ) { | - | ||||||||||||||||||
| 200 | ERR_put_error(6,(186),(150),__FILE__,188) | - | ||||||||||||||||||
| 201 | ; | - | ||||||||||||||||||
| 202 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||
| 203 | } | - | ||||||||||||||||||
| 204 | - | |||||||||||||||||||
| 205 | return executed 5 times by 1 test: pkey->ameth->pkey_check(pkey);return pkey->ameth->pkey_check(pkey);Executed by:
executed 5 times by 1 test: return pkey->ameth->pkey_check(pkey);Executed by:
| 5 | ||||||||||||||||||
| 206 | } | - | ||||||||||||||||||
| 207 | - | |||||||||||||||||||
| 208 | int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx) | - | ||||||||||||||||||
| 209 | { | - | ||||||||||||||||||
| 210 | EVP_PKEY *pkey = ctx->pkey; | - | ||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | if (pkey ==
| 0-10 | ||||||||||||||||||
| 213 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 214 | ) { | - | ||||||||||||||||||
| 215 | ERR_put_error(6,(190),(154),__FILE__,200); | - | ||||||||||||||||||
| 216 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 217 | } | - | ||||||||||||||||||
| 218 | - | |||||||||||||||||||
| 219 | - | |||||||||||||||||||
| 220 | if (ctx->pmeth->public_check !=
| 5 | ||||||||||||||||||
| 221 | ((void *)0)
| 5 | ||||||||||||||||||
| 222 | ) | - | ||||||||||||||||||
| 223 | return executed 5 times by 1 test: ctx->pmeth->public_check(pkey);return ctx->pmeth->public_check(pkey);Executed by:
executed 5 times by 1 test: return ctx->pmeth->public_check(pkey);Executed by:
| 5 | ||||||||||||||||||
| 224 | - | |||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | if (pkey->ameth ==
| 0-5 | ||||||||||||||||||
| 227 | ((void *)0)
| 0-5 | ||||||||||||||||||
| 228 | || pkey->ameth->pkey_public_check ==
| 2-3 | ||||||||||||||||||
| 229 | ((void *)0)
| 2-3 | ||||||||||||||||||
| 230 | ) { | - | ||||||||||||||||||
| 231 | ERR_put_error(6,(190),(150),__FILE__,211) | - | ||||||||||||||||||
| 232 | ; | - | ||||||||||||||||||
| 233 | return executed 2 times by 1 test: -2;return -2;Executed by:
executed 2 times by 1 test: return -2;Executed by:
| 2 | ||||||||||||||||||
| 234 | } | - | ||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | return executed 3 times by 1 test: pkey->ameth->pkey_public_check(pkey);return pkey->ameth->pkey_public_check(pkey);Executed by:
executed 3 times by 1 test: return pkey->ameth->pkey_public_check(pkey);Executed by:
| 3 | ||||||||||||||||||
| 237 | } | - | ||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx) | - | ||||||||||||||||||
| 240 | { | - | ||||||||||||||||||
| 241 | EVP_PKEY *pkey = ctx->pkey; | - | ||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | if (pkey ==
| 0-10 | ||||||||||||||||||
| 244 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 245 | ) { | - | ||||||||||||||||||
| 246 | ERR_put_error(6,(189),(154),__FILE__,223); | - | ||||||||||||||||||
| 247 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 248 | } | - | ||||||||||||||||||
| 249 | - | |||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | if (ctx->pmeth->param_check !=
| 5 | ||||||||||||||||||
| 252 | ((void *)0)
| 5 | ||||||||||||||||||
| 253 | ) | - | ||||||||||||||||||
| 254 | return executed 5 times by 1 test: ctx->pmeth->param_check(pkey);return ctx->pmeth->param_check(pkey);Executed by:
executed 5 times by 1 test: return ctx->pmeth->param_check(pkey);Executed by:
| 5 | ||||||||||||||||||
| 255 | - | |||||||||||||||||||
| 256 | - | |||||||||||||||||||
| 257 | if (pkey->ameth ==
| 0-5 | ||||||||||||||||||
| 258 | ((void *)0)
| 0-5 | ||||||||||||||||||
| 259 | || pkey->ameth->pkey_param_check ==
| 2-3 | ||||||||||||||||||
| 260 | ((void *)0)
| 2-3 | ||||||||||||||||||
| 261 | ) { | - | ||||||||||||||||||
| 262 | ERR_put_error(6,(189),(150),__FILE__,234) | - | ||||||||||||||||||
| 263 | ; | - | ||||||||||||||||||
| 264 | return executed 2 times by 1 test: -2;return -2;Executed by:
executed 2 times by 1 test: return -2;Executed by:
| 2 | ||||||||||||||||||
| 265 | } | - | ||||||||||||||||||
| 266 | - | |||||||||||||||||||
| 267 | return executed 3 times by 1 test: pkey->ameth->pkey_param_check(pkey);return pkey->ameth->pkey_param_check(pkey);Executed by:
executed 3 times by 1 test: return pkey->ameth->pkey_param_check(pkey);Executed by:
| 3 | ||||||||||||||||||
| 268 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |