public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] for [BUG] rsa: crash in br_i32_decode() called from rsa_gen_key_prop() (Heinrich Schuchardt)
@ 2020-09-09  7:35 REITHER Robert - Contractor
  2020-09-14 11:05 ` Heinrich Schuchardt
  0 siblings, 1 reply; 2+ messages in thread
From: REITHER Robert - Contractor @ 2020-09-09  7:35 UTC (permalink / raw)
  To: u-boot

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...

robert.reither at external.thalesgroup.com

--- u-boot-master-20200908/lib/rsa/rsa-keyprop.c         2020-09-07 20:17:33.000000000 +0200
+++ mycode/lib/rsa/rsa-keyprop.c         2020-09-08 18:10:59.122022000 +0200
@@ -15,6 +15,7 @@
#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 +24,7 @@
  */
static unsigned br_dec16be(const void *src)
{
-             return be16_to_cpup(src);
+            return get_unaligned_be16(src);
}
 /**
@@ -33,7 +34,7 @@ static unsigned br_dec16be(const void *s
  */
static uint32_t br_dec32be(const void *src)
{
-             return be32_to_cpup(src);
+            return get_unaligned_be32(src);
}
 /**

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-14 11:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-09  7:35 [PATCH] for [BUG] rsa: crash in br_i32_decode() called from rsa_gen_key_prop() (Heinrich Schuchardt) REITHER Robert - Contractor
2020-09-14 11:05 ` Heinrich Schuchardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox