mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
This patch extends the vboot2 API by three callback functions that the platform firmware may implement to offer hardware crypto engine support. For now we only support this for hash algorithms, and we will only allow it for firmware body hashes (not the keyblock or preamble which are too small to matter execution-time-wise anyway). The API is similar to the vb2api_*_hash() functions used to start body hashing in the first place, but we still take this round trip through vboot to allow it to do key/signature management and retain full control of the verification process. We also add a new preamble flag to explicitly disable this feature, so that we can later return to a solely software-based verification path through a firmware update in case a hardware crypto engine turns out to be insecure. CQ-DEPEND=CL:236435 BRANCH=None BUG=chrome-os-partner:32987 TEST='make runtests VBOOT2=1'. Manually booted on Pinky with and without HW crypto support and with the preamble flag set to confirm expected behavior. lib21/ parts untested except for compiling and new unit tests. Change-Id: I17c7d02f392089875a5942a5aafcf6a657354863 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/236453 Reviewed-by: Randall Spangler <rspangler@chromium.org>
63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*
|
|
* Crypto constants for verified boot
|
|
*/
|
|
|
|
#ifndef VBOOT_REFERENCE_VBOOT_2CRYPTO_H_
|
|
#define VBOOT_REFERENCE_VBOOT_2CRYPTO_H_
|
|
#include <stdint.h>
|
|
|
|
/* Verified boot crypto algorithms */
|
|
enum vb2_crypto_algorithm {
|
|
VB2_ALG_RSA1024_SHA1 = 0,
|
|
VB2_ALG_RSA1024_SHA256 = 1,
|
|
VB2_ALG_RSA1024_SHA512 = 2,
|
|
VB2_ALG_RSA2048_SHA1 = 3,
|
|
VB2_ALG_RSA2048_SHA256 = 4,
|
|
VB2_ALG_RSA2048_SHA512 = 5,
|
|
VB2_ALG_RSA4096_SHA1 = 6,
|
|
VB2_ALG_RSA4096_SHA256 = 7,
|
|
VB2_ALG_RSA4096_SHA512 = 8,
|
|
VB2_ALG_RSA8192_SHA1 = 9,
|
|
VB2_ALG_RSA8192_SHA256 = 10,
|
|
VB2_ALG_RSA8192_SHA512 = 11,
|
|
|
|
/* Number of algorithms */
|
|
VB2_ALG_COUNT
|
|
};
|
|
|
|
/* Algorithm types for signatures */
|
|
enum vb2_signature_algorithm {
|
|
/* Invalid or unsupported signature type */
|
|
VB2_SIG_INVALID = 0,
|
|
|
|
/*
|
|
* No signature algorithm. The digest is unsigned. See
|
|
* VB2_GUID_NONE_* above for key GUIDs to use with this algorithm.
|
|
*/
|
|
VB2_SIG_NONE = 1,
|
|
|
|
/* RSA algorithms of the given length in bits (1024-8192) */
|
|
VB2_SIG_RSA1024 = 2, /* Warning! This is likely to be deprecated! */
|
|
VB2_SIG_RSA2048 = 3,
|
|
VB2_SIG_RSA4096 = 4,
|
|
VB2_SIG_RSA8192 = 5,
|
|
};
|
|
|
|
/* Algorithm types for hash digests */
|
|
enum vb2_hash_algorithm {
|
|
/* Invalid or unsupported digest type */
|
|
VB2_HASH_INVALID = 0,
|
|
|
|
/* SHA-1. Warning: This is likely to be deprecated soon! */
|
|
VB2_HASH_SHA1 = 1,
|
|
|
|
/* SHA-256 and SHA-512 */
|
|
VB2_HASH_SHA256 = 2,
|
|
VB2_HASH_SHA512 = 3,
|
|
};
|
|
|
|
#endif /* VBOOT_REFERENCE_VBOOT_2CRYPTO_H_ */
|