Re: [Cfrg] RFC 5297 and absent vs. zero-length nonces

Daniel Franke <dfoxfranke@gmail.com> Fri, 24 February 2017 15:49 UTC

Return-Path: <dfoxfranke@gmail.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 6C15612989E for <cfrg@ietfa.amsl.com>; Fri, 24 Feb 2017 07:49:30 -0800 (PST)
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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 zuUKzN5xqhkR for <cfrg@ietfa.amsl.com>; Fri, 24 Feb 2017 07:49:29 -0800 (PST)
Received: from mail-qk0-x230.google.com (mail-qk0-x230.google.com [IPv6:2607:f8b0:400d:c09::230]) (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 32A3812968F for <cfrg@irtf.org>; Fri, 24 Feb 2017 07:49:29 -0800 (PST)
Received: by mail-qk0-x230.google.com with SMTP id u188so21686730qkc.2 for <cfrg@irtf.org>; Fri, 24 Feb 2017 07:49:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=OM90YpFMibhhfnH7fiy4s2VdH+ssmMjKcoky9QPwY38=; b=PkSDhi/RxaEH4G6GVj/uLbuUpEe8Cu0eyC/dWU41x4sKqUBYiKmvOcLATXBsHBnlaK f6LES5cr6H8qmr9i/PL2ykRE6tg5x2rlDbvooB+wSpGwbLoDwVeJkZQ0X2sQGU1Qy36e 20VDfiO2XrImDCinkYru8/QR1niBnhW3Sg7+8Y+h9DI9pOVLBNsWMkp/j1zx4f/nPf/1 hGJf4l5bWj98ssRD/VYjrgXJvanYES10979j5Rd1cQRkQjb/ZASBhXGXpVZtFXpbGEEA gvv9WW40eEkQ2C/S6S6XKi3U1H/BADMVfzRvdmaORJd5kIbuTrnxjekDEORq5gfcjIrM oH2A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=OM90YpFMibhhfnH7fiy4s2VdH+ssmMjKcoky9QPwY38=; b=mViWm1V9DckGpWplIZ1NUS098IyPSYk2gIr7G50u+77ereT3Z2rLoQQwMql1SrEx7U nR3u4z0mBmrrpG2WfmRzKUHLX14NFF27fhANhOrHSm5usZEoje3DO8RIFFvm7Q0kOSeO Np91hIDwxLm5cE0sDPdaqqL0UZfxMwi8DlYIBv9zxSjjSsDtut143N+UTCGXbom8yBTx V3pvZwkB26AkNyJyYHM2puC5R3NggmMdFx0lPVupFO5MoGl5xwkgod8hXkQooCZMBkxX ibwcE5KX47OabCe+Pzh+xIhSZitdSlM1LC4tansmA9wKH9FpwRG56BSJgY7eJXGHP6zI LwNg==
X-Gm-Message-State: AMke39kBkpAWvyIEyC6+prsIc+TOUzwmm8cl0iWZyVG9x2Jt5pYJf5eS7c5HsWugd1LQL1Ot6fYhTDvU2aGpXw==
X-Received: by 10.55.18.232 with SMTP id 101mr3026823qks.10.1487951368345; Fri, 24 Feb 2017 07:49:28 -0800 (PST)
MIME-Version: 1.0
Received: by 10.12.136.33 with HTTP; Fri, 24 Feb 2017 07:49:27 -0800 (PST)
In-Reply-To: <22B2CCFE-368C-4659-8828-FC11AC685441@cisco.com>
References: <CAJm83bB22+9L3Rcn43hyDuGx1=ncse5cLYCm+dAP9hCPqnd8Hw@mail.gmail.com> <288933e2-c982-1761-9b14-3b6215978bb6@lounge.org> <47B1124D-F656-49A7-9385-A06F68428B27@cisco.com> <22B2CCFE-368C-4659-8828-FC11AC685441@cisco.com>
From: Daniel Franke <dfoxfranke@gmail.com>
Date: Fri, 24 Feb 2017 10:49:27 -0500
Message-ID: <CAJm83bAcyQG6RvM-tqhDuO_RNfzhD14CMkQ1uUJY2XGxwLCPqA@mail.gmail.com>
To: "David McGrew (mcgrew)" <mcgrew@cisco.com>, dharkins <dharkins@arubanetworks.com>, cfrg@irtf.org
Content-Type: text/plain; charset=UTF-8
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/4rKBZaosxcVa7tbWDWi40VB7OJs>
Subject: Re: [Cfrg] RFC 5297 and absent vs. zero-length nonces
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Fri, 24 Feb 2017 15:49:30 -0000

On 2/24/17, David McGrew (mcgrew) <mcgrew@cisco.com> wrote:
>Clearly SIV modes can and should set N_MIN to zero.  I guess the N_MIN=1
> got missed during the review of RFC 5297.  (I recall discussing the N_MAX
> guidance during the review process, but I think N_MIN went unnoticed.)
>
>If N_MIN can be changed in RFC 5297 from 1 to 0 with an Errata, that would
> be the best way to go.   Otherwise, I suggest creating new IANA entries
> for the existing SIV modes that reference that RFC, but change N_MIN to
> zero.

If we agree that a change is in order, that I hope we can also agree
that an erratum would suffice. Having two different IANA codepoints
that differ only in the value of N_MIN sounds like it would sow a
hideous amount of confusion.

It sounds like the three of us agree, at least, that my option 3,
treating a zero-length nonce as a request for deterministic
encryption, is the Wrong Thing. For my own purposes, I'm just doing an
RFC 5297 implementation (look for a release announcement RSN) and not
aspiring to create a general RFC 5116 interface, so I think I can go
ahead and allow zero-length nonces regardless of whether it's strictly
RFCily-correct to do so. My function signature looks like this:

int AES_SIV_Encrypt(AES_SIV_CTX *ctx,
                    uint8_t *out, size_t *out_len,
                    uint8_t const* key, size_t key_len,
                    uint8_t const* nonce, size_t nonce_len,
                    uint8_t const* plaintext, size_t plaintext_len,
                    uint8_t const* ad, size_t ad_len);

It'll give you deterministic encryption if the `nonce` argument is
NULL, and encryption with a zero-length nonce if `nonce` is non-NULL
and `nonce_len` is 0.