Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2198152/?format=api
{ "id": 2198152, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2198152/?format=api", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/1.0/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<20260219132552.1499698-3-philippe.reynes@softathome.com>", "date": "2026-02-19T13:25:45", "name": "[RFC,v2,2/9] ecdsa: initial support of ecdsa using mbedtls", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "28e0c5a5d12431a886f0fcbf9239fb97d470e578", "submitter": { "id": 74351, "url": "http://patchwork.ozlabs.org/api/1.0/people/74351/?format=api", "name": "Philippe Reynes", "email": "philippe.reynes@softathome.com" }, "delegate": { "id": 161313, "url": "http://patchwork.ozlabs.org/api/1.0/users/161313/?format=api", "username": "raymo200915", "first_name": "Raymond", "last_name": "Mao", "email": "raymondmaoca@gmail.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260219132552.1499698-3-philippe.reynes@softathome.com/mbox/", "series": [ { "id": 492675, "url": "http://patchwork.ozlabs.org/api/1.0/series/492675/?format=api", "date": "2026-02-19T13:25:49", "name": "add software ecdsa support", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/492675/mbox/" } ], "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2198152/checks/", "tags": {}, "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=softathome1.onmicrosoft.com header.i=@softathome1.onmicrosoft.com\n header.a=rsa-sha256 header.s=selector1-softathome1-onmicrosoft-com\n header.b=itqNaO07;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)", "phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=softathome.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=softathome1.onmicrosoft.com header.i=@softathome1.onmicrosoft.com\n header.b=\"itqNaO07\";\n\tdkim-atps=neutral", "phobos.denx.de; dmarc=none (p=none dis=none)\n header.from=softathome.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=philippe.reynes@softathome.com" ], "Received": [ "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fGvLj2HvGz1xpY\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 20 Feb 2026 00:27:25 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id DAE5E83D77;\n\tThu, 19 Feb 2026 14:26:24 +0100 (CET)", "by phobos.denx.de (Postfix, from userid 109)\n id 02A3483DEA; Thu, 19 Feb 2026 14:26:19 +0100 (CET)", "from PAUP264CU001.outbound.protection.outlook.com\n (mail-francecentralazlp170110002.outbound.protection.outlook.com\n [IPv6:2a01:111:f403:c20a::2])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 0DD1983E13\n for <u-boot@lists.denx.de>; Thu, 19 Feb 2026 14:26:16 +0100 (CET)", "from PAZP264CA0197.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:237::18)\n by MR1PPFECD1EEFF4.FRAP264.PROD.OUTLOOK.COM (2603:10a6:508:1::6a1)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9632.14; Thu, 19 Feb\n 2026 13:26:10 +0000", "from PA1PEPF000CC3F9.FRAP264.PROD.OUTLOOK.COM\n (2603:10a6:102:237:cafe::69) by PAZP264CA0197.outlook.office365.com\n (2603:10a6:102:237::18) with Microsoft SMTP Server (version=TLS1_3,\n cipher=TLS_AES_256_GCM_SHA384) id 15.20.9632.15 via Frontend Transport; Thu,\n 19 Feb 2026 13:25:57 +0000", "from proxy.softathome.com (149.6.166.170) by\n PA1PEPF000CC3F9.mail.protection.outlook.com (10.167.242.4) with Microsoft\n SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9632.12\n via Frontend Transport; Thu, 19 Feb 2026 13:26:09 +0000", "from sah1lpt726.home (unknown [192.168.72.32])\n by proxy.softathome.com (Postfix) with ESMTPSA id B34482018F;\n Thu, 19 Feb 2026 14:26:09 +0100 (CET)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2", "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=W2ivFO87MAjN31wTR+wTuTdKX60qcPJyYt4+gWm0X2Z+mzj5zR2/8StbuRnbYHfpaFq55DeloTIB5z1i0n3Owpf3eB8ARInQsubYtUcVdOwVjkWTJqLkLmvEZTNPLOYCtEfDTtUja2Y3IAQek9VBip5x4LXW2lsebN1Xk261m9X6wyX9rLWCm6QeVylSWvL9imHDNaQZAX8BT/Y0O50AjaxbLuDQ2QW+ikx88S0zb9mtFReR80wFYkDU3E7pxXy6Y6lE/zKwb6L90c5oyhvFx3EaHH3nlOrmeYjQjRi23kbRzmsf05bELy8OIxXbvXIzgg85JZBBj8ofyyHkcnDxkw==", "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=0/EEO1obV9ybkajF8thngPSVoC7K7xrt0ADu/A8qLFo=;\n b=siQyAjy/A/FTEnnhVCDCD4mS3aZDvpw+vKRd6g8h+mHpacPBGDSZDrEMtWCC3A9hD7/EwkpXddboiRodxyuTRNTyeYPO8P0c4yB8U9abU9vwVixCZfjAfWHtWFYBKPp4x7HncG5HLStVA9AtCJzA+yWbNULvm7r8Ju0XjY+bDsRqqOhe5bVvVvzIaBkkbFfiqLw9dIUibmC7+bf5mzHc9M+XeTvJp9v+Cj5wfk0BzfPMi1IlnotmcQvDAaZL+Xh6aM90MnvmOxm9jM2of6r3UotFmrJrFkrkmGJSYqbJss1I3hwPcHuPRmiQG1Si5/4CG8Dh3k70YkAr2Y5lIaTB2w==", "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 149.6.166.170) smtp.rcpttodomain=gmail.com smtp.mailfrom=softathome.com;\n dmarc=bestguesspass action=none header.from=softathome.com; dkim=none\n (message not signed); arc=none (0)", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=softathome1.onmicrosoft.com; s=selector1-softathome1-onmicrosoft-com;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=0/EEO1obV9ybkajF8thngPSVoC7K7xrt0ADu/A8qLFo=;\n b=itqNaO07k3Gap9HlG+A5R8tDJA4RZF5uKRpHxqXi/KcYPGE03NOBWO+5XxCuRZYL0JR+ZuA2N5lVo2DYi4PrqRyXb+EJoTiSWo5W14cIuXoP3TumLtk/GRAnmc/01cY7YJ8yfd4/9PQ+Tx2QLLQhVwN1+F6Q6qYravZ2YhEgpTX8AI+CGuNpnhNuutO0sg3tbX8WuyfTFTl/14qhLNqmn3VrYx/yw9L2+2JAu9nSvD6iZ3vtUcTg2SvjbAE0kmL1SpxReSMOZEkWxxJDohZjYXwS3be+b7166vjJIw1FHWR6o6Pq8k/F6bAyNYef8kT7SJoa7104geuDcYq1arZiXg==", "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 149.6.166.170)\n smtp.mailfrom=softathome.com; dkim=none (message not signed)\n header.d=none;dmarc=bestguesspass action=none header.from=softathome.com;", "Received-SPF": "Pass (protection.outlook.com: domain of softathome.com\n designates 149.6.166.170 as permitted sender)\n receiver=protection.outlook.com; client-ip=149.6.166.170;\n helo=proxy.softathome.com; pr=C", "From": "Philippe Reynes <philippe.reynes@softathome.com>", "To": "marko.makela@iki.fi, jonny.green@keytechinc.com, raymondmaoca@gmail.com,\n trini@konsulko.com", "Cc": "u-boot@lists.denx.de,\n\tPhilippe Reynes <philippe.reynes@softathome.com>", "Subject": "[RFC PATCH v2 2/9] ecdsa: initial support of ecdsa using mbedtls", "Date": "Thu, 19 Feb 2026 14:25:45 +0100", "Message-ID": "<20260219132552.1499698-3-philippe.reynes@softathome.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260219132552.1499698-1-philippe.reynes@softathome.com>", "References": "<20260219132552.1499698-1-philippe.reynes@softathome.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-EOPAttributedMessage": "0", "X-MS-PublicTrafficType": "Email", "X-MS-TrafficTypeDiagnostic": "PA1PEPF000CC3F9:EE_|MR1PPFECD1EEFF4:EE_", "Content-Type": "text/plain", "X-MS-Office365-Filtering-Correlation-Id": "66074266-3fc3-43c3-bef7-08de6fba71eb", "X-MS-Exchange-SenderADCheck": "1", "X-MS-Exchange-AntiSpam-Relay": "0", "X-Microsoft-Antispam": "BCL:0;\n ARA:13230040|82310400026|376014|36860700013|1800799024|7142099003;", "X-Microsoft-Antispam-Message-Info": "\n VRrEDVeTkdK2CaGTwY+A1lTXTMiPUpE1t9/2mkSslXy8pniqxYPrDsCW/TyR0Zl39yibCngI/NAv/C+dEVrSkLAq70t2ma9ATh9tuOknANfoQd28FgbrmDFseAq2wFCY5eBlx3XLBJU3yZ+oAeSiGAW1Ht7nyiAlDvBxrMWkxQ3glLYHwUXwhLoXNf8G14Ls3nKDCfHM15NbXw+NA2XMlb2MUePHzE7Ah8OgzUUPxHKH/ayCUwNrZrVNGXJ75lU8/RBK8+k+0vFpxcY1cjlkDjEXwE5R/q1UgRxybVAZXHGH9ShQWJ92gkQjzEB7xFCOG2SEjN4QabT1Ot+iuimxtCCuMNO4JQpVd0WUBEQqwTd0qFD0APOxPJfeMoakvoh3Ats2i/K3geiaY+gTlpKFb9Y3KnO4R7npfldWc6u4if4/kYLgym8feR/253ETXAycGtYLtqSInDq6ecA+ulwtG/9yyAUBRQmBElPxPJh2U4+RVe3MJYbl5JuL5FGe3FqLC363hQqYoGv10W4qIMeIeEYAXzy+nEcidH4j3DEIbTyj9/3AoPLB1shFqzYW3UFr1fGVQ7j0xvLdSk46BgEcKNSsRKxoytXzeUnsPgwj9Iegt9juMy+G+s9VxoZ3eSLGRZCMWwGZgE4dsUs23oupsy5b6MELLbeLtrS3jWRzpQ1JqRNTJ1Fl0hoA2ej5dj2HbqazIdyH4EsYwItGZAxD2X6K6DJ/6YGiBmV/yTDJ2St9tJGed7uMLisgq7Pd1F0mFXdgJ4HsaPySjqXSWGnl0u217+NSj/XIx71NTGLDv9OEdRuNqbSCKCD6z1kPdzPKHs7k40G8cjQN8Ajd4zZlL8IhNRe5p8KL9N1gwZ0nycIYiPIPWz7JqQHVTvhffNS7dq5p5VfLf9H3HgTpcd+R1djfPDnvKugrdPW3adQfR7q51whiDMs6VkhO9LFVRaUbE5PUjP16yQkgEt63LYvYt9eyRIC7DR1blTA0GaiEvJJUyPNGpISH75+nxV8wzsVOaxN1B3s8/zH806Af5MTDYz9xFw3p77feGOug+2C3qu6AFF/9OM82VlXACHN079xVFMUv05q/hW2QKAHphZE0O3kMfoXe46h508feXMBrO1bN3ypQePxTxJoHFZf3W9tCzo4vPlOZFWKU3yOtzw6psT0UHCBOkE7s+rUFHdqQtBN8y/3xq5okb6UMSatUmv74Qlj2CPXmMhiDsCEGdk9CpOlDVWm+rAipgLup+qXxhNxJ4KG3p+XNRup1a9osVJn2ySd28yzYYyiDS6IvCXyPzY+x2FLm+UaDTX/4Rmu8gemr0oQWE9v8Dc/2JSlVq/1DGIRZ+LN7eFMafpA6MhgLXdFMbxXAHjomBO83U/heTfWqRxxVJVdpgYo2fNUxj20bh8FJaafKJz0uginLkvp8YfPIcUvZg9CKD4IdGbBzwhd/5OWtPivTxAehv7JbEGjTkiYvDZ91wWlmjvKAH5S0KTa0ZBay95XTse992SGxgsx+AKArpICkT5xxN/od+SB6ig89eXeK6f491zcaWYBkGs0YfCHQxlDTbEeAArr0noitRQsjt/efAr9V56YOcfjCrXn/55TZw1slmAR9n62CVdUoWCtuHH4wDj3VYG2in+6Co7AKf/UvbG4afDzb2seT0oKNtALy+uP3IlCX/3ZqSQ==", "X-Forefront-Antispam-Report": "CIP:149.6.166.170; CTRY:FR; LANG:en; SCL:1; SRV:;\n IPV:CAL; SFV:NSPM; H:proxy.softathome.com; PTR:InfoDomainNonexistent;\n CAT:NONE;\n SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024)(7142099003);\n DIR:OUT; SFP:1101;", "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1", "X-MS-Exchange-AntiSpam-MessageData-0": "\n XPEeq99PdLbEuMQLtIqUshnP4rNjVnJAKzl+Qsfj707hVzxa5EyCTnWOlpUFLs8iureD4slnBh+pOzJoHVcJFcFOWdzejv5mM8YpYLPj69hAgvUgUwYJ+QbVtNhT9FMuQnHi/G1j46K5D4q5eNMFny8CL952oru3W2cBNqC1bNgpKo2dG49y9wUfNOvsnFXhqbOmvi8454T8nHZyDejZjdg5qGaizgYcKFlh+AqAXBquWBTJyDWHlHeDx81Ap/XMWezUsfuvrfNXvOHb8IBovDrrjEiuHZ3cS1J3sBDsnH3U9hq23IIHuKh4X/vXnf5ZuOsgrbBqcPDBP4552wYaMrm1bUX1j0gBfPsm0wO6B9fVrUio+WrVxo1bH8ll3PJZV7oBuM6f9obhUSoIBr9o7hv/xEoa2eDDCPrAHdkGM5KAGMtMegPHK1ousN6kpK1e", "X-OriginatorOrg": "softathome.com", "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "19 Feb 2026 13:26:09.8593 (UTC)", "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 66074266-3fc3-43c3-bef7-08de6fba71eb", "X-MS-Exchange-CrossTenant-Id": "aa10e044-e405-4c10-8353-36b4d0cce511", "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=aa10e044-e405-4c10-8353-36b4d0cce511; Ip=[149.6.166.170];\n Helo=[proxy.softathome.com]", "X-MS-Exchange-CrossTenant-AuthSource": "PA1PEPF000CC3F9.FRAP264.PROD.OUTLOOK.COM", "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous", "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem", "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "MR1PPFECD1EEFF4", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.39", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>", "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de", "X-Virus-Status": "Clean" }, "content": "Adds an initial support of ecdsa verify using mbedtls.\n\nSigned-off-by: Philippe Reynes <philippe.reynes@softathome.com>\n---\nv2:\n- rename sw_ecdsa.c to ecdsa.c\n\n include/crypto/internal/sw_ecdsa.h | 14 +++++\n lib/mbedtls/Makefile | 3 +\n lib/mbedtls/ecdsa.c | 94 ++++++++++++++++++++++++++++++\n 3 files changed, 111 insertions(+)\n create mode 100644 include/crypto/internal/sw_ecdsa.h\n create mode 100644 lib/mbedtls/ecdsa.c", "diff": "diff --git a/include/crypto/internal/sw_ecdsa.h b/include/crypto/internal/sw_ecdsa.h\nnew file mode 100644\nindex 00000000000..b1ca31da0f8\n--- /dev/null\n+++ b/include/crypto/internal/sw_ecdsa.h\n@@ -0,0 +1,14 @@\n+/* SPDX-License-Identifier: GPL-2.0+ */\n+/*\n+ * Copyright (c) 2026, Philippe Reynes <philippe.reynes@softathome.com>\n+ */\n+#ifndef _SW_ECDSA\n+#define _SW_ECDSA\n+\n+struct ecdsa_public_key;\n+\n+int sw_ecdsa_verify(const struct ecdsa_public_key *pubkey,\n+\t\t const void *hash, size_t hash_len,\n+\t\t const void *signature, size_t sig_len);\n+\n+#endif\ndiff --git a/lib/mbedtls/Makefile b/lib/mbedtls/Makefile\nindex 5433e17cc64..6db06092cee 100644\n--- a/lib/mbedtls/Makefile\n+++ b/lib/mbedtls/Makefile\n@@ -11,6 +11,9 @@ obj-$(CONFIG_$(PHASE_)SHA1_MBEDTLS) += sha1.o\n obj-$(CONFIG_$(PHASE_)SHA256_MBEDTLS) += sha256.o\n obj-$(CONFIG_$(PHASE_)SHA512_MBEDTLS) += sha512.o\n \n+# shim layer for ecdsa\n+obj-$(CONFIG_$(PHASE_)ECDSA_MBEDTLS) += ecdsa.o\n+\n # x509 libraries\n obj-$(CONFIG_$(PHASE_)ASYMMETRIC_PUBLIC_KEY_MBEDTLS) += \\\n \tpublic_key.o\ndiff --git a/lib/mbedtls/ecdsa.c b/lib/mbedtls/ecdsa.c\nnew file mode 100644\nindex 00000000000..0ed95f4407f\n--- /dev/null\n+++ b/lib/mbedtls/ecdsa.c\n@@ -0,0 +1,94 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * Copyright (C) 2026 Philippe Reynes <philippe.reynes@softathome.com>\n+ */\n+\n+#include <crypto/ecdsa-uclass.h>\n+#include \"mbedtls_options.h\" /* required to access private fields */\n+#include <mbedtls/ecdsa.h>\n+#include <mbedtls/ecp.h>\n+\n+static mbedtls_ecp_group_id sw_ecdsa_search_group_id(const char *curve_name)\n+{\n+\tmbedtls_ecp_group_id grp_id = MBEDTLS_ECP_DP_NONE;\n+\tconst mbedtls_ecp_curve_info *info;\n+\n+\tif (!curve_name)\n+\t\tgoto out;\n+\n+\tif (!strcmp(curve_name, \"prime256v1\"))\n+\t\tgrp_id = MBEDTLS_ECP_DP_SECP256R1;\n+\n+\tinfo = mbedtls_ecp_curve_list();\n+\twhile (info && info->name) {\n+\t\tif (!strcmp(curve_name, info->name))\n+\t\t\tgrp_id = info->grp_id;\n+\t\tinfo++;\n+\t}\n+\n+ out:\n+\treturn grp_id;\n+}\n+\n+int sw_ecdsa_verify(const struct ecdsa_public_key *pubkey,\n+\t\t const void *hash, size_t hash_len,\n+\t\t const void *signature, size_t sig_len)\n+{\n+\tmbedtls_ecp_group_id grp_id;\n+\tmbedtls_ecp_group grp;\n+\tconst unsigned char *buf = hash;\n+\tsize_t blen = hash_len;\n+\tmbedtls_ecp_point Q;\n+\tmbedtls_mpi r, s;\n+\tint key_len;\n+\tint err = -1;\n+\n+\tif (!(pubkey->size_bits % 8))\n+\t\tkey_len = pubkey->size_bits / 8;\n+\telse\n+\t\tkey_len = pubkey->size_bits / 8 + 1;\n+\n+\t/* search the group */\n+\tgrp_id = sw_ecdsa_search_group_id(pubkey->curve_name);\n+\tif (grp_id == MBEDTLS_ECP_DP_NONE) {\n+\t\tprintf(\"%s: curve name %s not found\\n\",\n+\t\t __func__, pubkey->curve_name);\n+\t\tgoto out;\n+\t}\n+\n+\t/* init and load the group */\n+\tmbedtls_ecp_group_init(&grp);\n+\terr = mbedtls_ecp_group_load(&grp, grp_id);\n+\tif (err < 0)\n+\t\tgoto out;\n+\n+\t/* prepare the pubkey */\n+\tmbedtls_ecp_point_init(&Q);\n+\tmbedtls_mpi_init(&Q.X);\n+\tmbedtls_mpi_init(&Q.Y);\n+\tmbedtls_mpi_init(&Q.Z);\n+\tmbedtls_mpi_read_binary(&Q.X, pubkey->x, key_len);\n+\tmbedtls_mpi_read_binary(&Q.Y, pubkey->y, key_len);\n+\tmbedtls_mpi_lset(&Q.Z, 1);\n+\n+\t/* check if the pubkey is valid */\n+\terr = mbedtls_ecp_check_pubkey(&grp, &Q);\n+\tif (err < 0) {\n+\t\tprintf(\"%s: public key is invalid (err = %d)\\n\", __func__, err);\n+\t\tgoto out;\n+\t}\n+\n+\t/* compute r */\n+\tmbedtls_mpi_init(&r);\n+\tmbedtls_mpi_read_binary(&r, signature, key_len);\n+\n+\t/* compute s */\n+\tmbedtls_mpi_init(&s);\n+\tmbedtls_mpi_read_binary(&s, signature + key_len, key_len);\n+\n+\t/* check the signature */\n+\terr = mbedtls_ecdsa_verify(&grp, buf, blen, &Q, &r, &s);\n+\n+ out:\n+\treturn err;\n+}\n", "prefixes": [ "RFC", "v2", "2/9" ] }