]> git.proxmox.com Git - mirror_qemu.git/blob - block/crypto.h
block: expose crypto option names / defs to other drivers
[mirror_qemu.git] / block / crypto.h
1 /*
2 * QEMU block full disk encryption
3 *
4 * Copyright (c) 2015-2017 Red Hat, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef BLOCK_CRYPTO_H__
22 #define BLOCK_CRYPTO_H__
23
24 #define BLOCK_CRYPTO_OPT_LUKS_KEY_SECRET "key-secret"
25 #define BLOCK_CRYPTO_OPT_LUKS_CIPHER_ALG "cipher-alg"
26 #define BLOCK_CRYPTO_OPT_LUKS_CIPHER_MODE "cipher-mode"
27 #define BLOCK_CRYPTO_OPT_LUKS_IVGEN_ALG "ivgen-alg"
28 #define BLOCK_CRYPTO_OPT_LUKS_IVGEN_HASH_ALG "ivgen-hash-alg"
29 #define BLOCK_CRYPTO_OPT_LUKS_HASH_ALG "hash-alg"
30 #define BLOCK_CRYPTO_OPT_LUKS_ITER_TIME "iter-time"
31
32 #define BLOCK_CRYPTO_OPT_DEF_LUKS_KEY_SECRET \
33 { \
34 .name = BLOCK_CRYPTO_OPT_LUKS_KEY_SECRET, \
35 .type = QEMU_OPT_STRING, \
36 .help = "ID of the secret that provides the keyslot passphrase", \
37 }
38
39 #define BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG \
40 { \
41 .name = BLOCK_CRYPTO_OPT_LUKS_CIPHER_ALG, \
42 .type = QEMU_OPT_STRING, \
43 .help = "Name of encryption cipher algorithm", \
44 }
45
46 #define BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE \
47 { \
48 .name = BLOCK_CRYPTO_OPT_LUKS_CIPHER_MODE, \
49 .type = QEMU_OPT_STRING, \
50 .help = "Name of encryption cipher mode", \
51 }
52
53 #define BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG \
54 { \
55 .name = BLOCK_CRYPTO_OPT_LUKS_IVGEN_ALG, \
56 .type = QEMU_OPT_STRING, \
57 .help = "Name of IV generator algorithm", \
58 }
59
60 #define BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG \
61 { \
62 .name = BLOCK_CRYPTO_OPT_LUKS_IVGEN_HASH_ALG, \
63 .type = QEMU_OPT_STRING, \
64 .help = "Name of IV generator hash algorithm", \
65 }
66
67 #define BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG \
68 { \
69 .name = BLOCK_CRYPTO_OPT_LUKS_HASH_ALG, \
70 .type = QEMU_OPT_STRING, \
71 .help = "Name of encryption hash algorithm", \
72 }
73
74 #define BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME \
75 { \
76 .name = BLOCK_CRYPTO_OPT_LUKS_ITER_TIME, \
77 .type = QEMU_OPT_NUMBER, \
78 .help = "Time to spend in PBKDF in milliseconds", \
79 }
80
81 QCryptoBlockCreateOptions *
82 block_crypto_create_opts_init(QCryptoBlockFormat format,
83 QDict *opts,
84 Error **errp);
85
86 QCryptoBlockOpenOptions *
87 block_crypto_open_opts_init(QCryptoBlockFormat format,
88 QDict *opts,
89 Error **errp);
90
91 #endif /* BLOCK_CRYPTO_H__ */