apps/s_server.c:885: error: NULL_DEREFERENCE
  pointer `con` last assigned on line 861 could be null and is dereferenced by call to `SSL_set_bio()` at line 885, column 2.
Showing all 123 steps of the trace


apps/s_server.c:830:1: start of procedure sv_body()
828.   	}
829.   
830. > static int sv_body(char *hostname, int s, unsigned char *context)
831.   	{
832.   	char *buf=NULL;

apps/s_server.c:832:2: 
830.   static int sv_body(char *hostname, int s, unsigned char *context)
831.   	{
832. > 	char *buf=NULL;
833.   	fd_set readfds;
834.   	int ret=1,width;

apps/s_server.c:834:2: 
832.   	char *buf=NULL;
833.   	fd_set readfds;
834. > 	int ret=1,width;
835.   	int k,i;
836.   	unsigned long l;

apps/s_server.c:837:2: 
835.   	int k,i;
836.   	unsigned long l;
837. > 	SSL *con=NULL;
838.   	BIO *sbio;
839.   #ifdef OPENSSL_SYS_WINDOWS

apps/s_server.c:843:6: 
841.   #endif
842.   
843. > 	if ((buf=OPENSSL_malloc(bufsize)) == NULL)
844.   		{
845.   		BIO_printf(bio_err,"out of memory\n");

crypto/mem.c:282:1: start of procedure CRYPTO_malloc()
  280.   	}
  281.   
  282. > void *CRYPTO_malloc(int num, const char *file, int line)
  283.   	{
  284.   	void *ret = NULL;

crypto/mem.c:284:2: 
  282.   void *CRYPTO_malloc(int num, const char *file, int line)
  283.   	{
  284. > 	void *ret = NULL;
  285.   
  286.   	allow_customize = 0;

crypto/mem.c:286:2: 
  284.   	void *ret = NULL;
  285.   
  286. > 	allow_customize = 0;
  287.   	if (malloc_debug_func != NULL)
  288.   		{

crypto/mem.c:287:6: Taking false branch
  285.   
  286.   	allow_customize = 0;
  287.   	if (malloc_debug_func != NULL)
              ^
  288.   		{
  289.   		allow_customize_debug = 0;

crypto/mem.c:292:2: Skipping __function_pointer__(): unresolved function pointer
  290.   		malloc_debug_func(NULL, num, file, line, 0);
  291.   		}
  292.   	ret = malloc_ex_func(num,file,line);
          ^
  293.   #ifdef LEVITTE_DEBUG_MEM
  294.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:296:6: Taking false branch
  294.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
  295.   #endif
  296.   	if (malloc_debug_func != NULL)
              ^
  297.   		malloc_debug_func(ret, num, file, line, 1);
  298.   

crypto/mem.c:299:2: 
  297.   		malloc_debug_func(ret, num, file, line, 1);
  298.   
  299. > 	return ret;
  300.   	}
  301.   

crypto/mem.c:300:2: return from a call to CRYPTO_malloc
  298.   
  299.   	return ret;
  300.   	}
          ^
  301.   
  302.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

apps/s_server.c:843:6: Taking false branch
841.   #endif
842.   
843.   	if ((buf=OPENSSL_malloc(bufsize)) == NULL)
            ^
844.   		{
845.   		BIO_printf(bio_err,"out of memory\n");

apps/s_server.c:849:6: Taking false branch
847.   		}
848.   #ifdef FIONBIO	
849.   	if (s_nbio)
            ^
850.   		{
851.   		unsigned long sl=1;

apps/s_server.c:860:6: Taking true branch
858.   #endif
859.   
860.   	if (con == NULL) {
            ^
861.   		con=SSL_new(ctx);
862.   #ifndef OPENSSL_NO_KRB5

apps/s_server.c:861:3: 
859.   
860.   	if (con == NULL) {
861. > 		con=SSL_new(ctx);
862.   #ifndef OPENSSL_NO_KRB5
863.   		if ((con->kssl_ctx = kssl_ctx_new()) != NULL)

ssl/ssl_lib.c:173:1: start of procedure SSL_new()
  171.   	}
  172.   
  173. > SSL *SSL_new(SSL_CTX *ctx)
  174.   	{
  175.   	SSL *s;

ssl/ssl_lib.c:177:6: Taking false branch
  175.   	SSL *s;
  176.   
  177.   	if (ctx == NULL)
              ^
  178.   		{
  179.   		SSLerr(SSL_F_SSL_NEW,SSL_R_NULL_SSL_CTX);

ssl/ssl_lib.c:182:6: Taking true branch
  180.   		return(NULL);
  181.   		}
  182.   	if (ctx->method == NULL)
              ^
  183.   		{
  184.   		SSLerr(SSL_F_SSL_NEW,SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);

ssl/ssl_lib.c:184:3: 
  182.   	if (ctx->method == NULL)
  183.   		{
  184. > 		SSLerr(SSL_F_SSL_NEW,SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);
  185.   		return(NULL);
  186.   		}

crypto/err/err.c:582:1: start of procedure ERR_put_error()
    580.   /********************************************************/
    581.   
    582. > void ERR_put_error(int lib, int func, int reason, const char *file,
    583.   	     int line)
    584.   	{

crypto/err/err.c:606:2: Skipping ERR_get_state(): empty list of specs
    604.   	}
    605.   #endif
    606.   	es=ERR_get_state();
            ^
    607.   
    608.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:608:2: 
    606.   	es=ERR_get_state();
    607.   
    608. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    609.   	if (es->top == es->bottom)
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:609:6: Taking false branch
    607.   
    608.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    609.   	if (es->top == es->bottom)
                ^
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:611:2: 
    609.   	if (es->top == es->bottom)
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    611. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    612.   	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;

crypto/err/err.c:612:2: 
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    612. > 	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);

crypto/err/err.c:613:2: 
    611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    612.   	es->err_file[es->top]=file;
    613. > 	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
    615.   	}

crypto/err/err.c:614:2: Taking true branch
    612.   	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
            ^
    615.   	}
    616.   

crypto/err/err.c:614:2: Taking false branch
    612.   	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
            ^
    615.   	}
    616.   

crypto/err/err.c:615:2: return from a call to ERR_put_error
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
    615.   	}
            ^
    616.   
    617.   void ERR_clear_error(void)

ssl/ssl_lib.c:185:3: 
  183.   		{
  184.   		SSLerr(SSL_F_SSL_NEW,SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);
  185. > 		return(NULL);
  186.   		}
  187.   

ssl/ssl_lib.c:254:2: return from a call to SSL_new
  252.   	SSLerr(SSL_F_SSL_NEW,ERR_R_MALLOC_FAILURE);
  253.   	return(NULL);
  254.   	}
          ^
  255.   
  256.   int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx,

apps/s_server.c:871:6: Taking true branch
869.                           }
870.   #endif	/* OPENSSL_NO_KRB5 */
871.   		if(context)
            ^
