]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Log name of provided peer temp keys
authorViktor Dukhovni <openssl-users@dukhovni.org>
Thu, 13 Feb 2025 10:35:17 +0000 (21:35 +1100)
committerTomas Mraz <tomas@openssl.org>
Fri, 14 Feb 2025 16:14:53 +0000 (17:14 +0100)
Log the peer's temp key name when it is from a provider.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26734)

apps/lib/s_cb.c

index 026315406e298f16bcb8952a8121fc4a914ff69c..ca665685a069ecae409232ea693f55fda1f2b693 100644 (file)
@@ -416,6 +416,7 @@ int ssl_print_groups(BIO *out, SSL *s, int noshared)
 
 int ssl_print_tmp_key(BIO *out, SSL *s)
 {
+    const char *keyname;
     EVP_PKEY *key;
 
     if (!SSL_get_peer_tmp_key(s, &key)) {
@@ -425,12 +426,18 @@ int ssl_print_tmp_key(BIO *out, SSL *s)
         return 1;
     }
 
-    BIO_puts(out, "Server Temp Key: ");
+    BIO_puts(out, "Peer Temp Key: ");
     switch (EVP_PKEY_get_id(key)) {
     case EVP_PKEY_RSA:
         BIO_printf(out, "RSA, %d bits\n", EVP_PKEY_get_bits(key));
         break;
 
+    case EVP_PKEY_KEYMGMT:
+        if ((keyname = EVP_PKEY_get0_type_name(key)) == NULL)
+            keyname = "?";
+        BIO_printf(out, "%s\n", keyname);
+        break;
+
     case EVP_PKEY_DH:
         BIO_printf(out, "DH, %d bits\n", EVP_PKEY_get_bits(key));
         break;
@@ -1332,8 +1339,7 @@ void print_ssl_summary(SSL *s)
     if (SSL_is_server(s))
         ssl_print_groups(bio_err, s, 1);
 #endif
-    if (!SSL_is_server(s))
-        ssl_print_tmp_key(bio_err, s);
+    ssl_print_tmp_key(bio_err, s);
 }
 
 int config_ctx(SSL_CONF_CTX *cctx, STACK_OF(OPENSSL_STRING) *str,