Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: src/platform/vboot_reference/utils/verify_data.c

Issue 564020: Data structure and interface for manipulating and handing firmware images for verified boot. (Closed)
Patch Set: Fix spaces etc. Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/vboot_reference/utils/firmware_utility.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/vboot_reference/utils/verify_data.c
diff --git a/src/platform/vboot_reference/utils/verify_data.c b/src/platform/vboot_reference/utils/verify_data.c
index 05399b1881b4240047bd3f457c37be60ed80ceb7..fd5bb8715b94b37039339a14f3c0f818562d5fe6 100644
--- a/src/platform/vboot_reference/utils/verify_data.c
+++ b/src/platform/vboot_reference/utils/verify_data.c
@@ -15,43 +15,13 @@
#include <sys/types.h>
#include <unistd.h>
+#include "file_keys.h"
#include "sha_utility.h"
#include "padding.h"
#include "rsa.h"
#include "rsa_utility.h"
#include "verify_data.h"
-RSAPublicKey* read_RSAkey(char* input_file) {
- int key_fd;
- int buf_len;
- struct stat stat_fd;
- uint8_t* buf = NULL;
-
- if ((key_fd = open(input_file, O_RDONLY)) == -1) {
- fprintf(stderr, "Couldn't open pre-processed key file\n");
- return NULL;
- }
-
- if (-1 == fstat(key_fd, &stat_fd)) {
- fprintf(stderr, "Couldn't stat key file\n");
- return NULL;
- }
- buf_len = stat_fd.st_size;
-
- /* Read entire key binary blob into a buffer. */
- buf = (uint8_t*) malloc(buf_len);
- if (!buf)
- return NULL;
-
- if (buf_len != read(key_fd, buf, buf_len)) {
- fprintf(stderr, "Couldn't read key into a buffer.\n");
- return NULL;
- }
-
- close(key_fd);
- return RSAPublicKeyFromBuf(buf, buf_len);
-}
-
uint8_t* read_signature(char* input_file, int len) {
int i, sigfd;
uint8_t* signature = NULL;
@@ -101,7 +71,7 @@ int main(int argc, char* argv[]) {
/* Length of the RSA Signature/RSA Key */
sig_len = siglen_map[algorithm] * sizeof(uint32_t);
- if (!(key = read_RSAkey(argv[2])))
+ if (!(key = RSAPublicKeyFromFile(argv[2])))
goto failure;
if (!(signature = read_signature(argv[3], sig_len)))
goto failure;
« no previous file with comments | « src/platform/vboot_reference/utils/firmware_utility.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698