Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1798449rdb; Sun, 19 Nov 2023 10:40:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtq9a9LjtaMi8GnpVS+ddCyAE+XLHn46T2dvWk+ImBu7btF0zeWVh25DUsQ8e65S86isEL X-Received: by 2002:a05:6870:91cd:b0:1ea:bb5:a531 with SMTP id c13-20020a05687091cd00b001ea0bb5a531mr7065972oaf.13.1700419233093; Sun, 19 Nov 2023 10:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700419233; cv=none; d=google.com; s=arc-20160816; b=uqDLDb3gTmUNkLTtIu5jJixQYaVZQuaAUgGbTWs4oYjNwllhCmlRfR8aWIsmeZS81/ U0Ia4+CCqZxpAqLa4KYc/0v5lJ2Wsc57jLPI+p+28dx3fMiQhMyHrm4vwO5c9HeozoeZ k4/bnq1Qr30YsuxmyYgPvUrz4wu6TCBhlLFtUiIbzg37PXLF890zeUtxIFcn8KCkSyZH nA4Alo02yovT6ztJ+sKrzqrp/crOW+YkoX3Rfax8tzgkRerkyi7nEQ4MIUi47Zv2O5d9 WHwOXhzHqZ749cxDAZLI/kdIa0i1M6UqLfmO3f641tUM/XzP26+lMNxqjBLgyerv+usb oH9A== 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=7wIX8ORXLGy4iPlNpzgFGE4EPRBwYYYCdBAHOnzVq8k=; fh=tQBjE10fvMBuexszDbkazftFsdGcglkS4kikJYeaJK0=; b=B1ce/MLX5ObnSfTtkCc/7NGiNh20abaoHbe3LAXWQnvB4nXT7LthE1ZSwMTiJy/WIA YMuH/fs/fe/aGfebO99WPC5NPKigTmr5n4kGDDLCv6p9k6vHAeUHc+x1sBYMZcnirgrH sMQHWoQVCRGbdXcuhKKpM1PdpmVoo/XmUhqKpPKRs1n/vxrY4yPC/TIuLVtHZAhCIQRo 5k0LhckuCuTojbP3o6Nj8kIt//VyO3I7pY4WTUh8GnvXPwT3bzCGrImfCI+aXqeSg3Ky OjE3jDYBxe3hf66B2Ig4k3m/BVvKmN8/myIolG/LoPbXoEokDQczZleY+/Oqb321qFT6 IaMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ULIuyBBp; spf=pass (google.com: domain of linux-crypto+bounces-189-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-crypto+bounces-189-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. [147.75.48.161]) by mx.google.com with ESMTPS id k10-20020a056a00134a00b006cb65cfde7fsi2913686pfu.91.2023.11.19.10.40.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 10:40:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-189-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ULIuyBBp; spf=pass (google.com: domain of linux-crypto+bounces-189-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-crypto+bounces-189-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 EA62CB2047D for ; Sun, 19 Nov 2023 18:40:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58DEE199B0 for ; Sun, 19 Nov 2023 18:40:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ULIuyBBp" 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 3978911A; Sun, 19 Nov 2023 08:56:51 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-32fadd4ad09so2687591f8f.1; Sun, 19 Nov 2023 08:56:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700413009; x=1701017809; 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=7wIX8ORXLGy4iPlNpzgFGE4EPRBwYYYCdBAHOnzVq8k=; b=ULIuyBBpng4LRBCxeJ3S8O0R19NZ1zZOS4e43Q7u5u4KJW+bSpKZfdKFpfRyHRptcr XDuewq3gKMwAU3APLNtexDxZ2hWfYXJ0VgnhiHlX6XFUTYran58dL26lMwVGU9wr9dFr BeXYTIHwlgST0bb6PeH9gTUT545Gqn6uakC5WZzjOLx0TC6KPqd4g3aLNEDx8sX+26lt Gdd0bDToKRRa8ygjTHnXAhyZx0mXig0uo70tJn9xxv7MEfMTT2Fwnd5RxtuA+HbyP/DB ZwstDQVMJpSecnBaAgmPKUJTrpNXqtsInH4P48DCAyM6kJQMGmcg9QJi+zUwulH8w9K6 pcNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700413009; x=1701017809; 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=7wIX8ORXLGy4iPlNpzgFGE4EPRBwYYYCdBAHOnzVq8k=; b=a6KKiqg0LbRSSUjRNSHfjvCdU57O/TJ2JJhq6uo6chSql8vxEWTC0ik54W/Awx37en l6tDPY1ttWMc/pzDgCIMSaNZb+c0k3V63Qow9sNssYGQK3oTqynz7MoDL3n5nW55yGhO Qgd1AW+pl9yvrkxIf9rbRHiwrO2k2fFPf3fM4f8JGBnmdtJ5XwOruQvnbhA3cGmUR6Yy RS4WgVIpLF4t5xWn7Hd1XdM1DzngmajHlduAbpeC4ok6bG3xDT1sE2X0kDFuvfXY0kA2 avQHCHt87TQVykaSNFrznEZGt4dNBvvdTbpVfIUBAzOUhgDDgOfkQhkIwnRo1ZhXZunS uI+w== X-Gm-Message-State: AOJu0YxztpIqyIR61Z2lMbh3Na1Zc4TmRC8slYLN9RM/VKVnkXvquyI7 QLqeOqVM/Qk8AN+cNCbCxRvGb5A8ZlzCJZfsG1M= X-Received: by 2002:a5d:5886:0:b0:32d:ad05:906c with SMTP id n6-20020a5d5886000000b0032dad05906cmr4403585wrf.3.1700413009333; Sun, 19 Nov 2023 08:56:49 -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> <312531ec-aba5-4050-b236-dc9b456c7280@linux.dev> In-Reply-To: <312531ec-aba5-4050-b236-dc9b456c7280@linux.dev> From: Alexei Starovoitov Date: Sun, 19 Nov 2023 08:56:37 -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:46=E2=80=AFPM Vadim Fedorenko wrote: > > On 18/11/2023 18:35, Alexei Starovoitov wrote: > > 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 c= ontext structure > >>>> + * @tfm: The pointer to crypto_sync_skcipher struct. > >>>> + * @rcu: The RCU head used to free the crypto context with RC= U safety. > >>>> + * @usage: Object reference counter. When the refcount goes to = 0, the > >>>> + * memory is released back to the BPF allocator, which = provides > >>>> + * 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 = context. > >>> > >>> 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() ? > > Well, not only async. It's about Authenticated Encryption With > Associated Data (AEAD) Cipher API defined in crypto/aead.h. It's > ciphers with additional hmac function, like > 'authenc(hmac(sha256),cbc(aes))'. It has very similar API with only > difference of having Authenticated data in the encrypted block. and ? I'm not following what you're trying to say. Where is the inconsistency ? My point again is that lskcipher vs skcipher vs foo is an implementation detail that shouldn't be exposed in the name.