diff options
author | bjk <bjk@FreeBSD.org> | 2013-12-13 03:09:29 +0000 |
---|---|---|
committer | bjk <bjk@FreeBSD.org> | 2013-12-13 03:09:29 +0000 |
commit | d7ee8f3e6e6f4a898a30017648c3478b3f4dad17 (patch) | |
tree | c5e1b1af19210d11eba52054b6b3f659d14eaf07 /crypto/heimdal/lib | |
parent | 7a0c976f7e101a3ce3af15861c1a9cd1bd8df649 (diff) | |
download | FreeBSD-src-d7ee8f3e6e6f4a898a30017648c3478b3f4dad17.zip FreeBSD-src-d7ee8f3e6e6f4a898a30017648c3478b3f4dad17.tar.gz |
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: hrs (mentor, src committer)
MFC after: 3 days
Diffstat (limited to 'crypto/heimdal/lib')
-rw-r--r-- | crypto/heimdal/lib/gssapi/krb5/prf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/heimdal/lib/gssapi/krb5/prf.c b/crypto/heimdal/lib/gssapi/krb5/prf.c index 162a309..671ab2c 100644 --- a/crypto/heimdal/lib/gssapi/krb5/prf.c +++ b/crypto/heimdal/lib/gssapi/krb5/prf.c @@ -119,7 +119,7 @@ _gsskrb5_pseudo_random(OM_uint32 *minor_status, 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_status, tsize = min(dol, output.length); memcpy(p, output.data, tsize); - p += output.length; + p += tsize; dol -= tsize; krb5_data_free(&output); num++; |