Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/evp_asn1.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len) | - | ||||||||||||||||||||||||
3 | { | - | ||||||||||||||||||||||||
4 | ASN1_STRING *os; | - | ||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | if ((
| 0-26 | ||||||||||||||||||||||||
7 | ((void *)0)
| 0-26 | ||||||||||||||||||||||||
8 | ) | - | ||||||||||||||||||||||||
9 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
10 | if (!ASN1_OCTET_STRING_set(os, data, len)
| 0-26 | ||||||||||||||||||||||||
11 | ASN1_OCTET_STRING_free(os); | - | ||||||||||||||||||||||||
12 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
13 | } | - | ||||||||||||||||||||||||
14 | ASN1_TYPE_set(a, 4, os); | - | ||||||||||||||||||||||||
15 | return executed 26 times by 1 test: 1;return 1; Executed by:
executed 26 times by 1 test: return 1; Executed by:
| 26 | ||||||||||||||||||||||||
16 | } | - | ||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||
19 | int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len) | - | ||||||||||||||||||||||||
20 | { | - | ||||||||||||||||||||||||
21 | int ret, num; | - | ||||||||||||||||||||||||
22 | const unsigned char *p; | - | ||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||
24 | if ((
| 0-26 | ||||||||||||||||||||||||
25 | ((void *)0)
| 0-26 | ||||||||||||||||||||||||
26 | )
| 0-26 | ||||||||||||||||||||||||
27 | ERR_put_error(13,(135),(109),__FILE__,36); | - | ||||||||||||||||||||||||
28 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
29 | } | - | ||||||||||||||||||||||||
30 | p = ASN1_STRING_get0_data(a->value.octet_string); | - | ||||||||||||||||||||||||
31 | ret = ASN1_STRING_length(a->value.octet_string); | - | ||||||||||||||||||||||||
32 | if (ret < max_len
| 0-26 | ||||||||||||||||||||||||
33 | num = ret; never executed: num = ret; | 0 | ||||||||||||||||||||||||
34 | else | - | ||||||||||||||||||||||||
35 | num = max_len; executed 26 times by 1 test: num = max_len; Executed by:
| 26 | ||||||||||||||||||||||||
36 | memcpy(data, p, num); | - | ||||||||||||||||||||||||
37 | return executed 26 times by 1 test: ret;return ret; Executed by:
executed 26 times by 1 test: return ret; Executed by:
| 26 | ||||||||||||||||||||||||
38 | } | - | ||||||||||||||||||||||||
39 | - | |||||||||||||||||||||||||
40 | typedef struct { | - | ||||||||||||||||||||||||
41 | int32_t num; | - | ||||||||||||||||||||||||
42 | ASN1_OCTET_STRING *oct; | - | ||||||||||||||||||||||||
43 | } asn1_int_oct; | - | ||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||
45 | static const ASN1_TEMPLATE asn1_int_oct_seq_tt[] = { | - | ||||||||||||||||||||||||
46 | { ((0x1 << 12)), (0), | - | ||||||||||||||||||||||||
47 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
48 | asn1_int_oct | - | ||||||||||||||||||||||||
49 | , | - | ||||||||||||||||||||||||
50 | num | - | ||||||||||||||||||||||||
51 | ) | - | ||||||||||||||||||||||||
52 | , "num", (&(INT32_it)) }, | - | ||||||||||||||||||||||||
53 | { (0), (0), | - | ||||||||||||||||||||||||
54 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
55 | asn1_int_oct | - | ||||||||||||||||||||||||
56 | , | - | ||||||||||||||||||||||||
57 | oct | - | ||||||||||||||||||||||||
58 | ) | - | ||||||||||||||||||||||||
59 | , "oct", (&(ASN1_OCTET_STRING_it)) } | - | ||||||||||||||||||||||||
60 | } ; static const ASN1_ITEM asn1_int_oct_it = { 0x1, 16, asn1_int_oct_seq_tt, sizeof(asn1_int_oct_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||||||||
61 | ((void *)0) | - | ||||||||||||||||||||||||
62 | , sizeof(asn1_int_oct), "asn1_int_oct" }; | - | ||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||
64 | extern const ASN1_ITEM asn1_int_oct_it; | - | ||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||
66 | int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, | - | ||||||||||||||||||||||||
67 | int len) | - | ||||||||||||||||||||||||
68 | { | - | ||||||||||||||||||||||||
69 | asn1_int_oct atmp; | - | ||||||||||||||||||||||||
70 | ASN1_OCTET_STRING oct; | - | ||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||
72 | atmp.num = num; | - | ||||||||||||||||||||||||
73 | atmp.oct = &oct; | - | ||||||||||||||||||||||||
74 | oct.data = data; | - | ||||||||||||||||||||||||
75 | oct.type = 4; | - | ||||||||||||||||||||||||
76 | oct.length = len; | - | ||||||||||||||||||||||||
77 | oct.flags = 0; | - | ||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||
79 | if (ASN1_TYPE_pack_sequence((&(asn1_int_oct_it)), &atmp, &a)
| 0-2 | ||||||||||||||||||||||||
80 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||
81 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
82 | } | - | ||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||
84 | - | |||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||
88 | int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num, | - | ||||||||||||||||||||||||
89 | unsigned char *data, int max_len) | - | ||||||||||||||||||||||||
90 | { | - | ||||||||||||||||||||||||
91 | asn1_int_oct *atmp = | - | ||||||||||||||||||||||||
92 | ((void *)0) | - | ||||||||||||||||||||||||
93 | ; | - | ||||||||||||||||||||||||
94 | int ret = -1, n; | - | ||||||||||||||||||||||||
95 | - | |||||||||||||||||||||||||
96 | if ((
| 0-2 | ||||||||||||||||||||||||
97 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
98 | )
| 0-2 | ||||||||||||||||||||||||
99 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
100 | } | - | ||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||
102 | atmp = ASN1_TYPE_unpack_sequence((&(asn1_int_oct_it)), a); | - | ||||||||||||||||||||||||
103 | - | |||||||||||||||||||||||||
104 | if (atmp ==
| 0-2 | ||||||||||||||||||||||||
105 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
106 | ) | - | ||||||||||||||||||||||||
107 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
108 | - | |||||||||||||||||||||||||
109 | if (num !=
| 0-2 | ||||||||||||||||||||||||
110 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
111 | ) | - | ||||||||||||||||||||||||
112 | * executed 2 times by 1 test: num = atmp->num;*num = atmp->num; Executed by:
executed 2 times by 1 test: *num = atmp->num; Executed by:
| 2 | ||||||||||||||||||||||||
113 | - | |||||||||||||||||||||||||
114 | ret = ASN1_STRING_length(atmp->oct); | - | ||||||||||||||||||||||||
115 | if (max_len > ret
| 0-2 | ||||||||||||||||||||||||
116 | n = ret; never executed: n = ret; | 0 | ||||||||||||||||||||||||
117 | else | - | ||||||||||||||||||||||||
118 | n = max_len; executed 2 times by 1 test: n = max_len; Executed by:
| 2 | ||||||||||||||||||||||||
119 | - | |||||||||||||||||||||||||
120 | if (data !=
| 0-2 | ||||||||||||||||||||||||
121 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
122 | ) | - | ||||||||||||||||||||||||
123 | memcpy(data, ASN1_STRING_get0_data(atmp->oct), n); executed 2 times by 1 test: memcpy(data, ASN1_STRING_get0_data(atmp->oct), n); Executed by:
| 2 | ||||||||||||||||||||||||
124 | if (ret == -1
| 0-2 | ||||||||||||||||||||||||
125 | err: | - | ||||||||||||||||||||||||
126 | ERR_put_error(13,(134),(109),__FILE__,111); | - | ||||||||||||||||||||||||
127 | } never executed: end of block | 0 | ||||||||||||||||||||||||
128 | ASN1_item_free(((void*) (1 ? atmp : (asn1_int_oct*)0)), (&(asn1_int_oct_it))); | - | ||||||||||||||||||||||||
129 | return executed 2 times by 1 test: ret;return ret; Executed by:
executed 2 times by 1 test: return ret; Executed by:
| 2 | ||||||||||||||||||||||||
130 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |