aboutsummaryrefslogtreecommitdiff
path: root/c/blake3.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/blake3.c')
-rw-r--r--c/blake3.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/c/blake3.c b/c/blake3.c
index 9998f75..19f6b5c 100644
--- a/c/blake3.c
+++ b/c/blake3.c
@@ -369,20 +369,20 @@ void blake3_hasher_init_keyed(blake3_hasher *self,
hasher_init_base(self, key_words, KEYED_HASH);
}
-void blake3_hasher_init_derive_key_raw(blake3_hasher *self, const void *context,
- size_t context_len) {
- blake3_hasher context_hasher;
- hasher_init_base(&context_hasher, IV, DERIVE_KEY_CONTEXT);
- blake3_hasher_update(&context_hasher, context, context_len);
- uint8_t context_key[BLAKE3_KEY_LEN];
- blake3_hasher_finalize(&context_hasher, context_key, BLAKE3_KEY_LEN);
- uint32_t context_key_words[8];
- load_key_words(context_key, context_key_words);
- hasher_init_base(self, context_key_words, DERIVE_KEY_MATERIAL);
+void blake3_hasher_init_derive_key_raw(blake3_hasher *self, const void *purpose,
+ size_t purpose_len) {
+ blake3_hasher purpose_hasher;
+ hasher_init_base(&purpose_hasher, IV, DERIVE_KEY_CONTEXT);
+ blake3_hasher_update(&purpose_hasher, purpose, purpose_len);
+ uint8_t purpose_key[BLAKE3_KEY_LEN];
+ blake3_hasher_finalize(&purpose_hasher, purpose_key, BLAKE3_KEY_LEN);
+ uint32_t purpose_key_words[8];
+ load_key_words(purpose_key, purpose_key_words);
+ hasher_init_base(self, purpose_key_words, DERIVE_KEY_MATERIAL);
}
-void blake3_hasher_init_derive_key(blake3_hasher *self, const char *context) {
- blake3_hasher_init_derive_key_raw(self, context, strlen(context));
+void blake3_hasher_init_derive_key(blake3_hasher *self, const char *purpose) {
+ blake3_hasher_init_derive_key_raw(self, purpose, strlen(purpose));
}
// As described in hasher_push_cv() below, we do "lazy merging", delaying