872.   		      SSL_set_session_id_context(con, context,
873.   						 strlen((char *)context));

apps/s_server.c:872:9: 
870.   #endif	/* OPENSSL_NO_KRB5 */
871.   		if(context)
872. > 		      SSL_set_session_id_context(con, context,
873.   						 strlen((char *)context));
874.   	}

ssl/ssl_lib.c:270:1: start of procedure SSL_set_session_id_context()
  268.       }
  269.   
  270. > int SSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx,
  271.   			       unsigned int sid_ctx_len)
  272.       {

ssl/ssl_lib.c:273:8: Taking true branch
  271.   			       unsigned int sid_ctx_len)
  272.       {
  273.       if(sid_ctx_len > SSL_MAX_SID_CTX_LENGTH)
                ^
  274.   	{
  275.   	SSLerr(SSL_F_SSL_SET_SESSION_ID_CONTEXT,SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG);

ssl/ssl_lib.c:275:2: 
  273.       if(sid_ctx_len > SSL_MAX_SID_CTX_LENGTH)
  274.   	{
  275. > 	SSLerr(SSL_F_SSL_SET_SESSION_ID_CONTEXT,SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG);
  276.   	return 0;
  277.   	}

crypto/err/err.c:582:1: start of procedure ERR_put_error()
    580.   /********************************************************/
    581.   
    582. > void ERR_put_error(int lib, int func, int reason, const char *file,
    583.   	     int line)
    584.   	{

crypto/err/err.c:606:2: Skipping ERR_get_state(): empty list of specs
    604.   	}
    605.   #endif
    606.   	es=ERR_get_state();
            ^
    607.   
    608.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:608:2: 
    606.   	es=ERR_get_state();
    607.   
    608. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    609.   	if (es->top == es->bottom)
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:609:6: Taking false branch
    607.   
    608.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    609.   	if (es->top == es->bottom)
                ^
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:611:2: 
    609.   	if (es->top == es->bottom)
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    611. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    612.   	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;

crypto/err/err.c:612:2: 
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    612. > 	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);

crypto/err/err.c:613:2: 
    611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    612.   	es->err_file[es->top]=file;
    613. > 	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
    615.   	}

crypto/err/err.c:614:2: Taking true branch
    612.   	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
            ^
    615.   	}
    616.   

crypto/err/err.c:614:2: Taking false branch
    612.   	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
            ^
    615.   	}
    616.   

crypto/err/err.c:615:2: return from a call to ERR_put_error
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
    615.   	}
            ^
    616.   
    617.   void ERR_clear_error(void)

ssl/ssl_lib.c:276:2: 
  274.   	{
  275.   	SSLerr(SSL_F_SSL_SET_SESSION_ID_CONTEXT,SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG);
  276. > 	return 0;
  277.   	}
  278.       ssl->sid_ctx_length=sid_ctx_len;

ssl/ssl_lib.c:282:5: return from a call to SSL_set_session_id_context
  280.   
  281.       return 1;
  282.       }
             ^
  283.   
  284.   int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb)

apps/s_server.c:875:2: Skipping SSL_clear(): empty list of specs
873.   						 strlen((char *)context));
874.   	}
875.   	SSL_clear(con);
        ^
876.   
877.   	sbio=BIO_new_socket(s,BIO_NOCLOSE);

apps/s_server.c:877:2: 
875.   	SSL_clear(con);
876.   
877. > 	sbio=BIO_new_socket(s,BIO_NOCLOSE);
878.   	if (s_nbio_test)
879.   		{

crypto/bio/bss_sock.c:94:1: start of procedure BIO_new_socket()
  92.   	}
  93.   
  94. > BIO *BIO_new_socket(int fd, int close_flag)
  95.   	{
  96.   	BIO *ret;

crypto/bio/bss_sock.c:98:2: 
  96.   	BIO *ret;
  97.   
  98. > 	ret=BIO_new(BIO_s_socket());
  99.   	if (ret == NULL) return(NULL);
  100.   	BIO_set_fd(ret,fd,close_flag);

crypto/bio/bss_sock.c:89:1: start of procedure BIO_s_socket()
    87.   	};
    88.   
    89. > BIO_METHOD *BIO_s_socket(void)
    90.   	{
    91.   	return(&methods_sockp);

crypto/bio/bss_sock.c:91:2: 
    89.   BIO_METHOD *BIO_s_socket(void)
    90.   	{
    91. > 	return(&methods_sockp);
    92.   	}
    93.   

crypto/bio/bss_sock.c:92:2: return from a call to BIO_s_socket
    90.   	{
    91.   	return(&methods_sockp);
    92.   	}
           ^
    93.   
    94.   BIO *BIO_new_socket(int fd, int close_flag)

crypto/bio/bio_lib.c:66:1: start of procedure BIO_new()
    64.   #include <openssl/stack.h>
    65.   
    66. > BIO *BIO_new(BIO_METHOD *method)
    67.   	{
    68.   	BIO *ret=NULL;

crypto/bio/bio_lib.c:68:2: 
    66.   BIO *BIO_new(BIO_METHOD *method)
    67.   	{
    68. > 	BIO *ret=NULL;
    69.   
    70.   	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));

crypto/bio/bio_lib.c:70:2: 
    68.   	BIO *ret=NULL;
    69.   
    70. > 	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));
    71.   	if (ret == NULL)
    72.   		{

crypto/mem.c:282:1: start of procedure CRYPTO_malloc()
      280.   	}
      281.   
      282. > void *CRYPTO_malloc(int num, const char *file, int line)
      283.   	{
      284.   	void *ret = NULL;

crypto/mem.c:284:2: 
      282.   void *CRYPTO_malloc(int num, const char *file, int line)
      283.   	{
      284. > 	void *ret = NULL;
      285.   
      286.   	allow_customize = 0;

crypto/mem.c:286:2: 
      284.   	void *ret = NULL;
      285.   
      286. > 	allow_customize = 0;
      287.   	if (malloc_debug_func != NULL)
      288.   		{

crypto/mem.c:287:6: Taking false branch
      285.   
      286.   	allow_customize = 0;
      287.   	if (malloc_debug_func != NULL)
                  ^
      288.   		{
      289.   		allow_customize_debug = 0;

crypto/mem.c:292:2: Skipping __function_pointer__(): unresolved function pointer
      290.   		malloc_debug_func(NULL, num, file, line, 0);
      291.   		}
      292.   	ret = malloc_ex_func(num,file,line);
              ^
      293.   #ifdef LEVITTE_DEBUG_MEM
      294.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:296:6: Taking false branch
      294.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
      295.   #endif
      296.   	if (malloc_debug_func != NULL)
                  ^
      297.   		malloc_debug_func(ret, num, file, line, 1);
      298.   

crypto/mem.c:299:2: 
      297.   		malloc_debug_func(ret, num, file, line, 1);
      298.   
      299. > 	return ret;
      300.   	}
      301.   

crypto/mem.c:300:2: return from a call to CRYPTO_malloc
      298.   
      299.   	return ret;
      300.   	}
              ^
      301.   
      302.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/bio/bio_lib.c:71:6: Taking true branch
    69.   
    70.   	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));
    71.   	if (ret == NULL)
               ^
    72.   		{
    73.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);

