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

Side by Side Diff: chrome/browser/net/packed_ct_ev_whitelist.h

Issue 422063004: Certificate Transparency: Require SCTs for EV certificates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing review comments. Created 6 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_NET_PACKED_CT_EV_WHITELIST_H_ 5 #ifndef CHROME_BROWSER_NET_PACKED_CT_EV_WHITELIST_H_
6 #define CHROME_BROWSER_NET_PACKED_CT_EV_WHITELIST_H_ 6 #define CHROME_BROWSER_NET_PACKED_CT_EV_WHITELIST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 UncompressFailsForInvalidValuesInList); 53 UncompressFailsForInvalidValuesInList);
54 FRIEND_TEST_ALL_PREFIXES(PackedEVCertsWhitelistTest, 54 FRIEND_TEST_ALL_PREFIXES(PackedEVCertsWhitelistTest,
55 UncompressesWhitelistCorrectly); 55 UncompressesWhitelistCorrectly);
56 56
57 // Given a Golomb-coded list of hashes in |compressed_whitelist|, unpack into 57 // Given a Golomb-coded list of hashes in |compressed_whitelist|, unpack into
58 // |uncompressed_list|. Returns true if the format of the compressed whitelist 58 // |uncompressed_list|. Returns true if the format of the compressed whitelist
59 // is valid, false otherwise. 59 // is valid, false otherwise.
60 static bool UncompressEVWhitelist(const std::string& compressed_whitelist, 60 static bool UncompressEVWhitelist(const std::string& compressed_whitelist,
61 std::vector<uint64_t>* uncompressed_list); 61 std::vector<uint64_t>* uncompressed_list);
62 62
63 bool is_whitelist_valid_;
64
63 // The whitelist is an array containing certificate hashes (truncated 65 // The whitelist is an array containing certificate hashes (truncated
64 // to a fixed size of 8 bytes), sorted. 66 // to a fixed size of 8 bytes), sorted.
65 // Binary search is used to locate hashes in the the array. 67 // Binary search is used to locate hashes in the the array.
66 // Benchmarking bsearch vs std::set (with 120K entries, doing 1.2M lookups) 68 // Benchmarking bsearch vs std::set (with 120K entries, doing 1.2M lookups)
67 // shows that bsearch is about twice as fast as std::set lookups (and std::set 69 // shows that bsearch is about twice as fast as std::set lookups (and std::set
68 // has additional memory overhead). 70 // has additional memory overhead).
69 std::vector<uint64_t> whitelist_; 71 std::vector<uint64_t> whitelist_;
70 72
71 DISALLOW_COPY_AND_ASSIGN(PackedEVCertsWhitelist); 73 DISALLOW_COPY_AND_ASSIGN(PackedEVCertsWhitelist);
72 }; 74 };
73 75
74 // Sets the EV certificate hashes whitelist from |compressed_whitelist_file| 76 // Sets the EV certificate hashes whitelist from |compressed_whitelist_file|
75 // in |ssl_config_service|, after uncompressing it. 77 // in |ssl_config_service|, after uncompressing it.
76 // If the data in |compressed_whitelist_file| is not a valid compressed 78 // If the data in |compressed_whitelist_file| is not a valid compressed
77 // whitelist, does nothing. 79 // whitelist, does nothing.
78 // As this function performs file operations, it should be called from a 80 // As this function performs file operations, it should be called from a
79 // blocking pool worker or a file worker. 81 // blocking pool worker or a file worker.
80 // To set the new whitelist, this function dispatches a task to the IO thread. 82 // To set the new whitelist, this function dispatches a task to the IO thread.
81 void SetEVWhitelistFromFile(const base::FilePath& compressed_whitelist_file); 83 void SetEVWhitelistFromFile(const base::FilePath& compressed_whitelist_file);
82 84
83 #endif // CHROME_BROWSER_NET_PACKED_CT_EV_WHITELIST_H_ 85 #endif // CHROME_BROWSER_NET_PACKED_CT_EV_WHITELIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698