| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509/x_pubkey.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | struct X509_pubkey_st { | - | ||||||||||||
| 5 | X509_ALGOR *algor; | - | ||||||||||||
| 6 | ASN1_BIT_STRING *public_key; | - | ||||||||||||
| 7 | EVP_PKEY *pkey; | - | ||||||||||||
| 8 | }; | - | ||||||||||||
| 9 | - | |||||||||||||
| 10 | static int x509_pubkey_decode(EVP_PKEY **pk, X509_PUBKEY *key); | - | ||||||||||||
| 11 | - | |||||||||||||
| 12 | - | |||||||||||||
| 13 | static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | - | ||||||||||||
| 14 | void *exarg) | - | ||||||||||||
| 15 | { | - | ||||||||||||
| 16 | if (operation == 3
| 88289-416783 | ||||||||||||
| 17 | X509_PUBKEY *pubkey = (X509_PUBKEY *)*pval; | - | ||||||||||||
| 18 | EVP_PKEY_free(pubkey->pkey); | - | ||||||||||||
| 19 | } executed 88289 times by 1 test: else if (operation == 5end of blockExecuted by:
| 51686-365097 | ||||||||||||
| 20 | - | |||||||||||||
| 21 | X509_PUBKEY *pubkey = (X509_PUBKEY *)*pval; | - | ||||||||||||
| 22 | EVP_PKEY_free(pubkey->pkey); | - | ||||||||||||
| 23 | - | |||||||||||||
| 24 | - | |||||||||||||
| 25 | - | |||||||||||||
| 26 | - | |||||||||||||
| 27 | - | |||||||||||||
| 28 | ERR_set_mark(); | - | ||||||||||||
| 29 | if (x509_pubkey_decode(&pubkey->pkey, pubkey) == -1
| 0-51686 | ||||||||||||
| 30 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 31 | ERR_pop_to_mark(); | - | ||||||||||||
| 32 | } executed 51686 times by 1 test: end of blockExecuted by:
| 51686 | ||||||||||||
| 33 | return executed 505072 times by 1 test: 1;return 1;Executed by:
executed 505072 times by 1 test: return 1;Executed by:
| 505072 | ||||||||||||
| 34 | } | - | ||||||||||||
| 35 | - | |||||||||||||
| 36 | static const ASN1_AUX X509_PUBKEY_aux = { | - | ||||||||||||
| 37 | ((void *)0) | - | ||||||||||||
| 38 | , 0, 0, 0, pubkey_cb, 0}; static const ASN1_TEMPLATE X509_PUBKEY_seq_tt[] = { | - | ||||||||||||
| 39 | { (0), (0), | - | ||||||||||||
| 40 | __builtin_offsetof ( | - | ||||||||||||
| 41 | X509_PUBKEY | - | ||||||||||||
| 42 | , | - | ||||||||||||
| 43 | algor | - | ||||||||||||
| 44 | ) | - | ||||||||||||
| 45 | , "algor", (&(X509_ALGOR_it)) }, | - | ||||||||||||
| 46 | { (0), (0), | - | ||||||||||||
| 47 | __builtin_offsetof ( | - | ||||||||||||
| 48 | X509_PUBKEY | - | ||||||||||||
| 49 | , | - | ||||||||||||
| 50 | public_key | - | ||||||||||||
| 51 | ) | - | ||||||||||||
| 52 | , "public_key", (&(ASN1_BIT_STRING_it)) } | - | ||||||||||||
| 53 | } ; const ASN1_ITEM X509_PUBKEY_it = { 0x1, 16, X509_PUBKEY_seq_tt, sizeof(X509_PUBKEY_seq_tt) / sizeof(ASN1_TEMPLATE), &X509_PUBKEY_aux, sizeof(X509_PUBKEY), "X509_PUBKEY" }; | - | ||||||||||||
| 54 | - | |||||||||||||
| 55 | X509_PUBKEY *d2i_X509_PUBKEY(X509_PUBKEY **a, const unsigned char **in, long len) { return executed 15917 times by 1 test: (X509_PUBKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_PUBKEY_it)));return (X509_PUBKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_PUBKEY_it)));Executed by:
executed 15917 times by 1 test: } int i2d_X509_PUBKEY(X509_PUBKEY *a, unsigned char **out) { returnreturn (X509_PUBKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_PUBKEY_it)));Executed by:
executed 14788 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_PUBKEY_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_PUBKEY_it)));Executed by:
executed 14788 times by 1 test: } X509_PUBKEY *X509_PUBKEY_new(void) { returnreturn ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_PUBKEY_it)));Executed by:
executed 14781 times by 1 test: (X509_PUBKEY *)ASN1_item_new((&(X509_PUBKEY_it)));return (X509_PUBKEY *)ASN1_item_new((&(X509_PUBKEY_it)));Executed by:
executed 14781 times by 1 test: } void X509_PUBKEY_free(X509_PUBKEY *a) { ASN1_item_free((ASN1_VALUE *)a, (&(X509_PUBKEY_it))); }return (X509_PUBKEY *)ASN1_item_new((&(X509_PUBKEY_it)));Executed by:
executed 45457 times by 1 test: end of blockExecuted by:
| 14781-45457 | ||||||||||||
| 56 | - | |||||||||||||
| 57 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | - | ||||||||||||
| 58 | { | - | ||||||||||||
| 59 | X509_PUBKEY *pk = | - | ||||||||||||
| 60 | ((void *)0) | - | ||||||||||||
| 61 | ; | - | ||||||||||||
| 62 | - | |||||||||||||
| 63 | if (x ==
| 0-14781 | ||||||||||||
| 64 | ((void *)0)
| 0-14781 | ||||||||||||
| 65 | ) | - | ||||||||||||
| 66 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 67 | - | |||||||||||||
| 68 | if ((
| 0-14781 | ||||||||||||
| 69 | ((void *)0)
| 0-14781 | ||||||||||||
| 70 | ) | - | ||||||||||||
| 71 | goto never executed: error;goto error;never executed: goto error; | 0 | ||||||||||||
| 72 | - | |||||||||||||
| 73 | if (pkey->ameth
| 0-14781 | ||||||||||||
| 74 | if (pkey->ameth->pub_encode
| 0-14781 | ||||||||||||
| 75 | if (!pkey->ameth->pub_encode(pk, pkey)
| 0-14781 | ||||||||||||
| 76 | ERR_put_error(11,(120),(126),__FILE__,73) | - | ||||||||||||
| 77 | ; | - | ||||||||||||
| 78 | goto never executed: error;goto error;never executed: goto error; | 0 | ||||||||||||
| 79 | } | - | ||||||||||||
| 80 | } executed 14781 times by 1 test: else {end of blockExecuted by:
| 14781 | ||||||||||||
| 81 | ERR_put_error(11,(120),(124),__FILE__,77); | - | ||||||||||||
| 82 | goto never executed: error;goto error;never executed: goto error; | 0 | ||||||||||||
| 83 | } | - | ||||||||||||
| 84 | } else { | - | ||||||||||||
| 85 | ERR_put_error(11,(120),(111),__FILE__,81); | - | ||||||||||||
| 86 | goto never executed: error;goto error;never executed: goto error; | 0 | ||||||||||||
| 87 | } | - | ||||||||||||
| 88 | - | |||||||||||||
| 89 | X509_PUBKEY_free(*x); | - | ||||||||||||
| 90 | *x = pk; | - | ||||||||||||
| 91 | pk->pkey = pkey; | - | ||||||||||||
| 92 | EVP_PKEY_up_ref(pkey); | - | ||||||||||||
| 93 | return executed 14781 times by 1 test: 1;return 1;Executed by:
executed 14781 times by 1 test: return 1;Executed by:
| 14781 | ||||||||||||
| 94 | - | |||||||||||||
| 95 | error: | - | ||||||||||||
| 96 | X509_PUBKEY_free(pk); | - | ||||||||||||
| 97 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 98 | } | - | ||||||||||||
| 99 | static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key) | - | ||||||||||||
| 100 | { | - | ||||||||||||
| 101 | EVP_PKEY *pkey = EVP_PKEY_new(); | - | ||||||||||||
| 102 | - | |||||||||||||
| 103 | if (pkey ==
| 0-53097 | ||||||||||||
| 104 | ((void *)0)
| 0-53097 | ||||||||||||
| 105 | ) { | - | ||||||||||||
| 106 | ERR_put_error(11,(148),((1|64)),__FILE__,108); | - | ||||||||||||
| 107 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 108 | } | - | ||||||||||||
| 109 | - | |||||||||||||
| 110 | if (!EVP_PKEY_set_type(pkey, OBJ_obj2nid(key->algor->algorithm))
| 2173-50924 | ||||||||||||
| 111 | ERR_put_error(11,(148),(111),__FILE__,113); | - | ||||||||||||
| 112 | goto executed 2173 times by 1 test: error;goto error;Executed by:
executed 2173 times by 1 test: goto error;Executed by:
| 2173 | ||||||||||||
| 113 | } | - | ||||||||||||
| 114 | - | |||||||||||||
| 115 | if (pkey->ameth->pub_decode
| 0-50924 | ||||||||||||
| 116 | - | |||||||||||||
| 117 | - | |||||||||||||
| 118 | - | |||||||||||||
| 119 | - | |||||||||||||
| 120 | - | |||||||||||||
| 121 | if (!pkey->ameth->pub_decode(pkey, key)
| 13927-36997 | ||||||||||||
| 122 | ERR_put_error(11,(148),(125),__FILE__,124); | - | ||||||||||||
| 123 | goto executed 13927 times by 1 test: error;goto error;Executed by:
executed 13927 times by 1 test: goto error;Executed by:
| 13927 | ||||||||||||
| 124 | } | - | ||||||||||||
| 125 | } executed 36997 times by 1 test: else {end of blockExecuted by:
| 36997 | ||||||||||||
| 126 | ERR_put_error(11,(148),(124),__FILE__,128); | - | ||||||||||||
| 127 | goto never executed: error;goto error;never executed: goto error; | 0 | ||||||||||||
| 128 | } | - | ||||||||||||
| 129 | - | |||||||||||||
| 130 | *ppkey = pkey; | - | ||||||||||||
| 131 | return executed 36997 times by 1 test: 1;return 1;Executed by:
executed 36997 times by 1 test: return 1;Executed by:
| 36997 | ||||||||||||
| 132 | - | |||||||||||||
| 133 | error: | - | ||||||||||||
| 134 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 135 | return executed 16100 times by 1 test: 0;return 0;Executed by:
executed 16100 times by 1 test: return 0;Executed by:
| 16100 | ||||||||||||
| 136 | } | - | ||||||||||||
| 137 | - | |||||||||||||
| 138 | EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) | - | ||||||||||||
| 139 | { | - | ||||||||||||
| 140 | EVP_PKEY *ret = | - | ||||||||||||
| 141 | ((void *)0) | - | ||||||||||||
| 142 | ; | - | ||||||||||||
| 143 | - | |||||||||||||
| 144 | if (key ==
| 0-69485 | ||||||||||||
| 145 | ((void *)0)
| 0-69485 | ||||||||||||
| 146 | || key->public_key ==
| 0-69485 | ||||||||||||
| 147 | ((void *)0)
| 0-69485 | ||||||||||||
| 148 | ) | - | ||||||||||||
| 149 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 150 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 151 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 152 | - | |||||||||||||
| 153 | if (key->pkey !=
| 1411-68074 | ||||||||||||
| 154 | ((void *)0)
| 1411-68074 | ||||||||||||
| 155 | ) | - | ||||||||||||
| 156 | return executed 68074 times by 1 test: key->pkey;return key->pkey;Executed by:
executed 68074 times by 1 test: return key->pkey;Executed by:
| 68074 | ||||||||||||
| 157 | x509_pubkey_decode(&ret, key); | - | ||||||||||||
| 158 | - | |||||||||||||
| 159 | if (ret !=
| 0-1411 | ||||||||||||
| 160 | ((void *)0)
| 0-1411 | ||||||||||||
| 161 | ) { | - | ||||||||||||
| 162 | ERR_put_error(11,(119),((4|64)),__FILE__,161); | - | ||||||||||||
| 163 | EVP_PKEY_free(ret); | - | ||||||||||||
| 164 | } never executed: end of block | 0 | ||||||||||||
| 165 | - | |||||||||||||
| 166 | return executed 1411 times by 1 test: return ((void *)0) ;Executed by:
executed 1411 times by 1 test: return ((void *)0) ;Executed by:
| 1411 | ||||||||||||
| 167 | ((void *)0) executed 1411 times by 1 test: return ((void *)0) ;Executed by:
| 1411 | ||||||||||||
| 168 | ; executed 1411 times by 1 test: return ((void *)0) ;Executed by:
| 1411 | ||||||||||||
| 169 | } | - | ||||||||||||
| 170 | - | |||||||||||||
| 171 | EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) | - | ||||||||||||
| 172 | { | - | ||||||||||||
| 173 | EVP_PKEY *ret = X509_PUBKEY_get0(key); | - | ||||||||||||
| 174 | if (ret !=
| 0-15992 | ||||||||||||
| 175 | ((void *)0)
| 0-15992 | ||||||||||||
| 176 | ) | - | ||||||||||||
| 177 | EVP_PKEY_up_ref(ret); executed 15992 times by 1 test: EVP_PKEY_up_ref(ret);Executed by:
| 15992 | ||||||||||||
| 178 | return executed 15992 times by 1 test: ret;return ret;Executed by:
executed 15992 times by 1 test: return ret;Executed by:
| 15992 | ||||||||||||
| 179 | } | - | ||||||||||||
| 180 | - | |||||||||||||
| 181 | - | |||||||||||||
| 182 | - | |||||||||||||
| 183 | - | |||||||||||||
| 184 | - | |||||||||||||
| 185 | - | |||||||||||||
| 186 | EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length) | - | ||||||||||||
| 187 | { | - | ||||||||||||
| 188 | X509_PUBKEY *xpk; | - | ||||||||||||
| 189 | EVP_PKEY *pktmp; | - | ||||||||||||
| 190 | const unsigned char *q; | - | ||||||||||||
| 191 | q = *pp; | - | ||||||||||||
| 192 | xpk = d2i_X509_PUBKEY( | - | ||||||||||||
| 193 | ((void *)0) | - | ||||||||||||
| 194 | , &q, length); | - | ||||||||||||
| 195 | if (!xpk
| 0-15917 | ||||||||||||
| 196 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 197 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 198 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 199 | pktmp = X509_PUBKEY_get(xpk); | - | ||||||||||||
| 200 | X509_PUBKEY_free(xpk); | - | ||||||||||||
| 201 | if (!pktmp
| 0-15917 | ||||||||||||
| 202 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 203 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 204 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 205 | *pp = q; | - | ||||||||||||
| 206 | if (a
| 2-15915 | ||||||||||||
| 207 | EVP_PKEY_free(*a); | - | ||||||||||||
| 208 | *a = pktmp; | - | ||||||||||||
| 209 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 210 | return executed 15917 times by 1 test: pktmp;return pktmp;Executed by:
executed 15917 times by 1 test: return pktmp;Executed by:
| 15917 | ||||||||||||
| 211 | } | - | ||||||||||||
| 212 | - | |||||||||||||
| 213 | int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) | - | ||||||||||||
| 214 | { | - | ||||||||||||
| 215 | X509_PUBKEY *xpk = | - | ||||||||||||
| 216 | ((void *)0) | - | ||||||||||||
| 217 | ; | - | ||||||||||||
| 218 | int ret; | - | ||||||||||||
| 219 | if (!a
| 0-14741 | ||||||||||||
| 220 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 221 | if (!X509_PUBKEY_set(&xpk, a)
| 0-14741 | ||||||||||||
| 222 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 223 | ret = i2d_X509_PUBKEY(xpk, pp); | - | ||||||||||||
| 224 | X509_PUBKEY_free(xpk); | - | ||||||||||||
| 225 | return executed 14741 times by 1 test: ret;return ret;Executed by:
executed 14741 times by 1 test: return ret;Executed by:
| 14741 | ||||||||||||
| 226 | } | - | ||||||||||||
| 227 | - | |||||||||||||
| 228 | - | |||||||||||||
| 229 | - | |||||||||||||
| 230 | - | |||||||||||||
| 231 | - | |||||||||||||
| 232 | RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length) | - | ||||||||||||
| 233 | { | - | ||||||||||||
| 234 | EVP_PKEY *pkey; | - | ||||||||||||
| 235 | RSA *key; | - | ||||||||||||
| 236 | const unsigned char *q; | - | ||||||||||||
| 237 | q = *pp; | - | ||||||||||||
| 238 | pkey = d2i_PUBKEY( | - | ||||||||||||
| 239 | ((void *)0) | - | ||||||||||||
| 240 | , &q, length); | - | ||||||||||||
| 241 | if (!pkey
| 0 | ||||||||||||
| 242 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 243 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 244 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 245 | key = EVP_PKEY_get1_RSA(pkey); | - | ||||||||||||
| 246 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 247 | if (!key
| 0 | ||||||||||||
| 248 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 249 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 250 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 251 | *pp = q; | - | ||||||||||||
| 252 | if (a
| 0 | ||||||||||||
| 253 | RSA_free(*a); | - | ||||||||||||
| 254 | *a = key; | - | ||||||||||||
| 255 | } never executed: end of block | 0 | ||||||||||||
| 256 | return never executed: key;return key;never executed: return key; | 0 | ||||||||||||
| 257 | } | - | ||||||||||||
| 258 | - | |||||||||||||
| 259 | int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp) | - | ||||||||||||
| 260 | { | - | ||||||||||||
| 261 | EVP_PKEY *pktmp; | - | ||||||||||||
| 262 | int ret; | - | ||||||||||||
| 263 | if (!a
| 0-16 | ||||||||||||
| 264 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 265 | pktmp = EVP_PKEY_new(); | - | ||||||||||||
| 266 | if (pktmp ==
| 0-16 | ||||||||||||
| 267 | ((void *)0)
| 0-16 | ||||||||||||
| 268 | ) { | - | ||||||||||||
| 269 | ERR_put_error(13,(165),((1|64)),__FILE__,248); | - | ||||||||||||
| 270 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 271 | } | - | ||||||||||||
| 272 | EVP_PKEY_set1_RSA(pktmp, a); | - | ||||||||||||
| 273 | ret = i2d_PUBKEY(pktmp, pp); | - | ||||||||||||
| 274 | EVP_PKEY_free(pktmp); | - | ||||||||||||
| 275 | return executed 16 times by 1 test: ret;return ret;Executed by:
executed 16 times by 1 test: return ret;Executed by:
| 16 | ||||||||||||
| 276 | } | - | ||||||||||||
| 277 | - | |||||||||||||
| 278 | - | |||||||||||||
| 279 | - | |||||||||||||
| 280 | DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length) | - | ||||||||||||
| 281 | { | - | ||||||||||||
| 282 | EVP_PKEY *pkey; | - | ||||||||||||
| 283 | DSA *key; | - | ||||||||||||
| 284 | const unsigned char *q; | - | ||||||||||||
| 285 | q = *pp; | - | ||||||||||||
| 286 | pkey = d2i_PUBKEY( | - | ||||||||||||
| 287 | ((void *)0) | - | ||||||||||||
| 288 | , &q, length); | - | ||||||||||||
| 289 | if (!pkey
| 0 | ||||||||||||
| 290 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 291 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 292 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 293 | key = EVP_PKEY_get1_DSA(pkey); | - | ||||||||||||
| 294 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 295 | if (!key
| 0 | ||||||||||||
| 296 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 297 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 298 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 299 | *pp = q; | - | ||||||||||||
| 300 | if (a
| 0 | ||||||||||||
| 301 | DSA_free(*a); | - | ||||||||||||
| 302 | *a = key; | - | ||||||||||||
| 303 | } never executed: end of block | 0 | ||||||||||||
| 304 | return never executed: key;return key;never executed: return key; | 0 | ||||||||||||
| 305 | } | - | ||||||||||||
| 306 | - | |||||||||||||
| 307 | int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp) | - | ||||||||||||
| 308 | { | - | ||||||||||||
| 309 | EVP_PKEY *pktmp; | - | ||||||||||||
| 310 | int ret; | - | ||||||||||||
| 311 | if (!a
| 0-16 | ||||||||||||
| 312 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 313 | pktmp = EVP_PKEY_new(); | - | ||||||||||||
| 314 | if (pktmp ==
| 0-16 | ||||||||||||
| 315 | ((void *)0)
| 0-16 | ||||||||||||
| 316 | ) { | - | ||||||||||||
| 317 | ERR_put_error(13,(161),((1|64)),__FILE__,288); | - | ||||||||||||
| 318 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 319 | } | - | ||||||||||||
| 320 | EVP_PKEY_set1_DSA(pktmp, a); | - | ||||||||||||
| 321 | ret = i2d_PUBKEY(pktmp, pp); | - | ||||||||||||
| 322 | EVP_PKEY_free(pktmp); | - | ||||||||||||
| 323 | return executed 16 times by 1 test: ret;return ret;Executed by:
executed 16 times by 1 test: return ret;Executed by:
| 16 | ||||||||||||
| 324 | } | - | ||||||||||||
| 325 | - | |||||||||||||
| 326 | - | |||||||||||||
| 327 | - | |||||||||||||
| 328 | EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length) | - | ||||||||||||
| 329 | { | - | ||||||||||||
| 330 | EVP_PKEY *pkey; | - | ||||||||||||
| 331 | EC_KEY *key; | - | ||||||||||||
| 332 | const unsigned char *q; | - | ||||||||||||
| 333 | q = *pp; | - | ||||||||||||
| 334 | pkey = d2i_PUBKEY( | - | ||||||||||||
| 335 | ((void *)0) | - | ||||||||||||
| 336 | , &q, length); | - | ||||||||||||
| 337 | if (!pkey
| 0-7 | ||||||||||||
| 338 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 339 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 340 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 341 | key = EVP_PKEY_get1_EC_KEY(pkey); | - | ||||||||||||
| 342 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 343 | if (!key
| 0-7 | ||||||||||||
| 344 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 345 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 346 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 347 | *pp = q; | - | ||||||||||||
| 348 | if (a
| 0-7 | ||||||||||||
| 349 | EC_KEY_free(*a); | - | ||||||||||||
| 350 | *a = key; | - | ||||||||||||
| 351 | } never executed: end of block | 0 | ||||||||||||
| 352 | return executed 7 times by 1 test: key;return key;Executed by:
executed 7 times by 1 test: return key;Executed by:
| 7 | ||||||||||||
| 353 | } | - | ||||||||||||
| 354 | - | |||||||||||||
| 355 | int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp) | - | ||||||||||||
| 356 | { | - | ||||||||||||
| 357 | EVP_PKEY *pktmp; | - | ||||||||||||
| 358 | int ret; | - | ||||||||||||
| 359 | if (!a
| 0-12 | ||||||||||||
| 360 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 361 | if ((
| 0-12 | ||||||||||||
| 362 | ((void *)0)
| 0-12 | ||||||||||||
| 363 | ) { | - | ||||||||||||
| 364 | ERR_put_error(13,(181),((1|64)),__FILE__,327); | - | ||||||||||||
| 365 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 366 | } | - | ||||||||||||
| 367 | EVP_PKEY_set1_EC_KEY(pktmp, a); | - | ||||||||||||
| 368 | ret = i2d_PUBKEY(pktmp, pp); | - | ||||||||||||
| 369 | EVP_PKEY_free(pktmp); | - | ||||||||||||
| 370 | return executed 12 times by 1 test: ret;return ret;Executed by:
executed 12 times by 1 test: return ret;Executed by:
| 12 | ||||||||||||
| 371 | } | - | ||||||||||||
| 372 | - | |||||||||||||
| 373 | - | |||||||||||||
| 374 | int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, | - | ||||||||||||
| 375 | int ptype, void *pval, | - | ||||||||||||
| 376 | unsigned char *penc, int penclen) | - | ||||||||||||
| 377 | { | - | ||||||||||||
| 378 | if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval)
| 0-14781 | ||||||||||||
| 379 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 380 | if (penc
| 0-14781 | ||||||||||||
| 381 | CRYPTO_free(pub->public_key->data, __FILE__, 344); | - | ||||||||||||
| 382 | pub->public_key->data = penc; | - | ||||||||||||
| 383 | pub->public_key->length = penclen; | - | ||||||||||||
| 384 | - | |||||||||||||
| 385 | pub->public_key->flags &= ~(0x08 | 0x07); | - | ||||||||||||
| 386 | pub->public_key->flags |= 0x08; | - | ||||||||||||
| 387 | } executed 14781 times by 1 test: end of blockExecuted by:
| 14781 | ||||||||||||
| 388 | return executed 14781 times by 1 test: 1;return 1;Executed by:
executed 14781 times by 1 test: return 1;Executed by:
| 14781 | ||||||||||||
| 389 | } | - | ||||||||||||
| 390 | - | |||||||||||||
| 391 | int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, | - | ||||||||||||
| 392 | const unsigned char **pk, int *ppklen, | - | ||||||||||||
| 393 | X509_ALGOR **pa, X509_PUBKEY *pub) | - | ||||||||||||
| 394 | { | - | ||||||||||||
| 395 | if (ppkalg
| 1347-50932 | ||||||||||||
| 396 | * executed 1347 times by 1 test: ppkalg = pub->algor->algorithm;*ppkalg = pub->algor->algorithm;Executed by:
executed 1347 times by 1 test: *ppkalg = pub->algor->algorithm;Executed by:
| 1347 | ||||||||||||
| 397 | if (pk
| 1347-50932 | ||||||||||||
| 398 | *pk = pub->public_key->data; | - | ||||||||||||
| 399 | *ppklen = pub->public_key->length; | - | ||||||||||||
| 400 | } executed 50932 times by 1 test: end of blockExecuted by:
| 50932 | ||||||||||||
| 401 | if (pa
| 1355-50924 | ||||||||||||
| 402 | * executed 50924 times by 1 test: pa = pub->algor;*pa = pub->algor;Executed by:
executed 50924 times by 1 test: *pa = pub->algor;Executed by:
| 50924 | ||||||||||||
| 403 | return executed 52279 times by 1 test: 1;return 1;Executed by:
executed 52279 times by 1 test: return 1;Executed by:
| 52279 | ||||||||||||
| 404 | } | - | ||||||||||||
| 405 | - | |||||||||||||
| 406 | ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) | - | ||||||||||||
| 407 | { | - | ||||||||||||
| 408 | if (x ==
| 0-80 | ||||||||||||
| 409 | ((void *)0)
| 0-80 | ||||||||||||
| 410 | ) | - | ||||||||||||
| 411 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 412 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 413 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 414 | return executed 80 times by 1 test: x->cert_info.key->public_key;return x->cert_info.key->public_key;Executed by:
executed 80 times by 1 test: return x->cert_info.key->public_key;Executed by:
| 80 | ||||||||||||
| 415 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |