Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp139748iog; Fri, 17 Jun 2022 00:09:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u+Xrfj7CNGhxzVkwQLQ1Vv1SrW6i5w1qCrxKOfKlYFyCtLlNlppnXcfZHk6OUM3g+L0Rzv X-Received: by 2002:a65:41ca:0:b0:408:aa25:5026 with SMTP id b10-20020a6541ca000000b00408aa255026mr7870367pgq.96.1655449743877; Fri, 17 Jun 2022 00:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655449743; cv=none; d=google.com; s=arc-20160816; b=vKfWvFkvvsW7VHOf/4jL9//f44U2uJ8RKbl64eCJQvl09xDVLQRq3gZecGcuTILwDG l9zezTLyze+AGBhi8s6CoUumNRGXIUDfaqAXTiX3dS1CdzYQQSCK1v/NxohXFyQhT/Nt rkAVT7tpcP2c89njCmdKRl8fMg9qKRlZeqPlmAaEpklgu2Yb0U0ChDU5B4uGtZGdgB26 J839C8SsVLvb9UV9SoO+34Q4GT7u+o6Qo3O0U/OBrXPURh4B3yDqauX54v41SMsjJh9M +6mL51bhBCdM03L/jHoMCHNzP7na0k73WJFeoP+EBAe0JDsAuE7hXfVkx4emrk4/Ga0Z mlaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Lk5TQemGz4PyySED1h1MgKjL3fjCTm3RMzKUK+BNj/8=; b=0Rn4giHPiowdoUCaAhG+IBrvSiPmYL6teL/EDXqf2wrU2vI/7zqsS9DvJ9KOcaTkpc PUts4eTJfeNXtcACkZCejP/mIzH+TcBtQs7gHRmE2Asgm6+hDGItYdfvxryOTWWXLUtr +CioY7WET32etb4NM5K6Lvrv0Bccr1XuRsTvstj6saOnOyFKUgIcnIW3Dj6l8q8uU+jM Y4uJCeZnouSbU27a+ushamcoDoeJSGzAhlwXJbVuwCvY4bYZbxfiee5A879eSO5x31/S /oPVUVRhL6Upsr53nx9Fr0N12xbtLhgik04mppTWyX0DnjhyqEoougaeqlWlJ1MTF587 bPIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=48cJHCpC; 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=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a17090a420800b001e260a3bb55si4084381pjg.136.2022.06.17.00.08.28; Fri, 17 Jun 2022 00:09:03 -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; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=48cJHCpC; 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=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380383AbiFQHIM (ORCPT + 99 others); Fri, 17 Jun 2022 03:08:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380381AbiFQHIK (ORCPT ); Fri, 17 Jun 2022 03:08:10 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9897563508 for ; Fri, 17 Jun 2022 00:08:09 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id b12-20020a17090a6acc00b001ec2b181c98so2233203pjm.4 for ; Fri, 17 Jun 2022 00:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Lk5TQemGz4PyySED1h1MgKjL3fjCTm3RMzKUK+BNj/8=; b=48cJHCpC+kdwm41s7RKBZpaVl+QSSQRhazKV8kkkj73Xuu0QfibG5U+rMFk1mPQbnd jZ6LFuEifpMJkyjYZCZGZhNKkVqNookFx3a7dYC1rdIlmmeWd2DLr9EtEkxVgomliEUb WwyZGRq0/l3L+mjygQ38gHSCjsAIJ+BOupQmvLd7zioM/3Vhcw1QveLccjlDobfxjpqb W0N6Cht9/ThiD5dHPwiJh0Wjo2nV4L4dDCty9E/A2ue7CzI1ULNbHROMt89HFHqkIqaN P4FsEJcSzVOJcGT5xqUHOFYGagQ9AANYp9MGa2D1A/8HQpIAD+uvMiVZmdoiJ6qKgLGY B3Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Lk5TQemGz4PyySED1h1MgKjL3fjCTm3RMzKUK+BNj/8=; b=ebC1ap/p6PDcF40JTF7DvNfrNIrhn0qnxRcVrIxyLDMELcIGKjWKqkzFwoSIN1GLJy pnGDoKug69ur9O+ACSYCulq34s/LNFwH4bdrD7/EwyRICLIXo0xveXYga8zJg+6OxGSQ GNo/ANN49vtkrgaGJJeSvo+wwasa/4338BzCDwfmIh5jJEVAKq9i/JJ636DoMegJiEhA wRxUeurQXsYGCxU/Q79Ndk/z+PIXKnNEKu8I3v+FCwEeEn51Qeg4FdEnw6Bb8mSOZOqU /tWQAAokfSGjrB2I03ggwmhW1LhSyeJGd9BedekqPTthBwvTV3q44JEAH1mh5KBjfmc7 j2ag== X-Gm-Message-State: AJIora9sz604IbMrZrqtBXJ2FXxydWKgTizb76SzwjkakPA1NJ//TaCb TgWY2HikEl9gKpmoyCKB2zQaCg== X-Received: by 2002:a17:902:e5c9:b0:166:34ff:72a3 with SMTP id u9-20020a170902e5c900b0016634ff72a3mr8318177plf.80.1655449689047; Fri, 17 Jun 2022 00:08:09 -0700 (PDT) Received: from FVFDK26JP3YV.bytedance.net ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id j1-20020a170903028100b00163d4c3ffabsm2757868plr.304.2022.06.17.00.08.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jun 2022 00:08:08 -0700 (PDT) From: Lei He To: herbert@gondor.apana.org.au, davem@davemloft.net, dhowells@redhat.com, mst@redhat.com Cc: arei.gonglei@huawei.com, jasowang@redhat.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, pizhenwei@bytedance.com, helei.sig11@bytedance.com, f4bug@amsat.org, berrange@redhat.com Subject: [PATCH 0/4] virtio-crypto: support ECDSA algorithm Date: Fri, 17 Jun 2022 15:07:49 +0800 Message-Id: <20220617070754.73667-1-helei.sig11@bytedance.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 From: lei he This patch supports the ECDSA algorithm for virtio-crypto: 1. fixed the problem that the max_signature_size of ECDSA is incorrectly calculated. 2. make pkcs8_private_key_parser can identify ECDSA private keys. 3. implement ECDSA algorithm for virtio-crypto device lei he (4): crypto: fix the calculation of max_size for ECDSA crypto: pkcs8 parser support ECDSA private keys crypto: remove unused field in pkcs8_parse_context virtio-crypto: support ECDSA algorithm crypto/Kconfig | 1 + crypto/Makefile | 2 + crypto/akcipher.c | 10 + crypto/asymmetric_keys/pkcs8.asn1 | 2 +- crypto/asymmetric_keys/pkcs8_parser.c | 46 +++- crypto/ecdsa.c | 3 +- crypto/ecdsa_helper.c | 45 +++ .../virtio/virtio_crypto_akcipher_algs.c | 259 ++++++++++++++++-- include/crypto/internal/ecdsa.h | 15 + include/linux/asn1_encoder.h | 2 + lib/asn1_encoder.c | 3 +- 11 files changed, 360 insertions(+), 28 deletions(-) create mode 100644 crypto/ecdsa_helper.c create mode 100644 include/crypto/internal/ecdsa.h -- 2.20.1