diff options
| author | David Howells <dhowells@redhat.com> | 2014-09-16 12:36:06 -0400 |
|---|---|---|
| committer | David Howells <dhowells@redhat.com> | 2014-09-16 12:36:06 -0400 |
| commit | c06cfb08b88dfbe13be44a69ae2fdc3a7c902d81 (patch) | |
| tree | 8bc0e3794ffb426b3cbb2c0d7c2dbbd4b28e3054 /crypto | |
| parent | 614d8c39014c185aa0f7254f0a470cc33fc1b284 (diff) | |
KEYS: Remove key_type::match in favour of overriding default by match_preparse
A previous patch added a ->match_preparse() method to the key type. This is
allowed to override the function called by the iteration algorithm.
Therefore, we can just set a default that simply checks for an exact match of
the key description with the original criterion data and allow match_preparse
to override it as needed.
The key_type::match op is then redundant and can be removed, as can the
user_match() function.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Diffstat (limited to 'crypto')
| -rw-r--r-- | crypto/asymmetric_keys/asymmetric_type.c | 6 | ||||
| -rw-r--r-- | crypto/asymmetric_keys/pkcs7_key_type.c | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/crypto/asymmetric_keys/asymmetric_type.c b/crypto/asymmetric_keys/asymmetric_type.c index 9d78ad7754d9..7c0498968975 100644 --- a/crypto/asymmetric_keys/asymmetric_type.c +++ b/crypto/asymmetric_keys/asymmetric_type.c | |||
| @@ -59,8 +59,8 @@ EXPORT_SYMBOL_GPL(asymmetric_keyid_match); | |||
| 59 | * "id:<id>" - request a key matching the ID | 59 | * "id:<id>" - request a key matching the ID |
| 60 | * "<subtype>:<id>" - request a key of a subtype | 60 | * "<subtype>:<id>" - request a key of a subtype |
| 61 | */ | 61 | */ |
| 62 | static int asymmetric_key_match(const struct key *key, | 62 | static int asymmetric_key_cmp(const struct key *key, |
| 63 | const struct key_match_data *match_data) | 63 | const struct key_match_data *match_data) |
| 64 | { | 64 | { |
| 65 | const struct asymmetric_key_subtype *subtype = asymmetric_key_subtype(key); | 65 | const struct asymmetric_key_subtype *subtype = asymmetric_key_subtype(key); |
| 66 | const char *description = match_data->raw_data; | 66 | const char *description = match_data->raw_data; |
| @@ -110,6 +110,7 @@ static int asymmetric_key_match(const struct key *key, | |||
| 110 | static int asymmetric_key_match_preparse(struct key_match_data *match_data) | 110 | static int asymmetric_key_match_preparse(struct key_match_data *match_data) |
| 111 | { | 111 | { |
| 112 | match_data->lookup_type = KEYRING_SEARCH_LOOKUP_ITERATE; | 112 | match_data->lookup_type = KEYRING_SEARCH_LOOKUP_ITERATE; |
| 113 | match_data->cmp = asymmetric_key_cmp; | ||
| 113 | return 0; | 114 | return 0; |
| 114 | } | 115 | } |
| 115 | 116 | ||
| @@ -224,7 +225,6 @@ struct key_type key_type_asymmetric = { | |||
| 224 | .free_preparse = asymmetric_key_free_preparse, | 225 | .free_preparse = asymmetric_key_free_preparse, |
| 225 | .instantiate = generic_key_instantiate, | 226 | .instantiate = generic_key_instantiate, |
| 226 | .match_preparse = asymmetric_key_match_preparse, | 227 | .match_preparse = asymmetric_key_match_preparse, |
| 227 | .match = asymmetric_key_match, | ||
| 228 | .match_free = asymmetric_key_match_free, | 228 | .match_free = asymmetric_key_match_free, |
| 229 | .destroy = asymmetric_key_destroy, | 229 | .destroy = asymmetric_key_destroy, |
| 230 | .describe = asymmetric_key_describe, | 230 | .describe = asymmetric_key_describe, |
diff --git a/crypto/asymmetric_keys/pkcs7_key_type.c b/crypto/asymmetric_keys/pkcs7_key_type.c index d1faa1df1dec..751f8fd7335d 100644 --- a/crypto/asymmetric_keys/pkcs7_key_type.c +++ b/crypto/asymmetric_keys/pkcs7_key_type.c | |||
| @@ -75,7 +75,6 @@ static struct key_type key_type_pkcs7 = { | |||
| 75 | .preparse = pkcs7_preparse, | 75 | .preparse = pkcs7_preparse, |
| 76 | .free_preparse = user_free_preparse, | 76 | .free_preparse = user_free_preparse, |
| 77 | .instantiate = generic_key_instantiate, | 77 | .instantiate = generic_key_instantiate, |
| 78 | .match = user_match, | ||
| 79 | .revoke = user_revoke, | 78 | .revoke = user_revoke, |
| 80 | .destroy = user_destroy, | 79 | .destroy = user_destroy, |
| 81 | .describe = user_describe, | 80 | .describe = user_describe, |
