new ctrl to retrive value of received temporary key in server key exchange message, print out details in s_client
diff --git a/apps/s_apps.h b/apps/s_apps.h
index c7e6926..b45c1b9 100644
--- a/apps/s_apps.h
+++ b/apps/s_apps.h
@@ -163,6 +163,7 @@
 int ssl_print_sigalgs(BIO *out, SSL *s);
 int ssl_print_curves(BIO *out, SSL *s);
 #endif
+int ssl_print_tmp_key(BIO *out, SSL *s);
 int init_client(int *sock, char *server, int port, int type);
 int should_retry(int i);
 int extract_port(char *str, short *port_ptr);
diff --git a/apps/s_cb.c b/apps/s_cb.c
index b592870..fc40f39 100644
--- a/apps/s_cb.c
+++ b/apps/s_cb.c
@@ -466,6 +466,40 @@
 	return 1;
 	}
 
+int ssl_print_tmp_key(BIO *out, SSL *s)
+	{
+	EVP_PKEY *key;
+	if (!SSL_get_server_tmp_key(s, &key))
+		return 1;
+	BIO_puts(out, "Server Temp Key: ");
+	switch (EVP_PKEY_id(key))
+		{
+	case EVP_PKEY_RSA:
+		BIO_printf(out, "RSA, %d bits\n", EVP_PKEY_bits(key));
+		break;
+
+	case EVP_PKEY_DH:
+		BIO_printf(out, "DH, %d bits\n", EVP_PKEY_bits(key));
+		break;
+
+	case EVP_PKEY_EC:
+			{
+			EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key);
+			int nid;
+			const char *cname;
+			nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec));
+			EC_KEY_free(ec);
+			cname = EC_curve_nid2nist(nid);
+			if (!cname)
+				cname = OBJ_nid2sn(nid);
+			BIO_printf(out, "ECDH, %s, %d bits\n",
+						cname, EVP_PKEY_bits(key));
+			}
+		}
+	EVP_PKEY_free(key);
+	return 1;
+	}
+		
 
 long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
 				   int argi, long argl, long ret)
diff --git a/apps/s_client.c b/apps/s_client.c
index 0591add..ea0a321 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -2105,6 +2105,7 @@
 			}
 
 		ssl_print_sigalgs(bio, s);
+		ssl_print_tmp_key(bio, s);
 
 		BIO_printf(bio,"---\nSSL handshake has read %ld bytes and written %ld bytes\n",
 			BIO_number_read(SSL_get_rbio(s)),