Simplify HKDF interface.

This commit is contained in:
Moxie Marlinspike 2014-07-08 19:59:35 -07:00
parent 64b40df15b
commit fcaa3f0d73
3 changed files with 1 additions and 12 deletions

View File

@ -63,7 +63,7 @@ public abstract class HKDF {
ByteArrayOutputStream results = new ByteArrayOutputStream();
int remainingBytes = outputSize;
for (int i= getIterationStartOffset();i<iterations + getIterationEndOffset();i++) {
for (int i= getIterationStartOffset();i<iterations + getIterationStartOffset();i++) {
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(prk, "HmacSHA256"));
@ -89,6 +89,5 @@ public abstract class HKDF {
}
protected abstract int getIterationStartOffset();
protected abstract int getIterationEndOffset();
}

View File

@ -5,9 +5,4 @@ public class HKDFv2 extends HKDF {
protected int getIterationStartOffset() {
return 0;
}
@Override
protected int getIterationEndOffset() {
return 0;
}
}

View File

@ -5,9 +5,4 @@ public class HKDFv3 extends HKDF {
protected int getIterationStartOffset() {
return 1;
}
@Override
protected int getIterationEndOffset() {
return 1;
}
}