All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Rodolfo Giometti <giometti@enneenne.com>, linux-crypto@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	Rodolfo Giometti <giometti@enneenne.com>
Subject: Re: [V1 1/4] crypto ecdh.h: set key memory region as const
Date: Tue, 16 Sep 2025 14:50:50 +0800	[thread overview]
Message-ID: <202509161457.uTdEUas6-lkp@intel.com> (raw)
In-Reply-To: <20250915084039.2848952-2-giometti@enneenne.com>

Hi Rodolfo,

kernel test robot noticed the following build errors:

[auto build test ERROR on herbert-cryptodev-2.6/master]
[also build test ERROR on herbert-crypto-2.6/master linus/master v6.17-rc6 next-20250915]
[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/Rodolfo-Giometti/crypto-ecdh-h-set-key-memory-region-as-const/20250915-164558
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20250915084039.2848952-2-giometti%40enneenne.com
patch subject: [V1 1/4] crypto ecdh.h: set key memory region as const
config: riscv-randconfig-001-20250916 (https://download.01.org/0day-ci/archive/20250916/202509161457.uTdEUas6-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 65ad21d730d25789454d18e811f8ff5db79cb5d4)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250916/202509161457.uTdEUas6-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509161457.uTdEUas6-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/crypto/hisilicon/hpre/hpre_crypto.c:1430:23: error: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    1430 |         if (hpre_key_is_zero(params.key, params.key_size)) {
         |                              ^~~~~~~~~~
   drivers/crypto/hisilicon/hpre/hpre_crypto.c:1369:36: note: passing argument to parameter 'key' here
    1369 | static bool hpre_key_is_zero(char *key, unsigned short key_sz)
         |                                    ^
   1 error generated.


vim +1430 drivers/crypto/hisilicon/hpre/hpre_crypto.c

1e609f5fb73b6b1 Hui Tang   2021-05-29  1399  
05e7b906aa7c869 Meng Yu    2021-03-04  1400  static int hpre_ecdh_set_secret(struct crypto_kpp *tfm, const void *buf,
05e7b906aa7c869 Meng Yu    2021-03-04  1401  				unsigned int len)
05e7b906aa7c869 Meng Yu    2021-03-04  1402  {
05e7b906aa7c869 Meng Yu    2021-03-04  1403  	struct hpre_ctx *ctx = kpp_tfm_ctx(tfm);
b0ab0797f7ab74b Weili Qian 2023-07-07  1404  	unsigned int sz, sz_shift, curve_sz;
b94c910afda050a Hui Tang   2021-05-12  1405  	struct device *dev = ctx->dev;
1e609f5fb73b6b1 Hui Tang   2021-05-29  1406  	char key[HPRE_ECC_MAX_KSZ];
05e7b906aa7c869 Meng Yu    2021-03-04  1407  	struct ecdh params;
05e7b906aa7c869 Meng Yu    2021-03-04  1408  	int ret;
05e7b906aa7c869 Meng Yu    2021-03-04  1409  
05e7b906aa7c869 Meng Yu    2021-03-04  1410  	if (crypto_ecdh_decode_key(buf, len, &params) < 0) {
05e7b906aa7c869 Meng Yu    2021-03-04  1411  		dev_err(dev, "failed to decode ecdh key!\n");
05e7b906aa7c869 Meng Yu    2021-03-04  1412  		return -EINVAL;
05e7b906aa7c869 Meng Yu    2021-03-04  1413  	}
05e7b906aa7c869 Meng Yu    2021-03-04  1414  
1e609f5fb73b6b1 Hui Tang   2021-05-29  1415  	/* Use stdrng to generate private key */
1e609f5fb73b6b1 Hui Tang   2021-05-29  1416  	if (!params.key || !params.key_size) {
1e609f5fb73b6b1 Hui Tang   2021-05-29  1417  		params.key = key;
b0ab0797f7ab74b Weili Qian 2023-07-07  1418  		curve_sz = hpre_ecdh_get_curvesz(ctx->curve_id);
b0ab0797f7ab74b Weili Qian 2023-07-07  1419  		if (!curve_sz) {
b0ab0797f7ab74b Weili Qian 2023-07-07  1420  			dev_err(dev, "Invalid curve size!\n");
b0ab0797f7ab74b Weili Qian 2023-07-07  1421  			return -EINVAL;
b0ab0797f7ab74b Weili Qian 2023-07-07  1422  		}
b0ab0797f7ab74b Weili Qian 2023-07-07  1423  
b0ab0797f7ab74b Weili Qian 2023-07-07  1424  		params.key_size = curve_sz - 1;
1e609f5fb73b6b1 Hui Tang   2021-05-29  1425  		ret = ecdh_gen_privkey(ctx, &params);
1e609f5fb73b6b1 Hui Tang   2021-05-29  1426  		if (ret)
1e609f5fb73b6b1 Hui Tang   2021-05-29  1427  			return ret;
1e609f5fb73b6b1 Hui Tang   2021-05-29  1428  	}
1e609f5fb73b6b1 Hui Tang   2021-05-29  1429  
05e7b906aa7c869 Meng Yu    2021-03-04 @1430  	if (hpre_key_is_zero(params.key, params.key_size)) {
05e7b906aa7c869 Meng Yu    2021-03-04  1431  		dev_err(dev, "Invalid hpre key!\n");
05e7b906aa7c869 Meng Yu    2021-03-04  1432  		return -EINVAL;
05e7b906aa7c869 Meng Yu    2021-03-04  1433  	}
05e7b906aa7c869 Meng Yu    2021-03-04  1434  
05e7b906aa7c869 Meng Yu    2021-03-04  1435  	hpre_ecc_clear_ctx(ctx, false, true);
05e7b906aa7c869 Meng Yu    2021-03-04  1436  
05e7b906aa7c869 Meng Yu    2021-03-04  1437  	ret = hpre_ecdh_set_param(ctx, &params);
05e7b906aa7c869 Meng Yu    2021-03-04  1438  	if (ret < 0) {
05e7b906aa7c869 Meng Yu    2021-03-04  1439  		dev_err(dev, "failed to set hpre param, ret = %d!\n", ret);
05e7b906aa7c869 Meng Yu    2021-03-04  1440  		return ret;
05e7b906aa7c869 Meng Yu    2021-03-04  1441  	}
05e7b906aa7c869 Meng Yu    2021-03-04  1442  
05e7b906aa7c869 Meng Yu    2021-03-04  1443  	sz = ctx->key_sz;
05e7b906aa7c869 Meng Yu    2021-03-04  1444  	sz_shift = (sz << 1) + sz - params.key_size;
05e7b906aa7c869 Meng Yu    2021-03-04  1445  	memcpy(ctx->ecdh.p + sz_shift, params.key, params.key_size);
05e7b906aa7c869 Meng Yu    2021-03-04  1446  
05e7b906aa7c869 Meng Yu    2021-03-04  1447  	return 0;
05e7b906aa7c869 Meng Yu    2021-03-04  1448  }
05e7b906aa7c869 Meng Yu    2021-03-04  1449  

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

  reply	other threads:[~2025-09-16  6:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15  8:40 [V1 0/4] User API for KPP Rodolfo Giometti
2025-09-15  8:40 ` [V1 1/4] crypto ecdh.h: set key memory region as const Rodolfo Giometti
2025-09-16  6:50   ` kernel test robot [this message]
2025-09-16 17:19   ` kernel test robot
2025-09-15  8:40 ` [V1 2/4] crypto kpp.h: add new method set_secret_raw in struct kpp_alg Rodolfo Giometti
2025-09-15  8:40 ` [V1 3/4] crypto ecdh.c: define the ECDH set_secret_raw method Rodolfo Giometti
2025-09-15 14:46   ` kernel test robot
2025-09-15  8:40 ` [V1 4/4] crypto: add user-space interface for KPP algorithms Rodolfo Giometti
2025-09-15 14:50 ` [V1 0/4] User API for KPP Eric Biggers
2025-09-15 15:47   ` Rodolfo Giometti
2025-09-16  4:10     ` Herbert Xu
2025-09-16  8:22       ` Rodolfo Giometti
2025-09-16 10:21         ` Ignat Korchagin
2025-09-16 11:21           ` Rodolfo Giometti
2025-09-16 11:56             ` Ignat Korchagin
2025-09-16 12:33               ` Rodolfo Giometti
2025-09-16 12:43                 ` Ignat Korchagin
2025-09-16 13:07                   ` Rodolfo Giometti
2025-09-16 19:03                 ` Simo Sorce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202509161457.uTdEUas6-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=davem@davemloft.net \
    --cc=giometti@enneenne.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.