Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_NEOMUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57932C10F03 for ; Fri, 22 Mar 2019 19:15:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A8FC2175B for ; Fri, 22 Mar 2019 19:15:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727419AbfCVTPF (ORCPT ); Fri, 22 Mar 2019 15:15:05 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:38746 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727364AbfCVTPF (ORCPT ); Fri, 22 Mar 2019 15:15:05 -0400 Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id E1BD872CC53; Fri, 22 Mar 2019 22:15:00 +0300 (MSK) Received: from altlinux.org (sole.flsd.net [185.75.180.6]) by imap.altlinux.org (Postfix) with ESMTPSA id C9DB74A4A16; Fri, 22 Mar 2019 22:15:00 +0300 (MSK) Date: Fri, 22 Mar 2019 22:15:00 +0300 From: Vitaly Chikunov To: Mimi Zohar , Dmitry Kasatkin , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Herbert Xu , David Howells , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: [PATCH v7 11/11] integrity: support EC-RDSA signatures for asymmetric_verify Message-ID: <20190322191500.wzkbqsij5jyndlxd@altlinux.org> Mail-Followup-To: Mimi Zohar , Dmitry Kasatkin , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, Herbert Xu , David Howells , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org References: <20190301175918.29694-1-vt@altlinux.org> <20190301175918.29694-12-vt@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20190301175918.29694-12-vt@altlinux.org> User-Agent: NeoMutt/20171215-106-ac61c7 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Mimi, Dmitry, Can you Ack this patch? Thanks, On Fri, Mar 01, 2019 at 08:59:18PM +0300, Vitaly Chikunov wrote: > Allow to use EC-RDSA signatures for IMA by determining signature type by > the hash algorithm name. This works good for EC-RDSA since Streebog and > EC-RDSA should always be used together. > > Cc: Mimi Zohar > Cc: Dmitry Kasatkin > Cc: linux-integrity@vger.kernel.org > Signed-off-by: Vitaly Chikunov > --- > security/integrity/digsig_asymmetric.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/security/integrity/digsig_asymmetric.c b/security/integrity/digsig_asymmetric.c > index d775e03fbbcc..99080871eb9f 100644 > --- a/security/integrity/digsig_asymmetric.c > +++ b/security/integrity/digsig_asymmetric.c > @@ -104,9 +104,16 @@ int asymmetric_verify(struct key *keyring, const char *sig, > > memset(&pks, 0, sizeof(pks)); > > - pks.pkey_algo = "rsa"; > pks.hash_algo = hash_algo_name[hdr->hash_algo]; > - pks.encoding = "pkcs1"; > + if (hdr->hash_algo == HASH_ALGO_STREEBOG_256 || > + hdr->hash_algo == HASH_ALGO_STREEBOG_512) { > + /* EC-RDSA and Streebog should go together. */ > + pks.pkey_algo = "ecrdsa"; > + pks.encoding = "raw"; > + } else { > + pks.pkey_algo = "rsa"; > + pks.encoding = "pkcs1"; > + } > pks.digest = (u8 *)data; > pks.digest_size = datalen; > pks.s = hdr->sig; > -- > 2.11.0