1 /* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  *
5  * Crypto constants for verified boot
6  */
7 
8 #ifndef VBOOT_REFERENCE_VBOOT_2CRYPTO_H_
9 #define VBOOT_REFERENCE_VBOOT_2CRYPTO_H_
10 #include <stdint.h>
11 
12 /* Verified boot crypto algorithms */
13 enum vb2_crypto_algorithm {
14 	VB2_ALG_RSA1024_SHA1   = 0,
15 	VB2_ALG_RSA1024_SHA256 = 1,
16 	VB2_ALG_RSA1024_SHA512 = 2,
17 	VB2_ALG_RSA2048_SHA1   = 3,
18 	VB2_ALG_RSA2048_SHA256 = 4,
19 	VB2_ALG_RSA2048_SHA512 = 5,
20 	VB2_ALG_RSA4096_SHA1   = 6,
21 	VB2_ALG_RSA4096_SHA256 = 7,
22 	VB2_ALG_RSA4096_SHA512 = 8,
23 	VB2_ALG_RSA8192_SHA1   = 9,
24 	VB2_ALG_RSA8192_SHA256 = 10,
25 	VB2_ALG_RSA8192_SHA512 = 11,
26 
27 	/* Number of algorithms */
28 	VB2_ALG_COUNT
29 };
30 
31 /* Algorithm types for signatures */
32 enum vb2_signature_algorithm {
33 	/* Invalid or unsupported signature type */
34 	VB2_SIG_INVALID = 0,
35 
36 	/*
37 	 * No signature algorithm.  The digest is unsigned.  See
38 	 * VB2_GUID_NONE_* above for key GUIDs to use with this algorithm.
39 	 */
40 	VB2_SIG_NONE = 1,
41 
42 	/* RSA algorithms of the given length in bits (1024-8192) */
43 	VB2_SIG_RSA1024 = 2,  /* Warning!  This is likely to be deprecated! */
44 	VB2_SIG_RSA2048 = 3,
45 	VB2_SIG_RSA4096 = 4,
46 	VB2_SIG_RSA8192 = 5,
47 };
48 
49 /* Algorithm types for hash digests */
50 enum vb2_hash_algorithm {
51 	/* Invalid or unsupported digest type */
52 	VB2_HASH_INVALID = 0,
53 
54 	/* SHA-1.  Warning: This is likely to be deprecated soon! */
55 	VB2_HASH_SHA1 = 1,
56 
57 	/* SHA-256 and SHA-512 */
58 	VB2_HASH_SHA256 = 2,
59 	VB2_HASH_SHA512 = 3,
60 };
61 
62 #endif /* VBOOT_REFERENCE_VBOOT_2CRYPTO_H_ */
63