| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/p_lib.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | static void EVP_PKEY_free_it(EVP_PKEY *x); | - | ||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | int EVP_PKEY_bits(const EVP_PKEY *pkey) | - | ||||||||||||||||||
| 10 | { | - | ||||||||||||||||||
| 11 | if (pkey
| 0-457 | ||||||||||||||||||
| 12 | return executed 457 times by 1 test: pkey->ameth->pkey_bits(pkey);return pkey->ameth->pkey_bits(pkey);Executed by:
executed 457 times by 1 test: return pkey->ameth->pkey_bits(pkey);Executed by:
| 457 | ||||||||||||||||||
| 13 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 14 | } | - | ||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | int EVP_PKEY_security_bits(const EVP_PKEY *pkey) | - | ||||||||||||||||||
| 17 | { | - | ||||||||||||||||||
| 18 | if (pkey ==
| 0-13278 | ||||||||||||||||||
| 19 | ((void *)0)
| 0-13278 | ||||||||||||||||||
| 20 | ) | - | ||||||||||||||||||
| 21 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 22 | if (!pkey->ameth
| 0-13278 | ||||||||||||||||||
| 23 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||
| 24 | return executed 13278 times by 1 test: pkey->ameth->pkey_security_bits(pkey);return pkey->ameth->pkey_security_bits(pkey);Executed by:
executed 13278 times by 1 test: return pkey->ameth->pkey_security_bits(pkey);Executed by:
| 13278 | ||||||||||||||||||
| 25 | } | - | ||||||||||||||||||
| 26 | - | |||||||||||||||||||
| 27 | int EVP_PKEY_size(EVP_PKEY *pkey) | - | ||||||||||||||||||
| 28 | { | - | ||||||||||||||||||
| 29 | if (pkey
| 0-8850 | ||||||||||||||||||
| 30 | return executed 8850 times by 1 test: pkey->ameth->pkey_size(pkey);return pkey->ameth->pkey_size(pkey);Executed by:
executed 8850 times by 1 test: return pkey->ameth->pkey_size(pkey);Executed by:
| 8850 | ||||||||||||||||||
| 31 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 32 | } | - | ||||||||||||||||||
| 33 | - | |||||||||||||||||||
| 34 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode) | - | ||||||||||||||||||
| 35 | { | - | ||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | if (pkey->type == 116
| 0 | ||||||||||||||||||
| 38 | int ret = pkey->save_parameters; | - | ||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | if (mode >= 0
| 0 | ||||||||||||||||||
| 41 | pkey->save_parameters = mode; never executed: pkey->save_parameters = mode; | 0 | ||||||||||||||||||
| 42 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 43 | } | - | ||||||||||||||||||
| 44 | - | |||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | if (pkey->type == 408
| 0 | ||||||||||||||||||
| 47 | int ret = pkey->save_parameters; | - | ||||||||||||||||||
| 48 | - | |||||||||||||||||||
| 49 | if (mode >= 0
| 0 | ||||||||||||||||||
| 50 | pkey->save_parameters = mode; never executed: pkey->save_parameters = mode; | 0 | ||||||||||||||||||
| 51 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 52 | } | - | ||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 55 | } | - | ||||||||||||||||||
| 56 | - | |||||||||||||||||||
| 57 | int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) | - | ||||||||||||||||||
| 58 | { | - | ||||||||||||||||||
| 59 | if (to->type == 0
| 1062-8461 | ||||||||||||||||||
| 60 | if (EVP_PKEY_set_type(to, from->type) == 0
| 0-1062 | ||||||||||||||||||
| 61 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 62 | } executed 1062 times by 1 test: else if (to->type != from->typeend of blockExecuted by:
| 0-8461 | ||||||||||||||||||
| 63 | ERR_put_error(6,(103),(101),__FILE__,81); | - | ||||||||||||||||||
| 64 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 65 | } | - | ||||||||||||||||||
| 66 | - | |||||||||||||||||||
| 67 | if (EVP_PKEY_missing_parameters(from)
| 0-9523 | ||||||||||||||||||
| 68 | ERR_put_error(6,(103),(103),__FILE__,86); | - | ||||||||||||||||||
| 69 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 70 | } | - | ||||||||||||||||||
| 71 | - | |||||||||||||||||||
| 72 | if (!EVP_PKEY_missing_parameters(to)
| 634-8889 | ||||||||||||||||||
| 73 | if (EVP_PKEY_cmp_parameters(to, from) == 1
| 3955-4934 | ||||||||||||||||||
| 74 | return executed 4934 times by 1 test: 1;return 1;Executed by:
executed 4934 times by 1 test: return 1;Executed by:
| 4934 | ||||||||||||||||||
| 75 | ERR_put_error(6,(103),(153),__FILE__,93); | - | ||||||||||||||||||
| 76 | return executed 3955 times by 1 test: 0;return 0;Executed by:
executed 3955 times by 1 test: return 0;Executed by:
| 3955 | ||||||||||||||||||
| 77 | } | - | ||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | if (from->ameth
| 0-634 | ||||||||||||||||||
| 80 | return executed 634 times by 1 test: from->ameth->param_copy(to, from);return from->ameth->param_copy(to, from);Executed by:
executed 634 times by 1 test: return from->ameth->param_copy(to, from);Executed by:
| 634 | ||||||||||||||||||
| 81 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||
| 82 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 83 | } | - | ||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey) | - | ||||||||||||||||||
| 86 | { | - | ||||||||||||||||||
| 87 | if (pkey->ameth
| 0-30687 | ||||||||||||||||||
| 88 | return executed 12121 times by 1 test: pkey->ameth->param_missing(pkey);return pkey->ameth->param_missing(pkey);Executed by:
executed 12121 times by 1 test: return pkey->ameth->param_missing(pkey);Executed by:
| 12121 | ||||||||||||||||||
| 89 | return executed 18566 times by 1 test: 0;return 0;Executed by:
executed 18566 times by 1 test: return 0;Executed by:
| 18566 | ||||||||||||||||||
| 90 | } | - | ||||||||||||||||||
| 91 | - | |||||||||||||||||||
| 92 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) | - | ||||||||||||||||||
| 93 | { | - | ||||||||||||||||||
| 94 | if (a->type != b->type
| 0-13256 | ||||||||||||||||||
| 95 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 96 | if (a->ameth
| 0-13256 | ||||||||||||||||||
| 97 | return executed 9301 times by 1 test: a->ameth->param_cmp(a, b);return a->ameth->param_cmp(a, b);Executed by:
executed 9301 times by 1 test: return a->ameth->param_cmp(a, b);Executed by:
| 9301 | ||||||||||||||||||
| 98 | return executed 3955 times by 1 test: -2;return -2;Executed by:
executed 3955 times by 1 test: return -2;Executed by:
| 3955 | ||||||||||||||||||
| 99 | } | - | ||||||||||||||||||
| 100 | - | |||||||||||||||||||
| 101 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b) | - | ||||||||||||||||||
| 102 | { | - | ||||||||||||||||||
| 103 | if (a->type != b->type
| 5-9415 | ||||||||||||||||||
| 104 | return executed 5 times by 1 test: -1;return -1;Executed by:
executed 5 times by 1 test: return -1;Executed by:
| 5 | ||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | if (a->ameth
| 0-9415 | ||||||||||||||||||
| 107 | int ret; | - | ||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | if (a->ameth->param_cmp
| 4536-4879 | ||||||||||||||||||
| 110 | ret = a->ameth->param_cmp(a, b); | - | ||||||||||||||||||
| 111 | if (ret <= 0
| 0-4879 | ||||||||||||||||||
| 112 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 113 | } executed 4879 times by 1 test: end of blockExecuted by:
| 4879 | ||||||||||||||||||
| 114 | - | |||||||||||||||||||
| 115 | if (a->ameth->pub_cmp
| 0-9415 | ||||||||||||||||||
| 116 | return executed 9415 times by 1 test: a->ameth->pub_cmp(a, b);return a->ameth->pub_cmp(a, b);Executed by:
executed 9415 times by 1 test: return a->ameth->pub_cmp(a, b);Executed by:
| 9415 | ||||||||||||||||||
| 117 | } never executed: end of block | 0 | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||
| 120 | } | - | ||||||||||||||||||
| 121 | - | |||||||||||||||||||
| 122 | EVP_PKEY *EVP_PKEY_new(void) | - | ||||||||||||||||||
| 123 | { | - | ||||||||||||||||||
| 124 | EVP_PKEY *ret = CRYPTO_zalloc(sizeof(*ret), __FILE__, 142); | - | ||||||||||||||||||
| 125 | - | |||||||||||||||||||
| 126 | if (ret ==
| 0-98797 | ||||||||||||||||||
| 127 | ((void *)0)
| 0-98797 | ||||||||||||||||||
| 128 | ) { | - | ||||||||||||||||||
| 129 | ERR_put_error(6,(106),((1|64)),__FILE__,145); | - | ||||||||||||||||||
| 130 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 131 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 132 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 133 | } | - | ||||||||||||||||||
| 134 | ret->type = 0; | - | ||||||||||||||||||
| 135 | ret->save_type = 0; | - | ||||||||||||||||||
| 136 | ret->references = 1; | - | ||||||||||||||||||
| 137 | ret->save_parameters = 1; | - | ||||||||||||||||||
| 138 | ret->lock = CRYPTO_THREAD_lock_new(); | - | ||||||||||||||||||
| 139 | if (ret->lock ==
| 0-98797 | ||||||||||||||||||
| 140 | ((void *)0)
| 0-98797 | ||||||||||||||||||
| 141 | ) { | - | ||||||||||||||||||
| 142 | ERR_put_error(6,(106),((1|64)),__FILE__,154); | - | ||||||||||||||||||
| 143 | CRYPTO_free(ret, __FILE__, 155); | - | ||||||||||||||||||
| 144 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 145 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 146 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 147 | } | - | ||||||||||||||||||
| 148 | return executed 98797 times by 1 test: ret;return ret;Executed by:
executed 98797 times by 1 test: return ret;Executed by:
| 98797 | ||||||||||||||||||
| 149 | } | - | ||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | int EVP_PKEY_up_ref(EVP_PKEY *pkey) | - | ||||||||||||||||||
| 152 | { | - | ||||||||||||||||||
| 153 | int i; | - | ||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 | if (CRYPTO_UP_REF(&pkey->references, &i, pkey->lock) <= 0
| 0-249355 | ||||||||||||||||||
| 156 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | ; | - | ||||||||||||||||||
| 159 | ; | - | ||||||||||||||||||
| 160 | return executed 249355 times by 1 test: ((return ((i > 1) ? 1 : 0);Executed by:
executed 249355 times by 1 test: return ((i > 1) ? 1 : 0);Executed by:
| 0-249355 | ||||||||||||||||||
| 161 | } | - | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | - | |||||||||||||||||||
| 164 | - | |||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | - | |||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 | static int pkey_set_type(EVP_PKEY *pkey, ENGINE *e, int type, const char *str, | - | ||||||||||||||||||
| 169 | int len) | - | ||||||||||||||||||
| 170 | { | - | ||||||||||||||||||
| 171 | const EVP_PKEY_ASN1_METHOD *ameth; | - | ||||||||||||||||||
| 172 | ENGINE **eptr = (
| 0-146230 | ||||||||||||||||||
| 173 | ((void *)0)
| 0-146230 | ||||||||||||||||||
| 174 | )
| 0-146230 | ||||||||||||||||||
| 175 | ((void *)0) | - | ||||||||||||||||||
| 176 | ; | - | ||||||||||||||||||
| 177 | - | |||||||||||||||||||
| 178 | if (pkey
| 0-146230 | ||||||||||||||||||
| 179 | if (pkey->pkey.ptr
| 590-145640 | ||||||||||||||||||
| 180 | EVP_PKEY_free_it(pkey); executed 590 times by 1 test: EVP_PKEY_free_it(pkey);Executed by:
| 590 | ||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | - | |||||||||||||||||||
| 183 | - | |||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | if ((
| 2072-96757 | ||||||||||||||||||
| 186 | return executed 47401 times by 1 test: 1;return 1;Executed by:
executed 47401 times by 1 test: return 1;Executed by:
| 47401 | ||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | ENGINE_finish(pkey->engine); | - | ||||||||||||||||||
| 190 | pkey->engine = | - | ||||||||||||||||||
| 191 | ((void *)0) | - | ||||||||||||||||||
| 192 | ; | - | ||||||||||||||||||
| 193 | ENGINE_finish(pkey->pmeth_engine); | - | ||||||||||||||||||
| 194 | pkey->pmeth_engine = | - | ||||||||||||||||||
| 195 | ((void *)0) | - | ||||||||||||||||||
| 196 | ; | - | ||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | } executed 98829 times by 1 test: end of blockExecuted by:
| 98829 | ||||||||||||||||||
| 199 | if (str
| 1-98828 | ||||||||||||||||||
| 200 | ameth = EVP_PKEY_asn1_find_str(eptr, str, len); executed 1 time by 1 test: ameth = EVP_PKEY_asn1_find_str(eptr, str, len);Executed by:
| 1 | ||||||||||||||||||
| 201 | else | - | ||||||||||||||||||
| 202 | ameth = EVP_PKEY_asn1_find(eptr, type); executed 98828 times by 1 test: ameth = EVP_PKEY_asn1_find(eptr, type);Executed by:
| 98828 | ||||||||||||||||||
| 203 | - | |||||||||||||||||||
| 204 | if (pkey ==
| 0-98829 | ||||||||||||||||||
| 205 | ((void *)0)
| 0-98829 | ||||||||||||||||||
| 206 | && eptr !=
| 0 | ||||||||||||||||||
| 207 | ((void *)0)
| 0 | ||||||||||||||||||
| 208 | ) | - | ||||||||||||||||||
| 209 | ENGINE_finish(e); never executed: ENGINE_finish(e); | 0 | ||||||||||||||||||
| 210 | - | |||||||||||||||||||
| 211 | if (ameth ==
| 2174-96655 | ||||||||||||||||||
| 212 | ((void *)0)
| 2174-96655 | ||||||||||||||||||
| 213 | ) { | - | ||||||||||||||||||
| 214 | ERR_put_error(6,(158),(156),__FILE__,210); | - | ||||||||||||||||||
| 215 | return executed 2174 times by 1 test: 0;return 0;Executed by:
executed 2174 times by 1 test: return 0;Executed by:
| 2174 | ||||||||||||||||||
| 216 | } | - | ||||||||||||||||||
| 217 | if (pkey
| 0-96655 | ||||||||||||||||||
| 218 | pkey->ameth = ameth; | - | ||||||||||||||||||
| 219 | pkey->engine = e; | - | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | pkey->type = pkey->ameth->pkey_id; | - | ||||||||||||||||||
| 222 | pkey->save_type = type; | - | ||||||||||||||||||
| 223 | } executed 96655 times by 1 test: end of blockExecuted by:
| 96655 | ||||||||||||||||||
| 224 | return executed 96655 times by 1 test: 1;return 1;Executed by:
executed 96655 times by 1 test: return 1;Executed by:
| 96655 | ||||||||||||||||||
| 225 | } | - | ||||||||||||||||||
| 226 | - | |||||||||||||||||||
| 227 | EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, | - | ||||||||||||||||||
| 228 | const unsigned char *priv, | - | ||||||||||||||||||
| 229 | size_t len) | - | ||||||||||||||||||
| 230 | { | - | ||||||||||||||||||
| 231 | EVP_PKEY *ret = EVP_PKEY_new(); | - | ||||||||||||||||||
| 232 | - | |||||||||||||||||||
| 233 | if (ret ==
| 0-16541 | ||||||||||||||||||
| 234 | ((void *)0)
| 0-16541 | ||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | || !pkey_set_type(ret, e, type,
| 0-16541 | ||||||||||||||||||
| 237 | ((void *)0)
| 0-16541 | ||||||||||||||||||
| 238 | , -1)
| 0-16541 | ||||||||||||||||||
| 239 | - | |||||||||||||||||||
| 240 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 241 | } | - | ||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | if (ret->ameth->set_priv_key ==
| 0-16541 | ||||||||||||||||||
| 244 | ((void *)0)
| 0-16541 | ||||||||||||||||||
| 245 | ) { | - | ||||||||||||||||||
| 246 | ERR_put_error(6,(191),(150),__FILE__,237) | - | ||||||||||||||||||
| 247 | ; | - | ||||||||||||||||||
| 248 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 249 | } | - | ||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | if (!ret->ameth->set_priv_key(ret, priv, len)
| 0-16541 | ||||||||||||||||||
| 252 | ERR_put_error(6,(191),(180),__FILE__,242); | - | ||||||||||||||||||
| 253 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 254 | } | - | ||||||||||||||||||
| 255 | - | |||||||||||||||||||
| 256 | return executed 16541 times by 1 test: ret;return ret;Executed by:
executed 16541 times by 1 test: return ret;Executed by:
| 16541 | ||||||||||||||||||
| 257 | - | |||||||||||||||||||
| 258 | err: | - | ||||||||||||||||||
| 259 | EVP_PKEY_free(ret); | - | ||||||||||||||||||
| 260 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 261 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 262 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 263 | } | - | ||||||||||||||||||
| 264 | - | |||||||||||||||||||
| 265 | EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, | - | ||||||||||||||||||
| 266 | const unsigned char *pub, | - | ||||||||||||||||||
| 267 | size_t len) | - | ||||||||||||||||||
| 268 | { | - | ||||||||||||||||||
| 269 | EVP_PKEY *ret = EVP_PKEY_new(); | - | ||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | if (ret ==
| 0-15 | ||||||||||||||||||
| 272 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | || !pkey_set_type(ret, e, type,
| 0-15 | ||||||||||||||||||
| 275 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 276 | , -1)
| 0-15 | ||||||||||||||||||
| 277 | - | |||||||||||||||||||
| 278 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 279 | } | - | ||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | if (ret->ameth->set_pub_key ==
| 0-15 | ||||||||||||||||||
| 282 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 283 | ) { | - | ||||||||||||||||||
| 284 | ERR_put_error(6,(192),(150),__FILE__,267) | - | ||||||||||||||||||
| 285 | ; | - | ||||||||||||||||||
| 286 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 287 | } | - | ||||||||||||||||||
| 288 | - | |||||||||||||||||||
| 289 | if (!ret->ameth->set_pub_key(ret, pub, len)
| 0-15 | ||||||||||||||||||
| 290 | ERR_put_error(6,(192),(180),__FILE__,272); | - | ||||||||||||||||||
| 291 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 292 | } | - | ||||||||||||||||||
| 293 | - | |||||||||||||||||||
| 294 | return executed 15 times by 1 test: ret;return ret;Executed by:
executed 15 times by 1 test: return ret;Executed by:
| 15 | ||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | err: | - | ||||||||||||||||||
| 297 | EVP_PKEY_free(ret); | - | ||||||||||||||||||
| 298 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 299 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 300 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 301 | } | - | ||||||||||||||||||
| 302 | - | |||||||||||||||||||
| 303 | int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, | - | ||||||||||||||||||
| 304 | size_t *len) | - | ||||||||||||||||||
| 305 | { | - | ||||||||||||||||||
| 306 | if (pkey->ameth->get_priv_key ==
| 0-8 | ||||||||||||||||||
| 307 | ((void *)0)
| 0-8 | ||||||||||||||||||
| 308 | ) { | - | ||||||||||||||||||
| 309 | ERR_put_error(6,(202),(150),__FILE__,288) | - | ||||||||||||||||||
| 310 | ; | - | ||||||||||||||||||
| 311 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 312 | } | - | ||||||||||||||||||
| 313 | - | |||||||||||||||||||
| 314 | if (!pkey->ameth->get_priv_key(pkey, priv, len)
| 0-8 | ||||||||||||||||||
| 315 | ERR_put_error(6,(202),(182),__FILE__,293); | - | ||||||||||||||||||
| 316 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 317 | } | - | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | return executed 8 times by 1 test: 1;return 1;Executed by:
executed 8 times by 1 test: return 1;Executed by:
| 8 | ||||||||||||||||||
| 320 | } | - | ||||||||||||||||||
| 321 | - | |||||||||||||||||||
| 322 | int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, | - | ||||||||||||||||||
| 323 | size_t *len) | - | ||||||||||||||||||
| 324 | { | - | ||||||||||||||||||
| 325 | if (pkey->ameth->get_pub_key ==
| 0-8 | ||||||||||||||||||
| 326 | ((void *)0)
| 0-8 | ||||||||||||||||||
| 327 | ) { | - | ||||||||||||||||||
| 328 | ERR_put_error(6,(203),(150),__FILE__,305) | - | ||||||||||||||||||
| 329 | ; | - | ||||||||||||||||||
| 330 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 331 | } | - | ||||||||||||||||||
| 332 | - | |||||||||||||||||||
| 333 | if (!pkey->ameth->get_pub_key(pkey, pub, len)
| 0-8 | ||||||||||||||||||
| 334 | ERR_put_error(6,(203),(182),__FILE__,310); | - | ||||||||||||||||||
| 335 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 336 | } | - | ||||||||||||||||||
| 337 | - | |||||||||||||||||||
| 338 | return executed 8 times by 1 test: 1;return 1;Executed by:
executed 8 times by 1 test: return 1;Executed by:
| 8 | ||||||||||||||||||
| 339 | } | - | ||||||||||||||||||
| 340 | - | |||||||||||||||||||
| 341 | EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, | - | ||||||||||||||||||
| 342 | size_t len, const EVP_CIPHER *cipher) | - | ||||||||||||||||||
| 343 | { | - | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | EVP_PKEY *ret = EVP_PKEY_new(); | - | ||||||||||||||||||
| 346 | CMAC_CTX *cmctx = CMAC_CTX_new(); | - | ||||||||||||||||||
| 347 | - | |||||||||||||||||||
| 348 | if (ret ==
| 0-4 | ||||||||||||||||||
| 349 | ((void *)0)
| 0-4 | ||||||||||||||||||
| 350 | - | |||||||||||||||||||
| 351 | || cmctx ==
| 0-4 | ||||||||||||||||||
| 352 | ((void *)0)
| 0-4 | ||||||||||||||||||
| 353 | - | |||||||||||||||||||
| 354 | || !pkey_set_type(ret, e, 894,
| 0-4 | ||||||||||||||||||
| 355 | ((void *)0)
| 0-4 | ||||||||||||||||||
| 356 | , -1)
| 0-4 | ||||||||||||||||||
| 357 | - | |||||||||||||||||||
| 358 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 359 | } | - | ||||||||||||||||||
| 360 | - | |||||||||||||||||||
| 361 | if (!CMAC_Init(cmctx, priv, len, cipher, e)
| 0-4 | ||||||||||||||||||
| 362 | ERR_put_error(6,(193),(180),__FILE__,332); | - | ||||||||||||||||||
| 363 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 364 | } | - | ||||||||||||||||||
| 365 | - | |||||||||||||||||||
| 366 | ret->pkey.ptr = cmctx; | - | ||||||||||||||||||
| 367 | return executed 4 times by 1 test: ret;return ret;Executed by:
executed 4 times by 1 test: return ret;Executed by:
| 4 | ||||||||||||||||||
| 368 | - | |||||||||||||||||||
| 369 | err: | - | ||||||||||||||||||
| 370 | EVP_PKEY_free(ret); | - | ||||||||||||||||||
| 371 | CMAC_CTX_free(cmctx); | - | ||||||||||||||||||
| 372 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 373 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 374 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 375 | - | |||||||||||||||||||
| 376 | - | |||||||||||||||||||
| 377 | - | |||||||||||||||||||
| 378 | - | |||||||||||||||||||
| 379 | - | |||||||||||||||||||
| 380 | } | - | ||||||||||||||||||
| 381 | - | |||||||||||||||||||
| 382 | int EVP_PKEY_set_type(EVP_PKEY *pkey, int type) | - | ||||||||||||||||||
| 383 | { | - | ||||||||||||||||||
| 384 | return executed 129669 times by 1 test: pkey_set_type(pkey, return pkey_set_type(pkey, ((void *)0) , type, ((void *)0) , -1);Executed by:
executed 129669 times by 1 test: return pkey_set_type(pkey, ((void *)0) , type, ((void *)0) , -1);Executed by:
| 129669 | ||||||||||||||||||
| 385 | ((void *)0) executed 129669 times by 1 test: return pkey_set_type(pkey, ((void *)0) , type, ((void *)0) , -1);Executed by:
| 129669 | ||||||||||||||||||
| 386 | , type, executed 129669 times by 1 test: return pkey_set_type(pkey, ((void *)0) , type, ((void *)0) , -1);Executed by:
| 129669 | ||||||||||||||||||
| 387 | ((void *)0) executed 129669 times by 1 test: return pkey_set_type(pkey, ((void *)0) , type, ((void *)0) , -1);Executed by:
| 129669 | ||||||||||||||||||
| 388 | , -1); executed 129669 times by 1 test: return pkey_set_type(pkey, ((void *)0) , type, ((void *)0) , -1);Executed by:
| 129669 | ||||||||||||||||||
| 389 | } | - | ||||||||||||||||||
| 390 | - | |||||||||||||||||||
| 391 | int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len) | - | ||||||||||||||||||
| 392 | { | - | ||||||||||||||||||
| 393 | return executed 1 time by 1 test: pkey_set_type(pkey, return pkey_set_type(pkey, ((void *)0) , 0, str, len);Executed by:
executed 1 time by 1 test: return pkey_set_type(pkey, ((void *)0) , 0, str, len);Executed by:
| 1 | ||||||||||||||||||
| 394 | ((void *)0) executed 1 time by 1 test: return pkey_set_type(pkey, ((void *)0) , 0, str, len);Executed by:
| 1 | ||||||||||||||||||
| 395 | , 0, str, len); executed 1 time by 1 test: return pkey_set_type(pkey, ((void *)0) , 0, str, len);Executed by:
| 1 | ||||||||||||||||||
| 396 | } | - | ||||||||||||||||||
| 397 | - | |||||||||||||||||||
| 398 | int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type) | - | ||||||||||||||||||
| 399 | { | - | ||||||||||||||||||
| 400 | if (pkey->type == type
| 0-3 | ||||||||||||||||||
| 401 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 402 | } | - | ||||||||||||||||||
| 403 | - | |||||||||||||||||||
| 404 | - | |||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | - | |||||||||||||||||||
| 407 | - | |||||||||||||||||||
| 408 | if (EVP_PKEY_type(type) != EVP_PKEY_base_id(pkey)
| 0-3 | ||||||||||||||||||
| 409 | ERR_put_error(6,(206),(156),__FILE__,371); | - | ||||||||||||||||||
| 410 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 411 | } | - | ||||||||||||||||||
| 412 | - | |||||||||||||||||||
| 413 | pkey->type = type; | - | ||||||||||||||||||
| 414 | return executed 3 times by 1 test: 1;return 1;Executed by:
executed 3 times by 1 test: return 1;Executed by:
| 3 | ||||||||||||||||||
| 415 | } | - | ||||||||||||||||||
| 416 | - | |||||||||||||||||||
| 417 | - | |||||||||||||||||||
| 418 | int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e) | - | ||||||||||||||||||
| 419 | { | - | ||||||||||||||||||
| 420 | if (e !=
| 0-2 | ||||||||||||||||||
| 421 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 422 | ) { | - | ||||||||||||||||||
| 423 | if (!ENGINE_init(e)
| 0-2 | ||||||||||||||||||
| 424 | ERR_put_error(6,(187),(38),__FILE__,384); | - | ||||||||||||||||||
| 425 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 426 | } | - | ||||||||||||||||||
| 427 | if (ENGINE_get_pkey_meth(e, pkey->type) ==
| 1 | ||||||||||||||||||
| 428 | ((void *)0)
| 1 | ||||||||||||||||||
| 429 | ) { | - | ||||||||||||||||||
| 430 | ENGINE_finish(e); | - | ||||||||||||||||||
| 431 | ERR_put_error(6,(187),(156),__FILE__,389); | - | ||||||||||||||||||
| 432 | return executed 1 time by 1 test: 0;return 0;Executed by:
executed 1 time by 1 test: return 0;Executed by:
| 1 | ||||||||||||||||||
| 433 | } | - | ||||||||||||||||||
| 434 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 435 | ENGINE_finish(pkey->pmeth_engine); | - | ||||||||||||||||||
| 436 | pkey->pmeth_engine = e; | - | ||||||||||||||||||
| 437 | return executed 1 time by 1 test: 1;return 1;Executed by:
executed 1 time by 1 test: return 1;Executed by:
| 1 | ||||||||||||||||||
| 438 | } | - | ||||||||||||||||||
| 439 | - | |||||||||||||||||||
| 440 | int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) | - | ||||||||||||||||||
| 441 | { | - | ||||||||||||||||||
| 442 | if (pkey ==
| 0-63914 | ||||||||||||||||||
| 443 | ((void *)0)
| 0-63914 | ||||||||||||||||||
| 444 | || !EVP_PKEY_set_type(pkey, type)
| 0-63914 | ||||||||||||||||||
| 445 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 446 | pkey->pkey.ptr = key; | - | ||||||||||||||||||
| 447 | return executed 63914 times by 1 test: (key != return (key != ((void *)0) );Executed by:
executed 63914 times by 1 test: return (key != ((void *)0) );Executed by:
| 63914 | ||||||||||||||||||
| 448 | ((void *)0) executed 63914 times by 1 test: return (key != ((void *)0) );Executed by:
| 63914 | ||||||||||||||||||
| 449 | ); executed 63914 times by 1 test: return (key != ((void *)0) );Executed by:
| 63914 | ||||||||||||||||||
| 450 | } | - | ||||||||||||||||||
| 451 | - | |||||||||||||||||||
| 452 | void *EVP_PKEY_get0(const EVP_PKEY *pkey) | - | ||||||||||||||||||
| 453 | { | - | ||||||||||||||||||
| 454 | return executed 20553 times by 1 test: pkey->pkey.ptr;return pkey->pkey.ptr;Executed by:
executed 20553 times by 1 test: return pkey->pkey.ptr;Executed by:
| 20553 | ||||||||||||||||||
| 455 | } | - | ||||||||||||||||||
| 456 | - | |||||||||||||||||||
| 457 | const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len) | - | ||||||||||||||||||
| 458 | { | - | ||||||||||||||||||
| 459 | ASN1_OCTET_STRING *os = | - | ||||||||||||||||||
| 460 | ((void *)0) | - | ||||||||||||||||||
| 461 | ; | - | ||||||||||||||||||
| 462 | if (pkey->type != 855
| 0 | ||||||||||||||||||
| 463 | ERR_put_error(6,(183),(174),__FILE__,415); | - | ||||||||||||||||||
| 464 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 465 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 466 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 467 | } | - | ||||||||||||||||||
| 468 | os = EVP_PKEY_get0(pkey); | - | ||||||||||||||||||
| 469 | *len = os->length; | - | ||||||||||||||||||
| 470 | return never executed: os->data;return os->data;never executed: return os->data; | 0 | ||||||||||||||||||
| 471 | } | - | ||||||||||||||||||
| 472 | - | |||||||||||||||||||
| 473 | - | |||||||||||||||||||
| 474 | const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len) | - | ||||||||||||||||||
| 475 | { | - | ||||||||||||||||||
| 476 | ASN1_OCTET_STRING *os = | - | ||||||||||||||||||
| 477 | ((void *)0) | - | ||||||||||||||||||
| 478 | ; | - | ||||||||||||||||||
| 479 | if (pkey->type != 1061
| 0 | ||||||||||||||||||
| 480 | ERR_put_error(6,(184),(164),__FILE__,428); | - | ||||||||||||||||||
| 481 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 482 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 483 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 484 | } | - | ||||||||||||||||||
| 485 | os = EVP_PKEY_get0(pkey); | - | ||||||||||||||||||
| 486 | *len = os->length; | - | ||||||||||||||||||
| 487 | return never executed: os->data;return os->data;never executed: return os->data; | 0 | ||||||||||||||||||
| 488 | } | - | ||||||||||||||||||
| 489 | - | |||||||||||||||||||
| 490 | - | |||||||||||||||||||
| 491 | - | |||||||||||||||||||
| 492 | const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len) | - | ||||||||||||||||||
| 493 | { | - | ||||||||||||||||||
| 494 | ASN1_OCTET_STRING *os = | - | ||||||||||||||||||
| 495 | ((void *)0) | - | ||||||||||||||||||
| 496 | ; | - | ||||||||||||||||||
| 497 | - | |||||||||||||||||||
| 498 | if (pkey->type != 1062
| 0-26 | ||||||||||||||||||
| 499 | ERR_put_error(6,(172),(175),__FILE__,443); | - | ||||||||||||||||||
| 500 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 501 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 502 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 503 | } | - | ||||||||||||||||||
| 504 | os = EVP_PKEY_get0(pkey); | - | ||||||||||||||||||
| 505 | *len = os->length; | - | ||||||||||||||||||
| 506 | return executed 26 times by 1 test: os->data;return os->data;Executed by:
executed 26 times by 1 test: return os->data;Executed by:
| 26 | ||||||||||||||||||
| 507 | } | - | ||||||||||||||||||
| 508 | - | |||||||||||||||||||
| 509 | - | |||||||||||||||||||
| 510 | - | |||||||||||||||||||
| 511 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key) | - | ||||||||||||||||||
| 512 | { | - | ||||||||||||||||||
| 513 | int ret = EVP_PKEY_assign((pkey),6, (char *)(key)); | - | ||||||||||||||||||
| 514 | if (ret
| 0-36 | ||||||||||||||||||
| 515 | RSA_up_ref(key); executed 36 times by 1 test: RSA_up_ref(key);Executed by:
| 36 | ||||||||||||||||||
| 516 | return executed 36 times by 1 test: ret;return ret;Executed by:
executed 36 times by 1 test: return ret;Executed by:
| 36 | ||||||||||||||||||
| 517 | } | - | ||||||||||||||||||
| 518 | - | |||||||||||||||||||
| 519 | RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) | - | ||||||||||||||||||
| 520 | { | - | ||||||||||||||||||
| 521 | if (pkey->type != 6
| 0-4575 | ||||||||||||||||||
| 522 | ERR_put_error(6,(121),(127),__FILE__,464); | - | ||||||||||||||||||
| 523 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 524 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 525 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 526 | } | - | ||||||||||||||||||
| 527 | return executed 4575 times by 1 test: pkey->pkey.rsa;return pkey->pkey.rsa;Executed by:
executed 4575 times by 1 test: return pkey->pkey.rsa;Executed by:
| 4575 | ||||||||||||||||||
| 528 | } | - | ||||||||||||||||||
| 529 | - | |||||||||||||||||||
| 530 | RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey) | - | ||||||||||||||||||
| 531 | { | - | ||||||||||||||||||
| 532 | RSA *ret = EVP_PKEY_get0_RSA(pkey); | - | ||||||||||||||||||
| 533 | if (ret !=
| 0-33 | ||||||||||||||||||
| 534 | ((void *)0)
| 0-33 | ||||||||||||||||||
| 535 | ) | - | ||||||||||||||||||
| 536 | RSA_up_ref(ret); executed 33 times by 1 test: RSA_up_ref(ret);Executed by:
| 33 | ||||||||||||||||||
| 537 | return executed 33 times by 1 test: ret;return ret;Executed by:
executed 33 times by 1 test: return ret;Executed by:
| 33 | ||||||||||||||||||
| 538 | } | - | ||||||||||||||||||
| 539 | - | |||||||||||||||||||
| 540 | - | |||||||||||||||||||
| 541 | - | |||||||||||||||||||
| 542 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key) | - | ||||||||||||||||||
| 543 | { | - | ||||||||||||||||||
| 544 | int ret = EVP_PKEY_assign((pkey),116, (char *)(key)); | - | ||||||||||||||||||
| 545 | if (ret
| 0-51 | ||||||||||||||||||
| 546 | DSA_up_ref(key); executed 51 times by 1 test: DSA_up_ref(key);Executed by:
| 51 | ||||||||||||||||||
| 547 | return executed 51 times by 1 test: ret;return ret;Executed by:
executed 51 times by 1 test: return ret;Executed by:
| 51 | ||||||||||||||||||
| 548 | } | - | ||||||||||||||||||
| 549 | - | |||||||||||||||||||
| 550 | DSA *EVP_PKEY_get0_DSA(EVP_PKEY *pkey) | - | ||||||||||||||||||
| 551 | { | - | ||||||||||||||||||
| 552 | if (pkey->type != 116
| 0-1827 | ||||||||||||||||||
| 553 | ERR_put_error(6,(120),(129),__FILE__,491); | - | ||||||||||||||||||
| 554 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 555 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 556 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 557 | } | - | ||||||||||||||||||
| 558 | return executed 1827 times by 1 test: pkey->pkey.dsa;return pkey->pkey.dsa;Executed by:
executed 1827 times by 1 test: return pkey->pkey.dsa;Executed by:
| 1827 | ||||||||||||||||||
| 559 | } | - | ||||||||||||||||||
| 560 | - | |||||||||||||||||||
| 561 | DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey) | - | ||||||||||||||||||
| 562 | { | - | ||||||||||||||||||
| 563 | DSA *ret = EVP_PKEY_get0_DSA(pkey); | - | ||||||||||||||||||
| 564 | if (ret !=
| 0-1819 | ||||||||||||||||||
| 565 | ((void *)0)
| 0-1819 | ||||||||||||||||||
| 566 | ) | - | ||||||||||||||||||
| 567 | DSA_up_ref(ret); executed 1819 times by 1 test: DSA_up_ref(ret);Executed by:
| 1819 | ||||||||||||||||||
| 568 | return executed 1819 times by 1 test: ret;return ret;Executed by:
executed 1819 times by 1 test: return ret;Executed by:
| 1819 | ||||||||||||||||||
| 569 | } | - | ||||||||||||||||||
| 570 | - | |||||||||||||||||||
| 571 | - | |||||||||||||||||||
| 572 | - | |||||||||||||||||||
| 573 | - | |||||||||||||||||||
| 574 | int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key) | - | ||||||||||||||||||
| 575 | { | - | ||||||||||||||||||
| 576 | int ret = EVP_PKEY_assign((pkey),408, (char *)(key)); | - | ||||||||||||||||||
| 577 | if (ret
| 0-17 | ||||||||||||||||||
| 578 | EC_KEY_up_ref(key); executed 17 times by 1 test: EC_KEY_up_ref(key);Executed by:
| 17 | ||||||||||||||||||
| 579 | return executed 17 times by 1 test: ret;return ret;Executed by:
executed 17 times by 1 test: return ret;Executed by:
| 17 | ||||||||||||||||||
| 580 | } | - | ||||||||||||||||||
| 581 | - | |||||||||||||||||||
| 582 | EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) | - | ||||||||||||||||||
| 583 | { | - | ||||||||||||||||||
| 584 | if (pkey->type != 408
| 0-7185 | ||||||||||||||||||
| 585 | ERR_put_error(6,(131),(142),__FILE__,519); | - | ||||||||||||||||||
| 586 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 587 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 588 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 589 | } | - | ||||||||||||||||||
| 590 | return executed 7185 times by 1 test: pkey->pkey.ec;return pkey->pkey.ec;Executed by:
executed 7185 times by 1 test: return pkey->pkey.ec;Executed by:
| 7185 | ||||||||||||||||||
| 591 | } | - | ||||||||||||||||||
| 592 | - | |||||||||||||||||||
| 593 | EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) | - | ||||||||||||||||||
| 594 | { | - | ||||||||||||||||||
| 595 | EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); | - | ||||||||||||||||||
| 596 | if (ret !=
| 0-1842 | ||||||||||||||||||
| 597 | ((void *)0)
| 0-1842 | ||||||||||||||||||
| 598 | ) | - | ||||||||||||||||||
| 599 | EC_KEY_up_ref(ret); executed 1842 times by 1 test: EC_KEY_up_ref(ret);Executed by:
| 1842 | ||||||||||||||||||
| 600 | return executed 1842 times by 1 test: ret;return ret;Executed by:
executed 1842 times by 1 test: return ret;Executed by:
| 1842 | ||||||||||||||||||
| 601 | } | - | ||||||||||||||||||
| 602 | - | |||||||||||||||||||
| 603 | - | |||||||||||||||||||
| 604 | - | |||||||||||||||||||
| 605 | - | |||||||||||||||||||
| 606 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key) | - | ||||||||||||||||||
| 607 | { | - | ||||||||||||||||||
| 608 | int ret = EVP_PKEY_assign((pkey),28, (char *)(key)); | - | ||||||||||||||||||
| 609 | if (ret
| 0-235 | ||||||||||||||||||
| 610 | DH_up_ref(key); executed 235 times by 1 test: DH_up_ref(key);Executed by:
| 235 | ||||||||||||||||||
| 611 | return executed 235 times by 1 test: ret;return ret;Executed by:
executed 235 times by 1 test: return ret;Executed by:
| 235 | ||||||||||||||||||
| 612 | } | - | ||||||||||||||||||
| 613 | - | |||||||||||||||||||
| 614 | DH *EVP_PKEY_get0_DH(EVP_PKEY *pkey) | - | ||||||||||||||||||
| 615 | { | - | ||||||||||||||||||
| 616 | if (pkey->type != 28
| 0-274 | ||||||||||||||||||
| 617 | ERR_put_error(6,(119),(128),__FILE__,547); | - | ||||||||||||||||||
| 618 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 619 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 620 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 621 | } | - | ||||||||||||||||||
| 622 | return executed 274 times by 1 test: pkey->pkey.dh;return pkey->pkey.dh;Executed by:
executed 274 times by 1 test: return pkey->pkey.dh;Executed by:
| 274 | ||||||||||||||||||
| 623 | } | - | ||||||||||||||||||
| 624 | - | |||||||||||||||||||
| 625 | DH *EVP_PKEY_get1_DH(EVP_PKEY *pkey) | - | ||||||||||||||||||
| 626 | { | - | ||||||||||||||||||
| 627 | DH *ret = EVP_PKEY_get0_DH(pkey); | - | ||||||||||||||||||
| 628 | if (ret !=
| 0 | ||||||||||||||||||
| 629 | ((void *)0)
| 0 | ||||||||||||||||||
| 630 | ) | - | ||||||||||||||||||
| 631 | DH_up_ref(ret); never executed: DH_up_ref(ret); | 0 | ||||||||||||||||||
| 632 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 633 | } | - | ||||||||||||||||||
| 634 | - | |||||||||||||||||||
| 635 | - | |||||||||||||||||||
| 636 | int EVP_PKEY_type(int type) | - | ||||||||||||||||||
| 637 | { | - | ||||||||||||||||||
| 638 | int ret; | - | ||||||||||||||||||
| 639 | const EVP_PKEY_ASN1_METHOD *ameth; | - | ||||||||||||||||||
| 640 | ENGINE *e; | - | ||||||||||||||||||
| 641 | ameth = EVP_PKEY_asn1_find(&e, type); | - | ||||||||||||||||||
| 642 | if (ameth
| 0-1373 | ||||||||||||||||||
| 643 | ret = ameth->pkey_id; executed 1373 times by 1 test: ret = ameth->pkey_id;Executed by:
| 1373 | ||||||||||||||||||
| 644 | else | - | ||||||||||||||||||
| 645 | ret = 0; never executed: ret = 0; | 0 | ||||||||||||||||||
| 646 | - | |||||||||||||||||||
| 647 | ENGINE_finish(e); | - | ||||||||||||||||||
| 648 | - | |||||||||||||||||||
| 649 | return executed 1373 times by 1 test: ret;return ret;Executed by:
executed 1373 times by 1 test: return ret;Executed by:
| 1373 | ||||||||||||||||||
| 650 | } | - | ||||||||||||||||||
| 651 | - | |||||||||||||||||||
| 652 | int EVP_PKEY_id(const EVP_PKEY *pkey) | - | ||||||||||||||||||
| 653 | { | - | ||||||||||||||||||
| 654 | return executed 38125 times by 1 test: pkey->type;return pkey->type;Executed by:
executed 38125 times by 1 test: return pkey->type;Executed by:
| 38125 | ||||||||||||||||||
| 655 | } | - | ||||||||||||||||||
| 656 | - | |||||||||||||||||||
| 657 | int EVP_PKEY_base_id(const EVP_PKEY *pkey) | - | ||||||||||||||||||
| 658 | { | - | ||||||||||||||||||
| 659 | return executed 4 times by 1 test: EVP_PKEY_type(pkey->type);return EVP_PKEY_type(pkey->type);Executed by:
executed 4 times by 1 test: return EVP_PKEY_type(pkey->type);Executed by:
| 4 | ||||||||||||||||||
| 660 | } | - | ||||||||||||||||||
| 661 | - | |||||||||||||||||||
| 662 | void EVP_PKEY_free(EVP_PKEY *x) | - | ||||||||||||||||||
| 663 | { | - | ||||||||||||||||||
| 664 | int i; | - | ||||||||||||||||||
| 665 | - | |||||||||||||||||||
| 666 | if (x ==
| 348152-624970 | ||||||||||||||||||
| 667 | ((void *)0)
| 348152-624970 | ||||||||||||||||||
| 668 | ) | - | ||||||||||||||||||
| 669 | return; executed 624970 times by 1 test: return;Executed by:
| 624970 | ||||||||||||||||||
| 670 | - | |||||||||||||||||||
| 671 | CRYPTO_DOWN_REF(&x->references, &i, x->lock); | - | ||||||||||||||||||
| 672 | ; | - | ||||||||||||||||||
| 673 | if (i > 0
| 98797-249355 | ||||||||||||||||||
| 674 | return; executed 249355 times by 1 test: return;Executed by:
| 249355 | ||||||||||||||||||
| 675 | ; | - | ||||||||||||||||||
| 676 | EVP_PKEY_free_it(x); | - | ||||||||||||||||||
| 677 | CRYPTO_THREAD_lock_free(x->lock); | - | ||||||||||||||||||
| 678 | sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free); | - | ||||||||||||||||||
| 679 | CRYPTO_free(x, __FILE__, 603); | - | ||||||||||||||||||
| 680 | } executed 98797 times by 1 test: end of blockExecuted by:
| 98797 | ||||||||||||||||||
| 681 | - | |||||||||||||||||||
| 682 | static void EVP_PKEY_free_it(EVP_PKEY *x) | - | ||||||||||||||||||
| 683 | { | - | ||||||||||||||||||
| 684 | - | |||||||||||||||||||
| 685 | if (x->ameth
| 0-97204 | ||||||||||||||||||
| 686 | x->ameth->pkey_free(x); | - | ||||||||||||||||||
| 687 | x->pkey.ptr = | - | ||||||||||||||||||
| 688 | ((void *)0) | - | ||||||||||||||||||
| 689 | ; | - | ||||||||||||||||||
| 690 | } executed 97204 times by 1 test: end of blockExecuted by:
| 97204 | ||||||||||||||||||
| 691 | - | |||||||||||||||||||
| 692 | ENGINE_finish(x->engine); | - | ||||||||||||||||||
| 693 | x->engine = | - | ||||||||||||||||||
| 694 | ((void *)0) | - | ||||||||||||||||||
| 695 | ; | - | ||||||||||||||||||
| 696 | ENGINE_finish(x->pmeth_engine); | - | ||||||||||||||||||
| 697 | x->pmeth_engine = | - | ||||||||||||||||||
| 698 | ((void *)0) | - | ||||||||||||||||||
| 699 | ; | - | ||||||||||||||||||
| 700 | - | |||||||||||||||||||
| 701 | } executed 99387 times by 1 test: end of blockExecuted by:
| 99387 | ||||||||||||||||||
| 702 | - | |||||||||||||||||||
| 703 | static int unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent, | - | ||||||||||||||||||
| 704 | const char *kstr) | - | ||||||||||||||||||
| 705 | { | - | ||||||||||||||||||
| 706 | BIO_indent(out, indent, 128); | - | ||||||||||||||||||
| 707 | BIO_printf(out, "%s algorithm \"%s\" unsupported\n", | - | ||||||||||||||||||
| 708 | kstr, OBJ_nid2ln(pkey->type)); | - | ||||||||||||||||||
| 709 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 710 | } | - | ||||||||||||||||||
| 711 | - | |||||||||||||||||||
| 712 | int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, | - | ||||||||||||||||||
| 713 | int indent, ASN1_PCTX *pctx) | - | ||||||||||||||||||
| 714 | { | - | ||||||||||||||||||
| 715 | if (pkey->ameth
| 0-244 | ||||||||||||||||||
| 716 | return executed 244 times by 1 test: pkey->ameth->pub_print(out, pkey, indent, pctx);return pkey->ameth->pub_print(out, pkey, indent, pctx);Executed by:
executed 244 times by 1 test: return pkey->ameth->pub_print(out, pkey, indent, pctx);Executed by:
| 244 | ||||||||||||||||||
| 717 | - | |||||||||||||||||||
| 718 | return never executed: unsup_alg(out, pkey, indent, "Public Key");return unsup_alg(out, pkey, indent, "Public Key");never executed: return unsup_alg(out, pkey, indent, "Public Key"); | 0 | ||||||||||||||||||
| 719 | } | - | ||||||||||||||||||
| 720 | - | |||||||||||||||||||
| 721 | int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, | - | ||||||||||||||||||
| 722 | int indent, ASN1_PCTX *pctx) | - | ||||||||||||||||||
| 723 | { | - | ||||||||||||||||||
| 724 | if (pkey->ameth
| 0-116 | ||||||||||||||||||
| 725 | return executed 116 times by 1 test: pkey->ameth->priv_print(out, pkey, indent, pctx);return pkey->ameth->priv_print(out, pkey, indent, pctx);Executed by:
executed 116 times by 1 test: return pkey->ameth->priv_print(out, pkey, indent, pctx);Executed by:
| 116 | ||||||||||||||||||
| 726 | - | |||||||||||||||||||
| 727 | return never executed: unsup_alg(out, pkey, indent, "Private Key");return unsup_alg(out, pkey, indent, "Private Key");never executed: return unsup_alg(out, pkey, indent, "Private Key"); | 0 | ||||||||||||||||||
| 728 | } | - | ||||||||||||||||||
| 729 | - | |||||||||||||||||||
| 730 | int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, | - | ||||||||||||||||||
| 731 | int indent, ASN1_PCTX *pctx) | - | ||||||||||||||||||
| 732 | { | - | ||||||||||||||||||
| 733 | if (pkey->ameth
| 0-13 | ||||||||||||||||||
| 734 | return executed 13 times by 1 test: pkey->ameth->param_print(out, pkey, indent, pctx);return pkey->ameth->param_print(out, pkey, indent, pctx);Executed by:
executed 13 times by 1 test: return pkey->ameth->param_print(out, pkey, indent, pctx);Executed by:
| 13 | ||||||||||||||||||
| 735 | return never executed: unsup_alg(out, pkey, indent, "Parameters");return unsup_alg(out, pkey, indent, "Parameters");never executed: return unsup_alg(out, pkey, indent, "Parameters"); | 0 | ||||||||||||||||||
| 736 | } | - | ||||||||||||||||||
| 737 | - | |||||||||||||||||||
| 738 | static int evp_pkey_asn1_ctrl(EVP_PKEY *pkey, int op, int arg1, void *arg2) | - | ||||||||||||||||||
| 739 | { | - | ||||||||||||||||||
| 740 | if (pkey->ameth ==
| 0-10282 | ||||||||||||||||||
| 741 | ((void *)0)
| 0-10282 | ||||||||||||||||||
| 742 | || pkey->ameth->pkey_ctrl ==
| 0-10282 | ||||||||||||||||||
| 743 | ((void *)0)
| 0-10282 | ||||||||||||||||||
| 744 | ) | - | ||||||||||||||||||
| 745 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||
| 746 | return executed 10282 times by 1 test: pkey->ameth->pkey_ctrl(pkey, op, arg1, arg2);return pkey->ameth->pkey_ctrl(pkey, op, arg1, arg2);Executed by:
executed 10282 times by 1 test: return pkey->ameth->pkey_ctrl(pkey, op, arg1, arg2);Executed by:
| 10282 | ||||||||||||||||||
| 747 | } | - | ||||||||||||||||||
| 748 | - | |||||||||||||||||||
| 749 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid) | - | ||||||||||||||||||
| 750 | { | - | ||||||||||||||||||
| 751 | return executed 104 times by 1 test: evp_pkey_asn1_ctrl(pkey, 0x3, 0, pnid);return evp_pkey_asn1_ctrl(pkey, 0x3, 0, pnid);Executed by:
executed 104 times by 1 test: return evp_pkey_asn1_ctrl(pkey, 0x3, 0, pnid);Executed by:
| 104 | ||||||||||||||||||
| 752 | } | - | ||||||||||||||||||
| 753 | - | |||||||||||||||||||
| 754 | int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, | - | ||||||||||||||||||
| 755 | const unsigned char *pt, size_t ptlen) | - | ||||||||||||||||||
| 756 | { | - | ||||||||||||||||||
| 757 | if (ptlen > 0x7fffffff
| 0-3528 | ||||||||||||||||||
| 758 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 759 | if (evp_pkey_asn1_ctrl(pkey, 0x9, ptlen,
| 72-3456 | ||||||||||||||||||
| 760 | (void *)pt) <= 0
| 72-3456 | ||||||||||||||||||
| 761 | return executed 72 times by 1 test: 0;return 0;Executed by:
executed 72 times by 1 test: return 0;Executed by:
| 72 | ||||||||||||||||||
| 762 | return executed 3456 times by 1 test: 1;return 1;Executed by:
executed 3456 times by 1 test: return 1;Executed by:
| 3456 | ||||||||||||||||||
| 763 | } | - | ||||||||||||||||||
| 764 | - | |||||||||||||||||||
| 765 | size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt) | - | ||||||||||||||||||
| 766 | { | - | ||||||||||||||||||
| 767 | int rv; | - | ||||||||||||||||||
| 768 | rv = evp_pkey_asn1_ctrl(pkey, 0xa, 0, ppt); | - | ||||||||||||||||||
| 769 | if (rv <= 0
| 0-6650 | ||||||||||||||||||
| 770 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 771 | return executed 6650 times by 1 test: rv;return rv;Executed by:
executed 6650 times by 1 test: return rv;Executed by:
| 6650 | ||||||||||||||||||
| 772 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |