-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Counter KDF: NIST SP 800-108r1-upd1 #399
Conversation
39dc35c
to
65892ec
Compare
public CounterKdfSpec( | ||
final byte[] secret, final byte[] info, final int outputLen, final String algorithName) { | ||
this.secret = Objects.requireNonNull(secret); | ||
if (this.secret.length == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a cryptographic perspective, should we really be letting people have 1-byte KDK's? This seems like an unnecessary footgun. FWIW, I did look at the AWS-LC source and they also only check that this is non-zero. So if we follow the principal of not adding any new semantics in ACCP this should stay (but I feel gross about it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the library perspective, I think the right approach is to implement the standard faithfully.
@@ -0,0 +1,802 @@ | |||
[TEST] | |||
|
|||
HASH=SHA1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've imported KATs for SHA1 KDFs but we do not support this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file has been copy-pasted from AWS-LC's repo. In case we have to add SHA1 in future, then there do not have to change this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps in a follow-up, should we add benchmarks for our KDFs?
|
||
// The rest of the tests are only available in non-FIPS mode. | ||
@Test | ||
public void concatenationKdfExpectsConcatenationKdfSpecAsKeySpec() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be counterKdfExpectsCounterKdfSpecAsKeySpec
? we're requesting a Counter KDF factory and asserting that it doesn't accept a PBEKeySpec
Description of changes:
The following algorithm for SecretKeyFactory are added:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.