Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/rsa/rsa_asn1.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | static int rsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | - | ||||||||||||
8 | void *exarg) | - | ||||||||||||
9 | { | - | ||||||||||||
10 | if (operation == 0
| 25937-57888 | ||||||||||||
11 | *pval = (ASN1_VALUE *)RSA_new(); | - | ||||||||||||
12 | if (*
| 0-25937 | ||||||||||||
13 | ((void *)0)
| 0-25937 | ||||||||||||
14 | ) | - | ||||||||||||
15 | return executed 25937 times by 1 test: 2;return 2; Executed by:
executed 25937 times by 1 test: return 2; Executed by:
| 25937 | ||||||||||||
16 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
17 | } else if (operation == 2
| 11115-46773 | ||||||||||||
18 | RSA_free((RSA *)*pval); | - | ||||||||||||
19 | *pval = | - | ||||||||||||
20 | ((void *)0) | - | ||||||||||||
21 | ; | - | ||||||||||||
22 | return executed 11115 times by 1 test: 2;return 2; Executed by:
executed 11115 times by 1 test: return 2; Executed by:
| 11115 | ||||||||||||
23 | } else if (operation == 5
| 14923-31850 | ||||||||||||
24 | if (((
| 168-14755 | ||||||||||||
25 | - | |||||||||||||
26 | return executed 14755 times by 1 test: 1;return 1; Executed by:
executed 14755 times by 1 test: return 1; Executed by:
| 14755 | ||||||||||||
27 | } | - | ||||||||||||
28 | return executed 168 times by 1 test: (return (rsa_multip_calc_product((RSA *)*pval) == 1) ? 2 : 0; Executed by:
executed 168 times by 1 test: return (rsa_multip_calc_product((RSA *)*pval) == 1) ? 2 : 0; Executed by:
| 2-168 | ||||||||||||
29 | } | - | ||||||||||||
30 | return executed 31850 times by 1 test: 1;return 1; Executed by:
executed 31850 times by 1 test: return 1; Executed by:
| 31850 | ||||||||||||
31 | } | - | ||||||||||||
32 | - | |||||||||||||
33 | - | |||||||||||||
34 | static const ASN1_TEMPLATE RSA_PRIME_INFO_seq_tt[] = { | - | ||||||||||||
35 | { (0), (0), | - | ||||||||||||
36 | __builtin_offsetof ( | - | ||||||||||||
37 | RSA_PRIME_INFO | - | ||||||||||||
38 | , | - | ||||||||||||
39 | r | - | ||||||||||||
40 | ) | - | ||||||||||||
41 | , "r", (&(CBIGNUM_it)) }, | - | ||||||||||||
42 | { (0), (0), | - | ||||||||||||
43 | __builtin_offsetof ( | - | ||||||||||||
44 | RSA_PRIME_INFO | - | ||||||||||||
45 | , | - | ||||||||||||
46 | d | - | ||||||||||||
47 | ) | - | ||||||||||||
48 | , "d", (&(CBIGNUM_it)) }, | - | ||||||||||||
49 | { (0), (0), | - | ||||||||||||
50 | __builtin_offsetof ( | - | ||||||||||||
51 | RSA_PRIME_INFO | - | ||||||||||||
52 | , | - | ||||||||||||
53 | t | - | ||||||||||||
54 | ) | - | ||||||||||||
55 | , "t", (&(CBIGNUM_it)) }, | - | ||||||||||||
56 | } ; const ASN1_ITEM RSA_PRIME_INFO_it = { 0x1, 16, RSA_PRIME_INFO_seq_tt, sizeof(RSA_PRIME_INFO_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||
57 | ((void *)0) | - | ||||||||||||
58 | , sizeof(RSA_PRIME_INFO), "RSA_PRIME_INFO" }; | - | ||||||||||||
59 | - | |||||||||||||
60 | static const ASN1_AUX RSAPrivateKey_aux = { | - | ||||||||||||
61 | ((void *)0) | - | ||||||||||||
62 | , 0, 0, 0, rsa_cb, 0}; static const ASN1_TEMPLATE RSAPrivateKey_seq_tt[] = { | - | ||||||||||||
63 | { ((0x1 << 12)), (0), | - | ||||||||||||
64 | __builtin_offsetof ( | - | ||||||||||||
65 | RSA | - | ||||||||||||
66 | , | - | ||||||||||||
67 | version | - | ||||||||||||
68 | ) | - | ||||||||||||
69 | , "version", (&(INT32_it)) }, | - | ||||||||||||
70 | { (0), (0), | - | ||||||||||||
71 | __builtin_offsetof ( | - | ||||||||||||
72 | RSA | - | ||||||||||||
73 | , | - | ||||||||||||
74 | n | - | ||||||||||||
75 | ) | - | ||||||||||||
76 | , "n", (&(BIGNUM_it)) }, | - | ||||||||||||
77 | { (0), (0), | - | ||||||||||||
78 | __builtin_offsetof ( | - | ||||||||||||
79 | RSA | - | ||||||||||||
80 | , | - | ||||||||||||
81 | e | - | ||||||||||||
82 | ) | - | ||||||||||||
83 | , "e", (&(BIGNUM_it)) }, | - | ||||||||||||
84 | { (0), (0), | - | ||||||||||||
85 | __builtin_offsetof ( | - | ||||||||||||
86 | RSA | - | ||||||||||||
87 | , | - | ||||||||||||
88 | d | - | ||||||||||||
89 | ) | - | ||||||||||||
90 | , "d", (&(CBIGNUM_it)) }, | - | ||||||||||||
91 | { (0), (0), | - | ||||||||||||
92 | __builtin_offsetof ( | - | ||||||||||||
93 | RSA | - | ||||||||||||
94 | , | - | ||||||||||||
95 | p | - | ||||||||||||
96 | ) | - | ||||||||||||
97 | , "p", (&(CBIGNUM_it)) }, | - | ||||||||||||
98 | { (0), (0), | - | ||||||||||||
99 | __builtin_offsetof ( | - | ||||||||||||
100 | RSA | - | ||||||||||||
101 | , | - | ||||||||||||
102 | q | - | ||||||||||||
103 | ) | - | ||||||||||||
104 | , "q", (&(CBIGNUM_it)) }, | - | ||||||||||||
105 | { (0), (0), | - | ||||||||||||
106 | __builtin_offsetof ( | - | ||||||||||||
107 | RSA | - | ||||||||||||
108 | , | - | ||||||||||||
109 | dmp1 | - | ||||||||||||
110 | ) | - | ||||||||||||
111 | , "dmp1", (&(CBIGNUM_it)) }, | - | ||||||||||||
112 | { (0), (0), | - | ||||||||||||
113 | __builtin_offsetof ( | - | ||||||||||||
114 | RSA | - | ||||||||||||
115 | , | - | ||||||||||||
116 | dmq1 | - | ||||||||||||
117 | ) | - | ||||||||||||
118 | , "dmq1", (&(CBIGNUM_it)) }, | - | ||||||||||||
119 | { (0), (0), | - | ||||||||||||
120 | __builtin_offsetof ( | - | ||||||||||||
121 | RSA | - | ||||||||||||
122 | , | - | ||||||||||||
123 | iqmp | - | ||||||||||||
124 | ) | - | ||||||||||||
125 | , "iqmp", (&(CBIGNUM_it)) }, | - | ||||||||||||
126 | { ((0x2 << 1)|(0x1)), (0), | - | ||||||||||||
127 | __builtin_offsetof ( | - | ||||||||||||
128 | RSA | - | ||||||||||||
129 | , | - | ||||||||||||
130 | prime_infos | - | ||||||||||||
131 | ) | - | ||||||||||||
132 | , "prime_infos", (&(RSA_PRIME_INFO_it)) } | - | ||||||||||||
133 | } ; const ASN1_ITEM RSAPrivateKey_it = { 0x1, 16, RSAPrivateKey_seq_tt, sizeof(RSAPrivateKey_seq_tt) / sizeof(ASN1_TEMPLATE), &RSAPrivateKey_aux, sizeof(RSA), "RSAPrivateKey" }; | - | ||||||||||||
134 | - | |||||||||||||
135 | - | |||||||||||||
136 | static const ASN1_AUX RSAPublicKey_aux = { | - | ||||||||||||
137 | ((void *)0) | - | ||||||||||||
138 | , 0, 0, 0, rsa_cb, 0}; static const ASN1_TEMPLATE RSAPublicKey_seq_tt[] = { | - | ||||||||||||
139 | { (0), (0), | - | ||||||||||||
140 | __builtin_offsetof ( | - | ||||||||||||
141 | RSA | - | ||||||||||||
142 | , | - | ||||||||||||
143 | n | - | ||||||||||||
144 | ) | - | ||||||||||||
145 | , "n", (&(BIGNUM_it)) }, | - | ||||||||||||
146 | { (0), (0), | - | ||||||||||||
147 | __builtin_offsetof ( | - | ||||||||||||
148 | RSA | - | ||||||||||||
149 | , | - | ||||||||||||
150 | e | - | ||||||||||||
151 | ) | - | ||||||||||||
152 | , "e", (&(BIGNUM_it)) }, | - | ||||||||||||
153 | } ; const ASN1_ITEM RSAPublicKey_it = { 0x1, 16, RSAPublicKey_seq_tt, sizeof(RSAPublicKey_seq_tt) / sizeof(ASN1_TEMPLATE), &RSAPublicKey_aux, sizeof(RSA), "RSAPublicKey" }; | - | ||||||||||||
154 | - | |||||||||||||
155 | - | |||||||||||||
156 | static int rsa_pss_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | - | ||||||||||||
157 | void *exarg) | - | ||||||||||||
158 | { | - | ||||||||||||
159 | if (operation == 2
| 3158-12729 | ||||||||||||
160 | RSA_PSS_PARAMS *pss = (RSA_PSS_PARAMS *)*pval; | - | ||||||||||||
161 | X509_ALGOR_free(pss->maskHash); | - | ||||||||||||
162 | } executed 3158 times by 1 test: end of block Executed by:
| 3158 | ||||||||||||
163 | return executed 15887 times by 1 test: 1;return 1; Executed by:
executed 15887 times by 1 test: return 1; Executed by:
| 15887 | ||||||||||||
164 | } | - | ||||||||||||
165 | - | |||||||||||||
166 | static const ASN1_AUX RSA_PSS_PARAMS_aux = { | - | ||||||||||||
167 | ((void *)0) | - | ||||||||||||
168 | , 0, 0, 0, rsa_pss_cb, 0}; static const ASN1_TEMPLATE RSA_PSS_PARAMS_seq_tt[] = { | - | ||||||||||||
169 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (0), | - | ||||||||||||
170 | __builtin_offsetof ( | - | ||||||||||||
171 | RSA_PSS_PARAMS | - | ||||||||||||
172 | , | - | ||||||||||||
173 | hashAlgorithm | - | ||||||||||||
174 | ) | - | ||||||||||||
175 | , "hashAlgorithm", (&(X509_ALGOR_it)) }, | - | ||||||||||||
176 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (1), | - | ||||||||||||
177 | __builtin_offsetof ( | - | ||||||||||||
178 | RSA_PSS_PARAMS | - | ||||||||||||
179 | , | - | ||||||||||||
180 | maskGenAlgorithm | - | ||||||||||||
181 | ) | - | ||||||||||||
182 | , "maskGenAlgorithm", (&(X509_ALGOR_it)) }, | - | ||||||||||||
183 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (2), | - | ||||||||||||
184 | __builtin_offsetof ( | - | ||||||||||||
185 | RSA_PSS_PARAMS | - | ||||||||||||
186 | , | - | ||||||||||||
187 | saltLength | - | ||||||||||||
188 | ) | - | ||||||||||||
189 | , "saltLength", (&(ASN1_INTEGER_it)) }, | - | ||||||||||||
190 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (3), | - | ||||||||||||
191 | __builtin_offsetof ( | - | ||||||||||||
192 | RSA_PSS_PARAMS | - | ||||||||||||
193 | , | - | ||||||||||||
194 | trailerField | - | ||||||||||||
195 | ) | - | ||||||||||||
196 | , "trailerField", (&(ASN1_INTEGER_it)) } | - | ||||||||||||
197 | } ; const ASN1_ITEM RSA_PSS_PARAMS_it = { 0x1, 16, RSA_PSS_PARAMS_seq_tt, sizeof(RSA_PSS_PARAMS_seq_tt) / sizeof(ASN1_TEMPLATE), &RSA_PSS_PARAMS_aux, sizeof(RSA_PSS_PARAMS), "RSA_PSS_PARAMS" }; | - | ||||||||||||
198 | - | |||||||||||||
199 | RSA_PSS_PARAMS *d2i_RSA_PSS_PARAMS(RSA_PSS_PARAMS **a, const unsigned char **in, long len) { return never executed: (RSA_PSS_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSA_PSS_PARAMS_it)));return (RSA_PSS_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSA_PSS_PARAMS_it))); never executed: } int i2d_RSA_PSS_PARAMS(RSA_PSS_PARAMS *a, unsigned char **out) { returnreturn (RSA_PSS_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSA_PSS_PARAMS_it))); never executed: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSA_PSS_PARAMS_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSA_PSS_PARAMS_it))); never executed: } RSA_PSS_PARAMS *RSA_PSS_PARAMS_new(void) { returnreturn ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSA_PSS_PARAMS_it))); executed 4 times by 1 test: (RSA_PSS_PARAMS *)ASN1_item_new((&(RSA_PSS_PARAMS_it)));return (RSA_PSS_PARAMS *)ASN1_item_new((&(RSA_PSS_PARAMS_it))); Executed by:
executed 4 times by 1 test: } void RSA_PSS_PARAMS_free(RSA_PSS_PARAMS *a) { ASN1_item_free((ASN1_VALUE *)a, (&(RSA_PSS_PARAMS_it))); }return (RSA_PSS_PARAMS *)ASN1_item_new((&(RSA_PSS_PARAMS_it))); Executed by:
executed 26233 times by 1 test: end of block Executed by:
| 0-26233 | ||||||||||||
200 | - | |||||||||||||
201 | - | |||||||||||||
202 | static int rsa_oaep_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | - | ||||||||||||
203 | void *exarg) | - | ||||||||||||
204 | { | - | ||||||||||||
205 | if (operation == 2
| 2966-11882 | ||||||||||||
206 | RSA_OAEP_PARAMS *oaep = (RSA_OAEP_PARAMS *)*pval; | - | ||||||||||||
207 | X509_ALGOR_free(oaep->maskHash); | - | ||||||||||||
208 | } executed 2966 times by 1 test: end of block Executed by:
| 2966 | ||||||||||||
209 | return executed 14848 times by 1 test: 1;return 1; Executed by:
executed 14848 times by 1 test: return 1; Executed by:
| 14848 | ||||||||||||
210 | } | - | ||||||||||||
211 | - | |||||||||||||
212 | static const ASN1_AUX RSA_OAEP_PARAMS_aux = { | - | ||||||||||||
213 | ((void *)0) | - | ||||||||||||
214 | , 0, 0, 0, rsa_oaep_cb, 0}; static const ASN1_TEMPLATE RSA_OAEP_PARAMS_seq_tt[] = { | - | ||||||||||||
215 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (0), | - | ||||||||||||
216 | __builtin_offsetof ( | - | ||||||||||||
217 | RSA_OAEP_PARAMS | - | ||||||||||||
218 | , | - | ||||||||||||
219 | hashFunc | - | ||||||||||||
220 | ) | - | ||||||||||||
221 | , "hashFunc", (&(X509_ALGOR_it)) }, | - | ||||||||||||
222 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (1), | - | ||||||||||||
223 | __builtin_offsetof ( | - | ||||||||||||
224 | RSA_OAEP_PARAMS | - | ||||||||||||
225 | , | - | ||||||||||||
226 | maskGenFunc | - | ||||||||||||
227 | ) | - | ||||||||||||
228 | , "maskGenFunc", (&(X509_ALGOR_it)) }, | - | ||||||||||||
229 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (2), | - | ||||||||||||
230 | __builtin_offsetof ( | - | ||||||||||||
231 | RSA_OAEP_PARAMS | - | ||||||||||||
232 | , | - | ||||||||||||
233 | pSourceFunc | - | ||||||||||||
234 | ) | - | ||||||||||||
235 | , "pSourceFunc", (&(X509_ALGOR_it)) }, | - | ||||||||||||
236 | } ; const ASN1_ITEM RSA_OAEP_PARAMS_it = { 0x1, 16, RSA_OAEP_PARAMS_seq_tt, sizeof(RSA_OAEP_PARAMS_seq_tt) / sizeof(ASN1_TEMPLATE), &RSA_OAEP_PARAMS_aux, sizeof(RSA_OAEP_PARAMS), "RSA_OAEP_PARAMS" }; | - | ||||||||||||
237 | - | |||||||||||||
238 | RSA_OAEP_PARAMS *d2i_RSA_OAEP_PARAMS(RSA_OAEP_PARAMS **a, const unsigned char **in, long len) { return never executed: (RSA_OAEP_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSA_OAEP_PARAMS_it)));return (RSA_OAEP_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSA_OAEP_PARAMS_it))); never executed: } int i2d_RSA_OAEP_PARAMS(RSA_OAEP_PARAMS *a, unsigned char **out) { returnreturn (RSA_OAEP_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSA_OAEP_PARAMS_it))); never executed: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSA_OAEP_PARAMS_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSA_OAEP_PARAMS_it))); never executed: } RSA_OAEP_PARAMS *RSA_OAEP_PARAMS_new(void) { returnreturn ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSA_OAEP_PARAMS_it))); executed 2 times by 1 test: (RSA_OAEP_PARAMS *)ASN1_item_new((&(RSA_OAEP_PARAMS_it)));return (RSA_OAEP_PARAMS *)ASN1_item_new((&(RSA_OAEP_PARAMS_it))); Executed by:
executed 2 times by 1 test: } void RSA_OAEP_PARAMS_free(RSA_OAEP_PARAMS *a) { ASN1_item_free((ASN1_VALUE *)a, (&(RSA_OAEP_PARAMS_it))); }return (RSA_OAEP_PARAMS *)ASN1_item_new((&(RSA_OAEP_PARAMS_it))); Executed by:
executed 4 times by 1 test: end of block Executed by:
| 0-4 | ||||||||||||
239 | - | |||||||||||||
240 | RSA *d2i_RSAPrivateKey(RSA **a, const unsigned char **in, long len) { return executed 6512 times by 1 test: (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSAPrivateKey_it)));return (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSAPrivateKey_it))); Executed by:
executed 6512 times by 1 test: } int i2d_RSAPrivateKey(const RSA *a, unsigned char **out) { returnreturn (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSAPrivateKey_it))); Executed by:
executed 129 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSAPrivateKey_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSAPrivateKey_it))); Executed by:
executed 129 times by 1 test: }return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSAPrivateKey_it))); Executed by:
| 129-6512 | ||||||||||||
241 | - | |||||||||||||
242 | RSA *d2i_RSAPublicKey(RSA **a, const unsigned char **in, long len) { return executed 14335 times by 1 test: (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSAPublicKey_it)));return (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSAPublicKey_it))); Executed by:
executed 14335 times by 1 test: } int i2d_RSAPublicKey(const RSA *a, unsigned char **out) { returnreturn (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(RSAPublicKey_it))); Executed by:
executed 1686 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSAPublicKey_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSAPublicKey_it))); Executed by:
executed 1686 times by 1 test: }return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(RSAPublicKey_it))); Executed by:
| 1686-14335 | ||||||||||||
243 | - | |||||||||||||
244 | RSA *RSAPublicKey_dup(RSA *rsa) | - | ||||||||||||
245 | { | - | ||||||||||||
246 | return never executed: ASN1_item_dup((&(RSAPublicKey_it)), rsa);return ASN1_item_dup((&(RSAPublicKey_it)), rsa); never executed: return ASN1_item_dup((&(RSAPublicKey_it)), rsa); | 0 | ||||||||||||
247 | } | - | ||||||||||||
248 | - | |||||||||||||
249 | RSA *RSAPrivateKey_dup(RSA *rsa) | - | ||||||||||||
250 | { | - | ||||||||||||
251 | return never executed: ASN1_item_dup((&(RSAPrivateKey_it)), rsa);return ASN1_item_dup((&(RSAPrivateKey_it)), rsa); never executed: return ASN1_item_dup((&(RSAPrivateKey_it)), rsa); | 0 | ||||||||||||
252 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |