Message ID | 20210828101305.125966-1-xypron.glpk@gmx.de |
---|---|
State | Accepted |
Commit | d607dfd878700648a7cc07ab40b2faf77df29acd |
Delegated to: | Tom Rini |
Headers | show |
Series | [1/1] lib/rsa: don't use NULL as key_id | expand |
On Sat, 28 Aug 2021 at 04:13, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote: > > If keydir is not provided but name is we want to use name as key_id. > > But with the current coding name is only used on its own if it is NULL > and keydir is provided which never occurs. > > Fixes: 824ee745fbca ("lib/rsa: Use the 'keyfile' argument from mkimage") > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > --- > lib/rsa/rsa-sign.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Reviewed-by: Simon Glass <sjg@chromium.org> > diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c > index 085dc89bf7..0e0a890fd1 100644 > --- a/lib/rsa/rsa-sign.c > +++ b/lib/rsa/rsa-sign.c > @@ -269,7 +269,7 @@ static int rsa_engine_get_priv_key(const char *keydir, const char *name, > snprintf(key_id, sizeof(key_id), > "%s%s", > keydir, name); > - else if (keydir) > + else if (name) > snprintf(key_id, sizeof(key_id), > "%s", > name); > -- > 2.30.2 >
On Sat, Aug 28, 2021 at 12:13:05PM +0200, Heinrich Schuchardt wrote: > If keydir is not provided but name is we want to use name as key_id. > > But with the current coding name is only used on its own if it is NULL > and keydir is provided which never occurs. > > Fixes: 824ee745fbca ("lib/rsa: Use the 'keyfile' argument from mkimage") > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot/master, thanks!
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index 085dc89bf7..0e0a890fd1 100644 --- a/lib/rsa/rsa-sign.c +++ b/lib/rsa/rsa-sign.c @@ -269,7 +269,7 @@ static int rsa_engine_get_priv_key(const char *keydir, const char *name, snprintf(key_id, sizeof(key_id), "%s%s", keydir, name); - else if (keydir) + else if (name) snprintf(key_id, sizeof(key_id), "%s", name);
If keydir is not provided but name is we want to use name as key_id. But with the current coding name is only used on its own if it is NULL and keydir is provided which never occurs. Fixes: 824ee745fbca ("lib/rsa: Use the 'keyfile' argument from mkimage") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> --- lib/rsa/rsa-sign.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.30.2