ssl/ssltest.c:407: error: INTEGER_OVERFLOW_L1
  (0 - 1):unsigned64 by call to `SSL_new`.
Showing all 17 steps of the trace


ssl/ssltest.c:309:8: Call
307.   
308.   	c_ctx=SSL_CTX_new(meth);
309.   	s_ctx=SSL_CTX_new(meth);
              ^
310.   	if ((c_ctx == NULL) || (s_ctx == NULL))
311.   		{

ssl/ssl_lib.c:1041:16: Call
  1039.   	ret->client_cert_cb=NULL;
  1040.   
  1041.   	ret->sessions=lh_new(SSL_SESSION_hash,SSL_SESSION_cmp);
                         ^
  1042.   	if (ret->sessions == NULL) goto err;
  1043.   	ret->cert_store=X509_STORE_new();

crypto/lhash/lhash.c:136:2: Assignment
    134.   	ret->up_load=UP_LOAD;
    135.   	ret->down_load=DOWN_LOAD;
    136.   	ret->num_items=0;
            ^
    137.   
    138.   	ret->num_expands=0;

ssl/ssltest.c:407:8: Call
405.   	}
406.   
407.   	c_ssl=SSL_new(c_ctx);
              ^
408.   	s_ssl=SSL_new(s_ctx);
409.   

