Re: [PATCH] sign-file: Add -D "digest mode"

From: kernel test robot
Date: Fri Oct 04 2024 - 03:50:25 EST


Hi Fam,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.12-rc1 next-20241003]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Fam-Zheng/sign-file-Add-D-digest-mode/20241002-215025
base: linus/master
patch link: https://lore.kernel.org/r/20241002133837.1030094-1-fam.zheng%40bytedance.com
patch subject: [PATCH] sign-file: Add -D "digest mode"
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20241004/202410041509.PbZBKm0L-lkp@xxxxxxxxx/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project fef3566a25ff0e34fb87339ba5e13eca17cec00f)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241004/202410041509.PbZBKm0L-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410041509.PbZBKm0L-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]
>> scripts/sign-file.c:357:8: error: call to undeclared function 'CMS_final_digest'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
357 | ERR(CMS_final_digest(cms, digest_bin, digest_len, NULL, CMS_NOCERTS | CMS_BINARY) != 1,
| ^
1 error generated.
make[3]: *** [scripts/Makefile.host:116: scripts/sign-file] Error 1
make[3]: Target 'scripts/' not remade because of errors.
make[2]: *** [Makefile:1187: scripts] Error 2
make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:224: __sub-make] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:224: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for MODVERSIONS
Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
Selected by [y]:
- RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=y] || GCC_PLUGINS [=n]) && MODULES [=y]
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]


vim +/CMS_final_digest +357 scripts/sign-file.c

329
330 if (!raw_sig) {
331 /* Read the private key and the X.509 cert the PKCS#7 message
332 * will point to.
333 */
334 private_key = read_private_key(private_key_name);
335 x509 = read_x509(x509_name);
336
337 /* Digest the module data. */
338 OpenSSL_add_all_digests();
339 drain_openssl_errors(__LINE__, 0);
340 digest_algo = EVP_get_digestbyname(hash_algo);
341 ERR(!digest_algo, "EVP_get_digestbyname");
342
343 #ifndef USE_PKCS7
344 /* Load the signature message from the digest buffer. */
345 cms = CMS_sign(NULL, NULL, NULL, NULL,
346 CMS_NOCERTS | CMS_PARTIAL | CMS_BINARY |
347 CMS_DETACHED | CMS_STREAM);
348 ERR(!cms, "CMS_sign");
349
350 ERR(!CMS_add1_signer(cms, x509, private_key, digest_algo,
351 CMS_NOCERTS | CMS_BINARY |
352 CMS_NOSMIMECAP | use_keyid |
353 (digest_mode ? CMS_KEY_PARAM : 0) |
354 use_signed_attrs),
355 "CMS_add1_signer");
356 if (digest_mode)
> 357 ERR(CMS_final_digest(cms, digest_bin, digest_len, NULL, CMS_NOCERTS | CMS_BINARY) != 1,
358 "CMS_final_digest");
359 else
360 ERR(CMS_final(cms, bm, NULL, CMS_NOCERTS | CMS_BINARY) != 1,
361 "CMS_final");
362

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki