From: "Heiko Stübner" <heiko@sntech.de>
To: u-boot@lists.denx.de
Subject: [PATCH v5 4/8] lib: rsa: fix allocated size for rr and rrtmp in rsa_gen_key_prop()
Date: Mon, 25 May 2020 19:18:08 +0200 [thread overview]
Message-ID: <14768968.1T0FKZa6J5@diego> (raw)
In-Reply-To: <20200522141937.3523692-4-heiko@sntech.de>
Am Freitag, 22. Mai 2020, 16:19:33 CEST schrieb Heiko Stuebner:
> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>
> When calculating rrtmp/rr rsa_gen_key_prop() tries to make
> (((rlen + 31) >> 5) + 1) steps in the rr uint32_t array and
> (((rlen + 7) >> 3) + 1) / 4 steps in uint32_t rrtmp[]
> with rlen being num_bits * 2
>
> On a 4096bit key this comes down to to 257 uint32_t elements
> in rr and 256 elements in rrtmp but with the current allocation
> rr and rrtmp only have 129 uint32_t elements.
>
> On 2048bit keys this works by chance as the defined max_rsa_size=4096
> allocates a suitable number of elements, but with an actual 4096bit key
> this results in other memory parts getting overwritten.
>
> so double the number of elements in rr and rrtmp so that it matches
> the needed number and should increase nicely if max_rsa_size gets
> increased in the future.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
transplanting a tag from v4:
Reviewed-by: Simon Glass <sjg@chromium.org>
next prev parent reply other threads:[~2020-05-25 17:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-22 14:19 [PATCH v5 1/8] lib: rsa: distinguish between tpl and spl for CONFIG_RSA_VERIFY Heiko Stuebner
2020-05-22 14:19 ` [PATCH v5 2/8] lib: rsa: take spl/non-spl into account when building rsa_verify_with_pkey() Heiko Stuebner
2020-05-25 17:18 ` Heiko Stübner
2020-05-22 14:19 ` [PATCH v5 3/8] lib: rsa: bring exp_len in line when generating a key_prop Heiko Stuebner
2020-05-25 17:18 ` Heiko Stübner
2020-05-22 14:19 ` [PATCH v5 4/8] lib: rsa: fix allocated size for rr and rrtmp in rsa_gen_key_prop() Heiko Stuebner
2020-05-25 17:18 ` Heiko Stübner [this message]
2020-05-25 20:43 ` Philipp Tomsich
2020-06-09 10:18 ` Heinrich Schuchardt
2020-05-22 14:19 ` [PATCH v5 5/8] lib: rsa: free local arrays after use " Heiko Stuebner
2020-05-25 17:18 ` Heiko Stübner
2020-05-22 14:19 ` [PATCH v5 6/8] lib: rsa: add documentation to padding_pss_verify to document limitations Heiko Stuebner
2020-05-25 17:18 ` Heiko Stübner
2020-05-22 14:19 ` [PATCH v5 7/8] spl: fit: select SPL_HASH_SUPPORT for SPL_FIT_SIGNATURE Heiko Stuebner
2020-05-22 14:19 ` [PATCH v5 8/8] spl: fit: select SPL_CRYPTO_SUPPORT " Heiko Stuebner
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=14768968.1T0FKZa6J5@diego \
--to=heiko@sntech.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.