Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3857818rwd; Sat, 17 Jun 2023 03:33:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ68SyDnPgroYmtckMItRuVeGnlXw7scOW1aiZy2JznooDHWh5Dxps/SyUYQbYiE/ES0vRp0 X-Received: by 2002:a17:902:d489:b0:1b4:ddef:841e with SMTP id c9-20020a170902d48900b001b4ddef841emr5398248plg.4.1686998018554; Sat, 17 Jun 2023 03:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686998018; cv=none; d=google.com; s=arc-20160816; b=RX/lld+SlHur/MhiBaF6zi+0SWry1eW/Rwmye8NE9VvXVOq8n3vd6++6M4A0kfjGnU 0ZruWMncBhfrLbTq/+EIDo+1Lq0Rzjxgl0dEJYIX/Ar3xR9Shr6VO9hOk+jWwtPqzxEr oDwALUDWekStWoZRt6FzNlyE9P9vaSxCdv2MyVuB6ouGUYkRK6E7HIS26Abf4Gp4Fko/ E4Ry8bi6LW1SspTGmPoBHeJjtI3E/LLE23QVDlBFlwvpiNPnhYzY8pwNgruRUyblSImQ BmLrOVluDNpiQl1qOKXWA9pWV6ApiH6xSVSdyqQljLy8RUZvpLVPl5PXaReEFyWNpkEk pe/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=bcEMvszef+swcNFMsXxk5aUYZIAR+Qtt+/q0Fw2iKy8=; b=N/J4jTm2O7RRGZ57W0DUb0xdQte8dKhQYrh9Q/mqaBgr9xbTtDb4IvqeNz256OWqIN 5+yu8yQ4ZuVPjit3u4u6d3IMzW3AufkF8EmqndPlnOSnB0sjpdzXJmerrl8f5u+C5hcK qDjqQk+Z+mNE8eI9BnqCKP5d5qxI+eCr1ZJk/rHIaaiRxIjlgyrryab5/eNg6w2jogvx nvxfJe8QlqXiVW8uhj+cQy354aiGghhqPYn7XH2eLUcypsQf1G/OLpVeSVl9eZYDMDOq nCTxA4pD8VtwiABdMgcFAJJyCl2UgqMwtFD3icpFg5AN1HZTan/N1gy+L8XIlzcNPO5n 4CvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902e74200b001b3e3a19377si10661393plf.127.2023.06.17.03.33.16; Sat, 17 Jun 2023 03:33:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234087AbjFQKPt (ORCPT + 99 others); Sat, 17 Jun 2023 06:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233241AbjFQKPr (ORCPT ); Sat, 17 Jun 2023 06:15:47 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E81B1BCF for ; Sat, 17 Jun 2023 03:15:46 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QjsND3FRNzTknD; Sat, 17 Jun 2023 18:15:08 +0800 (CST) Received: from huawei.com (10.67.175.31) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sat, 17 Jun 2023 18:15:43 +0800 From: GUO Zihua To: , CC: Subject: [RFC PATCH 0/3] crypto: Introduce SM9 key exchange Date: Sat, 17 Jun 2023 18:14:40 +0800 Message-ID: <20230617101443.6083-1-guozihua@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.175.31] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500024.china.huawei.com (7.185.36.203) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org ID-based key exchange algorithms provides the capability of using a human-readable ID as the public key and generate corresponding private key base on that ID. With a pre-defined pattern, the ID could be generated with openly known knowledge of the opponent, eliminating the need of a certificate and avoiding the whole verification chain. Instead of CAs, ID-based crypto algorithm relies on a KGC (Key Generation Center) for generating and distrubuting of private keys. Unlike CAs, KGC is not directly involved in any of the crypto procedures. SM9 is an ID-based crypto algorithm within the ShangMi family. The key exchange part of it was accepted in ISO/IEC 11770-3:2021. This patchset introduces key exchange capability of SM9. ID-based crypto algorithms are widely accepted as the next gen asymmetric cryptography for various fileds including telecommunication, emails, IoT etc.. You can find the technical details in the last two patch. v4: Fixed typo in commit message; Marked non-exported function as static. v3: Fixed memleaks. v2: Updated the identification of initiator, changed function name for getting sk; Split the patchset into 3 patches in order to ease code review. GUO Zihua (3): MPI: Export mpi_add_ui and mpi_mod for SM9 crypto: Introduce SM9 key exchange algorithm library crypto: Introduce SM9 key exchange algorithm crypto/Kconfig | 15 + crypto/Makefile | 4 + crypto/sm9.c | 916 ++++++++++++++++++++++++++ crypto/sm9_lib.c | 1584 +++++++++++++++++++++++++++++++++++++++++++++ crypto/sm9_lib.h | 92 +++ lib/mpi/mpi-add.c | 2 +- lib/mpi/mpi-mod.c | 1 + 7 files changed, 2613 insertions(+), 1 deletion(-) create mode 100644 crypto/sm9.c create mode 100644 crypto/sm9_lib.c create mode 100644 crypto/sm9_lib.h -- 2.17.1