crypto/bio/bio_lib.c:73:3: 
    71.   	if (ret == NULL)
    72.   		{
    73. > 		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
    74.   		return(NULL);
    75.   		}

crypto/err/err.c:582:1: start of procedure ERR_put_error()
      580.   /********************************************************/
      581.   
      582. > void ERR_put_error(int lib, int func, int reason, const char *file,
      583.   	     int line)
      584.   	{

crypto/err/err.c:606:2: Skipping ERR_get_state(): empty list of specs
      604.   	}
      605.   #endif
      606.   	es=ERR_get_state();
              ^
      607.   
      608.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:608:2: 
      606.   	es=ERR_get_state();
      607.   
      608. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
      609.   	if (es->top == es->bottom)
      610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:609:6: Taking false branch
      607.   
      608.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
      609.   	if (es->top == es->bottom)
                  ^
      610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:611:2: 
      609.   	if (es->top == es->bottom)
      610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      611. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      612.   	es->err_file[es->top]=file;
      613.   	es->err_line[es->top]=line;

crypto/err/err.c:612:2: 
      610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      612. > 	es->err_file[es->top]=file;
      613.   	es->err_line[es->top]=line;
      614.   	err_clear_data(es,es->top);

crypto/err/err.c:613:2: 
      611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      612.   	es->err_file[es->top]=file;
      613. > 	es->err_line[es->top]=line;
      614.   	err_clear_data(es,es->top);
      615.   	}

crypto/err/err.c:614:2: Taking true branch
      612.   	es->err_file[es->top]=file;
      613.   	es->err_line[es->top]=line;
      614.   	err_clear_data(es,es->top);
              ^
      615.   	}
      616.   

crypto/err/err.c:614:2: Taking false branch
      612.   	es->err_file[es->top]=file;
      613.   	es->err_line[es->top]=line;
      614.   	err_clear_data(es,es->top);
              ^
      615.   	}
      616.   

crypto/err/err.c:615:2: return from a call to ERR_put_error
      613.   	es->err_line[es->top]=line;
      614.   	err_clear_data(es,es->top);
      615.   	}
              ^
      616.   
      617.   void ERR_clear_error(void)

crypto/bio/bio_lib.c:74:3: 
    72.   		{
    73.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
    74. > 		return(NULL);
    75.   		}
    76.   	if (!BIO_set(ret,method))

crypto/bio/bio_lib.c:82:2: return from a call to BIO_new
    80.   		}
    81.   	return(ret);
    82.   	}
           ^
    83.   
    84.   int BIO_set(BIO *bio, BIO_METHOD *method)

crypto/bio/bss_sock.c:99:6: Taking true branch
  97.   
  98.   	ret=BIO_new(BIO_s_socket());
  99.   	if (ret == NULL) return(NULL);
              ^
  100.   	BIO_set_fd(ret,fd,close_flag);
  101.   	return(ret);

crypto/bio/bss_sock.c:99:19: 
  97.   
  98.   	ret=BIO_new(BIO_s_socket());
  99. > 	if (ret == NULL) return(NULL);
  100.   	BIO_set_fd(ret,fd,close_flag);
  101.   	return(ret);

crypto/bio/bss_sock.c:102:2: return from a call to BIO_new_socket
  100.   	BIO_set_fd(ret,fd,close_flag);
  101.   	return(ret);
  102.   	}
          ^
  103.   
  104.   static int sock_new(BIO *bi)

apps/s_server.c:878:6: Taking true branch
876.   
877.   	sbio=BIO_new_socket(s,BIO_NOCLOSE);
878.   	if (s_nbio_test)
            ^
879.   		{
880.   		BIO *test;

apps/s_server.c:882:3: 
880.   		BIO *test;
881.   
882. > 		test=BIO_new(BIO_f_nbio_test());
883.   		sbio=BIO_push(test,sbio);
884.   		}

