Skip to content

Commit

Permalink
crypto: enable components build for Linux
Browse files Browse the repository at this point in the history
Expose some more API via CRYPTO_API and refactor gyp file.

(Reland of r92188.)

Review URL: http://codereview.chromium.org/7336009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92212 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
evan@chromium.org committed Jul 12, 2011
1 parent 2d0674e commit 3581bac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
8 changes: 3 additions & 5 deletions crypto/crypto.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'targets': [
{
'target_name': 'crypto',
'type': '<(component)',
'product_name': 'crcrypto', # Avoid colliding with OpenSSL's libcrypto
'dependencies': [
'../base/base.gyp:base',
Expand Down Expand Up @@ -67,16 +68,13 @@
'../third_party/nss/nss.gyp:nss',
],
}],
[ 'OS == "win"', {
'type': '<(component)',
}, { # else OS != "win"
'type': 'static_library',
[ 'OS != "win"', {
'sources!': [
'capi_util.h',
'capi_util.cc',
],
}],
[ 'OS == "win" and component == "shared_library"', {
[ 'component == "shared_library"', {
'defines': [
'CRYPTO_DLL',
'CRYPTO_IMPLEMENTATION',
Expand Down
16 changes: 8 additions & 8 deletions crypto/nss_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace crypto {
// EarlySetupForNSSInit performs lightweight setup which must occur before the
// process goes multithreaded. This does not initialise NSS. For test, see
// EnsureNSSInit.
void EarlySetupForNSSInit();
CRYPTO_API void EarlySetupForNSSInit();
#endif

// Initialize NRPR if it isn't already initialized. This function is
Expand All @@ -55,7 +55,7 @@ void CRYPTO_API EnsureNSSInit();
// Calling this method only has effect on Linux.
//
// WARNING: Use this with caution.
void ForceNSSNoDBInit();
CRYPTO_API 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
Expand All @@ -66,7 +66,7 @@ void ForceNSSNoDBInit();
// This method must be called before EnsureNSSInit() to take effect.
//
// WARNING: Use this with caution.
void DisableNSSForkCheck();
CRYPTO_API 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
Expand All @@ -75,7 +75,7 @@ void DisableNSSForkCheck();
//
// Note that this does not load libnssckbi.so which contains the root
// certificates.
void LoadNSSLibraries();
CRYPTO_API void LoadNSSLibraries();

// Check if the current NSS version is greater than or equals to |version|.
// A sample version string is "3.12.3".
Expand Down Expand Up @@ -136,14 +136,14 @@ bool EnsureTPMTokenReady();

// Convert a NSS PRTime value into a base::Time object.
// We use a int64 instead of PRTime here to avoid depending on NSPR headers.
base::Time PRTimeToBaseTime(int64 prtime);
CRYPTO_API 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.
bool OpenTestNSSDB(const FilePath& path, const char* description);
void CloseTestNSSDB();
CRYPTO_API bool OpenTestNSSDB(const FilePath& path, const char* description);
CRYPTO_API 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
Expand All @@ -157,7 +157,7 @@ base::Lock* GetNSSWriteLock();

// A helper class that acquires the NSS write Lock while the AutoNSSWriteLock
// is in scope.
class AutoNSSWriteLock {
class CRYPTO_API AutoNSSWriteLock {
public:
AutoNSSWriteLock();
~AutoNSSWriteLock();
Expand Down
3 changes: 2 additions & 1 deletion crypto/openpgp_symmetric_encryption.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <string>

#include "base/string_piece.h"
#include "crypto/crypto_api.h"

namespace crypto {

Expand All @@ -19,7 +20,7 @@ namespace crypto {
//
// Likewise, the output of this can be decrypted on the command line with:
// gpg < input
class OpenPGPSymmetricEncrytion {
class CRYPTO_API OpenPGPSymmetricEncrytion {
public:
enum Result {
OK,
Expand Down

0 comments on commit 3581bac

Please sign in to comment.