[TLS] Length of a variable-length vector: Could it be an odd multiple?

Jong-Shian Wu <js@crypto.tw> Wed, 13 January 2016 20:45 UTC

Return-Path: <js@crypto.tw>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E318F1B324A for <tls@ietfa.amsl.com>; Wed, 13 Jan 2016 12:45:11 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.278
X-Spam-Level:
X-Spam-Status: No, score=-1.278 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FM_FORGED_GMAIL=0.622] autolearn=no
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 HlA99utL0xU5 for <tls@ietfa.amsl.com>; Wed, 13 Jan 2016 12:45:11 -0800 (PST)
Received: from mail-ob0-x22d.google.com (mail-ob0-x22d.google.com [IPv6:2607:f8b0:4003:c01::22d]) (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 CF8F31B3248 for <tls@ietf.org>; Wed, 13 Jan 2016 12:45:10 -0800 (PST)
Received: by mail-ob0-x22d.google.com with SMTP id py5so97846900obc.2 for <tls@ietf.org>; Wed, 13 Jan 2016 12:45:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crypto-tw.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to:content-type; bh=aomyqoiU9C+Enw/rurM+Jpgbrw2EzDDgUj3Aemhmxco=; b=maL71ajbSgZfBEWA2FS8RFnFzGbkQYj7eSh8YRfjOHR/WUrzQr0CrUT9IN46AqdIhx VlJLzHEHB1752l1nWerkbh4m5IHbLSVi88OpkU2ixKj6fK2bICMS884xgrbjyalBl0PJ G23B0fd8iExjSQFdEv0J0U7V/jVXSf7pf/s43vvwWe/rBeOG84JpMf23yGchsgpJCBcE 4pFSvEmVjCa6WH1/X2/fvgfHgD9Hsz97/M+ZjZJOeIJxGQTQKyIpHFEYHD6sX/49ZJWF VfRKvkocAFbihrC+Y4nfYKG29Ht1lnfFwjqnQS0deG5gFzbLreNFt4kKjZQWH7DHiAAo A66Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=aomyqoiU9C+Enw/rurM+Jpgbrw2EzDDgUj3Aemhmxco=; b=gfxXs8VDt/dEz2PvALI8gwhDkp7/cXbrgtC+5hu4Rsmr16aCyr7s0OB0tDxGUvZJCs 9W7JngEHX2ux7QtOqi6JNHGRT8YWDjJ2K5zs+1b0XjzitxrWewxPhbB55hvxiDUnaDgo s55Qbmd8J6kHiz/BRrJmcP+VGu0iC0fOBp0NMDC1YBU7t/68aEixPys9koZfLnA4sssR zFPTR/fQl1ZG4mVi8KyojTdVIZYt+9yj6tB4AtFYo5sMgolUiD3D7PAkNByGCTahKezn Bn8nESu6iHNjnsivYhu343X7mRPq9MED/LPRI4QhljFtAcivwjOxD4E+bzJJvgytOrEW UHYg==
X-Gm-Message-State: ALoCoQlC0PDsC/ha/PKzqAMsxyIaslaoho8s4keVu16bZALx0ZHRwUNTRsrFEckFRuDiLC1PIvhc8E+pxcxn0ot/5KvVUX3LDw==
X-Received: by 10.60.137.137 with SMTP id qi9mr230840oeb.56.1452717910214; Wed, 13 Jan 2016 12:45:10 -0800 (PST)
Received: from mail-ob0-f181.google.com (mail-ob0-f181.google.com. [209.85.214.181]) by smtp.gmail.com with ESMTPSA id r9sm1503849oih.6.2016.01.13.12.45.09 for <tls@ietf.org> (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Jan 2016 12:45:09 -0800 (PST)
Received: by mail-ob0-f181.google.com with SMTP id vt7so65577902obb.1 for <tls@ietf.org>; Wed, 13 Jan 2016 12:45:09 -0800 (PST)
X-Received: by 10.60.226.136 with SMTP id rs8mr189760oec.31.1452717909580; Wed, 13 Jan 2016 12:45:09 -0800 (PST)
MIME-Version: 1.0
Received: by 10.202.197.131 with HTTP; Wed, 13 Jan 2016 12:44:30 -0800 (PST)
From: Jong-Shian Wu <js@crypto.tw>
Date: Thu, 14 Jan 2016 04:44:30 +0800
X-Gmail-Original-Message-ID: <CA+_zv04F0EiLdcbkhyNo9P8dR3BW3JAsDys_WKFXXUW92x=LcQ@mail.gmail.com>
Message-ID: <CA+_zv04F0EiLdcbkhyNo9P8dR3BW3JAsDys_WKFXXUW92x=LcQ@mail.gmail.com>
To: tls@ietf.org
Content-Type: text/plain; charset="UTF-8"
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/A6XOnHgYpxsBgDVz7DPwnEvD8IA>
Subject: [TLS] Length of a variable-length vector: Could it be an odd multiple?
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 13 Jan 2016 20:50:23 -0000

I have a question about the even-vs-odd restrictions on the length of
a valid variable-length vector defined in TLS specification after
reading the section 4.3 of RFC 5246 [1] which states that: "The length
of an encoded vector must be an even multiple of the length of a
single element (for example, a 17-byte vector of uint16 would be
illegal)."

Does it also means that an 18-byte vector of uint16 would be illegal?
(18 is an odd multiple of 2, not an *even* multiple of 2)

To put it differently, given the following definitions for Foo and Bar:

   opaque Foo[2];
   Foo Bar<4..8>;

Is it correct to say that there does not exist any valid 6-byte value
of type Bar?  (6 is not an even multiple of 2)

[1]: https://tools.ietf.org/html/rfc5246#section-4.3