diff options
Diffstat (limited to 'host/lib/file_keys.c')
-rw-r--r-- | host/lib/file_keys.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/host/lib/file_keys.c b/host/lib/file_keys.c index 00fbe6f5..24c794f1 100644 --- a/host/lib/file_keys.c +++ b/host/lib/file_keys.c @@ -22,55 +22,6 @@ #include "host_common.h" #include "signature_digest.h" -uint8_t *BufferFromFile(const char* input_file, uint64_t* len) -{ - int fd; - struct stat stat_fd; - uint8_t* buf = NULL; - - if ((fd = open(input_file, O_RDONLY)) == -1) { - VBDEBUG(("Couldn't open file %s\n", input_file)); - return NULL; - } - - if (-1 == fstat(fd, &stat_fd)) { - VBDEBUG(("Couldn't stat file %s\n", input_file)); - close(fd); - return NULL; - } - *len = stat_fd.st_size; - - buf = (uint8_t *)malloc(*len); - if (!buf) { - VbExError("Couldn't allocate %ld bytes for file %s\n", - *len, input_file); - close(fd); - return NULL; - } - - if (*len != read(fd, buf, *len)) { - VBDEBUG(("Couldn't read file %s into a buffer\n", input_file)); - free(buf); - close(fd); - return NULL; - } - - close(fd); - return buf; -} - -RSAPublicKey *RSAPublicKeyFromFile(const char *input_file) -{ - uint64_t len; - RSAPublicKey* key = NULL; - - uint8_t *buf = BufferFromFile(input_file, &len); - if (buf) - key = RSAPublicKeyFromBuf(buf, len); - free(buf); - return key; -} - int DigestFile(char *input_file, enum vb2_hash_algorithm alg, uint8_t *digest, uint32_t digest_size) { |