OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 BASE_CRYPTO_SIGNATURE_CREATOR_H_ | 5 #ifndef BASE_CRYPTO_SIGNATURE_CREATOR_H_ |
6 #define BASE_CRYPTO_SIGNATURE_CREATOR_H_ | 6 #define BASE_CRYPTO_SIGNATURE_CREATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #if defined(USE_NSS) | 11 #if defined(USE_OPENSSL) |
| 12 // Forward declaration for openssl/*.h |
| 13 typedef struct env_md_ctx_st EVP_MD_CTX; |
| 14 #elif defined(USE_NSS) |
12 // Forward declaration. | 15 // Forward declaration. |
13 struct SGNContextStr; | 16 struct SGNContextStr; |
14 #elif defined(OS_MACOSX) | 17 #elif defined(OS_MACOSX) |
15 #include <Security/cssm.h> | 18 #include <Security/cssm.h> |
16 #endif | 19 #endif |
17 | 20 |
18 #include <vector> | 21 #include <vector> |
19 | 22 |
20 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
21 #include "base/crypto/rsa_private_key.h" | 24 #include "base/crypto/rsa_private_key.h" |
(...skipping 19 matching lines...) Loading... |
41 | 44 |
42 // Finalize the signature. | 45 // Finalize the signature. |
43 bool Final(std::vector<uint8>* signature); | 46 bool Final(std::vector<uint8>* signature); |
44 | 47 |
45 private: | 48 private: |
46 // Private constructor. Use the Create() method instead. | 49 // Private constructor. Use the Create() method instead. |
47 SignatureCreator(); | 50 SignatureCreator(); |
48 | 51 |
49 RSAPrivateKey* key_; | 52 RSAPrivateKey* key_; |
50 | 53 |
51 #if defined(USE_NSS) | 54 #if defined(USE_OPENSSL) |
| 55 EVP_MD_CTX* sign_context_; |
| 56 #elif defined(USE_NSS) |
52 SGNContextStr* sign_context_; | 57 SGNContextStr* sign_context_; |
53 #elif defined(OS_MACOSX) | 58 #elif defined(OS_MACOSX) |
54 CSSM_CC_HANDLE sig_handle_; | 59 CSSM_CC_HANDLE sig_handle_; |
55 #elif defined(OS_WIN) | 60 #elif defined(OS_WIN) |
56 ScopedHCRYPTHASH hash_object_; | 61 ScopedHCRYPTHASH hash_object_; |
57 #endif | 62 #endif |
58 | 63 |
59 DISALLOW_COPY_AND_ASSIGN(SignatureCreator); | 64 DISALLOW_COPY_AND_ASSIGN(SignatureCreator); |
60 }; | 65 }; |
61 | 66 |
62 } // namespace base | 67 } // namespace base |
63 | 68 |
64 #endif // BASE_CRYPTO_SIGNATURE_CREATOR_H_ | 69 #endif // BASE_CRYPTO_SIGNATURE_CREATOR_H_ |
OLD | NEW |