Received: by 10.192.165.156 with SMTP id m28csp166384imm; Tue, 17 Apr 2018 08:11:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/705jQGIQkiySVmmv/G+jYorNCm3CLL32aibNMumO7YCixpRl9/E+OmwHUBeOUhs0Pyxwd X-Received: by 2002:a17:902:b2c8:: with SMTP id x8-v6mr2387793plw.83.1523977878336; Tue, 17 Apr 2018 08:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523977878; cv=none; d=google.com; s=arc-20160816; b=pI57m+uxeCs/fBLlA+bx95T+hUIKJpeA6g0xWpl7o/svInv/nBWEmBLYBP3VRuu7U8 n50mLWVzq5BXSvH6oaj0ptNFqsQ2/DH5SGZa6ZdOQSJb7USM548UY8lGTr4bBQBv1CjC 38g+inZXeauMt83QnTEsV8tmPLOolilf4AmndsidTOtj3r/kuhUN3Oxnr/WOTlPT+25y qLtVkDNz9D4UZn1D8b1W6s1yiUF2bivvGRQHjRv0ApgaRFEntUvPAsXqU1/Ze3wRlqlh vEl4Q2D1NyJN7krJAdu5mptApHF0TK//9/uyolq+IkkR4phCN4uI5lIEr6YSpNUKRHF6 PF8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter:arc-authentication-results; bh=84WehRzH0x+cxM1+K1zwPbYOqunGZIjpOdJD3HJxoLo=; b=yFJfSkJomJtY2rF5jHRjzo2oaSTQmA5AMj5sF7G523q/wrO+71voKTmB+BlOzYK35Y Z+fsg/y2Hg8b71af0y648j1wIQ1C8jCN4BeXYy9Pw5+FkMoTEBf8F8dz0mbVFixS+me3 eyAKQQdJ+DH6gvV9RkW6fFP9p0BdBt4sD5EGhz1CJeb1AgdTr0LOF58svPEAA+IodfUv QbDxtpS44G+AEBhizo/ujw7zsxElEjNAcugwRn969y3fOcUj78CvWMj3OBc4ogPoSp1T Or2yuWkpgYuUlC8BNKLNcSIrLvMvgia9ByPmbykTneWhk/4/CBqrLMwdlE9UTNxIxN8Q dYDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=aS8qUaD5; 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=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p20si13166193pfi.345.2018.04.17.08.11.04; Tue, 17 Apr 2018 08:11:18 -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=@samsung.com header.s=mail20170921 header.b=aS8qUaD5; 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=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752684AbeDQPHr (ORCPT + 99 others); Tue, 17 Apr 2018 11:07:47 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:41233 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751204AbeDQPHo (ORCPT ); Tue, 17 Apr 2018 11:07:44 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180417150741euoutp02ed1e5ef384f3a68759e4474e3dbeef8b~mQZvvlwpp2001420014euoutp02W; Tue, 17 Apr 2018 15:07:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180417150741euoutp02ed1e5ef384f3a68759e4474e3dbeef8b~mQZvvlwpp2001420014euoutp02W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1523977661; bh=84WehRzH0x+cxM1+K1zwPbYOqunGZIjpOdJD3HJxoLo=; h=Subject:To:Cc:From:Date:In-reply-to:References:From; b=aS8qUaD5BA3rSfZqZcJoRF3lofiiNw2NQuQuNW3J+pkWYvsjV/L2gYXPuK+1o8/Me VlAfXKX0nyInfu1dVdFTLAAmEjzqVuY82R1XDEE4l9eTQ2XMEzIYxkdgVqKokvMf6O P05E1xz7MbicL0qDRNV6622hYyxYg+6dHzvqHyAk= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180417150740eucas1p1970888c244945ff25252346c2a4157f1~mQZuridSe0728307283eucas1p1H; Tue, 17 Apr 2018 15:07:40 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id CF.50.05700.BBD06DA5; Tue, 17 Apr 2018 16:07:39 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180417150738eucas1p17e5c715fdd41d59888a9dd747f5bb330~mQZsiiBmI0727907279eucas1p1H; Tue, 17 Apr 2018 15:07:38 +0000 (GMT) X-AuditID: cbfec7f2-5ffe19c000011644-3f-5ad60dbbc92e Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 7B.53.04178.ABD06DA5; Tue, 17 Apr 2018 16:07:38 +0100 (BST) Received: from [106.120.51.18] by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P7C007YV4OPL630@eusync1.samsung.com>; Tue, 17 Apr 2018 16:07:38 +0100 (BST) Subject: Re: [PATCH v2] X.509: unpack RSA signatureValue field from BIT STRING To: "Maciej S. Szmigiero" , David Howells Cc: 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 From: Kamil Konieczny Message-id: Date: Tue, 17 Apr 2018 17:07:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-version: 1.0 In-reply-to: <6f5cdb8a-809e-6651-0e32-711d415a8b38@maciej.szmigiero.name> Content-type: text/plain; charset="iso-8859-2" Content-language: en-US Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBKsWRmVeSWpSXmKPExsWy7djP87q7ea9FGcy5ZGwx53wLi8W7pt8s Fj+uTGKx6H4lY7Fu/WImi613mtgs7t/7yWRxedccNosPPY/YLA4ufcZscf7COXaLI1P2sTrw eLRe+svmsWXlTSaPbQdUPa7tjvTY13+YxaPne7LH+31X2Tw+b5IL4IjisklJzcksSy3St0vg ylgycwpbwU72iqOPNzA3MP5i7WLk5JAQMJF49eQNmC0ksIJRYtmUrC5GLiD7M6PE7uYmNpii E/1tjBCJZYwSVz5+ZYFwnjFKfF91nBGkSlggQOLwnl1gtohArMSr2StZQYqYBV4zSbx985gF JMEmYC7xaPsZJhCbV8BNYnnjK7AGFgFViaur7oLFRQUiJJqe/2SHqBGU+DH5Hlgvp4CnxLTn r4GGcgAN1ZPYc8QYJMwsIC7R3HqTBcKWl9i85i0zyF4Jgf9sEi9n3mWBeMFFYuWJq+wQtrDE q+NboGwZic6Og0wQdrnEpi1r2SGaGxgl1rxvYoRIWEscPn6RFWIDn8SkbdOZQY6QEOCV6GgT gijxkLj05SQzhO0o0bb3AjSE5jBKtD5vZZnAKDcLyT+zEH6YheSHWUh+WMDIsopRPLW0ODc9 tdgwL7Vcrzgxt7g0L10vOT93EyMwPZ3+d/zTDsavl5IOMQpwMCrx8ErsuBIlxJpYV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3crPeKuSK+rji i8OElzptKTsDhBWP3HpyRomlOCPRUIu5qDgRAJkeUGucAgAA X-CMS-MailID: 20180417150738eucas1p17e5c715fdd41d59888a9dd747f5bb330 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180417134032epcas3p21dbb2d3a6d8650cd64e147d2ce89e6ea X-RootMTR: 20180417134032epcas3p21dbb2d3a6d8650cd64e147d2ce89e6ea References: <6f5cdb8a-809e-6651-0e32-711d415a8b38@maciej.szmigiero.name> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 [...] -- Best regards, Kamil Konieczny Samsung R&D Institute Poland