1/* keyctl kernel bits
2 *
3 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef __LINUX_KEYCTL_H
13#define __LINUX_KEYCTL_H
14
15#include <uapi/linux/keyctl.h>
16
17struct kernel_pkey_query {
18 __u32 supported_ops; /* Which ops are supported */
19 __u32 key_size; /* Size of the key in bits */
20 __u16 max_data_size; /* Maximum size of raw data to sign in bytes */
21 __u16 max_sig_size; /* Maximum size of signature in bytes */
22 __u16 max_enc_size; /* Maximum size of encrypted blob in bytes */
23 __u16 max_dec_size; /* Maximum size of decrypted blob in bytes */
24};
25
26enum kernel_pkey_operation {
27 kernel_pkey_encrypt,
28 kernel_pkey_decrypt,
29 kernel_pkey_sign,
30 kernel_pkey_verify,
31};
32
33struct kernel_pkey_params {
34 struct key *key;
35 const char *encoding; /* Encoding (eg. "oaep" or "raw" for none) */
36 const char *hash_algo; /* Digest algorithm used (eg. "sha1") or NULL if N/A */
37 char *info; /* Modified info string to be released later */
38 __u32 in_len; /* Input data size */
39 union {
40 __u32 out_len; /* Output buffer size (enc/dec/sign) */
41 __u32 in2_len; /* 2nd input data size (verify) */
42 };
43 enum kernel_pkey_operation op : 8;
44};
45
46#endif /* __LINUX_KEYCTL_H */
47