apps/s_server.c:3062: error: BUFFER_OVERRUN_L3
  Offset: [-529, +oo] Size: 12 by call to `X509_print`.
Showing all 40 steps of the trace


apps/s_server.c:3056:4: Call
3054.   			SSL_SESSION_print(io,SSL_get_session(con));
3055.   			BIO_printf(io,"---\n");
3056.   			print_stats(io,SSL_get_SSL_CTX(con));
           ^
3057.   			BIO_printf(io,"---\n");
3058.   			peer=SSL_get_peer_certificate(con);

apps/s_server.c:2172:3: Call
  2170.   	{
  2171.   	BIO_printf(bio,"%4ld items in the session cache\n",
  2172.   		SSL_CTX_sess_number(ssl_ctx));
            ^
  2173.   	BIO_printf(bio,"%4ld client connects (SSL_connect())\n",
  2174.   		SSL_CTX_sess_connect(ssl_ctx));

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2174:3: Call
  2172.   		SSL_CTX_sess_number(ssl_ctx));
  2173.   	BIO_printf(bio,"%4ld client connects (SSL_connect())\n",
  2174.   		SSL_CTX_sess_connect(ssl_ctx));
            ^
  2175.   	BIO_printf(bio,"%4ld client renegotiates (SSL_connect())\n",
  2176.   		SSL_CTX_sess_connect_renegotiate(ssl_ctx));

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2176:3: Call
  2174.   		SSL_CTX_sess_connect(ssl_ctx));
  2175.   	BIO_printf(bio,"%4ld client renegotiates (SSL_connect())\n",
  2176.   		SSL_CTX_sess_connect_renegotiate(ssl_ctx));
            ^
  2177.   	BIO_printf(bio,"%4ld client connects that finished\n",
  2178.   		SSL_CTX_sess_connect_good(ssl_ctx));

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2178:3: Call
  2176.   		SSL_CTX_sess_connect_renegotiate(ssl_ctx));
  2177.   	BIO_printf(bio,"%4ld client connects that finished\n",
  2178.   		SSL_CTX_sess_connect_good(ssl_ctx));
            ^
  2179.   	BIO_printf(bio,"%4ld server accepts (SSL_accept())\n",
  2180.   		SSL_CTX_sess_accept(ssl_ctx));

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2180:3: Call
  2178.   		SSL_CTX_sess_connect_good(ssl_ctx));
  2179.   	BIO_printf(bio,"%4ld server accepts (SSL_accept())\n",
  2180.   		SSL_CTX_sess_accept(ssl_ctx));
            ^
  2181.   	BIO_printf(bio,"%4ld server renegotiates (SSL_accept())\n",
  2182.   		SSL_CTX_sess_accept_renegotiate(ssl_ctx));

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2182:3: Call
  2180.   		SSL_CTX_sess_accept(ssl_ctx));
  2181.   	BIO_printf(bio,"%4ld server renegotiates (SSL_accept())\n",
  2182.   		SSL_CTX_sess_accept_renegotiate(ssl_ctx));
            ^
  2183.   	BIO_printf(bio,"%4ld server accepts that finished\n",
  2184.   		SSL_CTX_sess_accept_good(ssl_ctx));

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2184:3: Call
  2182.   		SSL_CTX_sess_accept_renegotiate(ssl_ctx));
  2183.   	BIO_printf(bio,"%4ld server accepts that finished\n",
  2184.   		SSL_CTX_sess_accept_good(ssl_ctx));
            ^
  2185.   	BIO_printf(bio,"%4ld session cache hits\n",SSL_CTX_sess_hits(ssl_ctx));
  2186.   	BIO_printf(bio,"%4ld session cache misses\n",SSL_CTX_sess_misses(ssl_ctx));

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2185:45: Call
  2183.   	BIO_printf(bio,"%4ld server accepts that finished\n",
  2184.   		SSL_CTX_sess_accept_good(ssl_ctx));
  2185.   	BIO_printf(bio,"%4ld session cache hits\n",SSL_CTX_sess_hits(ssl_ctx));
                                                      ^
  2186.   	BIO_printf(bio,"%4ld session cache misses\n",SSL_CTX_sess_misses(ssl_ctx));
  2187.   	BIO_printf(bio,"%4ld session cache timeouts\n",SSL_CTX_sess_timeouts(ssl_ctx));

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2186:47: Call
  2184.   		SSL_CTX_sess_accept_good(ssl_ctx));
  2185.   	BIO_printf(bio,"%4ld session cache hits\n",SSL_CTX_sess_hits(ssl_ctx));
  2186.   	BIO_printf(bio,"%4ld session cache misses\n",SSL_CTX_sess_misses(ssl_ctx));
                                                        ^
  2187.   	BIO_printf(bio,"%4ld session cache timeouts\n",SSL_CTX_sess_timeouts(ssl_ctx));
  2188.   	BIO_printf(bio,"%4ld callback cache hits\n",SSL_CTX_sess_cb_hits(ssl_ctx));

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2187:49: Call
  2185.   	BIO_printf(bio,"%4ld session cache hits\n",SSL_CTX_sess_hits(ssl_ctx));
  2186.   	BIO_printf(bio,"%4ld session cache misses\n",SSL_CTX_sess_misses(ssl_ctx));
  2187.   	BIO_printf(bio,"%4ld session cache timeouts\n",SSL_CTX_sess_timeouts(ssl_ctx));
                                                          ^
  2188.   	BIO_printf(bio,"%4ld callback cache hits\n",SSL_CTX_sess_cb_hits(ssl_ctx));
  2189.   	BIO_printf(bio,"%4ld cache full overflows (%ld allowed)\n",

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2188:46: Call
  2186.   	BIO_printf(bio,"%4ld session cache misses\n",SSL_CTX_sess_misses(ssl_ctx));
  2187.   	BIO_printf(bio,"%4ld session cache timeouts\n",SSL_CTX_sess_timeouts(ssl_ctx));
  2188.   	BIO_printf(bio,"%4ld callback cache hits\n",SSL_CTX_sess_cb_hits(ssl_ctx));
                                                       ^
  2189.   	BIO_printf(bio,"%4ld cache full overflows (%ld allowed)\n",
  2190.   		SSL_CTX_sess_cache_full(ssl_ctx),

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2190:3: Call
  2188.   	BIO_printf(bio,"%4ld callback cache hits\n",SSL_CTX_sess_cb_hits(ssl_ctx));
  2189.   	BIO_printf(bio,"%4ld cache full overflows (%ld allowed)\n",
  2190.   		SSL_CTX_sess_cache_full(ssl_ctx),
            ^
  2191.   		SSL_CTX_sess_get_cache_size(ssl_ctx));
  2192.   	}

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:2191:3: Call
  2189.   	BIO_printf(bio,"%4ld cache full overflows (%ld allowed)\n",
  2190.   		SSL_CTX_sess_cache_full(ssl_ctx),
  2191.   		SSL_CTX_sess_get_cache_size(ssl_ctx));
            ^
  2192.   	}
  2193.   

