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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_util.h

Issue 10069031: Replace SafeBrowsing MAC with downloads over SSL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Utilities for the SafeBrowsing code. 5 // Utilities for the SafeBrowsing code.
6 6
7 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ 7 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_
8 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ 8 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_
9 #pragma once 9 #pragma once
10 10
11 #include <cstring> 11 #include <cstring>
12 #include <deque> 12 #include <deque>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "chrome/browser/safe_browsing/chunk_range.h" 17 #include "chrome/browser/safe_browsing/chunk_range.h"
18 18
19 class GURL; 19 class GURL;
20 20
21 class SBEntry; 21 class SBEntry;
22 22
23 // A truncated hash's type. 23 // A truncated hash's type.
24 typedef int32 SBPrefix; 24 typedef int32 SBPrefix;
25 25
26 // Container for holding a chunk URL and the MAC of the contents of the URL. 26 // Container for holding a chunk URL and the list it belongs to.
27 struct ChunkUrl { 27 struct ChunkUrl {
28 std::string url; 28 std::string url;
29 std::string mac;
30 std::string list_name; 29 std::string list_name;
31 }; 30 };
32 31
33 // A full hash. 32 // A full hash.
34 union SBFullHash { 33 union SBFullHash {
35 char full_hash[32]; 34 char full_hash[32];
36 SBPrefix prefix; 35 SBPrefix prefix;
37 }; 36 };
38 37
39 inline bool operator==(const SBFullHash& lhash, const SBFullHash& rhash) { 38 inline bool operator==(const SBFullHash& lhash, const SBFullHash& rhash) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // provided full hashes. Returns the index of the match if one is found, or -1 311 // provided full hashes. Returns the index of the match if one is found, or -1
313 // otherwise. 312 // otherwise.
314 int GetUrlHashIndex(const GURL& url, 313 int GetUrlHashIndex(const GURL& url,
315 const std::vector<SBFullHashResult>& full_hashes); 314 const std::vector<SBFullHashResult>& full_hashes);
316 315
317 bool IsPhishingList(const std::string& list_name); 316 bool IsPhishingList(const std::string& list_name);
318 bool IsMalwareList(const std::string& list_name); 317 bool IsMalwareList(const std::string& list_name);
319 bool IsBadbinurlList(const std::string& list_name); 318 bool IsBadbinurlList(const std::string& list_name);
320 bool IsBadbinhashList(const std::string& list_name); 319 bool IsBadbinhashList(const std::string& list_name);
321 320
322 // Returns 'true' if 'mac' can be verified using 'key' and 'data'.
323 bool VerifyMAC(const std::string& key,
324 const std::string& mac,
325 const char* data,
326 int data_length);
327
328 GURL GeneratePhishingReportUrl(const std::string& report_page, 321 GURL GeneratePhishingReportUrl(const std::string& report_page,
329 const std::string& url_to_report, 322 const std::string& url_to_report,
330 bool is_client_side_detection); 323 bool is_client_side_detection);
331 324
332 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out); 325 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out);
333 std::string SBFullHashToString(const SBFullHash& hash_out); 326 std::string SBFullHashToString(const SBFullHash& hash_out);
334 } // namespace safe_browsing_util 327 } // namespace safe_browsing_util
335 328
336 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ 329 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_test.cc ('k') | chrome/browser/safe_browsing/safe_browsing_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698