Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1426920rdb; Sat, 18 Nov 2023 16:33:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZ+KJKr+rZN5WGh5YnaLRu/hC9DyZy5c1q+/LUuTg4j5PnVWVZn4bYKoB1MHtrY7qQu3/a X-Received: by 2002:a17:90b:3b43:b0:27d:60b1:4f2c with SMTP id ot3-20020a17090b3b4300b0027d60b14f2cmr2560845pjb.4.1700354011236; Sat, 18 Nov 2023 16:33:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700354011; cv=none; d=google.com; s=arc-20160816; b=hDeJKtCKNiR8ScQV/2Dxfb4rSh7IsbUNcEFTnBO8LsBl2nZ42us2ONlF/AlL6wTzV+ /TzMZUlY1wlMm0XhZve4TDEMYD2TL0fL2SMMSriyTD7p8xXnKI2oKzcF97XmzytLYeOz EdJy9oK+I7yPJ6WAymJ3jfedIGPbC0r18P5ynkzjVn7cFATNYhnqqpLHgllPS5q00NCm /9Ee1U8qCG5ZLEXv5GeAXJRqlfbLR+8bLwPQNxlTZmEnvzg0/IJCeodsgpxBrJIHee6h mOr9+i6GiTO2xqq8/KTPoWRZW6Y+XdgJVT3SA6Fmu87QoGxtF5bpSdCHnWP6LWtYzgQ7 r4FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=8o1oNmaFZ0ntKwjXKoCN526PrPN6jcZ6l3gzfiJBit4=; fh=tQBjE10fvMBuexszDbkazftFsdGcglkS4kikJYeaJK0=; b=Kv3i12RZPeAxjIS5aBmLLT3JDVtLb5O61AvskxkF62MIHozTlQj/upESvZAmpupqQM 9ml6uvc1le6IrRF5YZ91kAQppyCz4VZBDi1px9uXtaUs7NG5ooEavO29zogZnqfthc2g dZPsnJ7ZtfkTebI/VuWu2ZGXOetRd+TQ+UakTawVoW086ndxe3dd+n7nXREZ1wFU5KbU 4Yn4zorrfJUFxlQFFdK/ftBUdKOTrzz4Ogdsz1nIqs4CEKVlDcl5tTMV16fJ/p9uJxx0 XKBDdUjvEGWdczdnR0plv6Vsi2PdZ49ouhqBH8irPJVAbAKN1MOMZhULyBL2kdej3pd3 uH8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Y4+xPbLr; spf=pass (google.com: domain of linux-crypto+bounces-185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-185-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t21-20020a17090a449500b00283a1123a02si3497996pjg.96.2023.11.18.16.33.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 16:33:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Y4+xPbLr; spf=pass (google.com: domain of linux-crypto+bounces-185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-185-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 063F9B2096C for ; Sun, 19 Nov 2023 00:33:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A7BF1FCB for ; Sun, 19 Nov 2023 00:33:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y4+xPbLr" X-Original-To: linux-crypto@vger.kernel.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE83ED49; Sat, 18 Nov 2023 15:35:37 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-32f8441dfb5so2413164f8f.0; Sat, 18 Nov 2023 15:35:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700350536; x=1700955336; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8o1oNmaFZ0ntKwjXKoCN526PrPN6jcZ6l3gzfiJBit4=; b=Y4+xPbLr6jZ2upM3IdZ4w1Bfl/rKBCOraENVwNQIPkOCmTjV9buBbv5Cwv5QD0hdQX CB8Rg6wNobyIgBrARRCT7Outig9u/+ASpYwnvKXG8ddQuyrzV058Pd1s69bBIMGaBRN7 VnwOsrbbgYjlhbUml6NklSCnVeWgZJagQYcgIjvSW3NGfA0HjMk+0ZCFm6pc6jVHM/ha eymOvpt4b8SWL3W4muHRnBr3/ANWDHx8MZw/DgfkmZsQayROJIaeYkOkws7jEawXUHRK tK5LcnYlwjvSXG2pOp2g9BXs86uTWWNHJx4hTrXAE/TBIYex/Y6PyeOHV2/Gbup2CUmo mMHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700350536; x=1700955336; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8o1oNmaFZ0ntKwjXKoCN526PrPN6jcZ6l3gzfiJBit4=; b=MHKQ+1YbIVN1IozZ2ur777aBZBzuOr6vIU8dnfDyGpAnMXGFp9pUxtuVw2Ko048rS+ EGLtygOpjiK3wGcphyutA3k5SHqGEivQ81Kx7rhQcZyV0j+61RnJRk/OXy8MM4L57IqS aHmHKkYGjV2esfNmOw0q49Vw64cxGXyeik8plLACTiUjJ3e2fe5fQ8dpaERo8mWmN0Wi yuSv9dvl1APy76A68GjlYeLR9n0wkMDMO4ryM6t618LCEqttjQjbwGfcUE9rCes0helc QNGP3t32CGGP1KFoMhmJv6WFwHUWt5wUVRNIqH8OlbfmYhvo1RKNlUH5Ar2eId+3sEkH i4kg== X-Gm-Message-State: AOJu0YynZX3ZY4yiejhsdccTwFrmVhq2KjYz8WkNTVlHZ7BRlo2eYcr9 ZJS2ilxEUjz8RLReuy2Ax8Cyl5s/J0BiBpFKwSdSaimp X-Received: by 2002:adf:fa44:0:b0:32f:ad68:7474 with SMTP id y4-20020adffa44000000b0032fad687474mr2400325wrr.20.1700350535999; Sat, 18 Nov 2023 15:35:35 -0800 (PST) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231118225451.2132137-1-vadfed@meta.com> <862c832a-da98-4bef-80ef-8294be1d4601@linux.dev> In-Reply-To: <862c832a-da98-4bef-80ef-8294be1d4601@linux.dev> From: Alexei Starovoitov Date: Sat, 18 Nov 2023 15:35:24 -0800 Message-ID: Subject: Re: [PATCH bpf-next v5 1/2] bpf: add skcipher API support to TC/XDP programs To: Vadim Fedorenko Cc: Vadim Fedorenko , Jakub Kicinski , Martin KaFai Lau , Andrii Nakryiko , Alexei Starovoitov , Mykola Lysenko , Herbert Xu , Network Development , Linux Crypto Mailing List , bpf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Nov 18, 2023 at 3:32=E2=80=AFPM Vadim Fedorenko wrote: > > On 18/11/2023 18:23, Alexei Starovoitov wrote: > > On Sat, Nov 18, 2023 at 2:55=E2=80=AFPM Vadim Fedorenko wrote: > >> > >> +/** > >> + * struct bpf_crypto_lskcipher_ctx - refcounted BPF sync skcipher con= text structure > >> + * @tfm: The pointer to crypto_sync_skcipher struct. > >> + * @rcu: The RCU head used to free the crypto context with RCU = safety. > >> + * @usage: Object reference counter. When the refcount goes to 0,= the > >> + * memory is released back to the BPF allocator, which pr= ovides > >> + * RCU safety. > >> + */ > >> +struct bpf_crypto_lskcipher_ctx { > >> + struct crypto_lskcipher *tfm; > >> + struct rcu_head rcu; > >> + refcount_t usage; > >> +}; > >> + > >> +__bpf_kfunc_start_defs(); > >> + > >> +/** > >> + * bpf_crypto_lskcipher_ctx_create() - Create a mutable BPF crypto co= ntext. > > > > Let's drop 'lskcipher' from the kfunc names and ctx struct. > > bpf users don't need to know the internal implementation details. > > bpf_crypto_encrypt/decrypt() is clear enough. > > The only reason I added it was the existence of AEAD subset of crypto > API. And this subset can also be implemented in bpf later, and there > will be inconsistency in naming then if we add aead in future names. > WDYT? You mean future async apis ? Just bpf_crypto_encrypt_async() ?