ssl/ssl_lib.c:1169:1: Parameter `*parg`
    1167.   	}
    1168.   
    1169. > long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
    1170.   	{
    1171.   	long l;

apps/s_server.c:3062:5: Call
3060.   				{
3061.   				BIO_printf(io,"Client certificate\n");
3062.   				X509_print(io,peer);
            ^
3063.   				PEM_write_bio_X509(io,peer);
3064.   				}

crypto/asn1/t_x509.c:100:1: Parameter `*x->cert_info->validity->notAfter->data`
  98.   #endif
  99.   
  100. > int X509_print(BIO *bp, X509 *x)
  101.   {
  102.   	return X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);

crypto/asn1/t_x509.c:102:9: Call
  100.   int X509_print(BIO *bp, X509 *x)
  101.   {
  102.   	return X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
                 ^
  103.   }
  104.   

crypto/asn1/t_x509.c:105:1: Parameter `*x->cert_info->validity->notAfter->data`
    103.   }
    104.   
    105. > int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
    106.   	{
    107.   	long l;

crypto/asn1/t_x509.c:195:8: Call
    193.   		if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err;
    194.   		if (BIO_write(bp,"\n            Not After : ",25) <= 0) goto err;
    195.   		if (!ASN1_TIME_print(bp,X509_get_notAfter(x))) goto err;
                  ^
    196.   		if (BIO_write(bp,"\n",1) <= 0) goto err;
    197.   		}

