Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3452770ybt; Tue, 30 Jun 2020 03:12:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7X80kv+gqGBbTgDRq5ZRpYGLEAf/SIV+K5/Oyar7MKxI0PNi0UAMHzGTNEWEMfvIMcESr X-Received: by 2002:a17:906:4757:: with SMTP id j23mr16668238ejs.431.1593511927320; Tue, 30 Jun 2020 03:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593511927; cv=none; d=google.com; s=arc-20160816; b=YXh4qiUpSedU6mmNHpHvZIeTi8t6X0Ma+aMYODw/tixxSRAM41CT1Inyf4SU5cn1CD W4l/y1qw7jm7t4XzbHzCTrxaAvcc/2N33q+5ztJV8+Xe2zPSXFlC++hBL45zbXH0CgqB ZHb5XH7hG8SLKC3RgrTxd6TlJrWRRx6p8Uo+aGXiHsjPBhbN4JkH0i/adro2/wgcLKUp Y24vJs6eYy6JN3RnNR09+NHrUPttOeZ/DwD1t52dqM1aAgPpZc+TWkJPWEI/Qqex2/Z8 wcQNSV8WoY2YCFyZH2ekNV8uWjNaAHg1di74CyrdMo9J3zEsBjc2JTCqLzHHK2JJzlx+ R9VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OZXIcnKtHv6MhzLaHcOwHrMi0velFivl6DXRQ8VTQWU=; b=mQFFCV2WpfFu9MJncQGbsgl5cP3T2Vx5kda0+7eOo67nmxkj9o0FvTYdTJlJxcgde2 WL+LncpGM1UGxP+kGuUem62lb4ZDGpco5a25qrX9SCUKHuioS5nz9qr6ViIeSQ94f80y oyvu7o3Hrbu6yc7CvcMDIzSyFluma+qvAr+RpU5kH3TjxcGl71vvKWqkaUd5c9WAQk0+ TLYYs4sfr60elDEM/XD1mar+Jx4aqjAvSud6BsBjs3SE872RPv7RDs2OQHsdlo7hXqFv eeJkokg2/L40fsNE6Fs5pxIRHnq2GuGSoWqSHrIyn2a8jmgLVd93saG/DxfaBDZ8KBNF ryxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YLFLWM4B; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n26si1506637ejs.214.2020.06.30.03.11.32; Tue, 30 Jun 2020 03:12:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YLFLWM4B; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729259AbgF3KKC (ORCPT + 99 others); Tue, 30 Jun 2020 06:10:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:46276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732189AbgF3KKC (ORCPT ); Tue, 30 Jun 2020 06:10:02 -0400 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A86362078B for ; Tue, 30 Jun 2020 10:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593511801; bh=Qb8UJ9UKslgy8Grgbb2TcL+yWw1lhizz0OxstWxse3w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YLFLWM4B5mgsN+m7kVsthMkRWGOpVVRvSiZh+s9jyJ7G4RxMA8p4qYz2LCYhCm4Ju Xo1yc46WmU1BNSrnVRqgQg/QJwI7k1T/6D9NlpVp1bQkiBm1RNVb7sYLRvdwqWGFGX x/ERlQEuFUx2kVHwZLZUkIxxbyDCw4JA9w/fG39w= Received: by mail-oi1-f179.google.com with SMTP id s21so16951473oic.9 for ; Tue, 30 Jun 2020 03:10:01 -0700 (PDT) X-Gm-Message-State: AOAM530qyQpZCStj2e746TRRrJlFM/dxo+zYNwr3P+ziG2mHMb2FzQMX 67m4m3NNq39YV6ciQP5u3/EJhMxFtdajY4sUa48= X-Received: by 2002:aca:f257:: with SMTP id q84mr1286462oih.174.1593511797563; Tue, 30 Jun 2020 03:09:57 -0700 (PDT) MIME-Version: 1.0 References: <20200626080429.155450-1-giovanni.cabiddu@intel.com> <20200626080429.155450-5-giovanni.cabiddu@intel.com> <20200629170353.GA2750@silpixa00400314> In-Reply-To: <20200629170353.GA2750@silpixa00400314> From: Ard Biesheuvel Date: Tue, 30 Jun 2020 12:09:46 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 4/4] crypto: qat - fallback for xts with 192 bit keys To: Giovanni Cabiddu Cc: Herbert Xu , Linux Crypto Mailing List , qat-linux@intel.com Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, 29 Jun 2020 at 19:05, Giovanni Cabiddu wrote: > > Thanks for your feedback Ard. > > On Fri, Jun 26, 2020 at 08:15:16PM +0200, Ard Biesheuvel wrote: > > On Fri, 26 Jun 2020 at 10:04, Giovanni Cabiddu > > wrote: > > > > > > +static int qat_alg_skcipher_init_xts_tfm(struct crypto_skcipher *tfm) > > > +{ > > > + struct qat_alg_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); > > > + int reqsize; > > > + > > > + ctx->ftfm = crypto_alloc_skcipher("xts(aes)", 0, CRYPTO_ALG_ASYNC); > > > > Why are you only permitting synchronous fallbacks? If the logic above > > is sound, and copies the base.complete and base.data fields as well, > > the fallback can complete asynchronously without problems. > > Note that SIMD s/w implementations of XTS(AES) are asynchronous as > > well, as they use the crypto_simd helper which queues requests for > > asynchronous completion if the context from which the request was > > issued does not permit access to the SIMD register file (e.g., softirq > > context on some architectures, if the interrupted context is also > > using SIMD) > I did it this way since I though I didn't have a way to test it with an > asynchronous sw implementation. > I changed this line to avoid masking the asynchronous implementations > and test it by forcing simd.c to use always cryptd (don't know if there > is a simpler way to do it). > This is exactly how I tested it in the past, but note that the extended testing that Eric implemented will also run from a context where SIMD is disabled artificially, and so you should be getting this behavior in any case. > Also, I added to the mask CRYPTO_ALG_NEED_FALLBACK so I don't get another > implementation that requires a fallback. > > I'm going to send a v3. > > Regards, > > -- > Giovanni