]> git.dujemihanovic.xyz Git - linux.git/commit
sign-file: Fix incorrect return values check
authorYusong Gao <a869920004@gmail.com>
Wed, 13 Dec 2023 10:31:10 +0000 (10:31 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Dec 2023 20:55:11 +0000 (12:55 -0800)
commit829649443e78d85db0cff0c37cadb28fbb1a5f6f
tree75edd02e0d70c777c8f7b12d569f789815520691
parent5bd7ef53ffe5ca580e93e74eb8c81ed191ddc4bd
sign-file: Fix incorrect return values check

There are some wrong return values check in sign-file when call OpenSSL
API. The ERR() check cond is wrong because of the program only check the
return value is < 0 which ignored the return val is 0. For example:
1. CMS_final() return 1 for success or 0 for failure.
2. i2d_CMS_bio_stream() returns 1 for success or 0 for failure.
3. i2d_TYPEbio() return 1 for success and 0 for failure.
4. BIO_free() return 1 for success and 0 for failure.

Link: https://www.openssl.org/docs/manmaster/man3/
Fixes: e5a2e3c84782 ("scripts/sign-file.c: Add support for signing with a raw signature")
Signed-off-by: Yusong Gao <a869920004@gmail.com>
Reviewed-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20231213024405.624692-1-a869920004@gmail.com/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/sign-file.c