sign-file: simplify main function implementation
Subsystems (2)
PATCH 1/1 sign-file: simplify main function implementation
use_signed_attrs is an unnecessary variable, deleting this variable can simplify the code.
--- scripts/sign-file.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
scripts/sign-file.c +2 -10
@@ -224,7 +224,6 @@ int main(int argc, char **argv)bool raw_sig = false;unsigned char buf[4096 ];unsigned long module_size, sig_size; -unsigned int use_signed_attrs;const EVP_MD *digest_algo;EVP_PKEY *private_key;#ifndef USE_PKCS7
@@ -242,12 +241,6 @@ int main(int argc, char **argv) key_pass =getenv ("KBUILD_SIGN_PIN" ); -#ifndef USE_PKCS7 - use_signed_attrs =CMS_NOATTR ; -#else - use_signed_attrs =PKCS7_NOATTR ; -#endif - do { opt = getopt(argc, argv, "sdpk"); switch (opt) {
@@ -340,8 +333,7 @@ int main(int argc, char **argv)ERR (!CMS_add1_signer (cms, x509, private_key, digest_algo,CMS_NOCERTS |CMS_BINARY | -CMS_NOSMIMECAP | use_keyid | - use_signed_attrs), +CMS_NOSMIMECAP |CMS_NOATTR | use_keyid),"CMS_add1_signer" );ERR (CMS_final (cms, bm,NULL ,CMS_NOCERTS |CMS_BINARY ) <0 ,"CMS_final" );
@@ -349,7 +341,7 @@ int main(int argc, char **argv)#else pkcs7 =PKCS7_sign (x509, private_key,NULL , bm,PKCS7_NOCERTS |PKCS7_BINARY | -PKCS7_DETACHED | use_signed_attrs); +PKCS7_DETACHED |PKCS7_NOATTR );ERR (!pkcs7,"PKCS7_sign" );#endif
Signature · 1 line
2.24.3 (Apple Git-128)
Jarkko Sakkinen
maintainerQuoted 54 lines · Tianjia Zhang
use_signed_attrsis an unnecessary variable, deleting this variable can simplify the code.Signed-off-by Tianjia Zhang <[email protected]>--- scripts/sign-file.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)scripts/sign-file.c +2
-10@@ -224,7 +224,6 @@ int main(int argc, char **argv)bool raw_sig = false;unsigned char buf[4096 ];unsigned long module_size, sig_size; -unsigned int use_signed_attrs;const EVP_MD *digest_algo;EVP_PKEY *private_key;#ifndef USE_PKCS7 @@ -242,12 +241,6 @@ int main(int argc, char **argv) key_pass =getenv ("KBUILD_SIGN_PIN" ); -#ifndef USE_PKCS7 - use_signed_attrs =CMS_NOATTR ; -#else - use_signed_attrs =PKCS7_NOATTR ; -#endif - do { opt = getopt(argc, argv, "sdpk"); switch (opt) {@@ -340,8 +333,7 @@ int main(int argc, char **argv)ERR (!CMS_add1_signer (cms, x509, private_key, digest_algo,CMS_NOCERTS |CMS_BINARY | -CMS_NOSMIMECAP | use_keyid | - use_signed_attrs), +CMS_NOSMIMECAP |CMS_NOATTR | use_keyid),"CMS_add1_signer" );ERR (CMS_final (cms, bm,NULL ,CMS_NOCERTS |CMS_BINARY ) <0 ,"CMS_final" );@@ -349,7 +341,7 @@ int main(int argc, char **argv)#else pkcs7 =PKCS7_sign (x509, private_key,NULL , bm,PKCS7_NOCERTS |PKCS7_BINARY | -PKCS7_DETACHED | use_signed_attrs); +PKCS7_DETACHED |PKCS7_NOATTR );ERR (!pkcs7,"PKCS7_sign" );#endif Signature · 1 line
2.24.3 (Apple Git-128)
I'm sorry but I don't see how this makes our lives better.
If, however, this was part of a larger patch, it might make sense, if there was a real functional change concerning the same code blocks.
BR, Jarkko
Hi Jarkko,
Quoted 58 lines · Jarkko Sakkinen
Quoted 54 lines · Tianjia Zhang
use_signed_attrsis an unnecessary variable, deleting this variable can simplify the code.Signed-off-by Tianjia Zhang <[email protected]>--- scripts/sign-file.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)scripts/sign-file.c +2
-10@@ -224,7 +224,6 @@ int main(int argc, char **argv)bool raw_sig = false;unsigned char buf[4096 ];unsigned long module_size, sig_size; -unsigned int use_signed_attrs;const EVP_MD *digest_algo;EVP_PKEY *private_key;#ifndef USE_PKCS7 @@ -242,12 +241,6 @@ int main(int argc, char **argv) key_pass =getenv ("KBUILD_SIGN_PIN" ); -#ifndef USE_PKCS7 - use_signed_attrs =CMS_NOATTR ; -#else - use_signed_attrs =PKCS7_NOATTR ; -#endif - do { opt = getopt(argc, argv, "sdpk"); switch (opt) {@@ -340,8 +333,7 @@ int main(int argc, char **argv)ERR (!CMS_add1_signer (cms, x509, private_key, digest_algo,CMS_NOCERTS |CMS_BINARY | -CMS_NOSMIMECAP | use_keyid | - use_signed_attrs), +CMS_NOSMIMECAP |CMS_NOATTR | use_keyid),"CMS_add1_signer" );ERR (CMS_final (cms, bm,NULL ,CMS_NOCERTS |CMS_BINARY ) <0 ,"CMS_final" );@@ -349,7 +341,7 @@ int main(int argc, char **argv)#else pkcs7 =PKCS7_sign (x509, private_key,NULL , bm,PKCS7_NOCERTS |PKCS7_BINARY | -PKCS7_DETACHED | use_signed_attrs); +PKCS7_DETACHED |PKCS7_NOATTR );ERR (!pkcs7,"PKCS7_sign" );#endif Signature · 1 line
2.24.3 (Apple Git-128)I'm sorry but I don't see how this makes our lives better.
Quoted 4 lines
If, however, this was part of a larger patch, it might make sense, if there was a real functional change concerning the same code blocks.
BR, Jarkko
As you might expect, this is a stand-alone patch and there are no other changes attached to it.
Best regards,
Tianjia