crypto/asn1/t_x509.c:389:1: Parameter `*tm->data`
      387.   	}
      388.   
      389. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)
      390.   {
      391.   	if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm);

crypto/asn1/t_x509.c:393:12: Call
      391.   	if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm);
      392.   	if(tm->type == V_ASN1_GENERALIZEDTIME)
      393.   				return ASN1_GENERALIZEDTIME_print(bp, tm);
                        ^
      394.   	BIO_write(bp,"Bad time value",14);
      395.   	return(0);

crypto/asn1/t_x509.c:404:1: <Offset trace>
402.       };
403.   
404. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
405.   	{
406.   	char *v;

crypto/asn1/t_x509.c:404:1: Parameter `*tm->data`
        402.       };
        403.   
        404. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
        405.   	{
        406.   	char *v;

crypto/asn1/t_x509.c:421:2: Assignment
        419.   		if ((v[i] > '9') || (v[i] < '0')) goto err;
        420.   	y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0');
        421.   	M= (v[4]-'0')*10+(v[5]-'0');
                ^
        422.   	if ((M > 12) || (M < 1)) goto err;
        423.   	d= (v[6]-'0')*10+(v[7]-'0');

crypto/asn1/t_x509.c:398:1: <Length trace>
396.   }
397.   
398. > static const char *mon[12]=
399.       {
400.       "Jan","Feb","Mar","Apr","May","Jun",

crypto/asn1/t_x509.c:398:1: Array declaration
        396.   }
        397.   
        398. > static const char *mon[12]=
        399.       {
        400.       "Jan","Feb","Mar","Apr","May","Jun",

crypto/asn1/t_x509.c:443:3: Array access: Offset: [-529, +oo] Size: 12 by call to `X509_print` 
        441.   
        442.   	if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s",
        443.   		mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0)
                 ^
        444.   		return(0);
        445.   	else

int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
	{
	char *v;
	int gmt=0;
	int i;
	int y=0,M=0,d=0,h=0,m=0,s=0;
	char *f = NULL;
	int f_len = 0;
	i=tm->length;
	v=(char *)tm->data;
	if (i < 12) goto err;
	if (v[i-1] == 'Z') gmt=1;
	for (i=0; i<12; i++)
		if ((v[i] > '9') || (v[i] < '0')) goto err;
	y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0');
	M= (v[4]-'0')*10+(v[5]-'0');
	if ((M > 12) || (M < 1)) goto err;
	d= (v[6]-'0')*10+(v[7]-'0');
	h= (v[8]-'0')*10+(v[9]-'0');
	m=  (v[10]-'0')*10+(v[11]-'0');
	if (tm->length >= 14 &&
	    (v[12] >= '0') && (v[12] <= '9') &&
	    (v[13] >= '0') && (v[13] <= '9'))
		{
		s=  (v[12]-'0')*10+(v[13]-'0');
		if (tm->length >= 15 && v[14] == '.')
			{
			int l = tm->length;
			f = &v[14];
			f_len = 1;
			while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9')
				++f_len;
			}
		}
	if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s",
		mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0)
		return(0);
	else
		return(1);
err:
	BIO_write(bp,"Bad time value",14);
	return(0);
	}
