summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2016-10-18 13:55:19 -0700
committerRandall Spangler <rspangler@chromium.org>2016-11-06 02:33:19 +0000
commit13c0776aabc152ba5e8fc758a56fc6e92d746bc5 (patch)
tree8d1bc3578afa931967190c22ba78f245f118b089
parent46a382d6136f2fd206fd8c95180dbb816c9ad5ce (diff)
downloadvboot-13c0776aabc152ba5e8fc758a56fc6e92d746bc5.tar.gz
vboot: Remove the remainder of vb1 cryptolib
At this point, all that's left are a few constants in the cryptolib header files, and they're only used by host-side code. So move them to a host-side header file and get rid of cryptolib. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: I2235f0e84e13fef313afe54e749b73744b157884 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/400903 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--cgpt/cgpt_wrapper.c1
-rw-r--r--firmware/lib/cryptolib/README3
-rw-r--r--firmware/lib/cryptolib/include/cryptolib.h13
-rw-r--r--firmware/lib/cryptolib/include/rsa.h20
-rw-r--r--firmware/lib/include/vboot_common.h1
-rw-r--r--futility/cmd_vbutil_firmware.c1
-rw-r--r--futility/cmd_vbutil_key.c2
-rw-r--r--futility/cmd_vbutil_keyblock.c1
-rw-r--r--futility/ryu_root_header.c1
-rw-r--r--host/lib/file_keys.c1
-rw-r--r--host/lib/host_common.c1
-rw-r--r--host/lib/host_key.c2
-rw-r--r--host/lib/host_key2.c1
-rw-r--r--host/lib/host_keyblock.c1
-rw-r--r--host/lib/host_misc.c1
-rw-r--r--host/lib/host_signature2.c1
-rw-r--r--host/lib/include/file_keys.h1
-rw-r--r--host/lib/include/host_common.h1
-rw-r--r--host/lib/include/host_signature.h1
-rw-r--r--host/lib/signature_digest.c1
-rw-r--r--host/lib/util_misc.c1
-rw-r--r--tests/rsa_padding_test.h5
-rw-r--r--tests/sha_benchmark.c2
-rw-r--r--tests/sha_tests.c1
-rw-r--r--tests/test_common.c6
-rw-r--r--tests/vb20_rsa_padding_tests.c1
-rw-r--r--tests/vb2_nvstorage_tests.c2
-rw-r--r--tests/vb2_rsa_utility_tests.c8
-rw-r--r--tests/vb2_secdata_tests.c2
-rw-r--r--tests/vb2_secdatak_tests.c2
-rw-r--r--tests/vboot_kernel_tests.c1
-rw-r--r--utility/verify_data.c1
32 files changed, 15 insertions, 72 deletions
diff --git a/cgpt/cgpt_wrapper.c b/cgpt/cgpt_wrapper.c
index f8dc2f4f..e7ac6bf3 100644
--- a/cgpt/cgpt_wrapper.c
+++ b/cgpt/cgpt_wrapper.c
@@ -28,7 +28,6 @@
#include "2sha.h"
#include "cgpt.h"
#include "cgpt_nor.h"
-#include "cryptolib.h"
#include "file_keys.h"
// Check if cmdline |argv| has "-D". "-D" signifies that GPT structs are stored
diff --git a/firmware/lib/cryptolib/README b/firmware/lib/cryptolib/README
deleted file mode 100644
index e576bb7b..00000000
--- a/firmware/lib/cryptolib/README
+++ /dev/null
@@ -1,3 +0,0 @@
-This contains the implementation for the crypto library. This includes
-implementations for SHA1, SHA256, SHA512, and RSA signature verification
-(for PKCS #1 v1.5 signatures).
diff --git a/firmware/lib/cryptolib/include/cryptolib.h b/firmware/lib/cryptolib/include/cryptolib.h
deleted file mode 100644
index 7cdfdea0..00000000
--- a/firmware/lib/cryptolib/include/cryptolib.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Copyright (c) 2010 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.
- *
- * Firmware Cryptolib includes.
- */
-
-#ifndef VBOOT_REFERENCE_CRYPTOLIB_H_
-#define VBOOT_REFERENCE_CRYPTOLIB_H_
-
-#include "rsa.h"
-
-#endif /* VBOOT_REFERENCE_CRYPTOLIB_H_ */
diff --git a/firmware/lib/cryptolib/include/rsa.h b/firmware/lib/cryptolib/include/rsa.h
deleted file mode 100644
index 8ea7f889..00000000
--- a/firmware/lib/cryptolib/include/rsa.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (c) 2010 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.
- */
-
-#ifndef VBOOT_REFERENCE_RSA_H_
-#define VBOOT_REFERENCE_RSA_H_
-
-#ifndef VBOOT_REFERENCE_CRYPTOLIB_H_
-#error "Do not include this file directly. Use cryptolib.h instead."
-#endif
-
-#include "sysincludes.h"
-
-#define RSA1024NUMBYTES 128 /* 1024 bit key length */
-#define RSA2048NUMBYTES 256 /* 2048 bit key length */
-#define RSA4096NUMBYTES 512 /* 4096 bit key length */
-#define RSA8192NUMBYTES 1024 /* 8192 bit key length */
-
-#endif /* VBOOT_REFERENCE_RSA_H_ */
diff --git a/firmware/lib/include/vboot_common.h b/firmware/lib/include/vboot_common.h
index 762448bb..88bcb631 100644
--- a/firmware/lib/include/vboot_common.h
+++ b/firmware/lib/include/vboot_common.h
@@ -8,7 +8,6 @@
#ifndef VBOOT_REFERENCE_VBOOT_COMMON_H_
#define VBOOT_REFERENCE_VBOOT_COMMON_H_
-#include "cryptolib.h"
#include "vboot_struct.h"
#ifndef ARRAY_SIZE
diff --git a/futility/cmd_vbutil_firmware.c b/futility/cmd_vbutil_firmware.c
index 242dfc21..3bf3492b 100644
--- a/futility/cmd_vbutil_firmware.c
+++ b/futility/cmd_vbutil_firmware.c
@@ -16,7 +16,6 @@
#include "2api.h"
#include "2common.h"
#include "2rsa.h"
-#include "cryptolib.h"
#include "futility.h"
#include "host_common.h"
#include "host_key2.h"
diff --git a/futility/cmd_vbutil_key.c b/futility/cmd_vbutil_key.c
index 15aa9edc..27e601ed 100644
--- a/futility/cmd_vbutil_key.c
+++ b/futility/cmd_vbutil_key.c
@@ -12,8 +12,6 @@
#include <stdlib.h>
#include <string.h>
-
-#include "cryptolib.h"
#include "futility.h"
#include "host_common.h"
#include "host_key2.h"
diff --git a/futility/cmd_vbutil_keyblock.c b/futility/cmd_vbutil_keyblock.c
index 18cf63ab..bb8d62ac 100644
--- a/futility/cmd_vbutil_keyblock.c
+++ b/futility/cmd_vbutil_keyblock.c
@@ -14,7 +14,6 @@
#include "2sysincludes.h"
#include "2common.h"
#include "2rsa.h"
-#include "cryptolib.h"
#include "futility.h"
#include "host_common.h"
#include "host_key2.h"
diff --git a/futility/ryu_root_header.c b/futility/ryu_root_header.c
index 0797d7bc..1865b75c 100644
--- a/futility/ryu_root_header.c
+++ b/futility/ryu_root_header.c
@@ -18,7 +18,6 @@
#include "2sysincludes.h"
#include "2common.h"
#include "2sha.h"
-#include "cryptolib.h"
#include "futility.h"
#include "gbb_header.h"
diff --git a/host/lib/file_keys.c b/host/lib/file_keys.c
index 24c794f1..0aba6b86 100644
--- a/host/lib/file_keys.c
+++ b/host/lib/file_keys.c
@@ -17,7 +17,6 @@
#include "2common.h"
#include "2sha.h"
-#include "cryptolib.h"
#include "file_keys.h"
#include "host_common.h"
#include "signature_digest.h"
diff --git a/host/lib/host_common.c b/host/lib/host_common.c
index a741fd96..c3ba044e 100644
--- a/host/lib/host_common.c
+++ b/host/lib/host_common.c
@@ -12,7 +12,6 @@
#include "2rsa.h"
#include "host_common.h"
#include "host_key2.h"
-#include "cryptolib.h"
#include "utility.h"
#include "vb2_common.h"
#include "vboot_common.h"
diff --git a/host/lib/host_key.c b/host/lib/host_key.c
index c0a0fdd6..10efc766 100644
--- a/host/lib/host_key.c
+++ b/host/lib/host_key.c
@@ -17,9 +17,7 @@
#include "2common.h"
#include "2rsa.h"
#include "2sha.h"
-#include "cryptolib.h"
#include "host_common.h"
-#include "host_key.h"
#include "host_misc.h"
#include "vb2_common.h"
#include "vboot_common.h"
diff --git a/host/lib/host_key2.c b/host/lib/host_key2.c
index 7e505761..302bffee 100644
--- a/host/lib/host_key2.c
+++ b/host/lib/host_key2.c
@@ -17,7 +17,6 @@
#include "2common.h"
#include "2rsa.h"
#include "2sha.h"
-#include "cryptolib.h"
#include "host_common.h"
#include "host_key.h"
#include "host_key2.h"
diff --git a/host/lib/host_keyblock.c b/host/lib/host_keyblock.c
index dde8fe6c..fad17df4 100644
--- a/host/lib/host_keyblock.c
+++ b/host/lib/host_keyblock.c
@@ -13,7 +13,6 @@
#include "2common.h"
#include "2rsa.h"
#include "2sha.h"
-#include "cryptolib.h"
#include "host_common.h"
#include "host_key.h"
#include "host_key2.h"
diff --git a/host/lib/host_misc.c b/host/lib/host_misc.c
index 03d05664..611253b9 100644
--- a/host/lib/host_misc.c
+++ b/host/lib/host_misc.c
@@ -12,7 +12,6 @@
#include <string.h>
#include <unistd.h>
-#include "cryptolib.h"
#include "host_common.h"
#include "vboot_common.h"
diff --git a/host/lib/host_signature2.c b/host/lib/host_signature2.c
index 8925e6a7..a9d0f44f 100644
--- a/host/lib/host_signature2.c
+++ b/host/lib/host_signature2.c
@@ -18,7 +18,6 @@
#include "2common.h"
#include "2rsa.h"
#include "2sha.h"
-#include "cryptolib.h"
#include "file_keys.h"
#include "host_common.h"
#include "host_key2.h"
diff --git a/host/lib/include/file_keys.h b/host/lib/include/file_keys.h
index 0879c311..b4bdd322 100644
--- a/host/lib/include/file_keys.h
+++ b/host/lib/include/file_keys.h
@@ -8,7 +8,6 @@
#ifndef VBOOT_REFERENCE_FILE_KEYS_H_
#define VBOOT_REFERENCE_FILE_KEYS_H_
-#include "cryptolib.h"
#include "2sha.h"
/* Calculates the appropriate digest for the data in [input_file] based on the
diff --git a/host/lib/include/host_common.h b/host/lib/include/host_common.h
index 8c14942e..7a347a8f 100644
--- a/host/lib/include/host_common.h
+++ b/host/lib/include/host_common.h
@@ -14,7 +14,6 @@
*/
#define _STUB_IMPLEMENTATION_
-#include "cryptolib.h"
#include "host_key.h"
#include "host_key2.h"
#include "host_keyblock.h"
diff --git a/host/lib/include/host_signature.h b/host/lib/include/host_signature.h
index 4fb94d60..fce664da 100644
--- a/host/lib/include/host_signature.h
+++ b/host/lib/include/host_signature.h
@@ -8,7 +8,6 @@
#ifndef VBOOT_REFERENCE_HOST_SIGNATURE_H_
#define VBOOT_REFERENCE_HOST_SIGNATURE_H_
-#include "cryptolib.h"
#include "host_key.h"
#include "utility.h"
#include "vboot_struct.h"
diff --git a/host/lib/signature_digest.c b/host/lib/signature_digest.c
index 2050d4a4..d56b05be 100644
--- a/host/lib/signature_digest.c
+++ b/host/lib/signature_digest.c
@@ -14,7 +14,6 @@
#include "2common.h"
#include "2rsa.h"
#include "2sha.h"
-#include "cryptolib.h"
#include "host_common.h"
#include "host_signature2.h"
#include "signature_digest.h"
diff --git a/host/lib/util_misc.c b/host/lib/util_misc.c
index 56d21b38..95acecb9 100644
--- a/host/lib/util_misc.c
+++ b/host/lib/util_misc.c
@@ -17,7 +17,6 @@
#include "2common.h"
#include "2sha.h"
-#include "cryptolib.h"
#include "host_common.h"
#include "util_misc.h"
#include "vb2_common.h"
diff --git a/tests/rsa_padding_test.h b/tests/rsa_padding_test.h
index ce1ab247..18bccd8c 100644
--- a/tests/rsa_padding_test.h
+++ b/tests/rsa_padding_test.h
@@ -12,7 +12,10 @@
#ifndef VBOOT_REFERENCE_RSA_PADDING_TEST_H_
#define VBOOT_REFERENCE_RSA_PADDING_TEST_H_
-#include "cryptolib.h"
+#define RSA1024NUMBYTES 128 /* 1024 bit key length */
+#define RSA2048NUMBYTES 256 /* 2048 bit key length */
+#define RSA4096NUMBYTES 512 /* 4096 bit key length */
+#define RSA8192NUMBYTES 1024 /* 8192 bit key length */
/* The modulus of the public key (RSA-1024). */
static const uint8_t pubkey_n[] = {
diff --git a/tests/sha_benchmark.c b/tests/sha_benchmark.c
index 49ff829f..fadcb6bc 100644
--- a/tests/sha_benchmark.c
+++ b/tests/sha_benchmark.c
@@ -10,8 +10,6 @@
#include "2sysincludes.h"
#include "2common.h"
#include "2sha.h"
-
-#include "cryptolib.h"
#include "host_common.h"
#include "timer_utils.h"
diff --git a/tests/sha_tests.c b/tests/sha_tests.c
index ad85b9ea..40d3749f 100644
--- a/tests/sha_tests.c
+++ b/tests/sha_tests.c
@@ -10,7 +10,6 @@
#include <stdlib.h>
#include <string.h>
-#include "cryptolib.h"
#include "sha_test_vectors.h"
int SHA1_tests(void) {
diff --git a/tests/test_common.c b/tests/test_common.c
index 0a76ccdd..972a3ffe 100644
--- a/tests/test_common.c
+++ b/tests/test_common.c
@@ -5,15 +5,11 @@
* Common functions used by tests.
*/
-#include "test_common.h"
-
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include "cryptolib.h"
-#include "file_keys.h"
-#include "utility.h"
+#include "test_common.h"
/* Global test success flag. */
int gTestSuccess = 1;
diff --git a/tests/vb20_rsa_padding_tests.c b/tests/vb20_rsa_padding_tests.c
index a70da58c..c506572d 100644
--- a/tests/vb20_rsa_padding_tests.c
+++ b/tests/vb20_rsa_padding_tests.c
@@ -9,7 +9,6 @@
#define _STUB_IMPLEMENTATION_
-#include "cryptolib.h"
#include "file_keys.h"
#include "rsa_padding_test.h"
#include "test_common.h"
diff --git a/tests/vb2_nvstorage_tests.c b/tests/vb2_nvstorage_tests.c
index 45dd7b5e..2056f101 100644
--- a/tests/vb2_nvstorage_tests.c
+++ b/tests/vb2_nvstorage_tests.c
@@ -10,6 +10,8 @@
#include <stdlib.h>
#include <string.h>
+#include "2sysincludes.h"
+
#include "test_common.h"
#include "vboot_common.h"
diff --git a/tests/vb2_rsa_utility_tests.c b/tests/vb2_rsa_utility_tests.c
index df603272..9fe1b7e1 100644
--- a/tests/vb2_rsa_utility_tests.c
+++ b/tests/vb2_rsa_utility_tests.c
@@ -9,16 +9,16 @@
#define _STUB_IMPLEMENTATION_
-#include "cryptolib.h"
+#include "2sysincludes.h"
+
+#include "2common.h"
+#include "2rsa.h"
#include "file_keys.h"
#include "rsa_padding_test.h"
#include "test_common.h"
#include "utility.h"
#include "vboot_api.h"
-#include "2common.h"
-#include "2rsa.h"
-
/*
* 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
diff --git a/tests/vb2_secdata_tests.c b/tests/vb2_secdata_tests.c
index b8ffafaa..1abfcb2e 100644
--- a/tests/vb2_secdata_tests.c
+++ b/tests/vb2_secdata_tests.c
@@ -10,6 +10,8 @@
#include <stdlib.h>
#include <string.h>
+#include "2sysincludes.h"
+
#include "test_common.h"
#include "vboot_common.h"
diff --git a/tests/vb2_secdatak_tests.c b/tests/vb2_secdatak_tests.c
index 1aa059ed..4bc15cf9 100644
--- a/tests/vb2_secdatak_tests.c
+++ b/tests/vb2_secdatak_tests.c
@@ -10,6 +10,8 @@
#include <stdlib.h>
#include <string.h>
+#include "2sysincludes.h"
+
#include "test_common.h"
#include "vboot_common.h"
diff --git a/tests/vboot_kernel_tests.c b/tests/vboot_kernel_tests.c
index 994b792c..dfb66195 100644
--- a/tests/vboot_kernel_tests.c
+++ b/tests/vboot_kernel_tests.c
@@ -16,7 +16,6 @@
#include "cgptlib.h"
#include "cgptlib_internal.h"
#include "crc32.h"
-#include "cryptolib.h"
#include "gbb_header.h"
#include "gpt.h"
#include "host_common.h"
diff --git a/utility/verify_data.c b/utility/verify_data.c
index d160809b..74a11fc4 100644
--- a/utility/verify_data.c
+++ b/utility/verify_data.c
@@ -22,7 +22,6 @@
#include "2common.h"
#include "2sha.h"
#include "2rsa.h"
-#include "cryptolib.h"
#include "file_keys.h"
#include "host_common.h"
#include "vb2_common.h"