lua-record.cc \
minicurl.cc \
minicurl.hh \
+ string_compare.hh \
api-swagger.yaml \
api-swagger.json \
requirements.txt \
kqueuemplexer.cc \
portsmplexer.cc \
cdb.cc cdb.hh \
+ string_compare.hh \
ext/lmdb-safe/lmdb-safe.cc ext/lmdb-safe/lmdb-safe.hh \
ext/protozero/include/* \
builder-support/gen-version
--- /dev/null
+../string_compare.hh
\ No newline at end of file
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
#include "ednscookies.hh"
#include "misc.hh"
+#include "string_compare.hh"
#ifdef HAVE_CRYPTO_SHORTHASH
#include <sodium.h>
reinterpret_cast<const unsigned char*>(&toHash[0]),
toHash.length(),
reinterpret_cast<const unsigned char*>(&secret[0]));
- return server.substr(8) == hashResult;
+ return constantTimeStringEquals(server.substr(8), hashResult);
#else
return false;
#endif
mtasker_fcontext.cc mtasker_ucontext.cc \
NOTICE \
opensslsigners.hh opensslsigners.cc \
+ string_compare.hh \
portsmplexer.cc \
dnstap.proto dnstap.cc dnstap.hh fstrm_logger.cc fstrm_logger.hh \
ext/protozero/include/* \
--- /dev/null
+../string_compare.hh
\ No newline at end of file
#ifdef HAVE_CRYPTO_MEMCMP
return CRYPTO_memcmp(a.c_str(), b.c_str(), size) == 0;
#else
- const volatile unsigned char *_a = (const volatile unsigned char *) a.c_str();
- const volatile unsigned char *_b = (const volatile unsigned char *) b.c_str();
+ const volatile unsigned char* _a = (const volatile unsigned char*)a.c_str();
+ const volatile unsigned char* _b = (const volatile unsigned char*)b.c_str();
unsigned char res = 0;
for (size_t idx = 0; idx < size; idx++) {
return res == 0;
#endif
}
-