Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1129675ybc; Tue, 12 Nov 2019 14:58:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwBsu3PLDZwTnrSFp6vh41IlFeCGvdPdPya21eBDMFvTFkJkirKCWXTguEth2L80TGAdAtT X-Received: by 2002:a17:906:4096:: with SMTP id u22mr30850374ejj.264.1573599508670; Tue, 12 Nov 2019 14:58:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573599508; cv=none; d=google.com; s=arc-20160816; b=yxcNO3Sad0K+4fwjaFf6XVJAH8Ulvhi1rZKQtkZKoY3lCN676+FWg9Gx6vHCmBoev0 +79GUXW8MkgASfVDstiJLC279kDC+XFln02RMCsKN/iu6WNZfqQ/p3BJJY3CTny/72uC nSmzS6RUO4gdRiWD4sTq+z/K2cGwaAEju20zBDYlWYGNtbbYL6o7HkxhMw/ikbOxre+u Auy2cWJ5lVk3VGpQQRpYNZXRlTKbQ9owxpgOByul1AxD8yJK3CRDjL0vj6wa7OK3rjIZ GEnt2/PfnMAxkmIWAwl7D6Xwljn3fgQzVXmlWjWngJo9NpfCKjeKkn3Uv3UEcBKCe0uz IHGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zpJ/TMpVSKZy+JXxk/4c68rZdEAtB+OaqfRaFt77y6Y=; b=jbdXcXScJ8qLxoYFmrsz4LLHXnBBYxDLrz52lFARYm8u7E9SdNuqYbFqJqbyjIs+d2 LVtbYXIzPARDvq8DMhIkQgRKe5Rtq+4Yi23TZr02otEbDoMlRsCy2adU60hz3UemHYUP XzTz7Wz4/KP+CDIYIpKJGapt2FrN8soPfeF+0gKASifJOOEwgbF7QYt2KaYqXwNZkH3N tyVZ6MZJ77mBEUNP6OPp/O0Z9gfH4UpCbA9FNNlSSAVMiwHzqWA37zsVhYwiGYgQm8qa oWbZNufM3bmmWVCI64v+aUlsUSwO83Nm663zyKd/oH46y7WX1bjfbZvYAaFzXJa0WCfp u9xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="IsPQL/hU"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k15si932803ejr.327.2019.11.12.14.57.59; Tue, 12 Nov 2019 14:58:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="IsPQL/hU"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726995AbfKLW4t (ORCPT + 99 others); Tue, 12 Nov 2019 17:56:49 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38748 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726910AbfKLW4s (ORCPT ); Tue, 12 Nov 2019 17:56:48 -0500 Received: by mail-pf1-f194.google.com with SMTP id c13so152242pfp.5 for ; Tue, 12 Nov 2019 14:56:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=zpJ/TMpVSKZy+JXxk/4c68rZdEAtB+OaqfRaFt77y6Y=; b=IsPQL/hU3IhF+qfkUCRWUrXYZheaE/5EOnSVDyJp/WnzWjkB3a7igBYUvpzviMn6L3 EWwKMMcbTBSkE9j6+lM7cjybdedxFAxjw34SjY8xUmExgVx9vkxyfsA7HCeOc5ODgssQ WFs7WhwKK8SIMbSuP6MoGhI6aOCwmBoWjhHQo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zpJ/TMpVSKZy+JXxk/4c68rZdEAtB+OaqfRaFt77y6Y=; b=TfGfuodjZzMIb2fWce5JJSEDW55sXzP+lz3DXxKcGjI3jsytT7E7/ndJ/LjNV50cWT Or0DiLDLq6HsIoS3PohxJHk7hcbKqxTRVT6XSF78UuM9PdBZszeQN5//07fve9kBxXNK HBdguiQrJT7GKqAeuF1HuCyAbYDHK7L15Sw7fpafkfmBPZNZyHqI3857HZMSK6WPXYgm 7uXxhBp60AuIbpZSTjGtEGMZffT/Z+utNH0UBQ+SIXf8Sl8ly48RUvyMmIh78qnTuF+Q Jy4PoTZOnGuhjha8cplOTLAhL41U8nBNfa7FZW7GQ6Qxn4/JwOVC4F5qvkrnzz+tDb9l tlqw== X-Gm-Message-State: APjAAAWY0psn6q3pEb1Y0hj0SSq7HVJBfuXrTpUlTksktzrs+gUJK1aJ GaLyFaBC4VCcdjvjXsF7mdNouA== X-Received: by 2002:a17:90a:d102:: with SMTP id l2mr363545pju.132.1573599406393; Tue, 12 Nov 2019 14:56:46 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e198sm18553pfh.83.2019.11.12.14.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 14:56:45 -0800 (PST) Date: Tue, 12 Nov 2019 14:56:44 -0800 From: Kees Cook To: Herbert Xu Cc: Stephan =?iso-8859-1?Q?M=FCller?= , =?iso-8859-1?Q?Jo=E3o?= Moreira , Sami Tolvanen , "David S. Miller" , Ard Biesheuvel , x86@kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [PATCH v4 3/8] crypto: x86/camellia: Use new glue function macros Message-ID: <201911121452.AE2672AECB@keescook> References: <20191111214552.36717-1-keescook@chromium.org> <20191111214552.36717-4-keescook@chromium.org> <3059417.7DhL3USBNQ@positron.chronox.de> <20191112031417.GB1433@sol.localdomain> <20191112031635.jm32vne33qxh7ojh@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191112031635.jm32vne33qxh7ojh@gondor.apana.org.au> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Nov 12, 2019 at 11:16:35AM +0800, Herbert Xu wrote: > On Mon, Nov 11, 2019 at 07:14:17PM -0800, Eric Biggers wrote: > > > > Also, I don't see the point of the macros, other than to obfuscate things. To > > keep things straightforward, I think we should keep the explicit function > > prototypes for each algorithm. > > I agree. Kees, please get rid of the macros. Okay, if we do that, then we'll likely be dropping a lot of union logic (since ecb and cbc end up with identical params and ctr and xts do too): typedef void (*common_glue_func_t)(void *ctx, u8 *dst, const u8 *src); typedef void (*common_glue_cbc_func_t)(void *ctx, u128 *dst, const u128 *src); typedef void (*common_glue_ctr_func_t)(void *ctx, u128 *dst, const u128 *src, le128 *iv); typedef void (*common_glue_xts_func_t)(void *ctx, u128 *dst, const u128 *src, le128 *iv); ... struct common_glue_func_entry { unsigned int num_blocks; /* number of blocks that @fn will process */ union { common_glue_func_t ecb; common_glue_cbc_func_t cbc; common_glue_ctr_func_t ctr; common_glue_xts_func_t xts; } fn_u; }; These would end up being just: typedef void (*common_glue_func_t)(void *ctx, u8 *dst, const u8 *src); typedef void (*common_glue_iv_func_t)(void *ctx, u8 *dst, const u8 *src, le128 *iv); ... struct common_glue_func_entry { unsigned int num_blocks; /* number of blocks that @fn will process */ union { common_glue_func_t func; common_glue_iv_func_t iv_func; } fn_u; Is that reasonable? -- Kees Cook