Received: by 10.192.165.156 with SMTP id m28csp169166imm; Tue, 17 Apr 2018 08:13:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/2HS0Kkpa0FFiCcpP32evVuMlTom1ldMsydz3vpC33WyffRD14ql3rd3lq1z0LCnVyUgh0 X-Received: by 10.98.236.220 with SMTP id e89mr2365249pfm.33.1523978031497; Tue, 17 Apr 2018 08:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523978031; cv=none; d=google.com; s=arc-20160816; b=GCdM7brSSNj6144lb+cd3mBCSgzZdCBUXSFSN13FARHvBrAo83E1+9J+lVNFi+zDEh s0e9AZD/OOeY9JlD/9gjnQ4cE3RptKIHscL53rhmahjDWmTmAHHCaO9HMYRoR4g/lJVn feZIadkzfckCHwVw0QaeTuNfr6s62FBhyCPbag/KABKKM9oIr+dd5Q75WgY9K1Zjf+hP O4zoF1SltLiiRyMyvGpIDzfoHT6AUiGU7iHepmV/4p2XPJhKKYfvvVA9+uzS5uZvAgeX /yDJozqXiQ2zWZixV4+QYUCxudDgsx6AH/vBrTVdlYDPbT/+OiHluv73QHcn/6PMpQG8 PlgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=u1V/EO1O/5sqlci/5IBK6gZ+PQcITU/DTml80vd6Rac=; b=Vvb6wtEQXkBn8rsU8xfECeczLin4hyj1HaJy4/cwN9jorzyskkTWRcmB4+reMkts+G JQoPoc2j4BxevMvqyqs096CyT+eZmhbFEG1ZepMDq6HJULM+flb3l7Lnoq/lz8Q7gyGN osyxUyvQGeQubHcQDsv2d0UGenmIyqjPehUnkshi3RCFJra1Mgzb/FteNg2Elk4p56bC e6yBW+4uPiztmcTh/8c/lG+P3Zw3XsTugtInmuNKJihRO94Z6yXF8FmYTfHo+aG+wJpJ 8DySuWqx1X2VVm8LJw3CPC1XRNjR0S1acerQxzpgaEgbWLy1gQTsfTVLWWSlKU1H993W nqfw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a35-v6si14780711pli.71.2018.04.17.08.13.37; Tue, 17 Apr 2018 08:13:51 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752766AbeDQPMG (ORCPT + 99 others); Tue, 17 Apr 2018 11:12:06 -0400 Received: from vps-vb.mhejs.net ([37.28.154.113]:48922 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752199AbeDQPMF (ORCPT ); Tue, 17 Apr 2018 11:12:05 -0400 Received: by vps-vb.mhejs.net with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1f8SGx-0007wN-F5; Tue, 17 Apr 2018 17:11:55 +0200 Subject: Re: [PATCH v2] X.509: unpack RSA signatureValue field from BIT STRING To: Kamil Konieczny Cc: David Howells , Herbert Xu , "David S. Miller" , Tom Lendacky , Gary Hook , James Morris , "Serge E. Hallyn" , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org References: <6f5cdb8a-809e-6651-0e32-711d415a8b38@maciej.szmigiero.name> From: "Maciej S. Szmigiero" Message-ID: <7497a6f6-b9fc-a249-a6c8-42ff2723aa4a@maciej.szmigiero.name> Date: Tue, 17 Apr 2018 17:11:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-8859-2 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17.04.2018 17:07, Kamil Konieczny wrote: > > > On 17.04.2018 15:39, Maciej S. Szmigiero wrote: >> The signatureValue field of a X.509 certificate is encoded as a BIT STRING. >> For RSA signatures this BIT STRING is of so-called primitive subtype, which >> contains a u8 prefix indicating a count of unused bits in the encoding. >> >> We have to strip this prefix from signature data, just as we already do for >> key data in x509_extract_key_data() function. >> >> This wasn't noticed earlier because this prefix byte is zero for RSA key >> sizes divisible by 8. Since BIT STRING is a big-endian encoding adding zero >> prefixes has no bearing on its value. >> >> The signature length, however was incorrect, which is a problem for RSA >> implementations that need it to be exactly correct (like AMD CCP). >> >> Signed-off-by: Maciej S. Szmigiero > > your e-mail address looks incorrect > > [...] > What's wrong with it? Maciej