rxrpc: Allow security classes to give more info on server keys
authorDavid Howells <dhowells@redhat.com>
Sun, 27 Sep 2020 10:13:04 +0000 (11:13 +0100)
committerDavid Howells <dhowells@redhat.com>
Mon, 23 Nov 2020 18:09:29 +0000 (18:09 +0000)
Allow a security class to give more information on an rxrpc_s-type key when
it is viewed in /proc/keys.  This will allow the upcoming RxGK security
class to show the enctype name here.

Signed-off-by: David Howells <dhowells@redhat.com>
net/rxrpc/ar-internal.h
net/rxrpc/server_key.c

index 6682c797b87871496aab01b9e44c5915444cc92e..0fb294725ff20fe0e2d6fcbef38ee0a90cde87c6 100644 (file)
@@ -227,6 +227,9 @@ struct rxrpc_security {
        /* Destroy the payload of a server key */
        void (*destroy_server_key)(struct key *);
 
+       /* Describe a server key */
+       void (*describe_server_key)(const struct key *, struct seq_file *);
+
        /* initialise a connection's security */
        int (*init_connection_security)(struct rxrpc_connection *,
                                        struct rxrpc_key_token *);
index 1a2f0b63ee1d2943b6ac8a1dc4a2462eb24cb535..ead3471307ee52e113eefa7ff67821bb8b77b0ab 100644 (file)
@@ -105,7 +105,11 @@ static void rxrpc_destroy_s(struct key *key)
 
 static void rxrpc_describe_s(const struct key *key, struct seq_file *m)
 {
+       const struct rxrpc_security *sec = key->payload.data[1];
+
        seq_puts(m, key->description);
+       if (sec && sec->describe_server_key)
+               sec->describe_server_key(key, m);
 }
 
 /*