Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: net/http/transport_security_state_static_fuzzer.cc

Issue 2582323004: Migrate static transport security state fuzzer to LibFuzzer. (Closed)
Patch Set: Add a dictionary. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/transport_security_state.h ('k') | net/http/transport_security_state_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <string>
6
7 #include "net/http/transport_security_state.h"
8
9 namespace net {
10
11 class TransportSecurityStateStaticFuzzer {
12 public:
13 bool FuzzStaticDomainState(TransportSecurityState* state,
14 const std::string& input) {
15 state->enable_static_pins_ = true;
16 TransportSecurityState::STSState sts_result;
17 TransportSecurityState::PKPState pkp_result;
18 return state->GetStaticDomainState(input, &sts_result, &pkp_result);
19 }
20
21 bool FuzzStaticExpectCTState(TransportSecurityState* state,
22 const std::string& input) {
23 state->enable_static_expect_ct_ = true;
24 TransportSecurityState::ExpectCTState result;
25 return state->GetStaticExpectCTState(input, &result);
26 }
27
28 bool FuzzStaticExpectStapleState(TransportSecurityState* state,
29 const std::string& input) {
30 state->enable_static_expect_staple_ = true;
31 TransportSecurityState::ExpectStapleState result;
32 return state->GetStaticExpectStapleState(input, &result);
33 }
34 };
35
36 } // namespace net
37
38 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
39 std::string input(data, data + size);
Ryan Sleevi 2016/12/29 00:16:51 This doesn't give casting errors? uint8_t* is a di
martijnc 2016/12/29 00:30:11 You're right. Done. I noticed the Linux compiler
40
41 net::TransportSecurityStateStaticFuzzer helper;
42 net::TransportSecurityState state;
43
44 helper.FuzzStaticDomainState(&state, input);
45 helper.FuzzStaticExpectCTState(&state, input);
46 helper.FuzzStaticExpectStapleState(&state, input);
47
48 return 0;
49 }
OLDNEW
« no previous file with comments | « net/http/transport_security_state.h ('k') | net/http/transport_security_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698