OLD | NEW |
1 // Copyright (c) 2011 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/crypto/secure_hash.h" | 5 #include "crypto/secure_hash.h" |
6 | 6 |
7 #include <openssl/ssl.h> | 7 #include <openssl/ssl.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/openssl_util.h" | 11 #include "crypto/openssl_util.h" |
12 | 12 |
13 namespace base { | 13 namespace crypto { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class SecureHashSHA256OpenSSL : public SecureHash { | 17 class SecureHashSHA256OpenSSL : public SecureHash { |
18 public: | 18 public: |
19 SecureHashSHA256OpenSSL() { | 19 SecureHashSHA256OpenSSL() { |
20 SHA256_Init(&ctx_); | 20 SHA256_Init(&ctx_); |
21 } | 21 } |
22 | 22 |
23 virtual ~SecureHashSHA256OpenSSL() { | 23 virtual ~SecureHashSHA256OpenSSL() { |
(...skipping 19 matching lines...) Expand all Loading... |
43 SecureHash* SecureHash::Create(Algorithm algorithm) { | 43 SecureHash* SecureHash::Create(Algorithm algorithm) { |
44 switch (algorithm) { | 44 switch (algorithm) { |
45 case SHA256: | 45 case SHA256: |
46 return new SecureHashSHA256OpenSSL(); | 46 return new SecureHashSHA256OpenSSL(); |
47 default: | 47 default: |
48 NOTIMPLEMENTED(); | 48 NOTIMPLEMENTED(); |
49 return NULL; | 49 return NULL; |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 } // namespace base | 53 } // namespace crypto |
OLD | NEW |