1
2
3
4#line 4 "s3_srvr_2_BUG.cil.c"
5int ssl3_accept(int initial_state )
6{ int s__info_callback ;
7 int s__in_handshake ;
8 int s__state ;
9 int s__new_session ;
10 int s__server ;
11 int s__version ;
12 int s__type ;
13 int s__init_num ;
14 int s__hit ;
15 int s__rwstate ;
16 int s__init_buf___0 ;
17 int s__debug ;
18 int s__shutdown ;
19 int s__cert ;
20 int s__options ;
21 int s__verify_mode ;
22 int s__session__peer ;
23 int s__cert__pkeys__AT0__privatekey ;
24 int s__ctx__info_callback ;
25 int s__ctx__stats__sess_accept_renegotiate ;
26 int s__ctx__stats__sess_accept ;
27 int s__ctx__stats__sess_accept_good ;
28 int s__s3__tmp__cert_request ;
29 int s__s3__tmp__reuse_message ;
30 int s__s3__tmp__use_rsa_tmp ;
31 int s__s3__tmp__new_cipher ;
32 int s__s3__tmp__new_cipher__algorithms ;
33 int s__s3__tmp__next_state___0 ;
34 int s__s3__tmp__new_cipher__algo_strength ;
35 int s__session__cipher ;
36 int buf ;
37 unsigned long l ;
38 unsigned long Time ;
39 unsigned long tmp ;
40 int cb ;
41 long num1 ;
42 int ret ;
43 int new_state ;
44 int state ;
45 int skip ;
46 int got_new_session ;
47 int tmp___1 ;
48 int tmp___2 ;
49 int tmp___3 ;
50 int tmp___4 ;
51 int tmp___5 ;
52 int tmp___6 ;
53 int tmp___7 ;
54 long tmp___8 ;
55 int tmp___9 ;
56 int tmp___10 ;
57 int blastFlag ;
58
59 int __cil_tmp55 ;
60 unsigned long __cil_tmp56 ;
61 unsigned long __cil_tmp57 ;
62 unsigned long __cil_tmp58 ;
63 unsigned long __cil_tmp59 ;
64 int __cil_tmp60 ;
65 unsigned long __cil_tmp61 ;
66
67 {
68#line 60
69;
70 s__state = initial_state;
71#line 61
72 blastFlag = 0;
73#line 62
74 tmp = __VERIFIER_nondet_int();
75#line 63
76 Time = tmp;
77#line 64
78 cb = 0;
79#line 65
80 ret = -1;
81#line 66
82 skip = 0;
83#line 67
84 got_new_session = 0;
85#line 68
86 if (s__info_callback != 0) {
87#line 69
88 cb = s__info_callback;
89 } else {
90#line 71
91 if (s__ctx__info_callback != 0) {
92#line 72
93 cb = s__ctx__info_callback;
94 }
95 }
96#line 77
97 s__in_handshake ++;
98#line 78
99 if (tmp___1 + 12288) {
100#line 79
101 if (tmp___2 + 16384) {
102
103 }
104 }
105#line 87
106 if (s__cert == 0) {
107#line 88
108 return (-1);
109 }
110 {
111#line 93
112 while (1) {
113 while_0_continue: ;
114#line 95
115 state = s__state;
116#line 96
117 if (s__state == 12292) {
118 goto switch_1_12292;
119 } else {
120#line 99
121 if (s__state == 16384) {
122 goto switch_1_16384;
123 } else {
124#line 102
125 if (s__state == 8192) {
126 goto switch_1_8192;
127 } else {
128#line 105
129 if (s__state == 24576) {
130 goto switch_1_24576;
131 } else {
132#line 108
133 if (s__state == 8195) {
134 goto switch_1_8195;
135 } else {
136#line 111
137 if (s__state == 8480) {
138 goto switch_1_8480;
139 } else {
140#line 114
141 if (s__state == 8481) {
142 goto switch_1_8481;
143 } else {
144#line 117
145 if (s__state == 8482) {
146 goto switch_1_8482;
147 } else {
148#line 120
149 if (s__state == 8464) {
150 goto switch_1_8464;
151 } else {
152#line 123
153 if (s__state == 8465) {
154 goto switch_1_8465;
155 } else {
156#line 126
157 if (s__state == 8466) {
158 goto switch_1_8466;
159 } else {
160#line 129
161 if (s__state == 8496) {
162 goto switch_1_8496;
163 } else {
164#line 132
165 if (s__state == 8497) {
166 goto switch_1_8497;
167 } else {
168#line 135
169 if (s__state == 8512) {
170 goto switch_1_8512;
171 } else {
172#line 138
173 if (s__state == 8513) {
174 goto switch_1_8513;
175 } else {
176#line 141
177 if (s__state == 8528) {
178 goto switch_1_8528;
179 } else {
180#line 144
181 if (s__state == 8529) {
182 goto switch_1_8529;
183 } else {
184#line 147
185 if (s__state == 8544) {
186 goto switch_1_8544;
187 } else {
188#line 150
189 if (s__state == 8545) {
190 goto switch_1_8545;
191 } else {
192#line 153
193 if (s__state == 8560) {
194 goto switch_1_8560;
195 } else {
196#line 156
197 if (s__state == 8561) {
198 goto switch_1_8561;
199 } else {
200#line 159
201 if (s__state == 8448) {
202 goto switch_1_8448;
203 } else {
204#line 162
205 if (s__state == 8576) {
206 goto switch_1_8576;
207 } else {
208#line 165
209 if (s__state == 8577) {
210 goto switch_1_8577;
211 } else {
212#line 168
213 if (s__state == 8592) {
214 goto switch_1_8592;
215 } else {
216#line 171
217 if (s__state == 8593) {
218 goto switch_1_8593;
219 } else {
220#line 174
221 if (s__state == 8608) {
222 goto switch_1_8608;
223 } else {
224#line 177
225 if (s__state == 8609) {
226 goto switch_1_8609;
227 } else {
228#line 180
229 if (s__state == 8640) {
230 goto switch_1_8640;
231 } else {
232#line 183
233 if (s__state == 8641) {
234 goto switch_1_8641;
235 } else {
236#line 186
237 if (s__state == 8656) {
238 goto switch_1_8656;
239 } else {
240#line 189
241 if (s__state == 8657) {
242 goto switch_1_8657;
243 } else {
244#line 192
245 if (s__state == 8672) {
246 goto switch_1_8672;
247 } else {
248#line 195
249 if (s__state == 8673) {
250 goto switch_1_8673;
251 } else {
252#line 198
253 if (s__state == 3) {
254 goto switch_1_3;
255 } else {
256 goto switch_1_default;
257#line 203
258 if (0) {
259 switch_1_12292:
260#line 205
261 s__new_session = 1;
262 switch_1_16384: ;
263 switch_1_8192: ;
264 switch_1_24576: ;
265 switch_1_8195:
266#line 210
267 s__server = 1;
268#line 211
269 if (cb != 0) {
270
271 }
272 {
273#line 216
274 __cil_tmp55 = s__version * 8;
275#line 216
276 if (__cil_tmp55 != 3) {
277#line 217
278 return (-1);
279 }
280 }
281#line 221
282 s__type = 8192;
283#line 222
284 if (s__init_buf___0 == 0) {
285#line 223
286 buf = __VERIFIER_nondet_int();
287#line 224
288 if (buf == 0) {
289#line 225
290 ret = -1;
291 goto end;
292 }
293#line 230
294 if (! tmp___3) {
295#line 231
296 ret = -1;
297 goto end;
298 }
299#line 236
300 s__init_buf___0 = buf;
301 }
302#line 240
303 if (! tmp___4) {
304#line 241
305 ret = -1;
306 goto end;
307 }
308#line 246
309 s__init_num = 0;
310#line 247
311 if (s__state != 12292) {
312#line 248
313 if (! tmp___5) {
314#line 249
315 ret = -1;
316 goto end;
317 }
318#line 254
319 s__state = 8464;
320#line 255
321 s__ctx__stats__sess_accept ++;
322 } else {
323#line 257
324 s__ctx__stats__sess_accept_renegotiate ++;
325#line 258
326 s__state = 8480;
327 }
328 goto switch_1_break;
329 switch_1_8480: ;
330 switch_1_8481:
331#line 263
332 s__shutdown = 0;
333#line 264
334 ret = __VERIFIER_nondet_int();
335#line 265
336 if (ret <= 0) {
337 goto end;
338 }
339#line 270
340 s__s3__tmp__next_state___0 = 8482;
341#line 271
342 s__state = 8448;
343#line 272
344 s__init_num = 0;
345 goto switch_1_break;
346 switch_1_8482:
347#line 275
348 s__state = 3;
349 goto switch_1_break;
350 switch_1_8464: ;
351 switch_1_8465: ;
352 switch_1_8466:
353#line 280
354 s__shutdown = 0;
355#line 281
356 ret = __VERIFIER_nondet_int();
357#line 282
358 if (blastFlag == 0) {
359#line 283
360 blastFlag = 1;
361 }
362#line 287
363 if (ret <= 0) {
364 goto end;
365 }
366#line 292
367 got_new_session = 1;
368#line 293
369 s__state = 8496;
370#line 294
371 s__init_num = 0;
372 goto switch_1_break;
373 switch_1_8496: ;
374 switch_1_8497:
375#line 298
376 ret = __VERIFIER_nondet_int();
377#line 299
378 if (blastFlag == 1) {
379#line 300
380 blastFlag = 2;
381 } else {
382#line 302
383 if (blastFlag == 3) {
384#line 303
385 blastFlag = 4;
386 }
387 }
388#line 308
389 if (ret <= 0) {
390 goto end;
391 }
392#line 313
393 if (s__hit) {
394#line 314
395 s__state = 8656;
396 } else {
397#line 316
398 s__state = 8512;
399 }
400#line 318
401 s__init_num = 0;
402 goto switch_1_break;
403 switch_1_8512: ;
404 switch_1_8513: ;
405 {
406#line 322
407 __cil_tmp56 = (unsigned long )s__s3__tmp__new_cipher__algorithms;
408#line 322
409 if (__cil_tmp56 + 256UL) {
410#line 323
411 skip = 1;
412 } else {
413#line 325
414 ret = __VERIFIER_nondet_int();
415#line 326
416 if (ret <= 0) {
417 goto end;
418 }
419 }
420 }
421#line 332
422 s__state = 8528;
423#line 333
424 s__init_num = 0;
425 goto switch_1_break;
426 switch_1_8528: ;
427 switch_1_8529:
428#line 337
429 l = (unsigned long )s__s3__tmp__new_cipher__algorithms;
430 {
431#line 338
432 __cil_tmp57 = (unsigned long )s__options;
433#line 338
434 if (__cil_tmp57 + 2097152UL) {
435#line 339
436 s__s3__tmp__use_rsa_tmp = 1;
437 } else {
438#line 341
439 s__s3__tmp__use_rsa_tmp = 0;
440 }
441 }
442#line 343
443 if (s__s3__tmp__use_rsa_tmp) {
444 goto _L___0;
445 } else {
446#line 346
447 if (l + 30UL) {
448 goto _L___0;
449 } else {
450#line 349
451 if (l + 1UL) {
452#line 350
453 if (s__cert__pkeys__AT0__privatekey == 0) {
454 goto _L___0;
455 } else {
456 {
457#line 353
458 __cil_tmp58 = (unsigned long )s__s3__tmp__new_cipher__algo_strength;
459#line 353
460 if (__cil_tmp58 + 2UL) {
461 {
462#line 354
463 __cil_tmp59 = (unsigned long )s__s3__tmp__new_cipher__algo_strength;
464#line 354
465 if (__cil_tmp59 + 4UL) {
466#line 355
467 tmp___7 = 512;
468 } else {
469#line 357
470 tmp___7 = 1024;
471 }
472 }
473 {
474#line 359
475 __cil_tmp60 = tmp___6 * 8;
476#line 359
477 if (__cil_tmp60 > tmp___7) {
478 _L___0:
479#line 361
480 ret = __VERIFIER_nondet_int();
481#line 362
482 if (ret <= 0) {
483 goto end;
484 }
485 } else {
486#line 368
487 skip = 1;
488 }
489 }
490 } else {
491#line 371
492 skip = 1;
493 }
494 }
495 }
496 } else {
497#line 375
498 skip = 1;
499 }
500 }
501 }
502#line 379
503 s__state = 8544;
504#line 380
505 s__init_num = 0;
506 goto switch_1_break;
507 switch_1_8544: ;
508 switch_1_8545: ;
509#line 384
510 if (s__verify_mode + 1) {
511#line 385
512 if (s__session__peer != 0) {
513#line 386
514 if (s__verify_mode + 4) {
515#line 387
516 skip = 1;
517#line 388
518 s__s3__tmp__cert_request = 0;
519#line 389
520 s__state = 8560;
521 } else {
522 goto _L___2;
523 }
524 } else {
525 _L___2:
526 {
527#line 395
528 __cil_tmp61 = (unsigned long )s__s3__tmp__new_cipher__algorithms;
529#line 395
530 if (__cil_tmp61 + 256UL) {
531#line 396
532 if (s__verify_mode + 2) {
533 goto _L___1;
534 } else {
535#line 399
536 skip = 1;
537#line 400
538 s__s3__tmp__cert_request = 0;
539#line 401
540 s__state = 8560;
541 }
542 } else {
543 _L___1:
544#line 405
545 s__s3__tmp__cert_request = 1;
546#line 406
547 ret = __VERIFIER_nondet_int();
548#line 407
549 if (ret <= 0) {
550 goto end;
551 }
552#line 412
553 s__state = 8448;
554#line 413
555 s__s3__tmp__next_state___0 = 8576;
556#line 414
557 s__init_num = 0;
558 }
559 }
560 }
561 } else {
562#line 418
563 skip = 1;
564#line 419
565 s__s3__tmp__cert_request = 0;
566#line 420
567 s__state = 8560;
568 }
569 goto switch_1_break;
570 switch_1_8560: ;
571 switch_1_8561:
572#line 425
573 ret = __VERIFIER_nondet_int();
574#line 426
575 if (ret <= 0) {
576 goto end;
577 }
578#line 431
579 s__s3__tmp__next_state___0 = 8576;
580#line 432
581 s__state = 8448;
582#line 433
583 s__init_num = 0;
584 goto switch_1_break;
585 switch_1_8448:
586#line 436
587 if (num1 > 0L) {
588#line 437
589 s__rwstate = 2;
590#line 438
591 num1 = tmp___8;
592#line 439
593 if (num1 <= 0L) {
594#line 440
595 ret = -1;
596 goto end;
597 }
598#line 445
599 s__rwstate = 1;
600 }
601#line 449
602 s__state = s__s3__tmp__next_state___0;
603 goto switch_1_break;
604 switch_1_8576: ;
605 switch_1_8577:
606#line 453
607 ret = __VERIFIER_nondet_int();
608#line 454
609 if (ret <= 0) {
610 goto end;
611 }
612#line 459
613 if (ret == 2) {
614#line 460
615 s__state = 8466;
616 } else {
617#line 462
618 ret = __VERIFIER_nondet_int();
619#line 463
620 if (ret <= 0) {
621 goto end;
622 }
623#line 468
624 s__init_num = 0;
625#line 469
626 s__state = 8592;
627 }
628 goto switch_1_break;
629 switch_1_8592: ;
630 switch_1_8593:
631#line 474
632 ret = __VERIFIER_nondet_int();
633#line 475
634 if (ret <= 0) {
635 goto end;
636 }
637#line 480
638 s__state = 8608;
639#line 481
640 s__init_num = 0;
641 goto switch_1_break;
642 switch_1_8608: ;
643 switch_1_8609:
644#line 485
645 ret = __VERIFIER_nondet_int();
646#line 486
647 if (ret <= 0) {
648 goto end;
649 }
650#line 491
651 s__state = 8640;
652#line 492
653 s__init_num = 0;
654 goto switch_1_break;
655 switch_1_8640: ;
656 switch_1_8641:
657#line 496
658 ret = __VERIFIER_nondet_int();
659#line 497
660 if (ret <= 0) {
661 goto end;
662 }
663#line 502
664 if (s__hit) {
665#line 503
666 s__state = 3;
667 } else {
668#line 505
669 s__state = 8656;
670 }
671#line 507
672 s__init_num = 0;
673 goto switch_1_break;
674 switch_1_8656: ;
675 switch_1_8657:
676#line 511
677 s__session__cipher = s__s3__tmp__new_cipher;
678#line 512
679 if (! tmp___9) {
680#line 513
681 ret = -1;
682 goto end;
683 }
684#line 518
685 ret = __VERIFIER_nondet_int();
686#line 519
687 if (blastFlag == 2) {
688#line 520
689 blastFlag = 3;
690 }
691#line 524
692 if (ret <= 0) {
693 goto end;
694 }
695#line 529
696 s__state = 8672;
697#line 530
698 s__init_num = 0;
699#line 531
700 if (! tmp___10) {
701#line 532
702 ret = -1;
703 goto end;
704 }
705 goto switch_1_break;
706 switch_1_8672: ;
707 switch_1_8673:
708#line 540
709 ret = __VERIFIER_nondet_int();
710#line 541
711 if (blastFlag == 3) {
712 goto ERROR;
713 }
714#line 546
715 if (ret <= 0) {
716 goto end;
717 }
718#line 551
719 s__state = 8448;
720#line 552
721 if (s__hit) {
722#line 553
723 s__s3__tmp__next_state___0 = 8640;
724 } else {
725#line 555
726 s__s3__tmp__next_state___0 = 3;
727 }
728#line 557
729 s__init_num = 0;
730 goto switch_1_break;
731 switch_1_3:
732#line 560
733 s__init_buf___0 = 0;
734#line 561
735 s__init_num = 0;
736#line 562
737 if (got_new_session) {
738#line 563
739 s__new_session = 0;
740#line 564
741 s__ctx__stats__sess_accept_good ++;
742#line 565
743 if (cb != 0) {
744
745 }
746 }
747#line 573
748 ret = 1;
749 goto end;
750 switch_1_default:
751#line 576
752 ret = -1;
753 goto end;
754 } else {
755 switch_1_break: ;
756 }
757 }
758 }
759 }
760 }
761 }
762 }
763 }
764 }
765 }
766 }
767 }
768 }
769 }
770 }
771 }
772 }
773 }
774 }
775 }
776 }
777 }
778 }
779 }
780 }
781 }
782 }
783 }
784 }
785 }
786 }
787 }
788 }
789 }
790 }
791 }
792#line 617
793 if (! s__s3__tmp__reuse_message) {
794#line 618
795 if (! skip) {
796#line 619
797 if (s__debug) {
798#line 620
799 ret = __VERIFIER_nondet_int();
800#line 621
801 if (ret <= 0) {
802 goto end;
803 }
804 }
805#line 629
806 if (cb != 0) {
807#line 630
808 if (s__state != state) {
809#line 631
810 new_state = s__state;
811#line 632
812 s__state = state;
813#line 633
814 s__state = new_state;
815 }
816 }
817 }
818 }
819#line 646
820 skip = 0;
821 }
822 while_0_break: ;
823 }
824
825 end:
826#line 651
827 s__in_handshake --;
828#line 652
829 if (cb != 0) {
830
831 }
832#line 657
833 return (ret);
834 ERROR:
835#line 659
836 return (-1);
837}
838}
839#line 662 "s3_srvr_2_BUG.cil.c"
840int main(void)
841{ int s ;
842 int tmp ;
843
844 {
845 {
846#line 668
847 s = 8464;
848#line 669
849 tmp = ssl3_accept(s);
850 }
851#line 671
852 return (tmp);
853}
854}