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

Side by Side Diff: crypto/hmac_mac.cc

Issue 6805019: Move crypto files out of base, to a top level directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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) 2010 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 #include "base/hmac.h" 5 #include "crypto/hmac.h"
6 6
7 #include <CommonCrypto/CommonHMAC.h> 7 #include <CommonCrypto/CommonHMAC.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace base { 11 namespace crypto {
12 12
13 struct HMACPlatformData { 13 struct HMACPlatformData {
14 std::string key_; 14 std::string key_;
15 }; 15 };
16 16
17 HMAC::HMAC(HashAlgorithm hash_alg) 17 HMAC::HMAC(HashAlgorithm hash_alg)
18 : hash_alg_(hash_alg), plat_(new HMACPlatformData()) { 18 : hash_alg_(hash_alg), plat_(new HMACPlatformData()) {
19 // Only SHA-1 and SHA-256 hash algorithms are supported now. 19 // Only SHA-1 and SHA-256 hash algorithms are supported now.
20 DCHECK(hash_alg_ == SHA1 || hash_alg_ == SHA256); 20 DCHECK(hash_alg_ == SHA1 || hash_alg_ == SHA256);
21 } 21 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return false; 63 return false;
64 } 64 }
65 65
66 CCHmac(algorithm, 66 CCHmac(algorithm,
67 plat_->key_.data(), plat_->key_.length(), data.data(), data.length(), 67 plat_->key_.data(), plat_->key_.length(), data.data(), data.length(),
68 digest); 68 digest);
69 69
70 return true; 70 return true;
71 } 71 }
72 72
73 } // namespace base 73 } // namespace crypto
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698