@@ -180,13 +180,6 @@ typedef unsigned int u_int;
180180# include <fcntl.h>
181181#endif
182182
183- /* Use Windows API with STD_INPUT_HANDLE when checking for input?
184- Don't look at OPENSSL_SYS_MSDOS for this, since it is always defined if
185- OPENSSL_SYS_WINDOWS is defined */
186- #if defined(OPENSSL_SYS_WINDOWS ) && !defined(OPENSSL_SYS_WINCE ) && defined(STD_INPUT_HANDLE )
187- #define OPENSSL_USE_STD_INPUT_HANDLE
188- #endif
189-
190183#undef PROG
191184#define PROG s_client_main
192185
@@ -236,7 +229,6 @@ static BIO *bio_c_msg = NULL;
236229static int c_quiet = 0 ;
237230static int c_ign_eof = 0 ;
238231static int c_brief = 0 ;
239- static int c_no_rand_screen = 0 ;
240232
241233#ifndef OPENSSL_NO_PSK
242234/* Default PSK identity and key */
@@ -452,10 +444,6 @@ static void sc_usage(void)
452444 " -keymatexport label - Export keying material using label\n" );
453445 BIO_printf (bio_err ,
454446 " -keymatexportlen len - Export len bytes of keying material (default 20)\n" );
455- #ifdef OPENSSL_SYS_WINDOWS
456- BIO_printf (bio_err ,
457- " -no_rand_screen - Do not use RAND_screen() to initialize random state\n" );
458- #endif
459447}
460448
461449#ifndef OPENSSL_NO_TLSEXT
@@ -642,10 +630,11 @@ static int serverinfo_cli_parse_cb(SSL *s, unsigned int ext_type,
642630 unsigned char ext_buf [4 + 65536 ];
643631
644632 /* Reconstruct the type/len fields prior to extension data */
645- ext_buf [0 ] = ext_type >> 8 ;
646- ext_buf [1 ] = ext_type & 0xFF ;
647- ext_buf [2 ] = inlen >> 8 ;
648- ext_buf [3 ] = inlen & 0xFF ;
633+ inlen &= 0xffff ; /* for formal memcpy correctness */
634+ ext_buf [0 ] = (unsigned char )(ext_type >> 8 );
635+ ext_buf [1 ] = (unsigned char )(ext_type );
636+ ext_buf [2 ] = (unsigned char )(inlen >> 8 );
637+ ext_buf [3 ] = (unsigned char )(inlen );
649638 memcpy (ext_buf + 4 , in , inlen );
650639
651640 BIO_snprintf (pem_name , sizeof (pem_name ), "SERVERINFO FOR EXTENSION %d" ,
@@ -1148,10 +1137,6 @@ int MAIN(int argc, char **argv)
11481137 keymatexportlen = atoi (* (++ argv ));
11491138 if (keymatexportlen == 0 )
11501139 goto bad ;
1151- #ifdef OPENSSL_SYS_WINDOWS
1152- } else if (strcmp (* argv , "-no_rand_screen" ) == 0 ) {
1153- c_no_rand_screen = 1 ;
1154- #endif
11551140 } else {
11561141 BIO_printf (bio_err , "unknown option %s\n" , * argv );
11571142 badop = 1 ;
@@ -1268,7 +1253,7 @@ int MAIN(int argc, char **argv)
12681253 if (!load_excert (& exc , bio_err ))
12691254 goto end ;
12701255
1271- if (!app_RAND_load_file (NULL , bio_err , ++ c_no_rand_screen ) && inrand == NULL
1256+ if (!app_RAND_load_file (NULL, bio_err , 1 ) && inrand == NULL
12721257 && !RAND_status ()) {
12731258 BIO_printf (bio_err ,
12741259 "warning , not much extra random data , consider using the - rand option \n ");
@@ -1808,16 +1793,17 @@ int MAIN(int argc, char **argv)
18081793 tv .tv_usec = 0 ;
18091794 i = select (width , (void * )& readfds , (void * )& writefds ,
18101795 NULL , & tv );
1811- #if defined(OPENSSL_USE_STD_INPUT_HANDLE )
1796+ # if defined(OPENSSL_SYS_WINCE ) || defined(OPENSSL_SYS_MSDOS )
1797+ if (!i && (!_kbhit () || !read_tty ))
1798+ continue ;
1799+ # else
18121800 if (!i && (!((_kbhit ())
18131801 || (WAIT_OBJECT_0 ==
18141802 WaitForSingleObject (GetStdHandle
18151803 (STD_INPUT_HANDLE ),
18161804 0 )))
18171805 || !read_tty ))
18181806 continue ;
1819- #else
1820- if (!i && (!_kbhit () || !read_tty ) ) continue ;
18211807# endif
18221808 } else
18231809 i = select (width , (void * )& readfds , (void * )& writefds ,
@@ -2019,12 +2005,12 @@ int MAIN(int argc, char **argv)
20192005 }
20202006 }
20212007#if defined(OPENSSL_SYS_WINDOWS ) || defined(OPENSSL_SYS_MSDOS )
2022- #if defined(OPENSSL_USE_STD_INPUT_HANDLE )
2008+ # if defined(OPENSSL_SYS_WINCE ) || defined(OPENSSL_SYS_MSDOS )
2009+ else if (_kbhit ())
2010+ # else
20232011 else if ((_kbhit ())
20242012 || (WAIT_OBJECT_0 ==
20252013 WaitForSingleObject (GetStdHandle (STD_INPUT_HANDLE ), 0 )))
2026- #else
2027- else if (_kbhit ())
20282014# endif
20292015#elif defined (OPENSSL_SYS_NETWARE )
20302016 else if (_kbhit ())
0 commit comments