Linux 3.12.5
[linux/fpc-iii.git] / include / keys / asymmetric-subtype.h
blob4b840e822209d7d6894f81476267655498d530f2
1 /* Asymmetric public-key cryptography key subtype
3 * See Documentation/security/asymmetric-keys.txt
5 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
6 * Written by David Howells (dhowells@redhat.com)
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public Licence
10 * as published by the Free Software Foundation; either version
11 * 2 of the Licence, or (at your option) any later version.
14 #ifndef _KEYS_ASYMMETRIC_SUBTYPE_H
15 #define _KEYS_ASYMMETRIC_SUBTYPE_H
17 #include <linux/seq_file.h>
18 #include <keys/asymmetric-type.h>
20 struct public_key_signature;
23 * Keys of this type declare a subtype that indicates the handlers and
24 * capabilities.
26 struct asymmetric_key_subtype {
27 struct module *owner;
28 const char *name;
29 unsigned short name_len; /* length of name */
31 /* Describe a key of this subtype for /proc/keys */
32 void (*describe)(const struct key *key, struct seq_file *m);
34 /* Destroy a key of this subtype */
35 void (*destroy)(void *payload);
37 /* Verify the signature on a key of this subtype (optional) */
38 int (*verify_signature)(const struct key *key,
39 const struct public_key_signature *sig);
42 /**
43 * asymmetric_key_subtype - Get the subtype from an asymmetric key
44 * @key: The key of interest.
46 * Retrieves and returns the subtype pointer of the asymmetric key from the
47 * type-specific data attached to the key.
49 static inline
50 struct asymmetric_key_subtype *asymmetric_key_subtype(const struct key *key)
52 return key->type_data.p[0];
55 #endif /* _KEYS_ASYMMETRIC_SUBTYPE_H */