PRF and KDF algorithms

Links

Description

A Pseudo-Random Function family, or PRF, expands a key and a seed to a pseudo-random output, which is usually of variable length. Normally the key should be chosen uniformly at random (or at least with high entropy), but the seed can be any byte string.

A PRF is sometimes called a Key Derivation Function, or KDF, especially when it is used to derive or "separate" keys.

(Note that the classification used in this version of SCAN is different from that in previous versions: functions with variable-length output that are always used with only one input, rather than separate seed and key inputs, are treated as MessageDigests. The only example of this was MGF1.)

Key derivation algorithms intended for use with low-entropy inputs (e.g. passwords or passphrases) are classified separately, in the PassphraseHash section.


HMAC-PRF(digest) PRF Construction
Designers:
David Hopwood
(HMAC: Mihir Bellare, Ran Canetti, Hugo Krawczyk, Adi Shamir)
Published:
2000 (HMAC: June 1996)
Description:
HMAC-PRF is defined as:
HMAC-PRF(digest)(key, seed) =
    HMAC(digest)(key, I2OSP4(0) || seed) ||
    HMAC(digest)(key, I2OSP4(1) || seed) ||
    HMAC(digest)(key, I2OSP4(2) || seed) || ...
The maximum output length of the PRF is 232 × (output length of digest).
References:
Parameters:
Key length:
Any multiple of 8 bits that does not cause the maximum input length for the MessageDigest to be exceeded.
Missing information:
Test vectors.


KDF2(digest) PRF Construction
Designers:
P1363 Working Group
Published:
2001
Description:
KDF2 is defined as:
KDF2(digest)(key, seed) =
    digest(key || I2OSP4(1) || seed) ||
    digest(key || I2OSP4(2) || seed) ||
    digest(key || I2OSP4(3) || seed) || ...
The maximum output length of the PRF is (232 - 1) × (output length of digest).

See the comments below concerning compatibility with IEEE P1363a.

References:
Parameters:
Key length:
Any multiple of 8 bits that does not cause the maximum input length for the MessageDigest to be exceeeded.
Missing information:
Test vectors.
Comments:
Security comments:


SSL3-PRF PRF
Designers:
Netscape Communications Corp.
Description:
SSL3-PRF is defined as:
SSL3-PRF(key, seed) =
    MD5(key || SHA-1("A" || key || seed)) ||
    MD5(key || SHA-1("BB" || key || seed)) ||
    MD5(key || SHA-1("CCC" || key || seed)) || ...
A maximum of 26 × 16 = 416 bytes may be generated.

When used as a KDF, set seed to the zero-length string.

References:
Key length:
Any multiple of 8 bits that does not cause the maximum input length for MD5 or SHA-1 to be exceeeded.
Missing information:
Test vectors.
Comment:
When SSL3-PRF is used to implement SSL version 3, the master_secret described in the SSL specification corresponds to the PRF key, and (ServerHello.random || ClientHello.random) corresponds to the PRF seed.


TLS-PRF PRF
Designers:
IETF Transport Layer Security Working Group
Published:
January 1999
Description:
TLS-PRF is defined as follows:
TLS-PRF(key, seed) =
    PMD5(S1, seed) XOR PSHA-1(S2, seed)
Lkey = length in bytes of key
LS1 = LS2 = ceiling(Lkey / 2)
S1 = first LS1 bytes of key
S2 = last LS2 bytes of key
AH(0) = seed
AH(i) = HMAC(H)(key, AH(i-1)), for i > 0
PH(S1, seed) =
    HMAC(H)(key, AH(1) || seed) ||
    HMAC(H)(key, AH(2) || seed) ||
    HMAC(H)(key, AH(3) || seed) || ...
References:
Key length:
Any multiple of 8 bits that does not cause the maximum input length for MD5 or SHA-1 to be exceeeded.
Comment:
When TLS-PRF is used to implement the TLS protocol, the "label" argument to the PRF should be prepended to the seed. The key is referred to as the "secret" by the TLS specification. I.e. where the TLS spec says "PRF(secretlabelseed)", this may be implemented as "TLS-PRF(secretlabel || seed)".
Security comment:
The intention of using both MD5 and SHA-1 in the design was to try to ensure that weaknesses in only one of these hashes would not cause any security problem. However, only the first half of the key is used in PMD5, and only the second half in PSHA-1. This means that the security cannot be guaranteed to depend on the stronger of MD5 and SHA-1, unless there is sufficient entropy in both the first and last halves of the input key. If the key contains non-random fields (e.g. the version field in the master secret for TLS RSA ciphersuites), these will only affect one of PMD5 or PSHA-1.

Arguably, this does not matter much in practice because either PMD5 or PSHA-1 would be secure PRFs on their own.


Alleged PRFs and KDFs


Valid HTML 4.0 Valid CSS Copyright and trademarks