From: REITHER Robert - Contractor <robert.reither@external.thalesgroup.com>
To: u-boot@lists.denx.de
Subject: [PATCH] for [BUG] rsa: crash in br_i32_decode() called from rsa_gen_key_prop() (Heinrich Schuchardt)
Date: Wed, 9 Sep 2020 07:35:57 +0000 [thread overview]
Message-ID: <dda03210b10945039341dd1bde1cec92@external.thalesgroup.com> (raw)
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);
}
/**
next reply other threads:[~2020-09-09 7:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 7:35 REITHER Robert - Contractor [this message]
2020-09-14 11:05 ` [PATCH] for [BUG] rsa: crash in br_i32_decode() called from rsa_gen_key_prop() (Heinrich Schuchardt) Heinrich Schuchardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dda03210b10945039341dd1bde1cec92@external.thalesgroup.com \
--to=robert.reither@external.thalesgroup.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox