| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/dsa/dsa_ameth.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | static int dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) | - | ||||||||||||||||||||||||
| 5 | { | - | ||||||||||||||||||||||||
| 6 | const unsigned char *p, *pm; | - | ||||||||||||||||||||||||
| 7 | int pklen, pmlen; | - | ||||||||||||||||||||||||
| 8 | int ptype; | - | ||||||||||||||||||||||||
| 9 | const void *pval; | - | ||||||||||||||||||||||||
| 10 | const ASN1_STRING *pstr; | - | ||||||||||||||||||||||||
| 11 | X509_ALGOR *palg; | - | ||||||||||||||||||||||||
| 12 | ASN1_INTEGER *public_key = | - | ||||||||||||||||||||||||
| 13 | ((void *)0) | - | ||||||||||||||||||||||||
| 14 | ; | - | ||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | DSA *dsa = | - | ||||||||||||||||||||||||
| 17 | ((void *)0) | - | ||||||||||||||||||||||||
| 18 | ; | - | ||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||
| 20 | if (!X509_PUBKEY_get0_param(
| 0-4251 | ||||||||||||||||||||||||
| 21 | ((void *)0)
| 0-4251 | ||||||||||||||||||||||||
| 22 | , &p, &pklen, &palg, pubkey)
| 0-4251 | ||||||||||||||||||||||||
| 23 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 24 | X509_ALGOR_get0( | - | ||||||||||||||||||||||||
| 25 | ((void *)0) | - | ||||||||||||||||||||||||
| 26 | , &ptype, &pval, palg); | - | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | if (ptype == 16
| 129-4122 | ||||||||||||||||||||||||
| 29 | pstr = pval; | - | ||||||||||||||||||||||||
| 30 | pm = pstr->data; | - | ||||||||||||||||||||||||
| 31 | pmlen = pstr->length; | - | ||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | if ((
| 1666-2456 | ||||||||||||||||||||||||
| 34 | ((void *)0)
| 1666-2456 | ||||||||||||||||||||||||
| 35 | , &pm, pmlen)) ==
| 1666-2456 | ||||||||||||||||||||||||
| 36 | ((void *)0)
| 1666-2456 | ||||||||||||||||||||||||
| 37 | ) { | - | ||||||||||||||||||||||||
| 38 | ERR_put_error(10,(117),(104),__FILE__,42); | - | ||||||||||||||||||||||||
| 39 | goto executed 1666 times by 1 test: err;goto err;Executed by:
executed 1666 times by 1 test: goto err;Executed by:
| 1666 | ||||||||||||||||||||||||
| 40 | } | - | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | } executed 2456 times by 1 test: else if ((end of blockExecuted by:
| 5-2456 | ||||||||||||||||||||||||
| 43 | if ((
| 0-47 | ||||||||||||||||||||||||
| 44 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 45 | ) { | - | ||||||||||||||||||||||||
| 46 | ERR_put_error(10,(117),((1|64)),__FILE__,48); | - | ||||||||||||||||||||||||
| 47 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 48 | } | - | ||||||||||||||||||||||||
| 49 | } executed 47 times by 1 test: else {end of blockExecuted by:
| 47 | ||||||||||||||||||||||||
| 50 | ERR_put_error(10,(117),(105),__FILE__,52); | - | ||||||||||||||||||||||||
| 51 | goto executed 82 times by 1 test: err;goto err;Executed by:
executed 82 times by 1 test: goto err;Executed by:
| 82 | ||||||||||||||||||||||||
| 52 | } | - | ||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | if ((
| 125-2378 | ||||||||||||||||||||||||
| 55 | ((void *)0)
| 125-2378 | ||||||||||||||||||||||||
| 56 | , &p, pklen)) ==
| 125-2378 | ||||||||||||||||||||||||
| 57 | ((void *)0)
| 125-2378 | ||||||||||||||||||||||||
| 58 | ) { | - | ||||||||||||||||||||||||
| 59 | ERR_put_error(10,(117),(104),__FILE__,57); | - | ||||||||||||||||||||||||
| 60 | goto executed 125 times by 1 test: err;goto err;Executed by:
executed 125 times by 1 test: goto err;Executed by:
| 125 | ||||||||||||||||||||||||
| 61 | } | - | ||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | if ((
| 0-2378 | ||||||||||||||||||||||||
| 64 | ((void *)0)
| 0-2378 | ||||||||||||||||||||||||
| 65 | )) ==
| 0-2378 | ||||||||||||||||||||||||
| 66 | ((void *)0)
| 0-2378 | ||||||||||||||||||||||||
| 67 | ) { | - | ||||||||||||||||||||||||
| 68 | ERR_put_error(10,(117),(108),__FILE__,62); | - | ||||||||||||||||||||||||
| 69 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 70 | } | - | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | ASN1_INTEGER_free(public_key); | - | ||||||||||||||||||||||||
| 73 | EVP_PKEY_assign((pkey),116, (char *)(dsa)); | - | ||||||||||||||||||||||||
| 74 | return executed 2378 times by 1 test: 1;return 1;Executed by:
executed 2378 times by 1 test: return 1;Executed by:
| 2378 | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | err: | - | ||||||||||||||||||||||||
| 77 | ASN1_INTEGER_free(public_key); | - | ||||||||||||||||||||||||
| 78 | DSA_free(dsa); | - | ||||||||||||||||||||||||
| 79 | return executed 1873 times by 1 test: 0;return 0;Executed by:
executed 1873 times by 1 test: return 0;Executed by:
| 1873 | ||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | } | - | ||||||||||||||||||||||||
| 82 | - | |||||||||||||||||||||||||
| 83 | static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||
| 84 | { | - | ||||||||||||||||||||||||
| 85 | DSA *dsa; | - | ||||||||||||||||||||||||
| 86 | int ptype; | - | ||||||||||||||||||||||||
| 87 | unsigned char *penc = | - | ||||||||||||||||||||||||
| 88 | ((void *)0) | - | ||||||||||||||||||||||||
| 89 | ; | - | ||||||||||||||||||||||||
| 90 | int penclen; | - | ||||||||||||||||||||||||
| 91 | ASN1_STRING *str = | - | ||||||||||||||||||||||||
| 92 | ((void *)0) | - | ||||||||||||||||||||||||
| 93 | ; | - | ||||||||||||||||||||||||
| 94 | ASN1_INTEGER *pubint = | - | ||||||||||||||||||||||||
| 95 | ((void *)0) | - | ||||||||||||||||||||||||
| 96 | ; | - | ||||||||||||||||||||||||
| 97 | ASN1_OBJECT *aobj; | - | ||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | dsa = pkey->pkey.dsa; | - | ||||||||||||||||||||||||
| 100 | if (pkey->save_parameters
| 0-18 | ||||||||||||||||||||||||
| 101 | str = ASN1_STRING_new(); | - | ||||||||||||||||||||||||
| 102 | if (str ==
| 0-18 | ||||||||||||||||||||||||
| 103 | ((void *)0)
| 0-18 | ||||||||||||||||||||||||
| 104 | ) { | - | ||||||||||||||||||||||||
| 105 | ERR_put_error(10,(118),((1|64)),__FILE__,91); | - | ||||||||||||||||||||||||
| 106 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 107 | } | - | ||||||||||||||||||||||||
| 108 | str->length = i2d_DSAparams(dsa, &str->data); | - | ||||||||||||||||||||||||
| 109 | if (str->length <= 0
| 0-18 | ||||||||||||||||||||||||
| 110 | ERR_put_error(10,(118),((1|64)),__FILE__,96); | - | ||||||||||||||||||||||||
| 111 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 112 | } | - | ||||||||||||||||||||||||
| 113 | ptype = 16; | - | ||||||||||||||||||||||||
| 114 | } executed 18 times by 1 test: elseend of blockExecuted by:
| 18 | ||||||||||||||||||||||||
| 115 | ptype = -1; never executed: ptype = -1; | 0 | ||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||
| 117 | pubint = BN_to_ASN1_INTEGER(dsa->pub_key, | - | ||||||||||||||||||||||||
| 118 | ((void *)0) | - | ||||||||||||||||||||||||
| 119 | ); | - | ||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | if (pubint ==
| 0-18 | ||||||||||||||||||||||||
| 122 | ((void *)0)
| 0-18 | ||||||||||||||||||||||||
| 123 | ) { | - | ||||||||||||||||||||||||
| 124 | ERR_put_error(10,(118),((1|64)),__FILE__,106); | - | ||||||||||||||||||||||||
| 125 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 126 | } | - | ||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | penclen = i2d_ASN1_INTEGER(pubint, &penc); | - | ||||||||||||||||||||||||
| 129 | ASN1_INTEGER_free(pubint); | - | ||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | if (penclen <= 0
| 0-18 | ||||||||||||||||||||||||
| 132 | ERR_put_error(10,(118),((1|64)),__FILE__,114); | - | ||||||||||||||||||||||||
| 133 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 134 | } | - | ||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | aobj = OBJ_nid2obj(116); | - | ||||||||||||||||||||||||
| 137 | if (aobj ==
| 0-18 | ||||||||||||||||||||||||
| 138 | ((void *)0)
| 0-18 | ||||||||||||||||||||||||
| 139 | ) | - | ||||||||||||||||||||||||
| 140 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | if (X509_PUBKEY_set0_param(pk, aobj, ptype, str, penc, penclen)
| 0-18 | ||||||||||||||||||||||||
| 143 | return executed 18 times by 1 test: 1;return 1;Executed by:
executed 18 times by 1 test: return 1;Executed by:
| 18 | ||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||
| 145 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
| 146 | CRYPTO_free(penc, __FILE__, 126); | - | ||||||||||||||||||||||||
| 147 | ASN1_STRING_free(str); | - | ||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||
| 149 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 150 | } | - | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | static int dsa_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8) | - | ||||||||||||||||||||||||
| 158 | { | - | ||||||||||||||||||||||||
| 159 | const unsigned char *p, *pm; | - | ||||||||||||||||||||||||
| 160 | int pklen, pmlen; | - | ||||||||||||||||||||||||
| 161 | int ptype; | - | ||||||||||||||||||||||||
| 162 | const void *pval; | - | ||||||||||||||||||||||||
| 163 | const ASN1_STRING *pstr; | - | ||||||||||||||||||||||||
| 164 | const X509_ALGOR *palg; | - | ||||||||||||||||||||||||
| 165 | ASN1_INTEGER *privkey = | - | ||||||||||||||||||||||||
| 166 | ((void *)0) | - | ||||||||||||||||||||||||
| 167 | ; | - | ||||||||||||||||||||||||
| 168 | BN_CTX *ctx = | - | ||||||||||||||||||||||||
| 169 | ((void *)0) | - | ||||||||||||||||||||||||
| 170 | ; | - | ||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||
| 172 | DSA *dsa = | - | ||||||||||||||||||||||||
| 173 | ((void *)0) | - | ||||||||||||||||||||||||
| 174 | ; | - | ||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | int ret = 0; | - | ||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | if (!PKCS8_pkey_get0(
| 0-50 | ||||||||||||||||||||||||
| 179 | ((void *)0)
| 0-50 | ||||||||||||||||||||||||
| 180 | , &p, &pklen, &palg, p8)
| 0-50 | ||||||||||||||||||||||||
| 181 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 182 | X509_ALGOR_get0( | - | ||||||||||||||||||||||||
| 183 | ((void *)0) | - | ||||||||||||||||||||||||
| 184 | , &ptype, &pval, palg); | - | ||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||
| 186 | if ((
| 1-49 | ||||||||||||||||||||||||
| 187 | ((void *)0)
| 1-49 | ||||||||||||||||||||||||
| 188 | , &p, pklen)) ==
| 1-49 | ||||||||||||||||||||||||
| 189 | ((void *)0)
| 1-49 | ||||||||||||||||||||||||
| 190 | ) | - | ||||||||||||||||||||||||
| 191 | goto executed 1 time by 1 test: decerr;goto decerr;Executed by:
executed 1 time by 1 test: goto decerr;Executed by:
| 1 | ||||||||||||||||||||||||
| 192 | if (privkey->type == (2 | 0x100)
| 1-48 | ||||||||||||||||||||||||
| 193 | goto executed 2 times by 1 test: decerr;goto decerr;Executed by:
executed 2 times by 1 test: goto decerr;Executed by:
| 2 | ||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | pstr = pval; | - | ||||||||||||||||||||||||
| 196 | pm = pstr->data; | - | ||||||||||||||||||||||||
| 197 | pmlen = pstr->length; | - | ||||||||||||||||||||||||
| 198 | if ((
| 1-46 | ||||||||||||||||||||||||
| 199 | ((void *)0)
| 1-46 | ||||||||||||||||||||||||
| 200 | , &pm, pmlen)) ==
| 1-46 | ||||||||||||||||||||||||
| 201 | ((void *)0)
| 1-46 | ||||||||||||||||||||||||
| 202 | ) | - | ||||||||||||||||||||||||
| 203 | goto executed 1 time by 1 test: decerr;goto decerr;Executed by:
executed 1 time by 1 test: goto decerr;Executed by:
| 1 | ||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | if ((
| 0-46 | ||||||||||||||||||||||||
| 206 | ((void *)0)
| 0-46 | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | || !ASN1_INTEGER_to_BN(privkey, dsa->priv_key)
| 0-46 | ||||||||||||||||||||||||
| 209 | ERR_put_error(10,(115),(109),__FILE__,169); | - | ||||||||||||||||||||||||
| 210 | goto never executed: dsaerr;goto dsaerr;never executed: goto dsaerr; | 0 | ||||||||||||||||||||||||
| 211 | } | - | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | if ((
| 0-46 | ||||||||||||||||||||||||
| 214 | ((void *)0)
| 0-46 | ||||||||||||||||||||||||
| 215 | ) { | - | ||||||||||||||||||||||||
| 216 | ERR_put_error(10,(115),((1|64)),__FILE__,174); | - | ||||||||||||||||||||||||
| 217 | goto never executed: dsaerr;goto dsaerr;never executed: goto dsaerr; | 0 | ||||||||||||||||||||||||
| 218 | } | - | ||||||||||||||||||||||||
| 219 | if ((
| 0-46 | ||||||||||||||||||||||||
| 220 | ((void *)0)
| 0-46 | ||||||||||||||||||||||||
| 221 | ) { | - | ||||||||||||||||||||||||
| 222 | ERR_put_error(10,(115),((1|64)),__FILE__,178); | - | ||||||||||||||||||||||||
| 223 | goto never executed: dsaerr;goto dsaerr;never executed: goto dsaerr; | 0 | ||||||||||||||||||||||||
| 224 | } | - | ||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | BN_set_flags(dsa->priv_key, 0x04); | - | ||||||||||||||||||||||||
| 227 | if (!BN_mod_exp(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, ctx)
| 0-46 | ||||||||||||||||||||||||
| 228 | ERR_put_error(10,(115),(109),__FILE__,184); | - | ||||||||||||||||||||||||
| 229 | goto never executed: dsaerr;goto dsaerr;never executed: goto dsaerr; | 0 | ||||||||||||||||||||||||
| 230 | } | - | ||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||
| 232 | EVP_PKEY_assign((pkey),116, (char *)(dsa)); | - | ||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||
| 234 | ret = 1; | - | ||||||||||||||||||||||||
| 235 | goto executed 46 times by 1 test: done;goto done;Executed by:
executed 46 times by 1 test: goto done;Executed by:
| 46 | ||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | decerr: | - | ||||||||||||||||||||||||
| 238 | ERR_put_error(10,(115),(104),__FILE__,194); | - | ||||||||||||||||||||||||
| 239 | dsaerr: code before this statement executed 4 times by 1 test: dsaerr:Executed by:
| 4 | ||||||||||||||||||||||||
| 240 | DSA_free(dsa); | - | ||||||||||||||||||||||||
| 241 | done: code before this statement executed 4 times by 1 test: done:Executed by:
| 4 | ||||||||||||||||||||||||
| 242 | BN_CTX_free(ctx); | - | ||||||||||||||||||||||||
| 243 | ASN1_STRING_clear_free(privkey); | - | ||||||||||||||||||||||||
| 244 | return executed 50 times by 1 test: ret;return ret;Executed by:
executed 50 times by 1 test: return ret;Executed by:
| 50 | ||||||||||||||||||||||||
| 245 | } | - | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||
| 248 | { | - | ||||||||||||||||||||||||
| 249 | ASN1_STRING *params = | - | ||||||||||||||||||||||||
| 250 | ((void *)0) | - | ||||||||||||||||||||||||
| 251 | ; | - | ||||||||||||||||||||||||
| 252 | ASN1_INTEGER *prkey = | - | ||||||||||||||||||||||||
| 253 | ((void *)0) | - | ||||||||||||||||||||||||
| 254 | ; | - | ||||||||||||||||||||||||
| 255 | unsigned char *dp = | - | ||||||||||||||||||||||||
| 256 | ((void *)0) | - | ||||||||||||||||||||||||
| 257 | ; | - | ||||||||||||||||||||||||
| 258 | int dplen; | - | ||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||
| 260 | if (!pkey->pkey.dsa
| 0-4 | ||||||||||||||||||||||||
| 261 | ERR_put_error(10,(116),(101),__FILE__,211); | - | ||||||||||||||||||||||||
| 262 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 263 | } | - | ||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | params = ASN1_STRING_new(); | - | ||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 | if (params ==
| 0-4 | ||||||||||||||||||||||||
| 268 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||
| 269 | ) { | - | ||||||||||||||||||||||||
| 270 | ERR_put_error(10,(116),((1|64)),__FILE__,218); | - | ||||||||||||||||||||||||
| 271 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 272 | } | - | ||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||
| 274 | params->length = i2d_DSAparams(pkey->pkey.dsa, ¶ms->data); | - | ||||||||||||||||||||||||
| 275 | if (params->length <= 0
| 0-4 | ||||||||||||||||||||||||
| 276 | ERR_put_error(10,(116),((1|64)),__FILE__,224); | - | ||||||||||||||||||||||||
| 277 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 278 | } | - | ||||||||||||||||||||||||
| 279 | params->type = 16; | - | ||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||
| 282 | prkey = BN_to_ASN1_INTEGER(pkey->pkey.dsa->priv_key, | - | ||||||||||||||||||||||||
| 283 | ((void *)0) | - | ||||||||||||||||||||||||
| 284 | ); | - | ||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||
| 286 | if (!prkey
| 0-4 | ||||||||||||||||||||||||
| 287 | ERR_put_error(10,(116),(109),__FILE__,233); | - | ||||||||||||||||||||||||
| 288 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 289 | } | - | ||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | dplen = i2d_ASN1_INTEGER(prkey, &dp); | - | ||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||
| 293 | ASN1_STRING_clear_free(prkey); | - | ||||||||||||||||||||||||
| 294 | prkey = | - | ||||||||||||||||||||||||
| 295 | ((void *)0) | - | ||||||||||||||||||||||||
| 296 | ; | - | ||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||
| 298 | if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(116), 0,
| 0-4 | ||||||||||||||||||||||||
| 299 | 16, params, dp, dplen)
| 0-4 | ||||||||||||||||||||||||
| 300 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 301 | - | |||||||||||||||||||||||||
| 302 | return executed 4 times by 1 test: 1;return 1;Executed by:
executed 4 times by 1 test: return 1;Executed by:
| 4 | ||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||
| 304 | err: | - | ||||||||||||||||||||||||
| 305 | CRYPTO_free(dp, __FILE__, 249); | - | ||||||||||||||||||||||||
| 306 | ASN1_STRING_free(params); | - | ||||||||||||||||||||||||
| 307 | ASN1_STRING_clear_free(prkey); | - | ||||||||||||||||||||||||
| 308 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 309 | } | - | ||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||
| 311 | static int int_dsa_size(const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||
| 312 | { | - | ||||||||||||||||||||||||
| 313 | return executed 368 times by 1 test: DSA_size(pkey->pkey.dsa);return DSA_size(pkey->pkey.dsa);Executed by:
executed 368 times by 1 test: return DSA_size(pkey->pkey.dsa);Executed by:
| 368 | ||||||||||||||||||||||||
| 314 | } | - | ||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | static int dsa_bits(const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||
| 317 | { | - | ||||||||||||||||||||||||
| 318 | return executed 18 times by 1 test: DSA_bits(pkey->pkey.dsa);return DSA_bits(pkey->pkey.dsa);Executed by:
executed 18 times by 1 test: return DSA_bits(pkey->pkey.dsa);Executed by:
| 18 | ||||||||||||||||||||||||
| 319 | } | - | ||||||||||||||||||||||||
| 320 | - | |||||||||||||||||||||||||
| 321 | static int dsa_security_bits(const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||
| 322 | { | - | ||||||||||||||||||||||||
| 323 | return executed 2017 times by 1 test: DSA_security_bits(pkey->pkey.dsa);return DSA_security_bits(pkey->pkey.dsa);Executed by:
executed 2017 times by 1 test: return DSA_security_bits(pkey->pkey.dsa);Executed by:
| 2017 | ||||||||||||||||||||||||
| 324 | } | - | ||||||||||||||||||||||||
| 325 | - | |||||||||||||||||||||||||
| 326 | static int dsa_missing_parameters(const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||
| 327 | { | - | ||||||||||||||||||||||||
| 328 | DSA *dsa; | - | ||||||||||||||||||||||||
| 329 | dsa = pkey->pkey.dsa; | - | ||||||||||||||||||||||||
| 330 | if (dsa ==
| 0-4546 | ||||||||||||||||||||||||
| 331 | ((void *)0)
| 0-4546 | ||||||||||||||||||||||||
| 332 | || dsa->p ==
| 0-4546 | ||||||||||||||||||||||||
| 333 | ((void *)0)
| 0-4546 | ||||||||||||||||||||||||
| 334 | || dsa->q ==
| 0-4546 | ||||||||||||||||||||||||
| 335 | ((void *)0)
| 0-4546 | ||||||||||||||||||||||||
| 336 | || dsa->g ==
| 0-4546 | ||||||||||||||||||||||||
| 337 | ((void *)0)
| 0-4546 | ||||||||||||||||||||||||
| 338 | ) | - | ||||||||||||||||||||||||
| 339 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 340 | return executed 4546 times by 1 test: 0;return 0;Executed by:
executed 4546 times by 1 test: return 0;Executed by:
| 4546 | ||||||||||||||||||||||||
| 341 | } | - | ||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 | static int dsa_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) | - | ||||||||||||||||||||||||
| 344 | { | - | ||||||||||||||||||||||||
| 345 | BIGNUM *a; | - | ||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | if (to->pkey.dsa ==
| 0 | ||||||||||||||||||||||||
| 348 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 349 | ) { | - | ||||||||||||||||||||||||
| 350 | to->pkey.dsa = DSA_new(); | - | ||||||||||||||||||||||||
| 351 | if (to->pkey.dsa ==
| 0 | ||||||||||||||||||||||||
| 352 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 353 | ) | - | ||||||||||||||||||||||||
| 354 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 355 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||
| 357 | if ((
| 0 | ||||||||||||||||||||||||
| 358 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 359 | ) | - | ||||||||||||||||||||||||
| 360 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 361 | BN_free(to->pkey.dsa->p); | - | ||||||||||||||||||||||||
| 362 | to->pkey.dsa->p = a; | - | ||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | if ((
| 0 | ||||||||||||||||||||||||
| 365 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 366 | ) | - | ||||||||||||||||||||||||
| 367 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 368 | BN_free(to->pkey.dsa->q); | - | ||||||||||||||||||||||||
| 369 | to->pkey.dsa->q = a; | - | ||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||
| 371 | if ((
| 0 | ||||||||||||||||||||||||
| 372 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 373 | ) | - | ||||||||||||||||||||||||
| 374 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 375 | BN_free(to->pkey.dsa->g); | - | ||||||||||||||||||||||||
| 376 | to->pkey.dsa->g = a; | - | ||||||||||||||||||||||||
| 377 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 378 | } | - | ||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||
| 380 | static int dsa_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) | - | ||||||||||||||||||||||||
| 381 | { | - | ||||||||||||||||||||||||
| 382 | if (BN_cmp(a->pkey.dsa->p, b->pkey.dsa->p)
| 0-4036 | ||||||||||||||||||||||||
| 383 | BN_cmp(a->pkey.dsa->q, b->pkey.dsa->q)
| 0-4036 | ||||||||||||||||||||||||
| 384 | BN_cmp(a->pkey.dsa->g, b->pkey.dsa->g)
| 0-4036 | ||||||||||||||||||||||||
| 385 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 386 | else | - | ||||||||||||||||||||||||
| 387 | return executed 4036 times by 1 test: 1;return 1;Executed by:
executed 4036 times by 1 test: return 1;Executed by:
| 4036 | ||||||||||||||||||||||||
| 388 | } | - | ||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||
| 390 | static int dsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) | - | ||||||||||||||||||||||||
| 391 | { | - | ||||||||||||||||||||||||
| 392 | if (BN_cmp(b->pkey.dsa->pub_key, a->pkey.dsa->pub_key) != 0
| 2-2037 | ||||||||||||||||||||||||
| 393 | return executed 2 times by 1 test: 0;return 0;Executed by:
executed 2 times by 1 test: return 0;Executed by:
| 2 | ||||||||||||||||||||||||
| 394 | else | - | ||||||||||||||||||||||||
| 395 | return executed 2037 times by 1 test: 1;return 1;Executed by:
executed 2037 times by 1 test: return 1;Executed by:
| 2037 | ||||||||||||||||||||||||
| 396 | } | - | ||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||
| 398 | static void int_dsa_free(EVP_PKEY *pkey) | - | ||||||||||||||||||||||||
| 399 | { | - | ||||||||||||||||||||||||
| 400 | DSA_free(pkey->pkey.dsa); | - | ||||||||||||||||||||||||
| 401 | } executed 8190 times by 1 test: end of blockExecuted by:
| 8190 | ||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||
| 403 | static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) | - | ||||||||||||||||||||||||
| 404 | { | - | ||||||||||||||||||||||||
| 405 | int ret = 0; | - | ||||||||||||||||||||||||
| 406 | const char *ktype = | - | ||||||||||||||||||||||||
| 407 | ((void *)0) | - | ||||||||||||||||||||||||
| 408 | ; | - | ||||||||||||||||||||||||
| 409 | const BIGNUM *priv_key, *pub_key; | - | ||||||||||||||||||||||||
| 410 | - | |||||||||||||||||||||||||
| 411 | if (ptype == 2
| 12-21 | ||||||||||||||||||||||||
| 412 | priv_key = x->priv_key; executed 12 times by 1 test: priv_key = x->priv_key;Executed by:
| 12 | ||||||||||||||||||||||||
| 413 | else | - | ||||||||||||||||||||||||
| 414 | priv_key = executed 21 times by 1 test: priv_key = ((void *)0) ;Executed by:
| 21 | ||||||||||||||||||||||||
| 415 | ((void *)0) executed 21 times by 1 test: priv_key = ((void *)0) ;Executed by:
| 21 | ||||||||||||||||||||||||
| 416 | ; executed 21 times by 1 test: priv_key = ((void *)0) ;Executed by:
| 21 | ||||||||||||||||||||||||
| 417 | - | |||||||||||||||||||||||||
| 418 | if (ptype > 0
| 13-20 | ||||||||||||||||||||||||
| 419 | pub_key = x->pub_key; executed 20 times by 1 test: pub_key = x->pub_key;Executed by:
| 20 | ||||||||||||||||||||||||
| 420 | else | - | ||||||||||||||||||||||||
| 421 | pub_key = executed 13 times by 1 test: pub_key = ((void *)0) ;Executed by:
| 13 | ||||||||||||||||||||||||
| 422 | ((void *)0) executed 13 times by 1 test: pub_key = ((void *)0) ;Executed by:
| 13 | ||||||||||||||||||||||||
| 423 | ; executed 13 times by 1 test: pub_key = ((void *)0) ;Executed by:
| 13 | ||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||
| 425 | if (ptype == 2
| 12-21 | ||||||||||||||||||||||||
| 426 | ktype = "Private-Key"; executed 12 times by 1 test: ktype = "Private-Key";Executed by:
| 12 | ||||||||||||||||||||||||
| 427 | else if (ptype == 1
| 8-13 | ||||||||||||||||||||||||
| 428 | ktype = "Public-Key"; executed 8 times by 1 test: ktype = "Public-Key";Executed by:
| 8 | ||||||||||||||||||||||||
| 429 | else | - | ||||||||||||||||||||||||
| 430 | ktype = "DSA-Parameters"; executed 13 times by 1 test: ktype = "DSA-Parameters";Executed by:
| 13 | ||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||
| 432 | if (priv_key
| 9-24 | ||||||||||||||||||||||||
| 433 | if (!BIO_indent(bp, off, 128)
| 0-9 | ||||||||||||||||||||||||
| 434 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 435 | if (BIO_printf(bp, "%s: (%d bit)\n", ktype, BN_num_bits(x->p))
| 0-9 | ||||||||||||||||||||||||
| 436 | <= 0
| 0-9 | ||||||||||||||||||||||||
| 437 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 438 | } executed 9 times by 1 test: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 | if (!ASN1_bn_print(bp, "priv:", priv_key,
| 0-33 | ||||||||||||||||||||||||
| 441 | ((void *)0)
| 0-33 | ||||||||||||||||||||||||
| 442 | , off)
| 0-33 | ||||||||||||||||||||||||
| 443 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 444 | if (!ASN1_bn_print(bp, "pub: ", pub_key,
| 0-33 | ||||||||||||||||||||||||
| 445 | ((void *)0)
| 0-33 | ||||||||||||||||||||||||
| 446 | , off)
| 0-33 | ||||||||||||||||||||||||
| 447 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 448 | if (!ASN1_bn_print(bp, "P: ", x->p,
| 0-33 | ||||||||||||||||||||||||
| 449 | ((void *)0)
| 0-33 | ||||||||||||||||||||||||
| 450 | , off)
| 0-33 | ||||||||||||||||||||||||
| 451 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 452 | if (!ASN1_bn_print(bp, "Q: ", x->q,
| 0-33 | ||||||||||||||||||||||||
| 453 | ((void *)0)
| 0-33 | ||||||||||||||||||||||||
| 454 | , off)
| 0-33 | ||||||||||||||||||||||||
| 455 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 456 | if (!ASN1_bn_print(bp, "G: ", x->g,
| 0-33 | ||||||||||||||||||||||||
| 457 | ((void *)0)
| 0-33 | ||||||||||||||||||||||||
| 458 | , off)
| 0-33 | ||||||||||||||||||||||||
| 459 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 460 | ret = 1; | - | ||||||||||||||||||||||||
| 461 | err: code before this statement executed 33 times by 1 test: err:Executed by:
| 33 | ||||||||||||||||||||||||
| 462 | return executed 33 times by 1 test: ret;return ret;Executed by:
executed 33 times by 1 test: return ret;Executed by:
| 33 | ||||||||||||||||||||||||
| 463 | } | - | ||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||
| 465 | static int dsa_param_decode(EVP_PKEY *pkey, | - | ||||||||||||||||||||||||
| 466 | const unsigned char **pder, int derlen) | - | ||||||||||||||||||||||||
| 467 | { | - | ||||||||||||||||||||||||
| 468 | DSA *dsa; | - | ||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||
| 470 | if ((
| 0 | ||||||||||||||||||||||||
| 471 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 472 | , pder, derlen)) ==
| 0 | ||||||||||||||||||||||||
| 473 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 474 | ) { | - | ||||||||||||||||||||||||
| 475 | ERR_put_error(10,(119),(10),__FILE__,381); | - | ||||||||||||||||||||||||
| 476 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 477 | } | - | ||||||||||||||||||||||||
| 478 | EVP_PKEY_assign((pkey),116, (char *)(dsa)); | - | ||||||||||||||||||||||||
| 479 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 480 | } | - | ||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||
| 482 | static int dsa_param_encode(const EVP_PKEY *pkey, unsigned char **pder) | - | ||||||||||||||||||||||||
| 483 | { | - | ||||||||||||||||||||||||
| 484 | return never executed: i2d_DSAparams(pkey->pkey.dsa, pder);return i2d_DSAparams(pkey->pkey.dsa, pder);never executed: return i2d_DSAparams(pkey->pkey.dsa, pder); | 0 | ||||||||||||||||||||||||
| 485 | } | - | ||||||||||||||||||||||||
| 486 | - | |||||||||||||||||||||||||
| 487 | static int dsa_param_print(BIO *bp, const EVP_PKEY *pkey, int indent, | - | ||||||||||||||||||||||||
| 488 | ASN1_PCTX *ctx) | - | ||||||||||||||||||||||||
| 489 | { | - | ||||||||||||||||||||||||
| 490 | return executed 13 times by 1 test: do_dsa_print(bp, pkey->pkey.dsa, indent, 0);return do_dsa_print(bp, pkey->pkey.dsa, indent, 0);Executed by:
executed 13 times by 1 test: return do_dsa_print(bp, pkey->pkey.dsa, indent, 0);Executed by:
| 13 | ||||||||||||||||||||||||
| 491 | } | - | ||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||
| 493 | static int dsa_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent, | - | ||||||||||||||||||||||||
| 494 | ASN1_PCTX *ctx) | - | ||||||||||||||||||||||||
| 495 | { | - | ||||||||||||||||||||||||
| 496 | return executed 8 times by 1 test: do_dsa_print(bp, pkey->pkey.dsa, indent, 1);return do_dsa_print(bp, pkey->pkey.dsa, indent, 1);Executed by:
executed 8 times by 1 test: return do_dsa_print(bp, pkey->pkey.dsa, indent, 1);Executed by:
| 8 | ||||||||||||||||||||||||
| 497 | } | - | ||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | static int dsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent, | - | ||||||||||||||||||||||||
| 500 | ASN1_PCTX *ctx) | - | ||||||||||||||||||||||||
| 501 | { | - | ||||||||||||||||||||||||
| 502 | return executed 12 times by 1 test: do_dsa_print(bp, pkey->pkey.dsa, indent, 2);return do_dsa_print(bp, pkey->pkey.dsa, indent, 2);Executed by:
executed 12 times by 1 test: return do_dsa_print(bp, pkey->pkey.dsa, indent, 2);Executed by:
| 12 | ||||||||||||||||||||||||
| 503 | } | - | ||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||
| 505 | static int old_dsa_priv_decode(EVP_PKEY *pkey, | - | ||||||||||||||||||||||||
| 506 | const unsigned char **pder, int derlen) | - | ||||||||||||||||||||||||
| 507 | { | - | ||||||||||||||||||||||||
| 508 | DSA *dsa; | - | ||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||
| 510 | if ((
| 29-2008 | ||||||||||||||||||||||||
| 511 | ((void *)0)
| 29-2008 | ||||||||||||||||||||||||
| 512 | , pder, derlen)) ==
| 29-2008 | ||||||||||||||||||||||||
| 513 | ((void *)0)
| 29-2008 | ||||||||||||||||||||||||
| 514 | ) { | - | ||||||||||||||||||||||||
| 515 | ERR_put_error(10,(122),(10),__FILE__,417); | - | ||||||||||||||||||||||||
| 516 | return executed 29 times by 1 test: 0;return 0;Executed by:
executed 29 times by 1 test: return 0;Executed by:
| 29 | ||||||||||||||||||||||||
| 517 | } | - | ||||||||||||||||||||||||
| 518 | EVP_PKEY_assign((pkey),116, (char *)(dsa)); | - | ||||||||||||||||||||||||
| 519 | return executed 2008 times by 1 test: 1;return 1;Executed by:
executed 2008 times by 1 test: return 1;Executed by:
| 2008 | ||||||||||||||||||||||||
| 520 | } | - | ||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||
| 522 | static int old_dsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder) | - | ||||||||||||||||||||||||
| 523 | { | - | ||||||||||||||||||||||||
| 524 | return executed 7 times by 1 test: i2d_DSAPrivateKey(pkey->pkey.dsa, pder);return i2d_DSAPrivateKey(pkey->pkey.dsa, pder);Executed by:
executed 7 times by 1 test: return i2d_DSAPrivateKey(pkey->pkey.dsa, pder);Executed by:
| 7 | ||||||||||||||||||||||||
| 525 | } | - | ||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, | - | ||||||||||||||||||||||||
| 528 | const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx) | - | ||||||||||||||||||||||||
| 529 | { | - | ||||||||||||||||||||||||
| 530 | DSA_SIG *dsa_sig; | - | ||||||||||||||||||||||||
| 531 | const unsigned char *p; | - | ||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||
| 533 | if (!sig
| 46-64 | ||||||||||||||||||||||||
| 534 | if (BIO_puts(bp, "\n") <= 0
| 0-46 | ||||||||||||||||||||||||
| 535 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 536 | else | - | ||||||||||||||||||||||||
| 537 | return executed 46 times by 1 test: 1;return 1;Executed by:
executed 46 times by 1 test: return 1;Executed by:
| 46 | ||||||||||||||||||||||||
| 538 | } | - | ||||||||||||||||||||||||
| 539 | p = sig->data; | - | ||||||||||||||||||||||||
| 540 | dsa_sig = d2i_DSA_SIG( | - | ||||||||||||||||||||||||
| 541 | ((void *)0) | - | ||||||||||||||||||||||||
| 542 | , &p, sig->length); | - | ||||||||||||||||||||||||
| 543 | if (dsa_sig
| 21-43 | ||||||||||||||||||||||||
| 544 | int rv = 0; | - | ||||||||||||||||||||||||
| 545 | const BIGNUM *r, *s; | - | ||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||
| 547 | DSA_SIG_get0(dsa_sig, &r, &s); | - | ||||||||||||||||||||||||
| 548 | - | |||||||||||||||||||||||||
| 549 | if (BIO_write(bp, "\n", 1) != 1
| 0-21 | ||||||||||||||||||||||||
| 550 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||
| 552 | if (!ASN1_bn_print(bp, "r: ", r,
| 0-21 | ||||||||||||||||||||||||
| 553 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
| 554 | , indent)
| 0-21 | ||||||||||||||||||||||||
| 555 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 556 | if (!ASN1_bn_print(bp, "s: ", s,
| 0-21 | ||||||||||||||||||||||||
| 557 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
| 558 | , indent)
| 0-21 | ||||||||||||||||||||||||
| 559 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 560 | rv = 1; | - | ||||||||||||||||||||||||
| 561 | err: code before this statement executed 21 times by 1 test: err:Executed by:
| 21 | ||||||||||||||||||||||||
| 562 | DSA_SIG_free(dsa_sig); | - | ||||||||||||||||||||||||
| 563 | return executed 21 times by 1 test: rv;return rv;Executed by:
executed 21 times by 1 test: return rv;Executed by:
| 21 | ||||||||||||||||||||||||
| 564 | } | - | ||||||||||||||||||||||||
| 565 | return executed 43 times by 1 test: X509_signature_dump(bp, sig, indent);return X509_signature_dump(bp, sig, indent);Executed by:
executed 43 times by 1 test: return X509_signature_dump(bp, sig, indent);Executed by:
| 43 | ||||||||||||||||||||||||
| 566 | } | - | ||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||
| 568 | static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | - | ||||||||||||||||||||||||
| 569 | { | - | ||||||||||||||||||||||||
| 570 | switch (op) { | - | ||||||||||||||||||||||||
| 571 | case executed 11 times by 1 test: 0x1:case 0x1:Executed by:
executed 11 times by 1 test: case 0x1:Executed by:
| 11 | ||||||||||||||||||||||||
| 572 | if (arg1 == 0
| 0-11 | ||||||||||||||||||||||||
| 573 | int snid, hnid; | - | ||||||||||||||||||||||||
| 574 | X509_ALGOR *alg1, *alg2; | - | ||||||||||||||||||||||||
| 575 | PKCS7_SIGNER_INFO_get0_algs(arg2, | - | ||||||||||||||||||||||||
| 576 | ((void *)0) | - | ||||||||||||||||||||||||
| 577 | , &alg1, &alg2); | - | ||||||||||||||||||||||||
| 578 | if (alg1 ==
| 0-11 | ||||||||||||||||||||||||
| 579 | ((void *)0)
| 0-11 | ||||||||||||||||||||||||
| 580 | || alg1->algorithm ==
| 0-11 | ||||||||||||||||||||||||
| 581 | ((void *)0)
| 0-11 | ||||||||||||||||||||||||
| 582 | ) | - | ||||||||||||||||||||||||
| 583 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 584 | hnid = OBJ_obj2nid(alg1->algorithm); | - | ||||||||||||||||||||||||
| 585 | if (hnid == 0
| 0-11 | ||||||||||||||||||||||||
| 586 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 587 | if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey))
| 0-11 | ||||||||||||||||||||||||
| 588 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 589 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), -1, 0); | - | ||||||||||||||||||||||||
| 590 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 591 | return executed 11 times by 1 test: 1;return 1;Executed by:
executed 11 times by 1 test: return 1;Executed by:
| 11 | ||||||||||||||||||||||||
| 592 | - | |||||||||||||||||||||||||
| 593 | case executed 54 times by 1 test: 0x5:case 0x5:Executed by:
executed 54 times by 1 test: case 0x5:Executed by:
| 54 | ||||||||||||||||||||||||
| 594 | if (arg1 == 0
| 26-28 | ||||||||||||||||||||||||
| 595 | int snid, hnid; | - | ||||||||||||||||||||||||
| 596 | X509_ALGOR *alg1, *alg2; | - | ||||||||||||||||||||||||
| 597 | CMS_SignerInfo_get0_algs(arg2, | - | ||||||||||||||||||||||||
| 598 | ((void *)0) | - | ||||||||||||||||||||||||
| 599 | , | - | ||||||||||||||||||||||||
| 600 | ((void *)0) | - | ||||||||||||||||||||||||
| 601 | , &alg1, &alg2); | - | ||||||||||||||||||||||||
| 602 | if (alg1 ==
| 0-26 | ||||||||||||||||||||||||
| 603 | ((void *)0)
| 0-26 | ||||||||||||||||||||||||
| 604 | || alg1->algorithm ==
| 0-26 | ||||||||||||||||||||||||
| 605 | ((void *)0)
| 0-26 | ||||||||||||||||||||||||
| 606 | ) | - | ||||||||||||||||||||||||
| 607 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 608 | hnid = OBJ_obj2nid(alg1->algorithm); | - | ||||||||||||||||||||||||
| 609 | if (hnid == 0
| 0-26 | ||||||||||||||||||||||||
| 610 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 611 | if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey))
| 0-26 | ||||||||||||||||||||||||
| 612 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 613 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), -1, 0); | - | ||||||||||||||||||||||||
| 614 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 615 | return executed 54 times by 1 test: 1;return 1;Executed by:
executed 54 times by 1 test: return 1;Executed by:
| 54 | ||||||||||||||||||||||||
| 616 | - | |||||||||||||||||||||||||
| 617 | case never executed: 0x8:case 0x8:never executed: case 0x8: | 0 | ||||||||||||||||||||||||
| 618 | *(int *)arg2 = -1; | - | ||||||||||||||||||||||||
| 619 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 620 | - | |||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | case executed 38 times by 1 test: 0x3:case 0x3:Executed by:
executed 38 times by 1 test: case 0x3:Executed by:
| 38 | ||||||||||||||||||||||||
| 623 | *(int *)arg2 = 672; | - | ||||||||||||||||||||||||
| 624 | return executed 38 times by 1 test: 2;return 2;Executed by:
executed 38 times by 1 test: return 2;Executed by:
| 38 | ||||||||||||||||||||||||
| 625 | - | |||||||||||||||||||||||||
| 626 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 627 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||||||||
| 628 | - | |||||||||||||||||||||||||
| 629 | } | - | ||||||||||||||||||||||||
| 630 | - | |||||||||||||||||||||||||
| 631 | } | - | ||||||||||||||||||||||||
| 632 | - | |||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||
| 635 | const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[5] = { | - | ||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||
| 637 | { | - | ||||||||||||||||||||||||
| 638 | 66, | - | ||||||||||||||||||||||||
| 639 | 116, | - | ||||||||||||||||||||||||
| 640 | 0x1}, | - | ||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||
| 642 | { | - | ||||||||||||||||||||||||
| 643 | 67, | - | ||||||||||||||||||||||||
| 644 | 116, | - | ||||||||||||||||||||||||
| 645 | 0x1}, | - | ||||||||||||||||||||||||
| 646 | - | |||||||||||||||||||||||||
| 647 | { | - | ||||||||||||||||||||||||
| 648 | 70, | - | ||||||||||||||||||||||||
| 649 | 116, | - | ||||||||||||||||||||||||
| 650 | 0x1}, | - | ||||||||||||||||||||||||
| 651 | - | |||||||||||||||||||||||||
| 652 | { | - | ||||||||||||||||||||||||
| 653 | 113, | - | ||||||||||||||||||||||||
| 654 | 116, | - | ||||||||||||||||||||||||
| 655 | 0x1}, | - | ||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||
| 657 | { | - | ||||||||||||||||||||||||
| 658 | 116, | - | ||||||||||||||||||||||||
| 659 | 116, | - | ||||||||||||||||||||||||
| 660 | 0, | - | ||||||||||||||||||||||||
| 661 | - | |||||||||||||||||||||||||
| 662 | "DSA", | - | ||||||||||||||||||||||||
| 663 | "OpenSSL DSA method", | - | ||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||
| 665 | dsa_pub_decode, | - | ||||||||||||||||||||||||
| 666 | dsa_pub_encode, | - | ||||||||||||||||||||||||
| 667 | dsa_pub_cmp, | - | ||||||||||||||||||||||||
| 668 | dsa_pub_print, | - | ||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||
| 670 | dsa_priv_decode, | - | ||||||||||||||||||||||||
| 671 | dsa_priv_encode, | - | ||||||||||||||||||||||||
| 672 | dsa_priv_print, | - | ||||||||||||||||||||||||
| 673 | - | |||||||||||||||||||||||||
| 674 | int_dsa_size, | - | ||||||||||||||||||||||||
| 675 | dsa_bits, | - | ||||||||||||||||||||||||
| 676 | dsa_security_bits, | - | ||||||||||||||||||||||||
| 677 | - | |||||||||||||||||||||||||
| 678 | dsa_param_decode, | - | ||||||||||||||||||||||||
| 679 | dsa_param_encode, | - | ||||||||||||||||||||||||
| 680 | dsa_missing_parameters, | - | ||||||||||||||||||||||||
| 681 | dsa_copy_parameters, | - | ||||||||||||||||||||||||
| 682 | dsa_cmp_parameters, | - | ||||||||||||||||||||||||
| 683 | dsa_param_print, | - | ||||||||||||||||||||||||
| 684 | dsa_sig_print, | - | ||||||||||||||||||||||||
| 685 | - | |||||||||||||||||||||||||
| 686 | int_dsa_free, | - | ||||||||||||||||||||||||
| 687 | dsa_pkey_ctrl, | - | ||||||||||||||||||||||||
| 688 | old_dsa_priv_decode, | - | ||||||||||||||||||||||||
| 689 | old_dsa_priv_encode} | - | ||||||||||||||||||||||||
| 690 | }; | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |