Re: [hybi] It's time to ship

Adam Barth <ietf@adambarth.com> Thu, 13 January 2011 09:23 UTC

Return-Path: <ietf@adambarth.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 4388D3A6A04 for <hybi@core3.amsl.com>; Thu, 13 Jan 2011 01:23:51 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.827
X-Spam-Level:
X-Spam-Status: No, score=-3.827 tagged_above=-999 required=5 tests=[AWL=-0.850, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rWNRsPgNUGr2 for <hybi@core3.amsl.com>; Thu, 13 Jan 2011 01:23:49 -0800 (PST)
Received: from mail-gx0-f172.google.com (mail-gx0-f172.google.com [209.85.161.172]) by core3.amsl.com (Postfix) with ESMTP id 33E373A69F2 for <hybi@ietf.org>; Thu, 13 Jan 2011 01:23:49 -0800 (PST)
Received: by gxk28 with SMTP id 28so668575gxk.31 for <hybi@ietf.org>; Thu, 13 Jan 2011 01:26:11 -0800 (PST)
Received: by 10.90.34.12 with SMTP id h12mr2879161agh.84.1294910769631; Thu, 13 Jan 2011 01:26:09 -0800 (PST)
Received: from mail-iw0-f172.google.com (mail-iw0-f172.google.com [209.85.214.172]) by mx.google.com with ESMTPS id w4sm1924778anw.36.2011.01.13.01.26.07 (version=SSLv3 cipher=RC4-MD5); Thu, 13 Jan 2011 01:26:07 -0800 (PST)
Received: by iwn40 with SMTP id 40so1451587iwn.31 for <hybi@ietf.org>; Thu, 13 Jan 2011 01:26:06 -0800 (PST)
Received: by 10.231.199.12 with SMTP id eq12mr2191333ibb.2.1294910766418; Thu, 13 Jan 2011 01:26:06 -0800 (PST)
MIME-Version: 1.0
Received: by 10.231.11.140 with HTTP; Thu, 13 Jan 2011 01:25:36 -0800 (PST)
In-Reply-To: <AANLkTi=CpyVwMYjqaaWizB0=Q5w-oD=xyBFg3_Bs_w5E@mail.gmail.com>
References: <AANLkTim2VGfH2FiJ4iH85wYiuXNKQ1Arh1C1Kg4M58Fs@mail.gmail.com> <sk1si6dvl4s1lmroa5qdt0ra2erd5066ri@hive.bjoern.hoehrmann.de> <AANLkTinBZeMoTLUjPUxjixB7sfhJ4yeHi3REk=oz76FC@mail.gmail.com> <AANLkTi=CpyVwMYjqaaWizB0=Q5w-oD=xyBFg3_Bs_w5E@mail.gmail.com>
From: Adam Barth <ietf@adambarth.com>
Date: Thu, 13 Jan 2011 01:25:36 -0800
Message-ID: <AANLkTi=vbc6TTcxzxRdi_80TtXAp4GVJ-D-dhuTK3bn2@mail.gmail.com>
To: Takeshi Yoshino <tyoshino@google.com>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] It's time to ship
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Jan 2011 09:23:51 -0000

On Thu, Jan 13, 2011 at 1:09 AM, Takeshi Yoshino <tyoshino@google.com> wrote:
> On Thu, Jan 13, 2011 at 06:15, Adam Barth <ietf@adambarth.com> wrote:
>> On Wed, Jan 12, 2011 at 12:28 PM, Bjoern Hoehrmann <derhoermi@gmx.net>
>> wrote:
>> > * Adam Barth wrote:
>> >>http://www.ietf.org/id/draft-abarth-thewebsocketprotocol-01.txt
>> >
>> > This says:
>> >
>> >  The masked-data is the clear-text frame encrypted under AES-128-CTR
>> >  (see [TODO: Cite AES-128-CTR]) using the masking-key as the key and
>> >  the initial counter value equal to the masking-nonce followed by 28
>> >  zero octets.
>> >
>> >  For example, octet i of the masked-data is computed from octet i of
>> >  the clear-text frame as follows:
>> >
>> >    initial-counter = masking-nonce << 96
>> >    masked-octet-i = clear-text-octet-i XOR AES_k(initial-counter + i)
>> >
>> >  where AES_k is AES keyed with the masking-key.
>> >
>> > Could you give a reference for AES-128-CTR and explain the example?
>>
>> Here's an example RFC that uses AES-128-CTR
>>
>> http://www.ietf.org/rfc/rfc4344.txt
>>
>> I believe it's technically defined by combining
>> http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf and
>> http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf, the
>> later of which contains test vectors.  (Careful readers will notice
>> that my example is wrong.)
>>
>
> So, this part can be rewritten like this, I thought. do you think it's
> correct?
> ----
> ...[snip]
>    the initial counter value equal to the masking-nonce followed by 12
> ...[snip]
>   initial-counter = masking-nonce << 96
>   for i = 0 to size-of-clear-text - 1
>     j = i MOD 16
>     if j == 0
>       frame-key = AES_k(initial-counter + i / 16)
>     masked-octet-i = clear-text-octet-i XOR octet-j-of-frame-key
> ----
> and, since masking-key is 20 octet length, it looks like we must
> truncated/padded key to fit AES key size?

Something like that.  Luckily we have crypto experts to help us get it
exactly right.

Adam