-
Notifications
You must be signed in to change notification settings - Fork 28
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
Initial commit for KBKDF #87
base: master
Are you sure you want to change the base?
Conversation
const FEEDBACK_KI: bool = false; | ||
} | ||
|
||
pub struct Counter<Prf, K, R = U32> { |
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.
not so fan of the default values for R
. I wonder if maybe a type alias might not be better. (ala x509-cert::Certificate
)
|
||
// Fixed input data | ||
h.update(label); | ||
if use_separator { |
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.
This behavior is not standard, but TPM specification relies on KBKDF and calls for separator to be optional (https://trustedcomputinggroup.org/wp-content/uploads/TCG_TPM2_r1p59_Part1_Architecture_pub.pdf#page=73).
Added only if Label is not present or if the last octet of Label is not zero.
For a time I intended to provide that behavior as a type parameter, but I'm not sure now. I'd love opinion.
9002671
to
013eec6
Compare
Nist has test vectors http://csrc.nist.gov/groups/STM/cavp/index.html |
kbkdf/src/lib.rs
Outdated
/// Derives `key` from `kin` and other parameters. | ||
fn derive( | ||
&self, | ||
kin: &GenericArray<u8, Prf::KeySize>, |
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.
This is incorrect and doesn't work with hmac.
I think I'll need for it to pass in the Prf
and reset it.
847ceb0
to
9df77b4
Compare
This implements KBKDF as defined in https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-108r1.pdf
This also implements non-standards behavior like
use-l
anduse-separator
. Those are used in TPMs for the KDFa method for example. See comments below for questions about that.Missing: