Message ID | 20200206012036.25614-4-cotequeiroz@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | crypto: qce driver fixes for gcm | expand |
Hi Eneas,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on cryptodev/master]
[also build test WARNING on crypto/master next-20200206]
[cannot apply to sparc-next/master v5.5]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Eneas-U-de-Queiroz/crypto-qce-driver-fixes-for-gcm/20200207-051805
base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/crypto/qce/skcipher.c: In function 'qce_skcipher_crypt':
>> drivers/crypto/qce/skcipher.c:232:26: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (IS_AES(rctx->flags) &&
vim +232 drivers/crypto/qce/skcipher.c
5feaaae1b549f3 drivers/crypto/qce/ablkcipher.c Herbert Xu 2019-04-11 216
8bf0871539faa0 drivers/crypto/qce/skcipher.c Ard Biesheuvel 2019-11-09 217 static int qce_skcipher_crypt(struct skcipher_request *req, int encrypt)
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 218 {
8bf0871539faa0 drivers/crypto/qce/skcipher.c Ard Biesheuvel 2019-11-09 219 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
8bf0871539faa0 drivers/crypto/qce/skcipher.c Ard Biesheuvel 2019-11-09 220 struct qce_cipher_ctx *ctx = crypto_skcipher_ctx(tfm);
8bf0871539faa0 drivers/crypto/qce/skcipher.c Ard Biesheuvel 2019-11-09 221 struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req);
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 222 struct qce_alg_template *tmpl = to_cipher_tmpl(tfm);
7de4c2bd196f11 drivers/crypto/qce/skcipher.c Eneas U de Queiroz 2019-12-20 223 int keylen;
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 224 int ret;
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 225
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 226 rctx->flags = tmpl->alg_flags;
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 227 rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT;
7de4c2bd196f11 drivers/crypto/qce/skcipher.c Eneas U de Queiroz 2019-12-20 228 keylen = IS_XTS(rctx->flags) ? ctx->enc_keylen >> 1 : ctx->enc_keylen;
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 229
f8b4400d05347c drivers/crypto/qce/skcipher.c Eneas U de Queiroz 2020-02-05 230 /* qce is hanging when AES-XTS request len > QCE_SECTOR_SIZE and
f8b4400d05347c drivers/crypto/qce/skcipher.c Eneas U de Queiroz 2020-02-05 231 * is not a multiple of it; pass such requests to the fallback */
c23a1c2b41c486 drivers/crypto/qce/skcipher.c Eneas U de Queiroz 2020-02-05 @232 if (IS_AES(rctx->flags) &&
c23a1c2b41c486 drivers/crypto/qce/skcipher.c Eneas U de Queiroz 2020-02-05 233 ((keylen != AES_KEYSIZE_128 && keylen != AES_KEYSIZE_256)
f8b4400d05347c drivers/crypto/qce/skcipher.c Eneas U de Queiroz 2020-02-05 234 || req->cryptlen <= aes_sw_max_len)
f8b4400d05347c drivers/crypto/qce/skcipher.c Eneas U de Queiroz 2020-02-05 235 || (IS_XTS(rctx->flags) && req->cryptlen > QCE_SECTOR_SIZE &&
f8b4400d05347c drivers/crypto/qce/skcipher.c Eneas U de Queiroz 2020-02-05 236 req->cryptlen % QCE_SECTOR_SIZE)) {
d1e4ba83b0286b drivers/crypto/qce/ablkcipher.c Kees Cook 2018-09-18 237 SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, ctx->fallback);
2d20ce070d3b78 drivers/crypto/qce/ablkcipher.c Herbert Xu 2016-06-29 238
d1e4ba83b0286b drivers/crypto/qce/ablkcipher.c Kees Cook 2018-09-18 239 skcipher_request_set_sync_tfm(subreq, ctx->fallback);
2d20ce070d3b78 drivers/crypto/qce/ablkcipher.c Herbert Xu 2016-06-29 240 skcipher_request_set_callback(subreq, req->base.flags,
2d20ce070d3b78 drivers/crypto/qce/ablkcipher.c Herbert Xu 2016-06-29 241 NULL, NULL);
2d20ce070d3b78 drivers/crypto/qce/ablkcipher.c Herbert Xu 2016-06-29 242 skcipher_request_set_crypt(subreq, req->src, req->dst,
8bf0871539faa0 drivers/crypto/qce/skcipher.c Ard Biesheuvel 2019-11-09 243 req->cryptlen, req->iv);
2d20ce070d3b78 drivers/crypto/qce/ablkcipher.c Herbert Xu 2016-06-29 244 ret = encrypt ? crypto_skcipher_encrypt(subreq) :
2d20ce070d3b78 drivers/crypto/qce/ablkcipher.c Herbert Xu 2016-06-29 245 crypto_skcipher_decrypt(subreq);
2d20ce070d3b78 drivers/crypto/qce/ablkcipher.c Herbert Xu 2016-06-29 246 skcipher_request_zero(subreq);
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 247 return ret;
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 248 }
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 249
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 250 return tmpl->qce->async_req_enqueue(tmpl->qce, &req->base);
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 251 }
ec8f5d8f6f76b9 drivers/crypto/qce/ablkcipher.c Stanimir Varbanov 2014-06-25 252
:::::: The code at line 232 was first introduced by commit
:::::: c23a1c2b41c486bff4ad5cf8b0968e3f55907eba crypto: qce - use AES fallback for small requests
:::::: TO: Eneas U de Queiroz <cotequeiroz@gmail.com>
:::::: CC: 0day robot <lkp@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
diff --git a/drivers/crypto/qce/common.c b/drivers/crypto/qce/common.c index 629e7f34dc09..5006e74c40cd 100644 --- a/drivers/crypto/qce/common.c +++ b/drivers/crypto/qce/common.c @@ -15,8 +15,6 @@ #include "regs-v5.h" #include "sha.h" -#define QCE_SECTOR_SIZE 512 - static inline u32 qce_read(struct qce_device *qce, u32 offset) { return readl(qce->base + offset); diff --git a/drivers/crypto/qce/common.h b/drivers/crypto/qce/common.h index 282d4317470d..9f989cba0f1b 100644 --- a/drivers/crypto/qce/common.h +++ b/drivers/crypto/qce/common.h @@ -12,6 +12,9 @@ #include <crypto/hash.h> #include <crypto/internal/skcipher.h> +/* xts du size */ +#define QCE_SECTOR_SIZE 512 + /* key size in bytes */ #define QCE_SHA_HMAC_KEY_SIZE 64 #define QCE_MAX_CIPHER_KEY_SIZE AES_KEYSIZE_256 diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c index a3536495b6b0..b7c0aaddd7d9 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c @@ -227,9 +227,13 @@ static int qce_skcipher_crypt(struct skcipher_request *req, int encrypt) rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT; keylen = IS_XTS(rctx->flags) ? ctx->enc_keylen >> 1 : ctx->enc_keylen; + /* qce is hanging when AES-XTS request len > QCE_SECTOR_SIZE and + * is not a multiple of it; pass such requests to the fallback */ if (IS_AES(rctx->flags) && ((keylen != AES_KEYSIZE_128 && keylen != AES_KEYSIZE_256) - || req->cryptlen <= aes_sw_max_len)) { + || req->cryptlen <= aes_sw_max_len) + || (IS_XTS(rctx->flags) && req->cryptlen > QCE_SECTOR_SIZE && + req->cryptlen % QCE_SECTOR_SIZE)) { SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, ctx->fallback); skcipher_request_set_sync_tfm(subreq, ctx->fallback);
QCE hangs when presented with an AES-XTS request whose length is larger than QCE_SECTOR_SIZE (512-bytes), and is not a multiple of it. Let the fallback cipher handle them. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>