['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,dot;\n\tSSL *con;\n\tconst SSL_CIPHER *c;\n\tBIO *io,*ssl_bio,*sbio;\n#ifndef OPENSSL_NO_KRB5\n\tKSSL_CTX *kctx;\n#endif\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_TLSEXT\n\t\tif (s_tlsextdebug)\n\t\t\t{\n\t\t\tSSL_set_tlsext_debug_callback(con, tlsext_cb);\n\t\t\tSSL_set_tlsext_debug_arg(con, bio_s_out);\n\t\t\t}\n#endif\n#ifndef OPENSSL_NO_KRB5\n\tif ((kctx = kssl_ctx_new()) != NULL)\n\t\t{\n\t\tkssl_ctx_setstring(kctx, KSSL_SERVICE, KRB5SVC);\n\t\tkssl_ctx_setstring(kctx, 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\tSSL_set_debug(con, 1);\n\t\tBIO_set_callback(SSL_get_rbio(con),bio_dump_callback);\n\t\tBIO_set_callback_arg(SSL_get_rbio(con),(char *)bio_s_out);\n\t\t}\n\tif (s_msg)\n\t\t{\n#ifndef OPENSSL_NO_SSL_TRACE\n\t\tif (s_msg == 2)\n\t\t\tSSL_set_msg_callback(con, SSL_trace);\n\t\telse\n#endif\n\t\t\tSSL_set_msg_callback(con, msg_cb);\n\t\tSSL_set_msg_callback_arg(con, bio_s_msg ? bio_s_msg : bio_s_out);\n\t\t}\n\tfor (;;)\n\t\t{\n\t\tif (hack)\n\t\t\t{\n\t\t\ti=SSL_accept(con);\n#ifndef OPENSSL_NO_SRP\n\t\t\twhile (i <= 0 &&  SSL_get_error(con,i) == SSL_ERROR_WANT_X509_LOOKUP)\n\t\t{\n\t\t\tBIO_printf(bio_s_out,"LOOKUP during accept %s\\n",srp_callback_parm.login);\n\t\t\tsrp_callback_parm.user = SRP_VBASE_get_by_user(srp_callback_parm.vb, srp_callback_parm.login);\n\t\t\tif (srp_callback_parm.user)\n\t\t\t\tBIO_printf(bio_s_out,"LOOKUP done %s\\n",srp_callback_parm.user->info);\n\t\t\telse\n\t\t\t\tBIO_printf(bio_s_out,"LOOKUP not successful\\n");\n\t\t\ti=SSL_accept(con);\n\t\t}\n#endif\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#if defined(OPENSSL_SYS_NETWARE)\n            delay(1000);\n#elif !defined(OPENSSL_SYS_MSDOS) && !defined(__DJGPP__)\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 const char *space="                          ";\n\t\tif (www == 1 && strncmp("GET /reneg", buf, 10) == 0)\n\t\t\t{\n\t\t\tif (strncmp("GET /renegcert", buf, 14) == 0)\n\t\t\t\tSSL_set_verify(con,\n\t\t\t\tSSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,NULL);\n\t\t\ti=SSL_renegotiate(con);\n\t\t\tBIO_printf(bio_s_out, "SSL_renegotiate -> %d\\n",i);\n\t\t\ti=SSL_do_handshake(con);\n\t\t\tif (i <= 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_s_out, "SSL_do_handshake() Retval %d\\n", SSL_get_error(con, i));\n\t\t\t\tERR_print_errors(bio_err);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tSSL_set_state(con, SSL_ST_ACCEPT);\n\t\t\ti=SSL_do_handshake(con);\n\t\t\tBIO_printf(bio_s_out, "SSL_do_handshake -> %d\\n",i);\n\t\t\tif (i <= 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_s_out, "SSL_do_handshake() Retval %d\\n", SSL_get_error(con, i));\n\t\t\t\tERR_print_errors(bio_err);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t}\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,\n\t\t\t\t"Secure Renegotiation IS%s supported\\n",\n\t\t      \t\tSSL_get_secure_renegotiation_support(con) ?\n\t\t\t\t\t\t\t"" : " NOT");\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\tssl_print_sigalgs(io, con);\n\t\t\tssl_print_curves(io, con, 0);\n\t\t\tBIO_printf(io,(SSL_cache_hit(con)\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 const 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 (app_isdir(p)>0)\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\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}', 'static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)\n\t{\n\tBIO_printf(bio,"%4ld items in the session cache\\n",\n\t\tSSL_CTX_sess_number(ssl_ctx));\n\tBIO_printf(bio,"%4ld client connects (SSL_connect())\\n",\n\t\tSSL_CTX_sess_connect(ssl_ctx));\n\tBIO_printf(bio,"%4ld client renegotiates (SSL_connect())\\n",\n\t\tSSL_CTX_sess_connect_renegotiate(ssl_ctx));\n\tBIO_printf(bio,"%4ld client connects that finished\\n",\n\t\tSSL_CTX_sess_connect_good(ssl_ctx));\n\tBIO_printf(bio,"%4ld server accepts (SSL_accept())\\n",\n\t\tSSL_CTX_sess_accept(ssl_ctx));\n\tBIO_printf(bio,"%4ld server renegotiates (SSL_accept())\\n",\n\t\tSSL_CTX_sess_accept_renegotiate(ssl_ctx));\n\tBIO_printf(bio,"%4ld server accepts that finished\\n",\n\t\tSSL_CTX_sess_accept_good(ssl_ctx));\n\tBIO_printf(bio,"%4ld session cache hits\\n",SSL_CTX_sess_hits(ssl_ctx));\n\tBIO_printf(bio,"%4ld session cache misses\\n",SSL_CTX_sess_misses(ssl_ctx));\n\tBIO_printf(bio,"%4ld session cache timeouts\\n",SSL_CTX_sess_timeouts(ssl_ctx));\n\tBIO_printf(bio,"%4ld callback cache hits\\n",SSL_CTX_sess_cb_hits(ssl_ctx));\n\tBIO_printf(bio,"%4ld cache full overflows (%ld allowed)\\n",\n\t\tSSL_CTX_sess_cache_full(ssl_ctx),\n\t\tSSL_CTX_sess_get_cache_size(ssl_ctx));\n\t}', 'long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)\n\t{\n\tlong l;\n\tif (ctx == NULL)\n\t\t{\n\t\tswitch (cmd)\n\t\t\t{\n\t\tcase SSL_CTRL_SET_CURVES_LIST:\n\t\t\treturn tls1_set_curves_list(NULL, NULL, parg);\n\t\tcase SSL_CTRL_SET_SIGALGS_LIST:\n\t\tcase SSL_CTRL_SET_CLIENT_SIGALGS_LIST:\n\t\t\treturn tls1_set_sigalgs_list(NULL, parg, 0);\n\t\tdefault:\n\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\tswitch (cmd)\n\t\t{\n\tcase SSL_CTRL_GET_READ_AHEAD:\n\t\treturn(ctx->read_ahead);\n\tcase SSL_CTRL_SET_READ_AHEAD:\n\t\tl=ctx->read_ahead;\n\t\tctx->read_ahead=larg;\n\t\treturn(l);\n\tcase SSL_CTRL_SET_MSG_CALLBACK_ARG:\n\t\tctx->msg_callback_arg = parg;\n\t\treturn 1;\n\tcase SSL_CTRL_GET_MAX_CERT_LIST:\n\t\treturn(ctx->max_cert_list);\n\tcase SSL_CTRL_SET_MAX_CERT_LIST:\n\t\tl=ctx->max_cert_list;\n\t\tctx->max_cert_list=larg;\n\t\treturn(l);\n\tcase SSL_CTRL_SET_SESS_CACHE_SIZE:\n\t\tl=ctx->session_cache_size;\n\t\tctx->session_cache_size=larg;\n\t\treturn(l);\n\tcase SSL_CTRL_GET_SESS_CACHE_SIZE:\n\t\treturn(ctx->session_cache_size);\n\tcase SSL_CTRL_SET_SESS_CACHE_MODE:\n\t\tl=ctx->session_cache_mode;\n\t\tctx->session_cache_mode=larg;\n\t\treturn(l);\n\tcase SSL_CTRL_GET_SESS_CACHE_MODE:\n\t\treturn(ctx->session_cache_mode);\n\tcase SSL_CTRL_SESS_NUMBER:\n\t\treturn(lh_SSL_SESSION_num_items(ctx->sessions));\n\tcase SSL_CTRL_SESS_CONNECT:\n\t\treturn(ctx->stats.sess_connect);\n\tcase SSL_CTRL_SESS_CONNECT_GOOD:\n\t\treturn(ctx->stats.sess_connect_good);\n\tcase SSL_CTRL_SESS_CONNECT_RENEGOTIATE:\n\t\treturn(ctx->stats.sess_connect_renegotiate);\n\tcase SSL_CTRL_SESS_ACCEPT:\n\t\treturn(ctx->stats.sess_accept);\n\tcase SSL_CTRL_SESS_ACCEPT_GOOD:\n\t\treturn(ctx->stats.sess_accept_good);\n\tcase SSL_CTRL_SESS_ACCEPT_RENEGOTIATE:\n\t\treturn(ctx->stats.sess_accept_renegotiate);\n\tcase SSL_CTRL_SESS_HIT:\n\t\treturn(ctx->stats.sess_hit);\n\tcase SSL_CTRL_SESS_CB_HIT:\n\t\treturn(ctx->stats.sess_cb_hit);\n\tcase SSL_CTRL_SESS_MISSES:\n\t\treturn(ctx->stats.sess_miss);\n\tcase SSL_CTRL_SESS_TIMEOUTS:\n\t\treturn(ctx->stats.sess_timeout);\n\tcase SSL_CTRL_SESS_CACHE_FULL:\n\t\treturn(ctx->stats.sess_cache_full);\n\tcase SSL_CTRL_OPTIONS:\n\t\treturn(ctx->options|=larg);\n\tcase SSL_CTRL_CLEAR_OPTIONS:\n\t\treturn(ctx->options&=~larg);\n\tcase SSL_CTRL_MODE:\n\t\treturn(ctx->mode|=larg);\n\tcase SSL_CTRL_CLEAR_MODE:\n\t\treturn(ctx->mode&=~larg);\n\tcase SSL_CTRL_SET_MAX_SEND_FRAGMENT:\n\t\tif (larg < 512 || larg > SSL3_RT_MAX_PLAIN_LENGTH)\n\t\t\treturn 0;\n\t\tctx->max_send_fragment = larg;\n\t\treturn 1;\n\tcase SSL_CTRL_CERT_FLAGS:\n\t\treturn(ctx->cert->cert_flags|=larg);\n\tcase SSL_CTRL_CLEAR_CERT_FLAGS:\n\t\treturn(ctx->cert->cert_flags &=~larg);\n\tdefault:\n\t\treturn(ctx->method->ssl_ctx_ctrl(ctx,cmd,larg,parg));\n\t\t}\n\t}', 'int X509_print(BIO *bp, X509 *x)\n{\n\treturn X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);\n}', 'int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)\n\t{\n\tlong l;\n\tint ret=0,i;\n\tchar *m=NULL,mlch = \' \';\n\tint nmindent = 0;\n\tX509_CINF *ci;\n\tASN1_INTEGER *bs;\n\tEVP_PKEY *pkey=NULL;\n\tconst char *neg;\n\tif((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {\n\t\t\tmlch = \'\\n\';\n\t\t\tnmindent = 12;\n\t}\n\tif(nmflags == X509_FLAG_COMPAT)\n\t\tnmindent = 16;\n\tci=x->cert_info;\n\tif(!(cflag & X509_FLAG_NO_HEADER))\n\t\t{\n\t\tif (BIO_write(bp,"Certificate:\\n",13) <= 0) goto err;\n\t\tif (BIO_write(bp,"    Data:\\n",10) <= 0) goto err;\n\t\t}\n\tif(!(cflag & X509_FLAG_NO_VERSION))\n\t\t{\n\t\tl=X509_get_version(x);\n\t\tif (BIO_printf(bp,"%8sVersion: %lu (0x%lx)\\n","",l+1,l) <= 0) goto err;\n\t\t}\n\tif(!(cflag & X509_FLAG_NO_SERIAL))\n\t\t{\n\t\tif (BIO_write(bp,"        Serial Number:",22) <= 0) goto err;\n\t\tbs=X509_get_serialNumber(x);\n\t\tif (bs->length <= (int)sizeof(long))\n\t\t\t{\n\t\t\tl=ASN1_INTEGER_get(bs);\n\t\t\tif (bs->type == V_ASN1_NEG_INTEGER)\n\t\t\t\t{\n\t\t\t\tl= -l;\n\t\t\t\tneg="-";\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tneg="";\n\t\t\tif (BIO_printf(bp," %s%lu (%s0x%lx)\\n",neg,l,neg,l) <= 0)\n\t\t\t\tgoto err;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tneg=(bs->type == V_ASN1_NEG_INTEGER)?" (Negative)":"";\n\t\t\tif (BIO_printf(bp,"\\n%12s%s","",neg) <= 0) goto err;\n\t\t\tfor (i=0; i<bs->length; i++)\n\t\t\t\t{\n\t\t\t\tif (BIO_printf(bp,"%02x%c",bs->data[i],\n\t\t\t\t\t((i+1 == bs->length)?\'\\n\':\':\')) <= 0)\n\t\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tif(!(cflag & X509_FLAG_NO_SIGNAME))\n\t\t{\n\t\tif(X509_signature_print(bp, x->sig_alg, NULL) <= 0)\n\t\t\tgoto err;\n#if 0\n\t\tif (BIO_printf(bp,"%8sSignature Algorithm: ","") <= 0)\n\t\t\tgoto err;\n\t\tif (i2a_ASN1_OBJECT(bp, ci->signature->algorithm) <= 0)\n\t\t\tgoto err;\n\t\tif (BIO_puts(bp, "\\n") <= 0)\n\t\t\tgoto err;\n#endif\n\t\t}\n\tif(!(cflag & X509_FLAG_NO_ISSUER))\n\t\t{\n\t\tif (BIO_printf(bp,"        Issuer:%c",mlch) <= 0) goto err;\n\t\tif (X509_NAME_print_ex(bp,X509_get_issuer_name(x),nmindent, nmflags) < 0) goto err;\n\t\tif (BIO_write(bp,"\\n",1) <= 0) goto err;\n\t\t}\n\tif(!(cflag & X509_FLAG_NO_VALIDITY))\n\t\t{\n\t\tif (BIO_write(bp,"        Validity\\n",17) <= 0) goto err;\n\t\tif (BIO_write(bp,"            Not Before: ",24) <= 0) goto err;\n\t\tif (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err;\n\t\tif (BIO_write(bp,"\\n            Not After : ",25) <= 0) goto err;\n\t\tif (!ASN1_TIME_print(bp,X509_get_notAfter(x))) goto err;\n\t\tif (BIO_write(bp,"\\n",1) <= 0) goto err;\n\t\t}\n\tif(!(cflag & X509_FLAG_NO_SUBJECT))\n\t\t{\n\t\tif (BIO_printf(bp,"        Subject:%c",mlch) <= 0) goto err;\n\t\tif (X509_NAME_print_ex(bp,X509_get_subject_name(x),nmindent, nmflags) < 0) goto err;\n\t\tif (BIO_write(bp,"\\n",1) <= 0) goto err;\n\t\t}\n\tif(!(cflag & X509_FLAG_NO_PUBKEY))\n\t\t{\n\t\tif (BIO_write(bp,"        Subject Public Key Info:\\n",33) <= 0)\n\t\t\tgoto err;\n\t\tif (BIO_printf(bp,"%12sPublic Key Algorithm: ","") <= 0)\n\t\t\tgoto err;\n\t\tif (i2a_ASN1_OBJECT(bp, ci->key->algor->algorithm) <= 0)\n\t\t\tgoto err;\n\t\tif (BIO_puts(bp, "\\n") <= 0)\n\t\t\tgoto err;\n\t\tpkey=X509_get_pubkey(x);\n\t\tif (pkey == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bp,"%12sUnable to load Public Key\\n","");\n\t\t\tERR_print_errors(bp);\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tEVP_PKEY_print_public(bp, pkey, 16, NULL);\n\t\t\tEVP_PKEY_free(pkey);\n\t\t\t}\n\t\t}\n\tif(!(cflag & X509_FLAG_NO_IDS))\n\t\t{\n\t\tif (ci->issuerUID)\n\t\t\t{\n\t\t\tif (BIO_printf(bp,"%8sIssuer Unique ID: ","") <= 0)\n\t\t\t\tgoto err;\n\t\t\tif (!X509_signature_dump(bp, ci->issuerUID, 12))\n\t\t\t\tgoto err;\n\t\t\t}\n\t\tif (ci->subjectUID)\n\t\t\t{\n\t\t\tif (BIO_printf(bp,"%8sSubject Unique ID: ","") <= 0)\n\t\t\t\tgoto err;\n\t\t\tif (!X509_signature_dump(bp, ci->subjectUID, 12))\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\tif (!(cflag & X509_FLAG_NO_EXTENSIONS))\n\t\tX509V3_extensions_print(bp, "X509v3 extensions",\n\t\t\t\t\tci->extensions, cflag, 8);\n\tif(!(cflag & X509_FLAG_NO_SIGDUMP))\n\t\t{\n\t\tif(X509_signature_print(bp, x->sig_alg, x->signature) <= 0) goto err;\n\t\t}\n\tif(!(cflag & X509_FLAG_NO_AUX))\n\t\t{\n\t\tif (!X509_CERT_AUX_print(bp, x->aux, 0)) goto err;\n\t\t}\n\tret=1;\nerr:\n\tif (m != NULL) OPENSSL_free(m);\n\treturn(ret);\n\t}', 'int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)\n{\n\tif(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm);\n\tif(tm->type == V_ASN1_GENERALIZEDTIME)\n\t\t\t\treturn ASN1_GENERALIZEDTIME_print(bp, tm);\n\tBIO_write(bp,"Bad time value",14);\n\treturn(0);\n}', 'int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)\n\t{\n\tchar *v;\n\tint gmt=0;\n\tint i;\n\tint y=0,M=0,d=0,h=0,m=0,s=0;\n\tchar *f = NULL;\n\tint f_len = 0;\n\ti=tm->length;\n\tv=(char *)tm->data;\n\tif (i < 12) goto err;\n\tif (v[i-1] == \'Z\') gmt=1;\n\tfor (i=0; i<12; i++)\n\t\tif ((v[i] > \'9\') || (v[i] < \'0\')) goto err;\n\ty= (v[0]-\'0\')*1000+(v[1]-\'0\')*100 + (v[2]-\'0\')*10+(v[3]-\'0\');\n\tM= (v[4]-\'0\')*10+(v[5]-\'0\');\n\tif ((M > 12) || (M < 1)) goto err;\n\td= (v[6]-\'0\')*10+(v[7]-\'0\');\n\th= (v[8]-\'0\')*10+(v[9]-\'0\');\n\tm=  (v[10]-\'0\')*10+(v[11]-\'0\');\n\tif (tm->length >= 14 &&\n\t    (v[12] >= \'0\') && (v[12] <= \'9\') &&\n\t    (v[13] >= \'0\') && (v[13] <= \'9\'))\n\t\t{\n\t\ts=  (v[12]-\'0\')*10+(v[13]-\'0\');\n\t\tif (tm->length >= 15 && v[14] == \'.\')\n\t\t\t{\n\t\t\tint l = tm->length;\n\t\t\tf = &v[14];\n\t\t\tf_len = 1;\n\t\t\twhile (14 + f_len < l && f[f_len] >= \'0\' && f[f_len] <= \'9\')\n\t\t\t\t++f_len;\n\t\t\t}\n\t\t}\n\tif (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s",\n\t\tmon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0)\n\t\treturn(0);\n\telse\n\t\treturn(1);\nerr:\n\tBIO_write(bp,"Bad time value",14);\n\treturn(0);\n\t}']