[TLS] How to wade through Hello extensions was: The MCSV hack is a compliment to SSL/TLS designers

Marsh Ray <marsh@extendedsubset.com> Thu, 10 December 2009 18:46 UTC

Return-Path: <marsh@extendedsubset.com>
X-Original-To: tls@core3.amsl.com
Delivered-To: tls@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 549723A68A6 for <tls@core3.amsl.com>; Thu, 10 Dec 2009 10:46:52 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.295
X-Spam-Level:
X-Spam-Status: No, score=-2.295 tagged_above=-999 required=5 tests=[AWL=-0.296, BAYES_00=-2.599, J_CHICKENPOX_43=0.6]
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 EvfN0WgAI1xF for <tls@core3.amsl.com>; Thu, 10 Dec 2009 10:46:51 -0800 (PST)
Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) by core3.amsl.com (Postfix) with ESMTP id 3FF403A67E6 for <tls@ietf.org>; Thu, 10 Dec 2009 10:46:51 -0800 (PST)
Received: from xs01.extendedsubset.com ([69.164.193.58]) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.68) (envelope-from <marsh@extendedsubset.com>) id 1NIo2B-0005zH-Ec; Thu, 10 Dec 2009 18:46:39 +0000
Received: from [127.0.0.1] (localhost [127.0.0.1]) by xs01.extendedsubset.com (Postfix) with ESMTP id A1354603A; Thu, 10 Dec 2009 18:46:35 +0000 (UTC)
X-Mail-Handler: MailHop Outbound by DynDNS
X-Originating-IP: 69.164.193.58
X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information)
X-MHO-User: U2FsdGVkX1/0Ae807Uc8hgGwxbL1INs2vYD0bIp3s3c=
Message-ID: <4B214209.6020304@extendedsubset.com>
Date: Thu, 10 Dec 2009 12:46:33 -0600
From: Marsh Ray <marsh@extendedsubset.com>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: mrex@sap.com
References: <200912101722.nBAHM9iR022569@fs4113.wdf.sap.corp>
In-Reply-To: <200912101722.nBAHM9iR022569@fs4113.wdf.sap.corp>
X-Enigmail-Version: 0.96.0
OpenPGP: id=1E36DBF2
Content-Type: multipart/mixed; boundary="------------060905010508040002010208"
Cc: tls@ietf.org, James@Manger.com.au
Subject: [TLS] How to wade through Hello extensions was: The MCSV hack is a compliment to SSL/TLS designers
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.9
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/listinfo/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/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: Thu, 10 Dec 2009 18:46:52 -0000

Martin Rex wrote:
> Marsh Ray wrote:
>>> I recommend the approach in draft-mrex-tls-secure-renegotiation-03
>>> (MCSV in every ClientHello).
>> It also requires the use of an extension.
> 
> No, it does NOT.
> 
> draft-mrex-tls-secure-renegotiation-03 uses additional data following
> the compression_method in ServerHello for Server->Client signaling.
> See Section 4.4 last two paragraphs of that draft.
> 
> That extra data is designed to be compatible with TLS extensions,
> but it can be processed like a static 6-octet string by extensions-free
> implementations.

Hmmm, an additional six bytes after a hello:

0x00  0x04  0xFF  0x01  0x00  0x00

I'd call that an extension.

The only difference is that in draft-ietf-tls-renegotiation it contains
useful payload data on renegotiation handshakes.

> Clients that _send_ TLS extensions in ClientHello will have to search
> the S->C signal among the TLS extensions in ServerHello -- but that
> is an obvious side-effect of asking for TLS extension in ClientHello.

Right.

And in draft-ietf-tls-renegotiation you have to be able to iterate
extensions on any hello message. Not a big deal. In any case, you've had
six and a half years to prepare yourself for it.

Hmm, let's see how long it takes me to write this in C++.

Starting typing code at 11:41 AM
Finished primary functiat at 11:59.

So the basic "wade through the list of extensions" function came out to
51 LoC (including comments and gratuitous whitespace) and 18 minutes.

Wonder if it compiles?

Fixed typo assert(extId); should be assert(extType);

Fixed type error
	*rv.assign(p, p + statedExtDataLen);
should be
	rv->assign(p, p + statedExtDataLen);

(I updated the version pasted above)

Compiles cleanly at 12:04, time includes typing into this email.

Quick and dirty test program with actual data from Wireshark. Stepping
through in debugger.

12:15 PM Found bug. Missing loop increment, silly mistake.

12:28 PM Passes four reasonably-useful test cases.

So it took 47 minutes including writing a custom unit test. I would
probably stare at it a while longer and find things I'd want to change.
I would definitely look at it again the next day. QA will want to work
on product tests of course.

There is a non-zero probability that it still contains bugs, but I think
it's a reasonable first cut.

Anyone is welcome to use it if it helps.

- Marsh