[TLS] A small detail in HMAC key generation for Finished message

Christian Huitema <huitema@microsoft.com> Wed, 23 December 2015 22:19 UTC

Return-Path: <huitema@microsoft.com>
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 D2C7A1A887D for <tls@ietfa.amsl.com>; Wed, 23 Dec 2015 14:19:14 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.002
X-Spam-Level:
X-Spam-Status: No, score=-2.002 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham
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 vwJR-Giunp6V for <tls@ietfa.amsl.com>; Wed, 23 Dec 2015 14:19:13 -0800 (PST)
Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0124.outbound.protection.outlook.com [207.46.100.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6858A1A8877 for <tls@ietf.org>; Wed, 23 Dec 2015 14:19:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PqCshwHXmvEWcxk/KxzzrWP4G99bWp7FL26HB86lk4E=; b=INYywNvpjy0x3thT5GSjTv0VHpuZzdsbPmmsdcQ3HBqRbfHGFgMiwmSCtIE2V6kFLDJwOqVY/uSSCFguZ9VC9jY5hIkxAO2yFiEk4P1by6Bno5shy+tuqpCg4UOPpCulmmBqJHxQOb1Kao6RW6+Ijcym5LJZnc+b+MeSTHDbxIk=
Received: from DM2PR0301MB0655.namprd03.prod.outlook.com (10.160.96.17) by DM2PR0301MB0655.namprd03.prod.outlook.com (10.160.96.17) with Microsoft SMTP Server (TLS) id 15.1.361.13; Wed, 23 Dec 2015 22:19:11 +0000
Received: from DM2PR0301MB0655.namprd03.prod.outlook.com ([10.160.96.17]) by DM2PR0301MB0655.namprd03.prod.outlook.com ([10.160.96.17]) with mapi id 15.01.0361.006; Wed, 23 Dec 2015 22:19:11 +0000
From: Christian Huitema <huitema@microsoft.com>
To: "tls@ietf.org" <tls@ietf.org>
Thread-Topic: A small detail in HMAC key generation for Finished message
Thread-Index: AdE9zLUIRqzr9WCoSK+Y1yfu8/UHSA==
Date: Wed, 23 Dec 2015 22:19:10 +0000
Message-ID: <DM2PR0301MB06550A43EC188A16E8C8464DA8E60@DM2PR0301MB0655.namprd03.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=huitema@microsoft.com;
x-originating-ip: [2601:600:8900:31e1:dd84:ed7c:8cb:cd28]
x-microsoft-exchange-diagnostics: 1; DM2PR0301MB0655; 5:Z2csYxNJxyUqJKVKPrhllQGmijeFZ5/U/y/kyVweyaG8maO7z7SXafIFw6h7m5S1SJ0dAn979rV0ODle7qIn0iZEb3V/DNtL40nuh9Ml0kOPm1VqgVTHG2zPsVaojX2KkVoV7B5gFRhQjtScqGPKYQ==; 24:F/au1JBnkXMpuq5ewcleKYbQcdbiMuMZYawRsOwO1jGY74jLHKthKrp/n7ie35m/Er3ME1Ist0/D1ZQCCbG2wVepyCNUWbA+LULPgwOliWY=
x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0655;
x-microsoft-antispam-prvs: <DM2PR0301MB06556F815B88E0324FB96266A8E60@DM2PR0301MB0655.namprd03.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:;
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001)(61426038)(61427038); SRVR:DM2PR0301MB0655; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB0655;
x-forefront-prvs: 0799B1B2D7
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(1730700002)(74316001)(5008740100001)(10400500002)(10290500002)(54356999)(40100003)(122556002)(33656002)(99286002)(106356001)(110136002)(5001960100002)(107886002)(105586002)(86612001)(86362001)(189998001)(10090500001)(50986999)(97736004)(81156007)(101416001)(6116002)(8990500004)(2351001)(229853001)(87936001)(2900100001)(77096005)(102836003)(92566002)(11100500001)(5005710100001)(5004730100002)(586003)(5002640100001)(1096002)(1220700001)(450100001)(5003600100002)(2501003)(76576001)(3826002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB0655; H:DM2PR0301MB0655.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en;
received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts)
spamdiagnosticoutput: 1:23
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: microsoft.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Dec 2015 22:19:11.0279 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0655
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/FBihBxeF_vuJwNe18F-jTY_AKr8>
Subject: [TLS] A small detail in HMAC key generation for Finished message
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, 23 Dec 2015 22:19:15 -0000

In the current 1.3 draft, section 6.3.4.3 specifies the content of the Finished message. It contains this specification for key computation:

client_finished_key =
    HKDF-Expand-Label(BaseKey, "client finished", "", L)

server_finished_key =
    HKDF-Expand-Label(BaseKey, "server finished", "", L)

I wonder what the zero length string actually means. Is it a null-terminated string that would encode in binary as a one octet byte string of value 0, or an empty string that would encode in binary as a zero length string?

There is one example of encoding a string in section 4.8.1, and the binary representation shows the encoding of the final null byte. Is that a common assumption?

Similarly, in the HKDF-Expand-Label, do we assume a final null byte for the "label"?

-- Christian Huitema