Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/pkcs7/pk7_attr.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | int | - | ||||||||||||||||||
5 | PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, struct stack_st_X509_ALGOR *cap) | - | ||||||||||||||||||
6 | { | - | ||||||||||||||||||
7 | ASN1_STRING *seq; | - | ||||||||||||||||||
8 | if (!(seq = ASN1_STRING_new())
| 0-2 | ||||||||||||||||||
9 | ERR_put_error(33,(0xfff),((1|64)),__FILE__,74); | - | ||||||||||||||||||
10 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
11 | } | - | ||||||||||||||||||
12 | seq->length = ASN1_item_i2d((ASN1_VALUE *)cap, &seq->data, | - | ||||||||||||||||||
13 | &X509_ALGORS_it); | - | ||||||||||||||||||
14 | return executed 2 times by 1 test: PKCS7_add_signed_attribute(si, 167,return PKCS7_add_signed_attribute(si, 167, 16, seq); Executed by:
executed 2 times by 1 test: return PKCS7_add_signed_attribute(si, 167, 16, seq); Executed by:
| 2 | ||||||||||||||||||
15 | 16, seq); executed 2 times by 1 test: return PKCS7_add_signed_attribute(si, 167, 16, seq); Executed by:
| 2 | ||||||||||||||||||
16 | } | - | ||||||||||||||||||
17 | - | |||||||||||||||||||
18 | struct stack_st_X509_ALGOR * | - | ||||||||||||||||||
19 | PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si) | - | ||||||||||||||||||
20 | { | - | ||||||||||||||||||
21 | ASN1_TYPE *cap; | - | ||||||||||||||||||
22 | const unsigned char *p; | - | ||||||||||||||||||
23 | - | |||||||||||||||||||
24 | cap = PKCS7_get_signed_attribute(si, 167); | - | ||||||||||||||||||
25 | if (!cap
| 0 | ||||||||||||||||||
26 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
27 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
28 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
29 | p = cap->value.sequence->data; | - | ||||||||||||||||||
30 | return never executed: (struct stack_st_X509_ALGOR *)return (struct stack_st_X509_ALGOR *) ASN1_item_d2i( ((void *)0) , &p, cap->value.sequence->length, &X509_ALGORS_it); never executed: return (struct stack_st_X509_ALGOR *) ASN1_item_d2i( ((void *)0) , &p, cap->value.sequence->length, &X509_ALGORS_it); | 0 | ||||||||||||||||||
31 | ASN1_item_d2i( never executed: return (struct stack_st_X509_ALGOR *) ASN1_item_d2i( ((void *)0) , &p, cap->value.sequence->length, &X509_ALGORS_it); | 0 | ||||||||||||||||||
32 | ((void *)0) never executed: return (struct stack_st_X509_ALGOR *) ASN1_item_d2i( ((void *)0) , &p, cap->value.sequence->length, &X509_ALGORS_it); | 0 | ||||||||||||||||||
33 | , &p, cap->value.sequence->length, never executed: return (struct stack_st_X509_ALGOR *) ASN1_item_d2i( ((void *)0) , &p, cap->value.sequence->length, &X509_ALGORS_it); | 0 | ||||||||||||||||||
34 | &X509_ALGORS_it); never executed: return (struct stack_st_X509_ALGOR *) ASN1_item_d2i( ((void *)0) , &p, cap->value.sequence->length, &X509_ALGORS_it); | 0 | ||||||||||||||||||
35 | } | - | ||||||||||||||||||
36 | - | |||||||||||||||||||
37 | - | |||||||||||||||||||
38 | int | - | ||||||||||||||||||
39 | PKCS7_simple_smimecap(struct stack_st_X509_ALGOR *sk, int nid, int arg) | - | ||||||||||||||||||
40 | { | - | ||||||||||||||||||
41 | X509_ALGOR *alg; | - | ||||||||||||||||||
42 | - | |||||||||||||||||||
43 | if (!(alg = X509_ALGOR_new())
| 0-24 | ||||||||||||||||||
44 | ERR_put_error(33,(0xfff),((1|64)),__FILE__,105); | - | ||||||||||||||||||
45 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
46 | } | - | ||||||||||||||||||
47 | ASN1_OBJECT_free(alg->algorithm); | - | ||||||||||||||||||
48 | alg->algorithm = OBJ_nid2obj(nid); | - | ||||||||||||||||||
49 | if (arg > 0
| 6-18 | ||||||||||||||||||
50 | ASN1_INTEGER *nbit; | - | ||||||||||||||||||
51 | - | |||||||||||||||||||
52 | if (!(alg->parameter = ASN1_TYPE_new())
| 0-6 | ||||||||||||||||||
53 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
54 | if (!(nbit = ASN1_INTEGER_new())
| 0-6 | ||||||||||||||||||
55 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
56 | if (!ASN1_INTEGER_set(nbit, arg)
| 0-6 | ||||||||||||||||||
57 | ASN1_INTEGER_free(nbit); | - | ||||||||||||||||||
58 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
59 | } | - | ||||||||||||||||||
60 | alg->parameter->value.integer = nbit; | - | ||||||||||||||||||
61 | alg->parameter->type = 2; | - | ||||||||||||||||||
62 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||
63 | if (sk_push(((_STACK*) (1 ? (sk) : (struct stack_st_X509_ALGOR*)0)), ((void*) (1 ? (alg) : (X509_ALGOR*)0))) == 0
| 0-24 | ||||||||||||||||||
64 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
65 | return executed 24 times by 1 test: 1;return 1; Executed by:
executed 24 times by 1 test: return 1; Executed by:
| 24 | ||||||||||||||||||
66 | - | |||||||||||||||||||
67 | err: | - | ||||||||||||||||||
68 | ERR_put_error(33,(0xfff),((1|64)),__FILE__,129); | - | ||||||||||||||||||
69 | X509_ALGOR_free(alg); | - | ||||||||||||||||||
70 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
71 | } | - | ||||||||||||||||||
72 | - | |||||||||||||||||||
73 | int | - | ||||||||||||||||||
74 | PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid) | - | ||||||||||||||||||
75 | { | - | ||||||||||||||||||
76 | if (PKCS7_get_signed_attribute(si, 50)
| 0-2 | ||||||||||||||||||
77 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
78 | if (!coid
| 0-2 | ||||||||||||||||||
79 | coid = OBJ_nid2obj(21); executed 2 times by 1 test: coid = OBJ_nid2obj(21); Executed by:
| 2 | ||||||||||||||||||
80 | return executed 2 times by 1 test: PKCS7_add_signed_attribute(si, 50,return PKCS7_add_signed_attribute(si, 50, 6, coid); Executed by:
executed 2 times by 1 test: return PKCS7_add_signed_attribute(si, 50, 6, coid); Executed by:
| 2 | ||||||||||||||||||
81 | 6, coid); executed 2 times by 1 test: return PKCS7_add_signed_attribute(si, 50, 6, coid); Executed by:
| 2 | ||||||||||||||||||
82 | } | - | ||||||||||||||||||
83 | - | |||||||||||||||||||
84 | int | - | ||||||||||||||||||
85 | PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t) | - | ||||||||||||||||||
86 | { | - | ||||||||||||||||||
87 | if (!t
| 0-2 | ||||||||||||||||||
88 | ((void *)0)
| 0-2 | ||||||||||||||||||
89 | , 0))
| 0-2 | ||||||||||||||||||
90 | ERR_put_error(33,(0xfff),((1|64)),__FILE__,149); | - | ||||||||||||||||||
91 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
92 | } | - | ||||||||||||||||||
93 | return executed 2 times by 1 test: PKCS7_add_signed_attribute(si, 52,return PKCS7_add_signed_attribute(si, 52, 23, t); Executed by:
executed 2 times by 1 test: return PKCS7_add_signed_attribute(si, 52, 23, t); Executed by:
| 2 | ||||||||||||||||||
94 | 23, t); executed 2 times by 1 test: return PKCS7_add_signed_attribute(si, 52, 23, t); Executed by:
| 2 | ||||||||||||||||||
95 | } | - | ||||||||||||||||||
96 | - | |||||||||||||||||||
97 | int | - | ||||||||||||||||||
98 | PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, const unsigned char *md, | - | ||||||||||||||||||
99 | int mdlen) | - | ||||||||||||||||||
100 | { | - | ||||||||||||||||||
101 | ASN1_OCTET_STRING *os; | - | ||||||||||||||||||
102 | - | |||||||||||||||||||
103 | os = ASN1_OCTET_STRING_new(); | - | ||||||||||||||||||
104 | if (!os
| 0-2 | ||||||||||||||||||
105 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
106 | if (!ASN1_STRING_set(os, md, mdlen)
| 0-2 | ||||||||||||||||||
107 | !PKCS7_add_signed_attribute(si, 51,
| 0-2 | ||||||||||||||||||
108 | 4, os)
| 0-2 | ||||||||||||||||||
109 | ASN1_OCTET_STRING_free(os); | - | ||||||||||||||||||
110 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
111 | } | - | ||||||||||||||||||
112 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||
113 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |