Re: [Suit] COSE_Sign vs. COSE_Mac

Derek Atkins <derek@ihtfp.com> Fri, 15 June 2018 15:05 UTC

Return-Path: <derek@ihtfp.com>
X-Original-To: suit@ietfa.amsl.com
Delivered-To: suit@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 255DC130E4F for <suit@ietfa.amsl.com>; Fri, 15 Jun 2018 08:05:10 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.99
X-Spam-Level:
X-Spam-Status: No, score=-1.99 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, T_SPF_PERMERROR=0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=ihtfp.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FkRezA4r2yh5 for <suit@ietfa.amsl.com>; Fri, 15 Jun 2018 08:05:08 -0700 (PDT)
Received: from mail2.ihtfp.org (MAIL2.IHTFP.ORG [204.107.200.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id BBE20130E1F for <suit@ietf.org>; Fri, 15 Jun 2018 08:05:07 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by mail2.ihtfp.org (Postfix) with ESMTP id 30C7AE2050; Fri, 15 Jun 2018 11:05:06 -0400 (EDT)
Received: from mail2.ihtfp.org ([127.0.0.1]) by localhost (mail2.ihtfp.org [127.0.0.1]) (amavisd-maia, port 10024) with ESMTP id 18352-09; Fri, 15 Jun 2018 11:05:01 -0400 (EDT)
Received: from securerf.ihtfp.org (IHTFP-DHCP-158.IHTFP.ORG [192.168.248.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mocana.ihtfp.org", Issuer "IHTFP Consulting Certification Authority" (verified OK)) by mail2.ihtfp.org (Postfix) with ESMTPS id 41EC7E203F; Fri, 15 Jun 2018 11:05:01 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ihtfp.com; s=default; t=1529075101; bh=QfsO3jU/EI3UuUlKBYQSw/B1umPAh7i8MPTQoOpCJRk=; h=From:To:Cc:Subject:References:Date:In-Reply-To; b=aNKMPzqk2tzBnSw0W+F6BruQ1d7GzQtwyli2nLJ6MLYeRHfZu6fi6nfTPXWrd2l+9 EWRL3Q0hQWEycLzk3Vn0mURaoBwaJXfX8FTSUk2nergB7LLVdUot+H9GdAWYJXqtZ5 bsrCnvZwjiuBfpRLhtKOZVkA6PuWWLoqDOmDHTpg=
Received: (from warlord@localhost) by securerf.ihtfp.org (8.15.2/8.15.2/Submit) id w5FF4gxM024510; Fri, 15 Jun 2018 11:04:42 -0400
From: Derek Atkins <derek@ihtfp.com>
To: David Brown <david.brown@linaro.org>
Cc: Koen Zandberg <koen@bergzand.net>, suit@ietf.org
References: <238EC1AC-D898-472D-A951-2AD1438C6004@vigilsec.com> <168ED9F9-15CF-457B-850A-77196D423D08@arm.com> <BF32EDB6-A8A7-4C2E-9F62-3891E59341EE@vigilsec.com> <932b5b21-dc56-b316-0c0d-28d43c4cec42@bergzand.net> <20180607160549.GA11744@davidb.org>
Date: Fri, 15 Jun 2018 11:04:42 -0400
In-Reply-To: <20180607160549.GA11744@davidb.org> (David Brown's message of "Thu, 7 Jun 2018 10:05:49 -0600")
Message-ID: <sjmfu1o5bw5.fsf@securerf.ihtfp.org>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Virus-Scanned: Maia Mailguard 1.0.2a
Archived-At: <https://mailarchive.ietf.org/arch/msg/suit/UV7-ABR_MQJZ4xLT0J2HugTqFEc>
Subject: Re: [Suit] COSE_Sign vs. COSE_Mac
X-BeenThere: suit@ietf.org
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: Software Updates for Internet of Things <suit.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/suit>, <mailto:suit-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/suit/>
List-Post: <mailto:suit@ietf.org>
List-Help: <mailto:suit-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/suit>, <mailto:suit-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 15 Jun 2018 15:05:10 -0000

Hi,

David Brown <david.brown@linaro.org> writes:

> On Mon, Jun 04, 2018 at 05:59:41PM +0200, Koen Zandberg wrote:
>
>>My 2 cents for this scenario: the device I'm currently developing for
>>(samr21-xplained pro) takes around 8 seconds for ed25519 signature
>>verification (TweetNaCl implementation). An HMAC based verification
>>would be a lot faster here (saving me battery power). If you like I can
>>provide you some numbers on flash requirements for both HMAC and
>>public-key implementations.
>
> I think this more points out that there is a need for a better ed25519
> implementation for this kind of scenario.  On my mcu (120Mhz Cortex
> M7), TweetNaCl takes 1-2 seconds for a signature verification.  It is
> nice because it is only about 3kb of code.  The other implementation I
> have, from NaCl, takes on the order of 20-30ms for the same
> verification.  However, it is about 130Kb of code, which makes it
> unreasonable to use in many situations.

For the record, based on our experience on a Cortex M4 and Cortex R5, a
WalnutDSA signature verification would take you on the order of 5ms on
your M7 using only ~3kB of code.  (WalnutDSA is one of the NIST PQC
submissions).  The downside is that the signature is larger than ECC.

> What would be nice to have would be something in between.  A little
> bit larger code, but that runs faster than TweetNaCl.  There is a
> https://munacl.cryptojedi.org/faq.shtml microNaCl library that tries
> to do this.  However, it seems to be largely hand-written assembly,
> and targeted to very specific mcus.
>
> For this MCU, RSA code (using mbed TLS) is about 12Kb of code, and
> takes 400-500ms to do the signature verification.  Gut feeling is that
> Ed25519 could be implemented with similar code size and performance,
> or slightly better.
>
> I don't really have the depth of understanding needed to produce this
> implementation, however, but maybe someone does.

-derek

-- 
       Derek Atkins                 617-623-3745
       derek@ihtfp.com             www.ihtfp.com
       Computer and Internet Security Consultant