|
18 | 18 | #include <linux/slab.h>
|
19 | 19 | #include <asm/uaccess.h>
|
20 | 20 | #include "internal.h"
|
| 21 | +#include <keys/user-type.h> |
21 | 22 |
|
22 | 23 | static int request_key_auth_instantiate(struct key *,
|
23 | 24 | struct key_preparsed_payload *);
|
@@ -221,34 +222,26 @@ struct key *request_key_auth_new(struct key *target, const void *callout_info,
|
221 | 222 | return ERR_PTR(ret);
|
222 | 223 | }
|
223 | 224 |
|
224 |
| -/* |
225 |
| - * See if an authorisation key is associated with a particular key. |
226 |
| - */ |
227 |
| -static int key_get_instantiation_authkey_match(const struct key *key, |
228 |
| - const void *_id) |
229 |
| -{ |
230 |
| - struct request_key_auth *rka = key->payload.data; |
231 |
| - key_serial_t id = (key_serial_t)(unsigned long) _id; |
232 |
| - |
233 |
| - return rka->target_key->serial == id; |
234 |
| -} |
235 |
| - |
236 | 225 | /*
|
237 | 226 | * Search the current process's keyrings for the authorisation key for
|
238 | 227 | * instantiation of a key.
|
239 | 228 | */
|
240 | 229 | struct key *key_get_instantiation_authkey(key_serial_t target_id)
|
241 | 230 | {
|
| 231 | + char description[16]; |
242 | 232 | struct keyring_search_context ctx = {
|
243 | 233 | .index_key.type = &key_type_request_key_auth,
|
| 234 | + .index_key.description = description, |
244 | 235 | .cred = current_cred(),
|
245 |
| - .match = key_get_instantiation_authkey_match, |
246 |
| - .match_data = (void *)(unsigned long)target_id, |
| 236 | + .match = user_match, |
| 237 | + .match_data = description, |
247 | 238 | .flags = KEYRING_SEARCH_LOOKUP_DIRECT,
|
248 | 239 | };
|
249 | 240 | struct key *authkey;
|
250 | 241 | key_ref_t authkey_ref;
|
251 | 242 |
|
| 243 | + sprintf(description, "%x", target_id); |
| 244 | + |
252 | 245 | authkey_ref = search_process_keyrings(&ctx);
|
253 | 246 |
|
254 | 247 | if (IS_ERR(authkey_ref)) {
|
|
0 commit comments