diff options
author | msarda@chromium.org <msarda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 10:24:54 +0000 |
---|---|---|
committer | msarda@chromium.org <msarda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 10:24:54 +0000 |
commit | 271428d65bc85c4d3989a6782c8b3747c89564f4 (patch) | |
tree | 932b1c376875ec1cf4b6775bb2619fdd9df01a63 | |
parent | 9e56f798538a6c859ccb4d44bd014c552df951a4 (diff) | |
download | chromium_src-271428d65bc85c4d3989a6782c8b3747c89564f4.zip chromium_src-271428d65bc85c4d3989a6782c8b3747c89564f4.tar.gz chromium_src-271428d65bc85c4d3989a6782c8b3747c89564f4.tar.bz2 |
Built crypto and crypto_unittests for iOS
Adds iOS support to crypto.gyp. Both targets now build, but the tests may not
run correctly, and not all the crypto code is correct yet for iOS.
BUG=NONE
Review URL: https://chromiumcodereview.appspot.com/10830183
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150775 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | build/all.gyp | 2 | ||||
-rw-r--r-- | crypto/crypto.gyp | 21 | ||||
-rw-r--r-- | crypto/rsa_private_key.h | 8 | ||||
-rw-r--r-- | crypto/run_all_unittests.cc | 5 | ||||
-rw-r--r-- | net/net.gyp | 4 |
5 files changed, 29 insertions, 11 deletions
diff --git a/build/all.gyp b/build/all.gyp index 7581577..20ed722 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -11,6 +11,7 @@ 'dependencies': [ 'some.gyp:*', '../base/base.gyp:*', + '../crypto/crypto.gyp:*', '../net/net.gyp:*', '../sql/sql.gyp:*', '../testing/gtest.gyp:*', @@ -32,7 +33,6 @@ 'dependencies': [ '../chrome/chrome.gyp:*', '../content/content.gyp:*', - '../crypto/crypto.gyp:*', '../gpu/gpu.gyp:*', '../gpu/tools/tools.gyp:*', '../ipc/ipc.gyp:*', diff --git a/crypto/crypto.gyp b/crypto/crypto.gyp index e124423..33b6b17 100644 --- a/crypto/crypto.gyp +++ b/crypto/crypto.gyp @@ -35,7 +35,7 @@ 4018, ], 'conditions': [ - [ 'os_posix == 1 and OS != "mac" and OS != "android"', { + [ 'os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', { 'dependencies': [ '../build/linux/system.gyp:ssl', ], @@ -48,7 +48,7 @@ }, ], ], - }, { # os_posix != 1 or OS == "mac" or OS == "android" + }, { # os_posix != 1 or OS == "mac" or OS == "ios" or OS == "android" 'sources/': [ ['exclude', '_nss\.cc$'], ['include', 'ec_private_key_nss\.cc$'], @@ -100,7 +100,7 @@ 'mac_security_services_lock.h', ], }], - [ 'OS == "mac" or OS == "win"', { + [ 'OS == "mac" or OS == "ios" or OS == "win"', { 'dependencies': [ '../third_party/nss/nss.gyp:nspr', '../third_party/nss/nss.gyp:nss', @@ -262,7 +262,7 @@ '../testing/gtest.gyp:gtest', ], 'conditions': [ - [ 'os_posix == 1 and OS != "mac" and OS != "android"', { + [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', { 'conditions': [ [ 'linux_use_tcmalloc==1', { 'dependencies': [ @@ -274,17 +274,26 @@ 'dependencies': [ '../build/linux/system.gyp:ssl', ], - }, { # os_posix != 1 or OS == "mac" or OS == "android" + }, { # os_posix != 1 or OS == "mac" or OS == "android" or OS == "ios" 'sources!': [ 'rsa_private_key_nss_unittest.cc', 'openpgp_symmetric_encryption_unittest.cc', ] }], - [ 'OS == "mac" or OS == "win"', { + [ 'OS == "mac" or OS == "ios" or OS == "win"', { 'dependencies': [ '../third_party/nss/nss.gyp:nss', ], }], + ['OS == "ios"', { + 'sources!': [ + # These tests are excluded because they test classes that are not + # implemented on iOS. + 'rsa_private_key_unittest.cc', + 'signature_creator_unittest.cc', + 'signature_verifier_unittest.cc', + ], + }], [ 'OS == "mac"', { 'dependencies': [ '../third_party/nss/nss.gyp:nspr', diff --git a/crypto/rsa_private_key.h b/crypto/rsa_private_key.h index 7a1dccd..ff368d8 100644 --- a/crypto/rsa_private_key.h +++ b/crypto/rsa_private_key.h @@ -14,6 +14,8 @@ typedef struct evp_pkey_st EVP_PKEY; // Forward declaration. struct SECKEYPrivateKeyStr; struct SECKEYPublicKeyStr; +#elif defined(OS_IOS) +#include <Security/Security.h> #elif defined(OS_MACOSX) #include <Security/cssm.h> #endif @@ -217,6 +219,9 @@ class CRYPTO_EXPORT RSAPrivateKey { #elif defined(OS_WIN) HCRYPTPROV provider() { return provider_; } HCRYPTKEY key() { return key_; } +#elif defined(OS_IOS) + SecKeyRef key() { return key_; } + SecKeyRef public_key() { return public_key_; } #elif defined(OS_MACOSX) CSSM_KEY_PTR key() { return &key_; } CSSM_KEY_PTR public_key() { return &public_key_; } @@ -263,6 +268,9 @@ class CRYPTO_EXPORT RSAPrivateKey { ScopedHCRYPTPROV provider_; ScopedHCRYPTKEY key_; +#elif defined(OS_IOS) + SecKeyRef key_; + SecKeyRef public_key_; #elif defined(OS_MACOSX) CSSM_KEY key_; CSSM_KEY public_key_; diff --git a/crypto/run_all_unittests.cc b/crypto/run_all_unittests.cc index 9b6fc467..3d4cc479 100644 --- a/crypto/run_all_unittests.cc +++ b/crypto/run_all_unittests.cc @@ -1,11 +1,14 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. +#include "base/test/main_hook.h" #include "base/test/test_suite.h" #include "crypto/nss_util.h" int main(int argc, char** argv) { + MainHook hook(main, argc, argv); + #if defined(USE_NSS) // This is most likely not needed, but it basically replaces a similar call // that was performed on test_support_base. diff --git a/net/net.gyp b/net/net.gyp index b6b12c3..ca4b4d3 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -37,6 +37,7 @@ '../base/base.gyp:base_i18n', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../build/temp_gyp/googleurl.gyp:googleurl', + '../crypto/crypto.gyp:crypto', '../sdch/sdch.gyp:sdch', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', @@ -811,9 +812,6 @@ 'conditions': [ ['OS != "ios"', { 'dependencies': [ - # TODO(ios): This is temporary; Move this back to the main - # dependencies section once crypto builds for iOS. - '../crypto/crypto.gyp:crypto', # The v8 gyp file is not available in the iOS tree. '../v8/tools/gyp/v8.gyp:v8', ], |