From: Sean Anderson Date: Tue, 16 Feb 2021 12:05:42 -0500 Subject: [PATCH] lib: rsa: Add debug message on algo mismatch In-Reply-To: <314732.1613494869@gemini.denx.de> References: <20210216164016.635125-1-sean.anderson@seco.com> <314732.1613494869@gemini.denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2/16/21 12:01 PM, Wolfgang Denk wrote: > Dear Sean Anderson, > > In message <20210216164016.635125-1-sean.anderson@seco.com> you wrote: >> Currently we fail silently if there is an algorithm mismatch. To help >> distinguish this failure condition. >> >> Signed-off-by: Sean Anderson >> --- >> >> lib/rsa/rsa-verify.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c >> index e34d3293d1..aee76f42d5 100644 >> --- a/lib/rsa/rsa-verify.c >> +++ b/lib/rsa/rsa-verify.c >> @@ -447,8 +447,11 @@ static int rsa_verify_with_keynode(struct image_sign_info *info, >> } >> >> algo = fdt_getprop(blob, node, "algo", NULL); >> - if (strcmp(info->name, algo)) >> + if (strcmp(info->name, algo)) { >> + debug("%s: Wrong algo: have %s, expected %s", __func__, >> + info->name, algo); >> return -EFAULT; >> + } > > If this is considered an error, should that not be a printf() then > instead of a debug() which users will never see? I also thought that, but the much of the rest of this file also uses debug() to report errors. Perhaps there are security implications? Or perhaps it was done to reduce binary size? Simon, can you comment on this? --Sean > > Best regards, > > Wolfgang Denk >