summaryrefslogtreecommitdiffstats
path: root/common/state/backend_format_raw.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-27 10:14:38 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-31 18:43:53 +0200
commit0c7436753c73e71ee512e5ed8029e7ccceedcd89 (patch)
treecc1524b0abc4c016968cef8989408f0680eed548 /common/state/backend_format_raw.c
parenta081eb840ed12eff6256a5497771a8c3168fc95b (diff)
downloadbarebox-0c7436753c73e71ee512e5ed8029e7ccceedcd89.tar.gz
state: Allow to load without authentification
Sometimes it's useful to be able to load a state even when it can't be authentificated. Add an option for this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/state/backend_format_raw.c')
-rw-r--r--common/state/backend_format_raw.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/state/backend_format_raw.c b/common/state/backend_format_raw.c
index 43a5523..232856a 100644
--- a/common/state/backend_format_raw.c
+++ b/common/state/backend_format_raw.c
@@ -96,7 +96,7 @@ static int backend_raw_digest_init(struct state_backend_format_raw *raw)
static int backend_format_raw_verify(struct state_backend_format *format,
uint32_t magic, const void * buf,
- ssize_t *lenp)
+ ssize_t *lenp, enum state_flags flags)
{
uint32_t crc;
struct backend_raw_header *header;
@@ -127,7 +127,7 @@ static int backend_format_raw_verify(struct state_backend_format *format,
return -EINVAL;
}
- if (backend_raw->algo) {
+ if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTIFICATION)) {
ret = backend_raw_digest_init(backend_raw);
if (ret)
return ret;
@@ -153,7 +153,7 @@ static int backend_format_raw_verify(struct state_backend_format *format,
*lenp = header->data_len + sizeof(*header);
- if (backend_raw->algo) {
+ if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTIFICATION)) {
const void *hmac = data + header->data_len;
/* hmac over header and data */