Re: [babel] hmac info model elements

Toke Høiland-Jørgensen <toke@toke.dk> Tue, 08 January 2019 08:33 UTC

Return-Path: <toke@toke.dk>
X-Original-To: babel@ietfa.amsl.com
Delivered-To: babel@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9F192130E3F for <babel@ietfa.amsl.com>; Tue, 8 Jan 2019 00:33:31 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=toke.dk
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 ojMTILa2DNQq for <babel@ietfa.amsl.com>; Tue, 8 Jan 2019 00:33:29 -0800 (PST)
Received: from mail.toke.dk (mail.toke.dk [52.28.52.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A17E81271FF for <babel@ietf.org>; Tue, 8 Jan 2019 00:33:28 -0800 (PST)
From: Toke Høiland-Jørgensen <toke@toke.dk>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1546936375; bh=yeSxwP8cy/VEfzU7Du/XZ5Qe4TEzDDgkU0aD7hr0HZg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=lksdOCVOH6W4OLasHJLXXmWGsQki8oGJ3kd48TEBQqgohanVc3CFSvwLq+bH4PLiJ 5ELeg2ycOPgFU8jLz7NyPVfvB2Q+qAWSDmcVoz42DCH//oVx4d45GOGGjVGTwDO05G KbCEsJ6KC+X02m+TnfSTqYbvWtCndWnYI1ooPlOBOUaL3DRDF+xcjqvv2NYxWi5iPW zf4Nwb17ebTyOqWQX4PmUdlgQbLLGI2RysPTLTghfkHNwD4L7JD3SA8X22QasojDtI TEa8MyOVcRYV5liDj3vsH126VDDf517MSc6lQ2wQoKCmeRpiKR3XmBZ7jnyeyDrPun a7avjn9Sh6Yig==
To: "STARK, BARBARA H" <bs7652@att.com>, Dave Taht <dave.taht@gmail.com>
Cc: Juliusz Chroboczek <jch@irif.fr>, Mahesh Jethanandani <mjethanandani@gmail.com>, Babel at IETF <babel@ietf.org>
In-Reply-To: <2D09D61DDFA73D4C884805CC7865E6114DF86FD0@GAALPA1MSGUSRBF.ITServices.sbc.com>
References: <2D09D61DDFA73D4C884805CC7865E6114DF7EECB@GAALPA1MSGUSRBF.ITServices.sbc.com> <91CABBA9-DFC0-48C5-9A36-E2B12FC376D9@gmail.com> <2D09D61DDFA73D4C884805CC7865E6114DF8354B@GAALPA1MSGUSRBF.ITServices.sbc.com> <87tvio2i9l.wl-jch@irif.fr> <2D09D61DDFA73D4C884805CC7865E6114DF8669E@GAALPA1MSGUSRBF.ITServices.sbc.com> <87k1jgwhlz.fsf@toke.dk> <CAA93jw6QR4_035Q7c44hg+gQaG-9riBj5uDbo=0ahxXBwVFG6g@mail.gmail.com> <87ef9owadw.fsf@toke.dk> <2D09D61DDFA73D4C884805CC7865E6114DF86FD0@GAALPA1MSGUSRBF.ITServices.sbc.com>
Date: Tue, 08 Jan 2019 09:32:53 +0100
X-Clacks-Overhead: GNU Terry Pratchett
Message-ID: <875zuzwnuy.fsf@toke.dk>
MIME-Version: 1.0
Content-Type: text/plain
Archived-At: <https://mailarchive.ietf.org/arch/msg/babel/6rC6okUdGXL-5HRwb8fVX5yJpFM>
Subject: Re: [babel] hmac info model elements
X-BeenThere: babel@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "A list for discussion of the Babel Routing Protocol." <babel.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/babel>, <mailto:babel-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/babel/>
List-Post: <mailto:babel@ietf.org>
List-Help: <mailto:babel-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/babel>, <mailto:babel-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 08 Jan 2019 08:33:32 -0000

"STARK, BARBARA H" <bs7652@att.com> writes:

>> >> > Toke said: "Bird uses an unencoded string..."
>> >> > <bhs> I'm not sure what "unencoded" means here? But this sounds
>> >> > like maybe the entered string is a "passphrase" / PSK, like what's
>> >> > used for Wi-Fi, which is then used to derive the HMAC key using
>> >> > Unicode encoding?
>> >>
>> >> Nope, no derivation, just the raw ASCII bytes from the string used as
>> >> an HMAC key, zero-padded to the block size. Unless the supplied ASCII
>> >> string is longer than the block size, in which case it is hashed
>> >> first.
>> >
>> > ^^^^^^ ???? So you are saying an overlong key is transmuted into
>> > something else entirely, not truncated?
>> 
>> Yup, that would appear to be the case:
>> 
>> https://gitlab.labs.nic.cz/labs/bird/blob/master/lib/mac.c#L105
>
> I noticed the referenced code mentioned it could be used for OSPF (RFC 5709). So I went to see if RFC 5709 had anything to say about this. And it does:
>    (1) PREPARATION OF KEY
>        In this application, Ko is always L octets long.
>
>        If the Authentication Key (K) is L octets long, then Ko is equal
>        to K.  If the Authentication Key (K) is more than L octets long,
>        then Ko is set to H(K).  If the Authentication Key (K) is less
>        than L octets long, then Ko is set to the Authentication Key (K)
>        with zeros appended to the end of the Authentication Key (K),
>        such that Ko is L octets long.

Ah, nice find! This is exactly what Bird does.

> I'd be fine with this scheme, but think we should probably specify it
> somewhere, like OSPF does.

Agreed. This scheme has the advantage of being simple, and not requiring
another hashing or key derivation algorithm. At the cost of making it
easier to go from the derived key back to the original passphrase. Not
sure if that is a problem that warrants a "proper" key derivation
function?

> I notice OSPF makes no mention of arriving at the Authentication Key
> from a string (or hex). It just assumes its dealing with something
> that has a length measured in octets.
>
> WPA2 limits its passphrase strings to "printable ASCII" characters (32
> - 126). Since OSPF doesn't seem to care how it comes by the Key
> octets, it has no such limit in its spec. I wonder if there are any
> characters that would make one of the babel implementations choke; if
> so we may want to limit what characters can be used if input as ASCII.
> WPA2 does also allow hex PSK, which has no limitation on usable
> values.

I think that we should specify *something*, or we end up with
incompatibilities again. And, well, much as I hate UTF-8-challenged
systems in general, I'm not sure if doing UTF-8 is worth it in this
instance?

-Toke