Commit 9d3b180a authored by Vasilii Sukhanov's avatar Vasilii Sukhanov Committed by Commit Bot

[Passwords] Add Fuzzer for Leak Detection

This change adds a simple fuzzer for CipherEncrypt() used in the Leak
Detection feature.

Bug: 986298
Change-Id: I4878b1bf04a0edc4341c7c2997e443207120d6d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1763756
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689510}
parent 351da3a5
......@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/jumbo.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni")
fuzzable_proto_library("proto") {
......@@ -95,3 +96,12 @@ jumbo_source_set("unit_tests") {
"//third_party/private-join-and-compute/src:ec_commutative_cipher",
]
}
fuzzer_test("encryption_utils_fuzzer") {
sources = [
"cipher_encrypt_fuzzer.cc",
]
deps = [
":leak_detection",
]
}
// Copyright 2019 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 <stddef.h>
#include <stdint.h>
#include <string>
#include "components/password_manager/core/browser/leak_detection/encryption_utils.h"
namespace password_manager {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
std::string payload(reinterpret_cast<const char*>(data), size);
std::string key;
std::string cipher = password_manager::CipherEncrypt(payload, &key);
return 0;
}
} // namespace password_manager
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment