Re: [hybi] 64-bit comment

Erik Möller <emoller@opera.com> Mon, 16 August 2010 15:12 UTC

Return-Path: <emoller@opera.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 D56773A69F5 for <hybi@core3.amsl.com>; Mon, 16 Aug 2010 08:12:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.299
X-Spam-Level:
X-Spam-Status: No, score=-6.299 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_MED=-4]
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 S9KWKJCI3Ff4 for <hybi@core3.amsl.com>; Mon, 16 Aug 2010 08:12:50 -0700 (PDT)
Received: from smtp.opera.com (smtp.opera.com [213.236.208.81]) by core3.amsl.com (Postfix) with ESMTP id 0115F3A692C for <hybi@ietf.org>; Mon, 16 Aug 2010 08:12:49 -0700 (PDT)
Received: from emoller-pc.gothenburg.osa (sgw-oslo2.opera.com [213.236.208.46]) (authenticated bits=0) by smtp.opera.com (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id o7GFDJLD019385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 16 Aug 2010 15:13:20 GMT
Content-Type: text/plain; charset="iso-8859-15"; format="flowed"; delsp="yes"
To: Ian Hickson <ian@hixie.ch>
References: <op.vesthhewr4mipi@emoller-pc.gothenburg.osa> <Pine.LNX.4.64.1007210719060.7242@ps20323.dreamhostps.com>
Date: Mon, 16 Aug 2010 17:13:12 +0200
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
From: Erik Möller <emoller@opera.com>
Organization: Opera Software
Message-ID: <op.vhjdwazrr4mipi@emoller-pc.gothenburg.osa>
In-Reply-To: <Pine.LNX.4.64.1007210719060.7242@ps20323.dreamhostps.com>
User-Agent: Opera Mail/10.60 (Win32)
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] 64-bit comment
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: Mon, 16 Aug 2010 15:12:52 -0000

On Wed, 21 Jul 2010 09:19:38 +0200, Ian Hickson <ian@hixie.ch> wrote:

> On Thu, 24 Jun 2010, Erik Möller wrote:
>>
>> [43. Let expected be the MD5 fingerprint of challenge as a big-endian  
>> 128 bit
>> string. [RFC1321]]
>>
>> A comment on the 64-bit issue of that code could be helpful I think. If  
>> you're
>> just trying WebSockets on for size and do a simple server you're likely  
>> just
>> going to use the code from rfc1321 to calculate the Md5 and it's pretty  
>> easy
>> to miss the fact that it contains the following definition:
>>
>> /* UINT4 defines a four byte word */
>> typedef unsigned long int UINT4;
>>
>> Works fine on 32-bit OS and LLP64 (i.e. Win64) but on any other 64-bit  
>> OS
>> that's going to typedef UINT4 to be 8 bytes which will happily compile  
>> without
>> errors but will produce an incorrect hash.
>
> I'm very happy to include a note here, what text would you suggest?
>

Perhaps something like this: "Note that the reference implementation in  
rfc1321 defines a 4-byte integer as unsigned long int which does not hold  
true on all 64-bit operating systems."

-- 
Erik Möller
Core Developer
Opera Software