summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2016-01-14 10:52:54 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-01-18 08:24:55 +0100
commit54522f547ff81f45f61e92b150f85591cf857040 (patch)
tree3af7abb7b6f24d1d03374bdaef1efbc3c464ae89
parent53a573c0140118ba4e62f45bd17fae5c378805f7 (diff)
downloadbarebox-54522f547ff81f45f61e92b150f85591cf857040.tar.gz
barebox-54522f547ff81f45f61e92b150f85591cf857040.tar.xz
state: hmac: fix error message that algo is displayed
This patch moves the error message about missing crypto support so that the used crypto algo is printed. Without this patch the algo is always shown as a NULL pointer. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/state.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/state.c b/common/state.c
index d1fa47ffa3..3e95efd911 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1583,6 +1583,10 @@ static int state_backend_raw_file_init_digest(struct state *state, struct state_
if (!p) /* does not exist */
return 0;
+ ret = of_property_read_string(state->root, "algo", &algo);
+ if (ret)
+ return ret;
+
if (!IS_ENABLED(CONFIG_STATE_CRYPTO)) {
dev_err(&state->dev,
"algo %s specified, but crypto support for state framework (CONFIG_STATE_CRYPTO) not enabled.\n",
@@ -1590,10 +1594,6 @@ static int state_backend_raw_file_init_digest(struct state *state, struct state_
return -EINVAL;
}
- ret = of_property_read_string(state->root, "algo", &algo);
- if (ret)
- return ret;
-
ret = keystore_get_secret(state->name, &key, &key_len);
if (ret == -ENOENT) /* -ENOENT == does not exist */
return -EPROBE_DEFER;