crypto/bio/bf_nbio.c:97:1: start of procedure BIO_f_nbio_test()
  95.   	};
  96.   
  97. > BIO_METHOD *BIO_f_nbio_test(void)
  98.   	{
  99.   	return(&methods_nbiof);

crypto/bio/bf_nbio.c:99:2: 
  97.   BIO_METHOD *BIO_f_nbio_test(void)
  98.   	{
  99. > 	return(&methods_nbiof);
  100.   	}
  101.   

crypto/bio/bf_nbio.c:100:2: return from a call to BIO_f_nbio_test
  98.   	{
  99.   	return(&methods_nbiof);
  100.   	}
          ^
  101.   
  102.   static int nbiof_new(BIO *bi)

crypto/bio/bio_lib.c:66:1: start of procedure BIO_new()
  64.   #include <openssl/stack.h>
  65.   
  66. > BIO *BIO_new(BIO_METHOD *method)
  67.   	{
  68.   	BIO *ret=NULL;

crypto/bio/bio_lib.c:68:2: 
  66.   BIO *BIO_new(BIO_METHOD *method)
  67.   	{
  68. > 	BIO *ret=NULL;
  69.   
  70.   	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));

crypto/bio/bio_lib.c:70:2: 
  68.   	BIO *ret=NULL;
  69.   
  70. > 	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));
  71.   	if (ret == NULL)
  72.   		{

crypto/mem.c:282:1: start of procedure CRYPTO_malloc()
    280.   	}
    281.   
    282. > void *CRYPTO_malloc(int num, const char *file, int line)
    283.   	{
    284.   	void *ret = NULL;

crypto/mem.c:284:2: 
    282.   void *CRYPTO_malloc(int num, const char *file, int line)
    283.   	{
    284. > 	void *ret = NULL;
    285.   
    286.   	allow_customize = 0;

crypto/mem.c:286:2: 
    284.   	void *ret = NULL;
    285.   
    286. > 	allow_customize = 0;
    287.   	if (malloc_debug_func != NULL)
    288.   		{

crypto/mem.c:287:6: Taking false branch
    285.   
    286.   	allow_customize = 0;
    287.   	if (malloc_debug_func != NULL)
                ^
    288.   		{
    289.   		allow_customize_debug = 0;

crypto/mem.c:292:2: Skipping __function_pointer__(): unresolved function pointer
    290.   		malloc_debug_func(NULL, num, file, line, 0);
    291.   		}
    292.   	ret = malloc_ex_func(num,file,line);
            ^
    293.   #ifdef LEVITTE_DEBUG_MEM
    294.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:296:6: Taking false branch
    294.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
    295.   #endif
    296.   	if (malloc_debug_func != NULL)
                ^
    297.   		malloc_debug_func(ret, num, file, line, 1);
    298.   

crypto/mem.c:299:2: 
    297.   		malloc_debug_func(ret, num, file, line, 1);
    298.   
    299. > 	return ret;
    300.   	}
    301.   

crypto/mem.c:300:2: return from a call to CRYPTO_malloc
    298.   
    299.   	return ret;
    300.   	}
            ^
    301.   
    302.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/bio/bio_lib.c:71:6: Taking true branch
  69.   
  70.   	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));
  71.   	if (ret == NULL)
             ^
  72.   		{
  73.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);

crypto/bio/bio_lib.c:73:3: 
  71.   	if (ret == NULL)
  72.   		{
  73. > 		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
  74.   		return(NULL);
  75.   		}

crypto/err/err.c:582:1: start of procedure ERR_put_error()
    580.   /********************************************************/
    581.   
    582. > void ERR_put_error(int lib, int func, int reason, const char *file,
    583.   	     int line)
    584.   	{

crypto/err/err.c:606:2: Skipping ERR_get_state(): empty list of specs
    604.   	}
    605.   #endif
    606.   	es=ERR_get_state();
            ^
    607.   
    608.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:608:2: 
    606.   	es=ERR_get_state();
    607.   
    608. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    609.   	if (es->top == es->bottom)
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:609:6: Taking false branch
    607.   
    608.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    609.   	if (es->top == es->bottom)
                ^
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:611:2: 
    609.   	if (es->top == es->bottom)
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    611. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    612.   	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;

crypto/err/err.c:612:2: 
    610.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    612. > 	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);

crypto/err/err.c:613:2: 
    611.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    612.   	es->err_file[es->top]=file;
    613. > 	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
    615.   	}

crypto/err/err.c:614:2: Taking true branch
    612.   	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
            ^
    615.   	}
    616.   

crypto/err/err.c:614:2: Taking false branch
    612.   	es->err_file[es->top]=file;
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
            ^
    615.   	}
    616.   

crypto/err/err.c:615:2: return from a call to ERR_put_error
    613.   	es->err_line[es->top]=line;
    614.   	err_clear_data(es,es->top);
    615.   	}
            ^
    616.   
    617.   void ERR_clear_error(void)

crypto/bio/bio_lib.c:74:3: 
  72.   		{
  73.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
  74. > 		return(NULL);
  75.   		}
  76.   	if (!BIO_set(ret,method))

crypto/bio/bio_lib.c:82:2: return from a call to BIO_new
  80.   		}
  81.   	return(ret);
  82.   	}
         ^
  83.   
  84.   int BIO_set(BIO *bio, BIO_METHOD *method)

apps/s_server.c:883:3: 
881.   
882.   		test=BIO_new(BIO_f_nbio_test());
883. > 		sbio=BIO_push(test,sbio);
884.   		}
885.   	SSL_set_bio(con,sbio,sbio);

crypto/bio/bio_lib.c:362:1: start of procedure BIO_push()
  360.   
  361.   /* put the 'bio' on the end of b's list of operators */
  362. > BIO *BIO_push(BIO *b, BIO *bio)
  363.   	{
  364.   	BIO *lb;

crypto/bio/bio_lib.c:366:6: Taking true branch
  364.   	BIO *lb;
  365.   
  366.   	if (b == NULL) return(bio);
              ^
  367.   	lb=b;
  368.   	while (lb->next_bio != NULL)

crypto/bio/bio_lib.c:366:17: 
  364.   	BIO *lb;
  365.   
  366. > 	if (b == NULL) return(bio);
  367.   	lb=b;
  368.   	while (lb->next_bio != NULL)

crypto/bio/bio_lib.c:376:2: return from a call to BIO_push
  374.   	BIO_ctrl(b,BIO_CTRL_PUSH,0,NULL);
  375.   	return(b);
  376.   	}
          ^
  377.   
  378.   /* Remove the first and return the rest */

apps/s_server.c:885:2: 
883.   		sbio=BIO_push(test,sbio);
884.   		}
885. > 	SSL_set_bio(con,sbio,sbio);
886.   	SSL_set_accept_state(con);
887.   	/* SSL_set_fd(con,s); */