ssl/ssl_lib.c:162:1: Parameter `ctx->sessions->num_items`
  160.   	}
  161.   
  162. > SSL *SSL_new(SSL_CTX *ctx)
  163.   	{
  164.   	SSL *s;

ssl/ssl_lib.c:219:2: Call
  217.   	s->options=ctx->options;
  218.   	s->mode=ctx->mode;
  219.   	SSL_clear(s);
          ^
  220.   
  221.   	CRYPTO_new_ex_data(ssl_meth,(char *)s,&s->ex_data);

ssl/ssl_lib.c:82:1: Parameter `s->ctx->sessions->num_items`
    80.   	};
    81.   
    82. > int SSL_clear(SSL *s)
    83.   	{
    84.   	int state;

ssl/ssl_lib.c:121:6: Call
    119.   	ssl_clear_cipher_ctx(s);
    120.   
    121.   	if (ssl_clear_bad_session(s))
                ^
    122.   		{
    123.   		SSL_SESSION_free(s->session);

ssl/ssl_sess.c:582:1: Parameter `s->ctx->sessions->num_items`
      580.   	}
      581.   
      582. > int ssl_clear_bad_session(SSL *s)
      583.   	{
      584.   	if (	(s->session != NULL) &&

ssl/ssl_sess.c:588:3: Call
      586.   		!(SSL_in_init(s) || SSL_in_before(s)))
      587.   		{
      588.   		SSL_CTX_remove_session(s->ctx,s->session);
               ^
      589.   		return(1);
      590.   		}

ssl/ssl_sess.c:382:1: Parameter `ctx->sessions->num_items`
        380.   	}
        381.   
        382. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
        383.   {
        384.   	return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:384:9: Call
        382.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
        383.   {
        384.   	return remove_session_lock(ctx, c, 1);
                       ^
        385.   }
        386.   

ssl/ssl_sess.c:387:1: Parameter `ctx->sessions->num_items`
          385.   }
          386.   
          387. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
          388.   	{
          389.   	SSL_SESSION *r;

ssl/ssl_sess.c:395:20: Call
          393.   		{
          394.   		if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
          395.   		r=(SSL_SESSION *)lh_delete(ctx->sessions,(char *)c);
                                    ^
          396.   		if (r != NULL)
          397.   			{

crypto/lhash/lhash.c:220:1: <LHS trace>
218.   	}
219.   
220. > char *lh_delete(LHASH *lh, char *data)
221.   	{
222.   	unsigned long hash;

crypto/lhash/lhash.c:220:1: Parameter `lh->num_items`
            218.   	}
            219.   
            220. > char *lh_delete(LHASH *lh, char *data)
            221.   	{
            222.   	unsigned long hash;

crypto/lhash/lhash.c:243:2: Binary operation: (0 - 1):unsigned64 by call to `SSL_new` 
            241.   		}
            242.   
            243.   	lh->num_items--;
                    ^
            244.   	if ((lh->num_nodes > MIN_NODES) &&
            245.   		(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))

char *lh_delete(LHASH *lh, char *data)
	{
	unsigned long hash;
	LHASH_NODE *nn,**rn;
	char *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;
		Free((char *)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(ret);
	}
['int main(int argc, char *argv[])\n\t{\n\tchar *CApath=NULL,*CAfile=NULL;\n\tint badop=0;\n\tint bio_pair=0;\n\tint force=0;\n\tint tls1=0,ssl2=0,ssl3=0,ret=1;\n\tint client_auth=0;\n\tint server_auth=0,i;\n\tchar *server_cert=TEST_SERVER_CERT;\n\tchar *client_cert=TEST_CLIENT_CERT;\n\tSSL_CTX *s_ctx=NULL;\n\tSSL_CTX *c_ctx=NULL;\n\tSSL_METHOD *meth=NULL;\n\tSSL *c_ssl,*s_ssl;\n\tint number=1,reuse=0;\n\tlong bytes=1L;\n\tSSL_CIPHER *ciph;\n\tint dhe1024 = 0, no_dhe = 0;\n#ifndef NO_DH\n\tDH *dh;\n#endif\n\tverbose = 0;\n\tdebug = 0;\n\tcipher = 0;\n\tCRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);\n\tbio_err=BIO_new_fp(stderr,BIO_NOCLOSE);\n\tbio_stdout=BIO_new_fp(stdout,BIO_NOCLOSE);\n\targc--;\n\targv++;\n\twhile (argc >= 1)\n\t\t{\n\t\tif\t(strcmp(*argv,"-server_auth") == 0)\n\t\t\tserver_auth=1;\n\t\telse if\t(strcmp(*argv,"-client_auth") == 0)\n\t\t\tclient_auth=1;\n\t\telse if\t(strcmp(*argv,"-v") == 0)\n\t\t\tverbose=1;\n\t\telse if\t(strcmp(*argv,"-d") == 0)\n\t\t\tdebug=1;\n\t\telse if\t(strcmp(*argv,"-reuse") == 0)\n\t\t\treuse=1;\n\t\telse if\t(strcmp(*argv,"-dhe1024") == 0)\n\t\t\tdhe1024=1;\n\t\telse if\t(strcmp(*argv,"-no_dhe") == 0)\n\t\t\tno_dhe=1;\n\t\telse if\t(strcmp(*argv,"-ssl2") == 0)\n\t\t\tssl2=1;\n\t\telse if\t(strcmp(*argv,"-tls1") == 0)\n\t\t\ttls1=1;\n\t\telse if\t(strcmp(*argv,"-ssl3") == 0)\n\t\t\tssl3=1;\n\t\telse if\t(strncmp(*argv,"-num",4) == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tnumber= atoi(*(++argv));\n\t\t\tif (number == 0) number=1;\n\t\t\t}\n\t\telse if\t(strcmp(*argv,"-bytes") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tbytes= atol(*(++argv));\n\t\t\tif (bytes == 0L) bytes=1L;\n\t\t\ti=strlen(argv[0]);\n\t\t\tif (argv[0][i-1] == \'k\') bytes*=1024L;\n\t\t\tif (argv[0][i-1] == \'m\') bytes*=1024L*1024L;\n\t\t\t}\n\t\telse if\t(strcmp(*argv,"-cert") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tserver_cert= *(++argv);\n\t\t\t}\n\t\telse if\t(strcmp(*argv,"-s_cert") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tserver_cert= *(++argv);\n\t\t\t}\n\t\telse if\t(strcmp(*argv,"-c_cert") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tclient_cert= *(++argv);\n\t\t\t}\n\t\telse if\t(strcmp(*argv,"-cipher") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tcipher= *(++argv);\n\t\t\t}\n\t\telse if\t(strcmp(*argv,"-CApath") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tCApath= *(++argv);\n\t\t\t}\n\t\telse if\t(strcmp(*argv,"-CAfile") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tCAfile= *(++argv);\n\t\t\t}\n\t\telse if\t(strcmp(*argv,"-bio_pair") == 0)\n\t\t\t{\n\t\t\tbio_pair = 1;\n\t\t\t}\n\t\telse if\t(strcmp(*argv,"-f") == 0)\n\t\t\t{\n\t\t\tforce = 1;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tfprintf(stderr,"unknown option %s\\n",*argv);\n\t\t\tbadop=1;\n\t\t\tbreak;\n\t\t\t}\n\t\targc--;\n\t\targv++;\n\t\t}\n\tif (badop)\n\t\t{\nbad:\n\t\tsv_usage();\n\t\tgoto end;\n\t\t}\n\tif (!ssl2 && !ssl3 && !tls1 && number > 1 && !reuse && !force)\n\t\t{\n\t\tfprintf(stderr, "This case cannot work.  Use -f switch to perform "\n\t\t\t"the test anyway\\n"\n\t\t\t"(and -d to see what happens, "\n\t\t\t"and -bio_pair to really make it happen :-)\\n"\n\t\t\t"or add one of -ssl2, -ssl3, -tls1, -reuse to "\n\t\t\t"avoid protocol mismatch.\\n");\n\t\texit(1);\n\t\t}\n\tSSL_library_init();\n\tSSL_load_error_strings();\n#if !defined(NO_SSL2) && !defined(NO_SSL3)\n\tif (ssl2)\n\t\tmeth=SSLv2_method();\n\telse\n\tif (tls1)\n\t\tmeth=TLSv1_method();\n\telse\n\tif (ssl3)\n\t\tmeth=SSLv3_method();\n\telse\n\t\tmeth=SSLv23_method();\n#else\n#ifdef NO_SSL2\n\tmeth=SSLv3_method();\n#else\n\tmeth=SSLv2_method();\n#endif\n#endif\n\tc_ctx=SSL_CTX_new(meth);\n\ts_ctx=SSL_CTX_new(meth);\n\tif ((c_ctx == NULL) || (s_ctx == NULL))\n\t\t{\n\t\tERR_print_errors(bio_err);\n\t\tgoto end;\n\t\t}\n\tif (cipher != NULL)\n\t\t{\n\t\tSSL_CTX_set_cipher_list(c_ctx,cipher);\n\t\tSSL_CTX_set_cipher_list(s_ctx,cipher);\n\t\t}\n#ifndef NO_DH\n\tif (!no_dhe)\n\t\t{\n# ifndef NO_DSA\n\t\tif (dhe1024)\n\t\t\t{\n\t\t\tDSA *dsa;\n\t\t\tunsigned char seed[20];\n\t\t\tif (verbose)\n\t\t\t\t{\n\t\t\t\tfprintf(stdout, "Creating 1024 bit DHE parameters ...");\n\t\t\t\tfflush(stdout);\n\t\t\t\t}\n\t\t\tmemcpy(seed, "Random String no. 12", 20);\n\t\t\tdsa = DSA_generate_parameters(1024, seed, 20, NULL, NULL, 0, NULL);\n\t\t\tdh = DSA_dup_DH(dsa);\n\t\t\tDSA_free(dsa);\n\t\t\tSSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_DH_USE);\n\t\t\tif (verbose)\n\t\t\t\tfprintf(stdout, " done\\n");\n\t\t\t}\n\t\telse\n# endif\n\t\t\tdh=get_dh512();\n\t\tSSL_CTX_set_tmp_dh(s_ctx,dh);\n\t\tDH_free(dh);\n\t\t}\n#endif\n#ifndef NO_RSA\n\tSSL_CTX_set_tmp_rsa_callback(s_ctx,tmp_rsa_cb);\n#endif\n\tif (!SSL_CTX_use_certificate_file(s_ctx,server_cert,SSL_FILETYPE_PEM))\n\t\t{\n\t\tERR_print_errors(bio_err);\n\t\t}\n\telse if (!SSL_CTX_use_PrivateKey_file(s_ctx,server_cert,\n\t\tSSL_FILETYPE_PEM))\n\t\t{\n\t\tERR_print_errors(bio_err);\n\t\tgoto end;\n\t\t}\n\tif (client_auth)\n\t\t{\n\t\tSSL_CTX_use_certificate_file(c_ctx,client_cert,\n\t\t\tSSL_FILETYPE_PEM);\n\t\tSSL_CTX_use_PrivateKey_file(c_ctx,client_cert,\n\t\t\tSSL_FILETYPE_PEM);\n\t\t}\n\tif (\t(!SSL_CTX_load_verify_locations(s_ctx,CAfile,CApath)) ||\n\t\t(!SSL_CTX_set_default_verify_paths(s_ctx)) ||\n\t\t(!SSL_CTX_load_verify_locations(c_ctx,CAfile,CApath)) ||\n\t\t(!SSL_CTX_set_default_verify_paths(c_ctx)))\n\t\t{\n\t\tERR_print_errors(bio_err);\n\t\t}\n\tif (client_auth)\n\t\t{\n\t\tfprintf(stderr,"client authentication\\n");\n\t\tSSL_CTX_set_verify(s_ctx,\n\t\t\tSSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT,\n\t\t\tverify_callback);\n\t\t}\n\tif (server_auth)\n\t\t{\n\t\tfprintf(stderr,"server authentication\\n");\n\t\tSSL_CTX_set_verify(c_ctx,SSL_VERIFY_PEER,\n\t\t\tverify_callback);\n\t\t}\n\t{\n\t\tint session_id_context = 0;\n\t\tSSL_CTX_set_session_id_context(s_ctx, (void *)&session_id_context, sizeof session_id_context);\n\t}\n\tc_ssl=SSL_new(c_ctx);\n\ts_ssl=SSL_new(s_ctx);\n\tfor (i=0; i<number; i++)\n\t\t{\n\t\tif (!reuse) SSL_set_session(c_ssl,NULL);\n\t\tif (bio_pair)\n\t\t\tret=doit_biopair(s_ssl,c_ssl,bytes);\n\t\telse\n\t\t\tret=doit(s_ssl,c_ssl,bytes);\n\t\t}\n\tif (!verbose)\n\t\t{\n\t\tciph=SSL_get_current_cipher(c_ssl);\n\t\tfprintf(stdout,"Protocol %s, cipher %s, %s\\n",\n\t\t\tSSL_get_version(c_ssl),\n\t\t\tSSL_CIPHER_get_version(ciph),\n\t\t\tSSL_CIPHER_get_name(ciph));\n\t\t}\n\tif ((number > 1) || (bytes > 1L))\n\t\tprintf("%d handshakes of %ld bytes done\\n",number,bytes);\n\tSSL_free(s_ssl);\n\tSSL_free(c_ssl);\nend:\n\tif (s_ctx != NULL) SSL_CTX_free(s_ctx);\n\tif (c_ctx != NULL) SSL_CTX_free(c_ctx);\n\tif (bio_stdout != NULL) BIO_free(bio_stdout);\n\tERR_free_strings();\n\tERR_remove_state(0);\n\tEVP_cleanup();\n\tCRYPTO_mem_leaks(bio_err);\n\tif (bio_err != NULL) BIO_free(bio_err);\n\tEXIT(ret);\n\t}', 'SSL_CTX *SSL_CTX_new(SSL_METHOD *meth)\n\t{\n\tSSL_CTX *ret=NULL;\n\tif (meth == NULL)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_CTX_NEW,SSL_R_NULL_SSL_METHOD_PASSED);\n\t\treturn(NULL);\n\t\t}\n\tif (SSL_get_ex_data_X509_STORE_CTX_idx() < 0)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_CTX_NEW,SSL_R_X509_VERIFICATION_SETUP_PROBLEMS);\n\t\tgoto err;\n\t\t}\n\tret=(SSL_CTX *)Malloc(sizeof(SSL_CTX));\n\tif (ret == NULL)\n\t\tgoto err;\n\tmemset(ret,0,sizeof(SSL_CTX));\n\tret->method=meth;\n\tret->cert_store=NULL;\n\tret->session_cache_mode=SSL_SESS_CACHE_SERVER;\n\tret->session_cache_size=SSL_SESSION_CACHE_MAX_SIZE_DEFAULT;\n\tret->session_cache_head=NULL;\n\tret->session_cache_tail=NULL;\n\tret->session_timeout=meth->get_timeout();\n\tret->new_session_cb=NULL;\n\tret->remove_session_cb=NULL;\n\tret->get_session_cb=NULL;\n\tmemset((char *)&ret->stats,0,sizeof(ret->stats));\n\tret->references=1;\n\tret->quiet_shutdown=0;\n\tret->info_callback=NULL;\n\tret->app_verify_callback=NULL;\n\tret->app_verify_arg=NULL;\n\tret->read_ahead=0;\n\tret->verify_mode=SSL_VERIFY_NONE;\n\tret->verify_depth=-1;\n\tret->default_verify_callback=NULL;\n\tif ((ret->cert=ssl_cert_new()) == NULL)\n\t\tgoto err;\n\tret->default_passwd_callback=NULL;\n\tret->default_passwd_callback_userdata=NULL;\n\tret->client_cert_cb=NULL;\n\tret->sessions=lh_new(SSL_SESSION_hash,SSL_SESSION_cmp);\n\tif (ret->sessions == NULL) goto err;\n\tret->cert_store=X509_STORE_new();\n\tif (ret->cert_store == NULL) goto err;\n\tssl_create_cipher_list(ret->method,\n\t\t&ret->cipher_list,&ret->cipher_list_by_id,\n\t\tSSL_DEFAULT_CIPHER_LIST);\n\tif (ret->cipher_list == NULL\n\t    || sk_SSL_CIPHER_num(ret->cipher_list) <= 0)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_CTX_NEW,SSL_R_LIBRARY_HAS_NO_CIPHERS);\n\t\tgoto err2;\n\t\t}\n\tif ((ret->rsa_md5=EVP_get_digestbyname("ssl2-md5")) == NULL)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_CTX_NEW,SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES);\n\t\tgoto err2;\n\t\t}\n\tif ((ret->md5=EVP_get_digestbyname("ssl3-md5")) == NULL)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_CTX_NEW,SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES);\n\t\tgoto err2;\n\t\t}\n\tif ((ret->sha1=EVP_get_digestbyname("ssl3-sha1")) == NULL)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_CTX_NEW,SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES);\n\t\tgoto err2;\n\t\t}\n\tif ((ret->client_CA=sk_X509_NAME_new_null()) == NULL)\n\t\tgoto err;\n\tCRYPTO_new_ex_data(ssl_ctx_meth,(char *)ret,&ret->ex_data);\n\tret->extra_certs=NULL;\n\tret->comp_methods=SSL_COMP_get_compression_methods();\n\treturn(ret);\nerr:\n\tSSLerr(SSL_F_SSL_CTX_NEW,ERR_R_MALLOC_FAILURE);\nerr2:\n\tif (ret != NULL) SSL_CTX_free(ret);\n\treturn(NULL);\n\t}', 'LHASH *lh_new(unsigned long (*h)(), int (*c)())\n\t{\n\tLHASH *ret;\n\tint i;\n\tif ((ret=(LHASH *)Malloc(sizeof(LHASH))) == NULL)\n\t\tgoto err0;\n\tif ((ret->b=(LHASH_NODE **)Malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL)\n\t\tgoto err1;\n\tfor (i=0; i<MIN_NODES; i++)\n\t\tret->b[i]=NULL;\n\tret->comp=((c == NULL)?(int (*)())strcmp:c);\n\tret->hash=((h == NULL)?(unsigned long (*)())lh_strhash:h);\n\tret->num_nodes=MIN_NODES/2;\n\tret->num_alloc_nodes=MIN_NODES;\n\tret->p=0;\n\tret->pmax=MIN_NODES/2;\n\tret->up_load=UP_LOAD;\n\tret->down_load=DOWN_LOAD;\n\tret->num_items=0;\n\tret->num_expands=0;\n\tret->num_expand_reallocs=0;\n\tret->num_contracts=0;\n\tret->num_contract_reallocs=0;\n\tret->num_hash_calls=0;\n\tret->num_comp_calls=0;\n\tret->num_insert=0;\n\tret->num_replace=0;\n\tret->num_delete=0;\n\tret->num_no_delete=0;\n\tret->num_retrieve=0;\n\tret->num_retrieve_miss=0;\n\tret->num_hash_comps=0;\n\tret->error=0;\n\treturn(ret);\nerr1:\n\tFree((char *)ret);\nerr0:\n\treturn(NULL);\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 *)Malloc(sizeof(SSL));\n\tif (s == NULL) goto err;\n\tmemset(s,0,sizeof(SSL));\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\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\tSSL_clear(s);\n\tCRYPTO_new_ex_data(ssl_meth,(char *)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\tFree(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#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\ts->read_ahead=s->ctx->read_ahead;\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,(char *)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}', 'char *lh_delete(LHASH *lh, char *data)\n\t{\n\tunsigned long hash;\n\tLHASH_NODE *nn,**rn;\n\tchar *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\tFree((char *)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(ret);\n\t}']