diff options
Diffstat (limited to 'src/lib/libssl/src/apps/s_server.c')
-rw-r--r-- | src/lib/libssl/src/apps/s_server.c | 159 |
1 files changed, 0 insertions, 159 deletions
diff --git a/src/lib/libssl/src/apps/s_server.c b/src/lib/libssl/src/apps/s_server.c index 53da15da23..de54aa6abd 100644 --- a/src/lib/libssl/src/apps/s_server.c +++ b/src/lib/libssl/src/apps/s_server.c | |||
@@ -567,156 +567,6 @@ static void sv_usage(void) | |||
567 | static int local_argc=0; | 567 | static int local_argc=0; |
568 | static char **local_argv; | 568 | static char **local_argv; |
569 | 569 | ||
570 | #ifdef CHARSET_EBCDIC | ||
571 | static int ebcdic_new(BIO *bi); | ||
572 | static int ebcdic_free(BIO *a); | ||
573 | static int ebcdic_read(BIO *b, char *out, int outl); | ||
574 | static int ebcdic_write(BIO *b, const char *in, int inl); | ||
575 | static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr); | ||
576 | static int ebcdic_gets(BIO *bp, char *buf, int size); | ||
577 | static int ebcdic_puts(BIO *bp, const char *str); | ||
578 | |||
579 | #define BIO_TYPE_EBCDIC_FILTER (18|0x0200) | ||
580 | static BIO_METHOD methods_ebcdic= | ||
581 | { | ||
582 | BIO_TYPE_EBCDIC_FILTER, | ||
583 | "EBCDIC/ASCII filter", | ||
584 | ebcdic_write, | ||
585 | ebcdic_read, | ||
586 | ebcdic_puts, | ||
587 | ebcdic_gets, | ||
588 | ebcdic_ctrl, | ||
589 | ebcdic_new, | ||
590 | ebcdic_free, | ||
591 | }; | ||
592 | |||
593 | typedef struct | ||
594 | { | ||
595 | size_t alloced; | ||
596 | char buff[1]; | ||
597 | } EBCDIC_OUTBUFF; | ||
598 | |||
599 | BIO_METHOD *BIO_f_ebcdic_filter() | ||
600 | { | ||
601 | return(&methods_ebcdic); | ||
602 | } | ||
603 | |||
604 | static int ebcdic_new(BIO *bi) | ||
605 | { | ||
606 | EBCDIC_OUTBUFF *wbuf; | ||
607 | |||
608 | wbuf = (EBCDIC_OUTBUFF *)OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + 1024); | ||
609 | wbuf->alloced = 1024; | ||
610 | wbuf->buff[0] = '\0'; | ||
611 | |||
612 | bi->ptr=(char *)wbuf; | ||
613 | bi->init=1; | ||
614 | bi->flags=0; | ||
615 | return(1); | ||
616 | } | ||
617 | |||
618 | static int ebcdic_free(BIO *a) | ||
619 | { | ||
620 | if (a == NULL) return(0); | ||
621 | if (a->ptr != NULL) | ||
622 | OPENSSL_free(a->ptr); | ||
623 | a->ptr=NULL; | ||
624 | a->init=0; | ||
625 | a->flags=0; | ||
626 | return(1); | ||
627 | } | ||
628 | |||
629 | static int ebcdic_read(BIO *b, char *out, int outl) | ||
630 | { | ||
631 | int ret=0; | ||
632 | |||
633 | if (out == NULL || outl == 0) return(0); | ||
634 | if (b->next_bio == NULL) return(0); | ||
635 | |||
636 | ret=BIO_read(b->next_bio,out,outl); | ||
637 | if (ret > 0) | ||
638 | ascii2ebcdic(out,out,ret); | ||
639 | return(ret); | ||
640 | } | ||
641 | |||
642 | static int ebcdic_write(BIO *b, const char *in, int inl) | ||
643 | { | ||
644 | EBCDIC_OUTBUFF *wbuf; | ||
645 | int ret=0; | ||
646 | int num; | ||
647 | unsigned char n; | ||
648 | |||
649 | if ((in == NULL) || (inl <= 0)) return(0); | ||
650 | if (b->next_bio == NULL) return(0); | ||
651 | |||
652 | wbuf=(EBCDIC_OUTBUFF *)b->ptr; | ||
653 | |||
654 | if (inl > (num = wbuf->alloced)) | ||
655 | { | ||
656 | num = num + num; /* double the size */ | ||
657 | if (num < inl) | ||
658 | num = inl; | ||
659 | OPENSSL_free(wbuf); | ||
660 | wbuf=(EBCDIC_OUTBUFF *)OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + num); | ||
661 | |||
662 | wbuf->alloced = num; | ||
663 | wbuf->buff[0] = '\0'; | ||
664 | |||
665 | b->ptr=(char *)wbuf; | ||
666 | } | ||
667 | |||
668 | ebcdic2ascii(wbuf->buff, in, inl); | ||
669 | |||
670 | ret=BIO_write(b->next_bio, wbuf->buff, inl); | ||
671 | |||
672 | return(ret); | ||
673 | } | ||
674 | |||
675 | static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
676 | { | ||
677 | long ret; | ||
678 | |||
679 | if (b->next_bio == NULL) return(0); | ||
680 | switch (cmd) | ||
681 | { | ||
682 | case BIO_CTRL_DUP: | ||
683 | ret=0L; | ||
684 | break; | ||
685 | default: | ||
686 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
687 | break; | ||
688 | } | ||
689 | return(ret); | ||
690 | } | ||
691 | |||
692 | static int ebcdic_gets(BIO *bp, char *buf, int size) | ||
693 | { | ||
694 | int i, ret=0; | ||
695 | if (bp->next_bio == NULL) return(0); | ||
696 | /* return(BIO_gets(bp->next_bio,buf,size));*/ | ||
697 | for (i=0; i<size-1; ++i) | ||
698 | { | ||
699 | ret = ebcdic_read(bp,&buf[i],1); | ||
700 | if (ret <= 0) | ||
701 | break; | ||
702 | else if (buf[i] == '\n') | ||
703 | { | ||
704 | ++i; | ||
705 | break; | ||
706 | } | ||
707 | } | ||
708 | if (i < size) | ||
709 | buf[i] = '\0'; | ||
710 | return (ret < 0 && i == 0) ? ret : i; | ||
711 | } | ||
712 | |||
713 | static int ebcdic_puts(BIO *bp, const char *str) | ||
714 | { | ||
715 | if (bp->next_bio == NULL) return(0); | ||
716 | return ebcdic_write(bp, str, strlen(str)); | ||
717 | } | ||
718 | #endif | ||
719 | |||
720 | #ifndef OPENSSL_NO_TLSEXT | 570 | #ifndef OPENSSL_NO_TLSEXT |
721 | 571 | ||
722 | /* This is a context that we pass to callbacks */ | 572 | /* This is a context that we pass to callbacks */ |
@@ -2231,9 +2081,6 @@ static int sv_body(char *hostname, int s, unsigned char *context) | |||
2231 | print_stats(bio_s_out,SSL_get_SSL_CTX(con)); | 2081 | print_stats(bio_s_out,SSL_get_SSL_CTX(con)); |
2232 | } | 2082 | } |
2233 | } | 2083 | } |
2234 | #ifdef CHARSET_EBCDIC | ||
2235 | ebcdic2ascii(buf,buf,i); | ||
2236 | #endif | ||
2237 | l=k=0; | 2084 | l=k=0; |
2238 | for (;;) | 2085 | for (;;) |
2239 | { | 2086 | { |
@@ -2316,9 +2163,6 @@ again: | |||
2316 | switch (SSL_get_error(con,i)) | 2163 | switch (SSL_get_error(con,i)) |
2317 | { | 2164 | { |
2318 | case SSL_ERROR_NONE: | 2165 | case SSL_ERROR_NONE: |
2319 | #ifdef CHARSET_EBCDIC | ||
2320 | ascii2ebcdic(buf,buf,i); | ||
2321 | #endif | ||
2322 | raw_write_stdout(buf, | 2166 | raw_write_stdout(buf, |
2323 | (unsigned int)i); | 2167 | (unsigned int)i); |
2324 | if (SSL_pending(con)) goto again; | 2168 | if (SSL_pending(con)) goto again; |
@@ -2612,9 +2456,6 @@ static int www_body(char *hostname, int s, unsigned char *context) | |||
2612 | /* SSL_set_fd(con,s); */ | 2456 | /* SSL_set_fd(con,s); */ |
2613 | BIO_set_ssl(ssl_bio,con,BIO_CLOSE); | 2457 | BIO_set_ssl(ssl_bio,con,BIO_CLOSE); |
2614 | BIO_push(io,ssl_bio); | 2458 | BIO_push(io,ssl_bio); |
2615 | #ifdef CHARSET_EBCDIC | ||
2616 | io = BIO_push(BIO_new(BIO_f_ebcdic_filter()),io); | ||
2617 | #endif | ||
2618 | 2459 | ||
2619 | if (s_debug) | 2460 | if (s_debug) |
2620 | { | 2461 | { |