fileio: Unify whole-file reads

We do whole-file reads in a few places, so unify to a fileio_read_file()
function.

To do this, we change the type of struct image->buf to a uint8_t *.
Where we do pointer manipulation on the image buffer, we need a
temporary void * variable.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
Jeremy Kerr 2012-08-03 11:12:06 +08:00
parent d19b993024
commit 6e4b3edcfb
7 changed files with 88 additions and 156 deletions

View file

@ -32,11 +32,16 @@
#ifndef FILEIO_H
#define FILEIO_H
#include <stdint.h>
#include <openssl/evp.h>
#include <openssl/x509.h>
EVP_PKEY *fileio_read_pkey(const char *filename);
X509 *fileio_read_cert(const char *filename);
int fileio_read_file(void *ctx, const char *filename,
uint8_t **out_buf, size_t *out_len);
#endif /* FILEIO_H */