1 /* Asymmetric public-key cryptography key subtype
3 * See Documentation/crypto/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 kernel_pkey_query
;
21 struct kernel_pkey_params
;
22 struct public_key_signature
;
25 * Keys of this type declare a subtype that indicates the handlers and
28 struct asymmetric_key_subtype
{
31 unsigned short name_len
; /* length of name */
33 /* Describe a key of this subtype for /proc/keys */
34 void (*describe
)(const struct key
*key
, struct seq_file
*m
);
36 /* Destroy a key of this subtype */
37 void (*destroy
)(void *payload_crypto
, void *payload_auth
);
39 int (*query
)(const struct kernel_pkey_params
*params
,
40 struct kernel_pkey_query
*info
);
42 /* Encrypt/decrypt/sign data */
43 int (*eds_op
)(struct kernel_pkey_params
*params
,
44 const void *in
, void *out
);
46 /* Verify the signature on a key of this subtype (optional) */
47 int (*verify_signature
)(const struct key
*key
,
48 const struct public_key_signature
*sig
);
52 * asymmetric_key_subtype - Get the subtype from an asymmetric key
53 * @key: The key of interest.
55 * Retrieves and returns the subtype pointer of the asymmetric key from the
56 * type-specific data attached to the key.
59 struct asymmetric_key_subtype
*asymmetric_key_subtype(const struct key
*key
)
61 return key
->payload
.data
[asym_subtype
];
64 #endif /* _KEYS_ASYMMETRIC_SUBTYPE_H */