Re: [Suit] COSE_Sign vs. COSE_Mac

David Brown <david.brown@linaro.org> Thu, 07 June 2018 16:05 UTC

Return-Path: <david.brown@linaro.org>
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 3BEF6130F56 for <suit@ietfa.amsl.com>; Thu, 7 Jun 2018 09:05:56 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.7
X-Spam-Level:
X-Spam-Status: No, score=-2.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=linaro.org
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 6Ss3VSQSt8pS for <suit@ietfa.amsl.com>; Thu, 7 Jun 2018 09:05:53 -0700 (PDT)
Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7E272130FA3 for <suit@ietf.org>; Thu, 7 Jun 2018 09:05:52 -0700 (PDT)
Received: by mail-it0-x231.google.com with SMTP id n7-v6so13563080itn.1 for <suit@ietf.org>; Thu, 07 Jun 2018 09:05:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ddIwS0/DrKKE4dK7QDF4SETSF5MZoWj8Jm/EduxgwOM=; b=jFwTLxLrpoy5Hze5dAbq07vQCsQkgc1RhJ7KmWUyKYdgt1XfyU68zwW3Fnco2+TATR QADNWHVC/Xo30EhTRY3F7PcWcdRJTQZeRt76ab2N6ezg1RIrUxNjNvB3pYgOC9PtOsdK yOPK5+sSkosHkTErJ5AeDTij9d5T7c34c6mUs=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ddIwS0/DrKKE4dK7QDF4SETSF5MZoWj8Jm/EduxgwOM=; b=pg+TaLXRiFRLIb2zF5vIFQfpzl77lyAmWl7Kg10QlrE0xXJ/3ac6yrEh7qxgvMR462 CXM2hXDmRlvTHMAxNatd1Ro4e/lkLDOCWTXubMcdzJvcGnJpGQapbvm1VBwHrO7HXPP1 WrW4Gv4+9i2j64kctgqPZWLNIOGkmTZ6HYgMUfjTF3Y4P9Qy1gc7e47dYeAk+S82NNTH HXX21IfUN5XoCu0/6AYq19iETXtGfqOTCaY7aCsknNQour+MIUeCfGkxkaWxQkdNFWoN eISxRxDbIqeFn3doMd6NJvPl+ta36+yySDBev7Jc+SZWYwVt7AUec14HWadM4//K7SDf gwrg==
X-Gm-Message-State: APt69E0H4R/hna77h6mpqjmNtItbM4LLdGIKtjG0G1S3g/tQ4dg8n5J3 H/0tv4cmStZOJ2+nePoeeSZwu8NexYs=
X-Google-Smtp-Source: ADUXVKLcszo4VOhUFPqpFUXtqZ3uYNVwrEciM/zQsK/NxWXiRQHlU0QZpnh3Xzmam36laUk35Owy0g==
X-Received: by 2002:a24:714:: with SMTP id f20-v6mr2488088itf.76.1528387551425; Thu, 07 Jun 2018 09:05:51 -0700 (PDT)
Received: from davidb.org ([2601:283:4300:987c::9]) by smtp.gmail.com with ESMTPSA id k1-v6sm7737796iob.9.2018.06.07.09.05.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 09:05:50 -0700 (PDT)
Date: Thu, 07 Jun 2018 10:05:49 -0600
From: David Brown <david.brown@linaro.org>
To: Koen Zandberg <koen@bergzand.net>
Cc: suit@ietf.org
Message-ID: <20180607160549.GA11744@davidb.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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format="flowed"
Content-Disposition: inline
In-Reply-To: <932b5b21-dc56-b316-0c0d-28d43c4cec42@bergzand.net>
User-Agent: Mutt/1.9.4 (2018-02-28)
Archived-At: <https://mailarchive.ietf.org/arch/msg/suit/Ab9lfIOBzOVWfqzU4NW7HJ1cumo>
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: Thu, 07 Jun 2018 16:05:56 -0000

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.

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.

David