Rename CRYPTO_API to CRYPTO_EXPORT.
R=rvargas@chromium.org Review URL: http://codereview.chromium.org/7491061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95652 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
namespace crypto {
|
||||
|
||||
@ -23,11 +23,11 @@ namespace crypto {
|
||||
// "The CryptAcquireContext function is generally thread safe unless
|
||||
// CRYPT_NEWKEYSET or CRYPT_DELETEKEYSET is specified in the dwFlags
|
||||
// parameter."
|
||||
CRYPTO_API BOOL CryptAcquireContextLocked(HCRYPTPROV* prov,
|
||||
LPCWSTR container,
|
||||
LPCWSTR provider,
|
||||
DWORD prov_type,
|
||||
DWORD flags);
|
||||
CRYPTO_EXPORT BOOL CryptAcquireContextLocked(HCRYPTPROV* prov,
|
||||
LPCWSTR container,
|
||||
LPCWSTR provider,
|
||||
DWORD prov_type,
|
||||
DWORD flags);
|
||||
|
||||
} // namespace crypto
|
||||
|
||||
|
@ -113,7 +113,7 @@
|
||||
'sources': [
|
||||
'capi_util.cc',
|
||||
'capi_util.h',
|
||||
'crypto_api.h',
|
||||
'crypto_export.h',
|
||||
'crypto_module_blocking_password_delegate.h',
|
||||
'cssm_init.cc',
|
||||
'cssm_init.h',
|
||||
|
@ -2,25 +2,25 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CRYPTO_CRYPTO_API_H_
|
||||
#define CRYPTO_CRYPTO_API_H_
|
||||
#ifndef CRYPTO_CRYPTO_EXPORT_H_
|
||||
#define CRYPTO_CRYPTO_EXPORT_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(COMPONENT_BUILD)
|
||||
#if defined(WIN32)
|
||||
|
||||
#if defined(CRYPTO_IMPLEMENTATION)
|
||||
#define CRYPTO_API __declspec(dllexport)
|
||||
#define CRYPTO_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define CRYPTO_API __declspec(dllimport)
|
||||
#define CRYPTO_EXPORT __declspec(dllimport)
|
||||
#endif // defined(CRYPTO_IMPLEMENTATION)
|
||||
|
||||
#else // defined(WIN32)
|
||||
#define CRYPTO_API __attribute__((visibility("default")))
|
||||
#define CRYPTO_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#else // defined(COMPONENT_BUILD)
|
||||
#define CRYPTO_API
|
||||
#define CRYPTO_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // CRYPTO_CRYPTO_API_H_
|
||||
#endif // CRYPTO_CRYPTO_EXPORT_H_
|
@ -9,33 +9,33 @@
|
||||
#include <Security/cssm.h>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
namespace crypto {
|
||||
|
||||
// Initialize CSSM if it isn't already initialized. This must be called before
|
||||
// any other CSSM functions. This function is thread-safe, and CSSM will only
|
||||
// ever be initialized once. CSSM will be properly shut down on program exit.
|
||||
CRYPTO_API void EnsureCSSMInit();
|
||||
CRYPTO_EXPORT void EnsureCSSMInit();
|
||||
|
||||
// Returns the shared CSP handle used by CSSM functions.
|
||||
CSSM_CSP_HANDLE GetSharedCSPHandle();
|
||||
|
||||
// Returns the shared CL handle used by CSSM functions.
|
||||
CRYPTO_API CSSM_CL_HANDLE GetSharedCLHandle();
|
||||
CRYPTO_EXPORT CSSM_CL_HANDLE GetSharedCLHandle();
|
||||
|
||||
// Returns the shared TP handle used by CSSM functions.
|
||||
CRYPTO_API CSSM_TP_HANDLE GetSharedTPHandle();
|
||||
CRYPTO_EXPORT CSSM_TP_HANDLE GetSharedTPHandle();
|
||||
|
||||
// Set of pointers to memory function wrappers that are required for CSSM
|
||||
extern const CSSM_API_MEMORY_FUNCS kCssmMemoryFunctions;
|
||||
|
||||
// Utility function to log an error message including the error name.
|
||||
CRYPTO_API void LogCSSMError(const char *function_name, CSSM_RETURN err);
|
||||
CRYPTO_EXPORT void LogCSSMError(const char *function_name, CSSM_RETURN err);
|
||||
|
||||
// Utility functions to allocate and release CSSM memory.
|
||||
void* CSSMMalloc(CSSM_SIZE size);
|
||||
CRYPTO_API void CSSMFree(void* ptr);
|
||||
CRYPTO_EXPORT void CSSMFree(void* ptr);
|
||||
|
||||
// Wrapper class for CSSM_DATA type. This should only be used when using the
|
||||
// CL/TP/CSP handles from above, since that's the only time we're guaranteed (or
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/string_piece.h"
|
||||
#include "build/build_config.h"
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
#if defined(USE_NSS)
|
||||
#include "crypto/scoped_nss_types.h"
|
||||
@ -24,7 +24,7 @@ namespace crypto {
|
||||
|
||||
class SymmetricKey;
|
||||
|
||||
class CRYPTO_API Encryptor {
|
||||
class CRYPTO_EXPORT Encryptor {
|
||||
public:
|
||||
enum Mode {
|
||||
CBC,
|
||||
|
@ -13,14 +13,14 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/string_piece.h"
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
namespace crypto {
|
||||
|
||||
// Simplify the interface and reduce includes by abstracting out the internals.
|
||||
struct HMACPlatformData;
|
||||
|
||||
class CRYPTO_API HMAC {
|
||||
class CRYPTO_EXPORT HMAC {
|
||||
public:
|
||||
// The set of supported hash functions. Extend as required.
|
||||
enum HashAlgorithm {
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define CRYPTO_MAC_SECURITY_SERVICES_LOCK_H_
|
||||
#pragma once
|
||||
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
namespace base {
|
||||
class Lock;
|
||||
@ -20,7 +20,7 @@ namespace crypto {
|
||||
// problematic.
|
||||
//
|
||||
// http://developer.apple.com/mac/library/documentation/Security/Reference/certifkeytrustservices/Reference/reference.html
|
||||
CRYPTO_API base::Lock& GetMacSecurityServicesLock();
|
||||
CRYPTO_EXPORT base::Lock& GetMacSecurityServicesLock();
|
||||
|
||||
} // namespace crypto
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <string>
|
||||
#include "base/basictypes.h"
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
#if defined(USE_NSS)
|
||||
class FilePath;
|
||||
@ -28,17 +28,17 @@ namespace crypto {
|
||||
// EarlySetupForNSSInit performs lightweight setup which must occur before the
|
||||
// process goes multithreaded. This does not initialise NSS. For test, see
|
||||
// EnsureNSSInit.
|
||||
CRYPTO_API void EarlySetupForNSSInit();
|
||||
CRYPTO_EXPORT void EarlySetupForNSSInit();
|
||||
#endif
|
||||
|
||||
// Initialize NRPR if it isn't already initialized. This function is
|
||||
// thread-safe, and NSPR will only ever be initialized once.
|
||||
void CRYPTO_API EnsureNSPRInit();
|
||||
CRYPTO_EXPORT void EnsureNSPRInit();
|
||||
|
||||
// Initialize NSS if it isn't already initialized. This must be called before
|
||||
// any other NSS functions. This function is thread-safe, and NSS will only
|
||||
// ever be initialized once.
|
||||
void CRYPTO_API EnsureNSSInit();
|
||||
CRYPTO_EXPORT void EnsureNSSInit();
|
||||
|
||||
// Call this before calling EnsureNSSInit() will force NSS to initialize
|
||||
// without a persistent DB. This is used for the special case where access of
|
||||
@ -55,7 +55,7 @@ void CRYPTO_API EnsureNSSInit();
|
||||
// Calling this method only has effect on Linux.
|
||||
//
|
||||
// WARNING: Use this with caution.
|
||||
CRYPTO_API void ForceNSSNoDBInit();
|
||||
CRYPTO_EXPORT void ForceNSSNoDBInit();
|
||||
|
||||
// This methods is used to disable checks in NSS when used in a forked process.
|
||||
// NSS checks whether it is running a forked process to avoid problems when
|
||||
@ -66,7 +66,7 @@ CRYPTO_API void ForceNSSNoDBInit();
|
||||
// This method must be called before EnsureNSSInit() to take effect.
|
||||
//
|
||||
// WARNING: Use this with caution.
|
||||
CRYPTO_API void DisableNSSForkCheck();
|
||||
CRYPTO_EXPORT void DisableNSSForkCheck();
|
||||
|
||||
// Load NSS library files. This function has no effect on Mac and Windows.
|
||||
// This loads the necessary NSS library files so that NSS can be initialized
|
||||
@ -75,7 +75,7 @@ CRYPTO_API void DisableNSSForkCheck();
|
||||
//
|
||||
// Note that this does not load libnssckbi.so which contains the root
|
||||
// certificates.
|
||||
CRYPTO_API void LoadNSSLibraries();
|
||||
CRYPTO_EXPORT void LoadNSSLibraries();
|
||||
|
||||
// Check if the current NSS version is greater than or equals to |version|.
|
||||
// A sample version string is "3.12.3".
|
||||
@ -85,11 +85,11 @@ bool CheckNSSVersion(const char* version);
|
||||
// Open the r/w nssdb that's stored inside the user's encrypted home
|
||||
// directory. This is the default slot returned by
|
||||
// GetPublicNSSKeySlot().
|
||||
CRYPTO_API void OpenPersistentNSSDB();
|
||||
CRYPTO_EXPORT void OpenPersistentNSSDB();
|
||||
|
||||
// A delegate class that we can use to access the cros API for
|
||||
// communication with cryptohomed and the TPM.
|
||||
class CRYPTO_API TPMTokenInfoDelegate {
|
||||
class CRYPTO_EXPORT TPMTokenInfoDelegate {
|
||||
public:
|
||||
TPMTokenInfoDelegate();
|
||||
virtual ~TPMTokenInfoDelegate();
|
||||
@ -113,37 +113,38 @@ class CRYPTO_API TPMTokenInfoDelegate {
|
||||
// GetPrivateNSSKeySlot() will return the TPM slot if one was found.
|
||||
// Takes ownership of the passed-in delegate object so it can access
|
||||
// the cros library to talk to cryptohomed.
|
||||
CRYPTO_API void EnableTPMTokenForNSS(TPMTokenInfoDelegate* delegate);
|
||||
CRYPTO_EXPORT void EnableTPMTokenForNSS(TPMTokenInfoDelegate* delegate);
|
||||
|
||||
// Get name and user PIN for the built-in TPM token on ChromeOS.
|
||||
// Either one can safely be NULL. Should only be called after
|
||||
// EnableTPMTokenForNSS has been called with a non-null delegate.
|
||||
CRYPTO_API void GetTPMTokenInfo(std::string* token_name, std::string* user_pin);
|
||||
CRYPTO_EXPORT void GetTPMTokenInfo(std::string* token_name,
|
||||
std::string* user_pin);
|
||||
|
||||
// Returns true if the machine has a TPM and it can be used to store tokens.
|
||||
CRYPTO_API bool IsTPMTokenAvailable();
|
||||
CRYPTO_EXPORT bool IsTPMTokenAvailable();
|
||||
|
||||
// Returns true if the TPM is owned and PKCS#11 initialized with the
|
||||
// user and security officer PINs, and has been enabled in NSS by
|
||||
// calling EnableTPMForNSS, and opencryptoki has been successfully
|
||||
// loaded into NSS.
|
||||
CRYPTO_API bool IsTPMTokenReady();
|
||||
CRYPTO_EXPORT bool IsTPMTokenReady();
|
||||
|
||||
// Same as IsTPMTokenReady() except this attempts to initialize the token
|
||||
// if necessary.
|
||||
CRYPTO_API bool EnsureTPMTokenReady();
|
||||
CRYPTO_EXPORT bool EnsureTPMTokenReady();
|
||||
#endif
|
||||
|
||||
// Convert a NSS PRTime value into a base::Time object.
|
||||
// We use a int64 instead of PRTime here to avoid depending on NSPR headers.
|
||||
CRYPTO_API base::Time PRTimeToBaseTime(int64 prtime);
|
||||
CRYPTO_EXPORT base::Time PRTimeToBaseTime(int64 prtime);
|
||||
|
||||
#if defined(USE_NSS)
|
||||
// Exposed for unittests only. |path| should be an existing directory under
|
||||
// which the DB files will be placed. |description| is a user-visible name for
|
||||
// the DB, as a utf8 string, which will be truncated at 32 bytes.
|
||||
CRYPTO_API bool OpenTestNSSDB(const FilePath& path, const char* description);
|
||||
CRYPTO_API void CloseTestNSSDB();
|
||||
CRYPTO_EXPORT bool OpenTestNSSDB(const FilePath& path, const char* description);
|
||||
CRYPTO_EXPORT void CloseTestNSSDB();
|
||||
|
||||
// NSS has a bug which can cause a deadlock or stall in some cases when writing
|
||||
// to the certDB and keyDB. It also has a bug which causes concurrent key pair
|
||||
@ -157,7 +158,7 @@ base::Lock* GetNSSWriteLock();
|
||||
|
||||
// A helper class that acquires the NSS write Lock while the AutoNSSWriteLock
|
||||
// is in scope.
|
||||
class CRYPTO_API AutoNSSWriteLock {
|
||||
class CRYPTO_EXPORT AutoNSSWriteLock {
|
||||
public:
|
||||
AutoNSSWriteLock();
|
||||
~AutoNSSWriteLock();
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <secmodt.h>
|
||||
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
// These functions return a type defined in an NSS header, and so cannot be
|
||||
// declared in nss_util.h. Hence, they are declared here.
|
||||
@ -18,14 +18,14 @@ namespace crypto {
|
||||
// Returns a reference to the default NSS key slot for storing
|
||||
// public-key data only (e.g. server certs). Caller must release
|
||||
// returned reference with PK11_FreeSlot.
|
||||
CRYPTO_API PK11SlotInfo* GetPublicNSSKeySlot();
|
||||
CRYPTO_EXPORT PK11SlotInfo* GetPublicNSSKeySlot();
|
||||
|
||||
// Returns a reference to the default slot for storing private-key and
|
||||
// mixed private-key/public-key data. Returns a hardware (TPM) NSS
|
||||
// key slot if on ChromeOS and EnableTPMForNSS() has been called
|
||||
// successfully. Caller must release returned reference with
|
||||
// PK11_FreeSlot.
|
||||
CRYPTO_API PK11SlotInfo* GetPrivateNSSKeySlot();
|
||||
CRYPTO_EXPORT PK11SlotInfo* GetPrivateNSSKeySlot();
|
||||
|
||||
// A helper class that acquires the SECMOD list read lock while the
|
||||
// AutoSECMODListReadLock is in scope.
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/string_piece.h"
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
namespace crypto {
|
||||
|
||||
@ -20,7 +20,7 @@ namespace crypto {
|
||||
//
|
||||
// Likewise, the output of this can be decrypted on the command line with:
|
||||
// gpg < input
|
||||
class CRYPTO_API OpenPGPSymmetricEncrytion {
|
||||
class CRYPTO_EXPORT OpenPGPSymmetricEncrytion {
|
||||
public:
|
||||
enum Result {
|
||||
OK,
|
||||
|
@ -23,7 +23,7 @@ struct SECKEYPublicKeyStr;
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "crypto/scoped_capi_types.h"
|
||||
@ -171,7 +171,7 @@ class PrivateKeyInfoCodec {
|
||||
// Encapsulates an RSA private key. Can be used to generate new keys, export
|
||||
// keys to other formats, or to extract a public key.
|
||||
// TODO(hclam): This class should be ref-counted so it can be reused easily.
|
||||
class CRYPTO_API RSAPrivateKey {
|
||||
class CRYPTO_EXPORT RSAPrivateKey {
|
||||
public:
|
||||
~RSAPrivateKey();
|
||||
|
||||
|
@ -7,13 +7,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
namespace crypto {
|
||||
|
||||
// A wrapper to calculate secure hashes incrementally, allowing to
|
||||
// be used when the full input is not known in advance.
|
||||
class CRYPTO_API SecureHash {
|
||||
class CRYPTO_EXPORT SecureHash {
|
||||
public:
|
||||
enum Algorithm {
|
||||
SHA256,
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
namespace crypto {
|
||||
|
||||
@ -23,12 +23,12 @@ enum {
|
||||
// Computes the SHA-256 hash of the input string 'str' and stores the first
|
||||
// 'len' bytes of the hash in the output buffer 'output'. If 'len' > 32,
|
||||
// only 32 bytes (the full hash) are stored in the 'output' buffer.
|
||||
CRYPTO_API void SHA256HashString(const std::string& str,
|
||||
void* output, size_t len);
|
||||
CRYPTO_EXPORT void SHA256HashString(const std::string& str,
|
||||
void* output, size_t len);
|
||||
|
||||
// Convenience version of the above that returns the result in a 32-byte
|
||||
// string.
|
||||
CRYPTO_API std::string SHA256HashString(const std::string& str);
|
||||
CRYPTO_EXPORT std::string SHA256HashString(const std::string& str);
|
||||
|
||||
} // namespace crypto
|
||||
|
||||
|
@ -21,7 +21,7 @@ struct SGNContextStr;
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
#include "crypto/rsa_private_key.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
@ -32,7 +32,7 @@ namespace crypto {
|
||||
|
||||
// Signs data using a bare private key (as opposed to a full certificate).
|
||||
// Currently can only sign data using SHA-1 with RSA encryption.
|
||||
class CRYPTO_API SignatureCreator {
|
||||
class CRYPTO_EXPORT SignatureCreator {
|
||||
public:
|
||||
~SignatureCreator();
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "crypto/scoped_capi_types.h"
|
||||
@ -27,7 +27,7 @@ namespace crypto {
|
||||
|
||||
// The SignatureVerifier class verifies a signature using a bare public key
|
||||
// (as opposed to a certificate).
|
||||
class CRYPTO_API SignatureVerifier {
|
||||
class CRYPTO_EXPORT SignatureVerifier {
|
||||
public:
|
||||
SignatureVerifier();
|
||||
~SignatureVerifier();
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "crypto/crypto_api.h"
|
||||
#include "crypto/crypto_export.h"
|
||||
|
||||
#if defined(USE_NSS)
|
||||
#include "crypto/scoped_nss_types.h"
|
||||
@ -23,7 +23,7 @@ namespace crypto {
|
||||
|
||||
// Wraps a platform-specific symmetric key and allows it to be held in a
|
||||
// scoped_ptr.
|
||||
class CRYPTO_API SymmetricKey {
|
||||
class CRYPTO_EXPORT SymmetricKey {
|
||||
public:
|
||||
// Defines the algorithm that a key will be used with. See also
|
||||
// classs Encrptor.
|
||||
|
Reference in New Issue
Block a user