Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 #include <iostream> | |
|
Ryan Sleevi
2016/12/29 00:35:38
This wasn't necessary, was it?
If so, line break
martijnc
2016/12/29 00:39:32
Yes, sorry, forgot to remove it again.
| |
| 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(reinterpret_cast<const char*>(data), size); | |
| 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 } | |
| OLD | NEW |