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

Side by Side Diff: crypto/secure_hash.h

Issue 2080753002: crypto: Add BoringSSL accelerated version of SHA-1 Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/crypto.gypi ('k') | crypto/secure_hash.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 #ifndef CRYPTO_SECURE_HASH_H_ 5 #ifndef CRYPTO_SECURE_HASH_H_
6 #define CRYPTO_SECURE_HASH_H_ 6 #define CRYPTO_SECURE_HASH_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "crypto/crypto_export.h" 11 #include "crypto/crypto_export.h"
12 12
13 namespace crypto { 13 namespace crypto {
14 14
15 // A wrapper to calculate secure hashes incrementally, allowing to 15 // A wrapper to calculate secure hashes incrementally, allowing to
16 // be used when the full input is not known in advance. 16 // be used when the full input is not known in advance.
17 class CRYPTO_EXPORT SecureHash { 17 class CRYPTO_EXPORT SecureHash {
18 public: 18 public:
19 enum Algorithm { 19 enum Algorithm {
20 SHA1,
20 SHA256, 21 SHA256,
21 }; 22 };
22 virtual ~SecureHash() {} 23 virtual ~SecureHash() {}
23 24
24 static SecureHash* Create(Algorithm type); 25 static SecureHash* Create(Algorithm type);
25 26
26 virtual void Update(const void* input, size_t len) = 0; 27 virtual void Update(const void* input, size_t len) = 0;
27 virtual void Finish(void* output, size_t len) = 0; 28 virtual void Finish(void* output, size_t len) = 0;
28 virtual size_t GetHashLength() const = 0; 29 virtual size_t GetHashLength() const = 0;
29 30
30 // Create a clone of this SecureHash. The returned clone and this both 31 // Create a clone of this SecureHash. The returned clone and this both
31 // represent the same hash state. But from this point on, calling 32 // represent the same hash state. But from this point on, calling
32 // Update()/Finish() on either doesn't affect the state of the other. 33 // Update()/Finish() on either doesn't affect the state of the other.
33 virtual SecureHash* Clone() const = 0; 34 virtual SecureHash* Clone() const = 0;
34 35
35 protected: 36 protected:
36 SecureHash() {} 37 SecureHash() {}
37 38
38 private: 39 private:
39 DISALLOW_COPY_AND_ASSIGN(SecureHash); 40 DISALLOW_COPY_AND_ASSIGN(SecureHash);
40 }; 41 };
41 42
42 } // namespace crypto 43 } // namespace crypto
43 44
44 #endif // CRYPTO_SECURE_HASH_H_ 45 #endif // CRYPTO_SECURE_HASH_H_
OLDNEW
« no previous file with comments | « crypto/crypto.gypi ('k') | crypto/secure_hash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698