Rename CRYPTO_API to CRYPTO_EXPORT.

[email protected]
Review URL: http://codereview.chromium.org/7491061

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95652 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/crypto/capi_util.h b/crypto/capi_util.h
index b61c268..3aa681e5 100644
--- a/crypto/capi_util.h
+++ b/crypto/capi_util.h
@@ -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 @@
 // "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
 
diff --git a/crypto/crypto.gyp b/crypto/crypto.gyp
index b073a99..e909e90 100644
--- a/crypto/crypto.gyp
+++ b/crypto/crypto.gyp
@@ -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',
diff --git a/crypto/crypto_api.h b/crypto/crypto_api.h
deleted file mode 100644
index 2787af8..0000000
--- a/crypto/crypto_api.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// 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_
-#pragma once
-
-#if defined(COMPONENT_BUILD)
-#if defined(WIN32)
-
-#if defined(CRYPTO_IMPLEMENTATION)
-#define CRYPTO_API __declspec(dllexport)
-#else
-#define CRYPTO_API __declspec(dllimport)
-#endif  // defined(CRYPTO_IMPLEMENTATION)
-
-#else  // defined(WIN32)
-#define CRYPTO_API __attribute__((visibility("default")))
-#endif
-
-#else  // defined(COMPONENT_BUILD)
-#define CRYPTO_API
-#endif
-
-#endif  // CRYPTO_CRYPTO_API_H_
diff --git a/crypto/crypto_export.h b/crypto/crypto_export.h
new file mode 100644
index 0000000..c36e527
--- /dev/null
+++ b/crypto/crypto_export.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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_EXPORT __declspec(dllexport)
+#else
+#define CRYPTO_EXPORT __declspec(dllimport)
+#endif  // defined(CRYPTO_IMPLEMENTATION)
+
+#else  // defined(WIN32)
+#define CRYPTO_EXPORT __attribute__((visibility("default")))
+#endif
+
+#else  // defined(COMPONENT_BUILD)
+#define CRYPTO_EXPORT
+#endif
+
+#endif  // CRYPTO_CRYPTO_EXPORT_H_
diff --git a/crypto/cssm_init.h b/crypto/cssm_init.h
index 86ea19d..60fb28e0 100644
--- a/crypto/cssm_init.h
+++ b/crypto/cssm_init.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
diff --git a/crypto/encryptor.h b/crypto/encryptor.h
index cfab6f28..0de6358 100644
--- a/crypto/encryptor.h
+++ b/crypto/encryptor.h
@@ -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 @@
 
 class SymmetricKey;
 
-class CRYPTO_API Encryptor {
+class CRYPTO_EXPORT Encryptor {
  public:
   enum Mode {
     CBC,
diff --git a/crypto/hmac.h b/crypto/hmac.h
index e52d519..b170ce7 100644
--- a/crypto/hmac.h
+++ b/crypto/hmac.h
@@ -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 {
diff --git a/crypto/mac_security_services_lock.h b/crypto/mac_security_services_lock.h
index c6e2ac43..f857cda 100644
--- a/crypto/mac_security_services_lock.h
+++ b/crypto/mac_security_services_lock.h
@@ -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 @@
 // 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
 
diff --git a/crypto/nss_util.h b/crypto/nss_util.h
index d56c7b9..2a2e8a5 100644
--- a/crypto/nss_util.h
+++ b/crypto/nss_util.h
@@ -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 @@
 // 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 @@
 // 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 @@
 // 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 @@
 //
 // 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 @@
 // 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 @@
 // 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 @@
 
 // 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();
diff --git a/crypto/nss_util_internal.h b/crypto/nss_util_internal.h
index 4d6a928..ebb1844 100644
--- a/crypto/nss_util_internal.h
+++ b/crypto/nss_util_internal.h
@@ -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 @@
 // 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.
diff --git a/crypto/openpgp_symmetric_encryption.h b/crypto/openpgp_symmetric_encryption.h
index e2a4bbd..691fdf2cb 100644
--- a/crypto/openpgp_symmetric_encryption.h
+++ b/crypto/openpgp_symmetric_encryption.h
@@ -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 @@
 //
 // 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,
diff --git a/crypto/rsa_private_key.h b/crypto/rsa_private_key.h
index bfa76778..6b9d9d68 100644
--- a/crypto/rsa_private_key.h
+++ b/crypto/rsa_private_key.h
@@ -23,7 +23,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"
@@ -171,7 +171,7 @@
 // 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();
 
diff --git a/crypto/secure_hash.h b/crypto/secure_hash.h
index bdeb9f1a..8a0f6ae 100644
--- a/crypto/secure_hash.h
+++ b/crypto/secure_hash.h
@@ -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,
diff --git a/crypto/sha2.h b/crypto/sha2.h
index 4243ec0..18acf2b 100644
--- a/crypto/sha2.h
+++ b/crypto/sha2.h
@@ -8,7 +8,7 @@
 
 #include <string>
 
-#include "crypto/crypto_api.h"
+#include "crypto/crypto_export.h"
 
 namespace crypto {
 
@@ -23,12 +23,12 @@
 // 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
 
diff --git a/crypto/signature_creator.h b/crypto/signature_creator.h
index e210a028..eccfcce 100644
--- a/crypto/signature_creator.h
+++ b/crypto/signature_creator.h
@@ -21,7 +21,7 @@
 #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 @@
 
 // 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();
 
diff --git a/crypto/signature_verifier.h b/crypto/signature_verifier.h
index 7d0d498..3faa572b 100644
--- a/crypto/signature_verifier.h
+++ b/crypto/signature_verifier.h
@@ -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 @@
 
 // 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();
diff --git a/crypto/symmetric_key.h b/crypto/symmetric_key.h
index 4577bd8..5bb92b7 100644
--- a/crypto/symmetric_key.h
+++ b/crypto/symmetric_key.h
@@ -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 @@
 
 // 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.