blob: 1523cc664ab5895d53b64e857040ac983e7587df [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "crypto/crypto_export.h"
#include "starboard/types.h"
namespace crypto {
// Performs a constant-time comparison of two strings, returning true if the
// strings are equal.
// For cryptographic operations, comparison functions such as memcmp() may
// expose side-channel information about input, allowing an attacker to
// perform timing analysis to determine what the expected bits should be. In
// order to avoid such attacks, the comparison must execute in constant time,
// so as to not to reveal to the attacker where the difference(s) are.
// For an example attack, see
CRYPTO_EXPORT bool SecureMemEqual(const void* s1, const void* s2, size_t n);
} // namespace crypto