aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Reither <robert.reither@external.thalesgroup.com>2020-09-14 13:12:02 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-09-14 23:28:52 +0200
commit8479333ce7f44ff8cd9f00fbcb8ffa2a5b5763f9 (patch)
tree86b4538d6fac4cffe2b6a60612653bb12ebaba3c /lib
parent00e5fda0063eaa20e9c3f6844ac88c64eb875f23 (diff)
downloadu-boot-8479333ce7f44ff8cd9f00fbcb8ffa2a5b5763f9.zip
u-boot-8479333ce7f44ff8cd9f00fbcb8ffa2a5b5763f9.tar.gz
u-boot-8479333ce7f44ff8cd9f00fbcb8ffa2a5b5763f9.tar.bz2
rsa: crash in br_i32_decode() called from rsa_gen_key_prop()
Fixes problem for unaligned 32bit big-endian access in lib/rsa/rsa-keyprop.c. Exchanges br_i32_decode() with get_unaligned_be32(). This will keep the unaligned access for architectures capable and will do some byte-shift magic for the not so capable ones. Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-by: Robert Reither <robert.reither@external.thalesgroup.com> Remove unused include. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/rsa/rsa-keyprop.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/rsa/rsa-keyprop.c b/lib/rsa/rsa-keyprop.c
index 1e83eed..98855f6 100644
--- a/lib/rsa/rsa-keyprop.c
+++ b/lib/rsa/rsa-keyprop.c
@@ -12,9 +12,9 @@
#include <common.h>
#include <image.h>
#include <malloc.h>
-#include <asm/byteorder.h>
#include <crypto/internal/rsa.h>
#include <u-boot/rsa-mod-exp.h>
+#include <asm/unaligned.h>
/**
* br_dec16be() - Convert 16-bit big-endian integer to native
@@ -23,7 +23,7 @@
*/
static unsigned br_dec16be(const void *src)
{
- return be16_to_cpup(src);
+ return get_unaligned_be16(src);
}
/**
@@ -33,7 +33,7 @@ static unsigned br_dec16be(const void *src)
*/
static uint32_t br_dec32be(const void *src)
{
- return be32_to_cpup(src);
+ return get_unaligned_be32(src);
}
/**