diff options
author | Joel Kitching <kitching@google.com> | 2021-01-20 17:22:02 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-28 03:52:08 +0000 |
commit | 3a525ff3af462ec2c20b3f7a25c0cfbb1ef8ab57 (patch) | |
tree | a71c64b522df37b1d0ab2c1e0a5d05e59c615bb2 | |
parent | d21cae0b23e206eef336136b23752b2653e58229 (diff) | |
download | vboot-3a525ff3af462ec2c20b3f7a25c0cfbb1ef8ab57.tar.gz |
vboot: relocate private RSA function headers
Previously, functions that need to be tested but not exposed
to vboot API were placed in vboot_test.h. Now, the approach
of placing them in a xyz_private.h header file is preferred.
BUG=b:124141368, chromium:968464
TEST=make clean && make runtests
BRANCH=none
Signed-off-by: Joel Kitching <kitching@google.com>
Change-Id: I8be50d95c533b277b509aabb503ae05f69662a33
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2641344
Tested-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Joel Kitching <kitching@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
-rw-r--r-- | firmware/2lib/2rsa.c | 1 | ||||
-rw-r--r-- | firmware/2lib/include/2rsa_private.h | 21 | ||||
-rw-r--r-- | firmware/lib/include/vboot_test.h | 15 | ||||
-rw-r--r-- | tests/vb2_rsa_utility_tests.c | 1 |
4 files changed, 23 insertions, 15 deletions
diff --git a/firmware/2lib/2rsa.c b/firmware/2lib/2rsa.c index 962558df..dcd8bad0 100644 --- a/firmware/2lib/2rsa.c +++ b/firmware/2lib/2rsa.c @@ -11,6 +11,7 @@ #include "2common.h" #include "2rsa.h" +#include "2rsa_private.h" #include "2sha.h" #include "2sysincludes.h" #include "vboot_test.h" diff --git a/firmware/2lib/include/2rsa_private.h b/firmware/2lib/include/2rsa_private.h new file mode 100644 index 00000000..23a2aaca --- /dev/null +++ b/firmware/2lib/include/2rsa_private.h @@ -0,0 +1,21 @@ +/* Copyright 2021 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. + * + * Internal functions from 2rsa.c that have error conditions we can't trigger + * from the public APIs. These include checks for bad algorithms where the + * next call level up already checks for bad algorithms, etc. + * + * These functions aren't in 2rsa.h because they're not part of the public + * APIs. + */ + +#ifndef VBOOT_REFERENCE_2RSA_PRIVATE_H_ +#define VBOOT_REFERENCE_2RSA_PRIVATE_H_ + +struct vb2_public_key; +int vb2_mont_ge(const struct vb2_public_key *key, uint32_t *a); +vb2_error_t vb2_check_padding(const uint8_t *sig, + const struct vb2_public_key *key); + +#endif /* VBOOT_REFERENCE_2RSA_PRIVATE_H_ */ diff --git a/firmware/lib/include/vboot_test.h b/firmware/lib/include/vboot_test.h index f66cfece..3cfe6377 100644 --- a/firmware/lib/include/vboot_test.h +++ b/firmware/lib/include/vboot_test.h @@ -9,21 +9,6 @@ #define VBOOT_REFERENCE_TEST_API_H_ /**************************************************************************** - * 2rsa.c - * - * Internal functions from 2rsa.c that have error conditions we can't trigger - * from the public APIs. These include checks for bad algorithms where the - * next call level up already checks for bad algorithms, etc. - * - * These functions aren't in 2rsa.h because they're not part of the public - * APIs. - */ -struct vb2_public_key; -int vb2_mont_ge(const struct vb2_public_key *key, uint32_t *a); -vb2_error_t vb2_check_padding(const uint8_t *sig, - const struct vb2_public_key *key); - -/**************************************************************************** * vboot_api_kernel.c */ struct LoadKernelParams; diff --git a/tests/vb2_rsa_utility_tests.c b/tests/vb2_rsa_utility_tests.c index cc856e88..4ad5a95b 100644 --- a/tests/vb2_rsa_utility_tests.c +++ b/tests/vb2_rsa_utility_tests.c @@ -8,6 +8,7 @@ #include "2common.h" #include "2rsa.h" +#include "2rsa_private.h" #include "2sysincludes.h" #include "file_keys.h" #include "rsa_padding_test.h" |