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

Side by Side Diff: crypto/hmac.h

Issue 1870233002: Convert crypto to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 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
« no previous file with comments | « crypto/hkdf.cc ('k') | crypto/hmac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Utility class for calculating the HMAC for a given message. We currently 5 // Utility class for calculating the HMAC for a given message. We currently
6 // only support SHA1 for the hash algorithm, but this can be extended easily. 6 // only support SHA1 for the hash algorithm, but this can be extended easily.
7 7
8 #ifndef CRYPTO_HMAC_H_ 8 #ifndef CRYPTO_HMAC_H_
9 #define CRYPTO_HMAC_H_ 9 #define CRYPTO_HMAC_H_
10 10
11 #include <stddef.h> 11 #include <stddef.h>
12 12
13 #include <memory>
14
13 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
14 #include "base/macros.h" 16 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
17 #include "crypto/crypto_export.h" 18 #include "crypto/crypto_export.h"
18 19
19 namespace crypto { 20 namespace crypto {
20 21
21 // Simplify the interface and reduce includes by abstracting out the internals. 22 // Simplify the interface and reduce includes by abstracting out the internals.
22 struct HMACPlatformData; 23 struct HMACPlatformData;
23 class SymmetricKey; 24 class SymmetricKey;
24 25
25 class CRYPTO_EXPORT HMAC { 26 class CRYPTO_EXPORT HMAC {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const base::StringPiece& digest) const WARN_UNUSED_RESULT; 79 const base::StringPiece& digest) const WARN_UNUSED_RESULT;
79 80
80 // Verifies a truncated HMAC, behaving identical to Verify(), except 81 // Verifies a truncated HMAC, behaving identical to Verify(), except
81 // that |digest| is allowed to be smaller than |DigestLength()|. 82 // that |digest| is allowed to be smaller than |DigestLength()|.
82 bool VerifyTruncated( 83 bool VerifyTruncated(
83 const base::StringPiece& data, 84 const base::StringPiece& data,
84 const base::StringPiece& digest) const WARN_UNUSED_RESULT; 85 const base::StringPiece& digest) const WARN_UNUSED_RESULT;
85 86
86 private: 87 private:
87 HashAlgorithm hash_alg_; 88 HashAlgorithm hash_alg_;
88 scoped_ptr<HMACPlatformData> plat_; 89 std::unique_ptr<HMACPlatformData> plat_;
89 90
90 DISALLOW_COPY_AND_ASSIGN(HMAC); 91 DISALLOW_COPY_AND_ASSIGN(HMAC);
91 }; 92 };
92 93
93 } // namespace crypto 94 } // namespace crypto
94 95
95 #endif // CRYPTO_HMAC_H_ 96 #endif // CRYPTO_HMAC_H_
OLDNEW
« no previous file with comments | « crypto/hkdf.cc ('k') | crypto/hmac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698