Closed matt36 closed 2 years ago
The C implementation of the DRBG doesn't appear to mix in the gathered entropy, resulting in predictable output.
In the function below the entropy is collected in the local array 'seed', but this is never passed to the hasher.
static void drbg_ensure_init(void) { if (!drbg.initialized) { drbg.counter = 0; uint8_t seed[BLAKE3_KEY_LEN]; drbg_entropy(seed, BLAKE3_KEY_LEN); drbg_ratchet(); drbg.initialized = true; } }
I think a call to blake3_hasher_init_keyed() would be needed, which I think is equivalent to what the Java version is doing.
blake3_hasher_init_keyed()
Oh yeah that looks like a legit problem, oops!
The C implementation of the DRBG doesn't appear to mix in the gathered entropy, resulting in predictable output.
In the function below the entropy is collected in the local array 'seed', but this is never passed to the hasher.
I think a call to
blake3_hasher_init_keyed()
would be needed, which I think is equivalent to what the Java version is doing.