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

Daniel Franke <> Fri, 24 February 2017 15:49 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 6C15612989E for <>; Fri, 24 Feb 2017 07:49:30 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.7
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: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id zuUKzN5xqhkR for <>; Fri, 24 Feb 2017 07:49:29 -0800 (PST)
Received: from ( [IPv6:2607:f8b0:400d:c09::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 32A3812968F for <>; Fri, 24 Feb 2017 07:49:29 -0800 (PST)
Received: by with SMTP id u188so21686730qkc.2 for <>; Fri, 24 Feb 2017 07:49:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; 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;; 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 with SMTP id 101mr3026823qks.10.1487951368345; Fri, 24 Feb 2017 07:49:28 -0800 (PST)
MIME-Version: 1.0
Received: by with HTTP; Fri, 24 Feb 2017 07:49:27 -0800 (PST)
In-Reply-To: <>
References: <> <> <> <>
From: Daniel Franke <>
Date: Fri, 24 Feb 2017 10:49:27 -0500
Message-ID: <>
To: "David McGrew (mcgrew)" <>, dharkins <>,
Content-Type: text/plain; charset=UTF-8
Archived-At: <>
Subject: Re: [Cfrg] RFC 5297 and absent vs. zero-length nonces
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: Crypto Forum Research Group <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Fri, 24 Feb 2017 15:49:30 -0000

On 2/24/17, David McGrew (mcgrew) <> 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.