OpenCoverage

n_pkey.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/n_pkey.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8typedef struct netscape_pkey_st {-
9 long version;-
10 X509_ALGOR *algor;-
11 ASN1_OCTET_STRING *private_key;-
12} NETSCAPE_PKEY;-
13-
14typedef struct netscape_encrypted_pkey_st {-
15 ASN1_OCTET_STRING *os;-
16-
17-
18-
19-
20 X509_SIG *enckey;-
21} NETSCAPE_ENCRYPTED_PKEY;-
22-
23-
24static const ASN1_AUX NETSCAPE_ENCRYPTED_PKEY_aux = {-
25 .flags = 4,-
26};-
27static const ASN1_TEMPLATE NETSCAPE_ENCRYPTED_PKEY_seq_tt[] = {-
28 {-
29 .offset = -
30 __builtin_offsetof (-
31 NETSCAPE_ENCRYPTED_PKEY-
32 , -
33 os-
34 )-
35 ,-
36 .field_name = "os",-
37 .item = &ASN1_OCTET_STRING_it,-
38 },-
39 {-
40 .offset = -
41 __builtin_offsetof (-
42 NETSCAPE_ENCRYPTED_PKEY-
43 , -
44 enckey-
45 )-
46 ,-
47 .field_name = "enckey",-
48 .item = &X509_SIG_it,-
49 },-
50};-
51-
52const ASN1_ITEM NETSCAPE_ENCRYPTED_PKEY_it = {-
53 .itype = 0x1,-
54 .utype = 16,-
55 .templates = NETSCAPE_ENCRYPTED_PKEY_seq_tt,-
56 .tcount = sizeof(NETSCAPE_ENCRYPTED_PKEY_seq_tt) / sizeof(ASN1_TEMPLATE),-
57 .funcs = &NETSCAPE_ENCRYPTED_PKEY_aux,-
58 .size = sizeof(NETSCAPE_ENCRYPTED_PKEY),-
59 .sname = "NETSCAPE_ENCRYPTED_PKEY",-
60};-
61-
62NETSCAPE_ENCRYPTED_PKEY *NETSCAPE_ENCRYPTED_PKEY_new(void);-
63void NETSCAPE_ENCRYPTED_PKEY_free(NETSCAPE_ENCRYPTED_PKEY *a);-
64NETSCAPE_ENCRYPTED_PKEY *d2i_NETSCAPE_ENCRYPTED_PKEY(NETSCAPE_ENCRYPTED_PKEY **a, const unsigned char **in, long len);-
65int i2d_NETSCAPE_ENCRYPTED_PKEY(const NETSCAPE_ENCRYPTED_PKEY *a, unsigned char **out);-
66-
67NETSCAPE_ENCRYPTED_PKEY *-
68d2i_NETSCAPE_ENCRYPTED_PKEY(NETSCAPE_ENCRYPTED_PKEY **a, const unsigned char **in, long len)-
69{-
70 return
never executed: return (NETSCAPE_ENCRYPTED_PKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &NETSCAPE_ENCRYPTED_PKEY_it);
(NETSCAPE_ENCRYPTED_PKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
never executed: return (NETSCAPE_ENCRYPTED_PKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &NETSCAPE_ENCRYPTED_PKEY_it);
0
71 &NETSCAPE_ENCRYPTED_PKEY_it);
never executed: return (NETSCAPE_ENCRYPTED_PKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &NETSCAPE_ENCRYPTED_PKEY_it);
0
72}-
73-
74int-
75i2d_NETSCAPE_ENCRYPTED_PKEY(const NETSCAPE_ENCRYPTED_PKEY *a, unsigned char **out)-
76{-
77 return
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_ENCRYPTED_PKEY_it);
ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_ENCRYPTED_PKEY_it);
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_ENCRYPTED_PKEY_it);
0
78}-
79-
80NETSCAPE_ENCRYPTED_PKEY *-
81NETSCAPE_ENCRYPTED_PKEY_new(void)-
82{-
83 return
never executed: return (NETSCAPE_ENCRYPTED_PKEY *)ASN1_item_new(&NETSCAPE_ENCRYPTED_PKEY_it);
(NETSCAPE_ENCRYPTED_PKEY *)ASN1_item_new(&NETSCAPE_ENCRYPTED_PKEY_it);
never executed: return (NETSCAPE_ENCRYPTED_PKEY *)ASN1_item_new(&NETSCAPE_ENCRYPTED_PKEY_it);
0
84}-
85-
86void-
87NETSCAPE_ENCRYPTED_PKEY_free(NETSCAPE_ENCRYPTED_PKEY *a)-
88{-
89 ASN1_item_free((ASN1_VALUE *)a, &NETSCAPE_ENCRYPTED_PKEY_it);-
90}
never executed: end of block
0
91-
92static const ASN1_TEMPLATE NETSCAPE_PKEY_seq_tt[] = {-
93 {-
94 .offset = -
95 __builtin_offsetof (-
96 NETSCAPE_PKEY-
97 , -
98 version-
99 )-
100 ,-
101 .field_name = "version",-
102 .item = &LONG_it,-
103 },-
104 {-
105 .offset = -
106 __builtin_offsetof (-
107 NETSCAPE_PKEY-
108 , -
109 algor-
110 )-
111 ,-
112 .field_name = "algor",-
113 .item = &X509_ALGOR_it,-
114 },-
115 {-
116 .offset = -
117 __builtin_offsetof (-
118 NETSCAPE_PKEY-
119 , -
120 private_key-
121 )-
122 ,-
123 .field_name = "private_key",-
124 .item = &ASN1_OCTET_STRING_it,-
125 },-
126};-
127-
128const ASN1_ITEM NETSCAPE_PKEY_it = {-
129 .itype = 0x1,-
130 .utype = 16,-
131 .templates = NETSCAPE_PKEY_seq_tt,-
132 .tcount = sizeof(NETSCAPE_PKEY_seq_tt) / sizeof(ASN1_TEMPLATE),-
133 .size = sizeof(NETSCAPE_PKEY),-
134 .sname = "NETSCAPE_PKEY",-
135};-
136-
137NETSCAPE_PKEY *NETSCAPE_PKEY_new(void);-
138void NETSCAPE_PKEY_free(NETSCAPE_PKEY *a);-
139NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a, const unsigned char **in, long len);-
140int i2d_NETSCAPE_PKEY(const NETSCAPE_PKEY *a, unsigned char **out);-
141-
142NETSCAPE_PKEY *-
143d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a, const unsigned char **in, long len)-
144{-
145 return
never executed: return (NETSCAPE_PKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &NETSCAPE_PKEY_it);
(NETSCAPE_PKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
never executed: return (NETSCAPE_PKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &NETSCAPE_PKEY_it);
0
146 &NETSCAPE_PKEY_it);
never executed: return (NETSCAPE_PKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &NETSCAPE_PKEY_it);
0
147}-
148-
149int-
150i2d_NETSCAPE_PKEY(const NETSCAPE_PKEY *a, unsigned char **out)-
151{-
152 return
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_PKEY_it);
ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_PKEY_it);
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_PKEY_it);
0
153}-
154-
155NETSCAPE_PKEY *-
156NETSCAPE_PKEY_new(void)-
157{-
158 return
never executed: return (NETSCAPE_PKEY *)ASN1_item_new(&NETSCAPE_PKEY_it);
(NETSCAPE_PKEY *)ASN1_item_new(&NETSCAPE_PKEY_it);
never executed: return (NETSCAPE_PKEY *)ASN1_item_new(&NETSCAPE_PKEY_it);
0
159}-
160-
161void-
162NETSCAPE_PKEY_free(NETSCAPE_PKEY *a)-
163{-
164 ASN1_item_free((ASN1_VALUE *)a, &NETSCAPE_PKEY_it);-
165}
never executed: end of block
0
166-
167static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,-
168 int (*cb)(char *buf, int len, const char *prompt, int verify), int sgckey);-
169-
170int-
171i2d_Netscape_RSA(const RSA *a, unsigned char **pp,-
172 int (*cb)(char *buf, int len, const char *prompt, int verify))-
173{-
174 return
never executed: return i2d_RSA_NET(a, pp, cb, 0);
i2d_RSA_NET(a, pp, cb, 0);
never executed: return i2d_RSA_NET(a, pp, cb, 0);
0
175}-
176-
177int-
178i2d_RSA_NET(const RSA *a, unsigned char **pp,-
179 int (*cb)(char *buf, int len, const char *prompt, int verify), int sgckey)-
180{-
181 int i, j, ret = 0;-
182 int rsalen, pkeylen, olen;-
183 NETSCAPE_PKEY *pkey = -
184 ((void *)0)-
185 ;-
186 NETSCAPE_ENCRYPTED_PKEY *enckey = -
187 ((void *)0)-
188 ;-
189 unsigned char buf[256], *zz;-
190 unsigned char key[64];-
191 EVP_CIPHER_CTX ctx;-
192 EVP_CIPHER_CTX_init(&ctx);-
193-
194 if (a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
195 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
196 )-
197 return
never executed: return (0);
(0);
never executed: return (0);
0
198-
199 if ((
(pkey = NETSCA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
pkey = NETSCAPE_PKEY_new()) ==
(pkey = NETSCA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
200 ((void *)0)
(pkey = NETSCA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
201 )-
202 goto
never executed: goto err;
err;
never executed: goto err;
0
203 if ((
(enckey = NETS...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
enckey = NETSCAPE_ENCRYPTED_PKEY_new()) ==
(enckey = NETS...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
204 ((void *)0)
(enckey = NETS...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
205 )-
206 goto
never executed: goto err;
err;
never executed: goto err;
0
207 pkey->version = 0;-
208-
209 pkey->algor->algorithm = OBJ_nid2obj(6);-
210 if ((
(pkey->algor->...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
pkey->algor->parameter = ASN1_TYPE_new()) ==
(pkey->algor->...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
211 ((void *)0)
(pkey->algor->...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
212 )-
213 goto
never executed: goto err;
err;
never executed: goto err;
0
214 pkey->algor->parameter->type = 5;-
215-
216 rsalen = i2d_RSAPrivateKey(a, -
217 ((void *)0)-
218 );-
219-
220-
221-
222-
223 pkey->private_key->length = rsalen;-
224 pkeylen = i2d_NETSCAPE_PKEY(pkey, -
225 ((void *)0)-
226 );-
227 enckey->enckey->digest->length = pkeylen;-
228 enckey->os->length = 11;-
229 enckey->enckey->algor->algorithm = OBJ_nid2obj(5);-
230 if ((
(enckey->encke...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
enckey->enckey->algor->parameter = ASN1_TYPE_new()) ==
(enckey->encke...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
231 ((void *)0)
(enckey->encke...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
232 )-
233 goto
never executed: goto err;
err;
never executed: goto err;
0
234 enckey->enckey->algor->parameter->type = 5;-
235-
236 if (pp ==
pp == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
237 ((void *)0)
pp == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
238 ) {-
239 olen = i2d_NETSCAPE_ENCRYPTED_PKEY(enckey, -
240 ((void *)0)-
241 );-
242 NETSCAPE_PKEY_free(pkey);-
243 NETSCAPE_ENCRYPTED_PKEY_free(enckey);-
244 return
never executed: return olen;
olen;
never executed: return olen;
0
245 }-
246-
247-
248 if ((
(zz = malloc(r...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
zz = malloc(rsalen)) ==
(zz = malloc(r...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
249 ((void *)0)
(zz = malloc(r...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
250 ) {-
251 ERR_put_error(13,(0xfff),((1|64)),__FILE__,263);-
252 goto
never executed: goto err;
err;
never executed: goto err;
0
253 }-
254-
255 pkey->private_key->data = zz;-
256-
257 i2d_RSAPrivateKey(a, &zz);-
258-
259 if ((
(zz = malloc(p...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
zz = malloc(pkeylen)) ==
(zz = malloc(p...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
260 ((void *)0)
(zz = malloc(p...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
261 ) {-
262 ERR_put_error(13,(0xfff),((1|64)),__FILE__,272);-
263 goto
never executed: goto err;
err;
never executed: goto err;
0
264 }-
265-
266 enckey->enckey->digest->data = zz;-
267 if (!ASN1_STRING_set(enckey->os, "private-key", -1)
!ASN1_STRING_s...vate-key", -1)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
268 ERR_put_error(13,(0xfff),((1|64)),__FILE__,278);-
269 goto
never executed: goto err;
err;
never executed: goto err;
0
270 }-
271 i2d_NETSCAPE_PKEY(pkey, &zz);-
272-
273-
274 explicit_bzero(pkey->private_key->data, rsalen);-
275-
276 if (cb ==
cb == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
277 ((void *)0)
cb == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
278 )-
279 cb = EVP_read_pw_string;
never executed: cb = EVP_read_pw_string;
0
280 i = cb((char *)buf, sizeof(buf), "Enter Private Key password:", 1);-
281 if (i != 0
i != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
282 ERR_put_error(13,(0xfff),(103),__FILE__,290);-
283 goto
never executed: goto err;
err;
never executed: goto err;
0
284 }-
285 i = strlen((char *)buf);-
286-
287 if (sgckey
sgckeyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
288 if (!EVP_Digest(buf, i, buf,
!EVP_Digest(bu... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
289 ((void *)0)
!EVP_Digest(bu... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
290 , EVP_md5(),
!EVP_Digest(bu... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
291 ((void *)0)
!EVP_Digest(bu... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
292 )
!EVP_Digest(bu... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
293 goto
never executed: goto err;
err;
never executed: goto err;
0
294 memcpy(buf + 16, "SGCKEYSALT", 10);-
295 i = 26;-
296 }
never executed: end of block
0
297-
298 if (!EVP_BytesToKey(EVP_rc4(), EVP_md5(),
!EVP_BytesToKe... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
299 ((void *)0)
!EVP_BytesToKe... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
300 , buf, i,1, key,
!EVP_BytesToKe... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
301 ((void *)0)
!EVP_BytesToKe... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
302 )
!EVP_BytesToKe... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
303 goto
never executed: goto err;
err;
never executed: goto err;
0
304 explicit_bzero(buf, sizeof(buf));-
305-
306-
307 zz = enckey->enckey->digest->data;-
308 if (!EVP_EncryptInit_ex(&ctx, EVP_rc4(),
!EVP_EncryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
309 ((void *)0)
!EVP_EncryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
310 , key,
!EVP_EncryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
311 ((void *)0)
!EVP_EncryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
312 )
!EVP_EncryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
313 goto
never executed: goto err;
err;
never executed: goto err;
0
314 if (!EVP_EncryptUpdate(&ctx, zz, &i, zz, pkeylen)
!EVP_EncryptUp..., zz, pkeylen)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
315 goto
never executed: goto err;
err;
never executed: goto err;
0
316 if (!EVP_EncryptFinal_ex(&ctx, zz + i, &j)
!EVP_EncryptFi...x, zz + i, &j)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
317 goto
never executed: goto err;
err;
never executed: goto err;
0
318-
319 ret = i2d_NETSCAPE_ENCRYPTED_PKEY(enckey, pp);-
320err:
code before this statement never executed: err:
0
321 EVP_CIPHER_CTX_cleanup(&ctx);-
322 NETSCAPE_ENCRYPTED_PKEY_free(enckey);-
323 NETSCAPE_PKEY_free(pkey);-
324 return
never executed: return (ret);
(ret);
never executed: return (ret);
0
325}-
326-
327-
328RSA *-
329d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length,-
330 int (*cb)(char *buf, int len, const char *prompt, int verify))-
331{-
332 return
never executed: return d2i_RSA_NET(a, pp, length, cb, 0);
d2i_RSA_NET(a, pp, length, cb, 0);
never executed: return d2i_RSA_NET(a, pp, length, cb, 0);
0
333}-
334-
335RSA *-
336d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,-
337 int (*cb)(char *buf, int len, const char *prompt, int verify), int sgckey)-
338{-
339 RSA *ret = -
340 ((void *)0)-
341 ;-
342 const unsigned char *p;-
343 NETSCAPE_ENCRYPTED_PKEY *enckey = -
344 ((void *)0)-
345 ;-
346-
347 p = *pp;-
348-
349 enckey = d2i_NETSCAPE_ENCRYPTED_PKEY(-
350 ((void *)0)-
351 , &p, length);-
352 if (!enckey
!enckeyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
353 ERR_put_error(13,(0xfff),(111),__FILE__,343);-
354 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
355 ((void *)0)
never executed: return ((void *)0) ;
0
356 ;
never executed: return ((void *)0) ;
0
357 }-
358-
359-
360 if (enckey->os->length != 11
enckey->os->length != 11Description
TRUEnever evaluated
FALSEnever evaluated
||
0
361 memcmp("private-key", enckey->os->data, 11) != 0
memcmp("privat...data, 11) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
362 ERR_put_error(13,(0xfff),(146),__FILE__,350);-
363 goto
never executed: goto err;
err;
never executed: goto err;
0
364 }-
365 if (OBJ_obj2nid(enckey->enckey->algor->algorithm) != 5
OBJ_obj2nid(en...lgorithm) != 5Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
366 ERR_put_error(13,(0xfff),(166),__FILE__,354);-
367 goto
never executed: goto err;
err;
never executed: goto err;
0
368 }-
369 if (cb ==
cb == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
370 ((void *)0)
cb == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
371 )-
372 cb = EVP_read_pw_string;
never executed: cb = EVP_read_pw_string;
0
373 if ((
(ret = d2i_RSA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
ret = d2i_RSA_NET_2(a, enckey->enckey->digest, cb,
(ret = d2i_RSA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
374 sgckey)) ==
(ret = d2i_RSA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
375 ((void *)0)
(ret = d2i_RSA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
376 )-
377 goto
never executed: goto err;
err;
never executed: goto err;
0
378-
379 *pp = p;-
380-
381err:
code before this statement never executed: err:
0
382 NETSCAPE_ENCRYPTED_PKEY_free(enckey);-
383 return
never executed: return ret;
ret;
never executed: return ret;
0
384-
385}-
386-
387static RSA *-
388d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,-
389 int (*cb)(char *buf, int len, const char *prompt, int verify), int sgckey)-
390{-
391 NETSCAPE_PKEY *pkey = -
392 ((void *)0)-
393 ;-
394 RSA *ret = -
395 ((void *)0)-
396 ;-
397 int i, j;-
398 unsigned char buf[256];-
399 const unsigned char *zz;-
400 unsigned char key[64];-
401 EVP_CIPHER_CTX ctx;-
402 EVP_CIPHER_CTX_init(&ctx);-
403-
404 i=cb((char *)buf, sizeof(buf), "Enter Private Key password:",0);-
405 if (i != 0
i != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
406 ERR_put_error(13,(0xfff),(103),__FILE__,386);-
407 goto
never executed: goto err;
err;
never executed: goto err;
0
408 }-
409-
410 i = strlen((char *)buf);-
411 if (sgckey
sgckeyDescription
TRUEnever evaluated
FALSEnever evaluated
){
0
412 if (!EVP_Digest(buf, i, buf,
!EVP_Digest(bu... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
413 ((void *)0)
!EVP_Digest(bu... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
414 , EVP_md5(),
!EVP_Digest(bu... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
415 ((void *)0)
!EVP_Digest(bu... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
416 )
!EVP_Digest(bu... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
417 goto
never executed: goto err;
err;
never executed: goto err;
0
418 memcpy(buf + 16, "SGCKEYSALT", 10);-
419 i = 26;-
420 }
never executed: end of block
0
421-
422 if (!EVP_BytesToKey(EVP_rc4(), EVP_md5(),
!EVP_BytesToKe... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
423 ((void *)0)
!EVP_BytesToKe... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
424 , buf, i,1, key,
!EVP_BytesToKe... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
425 ((void *)0)
!EVP_BytesToKe... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
426 )
!EVP_BytesToKe... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
427 goto
never executed: goto err;
err;
never executed: goto err;
0
428 explicit_bzero(buf, sizeof(buf));-
429-
430 if (!EVP_DecryptInit_ex(&ctx, EVP_rc4(),
!EVP_DecryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
431 ((void *)0)
!EVP_DecryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
432 , key,
!EVP_DecryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
433 ((void *)0)
!EVP_DecryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
434 )
!EVP_DecryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
435 goto
never executed: goto err;
err;
never executed: goto err;
0
436 if (!EVP_DecryptUpdate(&ctx, os->data, &i, os->data, os->length)
!EVP_DecryptUp...a, os->length)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
437 goto
never executed: goto err;
err;
never executed: goto err;
0
438 if (!EVP_DecryptFinal_ex(&ctx, &(os->data[i]), &j)
!EVP_DecryptFi...>data[i]), &j)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
439 goto
never executed: goto err;
err;
never executed: goto err;
0
440 os->length = i + j;-
441-
442 zz = os->data;-
443-
444 if ((
(pkey = d2i_NE...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
pkey = d2i_NETSCAPE_PKEY(
(pkey = d2i_NE...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
445 ((void *)0)
(pkey = d2i_NE...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
446 , &zz, os->length)) ==
(pkey = d2i_NE...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
447 ((void *)0)
(pkey = d2i_NE...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
448 ) {-
449 ERR_put_error(13,(0xfff),(158),__FILE__,413);-
450 goto
never executed: goto err;
err;
never executed: goto err;
0
451 }-
452-
453 zz = pkey->private_key->data;-
454 if ((
(ret = d2i_RSA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
ret = d2i_RSAPrivateKey(a, &zz,
(ret = d2i_RSA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
455 pkey->private_key->length)) ==
(ret = d2i_RSA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
456 ((void *)0)
(ret = d2i_RSA...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
457 ) {-
458 ERR_put_error(13,(0xfff),(157),__FILE__,420);-
459 goto
never executed: goto err;
err;
never executed: goto err;
0
460 }-
461-
462err:
code before this statement never executed: err:
0
463 EVP_CIPHER_CTX_cleanup(&ctx);-
464 NETSCAPE_PKEY_free(pkey);-
465 return
never executed: return (ret);
(ret);
never executed: return (ret);
0
466}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2