0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00

add OpenVPNStaticKey::XOR() function

Allows to XOR (^) the key with the contents of another one.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
This commit is contained in:
Heiko Hund 2023-01-25 09:49:13 +01:00 committed by Frank Lichtenheld
parent 3bcb671d33
commit b91e138106

View File

@ -126,6 +126,14 @@ class OpenVPNStaticKey
return key_data_.defined();
}
void XOR(const OpenVPNStaticKey &other)
{
assert(defined() && other.defined());
for (std::size_t i = 0; i < key_data_.size(); ++i)
key_data_[i] ^= other.key_data_[i];
}
StaticKey slice(unsigned int key_specifier) const
{
if (key_data_.size() != KEY_SIZE)