private static byte[] PRF_legacy(TLSKeyMaterialSpec parameters)
{
Mac md5Hmac = new HMac(DigestFactory.createMD5());
Mac sha1HMac = new HMac(DigestFactory.createSHA1());
byte[] label = Strings.toByteArray(parameters.getLabel());
byte[] labelSeed = Arrays.concatenate(label, parameters.getSeed());
byte[] secret = parameters.getSecret();
int s_half = (secret.length + 1) / 2;
byte[] s1 = new byte[s_half];
byte[] s2 = new byte[s_half];
System.arraycopy(secret, 0, s1, 0, s_half);
System.arraycopy(secret, secret.length - s_half, s2, 0, s_half);
int size = parameters.getLength();
byte[] b1 = new byte[size];
byte[] b2 = new byte[size];
hmac_hash(md5Hmac, s1, labelSeed, b1);
hmac_hash(sha1HMac, s2, labelSeed, b2);
for (int i = 0; i < size; i++)
{
b1[i] ^= b2[i];
}
return b1;
}