lib: rsa: Leverage existing data buffer instead of systematic copy
authorSESA644425 <giojahermann@gmail.com>
Wed, 9 Mar 2022 09:27:16 +0000 (01:27 -0800)
committerTom Rini <trini@konsulko.com>
Mon, 11 Apr 2022 15:39:19 +0000 (11:39 -0400)
commitfb7330545e08876e26dae155f6f6d6788e4a102e
tree921c215b4c036e8d780a1a518427a3a2a59a1349
parentc755aa8a1dc2f2b819ce36148248ebe93bbc7f86
lib: rsa: Leverage existing data buffer instead of systematic copy

Prior to introduction of modifications in rsassa_pss functions
related to padding verification, doing a pass to reduce memory
consumption of function by replacing memory copies of parts of
const buffer by pointers to the original buffer (masked_db and
h are subparts of msg buffer which is declared const, salt is a
subpart of db which is a working buffer, unmodified after being
filled). New pointers scope is limited to the function where
they are declared (not returned to caller by any mean), zeroing
risk of memory fault related to the change.

Signed-off-by: SESA644425 <gioja.hermann@non.se.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
lib/rsa/rsa-verify.c