summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-17 21:11:13 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-17 21:11:13 +0000
commit82091cc2bc422e98e3ef6b7dfc29118db3425798 (patch)
treec0d2e0c4886afc7ed940e68d8a37d4d20b99ce92
parent6875efd2ee51436b54bdc92d1ee7453034db822f (diff)
downloadchromium_src-82091cc2bc422e98e3ef6b7dfc29118db3425798.zip
chromium_src-82091cc2bc422e98e3ef6b7dfc29118db3425798.tar.gz
chromium_src-82091cc2bc422e98e3ef6b7dfc29118db3425798.tar.bz2
crypto: Add crytpto_api.h and annotate the current exports needed to run
crypto_unittests. BUG=85776 TEST=none Review URL: http://codereview.chromium.org/7168004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89551 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--crypto/crypto.gyp2
-rw-r--r--crypto/crypto_api.h23
-rw-r--r--crypto/encryptor.h3
-rw-r--r--crypto/hmac.h3
-rw-r--r--crypto/rsa_private_key.h3
-rw-r--r--crypto/secure_hash.h3
-rw-r--r--crypto/sha2.h8
-rw-r--r--crypto/signature_creator.h3
-rw-r--r--crypto/signature_verifier.h3
-rw-r--r--crypto/symmetric_key.h3
10 files changed, 44 insertions, 10 deletions
diff --git a/crypto/crypto.gyp b/crypto/crypto.gyp
index 02ef8e1..e99ea75 100644
--- a/crypto/crypto.gyp
+++ b/crypto/crypto.gyp
@@ -13,6 +13,7 @@
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
+ '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
],
'msvs_disabled_warnings': [
4018,
@@ -104,6 +105,7 @@
'sources': [
'capi_util.cc',
'capi_util.h',
+ 'crypto_api.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
new file mode 100644
index 0000000..407eb33
--- /dev/null
+++ b/crypto/crypto_api.h
@@ -0,0 +1,23 @@
+// 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(CRYPTO_DLL)
+#if defined(WIN32)
+#if defined(CRYPTO_IMPLEMENTATION)
+#define CRYPTO_API __declspec(dllexport)
+#else
+#define CRYPTO_API __declspec(dllimport)
+#endif // defined(CRYPTO_IMPLEMENTATION)
+#else
+#define CRYPTO_API __attribute__((visibility("default")))
+#endif // defined(WIN32)
+#else
+#define CRYPTO_API
+#endif
+
+#endif // CRYPTO_CRYPTO_API_H_
diff --git a/crypto/encryptor.h b/crypto/encryptor.h
index d8250f6..0fdf758 100644
--- a/crypto/encryptor.h
+++ b/crypto/encryptor.h
@@ -9,6 +9,7 @@
#include <string>
#include "build/build_config.h"
+#include "crypto/crypto_api.h"
#if defined(USE_NSS)
#include "crypto/scoped_nss_types.h"
@@ -20,7 +21,7 @@ namespace crypto {
class SymmetricKey;
-class Encryptor {
+class CRYPTO_API Encryptor {
public:
enum Mode {
CBC
diff --git a/crypto/hmac.h b/crypto/hmac.h
index d31373a..9800276 100644
--- a/crypto/hmac.h
+++ b/crypto/hmac.h
@@ -12,13 +12,14 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/string_piece.h"
+#include "crypto/crypto_api.h"
namespace crypto {
// Simplify the interface and reduce includes by abstracting out the internals.
struct HMACPlatformData;
-class HMAC {
+class CRYPTO_API HMAC {
public:
// The set of supported hash functions. Extend as required.
enum HashAlgorithm {
diff --git a/crypto/rsa_private_key.h b/crypto/rsa_private_key.h
index 080db46..bfa7677 100644
--- a/crypto/rsa_private_key.h
+++ b/crypto/rsa_private_key.h
@@ -23,6 +23,7 @@ struct SECKEYPublicKeyStr;
#include <vector>
#include "base/basictypes.h"
+#include "crypto/crypto_api.h"
#if defined(OS_WIN)
#include "crypto/scoped_capi_types.h"
@@ -170,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 RSAPrivateKey {
+class CRYPTO_API RSAPrivateKey {
public:
~RSAPrivateKey();
diff --git a/crypto/secure_hash.h b/crypto/secure_hash.h
index 35a2f8b..bdeb9f1 100644
--- a/crypto/secure_hash.h
+++ b/crypto/secure_hash.h
@@ -7,12 +7,13 @@
#pragma once
#include "base/basictypes.h"
+#include "crypto/crypto_api.h"
namespace crypto {
// A wrapper to calculate secure hashes incrementally, allowing to
// be used when the full input is not known in advance.
-class SecureHash {
+class CRYPTO_API SecureHash {
public:
enum Algorithm {
SHA256,
diff --git a/crypto/sha2.h b/crypto/sha2.h
index 349a606..4243ec0 100644
--- a/crypto/sha2.h
+++ b/crypto/sha2.h
@@ -8,6 +8,8 @@
#include <string>
+#include "crypto/crypto_api.h"
+
namespace crypto {
// These functions perform SHA-256 operations.
@@ -21,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.
-void SHA256HashString(const std::string& str,
- void* output, size_t len);
+CRYPTO_API 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.
-std::string SHA256HashString(const std::string& str);
+CRYPTO_API std::string SHA256HashString(const std::string& str);
} // namespace crypto
diff --git a/crypto/signature_creator.h b/crypto/signature_creator.h
index 07be4b9..e210a02 100644
--- a/crypto/signature_creator.h
+++ b/crypto/signature_creator.h
@@ -21,6 +21,7 @@ struct SGNContextStr;
#include <vector>
#include "base/basictypes.h"
+#include "crypto/crypto_api.h"
#include "crypto/rsa_private_key.h"
#if defined(OS_WIN)
@@ -31,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 SignatureCreator {
+class CRYPTO_API SignatureCreator {
public:
~SignatureCreator();
diff --git a/crypto/signature_verifier.h b/crypto/signature_verifier.h
index fb6202c..7d0d498 100644
--- a/crypto/signature_verifier.h
+++ b/crypto/signature_verifier.h
@@ -17,6 +17,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "crypto/crypto_api.h"
#if defined(OS_WIN)
#include "crypto/scoped_capi_types.h"
@@ -26,7 +27,7 @@ namespace crypto {
// The SignatureVerifier class verifies a signature using a bare public key
// (as opposed to a certificate).
-class SignatureVerifier {
+class CRYPTO_API SignatureVerifier {
public:
SignatureVerifier();
~SignatureVerifier();
diff --git a/crypto/symmetric_key.h b/crypto/symmetric_key.h
index c5860b5..4577bd8 100644
--- a/crypto/symmetric_key.h
+++ b/crypto/symmetric_key.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/basictypes.h"
+#include "crypto/crypto_api.h"
#if defined(USE_NSS)
#include "crypto/scoped_nss_types.h"
@@ -22,7 +23,7 @@ namespace crypto {
// Wraps a platform-specific symmetric key and allows it to be held in a
// scoped_ptr.
-class SymmetricKey {
+class CRYPTO_API SymmetricKey {
public:
// Defines the algorithm that a key will be used with. See also
// classs Encrptor.