Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2315969lqb; Mon, 27 May 2024 15:59:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUhsuhVviFEnVfuZ/skzMk1pVaPPjPS+CTSEQHiMTgBD+lpAl+Yl/Qj8V+sezJyK+eR/11SsR+BYLwAraPiFq6rEeFfwZ6CmZ6IAYUJKg== X-Google-Smtp-Source: AGHT+IFT3g0j2N2xm7CZ3sp8pNJ3IhpVbcFtvu17ZdxLaj1glfpnlrhK1MvHCKFdnpA9FHxFU9z0 X-Received: by 2002:a05:622a:189f:b0:436:7bdb:d952 with SMTP id d75a77b69052e-43fb0e7ea81mr113031231cf.19.1716850771577; Mon, 27 May 2024 15:59:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716850771; cv=pass; d=google.com; s=arc-20160816; b=Jkp7afIICc6IZ035lfOv2+RhOwhbr1Lt/wZ7YhVNbyfe071AWmj3/pCNz7E869M5eq hALR7+ZaGo7pKbvItAxVhNgd0cpzytxiAPpVcG09jfFSNYKZW9wFUNXAyp390kZ2K+Bw SP3kIVoAhKVAGulvsf/XQWfAwtO6SOf2VNe3uk8+mLqxNbDOnmScTNfVXQuP6DLMNxwu T9HlAYMlGfRoEwksavbD6sNGRlk8DIdbdE8Fugf8aaxeqYU3ob6iEHAUz2jwBP7Pue8/ GnUyD9gG7D6dU1b/3ScNRiMcTYOrzcNfrXM76caiP/6PN79rdOFyHWlvT9JJAsn6xooc QJuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=Y0TRjyiZa/Ap4/5zKJVQsBGQLRS0DJLp7zg6+4ik+n4=; fh=D7XnYPMNjRyf4PksgQ1kQS8cdYEtBqdv6WgeMQugROE=; b=0Iy5Od0R6MxRZIVqAPveIk3OEWnI5EL1O1DdACdi/R8rphq7XHDnR9csAulyhKxgbc bTv3AKxs26AOxGrCfU82xjFVT5c8zCUIbKGBMlj39AL+Hp9xlMWUMNVE8PgIUv7hmsrA oqsk8y9Inugkh+3+Vlp5vc5aeDMQz/U/l14gbyFT4ZxQdjQqDpf42xMxxGx0RnRL3xr9 P1DSS0ahEWlN76YdXxTPHBkidh49tLTzKEMKcp5apn7Qepbl52DeES8ylE2enq2/z+s4 PkNA4/2SgWm78wMTZaoZCDOfZIRdO2bL2yIlQaD+EHc7yJZIMy2C9tV2ccygxkZUY7ti u2UA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tEWdmpAO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43fbc4fb55asi67005841cf.633.2024.05.27.15.59.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 15:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tEWdmpAO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D2B0C1C21299 for ; Mon, 27 May 2024 22:59:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6491713AA5D; Mon, 27 May 2024 22:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tEWdmpAO" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F8A61E880; Mon, 27 May 2024 22:59:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716850767; cv=none; b=pWKfqJB/RT2Yeib8wUb7/MqzLFPLEsiFkTWEd5qquHYRKVVv8Hfsi+MjexZn1HDLDbIj1uLCPsG1XE8MY9i4emItmgRLUDqsHJLAyiakqrrLdKcXUUm5ZMYXaaKmGiiOOgOsrgMluiR/HqbB5frVYXbUl2IhW5H48l9kwl7I36w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716850767; c=relaxed/simple; bh=VKCgZlWSHFibD4oSASuBd0h+q3F3oLe5CbcNtavGaIE=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=k+4+Cs/hqLAAxhcBVCEiDZHq2HKj9NKq8Gxoi2QMVLJcc807f6T80wIEYgeNn2nrxdgO7r91EOEFKfjopdV2AukVylV0klC0ib1QydZEFGmF9f194l2hivwSK7GKYpscN0EEXgKsHPhVYdQjnpkom4alI/LZ4cmDqAx76rcQICU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tEWdmpAO; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A792C2BBFC; Mon, 27 May 2024 22:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716850766; bh=VKCgZlWSHFibD4oSASuBd0h+q3F3oLe5CbcNtavGaIE=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=tEWdmpAOnHMRsfcTZWnwmQSqLUOl+odU30epMpZP9ayt36mnpySkQJjkHnw1uY+hJ yhQnfhsJp7Th9k5hHHfFxeHnbWED6Rpe7v8dAsqlhvTMdIsVZmvC8XHa2pnFThgJ/Q lar2owTF/wlSJ9h4+fl7YO/dxOxjMKjM6YQRfJAvWzgmGdHylHW22XOvZICkQ4UO9C KPINJJmYi78WePaUfqmPnJbV/BN0NbKaAfKBvM3u4sbx6dLiKw/rYSuedG0nAOoa8T n1CKxFH7LdTmoWCYEjsxtCbr4Waof88mmIvjCAtHj04qT6vKr76bZmvxZ+TGVfA4YU Ppia4Eh5+E7sA== Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 28 May 2024 01:59:23 +0300 Message-Id: Cc: , "David S. Miller" , "Stefan Berger" , Subject: Re: [PATCH] crypto: ecdsa: Fix the public key format description From: "Jarkko Sakkinen" To: "Jarkko Sakkinen" , "Herbert Xu" X-Mailer: aerc 0.17.0 References: <20240527202840.4818-1-jarkko@kernel.org> In-Reply-To: On Tue May 28, 2024 at 1:49 AM EEST, Jarkko Sakkinen wrote: > On Tue May 28, 2024 at 1:31 AM EEST, Jarkko Sakkinen wrote: > > > ret =3D crypto_akcipher_set_pub_key(tfm, data, 3 * x_size + 1= ); > > Noticed this mistake i.e. fixed it with "2 * x_size + 1" > > This is results earlier failure: > > ecdsa: (tpm2_key_ecdsa_query+0x10d/0x170 <- ecdsa_set_pub_key) arg1=3D0xf= fffffea > > Totally lost with the expected input format after trying out various=20 > options. OK got it working with: ptr =3D &data[0]; *ptr++ =3D 0x04; /* uncompressed */ memcpy(&ptr[0], &x[2], x_size); memcpy(&ptr[x_size], &x[2 + x_size + 2], x_size); ret =3D crypto_akcipher_set_pub_key(tfm, data, 2 * x_size + 1); crypto_free_akcipher(tfm); Had still a few "off-bys". Makes me wonder why this is not in ASN.1. E.g. TPM2 stuff and for instance RSA code takes ASN.1. This all and the required prefix byte really should be explained in the documentation of this function. I.e. follows the RFC in the sense that number is big-endian and has the prefix byte, but it does not follow it in the sense that x and y are not in input octect strings. Why is that? Does not feel right intuitively. BR, Jarkko