summaryrefslogtreecommitdiff
path: root/common/autoboot.c
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2019-07-29 07:23:19 +0200
committerTom Rini <trini@konsulko.com>2019-08-07 15:31:02 -0400
commitecaae801d63bc0549ca681608ba787d96faeb322 (patch)
treefd1069c0e87a528e92998933835fa22d2f70cf1a /common/autoboot.c
parentb236f8c086b38a3e43bd57ed3364ab691d47c73f (diff)
autoboot: fix bug using with CAAM and AUTOBOOT_ENCRYPTION
if CONFIG_AUTOBOOT_KEYED, CONFIG_AUTOBOOT_ENCRYPTION and CONFIG_AUTOBOOT_STOP_STR_SHA256 are enabled in conjunction with CONFIG_SHA_HW_ACCEL and CONFIG_FSL_CAAM, we get the Error when pressing a key while waiting for bootdelay: Error: Address arguments are not aligned CAAM was not setup properly or it is faulty Reason is, that used variables are not cache aligned, so malloc this variables cache aligned. Probably this is also a bugfix for other hw accelerators than CAAM. Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'common/autoboot.c')
-rw-r--r--common/autoboot.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/common/autoboot.c b/common/autoboot.c
index 42fbd7614a..7a91736a00 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -11,6 +11,7 @@
#include <console.h>
#include <fdtdec.h>
#include <hash.h>
+#include <memalign.h>
#include <menu.h>
#include <post.h>
#include <u-boot/sha256.h>
@@ -71,8 +72,8 @@ static int passwd_abort_sha256(uint64_t etime)
{
const char *sha_env_str = env_get("bootstopkeysha256");
u8 sha_env[SHA256_SUM_LEN];
- u8 sha[SHA256_SUM_LEN];
- char presskey[MAX_DELAY_STOP_STR];
+ u8 *sha;
+ char *presskey;
const char *algo_name = "sha256";
u_int presskey_len = 0;
int abort = 0;
@@ -93,6 +94,9 @@ static int passwd_abort_sha256(uint64_t etime)
return 0;
}
+ presskey = malloc_cache_aligned(MAX_DELAY_STOP_STR);
+ sha = malloc_cache_aligned(SHA256_SUM_LEN);
+ size = SHA256_SUM_LEN;
/*
* We don't know how long the stop-string is, so we need to
* generate the sha256 hash upon each input character and
@@ -101,8 +105,11 @@ static int passwd_abort_sha256(uint64_t etime)
do {
if (tstc()) {
/* Check for input string overflow */
- if (presskey_len >= MAX_DELAY_STOP_STR)
+ if (presskey_len >= MAX_DELAY_STOP_STR) {
+ free(presskey);
+ free(sha);
return 0;
+ }
presskey[presskey_len++] = getc();
@@ -116,6 +123,8 @@ static int passwd_abort_sha256(uint64_t etime)
}
} while (!abort && get_ticks() <= etime);
+ free(presskey);
+ free(sha);
return abort;
}