if (peer != NULL)
if (peer != NULL) { EVP_PKEY *pktmp; pktmp = X509_get_pubkey(peer);
static void print_stuff(bio,s,full)BIO *bio;SSL *s;int full;	{	X509 *peer=NULL;	char *p;	static char *space="                ";	char buf[BUFSIZ];	STACK *sk;	SSL_CIPHER *c;	X509_NAME *xn;	int j,i;	if (full)		{		sk=SSL_get_peer_cert_chain(s);		if (sk != NULL)			{			BIO_printf(bio,"---\nCertificate chain\n");			for (i=0; i<sk_num(sk); i++)				{				X509_NAME_oneline(X509_get_subject_name((X509 *)					sk_value(sk,i)),buf,BUFSIZ);				BIO_printf(bio,"%2d s:%s\n",i,buf);				X509_NAME_oneline(X509_get_issuer_name((X509 *)					sk_value(sk,i)),buf,BUFSIZ);				BIO_printf(bio,"   i:%s\n",buf);				}			}		BIO_printf(bio,"---\n");		peer=SSL_get_peer_certificate(s);		if (peer != NULL)			{			BIO_printf(bio,"Server certificate\n");			PEM_write_bio_X509(bio,peer);			X509_NAME_oneline(X509_get_subject_name(peer),				buf,BUFSIZ);			BIO_printf(bio,"subject=%s\n",buf);			X509_NAME_oneline(X509_get_issuer_name(peer),				buf,BUFSIZ);			BIO_printf(bio,"issuer=%s\n",buf);			}		else			BIO_printf(bio,"no peer certificate available\n");		sk=SSL_get_client_CA_list(s);		if ((sk != NULL) && (sk_num(sk) > 0))			{			BIO_printf(bio,"---\nAcceptable client certificate CA names\n");			for (i=0; i<sk_num(sk); i++)				{				xn=(X509_NAME *)sk_value(sk,i);				X509_NAME_oneline(xn,buf,sizeof(buf));				BIO_write(bio,buf,strlen(buf));				BIO_write(bio,"\n",1);				}			}		else			{			BIO_printf(bio,"---\nNo client certificate CA names sent\n");			}		p=SSL_get_shared_ciphers(s,buf,BUFSIZ);		if (p != NULL)			{			BIO_printf(bio,"---\nCiphers common between both SSL endpoints:\n");			j=i=0;			while (*p)				{				if (*p == ':')					{					BIO_write(bio,space,15-j%25);					i++;					j=0;					BIO_write(bio,((i%3)?" ":"\n"),1);					}				else					{					BIO_write(bio,p,1);					j++;					}				p++;				}			BIO_write(bio,"\n",1);			}		BIO_printf(bio,"---\nSSL handshake has read %ld bytes and written %ld bytes\n",			BIO_number_read(SSL_get_rbio(s)),			BIO_number_written(SSL_get_wbio(s)));		}	BIO_printf(bio,((s->hit)?"---\nReused, ":"---\nNew, "));	c=SSL_get_current_cipher(s);	BIO_printf(bio,"%s, Cipher is %s\n",		SSL_CIPHER_get_version(c),		SSL_CIPHER_get_name(c));	if (peer != NULL)		BIO_printf(bio,"Server public key is %d bit\n",			EVP_PKEY_bits(X509_get_pubkey(peer)));	SSL_SESSION_print(bio,SSL_get_session(s));	BIO_printf(bio,"---\n");	if (peer != NULL)		X509_free(peer);	}