crypto: rng - Do not free default RNG when it becomes unused
[linux-2.6-block.git] / include / linux / cryptouser.h
CommitLineData
a38f7907
SK
1/*
2 * Crypto user configuration API.
3 *
4 * Copyright (C) 2011 secunet Security Networks AG
5 * Copyright (C) 2011 Steffen Klassert <steffen.klassert@secunet.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21/* Netlink configuration messages. */
22enum {
23 CRYPTO_MSG_BASE = 0x10,
24 CRYPTO_MSG_NEWALG = 0x10,
25 CRYPTO_MSG_DELALG,
26 CRYPTO_MSG_UPDATEALG,
27 CRYPTO_MSG_GETALG,
28 __CRYPTO_MSG_MAX
29};
30#define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
31#define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE)
32
33#define CRYPTO_MAX_NAME CRYPTO_MAX_ALG_NAME
34
35/* Netlink message attributes. */
36enum crypto_attr_type_t {
37 CRYPTOCFGA_UNSPEC,
38 CRYPTOCFGA_PRIORITY_VAL, /* __u32 */
6c5a86f5 39 CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */
f4d663ce 40 CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */
50496a1f 41 CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */
6ad414fe 42 CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */
a55465dc 43 CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */
792608e9 44 CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */
07a5fa4a 45 CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */
3c339ab8 46 CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */
a38f7907
SK
47 __CRYPTOCFGA_MAX
48
49#define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
50};
51
52struct crypto_user_alg {
53 char cru_name[CRYPTO_MAX_ALG_NAME];
54 char cru_driver_name[CRYPTO_MAX_ALG_NAME];
55 char cru_module_name[CRYPTO_MAX_ALG_NAME];
56 __u32 cru_type;
57 __u32 cru_mask;
58 __u32 cru_refcnt;
59 __u32 cru_flags;
60};
6c5a86f5
SK
61
62struct crypto_report_larval {
63 char type[CRYPTO_MAX_NAME];
64};
f4d663ce
SK
65
66struct crypto_report_hash {
67 char type[CRYPTO_MAX_NAME];
68 unsigned int blocksize;
69 unsigned int digestsize;
70};
50496a1f 71
07a5fa4a
SK
72struct crypto_report_cipher {
73 char type[CRYPTO_MAX_ALG_NAME];
74 unsigned int blocksize;
75 unsigned int min_keysize;
76 unsigned int max_keysize;
77};
78
50496a1f
SK
79struct crypto_report_blkcipher {
80 char type[CRYPTO_MAX_NAME];
81 char geniv[CRYPTO_MAX_NAME];
82 unsigned int blocksize;
83 unsigned int min_keysize;
84 unsigned int max_keysize;
85 unsigned int ivsize;
86};
6ad414fe
SK
87
88struct crypto_report_aead {
89 char type[CRYPTO_MAX_NAME];
90 char geniv[CRYPTO_MAX_NAME];
91 unsigned int blocksize;
92 unsigned int maxauthsize;
93 unsigned int ivsize;
94};
a55465dc
SK
95
96struct crypto_report_comp {
97 char type[CRYPTO_MAX_NAME];
98};
792608e9
SK
99
100struct crypto_report_rng {
101 char type[CRYPTO_MAX_NAME];
102 unsigned int seedsize;
103};
5219a534 104
3c339ab8
TS
105struct crypto_report_akcipher {
106 char type[CRYPTO_MAX_NAME];
107};
108
5219a534
SK
109#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
110 sizeof(struct crypto_report_blkcipher))