[kbuild] Re: [Patch v3 6/7] crypto: qce: common: Add support for AEAD algorithms
From: Dan Carpenter
Date: Thu Apr 29 2021 - 01:26:08 EST
Hi Thara,
url: https://github.com/0day-ci/linux/commits/Thara-Gopinath/Add-support-for-AEAD-algorithms-in-Qualcomm-Crypto-Engine-driver/20210420-113944
base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: arm-randconfig-m031-20210428 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
smatch warnings:
drivers/crypto/qce/common.c:482 qce_setup_regs_aead() error: uninitialized symbol 'auth_ivsize'.
vim +/auth_ivsize +482 drivers/crypto/qce/common.c
b152c1b17bb6ad Thara Gopinath 2021-04-19 419 static int qce_setup_regs_aead(struct crypto_async_request *async_req)
b152c1b17bb6ad Thara Gopinath 2021-04-19 420 {
b152c1b17bb6ad Thara Gopinath 2021-04-19 421 struct aead_request *req = aead_request_cast(async_req);
b152c1b17bb6ad Thara Gopinath 2021-04-19 422 struct qce_aead_reqctx *rctx = aead_request_ctx(req);
b152c1b17bb6ad Thara Gopinath 2021-04-19 423 struct qce_aead_ctx *ctx = crypto_tfm_ctx(async_req->tfm);
b152c1b17bb6ad Thara Gopinath 2021-04-19 424 struct qce_alg_template *tmpl = to_aead_tmpl(crypto_aead_reqtfm(req));
b152c1b17bb6ad Thara Gopinath 2021-04-19 425 struct qce_device *qce = tmpl->qce;
b152c1b17bb6ad Thara Gopinath 2021-04-19 426 u32 enckey[QCE_MAX_CIPHER_KEY_SIZE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19 427 u32 enciv[QCE_MAX_IV_SIZE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19 428 u32 authkey[QCE_SHA_HMAC_KEY_SIZE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19 429 u32 authiv[SHA256_DIGEST_SIZE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19 430 u32 authnonce[QCE_MAX_NONCE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19 431 unsigned int enc_keylen = ctx->enc_keylen;
b152c1b17bb6ad Thara Gopinath 2021-04-19 432 unsigned int auth_keylen = ctx->auth_keylen;
b152c1b17bb6ad Thara Gopinath 2021-04-19 433 unsigned int enc_ivsize = rctx->ivsize;
b152c1b17bb6ad Thara Gopinath 2021-04-19 434 unsigned int auth_ivsize;
b152c1b17bb6ad Thara Gopinath 2021-04-19 435 unsigned int enckey_words, enciv_words;
b152c1b17bb6ad Thara Gopinath 2021-04-19 436 unsigned int authkey_words, authiv_words, authnonce_words;
b152c1b17bb6ad Thara Gopinath 2021-04-19 437 unsigned long flags = rctx->flags;
b152c1b17bb6ad Thara Gopinath 2021-04-19 438 u32 encr_cfg, auth_cfg, config, totallen;
b152c1b17bb6ad Thara Gopinath 2021-04-19 439 u32 iv_last_word;
b152c1b17bb6ad Thara Gopinath 2021-04-19 440
b152c1b17bb6ad Thara Gopinath 2021-04-19 441 qce_setup_config(qce);
b152c1b17bb6ad Thara Gopinath 2021-04-19 442
b152c1b17bb6ad Thara Gopinath 2021-04-19 443 /* Write encryption key */
b152c1b17bb6ad Thara Gopinath 2021-04-19 444 enckey_words = qce_be32_to_cpu_array(enckey, ctx->enc_key, enc_keylen);
b152c1b17bb6ad Thara Gopinath 2021-04-19 445 qce_write_array(qce, REG_ENCR_KEY0, enckey, enckey_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19 446
b152c1b17bb6ad Thara Gopinath 2021-04-19 447 /* Write encryption iv */
b152c1b17bb6ad Thara Gopinath 2021-04-19 448 enciv_words = qce_be32_to_cpu_array(enciv, rctx->iv, enc_ivsize);
b152c1b17bb6ad Thara Gopinath 2021-04-19 449 qce_write_array(qce, REG_CNTR0_IV0, enciv, enciv_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19 450
b152c1b17bb6ad Thara Gopinath 2021-04-19 451 if (IS_CCM(rctx->flags)) {
b152c1b17bb6ad Thara Gopinath 2021-04-19 452 iv_last_word = enciv[enciv_words - 1];
b152c1b17bb6ad Thara Gopinath 2021-04-19 453 qce_write(qce, REG_CNTR3_IV3, iv_last_word + 1);
b152c1b17bb6ad Thara Gopinath 2021-04-19 454 qce_write_array(qce, REG_ENCR_CCM_INT_CNTR0, (u32 *)enciv, enciv_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19 455 qce_write(qce, REG_CNTR_MASK, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19 456 qce_write(qce, REG_CNTR_MASK0, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19 457 qce_write(qce, REG_CNTR_MASK1, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19 458 qce_write(qce, REG_CNTR_MASK2, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19 459 }
b152c1b17bb6ad Thara Gopinath 2021-04-19 460
b152c1b17bb6ad Thara Gopinath 2021-04-19 461 /* Clear authentication IV and KEY registers of previous values */
b152c1b17bb6ad Thara Gopinath 2021-04-19 462 qce_clear_array(qce, REG_AUTH_IV0, 16);
b152c1b17bb6ad Thara Gopinath 2021-04-19 463 qce_clear_array(qce, REG_AUTH_KEY0, 16);
b152c1b17bb6ad Thara Gopinath 2021-04-19 464
b152c1b17bb6ad Thara Gopinath 2021-04-19 465 /* Clear byte count */
b152c1b17bb6ad Thara Gopinath 2021-04-19 466 qce_clear_array(qce, REG_AUTH_BYTECNT0, 4);
b152c1b17bb6ad Thara Gopinath 2021-04-19 467
b152c1b17bb6ad Thara Gopinath 2021-04-19 468 /* Write authentication key */
b152c1b17bb6ad Thara Gopinath 2021-04-19 469 authkey_words = qce_be32_to_cpu_array(authkey, ctx->auth_key, auth_keylen);
b152c1b17bb6ad Thara Gopinath 2021-04-19 470 qce_write_array(qce, REG_AUTH_KEY0, (u32 *)authkey, authkey_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19 471
b152c1b17bb6ad Thara Gopinath 2021-04-19 472 /* Write initial authentication IV only for HMAC algorithms */
b152c1b17bb6ad Thara Gopinath 2021-04-19 473 if (IS_SHA_HMAC(rctx->flags)) {
b152c1b17bb6ad Thara Gopinath 2021-04-19 474 /* Write default authentication iv */
b152c1b17bb6ad Thara Gopinath 2021-04-19 475 if (IS_SHA1_HMAC(rctx->flags)) {
b152c1b17bb6ad Thara Gopinath 2021-04-19 476 auth_ivsize = SHA1_DIGEST_SIZE;
b152c1b17bb6ad Thara Gopinath 2021-04-19 477 memcpy(authiv, std_iv_sha1, auth_ivsize);
b152c1b17bb6ad Thara Gopinath 2021-04-19 478 } else if (IS_SHA256_HMAC(rctx->flags)) {
b152c1b17bb6ad Thara Gopinath 2021-04-19 479 auth_ivsize = SHA256_DIGEST_SIZE;
b152c1b17bb6ad Thara Gopinath 2021-04-19 480 memcpy(authiv, std_iv_sha256, auth_ivsize);
b152c1b17bb6ad Thara Gopinath 2021-04-19 481 }
No else path.
b152c1b17bb6ad Thara Gopinath 2021-04-19 @482 authiv_words = auth_ivsize / sizeof(u32);
b152c1b17bb6ad Thara Gopinath 2021-04-19 483 qce_write_array(qce, REG_AUTH_IV0, (u32 *)authiv, authiv_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19 484 } else if (IS_CCM(rctx->flags)) {
b152c1b17bb6ad Thara Gopinath 2021-04-19 485 /* Write nonce for CCM algorithms */
b152c1b17bb6ad Thara Gopinath 2021-04-19 486 authnonce_words = qce_be32_to_cpu_array(authnonce, rctx->ccm_nonce, QCE_MAX_NONCE);
b152c1b17bb6ad Thara Gopinath 2021-04-19 487 qce_write_array(qce, REG_AUTH_INFO_NONCE0, authnonce, authnonce_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19 488 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip
_______________________________________________
kbuild mailing list -- kbuild@xxxxxxxxxxxx
To unsubscribe send an email to kbuild-leave@xxxxxxxxxxxx