Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp565372pxb; Wed, 25 Aug 2021 09:33:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfD0PNh44tirRcfQ7gdqHGfhq0NTMpYhP1g5OZZibMhL2/ZE1GjH7DGAQ3UevZpuKpmN1P X-Received: by 2002:a92:190f:: with SMTP id 15mr30310907ilz.45.1629909191360; Wed, 25 Aug 2021 09:33:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629909191; cv=none; d=google.com; s=arc-20160816; b=Avdap1xJzMSmzY0fk9XQb9ttW2Z8pURUFNhK0dvPFoCBiTXHFjXOStO9EFp5M0AeDz Dd64Y/W1W47IyYSlqr9ypmuLJrKM85Ow7oFKSKBOhE5JZGeW9eZCwz4+6jj3Foevkt+n YPyqYSHGUjALIgNcRQto7rufSYEqqPUig3p6QK3fvOgtfHlGUaRSpqbMrRAU8Fr1GsgS KeLj74ylriyORQfoQZmlE119pD++k85mSbZ7iSPjsUyrO0ul8aTq1aNgmyd4M3BsN5Te lLI43l8qo260S1DqTa0x/6rVu5jBmXjKIlV56xbTcSQCvZ8eI455I4O8Lq7nvLIupE7U 41IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=wMkJXZoogesNm5JJZvMGG6cJlR5rgjyot4jq2nzi3Aw=; b=Y5EldFT6KOUpggZvIfGBDeSJcGAwk0EtpklarWUFOYAt97iPsrlgw0XHIljaaqoQFA oH/zjyCx4kRE1Hf+7iLdVgO3uKFJ3sC/dyblfVaegwlAG9cJMLyJQrGEzX7kzQDbAE0Z qTMY95xZzSKlPdufHw4MQzPIXWUy2ajaZidacZvy09ISZLu+xqF0LaXVFlwVSUyBEwA5 981rcbQ/CgvNIsqznSHRHcsc8qxUIzgfEUEprgQRUlUsSRlLClFi9xFzfCPwELzhhbvv 9pJdZFNVynvwfT3Fvrln1kzxaXEUlhndVgx6VoGnf51RIQWAXoeaGS7gSln7GOry2E7Q tG6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XULmqv9a; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s2si85915jaj.81.2021.08.25.09.32.49; Wed, 25 Aug 2021 09:33:11 -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=@gmail.com header.s=20161025 header.b=XULmqv9a; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234737AbhHYQcr (ORCPT + 99 others); Wed, 25 Aug 2021 12:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240303AbhHYQcp (ORCPT ); Wed, 25 Aug 2021 12:32:45 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 739EBC0613CF; Wed, 25 Aug 2021 09:31:59 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id n27so20839261eja.5; Wed, 25 Aug 2021 09:31:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wMkJXZoogesNm5JJZvMGG6cJlR5rgjyot4jq2nzi3Aw=; b=XULmqv9aBdS0Fee5y/TVfH7zm0Ki8Fr9H6xJYbd0rgvjJtLfgAxop9scK+vLa5YF7Q ukSf92YyYuuQd/O8ZZsjGI9hE1j+oCpd+hr3dAHN3kkyZGA6gwGLU83U1lOgfLD8UqP8 8L0bsVwbZ1o3hbubchyuRfG94vhOJq3fimjwrPyi81k0fIXjklnca92aKj3WQoj4fn5v Ws9+UJMA2uevL8VA2/+8ZeYGLy2p7aZwhafF+9t2DhnRkJ/PFfOY/aRf+dVBG4sRCmtU CV6orFj5J2Ba/ezTejHEBAHrDkMSCv/KF844Hk+jogvV7mtmKSQ3UiXLcMn0F00vBA2b vrcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wMkJXZoogesNm5JJZvMGG6cJlR5rgjyot4jq2nzi3Aw=; b=jOaRvfG4CdG7+5hAwusJDmL8egOvWnWliM5KV8QsKS+zIe+5gc1Eb/Rpkd1Z0WZ4N6 qiZeW2ZShhoARBysCwH9uAXcIBMb+l5diDxbGjfsvywQgprA/MG3AvOeNGyROcAbhi3C 2yqW6Oxyxc2nUrg0eXJ4DKaINO7IaWVgqViib8H6fo6eofDPVS8WQUU1cS5pDkYCPXDp u3y3WSoeam6YH2KS/GAiziVCx+iN+DTcexrf7PpTqhvX+gPGtow+yEP8WGoCb9DEPJRX 2aR66g9G6X3Rg2BPRTnkPPDrNONFB2Ie2SsxLRCxP4uI/o3a9l9PX1+p1CP2WFetTgMF yacw== X-Gm-Message-State: AOAM530cRMvKYQ28xdtIE4RdxyTt4KaebeyKDQoJZHuqcCquhy5Ot15S kVYSKX0p8Y9SvGH64WW5hB57wSxuswMM1A== X-Received: by 2002:a17:907:7785:: with SMTP id ky5mr9640191ejc.247.1629909118029; Wed, 25 Aug 2021 09:31:58 -0700 (PDT) Received: from ?IPv6:2a04:241e:502:1d80:f02c:a1bd:70b1:fe95? ([2a04:241e:502:1d80:f02c:a1bd:70b1:fe95]) by smtp.gmail.com with ESMTPSA id y21sm302048edu.13.2021.08.25.09.31.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Aug 2021 09:31:57 -0700 (PDT) Subject: Re: [RFCv3 05/15] tcp: authopt: Add crypto initialization To: Ard Biesheuvel , Herbert Xu Cc: Eric Dumazet , Eric Biggers , Dmitry Safonov <0x7f454c46@gmail.com>, David Ahern , Shuah Khan , Eric Dumazet , "David S. Miller" , Kuniyuki Iwashima , Hideaki YOSHIFUJI , Jakub Kicinski , Yuchung Cheng , Francesco Ruggeri , Mat Martineau , Christoph Paasch , Ivan Delalande , Priyaranjan Jha , Menglong Dong , "open list:BPF JIT for MIPS (32-BIT AND 64-BIT)" , Linux Crypto Mailing List , "open list:KERNEL SELFTEST FRAMEWORK" , Linux Kernel Mailing List References: <30f73293-ea03-d18f-d923-0cf499d4b208@gmail.com> <20210825080817.GA19149@gondor.apana.org.au> From: Leonard Crestez Message-ID: Date: Wed, 25 Aug 2021 19:31:55 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 8/25/21 7:04 PM, Ard Biesheuvel wrote: > On Wed, 25 Aug 2021 at 10:08, Herbert Xu wrote: >> >> On Tue, Aug 24, 2021 at 04:34:58PM -0700, Eric Dumazet wrote: >>> >>> On 8/24/21 2:34 PM, Leonard Crestez wrote: >>>> The crypto_shash API is used in order to compute packet signatures. The >>>> API comes with several unfortunate limitations: >>>> >>>> 1) Allocating a crypto_shash can sleep and must be done in user context. >>>> 2) Packet signatures must be computed in softirq context >>>> 3) Packet signatures use dynamic "traffic keys" which require exclusive >>>> access to crypto_shash for crypto_setkey. >>>> >>>> The solution is to allocate one crypto_shash for each possible cpu for >>>> each algorithm at setsockopt time. The per-cpu tfm is then borrowed from >>>> softirq context, signatures are computed and the tfm is returned. >>>> >>> >>> I could not see the per-cpu stuff that you mention in the changelog. >> >> Perhaps it's time we moved the key information from the tfm into >> the request structure for hashes? Or at least provide a way for >> the key to be in the request structure in addition to the tfm as >> the tfm model still works for IPsec. Ard/Eric, what do you think >> about that? >> > > I think it makes sense for a shash desc to have the ability to carry a > key, which will be used instead of the TFM key, but this seems like > quite a lot of work, given that all implementations will need to be > updated. Also, setkey() can currently sleep, so we need to check > whether the existing key manipulation code can actually execute during > init/update/final if sleeping is not permitted. Are you sure that setkey can sleep? The documentation is not clear, maybe it only applies to certain hardware implementations? The TCP Authentication Option needs dynamic keys for SYN and SYNACK packets, all of which happens in BH context. -- Regards, Leonard