Return-Path: <owner-ips@ece.cmu.edu>
X-Sieve: cmu-sieve 2.0
Return-Path: <owner-ips@ece.cmu.edu>
Received: (from majordom@localhost)
	by ece.cmu.edu (8.11.0/8.10.2) id h2E1CnF16728
	for ips-outgoing; Thu, 13 Mar 2003 20:12:49 -0500 (EST)
X-Authentication-Warning: ece.cmu.edu: majordom set sender to owner-ips@ece.cmu.edu using -f
Received: from cygnus.equallogic.com (cygnus.equallogic.com [65.170.102.10])
	by ece.cmu.edu (8.11.0/8.10.2) with SMTP id h2DMjUM09280
	for <ips@ece.cmu.edu>; Thu, 13 Mar 2003 17:45:30 -0500 (EST)
Received: from cygnus.equallogic.com (localhost.localdomain [127.0.0.1])
	by cygnus.equallogic.com (8.11.6/8.11.6) with ESMTP id h2DMjOf29646
	for <ips@ece.cmu.edu>; Thu, 13 Mar 2003 17:45:24 -0500
Received: from deneb.dev.equallogic.com (deneb.dev.equallogic.com [172.16.1.99])
	by cygnus.equallogic.com (8.11.6/8.11.6) with ESMTP id h2DMjOI29640
	for <ips@ece.cmu.edu>; Thu, 13 Mar 2003 17:45:24 -0500
Received: from pkoning.dev.equallogic.com.equallogic.com (localhost.localdomain [127.0.0.1])
	by deneb.dev.equallogic.com (8.11.6/8.11.6) with ESMTP id h2DMZsx10675;
	Thu, 13 Mar 2003 17:35:54 -0500
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <15985.1938.645033.959017@pkoning.dev.equallogic.com>
Date: Thu, 13 Mar 2003 17:34:58 -0500
From: Paul Koning <pkoning@equallogic.com>
To: dean.scoville@qlogic.com
Cc: Julian_Satran@il.ibm.com, ips@ece.cmu.edu
Subject: Re: CHAP secret lengths
References: <2A8D600C919D2D41A3DAA2D2FEC717143871FB@homer.qlogic.org>
X-Mailer: VM 7.07 under 21.4 (patch 8) "Honest Recruiter" XEmacs Lucid
Sender: owner-ips@ece.cmu.edu
Precedence: bulk

>>>>> "Dean" == Dean Scoville <dean.scoville@qlogic.com> writes:

 Dean> Julian, The MD5 algorithm (RFC 1321) can encode messages that
 Dean> are comprised of an arbitrary number of bits, and as such the
 Dean> message length need not be a multiple of 8-bits.

 Dean> The CHAP RFC (RFC 1994) describes the CHAP Response value as
 Dean> being a one-way hash calculated over a stream of octets,
 Dean> consisting of the Identifier, followed by (concatenated with)
 Dean> the "secret", followed by (concatenated with) the Challenge
 Dean> Value.

 Dean> This would lead me to believe that the CHAP secret must be an
 Dean> integral number of octets, even though the MD5 algorithm is
 Dean> capable of encoding messages that are not a multiple of 8-bits
 Dean> and even though the iSCSI draft uses units of "bits" (96 random
 Dean> bits, 128 bit random secrets, etc.) when referring to
 Dean> acceptable CHAP secret lengths.

 Dean> Can we assume that CHAP secrets will always be a multiple of
 Dean> 8-bits?  If not, do we need to pad the secret to a multiple of
 Dean> 8-bits (using 0's as pad bits, perhaps?) before concatenating
 Dean> it with the Identifier and Challenge values and running the
 Dean> result through the MD5 algorithm?

I don't think you need anything further.  The CHAP values are indeed
multiples of bytes.  That follows from the definition of the protocol
encoding.  They are carried as binary-values, which in this case
should always be a large-binary-value.  That's encoded as a
hex-constant or a base64-constant.  For both of these, the spec
defines the resulting length, which is described as a "byte-length"
and given by a formula that produces an integral number of bytes.

So yes, even though MD5 works on any bit count, CHAP doesn't, and
iSCSI already constrains it to byte multiples.

      paul