ssl/ssl_lib.c:415:1: start of procedure SSL_set_bio()
  413.   	}
  414.   
  415. > void SSL_set_bio(SSL *s,BIO *rbio,BIO *wbio)
  416.   	{
  417.   	/* If the output buffering BIO is still in place, remove it

ssl/ssl_lib.c:419:6: 
  417.   	/* If the output buffering BIO is still in place, remove it
  418.   	 */
  419. > 	if (s->bbio != NULL)
  420.   		{
  421.   		if (s->wbio == s->bbio)

static int sv_body(char *hostname, int s, unsigned char *context)
	{
	char *buf=NULL;
	fd_set readfds;
	int ret=1,width;
	int k,i;
	unsigned long l;
	SSL *con=NULL;
	BIO *sbio;
#ifdef OPENSSL_SYS_WINDOWS
	struct timeval tv;
#endif
	if ((buf=OPENSSL_malloc(bufsize)) == NULL)
		{
		BIO_printf(bio_err,"out of memory\n");
		goto err;
		}
#ifdef FIONBIO
	if (s_nbio)
		{
		unsigned long sl=1;
		if (!s_quiet)
			BIO_printf(bio_err,"turning on non blocking io\n");
		if (BIO_socket_ioctl(s,FIONBIO,&sl) < 0)
			ERR_print_errors(bio_err);
		}
#endif
	if (con == NULL) {
		con=SSL_new(ctx);
#ifndef OPENSSL_NO_KRB5
		if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
                        {
                        kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE,
								KRB5SVC);
                        kssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB,
								KRB5KEYTAB);
                        }
#endif
		if(context)
		      SSL_set_session_id_context(con, context,
						 strlen((char *)context));
	}
	SSL_clear(con);
	sbio=BIO_new_socket(s,BIO_NOCLOSE);
	if (s_nbio_test)
		{
		BIO *test;
		test=BIO_new(BIO_f_nbio_test());
		sbio=BIO_push(test,sbio);
		}
	SSL_set_bio(con,sbio,sbio);
	SSL_set_accept_state(con);
	if (s_debug)
		{
		con->debug=1;
		BIO_set_callback(SSL_get_rbio(con),bio_dump_cb);
		BIO_set_callback_arg(SSL_get_rbio(con),bio_s_out);
		}
	width=s+1;
	for (;;)
		{
		int read_from_terminal;
		int read_from_sslcon;
		read_from_terminal = 0;
		read_from_sslcon = SSL_pending(con);
		if (!read_from_sslcon)
			{
			FD_ZERO(&readfds);
#ifndef OPENSSL_SYS_WINDOWS
			FD_SET(fileno(stdin),&readfds);
#endif
			FD_SET(s,&readfds);
#ifdef OPENSSL_SYS_WINDOWS
			tv.tv_sec = 1;
			tv.tv_usec = 0;
			i=select(width,(void *)&readfds,NULL,NULL,&tv);
			if((i < 0) || (!i && !_kbhit() ) )continue;
			if(_kbhit())
				read_from_terminal = 1;
#else
			i=select(width,(void *)&readfds,NULL,NULL,NULL);
			if (i <= 0) continue;
			if (FD_ISSET(fileno(stdin),&readfds))
				read_from_terminal = 1;
#endif
			if (FD_ISSET(s,&readfds))
				read_from_sslcon = 1;
			}
		if (read_from_terminal)
			{
			if (s_crlf)
				{
				int j, lf_num;
				i=read(fileno(stdin), buf, bufsize/2);
				lf_num = 0;
				for (j = 0; j < i; j++)
					if (buf[j] == '\n')
						lf_num++;
				for (j = i-1; j >= 0; j--)
					{
					buf[j+lf_num] = buf[j];
					if (buf[j] == '\n')
						{
						lf_num--;
						i++;
						buf[j+lf_num] = '\r';
						}
					}
				assert(lf_num == 0);
				}
			else
				i=read(fileno(stdin),buf,bufsize);
			if (!s_quiet)
				{
				if ((i <= 0) || (buf[0] == 'Q'))
					{
					BIO_printf(bio_s_out,"DONE\n");
					SHUTDOWN(s);
					close_accept_socket();
					ret= -11;
					goto err;
					}
				if ((i <= 0) || (buf[0] == 'q'))
					{
					BIO_printf(bio_s_out,"DONE\n");
					SHUTDOWN(s);
					goto err;
					}
				if ((buf[0] == 'r') &&
					((buf[1] == '\n') || (buf[1] == '\r')))
					{
					SSL_renegotiate(con);
					i=SSL_do_handshake(con);
					printf("SSL_do_handshake -> %d\n",i);
					i=0;
					continue;
					}
				if ((buf[0] == 'R') &&
					((buf[1] == '\n') || (buf[1] == '\r')))
					{
					SSL_set_verify(con,
						SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,NULL);
					SSL_renegotiate(con);
					i=SSL_do_handshake(con);
					printf("SSL_do_handshake -> %d\n",i);
					i=0;
					continue;
					}
				if (buf[0] == 'P')
					{
					static char *str="Lets print some clear text\n";
					BIO_write(SSL_get_wbio(con),str,strlen(str));
					}
				if (buf[0] == 'S')
					{
					print_stats(bio_s_out,SSL_get_SSL_CTX(con));
					}
				}
#ifdef CHARSET_EBCDIC
			ebcdic2ascii(buf,buf,i);
#endif
			l=k=0;
			for (;;)
				{
#ifdef RENEG
{ static count=0; if (++count == 100) { count=0; SSL_renegotiate(con); } }
#endif
				k=SSL_write(con,&(buf[l]),(unsigned int)i);
				switch (SSL_get_error(con,k))
					{
				case SSL_ERROR_NONE:
					break;
				case SSL_ERROR_WANT_WRITE:
				case SSL_ERROR_WANT_READ:
				case SSL_ERROR_WANT_X509_LOOKUP:
					BIO_printf(bio_s_out,"Write BLOCK\n");
					break;
				case SSL_ERROR_SYSCALL:
				case SSL_ERROR_SSL:
					BIO_printf(bio_s_out,"ERROR\n");
					ERR_print_errors(bio_err);
					ret=1;
					goto err;
				case SSL_ERROR_ZERO_RETURN:
					BIO_printf(bio_s_out,"DONE\n");
					ret=1;
					goto err;
					}
				l+=k;
				i-=k;
				if (i <= 0) break;
				}
			}
		if (read_from_sslcon)
			{
			if (!SSL_is_init_finished(con))
				{
				i=init_ssl_connection(con);
				if (i < 0)
					{
					ret=0;
					goto err;
					}
				else if (i == 0)
					{
					ret=1;
					goto err;
					}
				}
			else
				{
again:
				i=SSL_read(con,(char *)buf,bufsize);
				switch (SSL_get_error(con,i))
					{
				case SSL_ERROR_NONE:
#ifdef CHARSET_EBCDIC
					ascii2ebcdic(buf,buf,i);
#endif
					write(fileno(stdout),buf,
						(unsigned int)i);
					if (SSL_pending(con)) goto again;
					break;
				case SSL_ERROR_WANT_WRITE:
				case SSL_ERROR_WANT_READ:
				case SSL_ERROR_WANT_X509_LOOKUP:
					BIO_printf(bio_s_out,"Read BLOCK\n");
					break;
				case SSL_ERROR_SYSCALL:
				case SSL_ERROR_SSL:
					BIO_printf(bio_s_out,"ERROR\n");
					ERR_print_errors(bio_err);
					ret=1;
					goto err;
				case SSL_ERROR_ZERO_RETURN:
					BIO_printf(bio_s_out,"DONE\n");
					ret=1;
					goto err;
					}
				}
			}
		}
err:
	BIO_printf(bio_s_out,"shutting down SSL\n");
#if 1
	SSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
#else
	SSL_shutdown(con);
#endif
	if (con != NULL) SSL_free(con);
	BIO_printf(bio_s_out,"CONNECTION CLOSED\n");
	if (buf != NULL)
		{
		memset(buf,0,bufsize);
		OPENSSL_free(buf);
		}
	if (ret >= 0)
		BIO_printf(bio_s_out,"ACCEPT\n");
	return(ret);
	}
