Received: by 10.213.65.68 with SMTP id h4csp2622654imn; Mon, 9 Apr 2018 06:33:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx49HFZ3MhFTShgmfULTTjTBhzUEN9rWhCxmHtwUkzqP6UE3E0kADBiGD2XHx6lw8DYdr7bu4 X-Received: by 2002:a17:902:525:: with SMTP id 34-v6mr38491166plf.267.1523280828356; Mon, 09 Apr 2018 06:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523280828; cv=none; d=google.com; s=arc-20160816; b=bg00Rn40sRdtOhfQr0gFYuH9X6B/HkGl9160clZUOCuXkoUrQHETZDD8uAQQ4ultXd Ps6r/Di4Jjpf/nZ2eAMi3AVwDhSEqJbbCCCiX3XjitF99EzqAGBTl2pjQK8O86Lj3B8D wTWc/H5bACGvrLRmdPh2q3YE6rsESoaIWAZGonb6J9nWPNdjHzUcPafcQvINSqBA4C/G rAzTmrLLmHJWV4ST5LzRf5C2DgJNJEvBl7CFY1fx2OCevS464IfaKIbo0uzkZumV7gNr gVY6gVjw6QeFEBx6CIiyKh4a+BTBbzTQyAMwDIhEJzQf2n2+JSI/DXMteeATfEokz+Gc W3Fg== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=/CDar8QVZCjkes7CrCBSRdt9tZIT5ddBFgazLtz29Fw=; b=0BZJma4RGB/2oTROREtt5plAB5qP3CfVYKB5h4SKumTsaAakA9DMG9hBgiqHO5Bvxa BMDQXbgDiFwHTOFx2d6mhnm9sfoVgC0QYLn4T3wSR48toXl38HlrVUhEr6ieC08EHDp8 bUiF/P1bidMKGvGuyUBHgL5EKySK8fScKqdDX9+dorDa1nSdgekyWkKYfoKi+CMWZCbB Sb8nL2EIVY5IuLEVONt1XWX7wgtmDk5LNipYD2Lh2Sb5KyyZZ5/fxy82wRRQEEyK7MPE YuzE0/imbYAx5J8XwvEfQGoscgNFv1+qla30nBDs19SSjBIVJjC7op5oLZXj24EcM4KO UygA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ASVMXcsJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id m30-v6si197212pli.210.2018.04.09.06.33.11; Mon, 09 Apr 2018 06:33:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@gmail.com header.s=20161025 header.b=ASVMXcsJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1752389AbeDIN10 (ORCPT + 99 others); Mon, 9 Apr 2018 09:27:26 -0400 Received: from mail-ua0-f180.google.com ([209.85.217.180]:44190 "EHLO mail-ua0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbeDIN1Y (ORCPT ); Mon, 9 Apr 2018 09:27:24 -0400 Received: by mail-ua0-f180.google.com with SMTP id r16so4938435uak.11; Mon, 09 Apr 2018 06:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/CDar8QVZCjkes7CrCBSRdt9tZIT5ddBFgazLtz29Fw=; b=ASVMXcsJn9dyAU4wu7zuyAIxlD5Y/Lw7oshoNZEiSlSY1MOzN1zXdMi3FmQ2NKEPwQ lzeoFlU8tv+mcu6PXfe6yVBm0VJky1z78x0zfUCRK4uGch5XA/uQUG5W16bljbL0tzc3 kAQ9oHFsCN5AZTjwZ5lH4ZFPJJRjQcqWQkSWtduFJWjritjlPqXNmjxIjvpIfLTDqG8v aRqS3QO5s47ktKPqcQe9mLbm3lpjvujlD9jElWs+CujVLYP5G6ef9PpduQivFlMNcZXt 2ASuZqGPoiD7IydaTJPARmNbJ7RnXmERYR11G1+Q9a4Ud6FTt6N/S5lI+3pqJMQsSr5y QktA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/CDar8QVZCjkes7CrCBSRdt9tZIT5ddBFgazLtz29Fw=; b=ubcXzlm/9GK3vbP0cx49mVI0e1E8pkM+nzx42boZLmwqs90FkJ4TIoZUE2lxC6pM2N o9CjR8tUrfgB6DFV0nXSKIbc//8tO1ZxNjp+65FV7q222yQG6NesxjVR5eFOc8Nlgv1u 9yq1J0WzEk1SvsTcQXLrfMit+J/ADZlXrpcBc/6JTzxSV01Cx9wDi944XN3VbuY07OIg vl/Ge0lNf2b9KMXDbc8wp2XAq6uR3Uk3fOhAZMw2ENpR03DbSjq5RaPKTDkjA15+Z3m8 Fr85zRj/1UG7th9GtMaDbGMzlMFSHDKrBGhhFcsnhiPX5gZb+RqLu6wnb9HMmYRHiNi2 0yhw== X-Gm-Message-State: ALQs6tDhK294A3OQf0zN6TKo1Uz94n3oCfx8qicFgR1T0wnXr4ZG6Irt ViegkqGwURjG9FfE64Rbm/NKdoNu+VGBp5zclcc= X-Received: by 10.159.49.94 with SMTP id n30mr24646516uab.169.1523280443991; Mon, 09 Apr 2018 06:27:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.179.9 with HTTP; Mon, 9 Apr 2018 06:27:03 -0700 (PDT) In-Reply-To: <20180408092219.s24ymooq7afu43c2@gondor.apana.org.au> References: <1523126303-23205-1-git-send-email-s.mesoraca16@gmail.com> <1523126303-23205-4-git-send-email-s.mesoraca16@gmail.com> <20180408031619.GB25197@gondor.apana.org.au> <20180408092219.s24ymooq7afu43c2@gondor.apana.org.au> From: Salvatore Mesoraca Date: Mon, 9 Apr 2018 15:27:03 +0200 Message-ID: Subject: Re: [PATCH 3/6] crypto: api - avoid VLA use To: Herbert Xu Cc: linux-kernel@vger.kernel.org, Kernel Hardening , linux-crypto@vger.kernel.org, "David S. Miller" , Kees Cook , Eric Biggers , Laura Abbott Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-04-08 11:22 GMT+02:00 Herbert Xu : > On Sun, Apr 08, 2018 at 11:07:12AM +0200, Salvatore Mesoraca wrote: >> >> > This check should be done when the algorithm is registered. Perhaps >> > crypto_check_alg. >> >> Please correct me if I'm wrong: >> isn't crypto_check_alg invoked also during hashing algorithm registration? >> In this patch-set I'm dealing only with ciphers, because the maximum >> block size (16) >> is relatively small and it's also the most common block size with >> ciphers (maybe I should >> have explicitly referenced ciphers in the macro names, my bad). >> I don't think that it would be OK to use a similar approach for hashes >> too, because some >> of them have block size >= 1024 bytes. > > Yes we want to make it for ciphers only even if we move it to > crypto_check_alg. > > For a legacy type like cipher cou can do it by > > if (!alg->cra_type && (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == > CRYPTO_ALG_TYPE_CIPHER) > do_cipher_specific_check(); > Thank you very much for your help. I'm sending the new version. Salvatore