diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-12-03 12:20:05 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-12-06 01:54:09 -0500 |
commit | 6921d1fd2520df54b29125221eea06f230d78e61 (patch) | |
tree | 98d47e0bda7deee04f04f24ffe36816129b1f65c /src/common/crypto.h | |
parent | 4f60bca1c1cb5ba07730d8f20a4647cc9494b6c6 (diff) | |
download | tor-6921d1fd2520df54b29125221eea06f230d78e61.tar.gz tor-6921d1fd2520df54b29125221eea06f230d78e61.zip |
Implement HKDF from RFC5869
This is a customizable extract-and-expand HMAC-KDF for deriving keys.
It derives from RFC5869, which derives its rationale from Krawczyk,
H., "Cryptographic Extraction and Key Derivation: The HKDF Scheme",
Proceedings of CRYPTO 2010, 2010, <http://eprint.iacr.org/2010/264>.
I'm also renaming the existing KDF, now that Tor has two of them.
This is the key derivation scheme specified in ntor.
There are also unit tests.
Diffstat (limited to 'src/common/crypto.h')
-rw-r--r-- | src/common/crypto.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/crypto.h b/src/common/crypto.h index eb8b1de163..2d31e8d8bb 100644 --- a/src/common/crypto.h +++ b/src/common/crypto.h @@ -239,8 +239,15 @@ ssize_t crypto_dh_compute_secret(int severity, crypto_dh_t *dh, const char *pubkey, size_t pubkey_len, char *secret_out, size_t secret_out_len); void crypto_dh_free(crypto_dh_t *dh); -int crypto_expand_key_material(const char *key_in, size_t in_len, - char *key_out, size_t key_out_len); + +int crypto_expand_key_material_TAP(const uint8_t *key_in, + size_t key_in_len, + uint8_t *key_out, size_t key_out_len); +int crypto_expand_key_material_rfc5869_sha256( + const uint8_t *key_in, size_t key_in_len, + const uint8_t *salt_in, size_t salt_in_len, + const uint8_t *info_in, size_t info_in_len, + uint8_t *key_out, size_t key_out_len); /* random numbers */ int crypto_seed_rng(int startup); |