['static int sv_body(char *hostname, int s, unsigned char *context)\n\t{\n\tchar *buf=NULL;\n\tfd_set readfds;\n\tint ret=1,width;\n\tint k,i;\n\tunsigned long l;\n\tSSL *con=NULL;\n\tBIO *sbio;\n#ifdef OPENSSL_SYS_WINDOWS\n\tstruct timeval tv;\n#endif\n\tif ((buf=OPENSSL_malloc(bufsize)) == NULL)\n\t\t{\n\t\tBIO_printf(bio_err,"out of memory\\n");\n\t\tgoto err;\n\t\t}\n#ifdef FIONBIO\n\tif (s_nbio)\n\t\t{\n\t\tunsigned long sl=1;\n\t\tif (!s_quiet)\n\t\t\tBIO_printf(bio_err,"turning on non blocking io\\n");\n\t\tif (BIO_socket_ioctl(s,FIONBIO,&sl) < 0)\n\t\t\tERR_print_errors(bio_err);\n\t\t}\n#endif\n\tif (con == NULL) {\n\t\tcon=SSL_new(ctx);\n#ifndef OPENSSL_NO_KRB5\n\t\tif ((con->kssl_ctx = kssl_ctx_new()) != NULL)\n                        {\n                        kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE,\n\t\t\t\t\t\t\t\tKRB5SVC);\n                        kssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB,\n\t\t\t\t\t\t\t\tKRB5KEYTAB);\n                        }\n#endif\n\t\tif(context)\n\t\t      SSL_set_session_id_context(con, context,\n\t\t\t\t\t\t strlen((char *)context));\n\t}\n\tSSL_clear(con);\n\tsbio=BIO_new_socket(s,BIO_NOCLOSE);\n\tif (s_nbio_test)\n\t\t{\n\t\tBIO *test;\n\t\ttest=BIO_new(BIO_f_nbio_test());\n\t\tsbio=BIO_push(test,sbio);\n\t\t}\n\tSSL_set_bio(con,sbio,sbio);\n\tSSL_set_accept_state(con);\n\tif (s_debug)\n\t\t{\n\t\tcon->debug=1;\n\t\tBIO_set_callback(SSL_get_rbio(con),bio_dump_cb);\n\t\tBIO_set_callback_arg(SSL_get_rbio(con),bio_s_out);\n\t\t}\n\twidth=s+1;\n\tfor (;;)\n\t\t{\n\t\tint read_from_terminal;\n\t\tint read_from_sslcon;\n\t\tread_from_terminal = 0;\n\t\tread_from_sslcon = SSL_pending(con);\n\t\tif (!read_from_sslcon)\n\t\t\t{\n\t\t\tFD_ZERO(&readfds);\n#ifndef OPENSSL_SYS_WINDOWS\n\t\t\tFD_SET(fileno(stdin),&readfds);\n#endif\n\t\t\tFD_SET(s,&readfds);\n#ifdef OPENSSL_SYS_WINDOWS\n\t\t\ttv.tv_sec = 1;\n\t\t\ttv.tv_usec = 0;\n\t\t\ti=select(width,(void *)&readfds,NULL,NULL,&tv);\n\t\t\tif((i < 0) || (!i && !_kbhit() ) )continue;\n\t\t\tif(_kbhit())\n\t\t\t\tread_from_terminal = 1;\n#else\n\t\t\ti=select(width,(void *)&readfds,NULL,NULL,NULL);\n\t\t\tif (i <= 0) continue;\n\t\t\tif (FD_ISSET(fileno(stdin),&readfds))\n\t\t\t\tread_from_terminal = 1;\n#endif\n\t\t\tif (FD_ISSET(s,&readfds))\n\t\t\t\tread_from_sslcon = 1;\n\t\t\t}\n\t\tif (read_from_terminal)\n\t\t\t{\n\t\t\tif (s_crlf)\n\t\t\t\t{\n\t\t\t\tint j, lf_num;\n\t\t\t\ti=read(fileno(stdin), buf, bufsize/2);\n\t\t\t\tlf_num = 0;\n\t\t\t\tfor (j = 0; j < i; j++)\n\t\t\t\t\tif (buf[j] == \'\\n\')\n\t\t\t\t\t\tlf_num++;\n\t\t\t\tfor (j = i-1; j >= 0; j--)\n\t\t\t\t\t{\n\t\t\t\t\tbuf[j+lf_num] = buf[j];\n\t\t\t\t\tif (buf[j] == \'\\n\')\n\t\t\t\t\t\t{\n\t\t\t\t\t\tlf_num--;\n\t\t\t\t\t\ti++;\n\t\t\t\t\t\tbuf[j+lf_num] = \'\\r\';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tassert(lf_num == 0);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\ti=read(fileno(stdin),buf,bufsize);\n\t\t\tif (!s_quiet)\n\t\t\t\t{\n\t\t\t\tif ((i <= 0) || (buf[0] == \'Q\'))\n\t\t\t\t\t{\n\t\t\t\t\tBIO_printf(bio_s_out,"DONE\\n");\n\t\t\t\t\tSHUTDOWN(s);\n\t\t\t\t\tclose_accept_socket();\n\t\t\t\t\tret= -11;\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\tif ((i <= 0) || (buf[0] == \'q\'))\n\t\t\t\t\t{\n\t\t\t\t\tBIO_printf(bio_s_out,"DONE\\n");\n\t\t\t\t\tSHUTDOWN(s);\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\tif ((buf[0] == \'r\') &&\n\t\t\t\t\t((buf[1] == \'\\n\') || (buf[1] == \'\\r\')))\n\t\t\t\t\t{\n\t\t\t\t\tSSL_renegotiate(con);\n\t\t\t\t\ti=SSL_do_handshake(con);\n\t\t\t\t\tprintf("SSL_do_handshake -> %d\\n",i);\n\t\t\t\t\ti=0;\n\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\tif ((buf[0] == \'R\') &&\n\t\t\t\t\t((buf[1] == \'\\n\') || (buf[1] == \'\\r\')))\n\t\t\t\t\t{\n\t\t\t\t\tSSL_set_verify(con,\n\t\t\t\t\t\tSSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,NULL);\n\t\t\t\t\tSSL_renegotiate(con);\n\t\t\t\t\ti=SSL_do_handshake(con);\n\t\t\t\t\tprintf("SSL_do_handshake -> %d\\n",i);\n\t\t\t\t\ti=0;\n\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\tif (buf[0] == \'P\')\n\t\t\t\t\t{\n\t\t\t\t\tstatic char *str="Lets print some clear text\\n";\n\t\t\t\t\tBIO_write(SSL_get_wbio(con),str,strlen(str));\n\t\t\t\t\t}\n\t\t\t\tif (buf[0] == \'S\')\n\t\t\t\t\t{\n\t\t\t\t\tprint_stats(bio_s_out,SSL_get_SSL_CTX(con));\n\t\t\t\t\t}\n\t\t\t\t}\n#ifdef CHARSET_EBCDIC\n\t\t\tebcdic2ascii(buf,buf,i);\n#endif\n\t\t\tl=k=0;\n\t\t\tfor (;;)\n\t\t\t\t{\n#ifdef RENEG\n{ static count=0; if (++count == 100) { count=0; SSL_renegotiate(con); } }\n#endif\n\t\t\t\tk=SSL_write(con,&(buf[l]),(unsigned int)i);\n\t\t\t\tswitch (SSL_get_error(con,k))\n\t\t\t\t\t{\n\t\t\t\tcase SSL_ERROR_NONE:\n\t\t\t\t\tbreak;\n\t\t\t\tcase SSL_ERROR_WANT_WRITE:\n\t\t\t\tcase SSL_ERROR_WANT_READ:\n\t\t\t\tcase SSL_ERROR_WANT_X509_LOOKUP:\n\t\t\t\t\tBIO_printf(bio_s_out,"Write BLOCK\\n");\n\t\t\t\t\tbreak;\n\t\t\t\tcase SSL_ERROR_SYSCALL:\n\t\t\t\tcase SSL_ERROR_SSL:\n\t\t\t\t\tBIO_printf(bio_s_out,"ERROR\\n");\n\t\t\t\t\tERR_print_errors(bio_err);\n\t\t\t\t\tret=1;\n\t\t\t\t\tgoto err;\n\t\t\t\tcase SSL_ERROR_ZERO_RETURN:\n\t\t\t\t\tBIO_printf(bio_s_out,"DONE\\n");\n\t\t\t\t\tret=1;\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\tl+=k;\n\t\t\t\ti-=k;\n\t\t\t\tif (i <= 0) break;\n\t\t\t\t}\n\t\t\t}\n\t\tif (read_from_sslcon)\n\t\t\t{\n\t\t\tif (!SSL_is_init_finished(con))\n\t\t\t\t{\n\t\t\t\ti=init_ssl_connection(con);\n\t\t\t\tif (i < 0)\n\t\t\t\t\t{\n\t\t\t\t\tret=0;\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\telse if (i == 0)\n\t\t\t\t\t{\n\t\t\t\t\tret=1;\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\nagain:\n\t\t\t\ti=SSL_read(con,(char *)buf,bufsize);\n\t\t\t\tswitch (SSL_get_error(con,i))\n\t\t\t\t\t{\n\t\t\t\tcase SSL_ERROR_NONE:\n#ifdef CHARSET_EBCDIC\n\t\t\t\t\tascii2ebcdic(buf,buf,i);\n#endif\n\t\t\t\t\twrite(fileno(stdout),buf,\n\t\t\t\t\t\t(unsigned int)i);\n\t\t\t\t\tif (SSL_pending(con)) goto again;\n\t\t\t\t\tbreak;\n\t\t\t\tcase SSL_ERROR_WANT_WRITE:\n\t\t\t\tcase SSL_ERROR_WANT_READ:\n\t\t\t\tcase SSL_ERROR_WANT_X509_LOOKUP:\n\t\t\t\t\tBIO_printf(bio_s_out,"Read BLOCK\\n");\n\t\t\t\t\tbreak;\n\t\t\t\tcase SSL_ERROR_SYSCALL:\n\t\t\t\tcase SSL_ERROR_SSL:\n\t\t\t\t\tBIO_printf(bio_s_out,"ERROR\\n");\n\t\t\t\t\tERR_print_errors(bio_err);\n\t\t\t\t\tret=1;\n\t\t\t\t\tgoto err;\n\t\t\t\tcase SSL_ERROR_ZERO_RETURN:\n\t\t\t\t\tBIO_printf(bio_s_out,"DONE\\n");\n\t\t\t\t\tret=1;\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\nerr:\n\tBIO_printf(bio_s_out,"shutting down SSL\\n");\n#if 1\n\tSSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);\n#else\n\tSSL_shutdown(con);\n#endif\n\tif (con != NULL) SSL_free(con);\n\tBIO_printf(bio_s_out,"CONNECTION CLOSED\\n");\n\tif (buf != NULL)\n\t\t{\n\t\tmemset(buf,0,bufsize);\n\t\tOPENSSL_free(buf);\n\t\t}\n\tif (ret >= 0)\n\t\tBIO_printf(bio_s_out,"ACCEPT\\n");\n\treturn(ret);\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\tallow_customize = 0;\n\tif (malloc_debug_func != NULL)\n\t\t{\n\t\tallow_customize_debug = 0;\n\t\tmalloc_debug_func(NULL, num, file, line, 0);\n\t\t}\n\tret = malloc_ex_func(num,file,line);\n#ifdef LEVITTE_DEBUG_MEM\n\tfprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n\tif (malloc_debug_func != NULL)\n\t\tmalloc_debug_func(ret, num, file, line, 1);\n\treturn ret;\n\t}', 'SSL *SSL_new(SSL_CTX *ctx)\n\t{\n\tSSL *s;\n\tif (ctx == NULL)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_NEW,SSL_R_NULL_SSL_CTX);\n\t\treturn(NULL);\n\t\t}\n\tif (ctx->method == NULL)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_NEW,SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);\n\t\treturn(NULL);\n\t\t}\n\ts=(SSL *)OPENSSL_malloc(sizeof(SSL));\n\tif (s == NULL) goto err;\n\tmemset(s,0,sizeof(SSL));\n#ifndef\tOPENSSL_NO_KRB5\n\ts->kssl_ctx = kssl_ctx_new();\n#endif\n\tif (ctx->cert != NULL)\n\t\t{\n\t\ts->cert = ssl_cert_dup(ctx->cert);\n\t\tif (s->cert == NULL)\n\t\t\tgoto err;\n\t\t}\n\telse\n\t\ts->cert=NULL;\n\ts->sid_ctx_length=ctx->sid_ctx_length;\n\tmemcpy(&s->sid_ctx,&ctx->sid_ctx,sizeof(s->sid_ctx));\n\ts->verify_mode=ctx->verify_mode;\n\ts->verify_depth=ctx->verify_depth;\n\ts->verify_callback=ctx->default_verify_callback;\n\ts->generate_session_id=ctx->generate_session_id;\n\ts->purpose = ctx->purpose;\n\ts->trust = ctx->trust;\n\tCRYPTO_add(&ctx->references,1,CRYPTO_LOCK_SSL_CTX);\n\ts->ctx=ctx;\n\ts->verify_result=X509_V_OK;\n\ts->method=ctx->method;\n\tif (!s->method->ssl_new(s))\n\t\tgoto err;\n\ts->quiet_shutdown=ctx->quiet_shutdown;\n\ts->references=1;\n\ts->server=(ctx->method->ssl_accept == ssl_undefined_function)?0:1;\n\ts->options=ctx->options;\n\ts->mode=ctx->mode;\n\ts->read_ahead=ctx->read_ahead;\n\tSSL_clear(s);\n\tCRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data);\n\treturn(s);\nerr:\n\tif (s != NULL)\n\t\t{\n\t\tif (s->cert != NULL)\n\t\t\tssl_cert_free(s->cert);\n\t\tif (s->ctx != NULL)\n\t\t\tSSL_CTX_free(s->ctx);\n\t\tOPENSSL_free(s);\n\t\t}\n\tSSLerr(SSL_F_SSL_NEW,ERR_R_MALLOC_FAILURE);\n\treturn(NULL);\n\t}', 'void ERR_put_error(int lib, int func, int reason, const char *file,\n\t     int line)\n\t{\n\tERR_STATE *es;\n#ifdef _OSD_POSIX\n\tif (strncmp(file,"*POSIX(", sizeof("*POSIX(")-1) == 0) {\n\t\tchar *end;\n\t\tfile += sizeof("*POSIX(")-1;\n\t\tend = &file[strlen(file)-1];\n\t\tif (*end == \')\')\n\t\t\t*end = \'\\0\';\n\t\tif ((end = strrchr(file, \'/\')) != NULL)\n\t\t\tfile = &end[1];\n\t}\n#endif\n\tes=ERR_get_state();\n\tes->top=(es->top+1)%ERR_NUM_ERRORS;\n\tif (es->top == es->bottom)\n\t\tes->bottom=(es->bottom+1)%ERR_NUM_ERRORS;\n\tes->err_buffer[es->top]=ERR_PACK(lib,func,reason);\n\tes->err_file[es->top]=file;\n\tes->err_line[es->top]=line;\n\terr_clear_data(es,es->top);\n\t}', 'int SSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx,\n\t\t\t       unsigned int sid_ctx_len)\n    {\n    if(sid_ctx_len > SSL_MAX_SID_CTX_LENGTH)\n\t{\n\tSSLerr(SSL_F_SSL_SET_SESSION_ID_CONTEXT,SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG);\n\treturn 0;\n\t}\n    ssl->sid_ctx_length=sid_ctx_len;\n    memcpy(ssl->sid_ctx,sid_ctx,sid_ctx_len);\n    return 1;\n    }', 'BIO *BIO_new_socket(int fd, int close_flag)\n\t{\n\tBIO *ret;\n\tret=BIO_new(BIO_s_socket());\n\tif (ret == NULL) return(NULL);\n\tBIO_set_fd(ret,fd,close_flag);\n\treturn(ret);\n\t}', 'BIO_METHOD *BIO_s_socket(void)\n\t{\n\treturn(&methods_sockp);\n\t}', 'BIO *BIO_new(BIO_METHOD *method)\n\t{\n\tBIO *ret=NULL;\n\tret=(BIO *)OPENSSL_malloc(sizeof(BIO));\n\tif (ret == NULL)\n\t\t{\n\t\tBIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tif (!BIO_set(ret,method))\n\t\t{\n\t\tOPENSSL_free(ret);\n\t\tret=NULL;\n\t\t}\n\treturn(ret);\n\t}', 'BIO_METHOD *BIO_f_nbio_test(void)\n\t{\n\treturn(&methods_nbiof);\n\t}', 'BIO *BIO_push(BIO *b, BIO *bio)\n\t{\n\tBIO *lb;\n\tif (b == NULL) return(bio);\n\tlb=b;\n\twhile (lb->next_bio != NULL)\n\t\tlb=lb->next_bio;\n\tlb->next_bio=bio;\n\tif (bio != NULL)\n\t\tbio->prev_bio=lb;\n\tBIO_ctrl(b,BIO_CTRL_PUSH,0,NULL);\n\treturn(b);\n\t}', 'void SSL_set_bio(SSL *s,BIO *rbio,BIO *wbio)\n\t{\n\tif (s->bbio != NULL)\n\t\t{\n\t\tif (s->wbio == s->bbio)\n\t\t\t{\n\t\t\ts->wbio=s->wbio->next_bio;\n\t\t\ts->bbio->next_bio=NULL;\n\t\t\t}\n\t\t}\n\tif ((s->rbio != NULL) && (s->rbio != rbio))\n\t\tBIO_free_all(s->rbio);\n\tif ((s->wbio != NULL) && (s->wbio != wbio) && (s->rbio != s->wbio))\n\t\tBIO_free_all(s->wbio);\n\ts->rbio=rbio;\n\ts->wbio=wbio;\n\t}']