diff options
author | Jean-Frederic Clere <jfclere@apache.org> | 2016-04-10 10:19:51 +0000 |
---|---|---|
committer | Jean-Frederic Clere <jfclere@apache.org> | 2016-04-10 10:19:51 +0000 |
commit | fab3101178a6470576dabb87d7b1a482942b9faa (patch) | |
tree | c7f2ec3d5e5d299f1ce997b8d1c835cdaa807eff /support/ab.c | |
parent | 89db09bb588800a0aca972094863b068a81a0718 (diff) | |
download | httpd-fab3101178a6470576dabb87d7b1a482942b9faa.tar.gz |
print Server Temp Key information.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1738415 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support/ab.c')
-rw-r--r-- | support/ab.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/support/ab.c b/support/ab.c index 102976e345..aa75dcf48e 100644 --- a/support/ab.c +++ b/support/ab.c @@ -334,6 +334,7 @@ int is_ssl; SSL_CTX *ssl_ctx; char *ssl_cipher = NULL; char *ssl_info = NULL; +char *ssl_tmp_key = NULL; BIO *bio_out,*bio_err; #endif @@ -709,6 +710,39 @@ static void ssl_proceed_handshake(struct connection *c) SSL_CIPHER_get_name(ci), pk_bits, sk_bits); } + if (ssl_tmp_key == NULL) { + EVP_PKEY *key; + if (SSL_get_server_tmp_key(c->ssl, &key)) { + ssl_tmp_key = xmalloc(128); + switch (EVP_PKEY_id(key)) { + case EVP_PKEY_RSA: + apr_snprintf(ssl_tmp_key, 128, "RSA %d bits", + EVP_PKEY_bits(key)); + break; + case EVP_PKEY_DH: + apr_snprintf(ssl_tmp_key, 128, "DH %d bits", + EVP_PKEY_bits(key)); + break; +#ifndef OPENSSL_NO_EC + case EVP_PKEY_EC: { + const char *cname; + EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); + int 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); + + apr_snprintf(ssl_tmp_key, 128, "ECDH %s %d bits", + cname, + EVP_PKEY_bits(key)); + break; + } +#endif + } + EVP_PKEY_free(key); + } + } write_request(c); do_next = 0; break; @@ -858,6 +892,9 @@ static void output_results(int sig) if (is_ssl && ssl_info) { printf("SSL/TLS Protocol: %s\n", ssl_info); } + if (is_ssl && ssl_tmp_key) { + printf("Server Temp Key: %s\n", ssl_tmp_key); + } #endif printf("\n"); printf("Document Path: %s\n", path); |