Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3176954ybh; Mon, 5 Aug 2019 13:31:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqypue1umDkHJkXXQVvnef6wyDLVcuEBwDMWQ4jcE7+MsvvwijoyNxKgL/BisaB2MRu9QiYU X-Received: by 2002:a17:90a:c391:: with SMTP id h17mr20152084pjt.131.1565037092789; Mon, 05 Aug 2019 13:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565037092; cv=none; d=google.com; s=arc-20160816; b=dudmN0RexARFIVY0uL6ENGCajNPLrexTsEGUGBQLa5SyFk2KX2TjFFVNr0GUyy1yOd bZ6x/Dwd3PmQwmvu3nDem9A3BbFE91a6dO73A5pep4QYz6ApyH2cV6TNR5P8YRmv21j6 Os7szD1Rp9NmUtgtj9rz5VetDOuLpa3g/CvL7NSfglLrF49oRZtyJYEueoeF3oX0gHwt +mPYBC70gYSXcORXrg8OLC9eluBc7Oe0CDI6up6vG2CcFRNB9TwGJlVDWtVWALJ/q1jp frX8OGgoN5Dx7jrwtC/+BpiTSSm8VH6oS5I0HoFq/IcTuWbpyWK/OPf9f5p9OhOiyawn HlmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=rPyXaFAVZ7AVV36zYzo2icT2RiHdu+UYjxl8ZZTBuMo=; b=KtptkbtAOCx+9o0zbf96zJNqyMSoXm2xHXsVJSCUd3IBH6Cg2xhHGX0IvyUE6LFJdj lPgzQPYflD9J4HSo7HHnydHFlfUPjQP/Rw34bIAdH1cJk1uOPfZsuUDdVkbFuJbma0iH LFf54QqfvISso4S9kZQXP5EyxUPk0MeUXGv1ouEHxzG87BfqWjs5YSotYXB+nmjsuj9q xacuXZLXCdleb2yRUF1Qz+PpDL3p6cAEs5ezryRFjaEVyXgowV5YGNgnVKkOLduIXI4e 5+5HGwt85ibHb/dWzjVylQ2SoeV/dYO50fkgNd7SrhqM77ypUwK3UtpB8Cxo6WPwB5KA CbsA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5si45705222pgr.172.2019.08.05.13.31.16; Mon, 05 Aug 2019 13:31:32 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730515AbfHEUaR (ORCPT + 99 others); Mon, 5 Aug 2019 16:30:17 -0400 Received: from mga05.intel.com ([192.55.52.43]:37312 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727802AbfHEUaR (ORCPT ); Mon, 5 Aug 2019 16:30:17 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Aug 2019 13:30:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,350,1559545200"; d="scan'208";a="198086880" Received: from alison-desk.jf.intel.com ([10.54.74.53]) by fmsmga004.fm.intel.com with ESMTP; 05 Aug 2019 13:30:15 -0700 Date: Mon, 5 Aug 2019 13:31:02 -0700 From: Alison Schofield To: Ben Boeckel Cc: "Kirill A. Shutemov" , Andrew Morton , x86@kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , David Howells , Kees Cook , Dave Hansen , Kai Huang , Jacob Pan , linux-mm@kvack.org, kvm@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A . Shutemov" Subject: Re: [PATCHv2 25/59] keys/mktme: Preparse the MKTME key payload Message-ID: <20190805203102.GA7592@alison-desk.jf.intel.com> References: <20190731150813.26289-1-kirill.shutemov@linux.intel.com> <20190731150813.26289-26-kirill.shutemov@linux.intel.com> <20190805115819.GA31656@rotor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190805115819.GA31656@rotor> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 05, 2019 at 07:58:19AM -0400, Ben Boeckel wrote: > On Wed, Jul 31, 2019 at 18:07:39 +0300, Kirill A. Shutemov wrote: > > From: Alison Schofield > > +/* Make sure arguments are correct for the TYPE of key requested */ > > +static int mktme_check_options(u32 *payload, unsigned long token_mask, > > + enum mktme_type type, enum mktme_alg alg) > > +{ > > + if (!token_mask) > > + return -EINVAL; > > + > > + switch (type) { > > + case MKTME_TYPE_CPU: > > + if (test_bit(OPT_ALGORITHM, &token_mask)) > > + *payload |= (1 << alg) << 8; > > + else > > + return -EINVAL; > > + > > + *payload |= MKTME_KEYID_SET_KEY_RANDOM; > > + break; > > + > > + case MKTME_TYPE_NO_ENCRYPT: if (test_bit(OPT_ALGORITHM, &token_mask)) return -EINVAL; > > + *payload |= MKTME_KEYID_NO_ENCRYPT; > > + break; > > The documentation states that for `type=no-encrypt`, algorithm must not > be specified at all. Where is that checked? > > --Ben It's not currently checked, but should be. I'll add it as shown above. Thanks for the review, Alison