KEYS: Make the key matching functions return bool
authorDavid Howells <dhowells@redhat.com>
Tue, 16 Sep 2014 16:36:08 +0000 (17:36 +0100)
committerDavid Howells <dhowells@redhat.com>
Tue, 16 Sep 2014 16:36:08 +0000 (17:36 +0100)
Make the key matching functions pointed to by key_match_data::cmp return bool
rather than int.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
crypto/asymmetric_keys/asymmetric_type.c
include/linux/key-type.h
net/dns_resolver/dns_key.c
security/keys/internal.h
security/keys/keyring.c
security/keys/process_keys.c

index 7c04989..7755f91 100644 (file)
@@ -59,8 +59,8 @@ EXPORT_SYMBOL_GPL(asymmetric_keyid_match);
  *     "id:<id>"       - request a key matching the ID
  *     "<subtype>:<id>" - request a key of a subtype
  */
-static int asymmetric_key_cmp(const struct key *key,
-                             const struct key_match_data *match_data)
+static bool asymmetric_key_cmp(const struct key *key,
+                              const struct key_match_data *match_data)
 {
        const struct asymmetric_key_subtype *subtype = asymmetric_key_subtype(key);
        const char *description = match_data->raw_data;
index c14816b..ff9f1d3 100644 (file)
@@ -56,10 +56,12 @@ typedef int (*request_key_actor_t)(struct key_construction *key,
  * Preparsed matching criterion.
  */
 struct key_match_data {
-       /* Comparison function, defaults to type->match, but can be replaced by
-        * type->match_preparse(). */
-       int (*cmp)(const struct key *key,
-                  const struct key_match_data *match_data);
+       /* Comparison function, defaults to exact description match, but can be
+        * overridden by type->match_preparse().  Should return true if a match
+        * is found and false if not.
+        */
+       bool (*cmp)(const struct key *key,
+                   const struct key_match_data *match_data);
 
        const void      *raw_data;      /* Raw match data */
        void            *preparsed;     /* For ->match_preparse() to stash stuff */
index a07b9ba..31cd4fd 100644 (file)
@@ -176,8 +176,8 @@ static void dns_resolver_free_preparse(struct key_preparsed_payload *prep)
  * The domain name may be a simple name or an absolute domain name (which
  * should end with a period).  The domain name is case-independent.
  */
-static int dns_resolver_cmp(const struct key *key,
-                           const struct key_match_data *match_data)
+static bool dns_resolver_cmp(const struct key *key,
+                            const struct key_match_data *match_data)
 {
        int slen, dlen, ret = 0;
        const char *src = key->description, *dsp = match_data->raw_data;
Simple merge
Simple merge
Simple merge