diff options
Diffstat (limited to 'src/lib/libssl/src/apps/s_server.c')
| -rw-r--r-- | src/lib/libssl/src/apps/s_server.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/lib/libssl/src/apps/s_server.c b/src/lib/libssl/src/apps/s_server.c index b03231f3ba..5157aae4d1 100644 --- a/src/lib/libssl/src/apps/s_server.c +++ b/src/lib/libssl/src/apps/s_server.c | |||
| @@ -144,6 +144,14 @@ typedef unsigned int u_int; | |||
| 144 | #include <conio.h> | 144 | #include <conio.h> |
| 145 | #endif | 145 | #endif |
| 146 | 146 | ||
| 147 | #ifdef OPENSSL_SYS_WINCE | ||
| 148 | /* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */ | ||
| 149 | #ifdef fileno | ||
| 150 | #undef fileno | ||
| 151 | #endif | ||
| 152 | #define fileno(a) (int)_fileno(a) | ||
| 153 | #endif | ||
| 154 | |||
| 147 | #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) | 155 | #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) |
| 148 | /* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ | 156 | /* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ |
| 149 | #undef FIONBIO | 157 | #undef FIONBIO |
| @@ -234,7 +242,9 @@ static int s_msg=0; | |||
| 234 | static int s_quiet=0; | 242 | static int s_quiet=0; |
| 235 | 243 | ||
| 236 | static int hack=0; | 244 | static int hack=0; |
| 245 | #ifndef OPENSSL_NO_ENGINE | ||
| 237 | static char *engine_id=NULL; | 246 | static char *engine_id=NULL; |
| 247 | #endif | ||
| 238 | static const char *session_id_prefix=NULL; | 248 | static const char *session_id_prefix=NULL; |
| 239 | 249 | ||
| 240 | #ifdef MONOLITH | 250 | #ifdef MONOLITH |
| @@ -259,7 +269,9 @@ static void s_server_init(void) | |||
| 259 | s_msg=0; | 269 | s_msg=0; |
| 260 | s_quiet=0; | 270 | s_quiet=0; |
| 261 | hack=0; | 271 | hack=0; |
| 272 | #ifndef OPENSSL_NO_ENGINE | ||
| 262 | engine_id=NULL; | 273 | engine_id=NULL; |
| 274 | #endif | ||
| 263 | } | 275 | } |
| 264 | #endif | 276 | #endif |
| 265 | 277 | ||
| @@ -308,7 +320,9 @@ static void sv_usage(void) | |||
| 308 | BIO_printf(bio_err," -WWW - Respond to a 'GET /<path> HTTP/1.0' with file ./<path>\n"); | 320 | BIO_printf(bio_err," -WWW - Respond to a 'GET /<path> HTTP/1.0' with file ./<path>\n"); |
| 309 | BIO_printf(bio_err," -HTTP - Respond to a 'GET /<path> HTTP/1.0' with file ./<path>\n"); | 321 | BIO_printf(bio_err," -HTTP - Respond to a 'GET /<path> HTTP/1.0' with file ./<path>\n"); |
| 310 | BIO_printf(bio_err," with the assumption it contains a complete HTTP response.\n"); | 322 | BIO_printf(bio_err," with the assumption it contains a complete HTTP response.\n"); |
| 323 | #ifndef OPENSSL_NO_ENGINE | ||
| 311 | BIO_printf(bio_err," -engine id - Initialise and use the specified engine\n"); | 324 | BIO_printf(bio_err," -engine id - Initialise and use the specified engine\n"); |
| 325 | #endif | ||
| 312 | BIO_printf(bio_err," -id_prefix arg - Generate SSL/TLS session IDs prefixed by 'arg'\n"); | 326 | BIO_printf(bio_err," -id_prefix arg - Generate SSL/TLS session IDs prefixed by 'arg'\n"); |
| 313 | BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); | 327 | BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); |
| 314 | } | 328 | } |
| @@ -482,7 +496,9 @@ int MAIN(int argc, char *argv[]) | |||
| 482 | int no_tmp_rsa=0,no_dhe=0,nocert=0; | 496 | int no_tmp_rsa=0,no_dhe=0,nocert=0; |
| 483 | int state=0; | 497 | int state=0; |
| 484 | SSL_METHOD *meth=NULL; | 498 | SSL_METHOD *meth=NULL; |
| 499 | #ifndef OPENSSL_NO_ENGINE | ||
| 485 | ENGINE *e=NULL; | 500 | ENGINE *e=NULL; |
| 501 | #endif | ||
| 486 | char *inrand=NULL; | 502 | char *inrand=NULL; |
| 487 | 503 | ||
| 488 | #if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3) | 504 | #if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3) |
| @@ -657,11 +673,13 @@ int MAIN(int argc, char *argv[]) | |||
| 657 | if (--argc < 1) goto bad; | 673 | if (--argc < 1) goto bad; |
| 658 | session_id_prefix = *(++argv); | 674 | session_id_prefix = *(++argv); |
| 659 | } | 675 | } |
| 676 | #ifndef OPENSSL_NO_ENGINE | ||
| 660 | else if (strcmp(*argv,"-engine") == 0) | 677 | else if (strcmp(*argv,"-engine") == 0) |
| 661 | { | 678 | { |
| 662 | if (--argc < 1) goto bad; | 679 | if (--argc < 1) goto bad; |
| 663 | engine_id= *(++argv); | 680 | engine_id= *(++argv); |
| 664 | } | 681 | } |
| 682 | #endif | ||
| 665 | else if (strcmp(*argv,"-rand") == 0) | 683 | else if (strcmp(*argv,"-rand") == 0) |
| 666 | { | 684 | { |
| 667 | if (--argc < 1) goto bad; | 685 | if (--argc < 1) goto bad; |
| @@ -686,7 +704,9 @@ bad: | |||
| 686 | SSL_load_error_strings(); | 704 | SSL_load_error_strings(); |
| 687 | OpenSSL_add_ssl_algorithms(); | 705 | OpenSSL_add_ssl_algorithms(); |
| 688 | 706 | ||
| 707 | #ifndef OPENSSL_NO_ENGINE | ||
| 689 | e = setup_engine(bio_err, engine_id, 1); | 708 | e = setup_engine(bio_err, engine_id, 1); |
| 709 | #endif | ||
| 690 | 710 | ||
| 691 | if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL | 711 | if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL |
| 692 | && !RAND_status()) | 712 | && !RAND_status()) |
| @@ -860,7 +880,7 @@ end: | |||
| 860 | bio_s_out=NULL; | 880 | bio_s_out=NULL; |
| 861 | } | 881 | } |
| 862 | apps_shutdown(); | 882 | apps_shutdown(); |
| 863 | EXIT(ret); | 883 | OPENSSL_EXIT(ret); |
| 864 | } | 884 | } |
| 865 | 885 | ||
| 866 | static void print_stats(BIO *bio, SSL_CTX *ssl_ctx) | 886 | static void print_stats(BIO *bio, SSL_CTX *ssl_ctx) |
| @@ -1176,7 +1196,7 @@ err: | |||
| 1176 | BIO_printf(bio_s_out,"CONNECTION CLOSED\n"); | 1196 | BIO_printf(bio_s_out,"CONNECTION CLOSED\n"); |
| 1177 | if (buf != NULL) | 1197 | if (buf != NULL) |
| 1178 | { | 1198 | { |
| 1179 | memset(buf,0,bufsize); | 1199 | OPENSSL_cleanse(buf,bufsize); |
| 1180 | OPENSSL_free(buf); | 1200 | OPENSSL_free(buf); |
| 1181 | } | 1201 | } |
| 1182 | if (ret >= 0) | 1202 | if (ret >= 0) |
| @@ -1228,14 +1248,14 @@ static int init_ssl_connection(SSL *con) | |||
| 1228 | { | 1248 | { |
| 1229 | BIO_printf(bio_s_out,"Client certificate\n"); | 1249 | BIO_printf(bio_s_out,"Client certificate\n"); |
| 1230 | PEM_write_bio_X509(bio_s_out,peer); | 1250 | PEM_write_bio_X509(bio_s_out,peer); |
| 1231 | X509_NAME_oneline(X509_get_subject_name(peer),buf,BUFSIZ); | 1251 | X509_NAME_oneline(X509_get_subject_name(peer),buf,sizeof buf); |
| 1232 | BIO_printf(bio_s_out,"subject=%s\n",buf); | 1252 | BIO_printf(bio_s_out,"subject=%s\n",buf); |
| 1233 | X509_NAME_oneline(X509_get_issuer_name(peer),buf,BUFSIZ); | 1253 | X509_NAME_oneline(X509_get_issuer_name(peer),buf,sizeof buf); |
| 1234 | BIO_printf(bio_s_out,"issuer=%s\n",buf); | 1254 | BIO_printf(bio_s_out,"issuer=%s\n",buf); |
| 1235 | X509_free(peer); | 1255 | X509_free(peer); |
| 1236 | } | 1256 | } |
| 1237 | 1257 | ||
| 1238 | if (SSL_get_shared_ciphers(con,buf,BUFSIZ) != NULL) | 1258 | if (SSL_get_shared_ciphers(con,buf,sizeof buf) != NULL) |
| 1239 | BIO_printf(bio_s_out,"Shared ciphers:%s\n",buf); | 1259 | BIO_printf(bio_s_out,"Shared ciphers:%s\n",buf); |
| 1240 | str=SSL_CIPHER_get_name(SSL_get_current_cipher(con)); | 1260 | str=SSL_CIPHER_get_name(SSL_get_current_cipher(con)); |
| 1241 | BIO_printf(bio_s_out,"CIPHER is %s\n",(str != NULL)?str:"(NONE)"); | 1261 | BIO_printf(bio_s_out,"CIPHER is %s\n",(str != NULL)?str:"(NONE)"); |
| @@ -1395,7 +1415,7 @@ static int www_body(char *hostname, int s, unsigned char *context) | |||
| 1395 | else | 1415 | else |
| 1396 | { | 1416 | { |
| 1397 | BIO_printf(bio_s_out,"read R BLOCK\n"); | 1417 | BIO_printf(bio_s_out,"read R BLOCK\n"); |
| 1398 | #ifndef OPENSSL_SYS_MSDOS | 1418 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(__DJGPP__) |
| 1399 | sleep(1); | 1419 | sleep(1); |
| 1400 | #endif | 1420 | #endif |
| 1401 | continue; | 1421 | continue; |
