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

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

Issue 2960: Enable safe browsing tests exercising VerifyMAC.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 12 years, 3 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/safe_browsing/safe_browsing_util.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
6 6
7 #include "base/hmac.h" 7 #include "base/hmac.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/sha2.h" 9 #include "base/sha2.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 break; 130 break;
131 case '-': 131 case '-':
132 (*decoded)[i] = '+'; 132 (*decoded)[i] = '+';
133 break; 133 break;
134 } 134 }
135 } 135 }
136 } 136 }
137 137
138 bool VerifyMAC(const std::string& key, const std::string& mac, 138 bool VerifyMAC(const std::string& key, const std::string& mac,
139 const char* data, int data_length) { 139 const char* data, int data_length) {
140 #if !defined(OS_WIN)
141 // TODO(port): Remove #defines when linking issue with modp_b64 is resolved.
142 NOTIMPLEMENTED();
143 return false;
144 #endif
145 std::string key_copy = key; 140 std::string key_copy = key;
146 DecodeWebSafe(&key_copy); 141 DecodeWebSafe(&key_copy);
147 std::string decoded_key; 142 std::string decoded_key;
148 net::Base64Decode(key_copy, &decoded_key); 143 net::Base64Decode(key_copy, &decoded_key);
149 144
150 std::string mac_copy = mac; 145 std::string mac_copy = mac;
151 DecodeWebSafe(&mac_copy); 146 DecodeWebSafe(&mac_copy);
152 std::string decoded_mac; 147 std::string decoded_mac;
153 net::Base64Decode(mac_copy, &decoded_mac); 148 net::Base64Decode(mac_copy, &decoded_mac);
154 149
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // Validate that the next entry is wholly contained inside of |data_|. 609 // Validate that the next entry is wholly contained inside of |data_|.
615 const char* end = data_.get() + size_; 610 const char* end = data_.get() + size_;
616 if (next + SBEntry::kMinSize <= end && next + next_entry->Size() <= end) { 611 if (next + SBEntry::kMinSize <= end && next + next_entry->Size() <= end) {
617 *entry = next_entry; 612 *entry = next_entry;
618 return true; 613 return true;
619 } 614 }
620 615
621 return false; 616 return false;
622 } 617 }
623 618
OLDNEW
« chrome/SConscript.unit_tests ('K') | « chrome/browser/safe_browsing/protocol_parser_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698