Only support 32-byte keys in ChaCha20{,Aligned}

This commit is contained in:
Pieter Wuille
2022-09-21 17:39:48 -04:00
parent f21994a02e
commit 62ec713961
9 changed files with 46 additions and 53 deletions

View File

@@ -599,7 +599,7 @@ uint256 GetRandHash() noexcept
void FastRandomContext::RandomSeed()
{
uint256 seed = GetRandHash();
rng.SetKey(seed.begin(), 32);
rng.SetKey32(seed.begin());
requires_seed = false;
}
@@ -623,7 +623,7 @@ std::vector<unsigned char> FastRandomContext::randbytes(size_t len)
FastRandomContext::FastRandomContext(const uint256& seed) noexcept : requires_seed(false), bitbuf_size(0)
{
rng.SetKey(seed.begin(), 32);
rng.SetKey32(seed.begin());
}
bool Random_SanityCheck()
@@ -678,7 +678,7 @@ FastRandomContext::FastRandomContext(bool fDeterministic) noexcept : requires_se
return;
}
uint256 seed;
rng.SetKey(seed.begin(), 32);
rng.SetKey32(seed.begin());
}
FastRandomContext& FastRandomContext::operator=(FastRandomContext&& from) noexcept