Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Dec 2013 01:24:21 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org
Subject:   svn commit: r259758 - in releng/10.0: . crypto/heimdal/lib/gssapi/krb5
Message-ID:  <201312230124.rBN1OLMH023322@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Mon Dec 23 01:24:21 2013
New Revision: 259758
URL: http://svnweb.freebsd.org/changeset/base/259758

Log:
  MFS r249447:
    Apply patch from upstream Heimdal for encoding fix
  
    RFC 4402 specifies the implementation of the gss_pseudo_random()
    function for the krb5 mechanism (and the C bindings therein).
    The implementation uses a PRF+ function that concatenates the output
    of individual krb5 pseudo-random operations produced with a counter
    and seed.  The original implementation of this function in Heimdal
    incorrectly encoded the counter as a little-endian integer, but the
    RFC specifies the counter encoding as big-endian.  The implementation
    initializes the counter to zero, so the first block of output (16 octets,
    for the modern AES enctypes 17 and 18) is unchanged.  (RFC 4402 specifies
    that the counter should begin at 1, but both existing implementations
    begin with zero and it looks like the standard will be re-issued, with
    test vectors, to begin at zero.)
  
    This is upstream's commit f85652af868e64811f2b32b815d4198e7f9017f6,
    from 13 October, 2013:
    % Fix krb5's gss_pseudo_random() (n is big-endian)
    %
    % The first enctype RFC3961 prf output length's bytes are correct because
    % the little- and big-endian representations of unsigned zero are the
    % same.  The second block of output was wrong because the counter was not
    % being encoded as big-endian.
    %
    % This change could break applications.  But those applications would not
    % have been interoperating with other implementations anyways (in
    % particular: MIT's).
  
  Approved by:	re (gjb)

Modified:
  releng/10.0/UPDATING
  releng/10.0/crypto/heimdal/lib/gssapi/krb5/prf.c
Directory Properties:
  releng/10.0/   (props changed)

Modified: releng/10.0/UPDATING
==============================================================================
--- releng/10.0/UPDATING	Mon Dec 23 01:15:55 2013	(r259757)
+++ releng/10.0/UPDATING	Mon Dec 23 01:24:21 2013	(r259758)
@@ -16,6 +16,16 @@ from older versions of FreeBSD, try WITH
 stable/10, and then rebuild without this option. The bootstrap process from
 older version of current is a bit fragile.
 
+20131223:
+	The behavior of gss_pseudo_random() for the krb5 mechanism
+	has changed, for applications requesting a longer random string
+	than produced by the underlying enctype's pseudo-random() function.
+	In particular, the random string produced from a session key of
+	enctype aes256-cts-hmac-sha1-96 or aes256-cts-hmac-sha1-96 will
+	be different at the 17th octet and later, after this change.
+	The counter used in the PRF+ construction is now encoded as a
+	big-endian integer in accordance with RFC 4402.
+
 20131031:
 	The default version of mtree is nmtree which is obtained from
 	NetBSD.  The output is generally the same, but may vary

Modified: releng/10.0/crypto/heimdal/lib/gssapi/krb5/prf.c
==============================================================================
--- releng/10.0/crypto/heimdal/lib/gssapi/krb5/prf.c	Mon Dec 23 01:15:55 2013	(r259757)
+++ releng/10.0/crypto/heimdal/lib/gssapi/krb5/prf.c	Mon Dec 23 01:24:21 2013	(r259758)
@@ -119,7 +119,7 @@ _gsskrb5_pseudo_random(OM_uint32 *minor_
     while(dol > 0) {
 	size_t tsize;
 
-	_gsskrb5_encode_om_uint32(num, input.data);
+	_gsskrb5_encode_be_om_uint32(num, input.data);
 
 	ret = krb5_crypto_prf(context, crypto, &input, &output);
 	if (ret) {
@@ -133,7 +133,7 @@ _gsskrb5_pseudo_random(OM_uint32 *minor_
 
 	tsize = min(dol, output.length);
 	memcpy(p, output.data, tsize);
-	p += output.length;
+	p += tsize;
 	dol -= tsize;
 	krb5_data_free(&output);
 	num++;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312230124.rBN1OLMH023322>