| 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;
|
|
|