mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
crypto: make ChaCha20::SetKey wipe buffer
This commit is contained in:
parent
da0ec62e34
commit
57cc136282
2 changed files with 8 additions and 5 deletions
|
@ -335,6 +335,13 @@ ChaCha20::~ChaCha20()
|
|||
memory_cleanse(m_buffer.data(), m_buffer.size());
|
||||
}
|
||||
|
||||
void ChaCha20::SetKey(Span<const std::byte> key) noexcept
|
||||
{
|
||||
m_aligned.SetKey(key);
|
||||
m_bufleft = 0;
|
||||
memory_cleanse(m_buffer.data(), m_buffer.size());
|
||||
}
|
||||
|
||||
FSChaCha20::FSChaCha20(Span<const std::byte> key, uint32_t rekey_interval) noexcept :
|
||||
m_chacha20(key), m_rekey_interval(rekey_interval)
|
||||
{
|
||||
|
|
|
@ -95,11 +95,7 @@ public:
|
|||
~ChaCha20();
|
||||
|
||||
/** Set 32-byte key, and seek to nonce 0 and block position 0. */
|
||||
void SetKey(Span<const std::byte> key) noexcept
|
||||
{
|
||||
m_aligned.SetKey(key);
|
||||
m_bufleft = 0;
|
||||
}
|
||||
void SetKey(Span<const std::byte> key) noexcept;
|
||||
|
||||
/** 96-bit nonce type. */
|
||||
using Nonce96 = ChaCha20Aligned::Nonce96;
|
||||
|
|
Loading…
Add table
Reference in a new issue