apps/s_server.c:1252: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `SSL_new`.
Showing all 14 steps of the trace


apps/s_server.c:1252:11: Call
1250.   	if (!BIO_set_write_buffer_size(io,bufsize)) goto err;
1251.   
1252.   	if ((con=SSL_new(ctx)) == NULL) goto err;
                  ^
1253.   #ifndef OPENSSL_NO_KRB5
1254.   	if ((con->kssl_ctx = kssl_ctx_new()) != NULL)

ssl/ssl_lib.c:226:1: Parameter `ctx->sessions->num_items`
  224.   	}
  225.   
  226. > SSL *SSL_new(SSL_CTX *ctx)
  227.   	{
  228.   	SSL *s;

ssl/ssl_lib.c:298:2: Call
  296.   	s->server=(ctx->method->ssl_accept == ssl_undefined_function)?0:1;
  297.   
  298.   	SSL_clear(s);
          ^
  299.   
  300.   	CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data);

ssl/ssl_lib.c:137:1: Parameter `s->ctx->sessions->num_items`
    135.   	};
    136.   
    137. > int SSL_clear(SSL *s)
    138.   	{
    139.   	int state;

ssl/ssl_lib.c:185:6: Call
    183.   	ssl_clear_cipher_ctx(s);
    184.   
    185.   	if (ssl_clear_bad_session(s))
                ^
    186.   		{
    187.   		SSL_SESSION_free(s->session);

ssl/ssl_sess.c:678:1: Parameter `s->ctx->sessions->num_items`
      676.   	}
      677.   
      678. > int ssl_clear_bad_session(SSL *s)
      679.   	{
      680.   	if (	(s->session != NULL) &&

ssl/ssl_sess.c:684:3: Call
      682.   		!(SSL_in_init(s) || SSL_in_before(s)))
      683.   		{
      684.   		SSL_CTX_remove_session(s->ctx,s->session);
               ^
      685.   		return(1);
      686.   		}

ssl/ssl_sess.c:464:1: Parameter `ctx->sessions->num_items`
        462.   	}
        463.   
        464. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
        465.   {
        466.   	return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:466:9: Call
        464.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
        465.   {
        466.   	return remove_session_lock(ctx, c, 1);
                       ^
        467.   }
        468.   

ssl/ssl_sess.c:469:1: Parameter `ctx->sessions->num_items`
          467.   }
          468.   
          469. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
          470.   	{
          471.   	SSL_SESSION *r;

ssl/ssl_sess.c:477:20: Call
          475.   		{
          476.   		if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
          477.   		r=(SSL_SESSION *)lh_delete(ctx->sessions,c);
                                    ^
          478.   		if (r != NULL)
          479.   			{

crypto/lhash/lhash.c:217:1: <LHS trace>
215.   	}
216.   
217. > void *lh_delete(LHASH *lh, const void *data)
218.   	{
219.   	unsigned long hash;

crypto/lhash/lhash.c:217:1: Parameter `lh->num_items`
            215.   	}
            216.   
            217. > void *lh_delete(LHASH *lh, const void *data)
            218.   	{
            219.   	unsigned long hash;

crypto/lhash/lhash.c:240:2: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_new` 
            238.   		}
            239.   
            240.   	lh->num_items--;
                    ^
            241.   	if ((lh->num_nodes > MIN_NODES) &&
            242.   		(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))

void *lh_delete(LHASH *lh, const void *data)
	{
	unsigned long hash;
	LHASH_NODE *nn,**rn;
	const void *ret;
	lh->error=0;
	rn=getrn(lh,data,&hash);
	if (*rn == NULL)
		{
		lh->num_no_delete++;
		return(NULL);
		}
	else
		{
		nn= *rn;
		*rn=nn->next;
		ret=nn->data;
		OPENSSL_free(nn);
		lh->num_delete++;
		}
	lh->num_items--;
	if ((lh->num_nodes > MIN_NODES) &&
		(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
		contract(lh);
	return((void *)ret);
	}
['static int www_body(char *hostname, int s, unsigned char *context)\n\t{\n\tchar *buf=NULL;\n\tint ret=1;\n\tint i,j,k,blank,dot;\n\tstruct stat st_buf;\n\tSSL *con;\n\tSSL_CIPHER *c;\n\tBIO *io,*ssl_bio,*sbio;\n\tlong total_bytes;\n\tbuf=OPENSSL_malloc(bufsize);\n\tif (buf == NULL) return(0);\n\tio=BIO_new(BIO_f_buffer());\n\tssl_bio=BIO_new(BIO_f_ssl());\n\tif ((io == NULL) || (ssl_bio == NULL)) goto err;\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 (!BIO_set_write_buffer_size(io,bufsize)) goto err;\n\tif ((con=SSL_new(ctx)) == NULL) goto err;\n#ifndef OPENSSL_NO_KRB5\n\tif ((con->kssl_ctx = kssl_ctx_new()) != NULL)\n\t\t{\n\t\tkssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE, KRB5SVC);\n\t\tkssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB, KRB5KEYTAB);\n\t\t}\n#endif\n\tif(context) SSL_set_session_id_context(con, context,\n\t\t\t\t\t       strlen((char *)context));\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\tBIO_set_ssl(ssl_bio,con,BIO_CLOSE);\n\tBIO_push(io,ssl_bio);\n#ifdef CHARSET_EBCDIC\n\tio = BIO_push(BIO_new(BIO_f_ebcdic_filter()),io);\n#endif\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\tblank=0;\n\tfor (;;)\n\t\t{\n\t\tif (hack)\n\t\t\t{\n\t\t\ti=SSL_accept(con);\n\t\t\tswitch (SSL_get_error(con,i))\n\t\t\t\t{\n\t\t\tcase SSL_ERROR_NONE:\n\t\t\t\tbreak;\n\t\t\tcase SSL_ERROR_WANT_WRITE:\n\t\t\tcase SSL_ERROR_WANT_READ:\n\t\t\tcase SSL_ERROR_WANT_X509_LOOKUP:\n\t\t\t\tcontinue;\n\t\t\tcase SSL_ERROR_SYSCALL:\n\t\t\tcase SSL_ERROR_SSL:\n\t\t\tcase SSL_ERROR_ZERO_RETURN:\n\t\t\t\tret=1;\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tSSL_renegotiate(con);\n\t\t\tSSL_write(con,NULL,0);\n\t\t\t}\n\t\ti=BIO_gets(io,buf,bufsize-1);\n\t\tif (i < 0)\n\t\t\t{\n\t\t\tif (!BIO_should_retry(io))\n\t\t\t\t{\n\t\t\t\tif (!s_quiet)\n\t\t\t\t\tERR_print_errors(bio_err);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_s_out,"read R BLOCK\\n");\n#ifndef OPENSSL_SYS_MSDOS\n\t\t\t\tsleep(1);\n#endif\n\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\telse if (i == 0)\n\t\t\t{\n\t\t\tret=1;\n\t\t\tgoto end;\n\t\t\t}\n\t\tif (\t((www == 1) && (strncmp("GET ",buf,4) == 0)) ||\n\t\t\t((www == 2) && (strncmp("GET /stats ",buf,10) == 0)))\n\t\t\t{\n\t\t\tchar *p;\n\t\t\tX509 *peer;\n\t\t\tSTACK_OF(SSL_CIPHER) *sk;\n\t\t\tstatic char *space="                          ";\n\t\t\tBIO_puts(io,"HTTP/1.0 200 ok\\r\\nContent-type: text/html\\r\\n\\r\\n");\n\t\t\tBIO_puts(io,"<HTML><BODY BGCOLOR=\\"#ffffff\\">\\n");\n\t\t\tBIO_puts(io,"<pre>\\n");\n\t\t\tBIO_puts(io,"\\n");\n\t\t\tfor (i=0; i<local_argc; i++)\n\t\t\t\t{\n\t\t\t\tBIO_puts(io,local_argv[i]);\n\t\t\t\tBIO_write(io," ",1);\n\t\t\t\t}\n\t\t\tBIO_puts(io,"\\n");\n\t\t\tBIO_printf(io,"Ciphers supported in s_server binary\\n");\n\t\t\tsk=SSL_get_ciphers(con);\n\t\t\tj=sk_SSL_CIPHER_num(sk);\n\t\t\tfor (i=0; i<j; i++)\n\t\t\t\t{\n\t\t\t\tc=sk_SSL_CIPHER_value(sk,i);\n\t\t\t\tBIO_printf(io,"%-11s:%-25s",\n\t\t\t\t\tSSL_CIPHER_get_version(c),\n\t\t\t\t\tSSL_CIPHER_get_name(c));\n\t\t\t\tif ((((i+1)%2) == 0) && (i+1 != j))\n\t\t\t\t\tBIO_puts(io,"\\n");\n\t\t\t\t}\n\t\t\tBIO_puts(io,"\\n");\n\t\t\tp=SSL_get_shared_ciphers(con,buf,bufsize);\n\t\t\tif (p != NULL)\n\t\t\t\t{\n\t\t\t\tBIO_printf(io,"---\\nCiphers common between both SSL end points:\\n");\n\t\t\t\tj=i=0;\n\t\t\t\twhile (*p)\n\t\t\t\t\t{\n\t\t\t\t\tif (*p == \':\')\n\t\t\t\t\t\t{\n\t\t\t\t\t\tBIO_write(io,space,26-j);\n\t\t\t\t\t\ti++;\n\t\t\t\t\t\tj=0;\n\t\t\t\t\t\tBIO_write(io,((i%3)?" ":"\\n"),1);\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\tBIO_write(io,p,1);\n\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\tp++;\n\t\t\t\t\t}\n\t\t\t\tBIO_puts(io,"\\n");\n\t\t\t\t}\n\t\t\tBIO_printf(io,((con->hit)\n\t\t\t\t?"---\\nReused, "\n\t\t\t\t:"---\\nNew, "));\n\t\t\tc=SSL_get_current_cipher(con);\n\t\t\tBIO_printf(io,"%s, Cipher is %s\\n",\n\t\t\t\tSSL_CIPHER_get_version(c),\n\t\t\t\tSSL_CIPHER_get_name(c));\n\t\t\tSSL_SESSION_print(io,SSL_get_session(con));\n\t\t\tBIO_printf(io,"---\\n");\n\t\t\tprint_stats(io,SSL_get_SSL_CTX(con));\n\t\t\tBIO_printf(io,"---\\n");\n\t\t\tpeer=SSL_get_peer_certificate(con);\n\t\t\tif (peer != NULL)\n\t\t\t\t{\n\t\t\t\tBIO_printf(io,"Client certificate\\n");\n\t\t\t\tX509_print(io,peer);\n\t\t\t\tPEM_write_bio_X509(io,peer);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tBIO_puts(io,"no client certificate available\\n");\n\t\t\tBIO_puts(io,"</BODY></HTML>\\r\\n\\r\\n");\n\t\t\tbreak;\n\t\t\t}\n\t\telse if ((www == 2 || www == 3)\n                         && (strncmp("GET /",buf,5) == 0))\n\t\t\t{\n\t\t\tBIO *file;\n\t\t\tchar *p,*e;\n\t\t\tstatic char *text="HTTP/1.0 200 ok\\r\\nContent-type: text/plain\\r\\n\\r\\n";\n\t\t\tp= &(buf[5]);\n\t\t\tdot = 1;\n\t\t\tfor (e=p; *e != \'\\0\'; e++)\n\t\t\t\t{\n\t\t\t\tif (e[0] == \' \')\n\t\t\t\t\tbreak;\n\t\t\t\tswitch (dot)\n\t\t\t\t\t{\n\t\t\t\tcase 1:\n\t\t\t\t\tdot = (e[0] == \'.\') ? 2 : 0;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tdot = (e[0] == \'.\') ? 3 : 0;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tdot = (e[0] == \'/\') ? -1 : 0;\n\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tif (dot == 0)\n\t\t\t\t\tdot = (e[0] == \'/\') ? 1 : 0;\n\t\t\t\t}\n\t\t\tdot = (dot == 3) || (dot == -1);\n\t\t\tif (*e == \'\\0\')\n\t\t\t\t{\n\t\t\t\tBIO_puts(io,text);\n\t\t\t\tBIO_printf(io,"\'%s\' is an invalid file name\\r\\n",p);\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t*e=\'\\0\';\n\t\t\tif (dot)\n\t\t\t\t{\n\t\t\t\tBIO_puts(io,text);\n\t\t\t\tBIO_printf(io,"\'%s\' contains \'..\' reference\\r\\n",p);\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif (*p == \'/\')\n\t\t\t\t{\n\t\t\t\tBIO_puts(io,text);\n\t\t\t\tBIO_printf(io,"\'%s\' is an invalid path\\r\\n",p);\n\t\t\t\tbreak;\n\t\t\t\t}\n#if 0\n\t\t\tif (e[-1] == \'/\')\n\t\t\t\tstrcat(p,"index.html");\n#endif\n\t\t\tif (stat(p,&st_buf) < 0)\n\t\t\t\t{\n\t\t\t\tBIO_puts(io,text);\n\t\t\t\tBIO_printf(io,"Error accessing \'%s\'\\r\\n",p);\n\t\t\t\tERR_print_errors(io);\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif (S_ISDIR(st_buf.st_mode))\n\t\t\t\t{\n#if 0\n\t\t\t\tstrcat(p,"/index.html");\n#else\n\t\t\t\tBIO_puts(io,text);\n\t\t\t\tBIO_printf(io,"\'%s\' is a directory\\r\\n",p);\n\t\t\t\tbreak;\n#endif\n\t\t\t\t}\n\t\t\tif ((file=BIO_new_file(p,"r")) == NULL)\n\t\t\t\t{\n\t\t\t\tBIO_puts(io,text);\n\t\t\t\tBIO_printf(io,"Error opening \'%s\'\\r\\n",p);\n\t\t\t\tERR_print_errors(io);\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif (!s_quiet)\n\t\t\t\tBIO_printf(bio_err,"FILE:%s\\n",p);\n                        if (www == 2)\n                                {\n                                i=strlen(p);\n                                if (\t((i > 5) && (strcmp(&(p[i-5]),".html") == 0)) ||\n                                        ((i > 4) && (strcmp(&(p[i-4]),".php") == 0)) ||\n                                        ((i > 4) && (strcmp(&(p[i-4]),".htm") == 0)))\n                                        BIO_puts(io,"HTTP/1.0 200 ok\\r\\nContent-type: text/html\\r\\n\\r\\n");\n                                else\n                                        BIO_puts(io,"HTTP/1.0 200 ok\\r\\nContent-type: text/plain\\r\\n\\r\\n");\n                                }\n\t\t\ttotal_bytes=0;\n\t\t\tfor (;;)\n\t\t\t\t{\n\t\t\t\ti=BIO_read(file,buf,bufsize);\n\t\t\t\tif (i <= 0) break;\n#ifdef RENEG\n\t\t\t\ttotal_bytes+=i;\n\t\t\t\tfprintf(stderr,"%d\\n",i);\n\t\t\t\tif (total_bytes > 3*1024)\n\t\t\t\t\t{\n\t\t\t\t\ttotal_bytes=0;\n\t\t\t\t\tfprintf(stderr,"RENEGOTIATE\\n");\n\t\t\t\t\tSSL_renegotiate(con);\n\t\t\t\t\t}\n#endif\n\t\t\t\tfor (j=0; j<i; )\n\t\t\t\t\t{\n#ifdef RENEG\n{ static count=0; if (++count == 13) { SSL_renegotiate(con); } }\n#endif\n\t\t\t\t\tk=BIO_write(io,&(buf[j]),i-j);\n\t\t\t\t\tif (k <= 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\tif (!BIO_should_retry(io))\n\t\t\t\t\t\t\tgoto write_error;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tBIO_printf(bio_s_out,"rwrite W BLOCK\\n");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\tj+=k;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\nwrite_error:\n\t\t\tBIO_free(file);\n\t\t\tbreak;\n\t\t\t}\n\t\t}\n\tfor (;;)\n\t\t{\n\t\ti=(int)BIO_flush(io);\n\t\tif (i <= 0)\n\t\t\t{\n\t\t\tif (!BIO_should_retry(io))\n\t\t\t\tbreak;\n\t\t\t}\n\t\telse\n\t\t\tbreak;\n\t\t}\nend:\n#if 1\n\tSSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);\n#else\n#endif\nerr:\n\tif (ret >= 0)\n\t\tBIO_printf(bio_s_out,"ACCEPT\\n");\n\tif (buf != NULL) OPENSSL_free(buf);\n\tif (io != NULL) BIO_free_all(io);\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\ts->options=ctx->options;\n\ts->mode=ctx->mode;\n\ts->max_cert_list=ctx->max_cert_list;\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->read_ahead=ctx->read_ahead;\n\ts->msg_callback=ctx->msg_callback;\n\ts->msg_callback_arg=ctx->msg_callback_arg;\n\ts->verify_mode=ctx->verify_mode;\n\ts->verify_depth=ctx->verify_depth;\n\ts->sid_ctx_length=ctx->sid_ctx_length;\n\tmemcpy(&s->sid_ctx,&ctx->sid_ctx,sizeof(s->sid_ctx));\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\ts->quiet_shutdown=ctx->quiet_shutdown;\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->references=1;\n\ts->server=(ctx->method->ssl_accept == ssl_undefined_function)?0:1;\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}', 'int SSL_clear(SSL *s)\n\t{\n\tint state;\n\tif (s->method == NULL)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_CLEAR,SSL_R_NO_METHOD_SPECIFIED);\n\t\treturn(0);\n\t\t}\n\ts->error=0;\n\ts->hit=0;\n\ts->shutdown=0;\n#if 0\n\tif (s->new_session) return(1);\n#else\n\tif (s->new_session)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_CLEAR,ERR_R_INTERNAL_ERROR);\n\t\treturn 0;\n\t\t}\n#endif\n\tstate=s->state;\n\ts->type=0;\n\ts->state=SSL_ST_BEFORE|((s->server)?SSL_ST_ACCEPT:SSL_ST_CONNECT);\n\ts->version=s->method->version;\n\ts->client_version=s->version;\n\ts->rwstate=SSL_NOTHING;\n\ts->rstate=SSL_ST_READ_HEADER;\n#if 0\n\ts->read_ahead=s->ctx->read_ahead;\n#endif\n\tif (s->init_buf != NULL)\n\t\t{\n\t\tBUF_MEM_free(s->init_buf);\n\t\ts->init_buf=NULL;\n\t\t}\n\tssl_clear_cipher_ctx(s);\n\tif (ssl_clear_bad_session(s))\n\t\t{\n\t\tSSL_SESSION_free(s->session);\n\t\ts->session=NULL;\n\t\t}\n\ts->first_packet=0;\n#if 1\n\tif ((s->session == NULL) && (s->method != s->ctx->method))\n\t\t{\n\t\ts->method->ssl_free(s);\n\t\ts->method=s->ctx->method;\n\t\tif (!s->method->ssl_new(s))\n\t\t\treturn(0);\n\t\t}\n\telse\n#endif\n\t\ts->method->ssl_clear(s);\n\treturn(1);\n\t}', 'int ssl_clear_bad_session(SSL *s)\n\t{\n\tif (\t(s->session != NULL) &&\n\t\t!(s->shutdown & SSL_SENT_SHUTDOWN) &&\n\t\t!(SSL_in_init(s) || SSL_in_before(s)))\n\t\t{\n\t\tSSL_CTX_remove_session(s->ctx,s->session);\n\t\treturn(1);\n\t\t}\n\telse\n\t\treturn(0);\n\t}', 'int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)\n{\n\treturn remove_session_lock(ctx, c, 1);\n}', 'static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)\n\t{\n\tSSL_SESSION *r;\n\tint ret=0;\n\tif ((c != NULL) && (c->session_id_length != 0))\n\t\t{\n\t\tif(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);\n\t\tr=(SSL_SESSION *)lh_delete(ctx->sessions,c);\n\t\tif (r != NULL)\n\t\t\t{\n\t\t\tret=1;\n\t\t\tSSL_SESSION_list_remove(ctx,c);\n\t\t\t}\n\t\tif(lck) CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);\n\t\tif (ret)\n\t\t\t{\n\t\t\tr->not_resumable=1;\n\t\t\tif (ctx->remove_session_cb != NULL)\n\t\t\t\tctx->remove_session_cb(ctx,r);\n\t\t\tSSL_SESSION_free(r);\n\t\t\t}\n\t\t}\n\telse\n\t\tret=0;\n\treturn(ret);\n\t}', 'void *lh_delete(LHASH *lh, const void *data)\n\t{\n\tunsigned long hash;\n\tLHASH_NODE *nn,**rn;\n\tconst void *ret;\n\tlh->error=0;\n\trn=getrn(lh,data,&hash);\n\tif (*rn == NULL)\n\t\t{\n\t\tlh->num_no_delete++;\n\t\treturn(NULL);\n\t\t}\n\telse\n\t\t{\n\t\tnn= *rn;\n\t\t*rn=nn->next;\n\t\tret=nn->data;\n\t\tOPENSSL_free(nn);\n\t\tlh->num_delete++;\n\t\t}\n\tlh->num_items--;\n\tif ((lh->num_nodes > MIN_NODES) &&\n\t\t(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))\n\t\tcontract(lh);\n\treturn((void *)ret);\n\t}']