| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/pkcs7/pk7_doit.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | static int add_attribute(struct stack_st_X509_ATTRIBUTE **sk, int nid, int atrtype, | - | ||||||||||||||||||
| 4 | void *value); | - | ||||||||||||||||||
| 5 | static ASN1_TYPE *get_attribute(struct stack_st_X509_ATTRIBUTE *sk, int nid); | - | ||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | static int | - | ||||||||||||||||||
| 8 | PKCS7_type_is_other(PKCS7* p7) | - | ||||||||||||||||||
| 9 | { | - | ||||||||||||||||||
| 10 | int isOther = 1; | - | ||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | int nid = OBJ_obj2nid(p7->type); | - | ||||||||||||||||||
| 13 | - | |||||||||||||||||||
| 14 | switch (nid ) { | - | ||||||||||||||||||
| 15 | case never executed: 21:case 21:never executed: case 21: | 0 | ||||||||||||||||||
| 16 | case never executed: 22:case 22:never executed: case 22: | 0 | ||||||||||||||||||
| 17 | case never executed: 23:case 23:never executed: case 23: | 0 | ||||||||||||||||||
| 18 | case never executed: 24:case 24:never executed: case 24: | 0 | ||||||||||||||||||
| 19 | case never executed: 25:case 25:never executed: case 25: | 0 | ||||||||||||||||||
| 20 | case never executed: 26:case 26:never executed: case 26: | 0 | ||||||||||||||||||
| 21 | isOther = 0; | - | ||||||||||||||||||
| 22 | break; never executed: break; | 0 | ||||||||||||||||||
| 23 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 24 | isOther = 1; | - | ||||||||||||||||||
| 25 | } never executed: end of block | 0 | ||||||||||||||||||
| 26 | - | |||||||||||||||||||
| 27 | return never executed: isOther;return isOther;never executed: return isOther; | 0 | ||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | } | - | ||||||||||||||||||
| 30 | - | |||||||||||||||||||
| 31 | static ASN1_OCTET_STRING * | - | ||||||||||||||||||
| 32 | PKCS7_get_octet_string(PKCS7 *p7) | - | ||||||||||||||||||
| 33 | { | - | ||||||||||||||||||
| 34 | if ((
| 0-6 | ||||||||||||||||||
| 35 | return executed 6 times by 1 test: p7->d.data;return p7->d.data;Executed by:
executed 6 times by 1 test: return p7->d.data;Executed by:
| 6 | ||||||||||||||||||
| 36 | if (PKCS7_type_is_other(p7)
| 0 | ||||||||||||||||||
| 37 | (
| 0 | ||||||||||||||||||
| 38 | return never executed: p7->d.other->value.octet_string;return p7->d.other->value.octet_string;never executed: return p7->d.other->value.octet_string; | 0 | ||||||||||||||||||
| 39 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 40 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 41 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 42 | } | - | ||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | static int | - | ||||||||||||||||||
| 45 | PKCS7_bio_add_digest(BIO **pbio, X509_ALGOR *alg) | - | ||||||||||||||||||
| 46 | { | - | ||||||||||||||||||
| 47 | BIO *btmp; | - | ||||||||||||||||||
| 48 | const EVP_MD *md; | - | ||||||||||||||||||
| 49 | if ((
| 0-4 | ||||||||||||||||||
| 50 | ((void *)0)
| 0-4 | ||||||||||||||||||
| 51 | ) { | - | ||||||||||||||||||
| 52 | ERR_put_error(33,(0xfff),(32),__FILE__,113); | - | ||||||||||||||||||
| 53 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 54 | } | - | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | md = EVP_get_digestbyname(OBJ_nid2sn(OBJ_obj2nid(alg->algorithm))); | - | ||||||||||||||||||
| 57 | if (md ==
| 0-4 | ||||||||||||||||||
| 58 | ((void *)0)
| 0-4 | ||||||||||||||||||
| 59 | ) { | - | ||||||||||||||||||
| 60 | ERR_put_error(33,(0xfff),(109),__FILE__,119); | - | ||||||||||||||||||
| 61 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 62 | } | - | ||||||||||||||||||
| 63 | - | |||||||||||||||||||
| 64 | BIO_ctrl(btmp,111,0,(char *)md); | - | ||||||||||||||||||
| 65 | if (*
| 0-4 | ||||||||||||||||||
| 66 | ((void *)0)
| 0-4 | ||||||||||||||||||
| 67 | ) | - | ||||||||||||||||||
| 68 | * executed 4 times by 1 test: pbio = btmp;*pbio = btmp;Executed by:
executed 4 times by 1 test: *pbio = btmp;Executed by:
| 4 | ||||||||||||||||||
| 69 | else if (!BIO_push(*pbio, btmp)
| 0 | ||||||||||||||||||
| 70 | ERR_put_error(33,(0xfff),(32),__FILE__,127); | - | ||||||||||||||||||
| 71 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 72 | } | - | ||||||||||||||||||
| 73 | btmp = | - | ||||||||||||||||||
| 74 | ((void *)0) | - | ||||||||||||||||||
| 75 | ; | - | ||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | return executed 4 times by 1 test: 1;return 1;Executed by:
executed 4 times by 1 test: return 1;Executed by:
| 4 | ||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | err: | - | ||||||||||||||||||
| 80 | BIO_free(btmp); | - | ||||||||||||||||||
| 81 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 82 | - | |||||||||||||||||||
| 83 | } | - | ||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | static int | - | ||||||||||||||||||
| 86 | pkcs7_encode_rinfo(PKCS7_RECIP_INFO *ri, unsigned char *key, int keylen) | - | ||||||||||||||||||
| 87 | { | - | ||||||||||||||||||
| 88 | EVP_PKEY_CTX *pctx = | - | ||||||||||||||||||
| 89 | ((void *)0) | - | ||||||||||||||||||
| 90 | ; | - | ||||||||||||||||||
| 91 | EVP_PKEY *pkey = | - | ||||||||||||||||||
| 92 | ((void *)0) | - | ||||||||||||||||||
| 93 | ; | - | ||||||||||||||||||
| 94 | unsigned char *ek = | - | ||||||||||||||||||
| 95 | ((void *)0) | - | ||||||||||||||||||
| 96 | ; | - | ||||||||||||||||||
| 97 | int ret = 0; | - | ||||||||||||||||||
| 98 | size_t eklen; | - | ||||||||||||||||||
| 99 | - | |||||||||||||||||||
| 100 | pkey = X509_get_pubkey(ri->cert); | - | ||||||||||||||||||
| 101 | if (!pkey
| 0-1 | ||||||||||||||||||
| 102 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 103 | - | |||||||||||||||||||
| 104 | pctx = EVP_PKEY_CTX_new(pkey, | - | ||||||||||||||||||
| 105 | ((void *)0) | - | ||||||||||||||||||
| 106 | ); | - | ||||||||||||||||||
| 107 | if (!pctx
| 0-1 | ||||||||||||||||||
| 108 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | if (EVP_PKEY_encrypt_init(pctx) <= 0
| 0-1 | ||||||||||||||||||
| 111 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | if (EVP_PKEY_CTX_ctrl(pctx, -1, (1<<8),
| 0-1 | ||||||||||||||||||
| 114 | 3, 0, ri) <= 0
| 0-1 | ||||||||||||||||||
| 115 | ERR_put_error(33,(0xfff),(152),__FILE__,162); | - | ||||||||||||||||||
| 116 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 117 | } | - | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | if (EVP_PKEY_encrypt(pctx,
| 0-1 | ||||||||||||||||||
| 120 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 121 | , &eklen, key, keylen) <= 0
| 0-1 | ||||||||||||||||||
| 122 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 123 | - | |||||||||||||||||||
| 124 | ek = malloc(eklen); | - | ||||||||||||||||||
| 125 | - | |||||||||||||||||||
| 126 | if (ek ==
| 0-1 | ||||||||||||||||||
| 127 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 128 | ) { | - | ||||||||||||||||||
| 129 | ERR_put_error(33,(0xfff),((1|64)),__FILE__,172); | - | ||||||||||||||||||
| 130 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 131 | } | - | ||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | if (EVP_PKEY_encrypt(pctx, ek, &eklen, key, keylen) <= 0
| 0-1 | ||||||||||||||||||
| 134 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 135 | - | |||||||||||||||||||
| 136 | ASN1_STRING_set0(ri->enc_key, ek, eklen); | - | ||||||||||||||||||
| 137 | ek = | - | ||||||||||||||||||
| 138 | ((void *)0) | - | ||||||||||||||||||
| 139 | ; | - | ||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | ret = 1; | - | ||||||||||||||||||
| 142 | - | |||||||||||||||||||
| 143 | err: code before this statement executed 1 time by 1 test: err:Executed by:
| 1 | ||||||||||||||||||
| 144 | EVP_PKEY_free(pkey); | - | ||||||||||||||||||
| 145 | EVP_PKEY_CTX_free(pctx); | - | ||||||||||||||||||
| 146 | free(ek); | - | ||||||||||||||||||
| 147 | return executed 1 time by 1 test: ret;return ret;Executed by:
executed 1 time by 1 test: return ret;Executed by:
| 1 | ||||||||||||||||||
| 148 | } | - | ||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | static int | - | ||||||||||||||||||
| 152 | pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen, PKCS7_RECIP_INFO *ri, | - | ||||||||||||||||||
| 153 | EVP_PKEY *pkey) | - | ||||||||||||||||||
| 154 | { | - | ||||||||||||||||||
| 155 | EVP_PKEY_CTX *pctx = | - | ||||||||||||||||||
| 156 | ((void *)0) | - | ||||||||||||||||||
| 157 | ; | - | ||||||||||||||||||
| 158 | unsigned char *ek = | - | ||||||||||||||||||
| 159 | ((void *)0) | - | ||||||||||||||||||
| 160 | ; | - | ||||||||||||||||||
| 161 | size_t eklen; | - | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | int ret = -1; | - | ||||||||||||||||||
| 164 | - | |||||||||||||||||||
| 165 | pctx = EVP_PKEY_CTX_new(pkey, | - | ||||||||||||||||||
| 166 | ((void *)0) | - | ||||||||||||||||||
| 167 | ); | - | ||||||||||||||||||
| 168 | if (!pctx
| 0-1 | ||||||||||||||||||
| 169 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | if (EVP_PKEY_decrypt_init(pctx) <= 0
| 0-1 | ||||||||||||||||||
| 172 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | if (EVP_PKEY_CTX_ctrl(pctx, -1, (1<<9),
| 0-1 | ||||||||||||||||||
| 175 | 4, 0, ri) <= 0
| 0-1 | ||||||||||||||||||
| 176 | ERR_put_error(33,(0xfff),(152),__FILE__,211); | - | ||||||||||||||||||
| 177 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 178 | } | - | ||||||||||||||||||
| 179 | - | |||||||||||||||||||
| 180 | if (EVP_PKEY_decrypt(pctx,
| 0-1 | ||||||||||||||||||
| 181 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 182 | , &eklen,
| 0-1 | ||||||||||||||||||
| 183 | ri->enc_key->data, ri->enc_key->length) <= 0
| 0-1 | ||||||||||||||||||
| 184 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 185 | - | |||||||||||||||||||
| 186 | ek = malloc(eklen); | - | ||||||||||||||||||
| 187 | if (ek ==
| 0-1 | ||||||||||||||||||
| 188 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 189 | ) { | - | ||||||||||||||||||
| 190 | ERR_put_error(33,(0xfff),((1|64)),__FILE__,221); | - | ||||||||||||||||||
| 191 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 192 | } | - | ||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | if (EVP_PKEY_decrypt(pctx, ek, &eklen,
| 0-1 | ||||||||||||||||||
| 195 | ri->enc_key->data, ri->enc_key->length) <= 0
| 0-1 | ||||||||||||||||||
| 196 | ret = 0; | - | ||||||||||||||||||
| 197 | ERR_put_error(33,(0xfff),(6),__FILE__,228); | - | ||||||||||||||||||
| 198 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 199 | } | - | ||||||||||||||||||
| 200 | - | |||||||||||||||||||
| 201 | ret = 1; | - | ||||||||||||||||||
| 202 | - | |||||||||||||||||||
| 203 | freezero(*pek, *peklen); | - | ||||||||||||||||||
| 204 | - | |||||||||||||||||||
| 205 | *pek = ek; | - | ||||||||||||||||||
| 206 | *peklen = eklen; | - | ||||||||||||||||||
| 207 | - | |||||||||||||||||||
| 208 | err: code before this statement executed 1 time by 1 test: err:Executed by:
| 1 | ||||||||||||||||||
| 209 | EVP_PKEY_CTX_free(pctx); | - | ||||||||||||||||||
| 210 | if (!ret
| 0-1 | ||||||||||||||||||
| 211 | free(ek); never executed: free(ek); | 0 | ||||||||||||||||||
| 212 | - | |||||||||||||||||||
| 213 | return executed 1 time by 1 test: ret;return ret;Executed by:
executed 1 time by 1 test: return ret;Executed by:
| 1 | ||||||||||||||||||
| 214 | } | - | ||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | BIO * | - | ||||||||||||||||||
| 217 | PKCS7_dataInit(PKCS7 *p7, BIO *bio) | - | ||||||||||||||||||
| 218 | { | - | ||||||||||||||||||
| 219 | int i; | - | ||||||||||||||||||
| 220 | BIO *out = | - | ||||||||||||||||||
| 221 | ((void *)0) | - | ||||||||||||||||||
| 222 | , *btmp = | - | ||||||||||||||||||
| 223 | ((void *)0) | - | ||||||||||||||||||
| 224 | ; | - | ||||||||||||||||||
| 225 | X509_ALGOR *xa = | - | ||||||||||||||||||
| 226 | ((void *)0) | - | ||||||||||||||||||
| 227 | ; | - | ||||||||||||||||||
| 228 | const EVP_CIPHER *evp_cipher = | - | ||||||||||||||||||
| 229 | ((void *)0) | - | ||||||||||||||||||
| 230 | ; | - | ||||||||||||||||||
| 231 | struct stack_st_X509_ALGOR *md_sk = | - | ||||||||||||||||||
| 232 | ((void *)0) | - | ||||||||||||||||||
| 233 | ; | - | ||||||||||||||||||
| 234 | struct stack_st_PKCS7_RECIP_INFO *rsk = | - | ||||||||||||||||||
| 235 | ((void *)0) | - | ||||||||||||||||||
| 236 | ; | - | ||||||||||||||||||
| 237 | X509_ALGOR *xalg = | - | ||||||||||||||||||
| 238 | ((void *)0) | - | ||||||||||||||||||
| 239 | ; | - | ||||||||||||||||||
| 240 | PKCS7_RECIP_INFO *ri = | - | ||||||||||||||||||
| 241 | ((void *)0) | - | ||||||||||||||||||
| 242 | ; | - | ||||||||||||||||||
| 243 | ASN1_OCTET_STRING *os = | - | ||||||||||||||||||
| 244 | ((void *)0) | - | ||||||||||||||||||
| 245 | ; | - | ||||||||||||||||||
| 246 | - | |||||||||||||||||||
| 247 | if (p7 ==
| 0-5 | ||||||||||||||||||
| 248 | ((void *)0)
| 0-5 | ||||||||||||||||||
| 249 | ) { | - | ||||||||||||||||||
| 250 | ERR_put_error(33,(0xfff),(143),__FILE__,261); | - | ||||||||||||||||||
| 251 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 252 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 253 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 254 | } | - | ||||||||||||||||||
| 255 | if (p7->d.ptr ==
| 0-5 | ||||||||||||||||||
| 256 | ((void *)0)
| 0-5 | ||||||||||||||||||
| 257 | ) { | - | ||||||||||||||||||
| 258 | ERR_put_error(33,(0xfff),(122),__FILE__,278); | - | ||||||||||||||||||
| 259 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 260 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 261 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 262 | } | - | ||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | i = OBJ_obj2nid(p7->type); | - | ||||||||||||||||||
| 265 | p7->state = 0; | - | ||||||||||||||||||
| 266 | - | |||||||||||||||||||
| 267 | switch (i) { | - | ||||||||||||||||||
| 268 | case executed 4 times by 1 test: 22:case 22:Executed by:
executed 4 times by 1 test: case 22:Executed by:
| 4 | ||||||||||||||||||
| 269 | md_sk = p7->d.sign->md_algs; | - | ||||||||||||||||||
| 270 | os = PKCS7_get_octet_string(p7->d.sign->contents); | - | ||||||||||||||||||
| 271 | break; executed 4 times by 1 test: break;Executed by:
| 4 | ||||||||||||||||||
| 272 | case never executed: 24:case 24:never executed: case 24: | 0 | ||||||||||||||||||
| 273 | rsk = p7->d.signed_and_enveloped->recipientinfo; | - | ||||||||||||||||||
| 274 | md_sk = p7->d.signed_and_enveloped->md_algs; | - | ||||||||||||||||||
| 275 | xalg = p7->d.signed_and_enveloped->enc_data->algorithm; | - | ||||||||||||||||||
| 276 | evp_cipher = p7->d.signed_and_enveloped->enc_data->cipher; | - | ||||||||||||||||||
| 277 | if (evp_cipher ==
| 0 | ||||||||||||||||||
| 278 | ((void *)0)
| 0 | ||||||||||||||||||
| 279 | ) { | - | ||||||||||||||||||
| 280 | ERR_put_error(33,(0xfff),(116),__FILE__,296); | - | ||||||||||||||||||
| 281 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 282 | } | - | ||||||||||||||||||
| 283 | break; never executed: break; | 0 | ||||||||||||||||||
| 284 | case executed 1 time by 1 test: 23:case 23:Executed by:
executed 1 time by 1 test: case 23:Executed by:
| 1 | ||||||||||||||||||
| 285 | rsk = p7->d.enveloped->recipientinfo; | - | ||||||||||||||||||
| 286 | xalg = p7->d.enveloped->enc_data->algorithm; | - | ||||||||||||||||||
| 287 | evp_cipher = p7->d.enveloped->enc_data->cipher; | - | ||||||||||||||||||
| 288 | if (evp_cipher ==
| 0-1 | ||||||||||||||||||
| 289 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 290 | ) { | - | ||||||||||||||||||
| 291 | ERR_put_error(33,(0xfff),(116),__FILE__,305); | - | ||||||||||||||||||
| 292 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 293 | } | - | ||||||||||||||||||
| 294 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||
| 295 | case never executed: 25:case 25:never executed: case 25: | 0 | ||||||||||||||||||
| 296 | xa = p7->d.digest->md; | - | ||||||||||||||||||
| 297 | os = PKCS7_get_octet_string(p7->d.digest->contents); | - | ||||||||||||||||||
| 298 | break; never executed: break; | 0 | ||||||||||||||||||
| 299 | case never executed: 21:case 21:never executed: case 21: | 0 | ||||||||||||||||||
| 300 | break; never executed: break; | 0 | ||||||||||||||||||
| 301 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 302 | ERR_put_error(33,(0xfff),(112),__FILE__,316); | - | ||||||||||||||||||
| 303 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 304 | } | - | ||||||||||||||||||
| 305 | - | |||||||||||||||||||
| 306 | for (i = 0; i < sk_num(((_STACK*) (1 ? (md_sk) : (struct stack_st_X509_ALGOR*)0)))
| 4-5 | ||||||||||||||||||
| 307 | if (!PKCS7_bio_add_digest(&out, ((X509_ALGOR *)sk_value(((_STACK*) (1 ? (md_sk) : (struct stack_st_X509_ALGOR*)0)), (i))))
| 0-4 | ||||||||||||||||||
| 308 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | if (xa
| 0-5 | ||||||||||||||||||
| 311 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 312 | - | |||||||||||||||||||
| 313 | if (evp_cipher !=
| 1-4 | ||||||||||||||||||
| 314 | ((void *)0)
| 1-4 | ||||||||||||||||||
| 315 | ) { | - | ||||||||||||||||||
| 316 | unsigned char key[64]; | - | ||||||||||||||||||
| 317 | unsigned char iv[16]; | - | ||||||||||||||||||
| 318 | int keylen, ivlen; | - | ||||||||||||||||||
| 319 | EVP_CIPHER_CTX *ctx; | - | ||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | if ((
| 0-1 | ||||||||||||||||||
| 322 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 323 | ) { | - | ||||||||||||||||||
| 324 | ERR_put_error(33,(0xfff),(32),__FILE__,334); | - | ||||||||||||||||||
| 325 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 326 | } | - | ||||||||||||||||||
| 327 | BIO_ctrl(btmp,129,0,(char *)&ctx); | - | ||||||||||||||||||
| 328 | keylen = EVP_CIPHER_key_length(evp_cipher); | - | ||||||||||||||||||
| 329 | ivlen = EVP_CIPHER_iv_length(evp_cipher); | - | ||||||||||||||||||
| 330 | xalg->algorithm = OBJ_nid2obj(EVP_CIPHER_type(evp_cipher)); | - | ||||||||||||||||||
| 331 | if (ivlen > 0
| 0-1 | ||||||||||||||||||
| 332 | arc4random_buf(iv, ivlen); executed 1 time by 1 test: arc4random_buf(iv, ivlen);Executed by:
| 1 | ||||||||||||||||||
| 333 | if (EVP_CipherInit_ex(ctx, evp_cipher,
| 0-1 | ||||||||||||||||||
| 334 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 335 | ,
| 0-1 | ||||||||||||||||||
| 336 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 337 | ,
| 0-1 | ||||||||||||||||||
| 338 |
| 0-1 | ||||||||||||||||||
| 339 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 340 | , 1) <= 0
| 0-1 | ||||||||||||||||||
| 341 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 342 | if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0
| 0-1 | ||||||||||||||||||
| 343 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 344 | if (EVP_CipherInit_ex(ctx,
| 0-1 | ||||||||||||||||||
| 345 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 346 | ,
| 0-1 | ||||||||||||||||||
| 347 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 348 | , key, iv, 1) <= 0
| 0-1 | ||||||||||||||||||
| 349 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 350 | - | |||||||||||||||||||
| 351 | if (ivlen > 0
| 0-1 | ||||||||||||||||||
| 352 | if (xalg->parameter ==
| 0-1 | ||||||||||||||||||
| 353 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 354 | ) { | - | ||||||||||||||||||
| 355 | xalg->parameter = ASN1_TYPE_new(); | - | ||||||||||||||||||
| 356 | if (xalg->parameter ==
| 0-1 | ||||||||||||||||||
| 357 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 358 | ) | - | ||||||||||||||||||
| 359 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 360 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 361 | if (EVP_CIPHER_param_to_asn1(ctx, xalg->parameter) < 0
| 0-1 | ||||||||||||||||||
| 362 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 363 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 364 | - | |||||||||||||||||||
| 365 | - | |||||||||||||||||||
| 366 | for (i = 0; i < sk_num(((_STACK*) (1 ? (rsk) : (struct stack_st_PKCS7_RECIP_INFO*)0)))
| 1 | ||||||||||||||||||
| 367 | ri = ((PKCS7_RECIP_INFO *)sk_value(((_STACK*) (1 ? (rsk) : (struct stack_st_PKCS7_RECIP_INFO*)0)), (i))); | - | ||||||||||||||||||
| 368 | if (pkcs7_encode_rinfo(ri, key, keylen) <= 0
| 0-1 | ||||||||||||||||||
| 369 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 370 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 371 | explicit_bzero(key, keylen); | - | ||||||||||||||||||
| 372 | - | |||||||||||||||||||
| 373 | if (out ==
| 0-1 | ||||||||||||||||||
| 374 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 375 | ) | - | ||||||||||||||||||
| 376 | out = btmp; executed 1 time by 1 test: out = btmp;Executed by:
| 1 | ||||||||||||||||||
| 377 | else | - | ||||||||||||||||||
| 378 | BIO_push(out, btmp); never executed: BIO_push(out, btmp); | 0 | ||||||||||||||||||
| 379 | btmp = | - | ||||||||||||||||||
| 380 | ((void *)0) | - | ||||||||||||||||||
| 381 | ; | - | ||||||||||||||||||
| 382 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 383 | - | |||||||||||||||||||
| 384 | if (bio ==
| 1-4 | ||||||||||||||||||
| 385 | ((void *)0)
| 1-4 | ||||||||||||||||||
| 386 | ) { | - | ||||||||||||||||||
| 387 | if (((
| 1-3 | ||||||||||||||||||
| 388 | ((void *)0)
| 1-2 | ||||||||||||||||||
| 389 | )
| 1-2 | ||||||||||||||||||
| 390 | bio = BIO_new(BIO_s_null()); executed 1 time by 1 test: bio = BIO_new(BIO_s_null());Executed by:
| 1 | ||||||||||||||||||
| 391 | else if (os
| 1-2 | ||||||||||||||||||
| 392 | bio = BIO_new_mem_buf(os->data, os->length); executed 1 time by 1 test: bio = BIO_new_mem_buf(os->data, os->length);Executed by:
| 1 | ||||||||||||||||||
| 393 | if (bio ==
| 2 | ||||||||||||||||||
| 394 | ((void *)0)
| 2 | ||||||||||||||||||
| 395 | ) { | - | ||||||||||||||||||
| 396 | bio = BIO_new(BIO_s_mem()); | - | ||||||||||||||||||
| 397 | if (bio ==
| 0-2 | ||||||||||||||||||
| 398 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 399 | ) | - | ||||||||||||||||||
| 400 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 401 | BIO_ctrl(bio,130,0, | - | ||||||||||||||||||
| 402 | ((void *)0) | - | ||||||||||||||||||
| 403 | ); | - | ||||||||||||||||||
| 404 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 405 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 406 | if (out
| 0-5 | ||||||||||||||||||
| 407 | BIO_push(out, bio); executed 5 times by 1 test: BIO_push(out, bio);Executed by:
| 5 | ||||||||||||||||||
| 408 | else | - | ||||||||||||||||||
| 409 | out = bio; never executed: out = bio; | 0 | ||||||||||||||||||
| 410 | bio = | - | ||||||||||||||||||
| 411 | ((void *)0) | - | ||||||||||||||||||
| 412 | ; | - | ||||||||||||||||||
| 413 | if (0) { | - | ||||||||||||||||||
| 414 | err: | - | ||||||||||||||||||
| 415 | if (out !=
| 0 | ||||||||||||||||||
| 416 | ((void *)0)
| 0 | ||||||||||||||||||
| 417 | ) | - | ||||||||||||||||||
| 418 | BIO_free_all(out); never executed: BIO_free_all(out); | 0 | ||||||||||||||||||
| 419 | if (btmp !=
| 0 | ||||||||||||||||||
| 420 | ((void *)0)
| 0 | ||||||||||||||||||
| 421 | ) | - | ||||||||||||||||||
| 422 | BIO_free_all(btmp); never executed: BIO_free_all(btmp); | 0 | ||||||||||||||||||
| 423 | out = | - | ||||||||||||||||||
| 424 | ((void *)0) | - | ||||||||||||||||||
| 425 | ; | - | ||||||||||||||||||
| 426 | } never executed: end of block | 0 | ||||||||||||||||||
| 427 | return executed 5 times by 1 test: (out);return (out);Executed by:
executed 5 times by 1 test: return (out);Executed by:
| 5 | ||||||||||||||||||
| 428 | } | - | ||||||||||||||||||
| 429 | - | |||||||||||||||||||
| 430 | static int | - | ||||||||||||||||||
| 431 | pkcs7_cmp_ri(PKCS7_RECIP_INFO *ri, X509 *pcert) | - | ||||||||||||||||||
| 432 | { | - | ||||||||||||||||||
| 433 | int ret; | - | ||||||||||||||||||
| 434 | - | |||||||||||||||||||
| 435 | ret = X509_NAME_cmp(ri->issuer_and_serial->issuer, | - | ||||||||||||||||||
| 436 | pcert->cert_info->issuer); | - | ||||||||||||||||||
| 437 | if (ret
| 0-1 | ||||||||||||||||||
| 438 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 439 | return executed 1 time by 1 test: ASN1_STRING_cmp(pcert->cert_info->serialNumber,return ASN1_STRING_cmp(pcert->cert_info->serialNumber, ri->issuer_and_serial->serial);Executed by:
executed 1 time by 1 test: return ASN1_STRING_cmp(pcert->cert_info->serialNumber, ri->issuer_and_serial->serial);Executed by:
| 1 | ||||||||||||||||||
| 440 | ri->issuer_and_serial->serial); executed 1 time by 1 test: return ASN1_STRING_cmp(pcert->cert_info->serialNumber, ri->issuer_and_serial->serial);Executed by:
| 1 | ||||||||||||||||||
| 441 | } | - | ||||||||||||||||||
| 442 | - | |||||||||||||||||||
| 443 | - | |||||||||||||||||||
| 444 | BIO * | - | ||||||||||||||||||
| 445 | PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | - | ||||||||||||||||||
| 446 | { | - | ||||||||||||||||||
| 447 | int i, j; | - | ||||||||||||||||||
| 448 | BIO *out = | - | ||||||||||||||||||
| 449 | ((void *)0) | - | ||||||||||||||||||
| 450 | , *btmp = | - | ||||||||||||||||||
| 451 | ((void *)0) | - | ||||||||||||||||||
| 452 | , *etmp = | - | ||||||||||||||||||
| 453 | ((void *)0) | - | ||||||||||||||||||
| 454 | , *bio = | - | ||||||||||||||||||
| 455 | ((void *)0) | - | ||||||||||||||||||
| 456 | ; | - | ||||||||||||||||||
| 457 | X509_ALGOR *xa; | - | ||||||||||||||||||
| 458 | ASN1_OCTET_STRING *data_body = | - | ||||||||||||||||||
| 459 | ((void *)0) | - | ||||||||||||||||||
| 460 | ; | - | ||||||||||||||||||
| 461 | const EVP_MD *evp_md; | - | ||||||||||||||||||
| 462 | const EVP_CIPHER *evp_cipher = | - | ||||||||||||||||||
| 463 | ((void *)0) | - | ||||||||||||||||||
| 464 | ; | - | ||||||||||||||||||
| 465 | EVP_CIPHER_CTX *evp_ctx = | - | ||||||||||||||||||
| 466 | ((void *)0) | - | ||||||||||||||||||
| 467 | ; | - | ||||||||||||||||||
| 468 | X509_ALGOR *enc_alg = | - | ||||||||||||||||||
| 469 | ((void *)0) | - | ||||||||||||||||||
| 470 | ; | - | ||||||||||||||||||
| 471 | struct stack_st_X509_ALGOR *md_sk = | - | ||||||||||||||||||
| 472 | ((void *)0) | - | ||||||||||||||||||
| 473 | ; | - | ||||||||||||||||||
| 474 | struct stack_st_PKCS7_RECIP_INFO *rsk = | - | ||||||||||||||||||
| 475 | ((void *)0) | - | ||||||||||||||||||
| 476 | ; | - | ||||||||||||||||||
| 477 | PKCS7_RECIP_INFO *ri = | - | ||||||||||||||||||
| 478 | ((void *)0) | - | ||||||||||||||||||
| 479 | ; | - | ||||||||||||||||||
| 480 | unsigned char *ek = | - | ||||||||||||||||||
| 481 | ((void *)0) | - | ||||||||||||||||||
| 482 | , *tkey = | - | ||||||||||||||||||
| 483 | ((void *)0) | - | ||||||||||||||||||
| 484 | ; | - | ||||||||||||||||||
| 485 | int eklen = 0, tkeylen = 0; | - | ||||||||||||||||||
| 486 | - | |||||||||||||||||||
| 487 | if (p7 ==
| 0-1 | ||||||||||||||||||
| 488 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 489 | ) { | - | ||||||||||||||||||
| 490 | ERR_put_error(33,(0xfff),(143),__FILE__,436); | - | ||||||||||||||||||
| 491 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 492 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 493 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 494 | } | - | ||||||||||||||||||
| 495 | - | |||||||||||||||||||
| 496 | if (p7->d.ptr ==
| 0-1 | ||||||||||||||||||
| 497 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 498 | ) { | - | ||||||||||||||||||
| 499 | ERR_put_error(33,(0xfff),(122),__FILE__,441); | - | ||||||||||||||||||
| 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 | - | |||||||||||||||||||
| 505 | i = OBJ_obj2nid(p7->type); | - | ||||||||||||||||||
| 506 | p7->state = 0; | - | ||||||||||||||||||
| 507 | - | |||||||||||||||||||
| 508 | switch (i) { | - | ||||||||||||||||||
| 509 | case never executed: 22:case 22:never executed: case 22: | 0 | ||||||||||||||||||
| 510 | data_body = PKCS7_get_octet_string(p7->d.sign->contents); | - | ||||||||||||||||||
| 511 | md_sk = p7->d.sign->md_algs; | - | ||||||||||||||||||
| 512 | break; never executed: break; | 0 | ||||||||||||||||||
| 513 | case never executed: 24:case 24:never executed: case 24: | 0 | ||||||||||||||||||
| 514 | rsk = p7->d.signed_and_enveloped->recipientinfo; | - | ||||||||||||||||||
| 515 | md_sk = p7->d.signed_and_enveloped->md_algs; | - | ||||||||||||||||||
| 516 | data_body = p7->d.signed_and_enveloped->enc_data->enc_data; | - | ||||||||||||||||||
| 517 | enc_alg = p7->d.signed_and_enveloped->enc_data->algorithm; | - | ||||||||||||||||||
| 518 | evp_cipher = EVP_get_cipherbyname(OBJ_nid2sn(OBJ_obj2nid(enc_alg->algorithm))); | - | ||||||||||||||||||
| 519 | if (evp_cipher ==
| 0 | ||||||||||||||||||
| 520 | ((void *)0)
| 0 | ||||||||||||||||||
| 521 | ) { | - | ||||||||||||||||||
| 522 | ERR_put_error(33,(0xfff),(111),__FILE__,460); | - | ||||||||||||||||||
| 523 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 524 | } | - | ||||||||||||||||||
| 525 | break; never executed: break; | 0 | ||||||||||||||||||
| 526 | case executed 1 time by 1 test: 23:case 23:Executed by:
executed 1 time by 1 test: case 23:Executed by:
| 1 | ||||||||||||||||||
| 527 | rsk = p7->d.enveloped->recipientinfo; | - | ||||||||||||||||||
| 528 | enc_alg = p7->d.enveloped->enc_data->algorithm; | - | ||||||||||||||||||
| 529 | data_body = p7->d.enveloped->enc_data->enc_data; | - | ||||||||||||||||||
| 530 | evp_cipher = EVP_get_cipherbyname(OBJ_nid2sn(OBJ_obj2nid(enc_alg->algorithm))); | - | ||||||||||||||||||
| 531 | if (evp_cipher ==
| 0-1 | ||||||||||||||||||
| 532 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 533 | ) { | - | ||||||||||||||||||
| 534 | ERR_put_error(33,(0xfff),(111),__FILE__,470); | - | ||||||||||||||||||
| 535 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 536 | } | - | ||||||||||||||||||
| 537 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||
| 538 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 539 | ERR_put_error(33,(0xfff),(112),__FILE__,475); | - | ||||||||||||||||||
| 540 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 541 | } | - | ||||||||||||||||||
| 542 | - | |||||||||||||||||||
| 543 | - | |||||||||||||||||||
| 544 | if (md_sk !=
| 0-1 | ||||||||||||||||||
| 545 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 546 | ) { | - | ||||||||||||||||||
| 547 | for (i = 0; i < sk_num(((_STACK*) (1 ? (md_sk) : (struct stack_st_X509_ALGOR*)0)))
| 0 | ||||||||||||||||||
| 548 | xa = ((X509_ALGOR *)sk_value(((_STACK*) (1 ? (md_sk) : (struct stack_st_X509_ALGOR*)0)), (i))); | - | ||||||||||||||||||
| 549 | if ((
| 0 | ||||||||||||||||||
| 550 | ((void *)0)
| 0 | ||||||||||||||||||
| 551 | ) { | - | ||||||||||||||||||
| 552 | ERR_put_error(33,(0xfff),(32),__FILE__,484); | - | ||||||||||||||||||
| 553 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 554 | } | - | ||||||||||||||||||
| 555 | - | |||||||||||||||||||
| 556 | j = OBJ_obj2nid(xa->algorithm); | - | ||||||||||||||||||
| 557 | evp_md = EVP_get_digestbyname(OBJ_nid2sn(j)); | - | ||||||||||||||||||
| 558 | if (evp_md ==
| 0 | ||||||||||||||||||
| 559 | ((void *)0)
| 0 | ||||||||||||||||||
| 560 | ) { | - | ||||||||||||||||||
| 561 | ERR_put_error(33,(0xfff),(109),__FILE__,491); | - | ||||||||||||||||||
| 562 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 563 | } | - | ||||||||||||||||||
| 564 | - | |||||||||||||||||||
| 565 | BIO_ctrl(btmp,111,0,(char *)evp_md); | - | ||||||||||||||||||
| 566 | if (out ==
| 0 | ||||||||||||||||||
| 567 | ((void *)0)
| 0 | ||||||||||||||||||
| 568 | ) | - | ||||||||||||||||||
| 569 | out = btmp; never executed: out = btmp; | 0 | ||||||||||||||||||
| 570 | else | - | ||||||||||||||||||
| 571 | BIO_push(out, btmp); never executed: BIO_push(out, btmp); | 0 | ||||||||||||||||||
| 572 | btmp = | - | ||||||||||||||||||
| 573 | ((void *)0) | - | ||||||||||||||||||
| 574 | ; | - | ||||||||||||||||||
| 575 | } never executed: end of block | 0 | ||||||||||||||||||
| 576 | } never executed: end of block | 0 | ||||||||||||||||||
| 577 | - | |||||||||||||||||||
| 578 | if (evp_cipher !=
| 0-1 | ||||||||||||||||||
| 579 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 580 | ) { | - | ||||||||||||||||||
| 581 | if ((
| 0-1 | ||||||||||||||||||
| 582 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 583 | ) { | - | ||||||||||||||||||
| 584 | ERR_put_error(33,(0xfff),(32),__FILE__,506); | - | ||||||||||||||||||
| 585 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 586 | } | - | ||||||||||||||||||
| 587 | - | |||||||||||||||||||
| 588 | - | |||||||||||||||||||
| 589 | - | |||||||||||||||||||
| 590 | - | |||||||||||||||||||
| 591 | - | |||||||||||||||||||
| 592 | - | |||||||||||||||||||
| 593 | - | |||||||||||||||||||
| 594 | if (pcert
| 0-1 | ||||||||||||||||||
| 595 | for (i = 0; i < sk_num(((_STACK*) (1 ? (rsk) : (struct stack_st_PKCS7_RECIP_INFO*)0)))
| 0-1 | ||||||||||||||||||
| 596 | ri = ((PKCS7_RECIP_INFO *)sk_value(((_STACK*) (1 ? (rsk) : (struct stack_st_PKCS7_RECIP_INFO*)0)), (i))); | - | ||||||||||||||||||
| 597 | if (!pkcs7_cmp_ri(ri, pcert)
| 0-1 | ||||||||||||||||||
| 598 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||
| 599 | ri = | - | ||||||||||||||||||
| 600 | ((void *)0) | - | ||||||||||||||||||
| 601 | ; | - | ||||||||||||||||||
| 602 | } never executed: end of block | 0 | ||||||||||||||||||
| 603 | if (ri ==
| 0-1 | ||||||||||||||||||
| 604 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 605 | ) { | - | ||||||||||||||||||
| 606 | ERR_put_error(33,(0xfff),(115),__FILE__,524); | - | ||||||||||||||||||
| 607 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 608 | } | - | ||||||||||||||||||
| 609 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 610 | - | |||||||||||||||||||
| 611 | - | |||||||||||||||||||
| 612 | if (pcert ==
| 0-1 | ||||||||||||||||||
| 613 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 614 | ) { | - | ||||||||||||||||||
| 615 | - | |||||||||||||||||||
| 616 | - | |||||||||||||||||||
| 617 | - | |||||||||||||||||||
| 618 | - | |||||||||||||||||||
| 619 | for (i = 0; i < sk_num(((_STACK*) (1 ? (rsk) : (struct stack_st_PKCS7_RECIP_INFO*)0)))
| 0 | ||||||||||||||||||
| 620 | ri = ((PKCS7_RECIP_INFO *)sk_value(((_STACK*) (1 ? (rsk) : (struct stack_st_PKCS7_RECIP_INFO*)0)), (i))); | - | ||||||||||||||||||
| 621 | - | |||||||||||||||||||
| 622 | if (pkcs7_decrypt_rinfo(&ek, &eklen,
| 0 | ||||||||||||||||||
| 623 | ri, pkey) < 0
| 0 | ||||||||||||||||||
| 624 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 625 | ERR_clear_error(); | - | ||||||||||||||||||
| 626 | } never executed: end of block | 0 | ||||||||||||||||||
| 627 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 628 | - | |||||||||||||||||||
| 629 | if (pkcs7_decrypt_rinfo(&ek, &eklen, ri, pkey) < 0
| 0-1 | ||||||||||||||||||
| 630 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 631 | ERR_clear_error(); | - | ||||||||||||||||||
| 632 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 633 | - | |||||||||||||||||||
| 634 | evp_ctx = | - | ||||||||||||||||||
| 635 | ((void *)0) | - | ||||||||||||||||||
| 636 | ; | - | ||||||||||||||||||
| 637 | BIO_ctrl(etmp,129,0,(char *)&evp_ctx); | - | ||||||||||||||||||
| 638 | if (EVP_CipherInit_ex(evp_ctx, evp_cipher,
| 0-1 | ||||||||||||||||||
| 639 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 640 | ,
| 0-1 | ||||||||||||||||||
| 641 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 642 | ,
| 0-1 | ||||||||||||||||||
| 643 |
| 0-1 | ||||||||||||||||||
| 644 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 645 | , 0) <= 0
| 0-1 | ||||||||||||||||||
| 646 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 647 | if (EVP_CIPHER_asn1_to_param(evp_ctx, enc_alg->parameter) < 0
| 0-1 | ||||||||||||||||||
| 648 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 649 | - | |||||||||||||||||||
| 650 | tkeylen = EVP_CIPHER_CTX_key_length(evp_ctx); | - | ||||||||||||||||||
| 651 | tkey = malloc(tkeylen); | - | ||||||||||||||||||
| 652 | if (!tkey
| 0-1 | ||||||||||||||||||
| 653 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 654 | if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <= 0
| 0-1 | ||||||||||||||||||
| 655 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 656 | if (ek ==
| 0-1 | ||||||||||||||||||
| 657 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 658 | ) { | - | ||||||||||||||||||
| 659 | ek = tkey; | - | ||||||||||||||||||
| 660 | eklen = tkeylen; | - | ||||||||||||||||||
| 661 | tkey = | - | ||||||||||||||||||
| 662 | ((void *)0) | - | ||||||||||||||||||
| 663 | ; | - | ||||||||||||||||||
| 664 | } never executed: end of block | 0 | ||||||||||||||||||
| 665 | - | |||||||||||||||||||
| 666 | if (eklen != EVP_CIPHER_CTX_key_length(evp_ctx)
| 0-1 | ||||||||||||||||||
| 667 | - | |||||||||||||||||||
| 668 | - | |||||||||||||||||||
| 669 | - | |||||||||||||||||||
| 670 | - | |||||||||||||||||||
| 671 | if (!EVP_CIPHER_CTX_set_key_length(evp_ctx, eklen)
| 0 | ||||||||||||||||||
| 672 | - | |||||||||||||||||||
| 673 | freezero(ek, eklen); | - | ||||||||||||||||||
| 674 | ek = tkey; | - | ||||||||||||||||||
| 675 | eklen = tkeylen; | - | ||||||||||||||||||
| 676 | tkey = | - | ||||||||||||||||||
| 677 | ((void *)0) | - | ||||||||||||||||||
| 678 | ; | - | ||||||||||||||||||
| 679 | } never executed: end of block | 0 | ||||||||||||||||||
| 680 | } never executed: end of block | 0 | ||||||||||||||||||
| 681 | - | |||||||||||||||||||
| 682 | ERR_clear_error(); | - | ||||||||||||||||||
| 683 | if (EVP_CipherInit_ex(evp_ctx,
| 0-1 | ||||||||||||||||||
| 684 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 685 | ,
| 0-1 | ||||||||||||||||||
| 686 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 687 | , ek,
| 0-1 | ||||||||||||||||||
| 688 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 689 | , 0) <= 0
| 0-1 | ||||||||||||||||||
| 690 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 691 | - | |||||||||||||||||||
| 692 | freezero(ek, eklen); | - | ||||||||||||||||||
| 693 | ek = | - | ||||||||||||||||||
| 694 | ((void *)0) | - | ||||||||||||||||||
| 695 | ; | - | ||||||||||||||||||
| 696 | freezero(tkey, tkeylen); | - | ||||||||||||||||||
| 697 | tkey = | - | ||||||||||||||||||
| 698 | ((void *)0) | - | ||||||||||||||||||
| 699 | ; | - | ||||||||||||||||||
| 700 | - | |||||||||||||||||||
| 701 | if (out ==
| 0-1 | ||||||||||||||||||
| 702 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 703 | ) | - | ||||||||||||||||||
| 704 | out = etmp; executed 1 time by 1 test: out = etmp;Executed by:
| 1 | ||||||||||||||||||
| 705 | else | - | ||||||||||||||||||
| 706 | BIO_push(out, etmp); never executed: BIO_push(out, etmp); | 0 | ||||||||||||||||||
| 707 | etmp = | - | ||||||||||||||||||
| 708 | ((void *)0) | - | ||||||||||||||||||
| 709 | ; | - | ||||||||||||||||||
| 710 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 711 | - | |||||||||||||||||||
| 712 | if (((
| 0-1 | ||||||||||||||||||
| 713 | ((void *)0)
| 0 | ||||||||||||||||||
| 714 | )
| 0-1 | ||||||||||||||||||
| 715 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 716 | )
| 0-1 | ||||||||||||||||||
| 717 | bio = in_bio; | - | ||||||||||||||||||
| 718 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 719 | if (data_body !=
| 0-1 | ||||||||||||||||||
| 720 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 721 | && data_body->length > 0
| 0-1 | ||||||||||||||||||
| 722 | bio = BIO_new_mem_buf(data_body->data, data_body->length); executed 1 time by 1 test: bio = BIO_new_mem_buf(data_body->data, data_body->length);Executed by:
| 1 | ||||||||||||||||||
| 723 | else { | - | ||||||||||||||||||
| 724 | bio = BIO_new(BIO_s_mem()); | - | ||||||||||||||||||
| 725 | BIO_ctrl(bio,130,0, | - | ||||||||||||||||||
| 726 | ((void *)0) | - | ||||||||||||||||||
| 727 | ); | - | ||||||||||||||||||
| 728 | } never executed: end of block | 0 | ||||||||||||||||||
| 729 | if (bio ==
| 0-1 | ||||||||||||||||||
| 730 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 731 | ) | - | ||||||||||||||||||
| 732 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 733 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 734 | BIO_push(out, bio); | - | ||||||||||||||||||
| 735 | - | |||||||||||||||||||
| 736 | if (0) { | - | ||||||||||||||||||
| 737 | err: | - | ||||||||||||||||||
| 738 | freezero(ek, eklen); | - | ||||||||||||||||||
| 739 | freezero(tkey, tkeylen); | - | ||||||||||||||||||
| 740 | if (out !=
| 0 | ||||||||||||||||||
| 741 | ((void *)0)
| 0 | ||||||||||||||||||
| 742 | ) | - | ||||||||||||||||||
| 743 | BIO_free_all(out); never executed: BIO_free_all(out); | 0 | ||||||||||||||||||
| 744 | if (btmp !=
| 0 | ||||||||||||||||||
| 745 | ((void *)0)
| 0 | ||||||||||||||||||
| 746 | ) | - | ||||||||||||||||||
| 747 | BIO_free_all(btmp); never executed: BIO_free_all(btmp); | 0 | ||||||||||||||||||
| 748 | if (etmp !=
| 0 | ||||||||||||||||||
| 749 | ((void *)0)
| 0 | ||||||||||||||||||
| 750 | ) | - | ||||||||||||||||||
| 751 | BIO_free_all(etmp); never executed: BIO_free_all(etmp); | 0 | ||||||||||||||||||
| 752 | out = | - | ||||||||||||||||||
| 753 | ((void *)0) | - | ||||||||||||||||||
| 754 | ; | - | ||||||||||||||||||
| 755 | } never executed: end of block | 0 | ||||||||||||||||||
| 756 | return executed 1 time by 1 test: (out);return (out);Executed by:
executed 1 time by 1 test: return (out);Executed by:
| 1 | ||||||||||||||||||
| 757 | } | - | ||||||||||||||||||
| 758 | - | |||||||||||||||||||
| 759 | static BIO * | - | ||||||||||||||||||
| 760 | PKCS7_find_digest(EVP_MD_CTX **pmd, BIO *bio, int nid) | - | ||||||||||||||||||
| 761 | { | - | ||||||||||||||||||
| 762 | for (;;) { | - | ||||||||||||||||||
| 763 | bio = BIO_find_type(bio, (8|0x0200)); | - | ||||||||||||||||||
| 764 | if (bio ==
| 0-2 | ||||||||||||||||||
| 765 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 766 | ) { | - | ||||||||||||||||||
| 767 | ERR_put_error(33,(0xfff),(108),__FILE__,635); | - | ||||||||||||||||||
| 768 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 769 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 770 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 771 | } | - | ||||||||||||||||||
| 772 | BIO_ctrl(bio,120,0,(char *)pmd); | - | ||||||||||||||||||
| 773 | if (*
| 0-2 | ||||||||||||||||||
| 774 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 775 | ) { | - | ||||||||||||||||||
| 776 | ERR_put_error(33,(0xfff),((4|64)),__FILE__,640); | - | ||||||||||||||||||
| 777 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 778 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 779 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 780 | } | - | ||||||||||||||||||
| 781 | if (EVP_MD_type(EVP_MD_CTX_md(*pmd)) == nid
| 0-2 | ||||||||||||||||||
| 782 | return executed 2 times by 1 test: bio;return bio;Executed by:
executed 2 times by 1 test: return bio;Executed by:
| 2 | ||||||||||||||||||
| 783 | bio = BIO_next(bio); | - | ||||||||||||||||||
| 784 | } never executed: end of block | 0 | ||||||||||||||||||
| 785 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 786 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 787 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 788 | } | - | ||||||||||||||||||
| 789 | - | |||||||||||||||||||
| 790 | static int | - | ||||||||||||||||||
| 791 | do_pkcs7_signed_attrib(PKCS7_SIGNER_INFO *si, EVP_MD_CTX *mctx) | - | ||||||||||||||||||
| 792 | { | - | ||||||||||||||||||
| 793 | unsigned char md_data[64]; | - | ||||||||||||||||||
| 794 | unsigned int md_len; | - | ||||||||||||||||||
| 795 | - | |||||||||||||||||||
| 796 | - | |||||||||||||||||||
| 797 | if (!PKCS7_get_signed_attribute(si, 52)
| 0-2 | ||||||||||||||||||
| 798 | if (!PKCS7_add0_attrib_signing_time(si,
| 0-2 | ||||||||||||||||||
| 799 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 800 | )
| 0-2 | ||||||||||||||||||
| 801 | ERR_put_error(33,(0xfff),((1|64)),__FILE__,659); | - | ||||||||||||||||||
| 802 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 803 | } | - | ||||||||||||||||||
| 804 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 805 | - | |||||||||||||||||||
| 806 | - | |||||||||||||||||||
| 807 | if (!EVP_DigestFinal_ex(mctx, md_data, &md_len)
| 0-2 | ||||||||||||||||||
| 808 | ERR_put_error(33,(0xfff),(6),__FILE__,666); | - | ||||||||||||||||||
| 809 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 810 | } | - | ||||||||||||||||||
| 811 | if (!PKCS7_add1_attrib_digest(si, md_data, md_len)
| 0-2 | ||||||||||||||||||
| 812 | ERR_put_error(33,(0xfff),((1|64)),__FILE__,670); | - | ||||||||||||||||||
| 813 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 814 | } | - | ||||||||||||||||||
| 815 | - | |||||||||||||||||||
| 816 | - | |||||||||||||||||||
| 817 | if (!PKCS7_SIGNER_INFO_sign(si)
| 0-2 | ||||||||||||||||||
| 818 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 819 | - | |||||||||||||||||||
| 820 | return executed 2 times by 1 test: 1;return 1;Executed by:
executed 2 times by 1 test: return 1;Executed by:
| 2 | ||||||||||||||||||
| 821 | } | - | ||||||||||||||||||
| 822 | - | |||||||||||||||||||
| 823 | - | |||||||||||||||||||
| 824 | int | - | ||||||||||||||||||
| 825 | PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | - | ||||||||||||||||||
| 826 | { | - | ||||||||||||||||||
| 827 | int ret = 0; | - | ||||||||||||||||||
| 828 | int i, j; | - | ||||||||||||||||||
| 829 | BIO *btmp; | - | ||||||||||||||||||
| 830 | PKCS7_SIGNER_INFO *si; | - | ||||||||||||||||||
| 831 | EVP_MD_CTX *mdc, ctx_tmp; | - | ||||||||||||||||||
| 832 | struct stack_st_X509_ATTRIBUTE *sk; | - | ||||||||||||||||||
| 833 | struct stack_st_PKCS7_SIGNER_INFO *si_sk = | - | ||||||||||||||||||
| 834 | ((void *)0) | - | ||||||||||||||||||
| 835 | ; | - | ||||||||||||||||||
| 836 | ASN1_OCTET_STRING *os = | - | ||||||||||||||||||
| 837 | ((void *)0) | - | ||||||||||||||||||
| 838 | ; | - | ||||||||||||||||||
| 839 | - | |||||||||||||||||||
| 840 | if (p7 ==
| 0-3 | ||||||||||||||||||
| 841 | ((void *)0)
| 0-3 | ||||||||||||||||||
| 842 | ) { | - | ||||||||||||||||||
| 843 | ERR_put_error(33,(0xfff),(143),__FILE__,695); | - | ||||||||||||||||||
| 844 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 845 | } | - | ||||||||||||||||||
| 846 | - | |||||||||||||||||||
| 847 | if (p7->d.ptr ==
| 0-3 | ||||||||||||||||||
| 848 | ((void *)0)
| 0-3 | ||||||||||||||||||
| 849 | ) { | - | ||||||||||||||||||
| 850 | ERR_put_error(33,(0xfff),(122),__FILE__,700); | - | ||||||||||||||||||
| 851 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 852 | } | - | ||||||||||||||||||
| 853 | - | |||||||||||||||||||
| 854 | EVP_MD_CTX_init(&ctx_tmp); | - | ||||||||||||||||||
| 855 | i = OBJ_obj2nid(p7->type); | - | ||||||||||||||||||
| 856 | p7->state = 0; | - | ||||||||||||||||||
| 857 | - | |||||||||||||||||||
| 858 | switch (i) { | - | ||||||||||||||||||
| 859 | case never executed: 21:case 21:never executed: case 21: | 0 | ||||||||||||||||||
| 860 | os = p7->d.data; | - | ||||||||||||||||||
| 861 | break; never executed: break; | 0 | ||||||||||||||||||
| 862 | case never executed: 24:case 24:never executed: case 24: | 0 | ||||||||||||||||||
| 863 | - | |||||||||||||||||||
| 864 | si_sk = p7->d.signed_and_enveloped->signer_info; | - | ||||||||||||||||||
| 865 | os = p7->d.signed_and_enveloped->enc_data->enc_data; | - | ||||||||||||||||||
| 866 | if (!os
| 0 | ||||||||||||||||||
| 867 | os = ASN1_OCTET_STRING_new(); | - | ||||||||||||||||||
| 868 | if (!os
| 0 | ||||||||||||||||||
| 869 | ERR_put_error(33,(0xfff),((1|64)),__FILE__,719); | - | ||||||||||||||||||
| 870 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 871 | } | - | ||||||||||||||||||
| 872 | p7->d.signed_and_enveloped->enc_data->enc_data = os; | - | ||||||||||||||||||
| 873 | } never executed: end of block | 0 | ||||||||||||||||||
| 874 | break; never executed: break; | 0 | ||||||||||||||||||
| 875 | case executed 1 time by 1 test: 23:case 23:Executed by:
executed 1 time by 1 test: case 23:Executed by:
| 1 | ||||||||||||||||||
| 876 | - | |||||||||||||||||||
| 877 | os = p7->d.enveloped->enc_data->enc_data; | - | ||||||||||||||||||
| 878 | if (!os
| 0-1 | ||||||||||||||||||
| 879 | os = ASN1_OCTET_STRING_new(); | - | ||||||||||||||||||
| 880 | if (!os
| 0-1 | ||||||||||||||||||
| 881 | ERR_put_error(33,(0xfff),((1|64)),__FILE__,731); | - | ||||||||||||||||||
| 882 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 883 | } | - | ||||||||||||||||||
| 884 | p7->d.enveloped->enc_data->enc_data = os; | - | ||||||||||||||||||
| 885 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 886 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||
| 887 | case executed 2 times by 1 test: 22:case 22:Executed by:
executed 2 times by 1 test: case 22:Executed by:
| 2 | ||||||||||||||||||
| 888 | si_sk = p7->d.sign->signer_info; | - | ||||||||||||||||||
| 889 | os = PKCS7_get_octet_string(p7->d.sign->contents); | - | ||||||||||||||||||
| 890 | if (!((
| 0-2 | ||||||||||||||||||
| 891 | ((void *)0)
| 1 | ||||||||||||||||||
| 892 | )
| 0-1 | ||||||||||||||||||
| 893 | ((void *)0)
| 0-1 | ||||||||||||||||||
| 894 | ) { | - | ||||||||||||||||||
| 895 | ERR_put_error(33,(0xfff),(130),__FILE__,741); | - | ||||||||||||||||||
| 896 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 897 | } | - | ||||||||||||||||||
| 898 | - | |||||||||||||||||||
| 899 | if ((
| 0-2 | ||||||||||||||||||
| 900 | ASN1_OCTET_STRING_free(os); | - | ||||||||||||||||||
| 901 | os = | - | ||||||||||||||||||
| 902 | ((void *)0) | - | ||||||||||||||||||
| 903 | ; | - | ||||||||||||||||||
| 904 | p7->d.sign->contents->d.data = | - | ||||||||||||||||||
| 905 | ((void *)0) | - | ||||||||||||||||||
| 906 | ; | - | ||||||||||||||||||
| 907 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 908 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||
| 909 | - | |||||||||||||||||||
| 910 | case never executed: 25:case 25:never executed: case 25: | 0 | ||||||||||||||||||
| 911 | os = PKCS7_get_octet_string(p7->d.digest->contents); | - | ||||||||||||||||||
| 912 | if (os ==
| 0 | ||||||||||||||||||
| 913 | ((void *)0)
| 0 | ||||||||||||||||||
| 914 | ) { | - | ||||||||||||||||||
| 915 | ERR_put_error(33,(0xfff),(130),__FILE__,755); | - | ||||||||||||||||||
| 916 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 917 | } | - | ||||||||||||||||||
| 918 | - | |||||||||||||||||||
| 919 | if ((
| 0 | ||||||||||||||||||
| 920 | p7->detached
| 0 | ||||||||||||||||||
| 921 | ASN1_OCTET_STRING_free(os); | - | ||||||||||||||||||
| 922 | os = | - | ||||||||||||||||||
| 923 | ((void *)0) | - | ||||||||||||||||||
| 924 | ; | - | ||||||||||||||||||
| 925 | p7->d.digest->contents->d.data = | - | ||||||||||||||||||
| 926 | ((void *)0) | - | ||||||||||||||||||
| 927 | ; | - | ||||||||||||||||||
| 928 | } never executed: end of block | 0 | ||||||||||||||||||
| 929 | break; never executed: break; | 0 | ||||||||||||||||||
| 930 | - | |||||||||||||||||||
| 931 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 932 | ERR_put_error(33,(0xfff),(112),__FILE__,768); | - | ||||||||||||||||||
| 933 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 934 | } | - | ||||||||||||||||||
| 935 | - | |||||||||||||||||||
| 936 | if (si_sk !=
| 1-2 | ||||||||||||||||||
| 937 | ((void *)0)
| 1-2 | ||||||||||||||||||
| 938 | ) { | - | ||||||||||||||||||
| 939 | for (i = 0; i < sk_num(((_STACK*) (1 ? (si_sk) : (struct stack_st_PKCS7_SIGNER_INFO*)0)))
| 2 | ||||||||||||||||||
| 940 | si = ((PKCS7_SIGNER_INFO *)sk_value(((_STACK*) (1 ? (si_sk) : (struct stack_st_PKCS7_SIGNER_INFO*)0)), (i))); | - | ||||||||||||||||||
| 941 | if (si->pkey ==
| 0-2 | ||||||||||||||||||
| 942 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 943 | ) | - | ||||||||||||||||||
| 944 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 945 | - | |||||||||||||||||||
| 946 | j = OBJ_obj2nid(si->digest_alg->algorithm); | - | ||||||||||||||||||
| 947 | - | |||||||||||||||||||
| 948 | if ((
| 0-2 | ||||||||||||||||||
| 949 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 950 | ) | - | ||||||||||||||||||
| 951 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 952 | - | |||||||||||||||||||
| 953 | - | |||||||||||||||||||
| 954 | - | |||||||||||||||||||
| 955 | if (!EVP_MD_CTX_copy_ex(&ctx_tmp, mdc)
| 0-2 | ||||||||||||||||||
| 956 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 957 | - | |||||||||||||||||||
| 958 | sk = si->auth_attr; | - | ||||||||||||||||||
| 959 | - | |||||||||||||||||||
| 960 | - | |||||||||||||||||||
| 961 | - | |||||||||||||||||||
| 962 | if (sk_num(((_STACK*) (1 ? (sk) : (struct stack_st_X509_ATTRIBUTE*)0))) > 0
| 0-2 | ||||||||||||||||||
| 963 | if (!do_pkcs7_signed_attrib(si, &ctx_tmp)
| 0-2 | ||||||||||||||||||
| 964 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 965 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||
| 966 | unsigned char *abuf = | - | ||||||||||||||||||
| 967 | ((void *)0) | - | ||||||||||||||||||
| 968 | ; | - | ||||||||||||||||||
| 969 | unsigned int abuflen; | - | ||||||||||||||||||
| 970 | abuflen = EVP_PKEY_size(si->pkey); | - | ||||||||||||||||||
| 971 | abuf = malloc(abuflen); | - | ||||||||||||||||||
| 972 | if (!abuf
| 0 | ||||||||||||||||||
| 973 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 974 | - | |||||||||||||||||||
| 975 | if (!EVP_SignFinal(&ctx_tmp, abuf, &abuflen,
| 0 | ||||||||||||||||||
| 976 | si->pkey)
| 0 | ||||||||||||||||||
| 977 | ERR_put_error(33,(0xfff),(6),__FILE__,805); | - | ||||||||||||||||||
| 978 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 979 | } | - | ||||||||||||||||||
| 980 | ASN1_STRING_set0(si->enc_digest, abuf, abuflen); | - | ||||||||||||||||||
| 981 | } never executed: end of block | 0 | ||||||||||||||||||
| 982 | } | - | ||||||||||||||||||
| 983 | } executed 2 times by 1 test: else if (i == 25end of blockExecuted by:
| 0-2 | ||||||||||||||||||
| 984 | unsigned char md_data[64]; | - | ||||||||||||||||||
| 985 | unsigned int md_len; | - | ||||||||||||||||||
| 986 | - | |||||||||||||||||||
| 987 | if (!PKCS7_find_digest(&mdc, bio,
| 0 | ||||||||||||||||||
| 988 | OBJ_obj2nid(p7->d.digest->md->algorithm))
| 0 | ||||||||||||||||||
| 989 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 990 | if (!EVP_DigestFinal_ex(mdc, md_data, &md_len)
| 0 | ||||||||||||||||||
| 991 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 992 | if (ASN1_STRING_set(p7->d.digest->digest, md_data,
| 0 | ||||||||||||||||||
| 993 | md_len) == 0
| 0 | ||||||||||||||||||
| 994 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 995 | } never executed: end of block | 0 | ||||||||||||||||||
| 996 | - | |||||||||||||||||||
| 997 | if (!((
| 1-2 | ||||||||||||||||||
| 998 | ((void *)0)
| 1 | ||||||||||||||||||
| 999 | )
| 1 | ||||||||||||||||||
| 1000 | - | |||||||||||||||||||
| 1001 | - | |||||||||||||||||||
| 1002 | - | |||||||||||||||||||
| 1003 | - | |||||||||||||||||||
| 1004 | if (os ==
| 0-2 | ||||||||||||||||||
| 1005 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1006 | ) | - | ||||||||||||||||||
| 1007 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1008 | if (!(os->flags & 0x010)
| 0-2 | ||||||||||||||||||
| 1009 | char *cont; | - | ||||||||||||||||||
| 1010 | long contlen; | - | ||||||||||||||||||
| 1011 | - | |||||||||||||||||||
| 1012 | btmp = BIO_find_type(bio, (1|0x0400)); | - | ||||||||||||||||||
| 1013 | if (btmp ==
| 0-2 | ||||||||||||||||||
| 1014 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1015 | ) { | - | ||||||||||||||||||
| 1016 | ERR_put_error(33,(0xfff),(107),__FILE__,838); | - | ||||||||||||||||||
| 1017 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1018 | } | - | ||||||||||||||||||
| 1019 | contlen = BIO_ctrl(btmp,3,0,(char *)&cont); | - | ||||||||||||||||||
| 1020 | - | |||||||||||||||||||
| 1021 | - | |||||||||||||||||||
| 1022 | - | |||||||||||||||||||
| 1023 | - | |||||||||||||||||||
| 1024 | BIO_set_flags(btmp, 0x200); | - | ||||||||||||||||||
| 1025 | BIO_ctrl(btmp,130,0, | - | ||||||||||||||||||
| 1026 | ((void *)0) | - | ||||||||||||||||||
| 1027 | ); | - | ||||||||||||||||||
| 1028 | ASN1_STRING_set0(os, (unsigned char *)cont, contlen); | - | ||||||||||||||||||
| 1029 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 1030 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 1031 | ret = 1; | - | ||||||||||||||||||
| 1032 | err: code before this statement executed 3 times by 1 test: err:Executed by:
| 3 | ||||||||||||||||||
| 1033 | EVP_MD_CTX_cleanup(&ctx_tmp); | - | ||||||||||||||||||
| 1034 | return executed 3 times by 1 test: (ret);return (ret);Executed by:
executed 3 times by 1 test: return (ret);Executed by:
| 3 | ||||||||||||||||||
| 1035 | } | - | ||||||||||||||||||
| 1036 | - | |||||||||||||||||||
| 1037 | int | - | ||||||||||||||||||
| 1038 | PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) | - | ||||||||||||||||||
| 1039 | { | - | ||||||||||||||||||
| 1040 | EVP_MD_CTX mctx; | - | ||||||||||||||||||
| 1041 | EVP_PKEY_CTX *pctx; | - | ||||||||||||||||||
| 1042 | unsigned char *abuf = | - | ||||||||||||||||||
| 1043 | ((void *)0) | - | ||||||||||||||||||
| 1044 | ; | - | ||||||||||||||||||
| 1045 | int alen; | - | ||||||||||||||||||
| 1046 | size_t siglen; | - | ||||||||||||||||||
| 1047 | const EVP_MD *md = | - | ||||||||||||||||||
| 1048 | ((void *)0) | - | ||||||||||||||||||
| 1049 | ; | - | ||||||||||||||||||
| 1050 | - | |||||||||||||||||||
| 1051 | md = EVP_get_digestbyname(OBJ_nid2sn(OBJ_obj2nid(si->digest_alg->algorithm))); | - | ||||||||||||||||||
| 1052 | if (md ==
| 0-2 | ||||||||||||||||||
| 1053 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1054 | ) | - | ||||||||||||||||||
| 1055 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1056 | - | |||||||||||||||||||
| 1057 | EVP_MD_CTX_init(&mctx); | - | ||||||||||||||||||
| 1058 | if (EVP_DigestSignInit(&mctx, &pctx, md,
| 0-2 | ||||||||||||||||||
| 1059 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1060 | , si->pkey) <= 0
| 0-2 | ||||||||||||||||||
| 1061 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1062 | - | |||||||||||||||||||
| 1063 | if (EVP_PKEY_CTX_ctrl(pctx, -1, (1<<3),
| 0-2 | ||||||||||||||||||
| 1064 | 5, 0, si) <= 0
| 0-2 | ||||||||||||||||||
| 1065 | ERR_put_error(33,(0xfff),(152),__FILE__,877); | - | ||||||||||||||||||
| 1066 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1067 | } | - | ||||||||||||||||||
| 1068 | - | |||||||||||||||||||
| 1069 | alen = ASN1_item_i2d((ASN1_VALUE *)si->auth_attr, &abuf, | - | ||||||||||||||||||
| 1070 | &PKCS7_ATTR_SIGN_it); | - | ||||||||||||||||||
| 1071 | if (!abuf
| 0-2 | ||||||||||||||||||
| 1072 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1073 | if (EVP_DigestUpdate(&mctx,abuf,alen) <= 0
| 0-2 | ||||||||||||||||||
| 1074 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1075 | free(abuf); | - | ||||||||||||||||||
| 1076 | abuf = | - | ||||||||||||||||||
| 1077 | ((void *)0) | - | ||||||||||||||||||
| 1078 | ; | - | ||||||||||||||||||
| 1079 | if (EVP_DigestSignFinal(&mctx,
| 0-2 | ||||||||||||||||||
| 1080 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1081 | , &siglen) <= 0
| 0-2 | ||||||||||||||||||
| 1082 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1083 | abuf = malloc(siglen); | - | ||||||||||||||||||
| 1084 | if (!abuf
| 0-2 | ||||||||||||||||||
| 1085 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1086 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0
| 0-2 | ||||||||||||||||||
| 1087 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1088 | - | |||||||||||||||||||
| 1089 | if (EVP_PKEY_CTX_ctrl(pctx, -1, (1<<3),
| 0-2 | ||||||||||||||||||
| 1090 | 5, 1, si) <= 0
| 0-2 | ||||||||||||||||||
| 1091 | ERR_put_error(33,(0xfff),(152),__FILE__,899); | - | ||||||||||||||||||
| 1092 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1093 | } | - | ||||||||||||||||||
| 1094 | - | |||||||||||||||||||
| 1095 | EVP_MD_CTX_cleanup(&mctx); | - | ||||||||||||||||||
| 1096 | - | |||||||||||||||||||
| 1097 | ASN1_STRING_set0(si->enc_digest, abuf, siglen); | - | ||||||||||||||||||
| 1098 | - | |||||||||||||||||||
| 1099 | return executed 2 times by 1 test: 1;return 1;Executed by:
executed 2 times by 1 test: return 1;Executed by:
| 2 | ||||||||||||||||||
| 1100 | - | |||||||||||||||||||
| 1101 | err: | - | ||||||||||||||||||
| 1102 | free(abuf); | - | ||||||||||||||||||
| 1103 | EVP_MD_CTX_cleanup(&mctx); | - | ||||||||||||||||||
| 1104 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1105 | } | - | ||||||||||||||||||
| 1106 | - | |||||||||||||||||||
| 1107 | int | - | ||||||||||||||||||
| 1108 | PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio, | - | ||||||||||||||||||
| 1109 | PKCS7 *p7, PKCS7_SIGNER_INFO *si) | - | ||||||||||||||||||
| 1110 | { | - | ||||||||||||||||||
| 1111 | PKCS7_ISSUER_AND_SERIAL *ias; | - | ||||||||||||||||||
| 1112 | int ret = 0, i; | - | ||||||||||||||||||
| 1113 | struct stack_st_X509 *cert; | - | ||||||||||||||||||
| 1114 | X509 *x509; | - | ||||||||||||||||||
| 1115 | - | |||||||||||||||||||
| 1116 | if (p7 ==
| 0 | ||||||||||||||||||
| 1117 | ((void *)0)
| 0 | ||||||||||||||||||
| 1118 | ) { | - | ||||||||||||||||||
| 1119 | ERR_put_error(33,(0xfff),(143),__FILE__,925); | - | ||||||||||||||||||
| 1120 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1121 | } | - | ||||||||||||||||||
| 1122 | - | |||||||||||||||||||
| 1123 | if (p7->d.ptr ==
| 0 | ||||||||||||||||||
| 1124 | ((void *)0)
| 0 | ||||||||||||||||||
| 1125 | ) { | - | ||||||||||||||||||
| 1126 | ERR_put_error(33,(0xfff),(122),__FILE__,930); | - | ||||||||||||||||||
| 1127 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1128 | } | - | ||||||||||||||||||
| 1129 | - | |||||||||||||||||||
| 1130 | if ((
| 0 | ||||||||||||||||||
| 1131 | cert = p7->d.sign->cert; | - | ||||||||||||||||||
| 1132 | } never executed: else if ((end of block
| 0 | ||||||||||||||||||
| 1133 | cert = p7->d.signed_and_enveloped->cert; | - | ||||||||||||||||||
| 1134 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 1135 | ERR_put_error(33,(0xfff),(114),__FILE__,939); | - | ||||||||||||||||||
| 1136 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1137 | } | - | ||||||||||||||||||
| 1138 | - | |||||||||||||||||||
| 1139 | ias = si->issuer_and_serial; | - | ||||||||||||||||||
| 1140 | - | |||||||||||||||||||
| 1141 | x509 = X509_find_by_issuer_and_serial(cert, ias->issuer, ias->serial); | - | ||||||||||||||||||
| 1142 | - | |||||||||||||||||||
| 1143 | - | |||||||||||||||||||
| 1144 | if (x509 ==
| 0 | ||||||||||||||||||
| 1145 | ((void *)0)
| 0 | ||||||||||||||||||
| 1146 | ) { | - | ||||||||||||||||||
| 1147 | ERR_put_error(33,(0xfff),(106),__FILE__,949); | - | ||||||||||||||||||
| 1148 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1149 | } | - | ||||||||||||||||||
| 1150 | - | |||||||||||||||||||
| 1151 | - | |||||||||||||||||||
| 1152 | if (!X509_STORE_CTX_init(ctx, cert_store, x509, cert)
| 0 | ||||||||||||||||||
| 1153 | ERR_put_error(33,(0xfff),(11),__FILE__,955); | - | ||||||||||||||||||
| 1154 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1155 | } | - | ||||||||||||||||||
| 1156 | if (X509_STORE_CTX_set_purpose(ctx, 4) == 0
| 0 | ||||||||||||||||||
| 1157 | X509_STORE_CTX_cleanup(ctx); | - | ||||||||||||||||||
| 1158 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1159 | } | - | ||||||||||||||||||
| 1160 | i = X509_verify_cert(ctx); | - | ||||||||||||||||||
| 1161 | if (i <= 0
| 0 | ||||||||||||||||||
| 1162 | ERR_put_error(33,(0xfff),(11),__FILE__,964); | - | ||||||||||||||||||
| 1163 | X509_STORE_CTX_cleanup(ctx); | - | ||||||||||||||||||
| 1164 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1165 | } | - | ||||||||||||||||||
| 1166 | X509_STORE_CTX_cleanup(ctx); | - | ||||||||||||||||||
| 1167 | - | |||||||||||||||||||
| 1168 | return never executed: PKCS7_signatureVerify(bio, p7, si, x509);return PKCS7_signatureVerify(bio, p7, si, x509);never executed: return PKCS7_signatureVerify(bio, p7, si, x509); | 0 | ||||||||||||||||||
| 1169 | err: | - | ||||||||||||||||||
| 1170 | - | |||||||||||||||||||
| 1171 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 1172 | } | - | ||||||||||||||||||
| 1173 | - | |||||||||||||||||||
| 1174 | int | - | ||||||||||||||||||
| 1175 | PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, X509 *x509) | - | ||||||||||||||||||
| 1176 | { | - | ||||||||||||||||||
| 1177 | ASN1_OCTET_STRING *os; | - | ||||||||||||||||||
| 1178 | EVP_MD_CTX mdc_tmp, *mdc; | - | ||||||||||||||||||
| 1179 | int ret = 0, i; | - | ||||||||||||||||||
| 1180 | int md_type; | - | ||||||||||||||||||
| 1181 | struct stack_st_X509_ATTRIBUTE *sk; | - | ||||||||||||||||||
| 1182 | BIO *btmp; | - | ||||||||||||||||||
| 1183 | EVP_PKEY *pkey; | - | ||||||||||||||||||
| 1184 | - | |||||||||||||||||||
| 1185 | EVP_MD_CTX_init(&mdc_tmp); | - | ||||||||||||||||||
| 1186 | - | |||||||||||||||||||
| 1187 | if (!(OBJ_obj2nid((p7)->type) == 22)
| 0-2 | ||||||||||||||||||
| 1188 | !(OBJ_obj2nid((p7)->type) == 24)
| 0 | ||||||||||||||||||
| 1189 | ERR_put_error(33,(0xfff),(114),__FILE__,991); | - | ||||||||||||||||||
| 1190 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1191 | } | - | ||||||||||||||||||
| 1192 | - | |||||||||||||||||||
| 1193 | md_type = OBJ_obj2nid(si->digest_alg->algorithm); | - | ||||||||||||||||||
| 1194 | - | |||||||||||||||||||
| 1195 | btmp = bio; | - | ||||||||||||||||||
| 1196 | for (;;) { | - | ||||||||||||||||||
| 1197 | if ((
| 0-2 | ||||||||||||||||||
| 1198 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1199 | )
| 0-2 | ||||||||||||||||||
| 1200 | ((
| 0-2 | ||||||||||||||||||
| 1201 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1202 | )
| 0-2 | ||||||||||||||||||
| 1203 | ERR_put_error(33,(0xfff),(108),__FILE__,1001); | - | ||||||||||||||||||
| 1204 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1205 | } | - | ||||||||||||||||||
| 1206 | BIO_ctrl(btmp,120,0,(char *)&mdc); | - | ||||||||||||||||||
| 1207 | if (mdc ==
| 0-2 | ||||||||||||||||||
| 1208 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1209 | ) { | - | ||||||||||||||||||
| 1210 | ERR_put_error(33,(0xfff),((4|64)),__FILE__,1006); | - | ||||||||||||||||||
| 1211 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1212 | } | - | ||||||||||||||||||
| 1213 | if (EVP_MD_type(EVP_MD_CTX_md(mdc)) == md_type
| 0-2 | ||||||||||||||||||
| 1214 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||
| 1215 | - | |||||||||||||||||||
| 1216 | - | |||||||||||||||||||
| 1217 | - | |||||||||||||||||||
| 1218 | if (EVP_MD_pkey_type(EVP_MD_CTX_md(mdc)) == md_type
| 0 | ||||||||||||||||||
| 1219 | break; never executed: break; | 0 | ||||||||||||||||||
| 1220 | btmp = BIO_next(btmp); | - | ||||||||||||||||||
| 1221 | } never executed: end of block | 0 | ||||||||||||||||||
| 1222 | - | |||||||||||||||||||
| 1223 | - | |||||||||||||||||||
| 1224 | - | |||||||||||||||||||
| 1225 | if (!EVP_MD_CTX_copy_ex(&mdc_tmp, mdc)
| 0-2 | ||||||||||||||||||
| 1226 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1227 | - | |||||||||||||||||||
| 1228 | sk = si->auth_attr; | - | ||||||||||||||||||
| 1229 | if ((
| 0-2 | ||||||||||||||||||
| 1230 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1231 | )
| 0-2 | ||||||||||||||||||
| 1232 | unsigned char md_dat[64], *abuf = | - | ||||||||||||||||||
| 1233 | ((void *)0) | - | ||||||||||||||||||
| 1234 | ; | - | ||||||||||||||||||
| 1235 | unsigned int md_len; | - | ||||||||||||||||||
| 1236 | int alen; | - | ||||||||||||||||||
| 1237 | ASN1_OCTET_STRING *message_digest; | - | ||||||||||||||||||
| 1238 | - | |||||||||||||||||||
| 1239 | if (!EVP_DigestFinal_ex(&mdc_tmp, md_dat, &md_len)
| 0-2 | ||||||||||||||||||
| 1240 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1241 | message_digest = PKCS7_digest_from_attributes(sk); | - | ||||||||||||||||||
| 1242 | if (!message_digest
| 0-2 | ||||||||||||||||||
| 1243 | ERR_put_error(33,(0xfff),(108),__FILE__,1035); | - | ||||||||||||||||||
| 1244 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1245 | } | - | ||||||||||||||||||
| 1246 | if ((
| 0-2 | ||||||||||||||||||
| 1247 | (
| 0-2 | ||||||||||||||||||
| 1248 | ERR_put_error(33,(0xfff),(101),__FILE__,1040); | - | ||||||||||||||||||
| 1249 | ret = -1; | - | ||||||||||||||||||
| 1250 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1251 | } | - | ||||||||||||||||||
| 1252 | - | |||||||||||||||||||
| 1253 | if (!EVP_DigestInit_ex(&mdc_tmp,EVP_get_digestbyname(OBJ_nid2sn(md_type)),
| 0-2 | ||||||||||||||||||
| 1254 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1255 | )
| 0-2 | ||||||||||||||||||
| 1256 | ) | - | ||||||||||||||||||
| 1257 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1258 | - | |||||||||||||||||||
| 1259 | alen = ASN1_item_i2d((ASN1_VALUE *)sk, &abuf, | - | ||||||||||||||||||
| 1260 | &PKCS7_ATTR_VERIFY_it); | - | ||||||||||||||||||
| 1261 | if (alen <= 0
| 0-2 | ||||||||||||||||||
| 1262 | ERR_put_error(33,(0xfff),(13),__FILE__,1052); | - | ||||||||||||||||||
| 1263 | ret = -1; | - | ||||||||||||||||||
| 1264 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1265 | } | - | ||||||||||||||||||
| 1266 | if (!EVP_DigestUpdate(&mdc_tmp,abuf,alen)
| 0-2 | ||||||||||||||||||
| 1267 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1268 | - | |||||||||||||||||||
| 1269 | free(abuf); | - | ||||||||||||||||||
| 1270 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 1271 | - | |||||||||||||||||||
| 1272 | os = si->enc_digest; | - | ||||||||||||||||||
| 1273 | pkey = X509_get_pubkey(x509); | - | ||||||||||||||||||
| 1274 | if (!pkey
| 0-2 | ||||||||||||||||||
| 1275 | ret = -1; | - | ||||||||||||||||||
| 1276 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1277 | } | - | ||||||||||||||||||
| 1278 | - | |||||||||||||||||||
| 1279 | i = EVP_VerifyFinal(&mdc_tmp, os->data, os->length, pkey); | - | ||||||||||||||||||
| 1280 | EVP_PKEY_free(pkey); | - | ||||||||||||||||||
| 1281 | if (i <= 0
| 0-2 | ||||||||||||||||||
| 1282 | ERR_put_error(33,(0xfff),(105),__FILE__,1072); | - | ||||||||||||||||||
| 1283 | ret = -1; | - | ||||||||||||||||||
| 1284 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1285 | } else | - | ||||||||||||||||||
| 1286 | ret = 1; executed 2 times by 1 test: ret = 1;Executed by:
| 2 | ||||||||||||||||||
| 1287 | err: code before this statement executed 2 times by 1 test: err:Executed by:
| 2 | ||||||||||||||||||
| 1288 | EVP_MD_CTX_cleanup(&mdc_tmp); | - | ||||||||||||||||||
| 1289 | return executed 2 times by 1 test: (ret);return (ret);Executed by:
executed 2 times by 1 test: return (ret);Executed by:
| 2 | ||||||||||||||||||
| 1290 | } | - | ||||||||||||||||||
| 1291 | - | |||||||||||||||||||
| 1292 | PKCS7_ISSUER_AND_SERIAL * | - | ||||||||||||||||||
| 1293 | PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx) | - | ||||||||||||||||||
| 1294 | { | - | ||||||||||||||||||
| 1295 | struct stack_st_PKCS7_RECIP_INFO *rsk; | - | ||||||||||||||||||
| 1296 | PKCS7_RECIP_INFO *ri; | - | ||||||||||||||||||
| 1297 | int i; | - | ||||||||||||||||||
| 1298 | - | |||||||||||||||||||
| 1299 | i = OBJ_obj2nid(p7->type); | - | ||||||||||||||||||
| 1300 | if (i != 24
| 0 | ||||||||||||||||||
| 1301 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1302 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1303 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1304 | if (p7->d.signed_and_enveloped ==
| 0 | ||||||||||||||||||
| 1305 | ((void *)0)
| 0 | ||||||||||||||||||
| 1306 | ) | - | ||||||||||||||||||
| 1307 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1308 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1309 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1310 | rsk = p7->d.signed_and_enveloped->recipientinfo; | - | ||||||||||||||||||
| 1311 | if (rsk ==
| 0 | ||||||||||||||||||
| 1312 | ((void *)0)
| 0 | ||||||||||||||||||
| 1313 | ) | - | ||||||||||||||||||
| 1314 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1315 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1316 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1317 | ri = ((PKCS7_RECIP_INFO *)sk_value(((_STACK*) (1 ? (rsk) : (struct stack_st_PKCS7_RECIP_INFO*)0)), (0))); | - | ||||||||||||||||||
| 1318 | if (sk_num(((_STACK*) (1 ? (rsk) : (struct stack_st_PKCS7_RECIP_INFO*)0))) <= idx
| 0 | ||||||||||||||||||
| 1319 | return never executed: (return ( ((void *)0) );never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 1320 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 1321 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 1322 | ri = ((PKCS7_RECIP_INFO *)sk_value(((_STACK*) (1 ? (rsk) : (struct stack_st_PKCS7_RECIP_INFO*)0)), (idx))); | - | ||||||||||||||||||
| 1323 | return never executed: (ri->issuer_and_serial);return (ri->issuer_and_serial);never executed: return (ri->issuer_and_serial); | 0 | ||||||||||||||||||
| 1324 | } | - | ||||||||||||||||||
| 1325 | - | |||||||||||||||||||
| 1326 | ASN1_TYPE * | - | ||||||||||||||||||
| 1327 | PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid) | - | ||||||||||||||||||
| 1328 | { | - | ||||||||||||||||||
| 1329 | return executed 4 times by 1 test: (get_attribute(si->auth_attr, nid));return (get_attribute(si->auth_attr, nid));Executed by:
executed 4 times by 1 test: return (get_attribute(si->auth_attr, nid));Executed by:
| 4 | ||||||||||||||||||
| 1330 | } | - | ||||||||||||||||||
| 1331 | - | |||||||||||||||||||
| 1332 | ASN1_TYPE * | - | ||||||||||||||||||
| 1333 | PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid) | - | ||||||||||||||||||
| 1334 | { | - | ||||||||||||||||||
| 1335 | return never executed: (get_attribute(si->unauth_attr, nid));return (get_attribute(si->unauth_attr, nid));never executed: return (get_attribute(si->unauth_attr, nid)); | 0 | ||||||||||||||||||
| 1336 | } | - | ||||||||||||||||||
| 1337 | - | |||||||||||||||||||
| 1338 | static ASN1_TYPE * | - | ||||||||||||||||||
| 1339 | get_attribute(struct stack_st_X509_ATTRIBUTE *sk, int nid) | - | ||||||||||||||||||
| 1340 | { | - | ||||||||||||||||||
| 1341 | int i; | - | ||||||||||||||||||
| 1342 | X509_ATTRIBUTE *xa; | - | ||||||||||||||||||
| 1343 | ASN1_OBJECT *o; | - | ||||||||||||||||||
| 1344 | - | |||||||||||||||||||
| 1345 | o = OBJ_nid2obj(nid); | - | ||||||||||||||||||
| 1346 | if (!o
| 0-6 | ||||||||||||||||||
| 1347 | return executed 2 times by 1 test: (return ( ((void *)0) );Executed by:
executed 2 times by 1 test: return ( ((void *)0) );Executed by:
| 2 | ||||||||||||||||||
| 1348 | ((void *)0) executed 2 times by 1 test: return ( ((void *)0) );Executed by:
| 2 | ||||||||||||||||||
| 1349 | ); executed 2 times by 1 test: return ( ((void *)0) );Executed by:
| 2 | ||||||||||||||||||
| 1350 | for (i = 0; i < sk_num(((_STACK*) (1 ? (sk) : (struct stack_st_X509_ATTRIBUTE*)0)))
| 2-10 | ||||||||||||||||||
| 1351 | xa = ((X509_ATTRIBUTE *)sk_value(((_STACK*) (1 ? (sk) : (struct stack_st_X509_ATTRIBUTE*)0)), (i))); | - | ||||||||||||||||||
| 1352 | if (OBJ_cmp(xa->object, o) == 0
| 2-8 | ||||||||||||||||||
| 1353 | if (!xa->single
| 0-2 | ||||||||||||||||||
| 1354 | return executed 2 times by 1 test: (((ASN1_TYPE *)sk_value(((_STACK*) (1 ? (xa->value.set) : (struct stack_st_ASN1_TYPE*)0)), (0))));return (((ASN1_TYPE *)sk_value(((_STACK*) (1 ? (xa->value.set) : (struct stack_st_ASN1_TYPE*)0)), (0))));Executed by:
executed 2 times by 1 test: return (((ASN1_TYPE *)sk_value(((_STACK*) (1 ? (xa->value.set) : (struct stack_st_ASN1_TYPE*)0)), (0))));Executed by:
| 2 | ||||||||||||||||||
| 1355 | else | - | ||||||||||||||||||
| 1356 | return never executed: (return ( ((void *)0) );never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 1357 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 1358 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 1359 | } | - | ||||||||||||||||||
| 1360 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 1361 | return executed 2 times by 1 test: (return ( ((void *)0) );Executed by:
executed 2 times by 1 test: return ( ((void *)0) );Executed by:
| 2 | ||||||||||||||||||
| 1362 | ((void *)0) executed 2 times by 1 test: return ( ((void *)0) );Executed by:
| 2 | ||||||||||||||||||
| 1363 | ); executed 2 times by 1 test: return ( ((void *)0) );Executed by:
| 2 | ||||||||||||||||||
| 1364 | } | - | ||||||||||||||||||
| 1365 | - | |||||||||||||||||||
| 1366 | ASN1_OCTET_STRING * | - | ||||||||||||||||||
| 1367 | PKCS7_digest_from_attributes(struct stack_st_X509_ATTRIBUTE *sk) | - | ||||||||||||||||||
| 1368 | { | - | ||||||||||||||||||
| 1369 | ASN1_TYPE *astype; | - | ||||||||||||||||||
| 1370 | - | |||||||||||||||||||
| 1371 | if (!(astype = get_attribute(sk, 51))
| 0-2 | ||||||||||||||||||
| 1372 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1373 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1374 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1375 | if (astype->type != 4
| 0-2 | ||||||||||||||||||
| 1376 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1377 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1378 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1379 | return executed 2 times by 1 test: astype->value.octet_string;return astype->value.octet_string;Executed by:
executed 2 times by 1 test: return astype->value.octet_string;Executed by:
| 2 | ||||||||||||||||||
| 1380 | } | - | ||||||||||||||||||
| 1381 | - | |||||||||||||||||||
| 1382 | int | - | ||||||||||||||||||
| 1383 | PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, | - | ||||||||||||||||||
| 1384 | struct stack_st_X509_ATTRIBUTE *sk) | - | ||||||||||||||||||
| 1385 | { | - | ||||||||||||||||||
| 1386 | int i; | - | ||||||||||||||||||
| 1387 | - | |||||||||||||||||||
| 1388 | if (p7si->auth_attr !=
| 0 | ||||||||||||||||||
| 1389 | ((void *)0)
| 0 | ||||||||||||||||||
| 1390 | ) | - | ||||||||||||||||||
| 1391 | sk_pop_free(((_STACK*) (1 ? (p7si->auth_attr) : (struct stack_st_X509_ATTRIBUTE*)0)), ((void (*)(void *)) ((1 ? (X509_ATTRIBUTE_free) : (void (*)(X509_ATTRIBUTE *))0)))) never executed: sk_pop_free(((_STACK*) (1 ? (p7si->auth_attr) : (struct stack_st_X509_ATTRIBUTE*)0)), ((void (*)(void *)) ((1 ? (X509_ATTRIBUTE_free) : (void (*)(X509_ATTRIBUTE *))0)))) ; | 0 | ||||||||||||||||||
| 1392 | ; never executed: sk_pop_free(((_STACK*) (1 ? (p7si->auth_attr) : (struct stack_st_X509_ATTRIBUTE*)0)), ((void (*)(void *)) ((1 ? (X509_ATTRIBUTE_free) : (void (*)(X509_ATTRIBUTE *))0)))) ; | 0 | ||||||||||||||||||
| 1393 | p7si->auth_attr = (struct stack_st_X509_ATTRIBUTE *)sk_dup(((_STACK*) (1 ? sk : (struct stack_st_X509_ATTRIBUTE*)0))); | - | ||||||||||||||||||
| 1394 | if (p7si->auth_attr ==
| 0 | ||||||||||||||||||
| 1395 | ((void *)0)
| 0 | ||||||||||||||||||
| 1396 | ) | - | ||||||||||||||||||
| 1397 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1398 | for (i = 0; i < sk_num(((_STACK*) (1 ? (sk) : (struct stack_st_X509_ATTRIBUTE*)0)))
| 0 | ||||||||||||||||||
| 1399 | if ((
| 0 | ||||||||||||||||||
| 1400 | )
| 0 | ||||||||||||||||||
| 1401 | ==
| 0 | ||||||||||||||||||
| 1402 | ((void *)0)
| 0 | ||||||||||||||||||
| 1403 | ) | - | ||||||||||||||||||
| 1404 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||||||||
| 1405 | } never executed: end of block | 0 | ||||||||||||||||||
| 1406 | return never executed: (1);return (1);never executed: return (1); | 0 | ||||||||||||||||||
| 1407 | } | - | ||||||||||||||||||
| 1408 | - | |||||||||||||||||||
| 1409 | int | - | ||||||||||||||||||
| 1410 | PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, struct stack_st_X509_ATTRIBUTE *sk) | - | ||||||||||||||||||
| 1411 | { | - | ||||||||||||||||||
| 1412 | int i; | - | ||||||||||||||||||
| 1413 | - | |||||||||||||||||||
| 1414 | if (p7si->unauth_attr !=
| 0 | ||||||||||||||||||
| 1415 | ((void *)0)
| 0 | ||||||||||||||||||
| 1416 | ) | - | ||||||||||||||||||
| 1417 | sk_pop_free(((_STACK*) (1 ? (p7si->unauth_attr) : (struct stack_st_X509_ATTRIBUTE*)0)), ((void (*)(void *)) ((1 ? (X509_ATTRIBUTE_free) : (void (*)(X509_ATTRIBUTE *))0)))) never executed: sk_pop_free(((_STACK*) (1 ? (p7si->unauth_attr) : (struct stack_st_X509_ATTRIBUTE*)0)), ((void (*)(void *)) ((1 ? (X509_ATTRIBUTE_free) : (void (*)(X509_ATTRIBUTE *))0)))) ; | 0 | ||||||||||||||||||
| 1418 | ; never executed: sk_pop_free(((_STACK*) (1 ? (p7si->unauth_attr) : (struct stack_st_X509_ATTRIBUTE*)0)), ((void (*)(void *)) ((1 ? (X509_ATTRIBUTE_free) : (void (*)(X509_ATTRIBUTE *))0)))) ; | 0 | ||||||||||||||||||
| 1419 | p7si->unauth_attr = (struct stack_st_X509_ATTRIBUTE *)sk_dup(((_STACK*) (1 ? sk : (struct stack_st_X509_ATTRIBUTE*)0))); | - | ||||||||||||||||||
| 1420 | if (p7si->unauth_attr ==
| 0 | ||||||||||||||||||
| 1421 | ((void *)0)
| 0 | ||||||||||||||||||
| 1422 | ) | - | ||||||||||||||||||
| 1423 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1424 | for (i = 0; i < sk_num(((_STACK*) (1 ? (sk) : (struct stack_st_X509_ATTRIBUTE*)0)))
| 0 | ||||||||||||||||||
| 1425 | if ((
| 0 | ||||||||||||||||||
| 1426 | )
| 0 | ||||||||||||||||||
| 1427 | ==
| 0 | ||||||||||||||||||
| 1428 | ((void *)0)
| 0 | ||||||||||||||||||
| 1429 | ) | - | ||||||||||||||||||
| 1430 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||||||||
| 1431 | } never executed: end of block | 0 | ||||||||||||||||||
| 1432 | return never executed: (1);return (1);never executed: return (1); | 0 | ||||||||||||||||||
| 1433 | } | - | ||||||||||||||||||
| 1434 | - | |||||||||||||||||||
| 1435 | int | - | ||||||||||||||||||
| 1436 | PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, | - | ||||||||||||||||||
| 1437 | void *value) | - | ||||||||||||||||||
| 1438 | { | - | ||||||||||||||||||
| 1439 | return executed 8 times by 1 test: (add_attribute(&(p7si->auth_attr), nid, atrtype, value));return (add_attribute(&(p7si->auth_attr), nid, atrtype, value));Executed by:
executed 8 times by 1 test: return (add_attribute(&(p7si->auth_attr), nid, atrtype, value));Executed by:
| 8 | ||||||||||||||||||
| 1440 | } | - | ||||||||||||||||||
| 1441 | - | |||||||||||||||||||
| 1442 | int | - | ||||||||||||||||||
| 1443 | PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, void *value) | - | ||||||||||||||||||
| 1444 | { | - | ||||||||||||||||||
| 1445 | return never executed: (add_attribute(&(p7si->unauth_attr), nid, atrtype, value));return (add_attribute(&(p7si->unauth_attr), nid, atrtype, value));never executed: return (add_attribute(&(p7si->unauth_attr), nid, atrtype, value)); | 0 | ||||||||||||||||||
| 1446 | } | - | ||||||||||||||||||
| 1447 | - | |||||||||||||||||||
| 1448 | static int | - | ||||||||||||||||||
| 1449 | add_attribute(struct stack_st_X509_ATTRIBUTE **sk, int nid, int atrtype, void *value) | - | ||||||||||||||||||
| 1450 | { | - | ||||||||||||||||||
| 1451 | X509_ATTRIBUTE *attr = | - | ||||||||||||||||||
| 1452 | ((void *)0) | - | ||||||||||||||||||
| 1453 | ; | - | ||||||||||||||||||
| 1454 | - | |||||||||||||||||||
| 1455 | if (*
| 2-6 | ||||||||||||||||||
| 1456 | ((void *)0)
| 2-6 | ||||||||||||||||||
| 1457 | ) { | - | ||||||||||||||||||
| 1458 | *sk = ((struct stack_st_X509_ATTRIBUTE *)sk_new_null()); | - | ||||||||||||||||||
| 1459 | if (*
| 0-2 | ||||||||||||||||||
| 1460 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 1461 | ) | - | ||||||||||||||||||
| 1462 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1463 | new_attrib: code before this statement executed 2 times by 1 test: new_attrib:Executed by:
| 2 | ||||||||||||||||||
| 1464 | if (!(attr = X509_ATTRIBUTE_create(nid, atrtype, value))
| 0-8 | ||||||||||||||||||
| 1465 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1466 | if (!sk_push(((_STACK*) (1 ? (*sk) : (struct stack_st_X509_ATTRIBUTE*)0)), ((void*) (1 ? (attr) : (X509_ATTRIBUTE*)0)))
| 0-8 | ||||||||||||||||||
| 1467 | X509_ATTRIBUTE_free(attr); | - | ||||||||||||||||||
| 1468 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1469 | } | - | ||||||||||||||||||
| 1470 | } executed 8 times by 1 test: else {end of blockExecuted by:
| 8 | ||||||||||||||||||
| 1471 | int i; | - | ||||||||||||||||||
| 1472 | - | |||||||||||||||||||
| 1473 | for (i = 0; i < sk_num(((_STACK*) (1 ? (*sk) : (struct stack_st_X509_ATTRIBUTE*)0)))
| 6-12 | ||||||||||||||||||
| 1474 | attr = ((X509_ATTRIBUTE *)sk_value(((_STACK*) (1 ? (*sk) : (struct stack_st_X509_ATTRIBUTE*)0)), (i))); | - | ||||||||||||||||||
| 1475 | if (OBJ_obj2nid(attr->object) == nid
| 0-12 | ||||||||||||||||||
| 1476 | X509_ATTRIBUTE_free(attr); | - | ||||||||||||||||||
| 1477 | attr = X509_ATTRIBUTE_create(nid, atrtype, | - | ||||||||||||||||||
| 1478 | value); | - | ||||||||||||||||||
| 1479 | if (attr ==
| 0 | ||||||||||||||||||
| 1480 | ((void *)0)
| 0 | ||||||||||||||||||
| 1481 | ) | - | ||||||||||||||||||
| 1482 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1483 | if (!sk_set(((_STACK*) (1 ? (*sk) : (struct stack_st_X509_ATTRIBUTE*)0)), (i), ((void*) (1 ? (attr) : (X509_ATTRIBUTE*)0)))
| 0 | ||||||||||||||||||
| 1484 | X509_ATTRIBUTE_free(attr); | - | ||||||||||||||||||
| 1485 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1486 | } | - | ||||||||||||||||||
| 1487 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||
| 1488 | } | - | ||||||||||||||||||
| 1489 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 1490 | goto executed 6 times by 1 test: new_attrib;goto new_attrib;Executed by:
executed 6 times by 1 test: goto new_attrib;Executed by:
| 6 | ||||||||||||||||||
| 1491 | } | - | ||||||||||||||||||
| 1492 | end: code before this statement executed 8 times by 1 test: end:Executed by:
| 8 | ||||||||||||||||||
| 1493 | return executed 8 times by 1 test: (1);return (1);Executed by:
executed 8 times by 1 test: return (1);Executed by:
| 8 | ||||||||||||||||||
| 1494 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |