|
libkeepass 0.2.0
KeePass key database importer/exporter library
|
Constant-time byte comparisons for secrets and integrity values. More...
#include <array>#include <cstddef>#include <cstdint>#include <openssl/crypto.h>Go to the source code of this file.
Functions | |
| bool | keepass::detail::constant_time_eq (const void *a, std::size_t a_size, const void *b, std::size_t b_size) noexcept |
| Compares two byte ranges in constant time. | |
| template<std::size_t N> | |
| bool | keepass::detail::constant_time_eq (const std::array< uint8_t, N > &a, const std::array< uint8_t, N > &b) noexcept |
| Compares two fixed-size byte arrays in constant time. | |
Constant-time byte comparisons for secrets and integrity values.
|
inlinenoexcept |
Compares two fixed-size byte arrays in constant time.
| a | First array. |
| b | Second array. |
|
inlinenoexcept |
Compares two byte ranges in constant time.
The comparison time does not depend on the content bytes: every pair of bytes is always visited, so an early-exit on the first differing byte cannot leak which position differs. The lengths are treated as public, so mismatched lengths return false immediately. It is safe to compare secrets (keys, derived keys) and integrity values (hashes, HMACs) with this helper.
| a | First byte range. |
| a_size | Size of the first byte range. |
| b | Second byte range. |
| b_size | Size of the second byte range. |