chromium/src/crypto.git
11 days agoFix crypto target on linux-redux when using clang master
rsleevi@chromium.org [Thu, 9 May 2013 21:29:42 +0000 (21:29 +0000)]
Fix crypto target on linux-redux when using clang

BUG=none
R=wtc

Review URL: https://chromiumcodereview.appspot.com/14598019

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@199272 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 days agoAdd RSAPrivateKey::CreateFromKeypair()
cmasone@chromium.org [Wed, 8 May 2013 20:35:21 +0000 (20:35 +0000)]
Add RSAPrivateKey::CreateFromKeypair()

Add a static method to create an RSAPrivateKey object from an NSS public/private
keypair.  Only declared and implemented when USE_NSS is defined.

BUG=235179

Review URL: https://chromiumcodereview.appspot.com/14941007

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@198985 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

3 weeks agoFix client certificate authentication on Mac and Linux introduced in r178732
rsleevi@chromium.org [Thu, 25 Apr 2013 23:25:48 +0000 (23:25 +0000)]
Fix client certificate authentication on Mac and Linux introduced in r178732

When requesting client authentication, the SSL server may send a list of
acceptable CAs. When discovering matching client certificates, the Mac and
Linux implementations were not fully considering all intermediate certificates
when attempting to discover client certificates.

For example, if the client certficate chain was CC -> Intermediate -> Root, and
the server sent a list of acceptable CAs as Root, then on Mac and Linux, CC
would not be considered, whereas on Windows it would. Further, if the server
listed Intermediate as an acceptable CA, then it would work on all platforms.

BUG=224280, 224897
TEST=See https://docs.google.com/a/chromium.org/document/d/19V5_PBSm7OaFLXzTXdiCdSpt1r1yFYJhuH9X41O2oOs/edit?usp=sharing
R=wtc@chromium.org

Review URL: https://chromiumcodereview.appspot.com/13866049

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@196535 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

4 weeks agoUpdate the remaining include paths of base/string_piece.h to its new location.
tfarina@chromium.org [Wed, 17 Apr 2013 21:42:40 +0000 (21:42 +0000)]
Update the remaining include paths of base/string_piece.h to its new location.

string_piece.h was moved into base/strings/ in r191206 -
https://chromiumcodereview.appspot.com/12982018/

TBR=brettw@chromium.org

Review URL: https://codereview.chromium.org/14272007

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@194693 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

5 weeks agoRewrite scoped_array<T> to scoped_ptr<T[]> in crypto.
dcheng@chromium.org [Thu, 11 Apr 2013 16:46:51 +0000 (16:46 +0000)]
Rewrite scoped_array<T> to scoped_ptr<T[]> in crypto.

This is a manual cleanup pass using sed for files which are not built on
Linux.

BUG=171111

Review URL: https://chromiumcodereview.appspot.com/13831003

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@193667 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

5 weeks agoFinish scoped_array<T> to scoped_ptr<T[]> conversion on Linux.
dcheng@chromium.org [Tue, 9 Apr 2013 17:35:42 +0000 (17:35 +0000)]
Finish scoped_array<T> to scoped_ptr<T[]> conversion on Linux.

There are only a few instances left in the Linux build, so lumping
them all into one patch.

BUG=171111

Review URL: https://codereview.chromium.org/13916003

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@193134 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

6 weeks agoRewrite std::string("") to std::string(), Linux edition.
dcheng@chromium.org [Tue, 9 Apr 2013 08:46:45 +0000 (08:46 +0000)]
Rewrite std::string("") to std::string(), Linux edition.

This patch was generated by running the empty_string clang tool
across the Chromium Linux compilation database. Implicitly or
explicitly constructing std::string() with a "" argument is
inefficient as the caller needs to emit extra instructions to
pass an argument, and the constructor needlessly copies a byte
into internal storage. Rewriting these instances to simply call
the default constructor appears to save ~14-18 kilobytes on an
optimized release build.

BUG=none

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=193020

Review URL: https://codereview.chromium.org/13145003

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@193040 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

6 weeks agoRevert "Rewrite std::string("") to std::string(), Linux edition."
dcheng@chromium.org [Tue, 9 Apr 2013 06:41:12 +0000 (06:41 +0000)]
Revert "Rewrite std::string("") to std::string(), Linux edition."

This reverts commit e59558b78e8c6a1b0bd916a724724b638c3c91b6.

Revert "Fix build after r193020."

This reverts commit 558a35897f6b3ffbcaefde927c1f150b815d140a.

Revert "Really fix build after r193020."

This reverts commit e3748a79b523a8d365d4a33ef986eebb4186fa78.

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@193030 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

6 weeks agoRewrite std::string("") to std::string(), Linux edition.
dcheng@chromium.org [Tue, 9 Apr 2013 05:45:17 +0000 (05:45 +0000)]
Rewrite std::string("") to std::string(), Linux edition.

This patch was generated by running the empty_string clang tool
across the Chromium Linux compilation database. Implicitly or
explicitly constructing std::string() with a "" argument is
inefficient as the caller needs to emit extra instructions to
pass an argument, and the constructor needlessly copies a byte
into internal storage. Rewriting these instances to simply call
the default constructor appears to save ~14-18 kilobytes on an
optimized release build.

BUG=none

Review URL: https://codereview.chromium.org/13145003

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@193020 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

7 weeks agoAdd support for P-256 key exchange in crypto handshake.
rtenneti@chromium.org [Sun, 31 Mar 2013 02:49:11 +0000 (02:49 +0000)]
Add support for P-256 key exchange in crypto handshake.

Merge internal change: 44173744

Add default return to avoid crashing when we get an unknown
error code from the peer.

Merge internal change: 44160057

Fix incorrect DCHECK while serializing version negotiation
packet.

Merge internal change: 44156166

Reorder the addends in GetPacketHeaderSize to match the order
of the public header fields.

Merge internal change: 44153020

Changing retransmission and retransmittable data boolean flags
to enums.

Merge internal change: 44071662

Remove methods from QuicTime for converting to/from
microseconds and milliseconds since the epoch for QuicTime is
unspecified.  (It wraps TimeTicks in Chromium).

Merge internal change: 44069965

Change InterArrival feedback message to traffic in delta since
the "start" of the connection instead of a delta since the epoch.

One step closer to being able to remove QuicTime::To/FromMicroseconds
since those methods don't "do the right thing".

Merge internal change: 44037996

Changing kForce into an enum.

Merge internal change: 44024887

Cleanups from landing P-256 key exchange in Chromium.

Merge internal change: 44023801

Fix for std::vector in QuicPacketPublicHeader's memory
corruption by memset.

Merge internal change: 44022862

Merging cleanup changes from chromium.

Merge internal change: 44009665

Plug in the new decrypter and encrypter after the new keys have
been derived.

This is a first cut, as some details on changing the encryption
keys still need to be worked out.  Our interim solution is
permissive trial decryption, which allows the peer to encrypt
with the wrong key, either using the new key too early or using
the null key for too long.  The latter will leak confidential
information, so we err on the side of using the new key too early.

WARNING: the interim solution protects against eavesdroppers, but
is vulberable to active attackers.

Merge internal change: 44006658

Start tracking server and client stream resets and export them
via varz.

Merge internal change: 43971847

Pull out RstStreamFrame error code from QuicErrorCode so that
they don't appear in the tracked ConnectionClose error map.

This will also help in tracking RstStream error codes separately.

Merge internal change: 43968620

Adding Client/Server logging to all LOGS/DLOGs Not bothering
with VLOGs/DVLOGS unless it's requested.

Merge internal change: 43948596

crypto: step 5.

This change implements source-address tokens at the server and has the client
echo them. Source address tokens are opaque (to the client) bytestrings that
prove ownership of an IP address. In order to prevent amplification attacks,
the server demands that the client have a valid source address token for the IP
address that it's claiming to come from and that the token is reasonably
recent.

Since we already have it implemented, this code uses AES-GCM to encrypt and
authenticate the tokens with a fixed, dummy secret (for now). In the future,
the secret will be derived from the primary, private key in the same way that
SessionTicket keys used to be.

The QuicEncrypter/Decrypter code was written to be quite specific to the task
of encrypting and decrypting packets and, as part of this, it exposed only 64
bits of the AEAD nonce.

Since all GFEs will share the same token secret, and they'll all create tokens
with random nonces, that runs an unacceptably high risk of an attacker
obtaining two tokens with the same nonce.

Thus this change also reworks the QuicEncrypter/Decrypter so that the full
nonce is exposed and thus we can use 96-bit nonces. That's still not completely
wonderful but, at 10Mpps an attacker would still take a year to obtain a pair
of nonces, so it's good enough for a while at least.

Merge internal change: 43893806

R=rch@chromium.org

Review URL: https://chromiumcodereview.appspot.com/13282004

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@191569 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

7 weeks agoUpdate the remaining references to sys_string_conversions.h to its new location.
tfarina@chromium.org [Sat, 30 Mar 2013 00:27:00 +0000 (00:27 +0000)]
Update the remaining references to sys_string_conversions.h to its new location.

BUG=196305
TBR=isherman@chromium.org,rsleevi@chromium.org,keybuk@chromium.org,fischman@chromium.org,
thestig@chromium.org,alexeypa@chromium.org,rogerta@chromium.org,cpu@chromium.org,
akalin@chromium.org,ben@chromium.org,tony@chromium.org

Review URL: https://chromiumcodereview.appspot.com/13322003

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@191479 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

2 months ago[Cleanup] Remove StringPrintf from global namespace
groby@chromium.org [Mon, 18 Mar 2013 22:33:04 +0000 (22:33 +0000)]
[Cleanup] Remove StringPrintf from global namespace

use of StringPrintf now requires prefixing with base:: or a per-scope using directive

TBR'd:
abodenha: chrome/service
brettw: content, third_party, webkit
darin: base, chrome/browser, chrome/renderer
dgarret: courgette
enne: cc
fischmann: media
gbillock: sql
joi: google_apis,components
rsleevi: net, crypto
sky: chrome/test
thestig: printing, chrome/common,
tsepez: ipc
wez: remoting
yfriedman: testing/android

NOTRY=true
R=brettw@chromium.org
TBR=joi@chromium.org, rsleevi@chromium.org, enne@chromium.org, thestig@chromium.org, darin@chromium.org, abodenha@chromium.org, sky@chromium.org, dgarret@chromium.org, tsepez@chromium.org, fishman@chromium.org, wez@chromium.org, gbillock@chromium.org, yfriedman@chromium.org
BUG=

Review URL: https://codereview.chromium.org/12767006

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@188857 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

2 months agoInvoke the iOS hook from TestSuite so each run_all_unittests.cc file does not
lliabraa@chromium.org [Fri, 15 Mar 2013 13:14:02 +0000 (13:14 +0000)]
Invoke the iOS hook from TestSuite so each run_all_unittests.cc file does not
have to remember to install MainHook.

BUG=None

Review URL: https://chromiumcodereview.appspot.com/12321117

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@188376 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

2 months agoLand Recent QUIC Changes
rtenneti@chromium.org [Thu, 14 Mar 2013 16:25:33 +0000 (16:25 +0000)]
Land Recent QUIC Changes

Handle versioning by closing the connection on version mismatch for now.

Merge internal change: 43606997

Number of cleanups from landing recent crypto changes.

Merge internal change: 43606111

Added delta_time_largest_observed to ReceivedPacketInfo to calculate accurate RTT.

Merge internal change: 43582099

Implement server-side QUIC key expansion. The derived keys are still not being used yet.

TODO: Code is in crypto_test_utils needs to be enabled.

Merge internal change: 43570937

Added AbandoningPacket to congestion control to avoid issue with FEC.

Merge internal change: 43570099

Wait infinite (aka wait for next ack) is not handled correctly.

Merge internal change: 43558636

Enable faster stats for QUIC.

Merge internal change: 43557310

Implement QUIC key expansion on the client side.  The keys are not being used yet.

Merge internal change: 43515237

Add missing quic_stats files.

Track some connection stats.

Merge internal change: 43506869

Fix bug in WriteQueuedPackets

Merge internal change: 43499600

Small comment change in crypto_handshake's ProcessServerHello method.

Merge internal change: 43448804

R=rch@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/12806002

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@188096 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

2 months agoAdded Curve25519-donna changes.
rtenneti@chromium.org [Fri, 8 Mar 2013 23:40:42 +0000 (23:40 +0000)]
Added Curve25519-donna changes.

Added a wrapper class that implements the following API calls which for
Curve25519.
+ ScalarMult to compute the shared key.
+ ScalarBaseMult to get public key.
+ ConvertToPrivateKey returns a private key from random bytes.

Per agl/wtc, grabbed the rev 234205ff from the git repo
(https://github.com/agl/curve25519-donna/tree/234205ff1ecaf6b3c1dc76798a462c4293f31fdb)
and checked it in to crypto/ because that version has pure Google copyright.

R=wtc@chromium.org,agl@chromium.org,rsleevi@chromium.org
TEST=crypto unit tests

Review URL: https://chromiumcodereview.appspot.com/12457004

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@187074 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

2 months agoCRYPTO - Resolved comments from wtc. Used scoped_ptr<char[]> and
rtenneti@chromium.org [Wed, 27 Feb 2013 02:13:13 +0000 (02:13 +0000)]
CRYPTO - Resolved comments from wtc. Used scoped_ptr<char[]> and
deletion of virtual and removed and'ing with 0xFF.

R=wtc@chromium.org
TEST=crypt unittests

Review URL: https://chromiumcodereview.appspot.com/12330157

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@184832 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

2 months agoMove file_path.h to base/files.
brettw@chromium.org [Sun, 24 Feb 2013 05:40:52 +0000 (05:40 +0000)]
Move file_path.h to base/files.

TBR=sky

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@184344 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

2 months agoRelanding Porting of HKDF changes from server.
rtenneti@chromium.org [Sat, 23 Feb 2013 06:47:22 +0000 (06:47 +0000)]
Relanding Porting of HKDF changes from server.

Added a2b_hex function to move common code in hkdf_unittest.cc
and to make it similar to CL - 40300624.

Merge internal CL: 40300624

Original approved CL: https://chromiumcodereview.appspot.com/12326029/

R=agl@chromium.org, rsleevi@chromium.org

Review URL: https://chromiumcodereview.appspot.com/12335045

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@184306 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

2 months agoRevert 184133
vandebo@chromium.org [Fri, 22 Feb 2013 19:27:46 +0000 (19:27 +0000)]
Revert 184133

It failed in this way:

[ RUN      ] HKDFTest.HKDFConstruct
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(932) : Assertion failed: vector subscript out of range
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(933) : Assertion failed: "Standard C++ Libraries Out of Range" && 0

http://build.chromium.org/p/chromium.win/builders/XP%20Tests%20%28dbg%29%281%29/builds/33019/steps/crypto_unittests/logs/stdio

> Porting of HKDF changes from server.
>
> Merge internal CL: 40300624
>
>
> Review URL: https://chromiumcodereview.appspot.com/12326029

TBR=rtenneti@chromium.org
Review URL: https://codereview.chromium.org/12330079

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@184146 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

2 months agoPorting of HKDF changes from server.
rtenneti@chromium.org [Fri, 22 Feb 2013 18:28:14 +0000 (18:28 +0000)]
Porting of HKDF changes from server.

Merge internal CL: 40300624

Review URL: https://chromiumcodereview.appspot.com/12326029

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@184133 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

3 months agoDo a giant svn propset svn:eol-style LF on .cc and .h files that
jln@chromium.org [Thu, 14 Feb 2013 02:06:52 +0000 (02:06 +0000)]
Do a giant svn propset svn:eol-style LF on .cc and .h files that
lack this property.

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@182368 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

3 months agoThis patch adds some Android-support code to allow the network
digit@chromium.org [Mon, 11 Feb 2013 20:13:45 +0000 (20:13 +0000)]
This patch adds some Android-support code to allow the network
stack to use platform-specific private key objects to perform
signing in the context of SSL handshakes which require a client
certificate.

More specifically:

- Add net/android/keystore.h, which provides native
  functions to operate on JNI references pointing to
  java.security.PrivateKey objects provided by the
  platform. I.e.:

    net::android::GetPrivateKeyType()
    net::android::SignWithPrivateKey()

  Also provide a function that can get the system's own
  EVP_PKEY* handle corresponding to a given PrivateKey
  object. This uses reflection and should *only* be used
  for RSA private keys when running on Android 4.0 and
  4.1, in order to route around a platform bug that was
  only fixed in 4.2.

    net::android::GetOpenSSLSytstemHandleForPrivateKey()

  See the comments in this source file for mode details:

    net/android/java/org/chromium/net/AndroidKeyStore.java

- Add net/android/keystore_openssl.h, which provides
  a function that can wrap an existing PrivateKey
  JNI reference around an OpenSSL EVP_PKEY object
  which uses custom DSA/RSA/ECDSA methods to perform
  signing as expected to handle client certificates.

   net::android::GetOpenSSLPrivateKeyWrapper()

- Add relevant unit tests for the new functions.
  Note that the unit test comes with its own Java helper
  function, which is used to create a platform PrivateKey
  object from encoded PKCS#8 private key data.

  This is called from the native unit test, but does not
  constitute a new Java test (AndroidKeyStoreTestUtil.java).

- Add corresponding new test key files under
  net/data/ssl/certificates/, and their generation
  script in net/data/ssl/scripts/.

- Add net/android/private_key_type_list.h which is
  used both from C++ and Java to define the list of
  supported private key types used by this code.

- Minor improvements: Add a "release()" method to
  crypto::ScopedOpenSSL, add missing BASE_EXPORT
  to one base/android/jni_array.h function declaration.

BUG=166642

Review URL: https://chromiumcodereview.appspot.com/11571059

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@181741 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

3 months agoMore FilePath -> base::FilePath replacement.
brettw@chromium.org [Sun, 10 Feb 2013 19:20:14 +0000 (19:20 +0000)]
More FilePath -> base::FilePath replacement.

Review URL: https://codereview.chromium.org/12225112

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@181655 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

3 months agoAdd FilePath to base namespace.
brettw@chromium.org [Sat, 2 Feb 2013 05:12:33 +0000 (05:12 +0000)]
Add FilePath to base namespace.

This updates headers that forward-declare it and a few random places to use the namespace explicitly. There us a using declaration in file_path.h that makes the rest compile, which we can do in future passes.
Review URL: https://codereview.chromium.org/12163003

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@180245 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

3 months agoTime NSS Initialization for slow startups.
jeremy@chromium.org [Tue, 22 Jan 2013 16:39:34 +0000 (16:39 +0000)]
Time NSS Initialization for slow startups.

Since the code for doing this is outside chrome/ , we can't use the ScopedSlowStartupUMA class, but instead record a regular histogram.  If we're experiencing a slow startup, we look up the histogram and set the UMA bit on it.

BUG=160927

Review URL: https://chromiumcodereview.appspot.com/12018019

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@178018 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

3 months agoDisabling nacl_win64 targets when building in target_arch!=ia32 mode.
bradnelson@google.com [Mon, 21 Jan 2013 23:23:57 +0000 (23:23 +0000)]
Disabling nacl_win64 targets when building in target_arch!=ia32 mode.

When building on windows with target_arch=x64, we no longer need win32 targets
forced to be 64-bit. This gates out these targets when target_arch!=ia32.
(Prior CL dropped the minimal set to break the dependency between these targets
and the rest of the build. This eliminates them completely.)

BUG=None
TEST=None
R=jschuh@chromium.org,thestig@chromium.org
TBR=darin@chromium.org,abodenha@chromium.org,apatrick@chromium.org,sra@chromium.org,wtc@chromium.org

Review URL: https://chromiumcodereview.appspot.com/11929039

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@177959 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

4 months agoMake crypto build on Win64
jschuh@chromium.org [Thu, 10 Jan 2013 00:55:22 +0000 (00:55 +0000)]
Make crypto build on Win64

BUG=166496
BUG=167187
TBR=rsleevi

Review URL: https://chromiumcodereview.appspot.com/11833014

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@175954 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

5 months agoAdd the QuicRandom interface with a default implementation that is
wtc@chromium.org [Sat, 8 Dec 2012 04:08:28 +0000 (04:08 +0000)]
Add the QuicRandom interface with a default implementation that is
both cryptographically secure and thread-safe. The default QuicRandom
is a singleton.

crypto/random.h can include the smaller <stddef.h> for size_t.

Add missing header files to net/net.gyp.

R=rch@chromium.org
BUG=none
TEST=new unit tests

Review URL: https://chromiumcodereview.appspot.com/11476031

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@171931 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

5 months agoUse size_t as the type of the key_length and digest_length arguments
wtc@chromium.org [Tue, 4 Dec 2012 00:50:35 +0000 (00:50 +0000)]
Use size_t as the type of the key_length and digest_length arguments
of HMAC::Init() and HMAC::Sign().

R=agl@chromium.org,bradnelson@chromium.org,thakis@chromium.org
BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/11419270

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@170852 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

5 months agoFix nits in SecureHash.
wtc@chromium.org [Fri, 30 Nov 2012 00:36:58 +0000 (00:36 +0000)]
Fix nits in SecureHash.

R=agl@chromium.org,rsleevi@chromium.org
BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/11299235

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@170308 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

5 months agoFix nits in crypto::InitNSSSafely().
jorgelo@chromium.org [Thu, 29 Nov 2012 04:46:41 +0000 (04:46 +0000)]
Fix nits in crypto::InitNSSSafely().

Some comments in https://chromiumcodereview.appspot.com/11411013/
were not addressed before the CL landed, so do that now.

BUG=None
TEST=content_browsertests
NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/11418212

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@170129 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

5 months agoUpdate nss_revision to 169146.
wtc@chromium.org [Thu, 22 Nov 2012 02:20:58 +0000 (02:20 +0000)]
Update nss_revision to 169146.

The underlying CLs are:
https://codereview.chromium.org/11419095/
https://codereview.chromium.org/11411127/

The first CL allows us to call NSS_SetAlgorithmPolicy in Windows
shared_library build.

R=rsleevi@chromium.org,sgjesse@chromium.org
BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/11308155

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@169195 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

5 months agoAlways force a crash with error info on NSS_NoDB_Init failure.
wtc@chromium.org [Wed, 21 Nov 2012 16:00:21 +0000 (16:00 +0000)]
Always force a crash with error info on NSS_NoDB_Init failure.

R=eroman@chromium.org,rsleevi@chromium.org
BUG=153281
TEST=none

Review URL: https://chromiumcodereview.appspot.com/11415074

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@169053 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

5 months agoDisable MD5 certificate signatures if NSS is used to verify certificates.
wtc@chromium.org [Tue, 20 Nov 2012 07:58:44 +0000 (07:58 +0000)]
Disable MD5 certificate signatures if NSS is used to verify certificates.

This prepares us for NSS 3.14, which disables MD5 certificate signatures
by default.

Disable a unit test for NSS because all the test cases in that test are
invalid now.

R=rsleevi@chromium.org
BUG=151692
TEST=none

Review URL: https://chromiumcodereview.appspot.com/11365274

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@168757 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

6 months agoInitialize NSS in the PPAPI process for ClearKey CDM.
jorgelo@chromium.org [Sat, 17 Nov 2012 03:57:56 +0000 (03:57 +0000)]
Initialize NSS in the PPAPI process for ClearKey CDM.

BUG=156864
TEST=content_browsertests passes on linux_rel_precise.

Review URL: https://chromiumcodereview.appspot.com/11411013

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@168372 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

6 months agoMove scoped_temp_dir from base to base/files
brettw@chromium.org [Fri, 16 Nov 2012 20:34:23 +0000 (20:34 +0000)]
Move scoped_temp_dir from base to base/files

Also add to base namespace.

BUG=

Review URL: https://codereview.chromium.org/11359217

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@168281 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

6 months agoUse LOG(FATAL) instead of CHECK(false) to force a crash on NSS_NoDB_Init
wtc@chromium.org [Fri, 16 Nov 2012 03:45:32 +0000 (03:45 +0000)]
Use LOG(FATAL) instead of CHECK(false) to force a crash on NSS_NoDB_Init
failure.

This prevents the log message from being stripped in official builds.

R=eroman@chromium.org
BUG=153281
TEST=none

Review URL: https://chromiumcodereview.appspot.com/11280021

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@168128 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

6 months agoForce a crash with error info on NSS_NoDB_Init failure.
wtc@chromium.org [Thu, 15 Nov 2012 05:41:25 +0000 (05:41 +0000)]
Force a crash with error info on NSS_NoDB_Init failure.

R=eroman@chromium.org,rsleevi@chromium.org
BUG=153281
TEST=none

Review URL: https://chromiumcodereview.appspot.com/11358256

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@167871 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

6 months agocrypto: add GHASH implementation.
agl@chromium.org [Fri, 9 Nov 2012 19:30:32 +0000 (19:30 +0000)]
crypto: add GHASH implementation.

Can be used to implement GCM until GCM support in NSS is widespread.

Review URL: https://codereview.chromium.org/11175015

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@166952 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

6 months agocrypto: Remove forbidden using namespace directive.
tfarina@chromium.org [Sat, 3 Nov 2012 00:48:17 +0000 (00:48 +0000)]
crypto: Remove forbidden using namespace directive.

Instead just wrap the unittests files into the crypto namespace.

TEST=crypto_unittests
R=rsleevi@chromium.org

Review URL: https://chromiumcodereview.appspot.com/11368035

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@165816 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

6 months agoFirst step towards component build for Android.
yfriedman@chromium.org [Thu, 1 Nov 2012 17:38:47 +0000 (17:38 +0000)]
First step towards component build for Android.

Add symbol exports needed to build content shell.

BUG=158821

Review URL: https://codereview.chromium.org/11368031

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@165420 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

7 months agoEnable MD5 certificate signatures until we figure out how to deal
wtc@chromium.org [Fri, 19 Oct 2012 23:57:45 +0000 (23:57 +0000)]
Enable MD5 certificate signatures until we figure out how to deal
with the weak certificate signature unit tests.

Map the new NSS error code SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED
to net::ERR_CERT_WEAK_SIGNATURE.

Refactor MapCertErrorToCertStatusto avoid duplicating code with
MapSecurityError.

R=rsleevi@chromium.org
BUG=151692
TEST=none

Review URL: https://chromiumcodereview.appspot.com/11192076

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@163098 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

7 months agoRemove all the "set noparent" directives
dpranke@chromium.org [Fri, 19 Oct 2012 22:05:04 +0000 (22:05 +0000)]
Remove all the "set noparent" directives

Now that OWNERS supports per-file owners, we can limit the scope of the
top-level wildcard to just DEPS, and make darin and ben owners for
everything else and remove the broad use of "set noparent".

R=ben@chromium.org, darin@chromium.org
BUG=88315

Review URL: https://codereview.chromium.org/11191038

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@163069 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

7 months agoReland: Implement ScopedTestNSSDB instead of OpenTestNSSDB()
toyoshim@chromium.org [Thu, 18 Oct 2012 07:02:54 +0000 (07:02 +0000)]
Reland: Implement ScopedTestNSSDB instead of OpenTestNSSDB()
This CL needs memory suppression because of missing CloseTestNSSDB().
See also TODO.

BUG=136950, 156433

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=162327

Review URL: https://chromiumcodereview.appspot.com/11174006

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@162659 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

7 months agoRevert 162327 - Implement ScopedTestNSSDB instead of OpenTestNSSDB()
estade@chromium.org [Wed, 17 Oct 2012 20:32:38 +0000 (20:32 +0000)]
Revert 162327 - Implement ScopedTestNSSDB instead of OpenTestNSSDB()

BUG=136950

Review URL: https://chromiumcodereview.appspot.com/11174006

TBR=toyoshim@chromium.org
BUG=156433
Review URL: https://codereview.chromium.org/11196028

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@162511 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

7 months agoImplement ScopedTestNSSDB instead of OpenTestNSSDB()
toyoshim@chromium.org [Wed, 17 Oct 2012 08:35:13 +0000 (08:35 +0000)]
Implement ScopedTestNSSDB instead of OpenTestNSSDB()

BUG=136950

Review URL: https://chromiumcodereview.appspot.com/11174006

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@162327 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

7 months agoUse the NSS internal key slot for all temporary key operations
rsleevi@chromium.org [Wed, 17 Oct 2012 03:18:58 +0000 (03:18 +0000)]
Use the NSS internal key slot for all temporary key operations

Rather than calling PK11_GetBestSlot, which requires enumerating all
connected tokens, use PK11_GetInternalSlot, which explicitly uses the
internal NSS key database. On Linux, this will ignore any user preferences
regarding what tokens should be used for which mechanisms, but for
internal/temporary operations, this is an acceptable tradeoff.

BUG=chrome-os-partner:14707

Review URL: https://chromiumcodereview.appspot.com/11186004

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@162309 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

7 months agocrypto: remove unused Mac SignatureVerifier.
agl@chromium.org [Tue, 9 Oct 2012 19:22:41 +0000 (19:22 +0000)]
crypto: remove unused Mac SignatureVerifier.

Review URL: https://chromiumcodereview.appspot.com/11092006

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@160892 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

7 months agoForce crypto::AppleKeychain access to be guarded by a Big Global Lock
rsleevi@chromium.org [Wed, 3 Oct 2012 05:46:45 +0000 (05:46 +0000)]
Force crypto::AppleKeychain access to be guarded by a Big Global Lock

Apple removed the Big Global Lock guarding the Security.framework API,
but there are a number of thread-unsafe places in the API. Additionally,
it seems that OS X 10.8.2 has introduced some deadlock potential, so
force calls to be serialized behind a Chrome-supplied Big Global Lock
until it's safe to do otherwise.

BUG=151707
TEST=See bug

Review URL: https://chromiumcodereview.appspot.com/11016004

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@159839 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

8 months agocrypto: add DecodeSignature and use SHA-256 with ECDSA.
agl@chromium.org [Wed, 19 Sep 2012 15:11:33 +0000 (15:11 +0000)]
crypto: add DecodeSignature and use SHA-256 with ECDSA.

This changes ECSignatureCreator to use the hash function that SPDY
expects (SHA-256). There are no other users of ECSignatureCreator in
the tree so I'm going to defer making these choices parameters until there's
a benefit to be had.

It also adds DecodeSignature to convert from ASN.1 signatures to the `raw'
form that SPDY needs.

BUG=none

Review URL: https://chromiumcodereview.appspot.com/10910226

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@157551 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

8 months agoDo not include <Security/cssm.h> on iOS as it does not exist.
msarda@chromium.org [Wed, 5 Sep 2012 10:31:31 +0000 (10:31 +0000)]
Do not include <Security/cssm.h> on iOS as it does not exist.

Review URL: https://chromiumcodereview.appspot.com/10920073

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@154937 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

8 months agoRename MacKeychain to AppleKeychain
msarda@chromium.org [Thu, 30 Aug 2012 13:03:46 +0000 (13:03 +0000)]
Rename MacKeychain to AppleKeychain

Rename MacKeychain to AppleKeychain and add mac and iOS specific
implementations (crypto/apple_keychain_ios.mm and
crypto/apple_keychain_mac.mm). Rename MockKeychain to
MockAppleKeychain and split its implementations in 3 files
crypto/mock_apple_keychain.cc, crypto/mock_apple_keychain_ios.cc and
crypto/mock_apple_keychain_mac.cc).

Review URL: https://chromiumcodereview.appspot.com/10875029

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@154123 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

9 months agoAdd RSAPrivateKey stub implementation for iOS.
msarda@chromium.org [Mon, 20 Aug 2012 01:11:49 +0000 (01:11 +0000)]
Add RSAPrivateKey stub implementation for iOS.

RSAPrivateKey is not used on iOS, but code calling it is compiled. To avoid
ifdef'ing in the client code, the class is stubbed out.

Review URL: https://chromiumcodereview.appspot.com/10823309

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@152300 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

9 months agoUpstream minor iOS crypto diffs.
msarda@chromium.org [Tue, 14 Aug 2012 19:46:28 +0000 (19:46 +0000)]
Upstream minor iOS crypto diffs.

This CL upstreams two minor changes of crypto for iOS:
* nss_util.cc: On iOS, the default NSS root certificates need to be initialized when no persistent database is used.
* symmetric_key_unittest.cc: Turn off an OS X-specific code path for iOS.

Review URL: https://chromiumcodereview.appspot.com/10831307

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@151545 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

9 months agoBuilt crypto and crypto_unittests for iOS
msarda@chromium.org [Thu, 9 Aug 2012 10:24:54 +0000 (10:24 +0000)]
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: http://src.chromium.org/svn/trunk/src/crypto@150775 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

9 months agoAdded crypto random-number generator
mniknami@chromium.org [Thu, 2 Aug 2012 20:22:25 +0000 (20:22 +0000)]
Added crypto random-number generator

Added a cryptographic random-number generator to crypto/.
Modified sync to use this function instead.
May also be used by Cloud Print in the future.

Review URL: https://chromiumcodereview.appspot.com/10698177

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@149689 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

9 months agoAdd a DCHECK to ECSignatureCreator::SetFactoryForTesting to help avoid use-after...
rch@chromium.org [Wed, 1 Aug 2012 22:02:33 +0000 (22:02 +0000)]
Add a DCHECK to ECSignatureCreator::SetFactoryForTesting to help avoid use-after-free problems.

Review URL: https://chromiumcodereview.appspot.com/10828118

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@149506 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

9 months agoMake 'License' field in third-party metadata required
steveblock@chromium.org [Wed, 1 Aug 2012 15:50:29 +0000 (15:50 +0000)]
Make 'License' field in third-party metadata required

This will simplify the addition of a tool to check licenses for the purpose of
the Android WebView build.

See also http://codereview.chromium.org/10827099

Also adds other missing fields to these README.chromium files as required by
presubmit checks and fixes a regex used to enforce this.

BUG=138921

Review URL: https://chromiumcodereview.appspot.com/10821103

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@149423 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

9 months agosrc/crypto should build on the x86_64 architecture.
mmaerean@adobe.com [Mon, 30 Jul 2012 22:11:11 +0000 (22:11 +0000)]
src/crypto should build on the x86_64 architecture.
This patch solves the build issues that are directly related to building crypto for the x86_64 architecture.

BUG=136072

Review URL: https://chromiumcodereview.appspot.com/10738003

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@149047 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

9 months agocrypto: Tag some overridden methods with OVERRIDE.
tfarina@chromium.org [Mon, 30 Jul 2012 05:16:00 +0000 (05:16 +0000)]
crypto: Tag some overridden methods with OVERRIDE.

BUG=115047
R=rsleevi@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10824076

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@148928 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

9 months agocrypto: special case āˆž+a, a+āˆž and a+a in p224.
agl@chromium.org [Fri, 27 Jul 2012 21:25:19 +0000 (21:25 +0000)]
crypto: special case āˆž+a, a+āˆž and a+a in p224.

In unrelated work, I found that the group addition formula used in p224.cc
doesn't work when one of the arguments is the point at infinity. This change
catches that case and simplifies the ScalarMult loop as a consequence.

In the course of doing this, I found a couple of bugs in Contract that would
have produced the wrong answer is very rare cases.

I also added a catch for a+a. This can't happen in the ScalarMult loop, but it
could happen from SPAKE2 at a rate of 1 in ~2**220 evaluations.

BUG=none
TEST=crypto_unittests

Review URL: https://chromiumcodereview.appspot.com/10822019

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@148815 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

10 months agoDeclare password_data_count_ as int to match the return type of its
wtc@chromium.org [Thu, 19 Jul 2012 21:52:09 +0000 (21:52 +0000)]
Declare password_data_count_ as int to match the return type of its
getter method.

R=rsleevi@chromium.org
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10800038

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@147541 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

10 months agoRemove #pragma once from crypto
ajwong@chromium.org [Wed, 11 Jul 2012 07:19:14 +0000 (07:19 +0000)]
Remove #pragma once from crypto

Review URL: https://chromiumcodereview.appspot.com/10695140

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@146077 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

10 months agoNSS Channel ID: don't check ECC support on every socket creation.
mattm@chromium.org [Mon, 9 Jul 2012 23:12:14 +0000 (23:12 +0000)]
NSS Channel ID: don't check ECC support on every socket creation.

Add static function to ECPrivateKey to get which NSS slot it uses.

BUG=127506

Review URL: https://chromiumcodereview.appspot.com/10700099

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@145777 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

10 months agoConvert SSLClientSocketNSS to use the NSS Channel ID callback.
mattm@chromium.org [Tue, 26 Jun 2012 02:13:49 +0000 (02:13 +0000)]
Convert SSLClientSocketNSS to use the NSS Channel ID callback.

BUG=129174,127506
TEST=run a TLS Channel ID supporting server, try connecting to it.
TBR=joi@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10560020

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@144093 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

11 months agoUse NSS for symmetric key crypto operations on Windows and Mac.
ddorwin@chromium.org [Fri, 15 Jun 2012 08:11:52 +0000 (08:11 +0000)]
Use NSS for symmetric key crypto operations on Windows and Mac.

Encryptor, HMAC, and SymmetricKey now use NSS on all platforms except Android.
This allows us to use them inside the sandbox, something that was not possible
when using the platform APIs.

On Windows, Native Client 64-bit builds still use the the platform APIs.

BUG=127803,124741
TEST=Existing tests since there is no change in functionality.

Review URL: https://chromiumcodereview.appspot.com/10543146

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@142356 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

11 months agoFixing gcc 4.7 building problems.
shenhan@google.com [Tue, 5 Jun 2012 01:54:46 +0000 (01:54 +0000)]
Fixing gcc 4.7 building problems.

a) - gcc-4.7 improved the implicit headers that it includes. with
<4.7, the gthr-default.h file always pulls in unistd.h. with >=4.7,
they avoided that include when possible. so code that isn't including
unistd.h itself but needs it now breaks.

b) - narrowing conversion in initiliazation list now raises an
'ill-formed conversion' warning, which causes error when -Werror is
given.

[THIS PART IS NOW REVERTED IN THE PATCH} c) - included patches from pastebin - http://pastebin.com/raw.php?i=p3UKs7Cg

Note - this may not be fixing all the gcc 4.7 build problems for all
parts, but rather than submitting one big-fix-for-all CL, we'd better
do it incrementally (given that all the modification is reasonable and
minor) so that at least some parts get a successful gcc 4.7 build.

BUG=None
TEST=Built successfully using GCC-4.7 under chromium chroot

Review URL: https://chromiumcodereview.appspot.com/10451068

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@140470 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 months agoRemove TPMTokenInfoDelegate to make TPM initialization code path simple
hashimoto@chromium.org [Thu, 17 May 2012 10:04:17 +0000 (10:04 +0000)]
Remove TPMTokenInfoDelegate to make TPM initialization code path simple

Move Cryptohome D-Bus method calls to chromeos::CertLibrary

BUG=125848
TEST=can login

Review URL: https://chromiumcodereview.appspot.com/10332191

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@137646 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 months agoUpstream: Depend on OpenSSL directly instead of via system.gyp
jingzhao@chromium.org [Wed, 16 May 2012 07:40:01 +0000 (07:40 +0000)]
Upstream: Depend on OpenSSL directly instead of via system.gyp

build/android/system.gyp has an extra level of abstraction for openssl
which is currently not really doing anything since we don't yet support
using the system openssl on android. Remove it for now, because this
stops there from being two targets called "ssl" (this one and the one
for linux) - solving some problems with the android build backend for
gyp.

Review URL: https://chromiumcodereview.appspot.com/10332106

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@137379 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 months agoRemove crypto::IsTPMTokenAvailble
hashimoto@chromium.org [Wed, 16 May 2012 03:55:27 +0000 (03:55 +0000)]
Remove crypto::IsTPMTokenAvailble

BUG=126674
TEST=build success

Review URL: https://chromiumcodereview.appspot.com/10381151

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@137357 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 months agoChange the way _EXPORT macros look.
thakis@chromium.org [Tue, 15 May 2012 15:04:32 +0000 (15:04 +0000)]
Change the way _EXPORT macros look.

With the current setup, if you have a header file my_class.h

class BASE_EXPORT MyClass {
 public:
  void MyInlineMethod() { /* do stuff, inline */ }
};

then every cc file that includes my_class.h will have a public symbol
for MyInlineMethod (because inline methods need to be emitted to
every translation unit, and the linker sorts them out). With the
components build, the linker can't decide to drop these inline methods,
so every .so that uses this header file will have the same public symbol.

With this proposed change, the symbol will only be visible in the target
the header file belongs to, and it will be hidden in all other components.
That's cleaner, and it also prevents accident hidden dependencies (say
target A depends on B, and B depends on C. A accidentally uses an inline
function from a class in C. With this change, that would result in a linker
error, and an explicit dependency from A on C would have to be added).

Also add a missing CHROMEOS_IMPLEMENTATION define which went
unnoticed until now.

BUG=90078
TEST=Things still build.
TBR=ben, tony, viettrungluu, thestig, agl, willchan

Review URL: https://chromiumcodereview.appspot.com/10386108

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@137130 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 months agoAdd a wrong key that should be detected by all implementations.
wtc@chromium.org [Fri, 11 May 2012 03:17:44 +0000 (03:17 +0000)]
Add a wrong key that should be detected by all implementations.

R=rsleevi@chromium.org
BUG=127586
TEST=EncryptorTest.DecryptWrongKey

Review URL: https://chromiumcodereview.appspot.com/10378095

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@136493 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 months agoDon't sign extensions with an unsupported/invalid private key
rsleevi@chromium.org [Fri, 4 May 2012 04:11:42 +0000 (04:11 +0000)]
Don't sign extensions with an unsupported/invalid private key

BUG=125997
TEST=manually test with unsupported/invalid key

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@135292 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 months agowin: Fix a few minor issues found by clang.
thakis@chromium.org [Wed, 2 May 2012 20:47:47 +0000 (20:47 +0000)]
win: Fix a few minor issues found by clang.

No intended functionality change.

BUG=82385
TEST=compiles

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@134988 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 months agoDemonstrate that not all wrong keys can be detected by padding error.
wtc@chromium.org [Fri, 27 Apr 2012 03:01:09 +0000 (03:01 +0000)]
Demonstrate that not all wrong keys can be detected by padding error.

R=xhwang@chromium.org
BUG=124434
TEST=crypto_unittests --gtest_filter=EncryptorTest.DecryptWrongKey

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@134220 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 months agoAdd a warning about Decrypt() being used as a padding oracle.
wtc@chromium.org [Wed, 25 Apr 2012 00:27:43 +0000 (00:27 +0000)]
Add a warning about Decrypt() being used as a padding oracle.

R=agl@chromium.org,rsleevi@chromium.org
BUG=124434
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10216004

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@133822 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

12 months agoAdd a wrong key test into EncryptorTest.
xhwang@chromium.org [Mon, 23 Apr 2012 23:51:43 +0000 (23:51 +0000)]
Add a wrong key test into EncryptorTest.

The behavior of crypto::Encryptor::Decrypt() funcion is different on different platforms. Add this test to test this.

BUG=124434
TEST=this is a new test

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@133569 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

13 months agoProperly pass NSS parameters when initializing the PKCS#11 module on CrOS
rsleevi@chromium.org [Fri, 6 Apr 2012 02:37:21 +0000 (02:37 +0000)]
Properly pass NSS parameters when initializing the PKCS#11 module on CrOS

When initializing the CHAPS PKCS#11 module in CrOS, properly
pass the NSS parameters to SECMOD_LoadUserModule. This
ensures that the default flags for the default slot to mark
the slot as friendly, which means it is not necessary to
call C_Login before calling any read-only operations. Any
actions that fail in read-only mode will still call C_Login.

BUG=118206, chromium-os:28842
TEST=See bug

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@131075 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

13 months agoForces TPM slot to be "Friendly", allowing NSS to avoid locking
gspencer@chromium.org [Tue, 3 Apr 2012 21:58:07 +0000 (21:58 +0000)]
Forces TPM slot to be "Friendly", allowing NSS to avoid locking

Also added VLOG(1) logging for PKCS11 slot info.

BUG=chromium:118206
TEST=Ran on device, tried to repro bug, and was unable to.  Confirmed that friendly bit was set (based on log output).

Review URL: https://chromiumcodereview.appspot.com/9969019

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@130474 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

13 months agoFix some grammar in comments, error messages and documentation.
gavinp@chromium.org [Tue, 3 Apr 2012 12:32:14 +0000 (12:32 +0000)]
Fix some grammar in comments, error messages and documentation.

Thanks to all my reviewers, you are legion.  I hope I didn't waste too
much of your time.

BUG=None

Review URL: http://codereview.chromium.org/9854039
Review URL: http://codereview.chromium.org/9854043
Review URL: http://codereview.chromium.org/9863058
Review URL: http://codereview.chromium.org/9863059
Review URL: http://codereview.chromium.org/9887005
Review URL: http://codereview.chromium.org/9890002
Review URL: http://codereview.chromium.org/9891002
Review URL: http://codereview.chromium.org/9895003
Review URL: http://codereview.chromium.org/9896002
Review URL: http://codereview.chromium.org/9896003
Review URL: http://codereview.chromium.org/9897002
Review URL: http://codereview.chromium.org/9897003
Review URL: http://codereview.chromium.org/9903004
Review URL: http://codereview.chromium.org/9904003
Review URL: http://codereview.chromium.org/9904002
Review URL: http://codereview.chromium.org/9904004
Review URL: http://codereview.chromium.org/9906002
Review URL: http://codereview.chromium.org/9906001
Review URL: http://codereview.chromium.org/9906003
Review URL: http://codereview.chromium.org/9909001
Review URL: http://codereview.chromium.org/9909002
Review URL: http://codereview.chromium.org/9909003
Review URL: http://codereview.chromium.org/9909004
Review URL: http://codereview.chromium.org/9910001
Review URL: http://codereview.chromium.org/9910002
Review URL: http://codereview.chromium.org/9910010
Review URL: http://codereview.chromium.org/9911001
Review URL: http://codereview.chromium.org/9912001

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@130359 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

13 months agoinit key_ in ctor
tbreisacher@chromium.org [Fri, 30 Mar 2012 21:37:19 +0000 (21:37 +0000)]
init key_ in ctor

CID=16392
BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/9861027

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@129953 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

13 months agoAdd base::HostToNetXX() & NetToHostXX(), and use them to replace htonX() & ntohX... git-svn
wez@chromium.org [Wed, 28 Mar 2012 20:19:31 +0000 (20:19 +0000)]
Add base::HostToNetXX() & NetToHostXX(), and use them to replace htonX() & ntohX() in Chrome.

This primarily addresses issues with code using the OS-provided htonX() & ntohX() functions from within the Chrome sandbox.  Under Windows these functions are provided by ws2_32.dll, which is no longer available within Chrome's sandbox.

The new base::HostToNetXX() and NetToHostXX() functions are safe for use by sandboxed code on Windows, and provide a single place where future fixes for other platforms can be made.

BUG=117252

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@129476 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

13 months agoNew CRYPTO_EXPORT macros.
thakis@chromium.org [Wed, 28 Mar 2012 04:10:05 +0000 (04:10 +0000)]
New CRYPTO_EXPORT macros.

BUG=90078
TEST=none

Review URL: https://chromiumcodereview.appspot.com/9873017

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@129368 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

13 months agoFix a few warnings that -Wnull-conversion of a future clang will complain about.
thakis@chromium.org [Wed, 28 Mar 2012 01:35:51 +0000 (01:35 +0000)]
Fix a few warnings that -Wnull-conversion of a future clang will complain about.

BUG=none
TEST=none
TBR=OWNERS
NOTRY=true

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@129337 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

13 months agoReland - Create a database for NaCl validation caching that is shared between processes.
nduca@google.com [Tue, 27 Mar 2012 01:15:30 +0000 (01:15 +0000)]
Reland - Create a database for NaCl validation caching that is shared between processes.

Originally reverted in 129077 due to perf regression. Followup commit will fix up expectations.
http://chromegw.corp.google.com/i/chromium/builders/Linux%20x64/builds/25780

This change primarily entails creating a SyncChannel between sel_ldr and the
browser.  Queries to the database could be made from any thread inside sel_ldr,
so the query mechanism needs to be thread safe.

This feature is currently disabled by default, and requires an environment
variable to enable.  A few changes need to be made before this features is safe
and can be enabled, such as making sure each installation has a unique,
crypographically secure key.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2515
TEST= Run NaCl w/ NACL_VALIDATION_CACHE=1

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

TBR=ncbray@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9808113

TBR=nduca@google.com
Review URL: https://chromiumcodereview.appspot.com/9860020

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@129082 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

13 months agoRevert 129061 - Create a database for NaCl validation caching that is shared between...
nduca@google.com [Tue, 27 Mar 2012 00:59:39 +0000 (00:59 +0000)]
Revert 129061 - Create a database for NaCl validation caching that is shared between processes.

Reverted due to perf regression, see
http://chromegw.corp.google.com/i/chromium/builders/Linux%20x64/builds/25780

This change primarily entails creating a SyncChannel between sel_ldr and the
browser.  Queries to the database could be made from any thread inside sel_ldr,
so the query mechanism needs to be thread safe.

This feature is currently disabled by default, and requires an environment
variable to enable.  A few changes need to be made before this features is safe
and can be enabled, such as making sure each installation has a unique,
crypographically secure key.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2515
TEST= Run NaCl w/ NACL_VALIDATION_CACHE=1

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

TBR=ncbray@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9808113

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@129077 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

13 months agoCreate a database for NaCl validation caching that is shared between processes.
ncbray@chromium.org [Tue, 27 Mar 2012 00:16:47 +0000 (00:16 +0000)]
Create a database for NaCl validation caching that is shared between processes.

This change primarily entails creating a SyncChannel between sel_ldr and the
browser.  Queries to the database could be made from any thread inside sel_ldr,
so the query mechanism needs to be thread safe.

This feature is currently disabled by default, and requires an environment
variable to enable.  A few changes need to be made before this features is safe
and can be enabled, such as making sure each installation has a unique,
crypographically secure key.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2515
TEST= Run NaCl w/ NACL_VALIDATION_CACHE=1

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@129061 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

14 months agoMove *keychain_mac* files to crypto/
akalin@chromium.org [Sat, 17 Mar 2012 12:14:50 +0000 (12:14 +0000)]
Move *keychain_mac* files to crypto/

This is in preparation for moving password_manager/encryptor* to
crypto/.

This also fixes an ODR violation; mock_keychain_mac.cc was being
compiled in two targets which are linked together.

BUG=118564
TEST=

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@127358 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

14 months agomac: Make crypto_unittests depend on nspr
thakis@chromium.org [Thu, 15 Mar 2012 19:07:41 +0000 (19:07 +0000)]
mac: Make crypto_unittests depend on nspr

nss_util_unittest.cc calls PR_ImplodeTime, so this dependency is needed in
the components build.

BUG=90078
TEST=none

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@126958 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

14 months agoDon't enforce the old HMAC key size requirement in FIPS 198 Sec. 3.
wtc@chromium.org [Wed, 14 Mar 2012 17:41:46 +0000 (17:41 +0000)]
Don't enforce the old HMAC key size requirement in FIPS 198 Sec. 3.

This requirement has been removed in FIPS 198-1.

R=rsleevi@chromium.org
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9695058

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@126674 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

14 months agoRefactor Pickle Read methods to use higher performance PickleIterator.
jbates@chromium.org [Wed, 7 Mar 2012 20:42:56 +0000 (20:42 +0000)]
Refactor Pickle Read methods to use higher performance PickleIterator.

There was a lot of redundant error checking and initialization code in all Pickle Read methods because of the void** iterator type. This change replaces the void* iterator with PickleIterator, which encapsulates the read pointer so that less error checking and initialization code is needed for reading.

PickleIterator has all the necessary data to do the actual reading. The advantage of having it provide Read methods (as opposed to leaving them solely in the Pickle interface) is that the callers do not need to pass around the const Pickle* once they have a PickleIterator.

Followup CLs will refactor the call sites to remove const Pickle* arguments where they are now unnecessary. Then the Pickle::Read* methods can be removed entirely.

The alternative approach would have been to change the Pickle::Read methods to non-const and remove the iterator parameter (making Read methods advance an internal read pointer). Unfortunately, the const Read with iterator design is entrenched throughout the chromium code, making this a much more complex change with the same performance outcome.

BUG=13108

Review URL: https://chromiumcodereview.appspot.com/9447084

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@125447 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

14 months agoAvoid loading ws2_32.dll just to get htons() and friends.
wez@chromium.org [Tue, 6 Mar 2012 04:34:24 +0000 (04:34 +0000)]
Avoid loading ws2_32.dll just to get htons() and friends.

Chrome does not load ws2_32.dll into the renderer sandbox, so code calling these functions would fail attempting to load the DLL.  This CL replaces the calls with direct use of the MSVC byte-swap intrinsics.

BUG=115477,116591
TEST=Chromoting client does not crash on connect on Windows.

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@125110 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

14 months agoConvert blocking chromeos::CryptohomeClient::Pkcs11* methods to async
hashimoto@chromium.org [Tue, 28 Feb 2012 10:34:21 +0000 (10:34 +0000)]
Convert blocking chromeos::CryptohomeClient::Pkcs11* methods to async

CryptohomeLibrary::Pkcs11* methods are removed.
crypto::EnsureTPMTokenReady (renamed to InitializeTPMToken) and TPMTokenInfoDelegate::IsTokenReady are also converted to async.

BUG=chromium-os:16552
TEST=Login as a user, open chrome://cryptohome and see "token_name" is displayed correctly, open chrome://settings/certificates and see "Import and Bind to Device…" button is enabled (can be pushed).

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@123956 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

14 months agoFix SpdySession::WriteCredentialFrame ECPrivateKey creation args.
mattm@chromium.org [Tue, 28 Feb 2012 08:06:54 +0000 (08:06 +0000)]
Fix SpdySession::WriteCredentialFrame ECPrivateKey creation args.

It was passing the DER certificate instead of a SubjectPublicKeyInfo.

Also adds ECSignatureCreator::SetFactoryForTesting method to allow
easier testing of code that uses ECSignatureCreator.

BUG=none
TEST=SpdyHttpStreamTest.SendCredentialsEC

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@123940 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

15 months agoProperly parse UTF8Strings in certificates on Windows.
rsleevi@chromium.org [Wed, 15 Feb 2012 06:01:59 +0000 (06:01 +0000)]
Properly parse UTF8Strings in certificates on Windows.

BUG=114168
TEST=https://www.verisign.co.jp appears correctly regardless of system
locale. Additionally, net_unittests:X509TypesTest* should cover this.

Review URL: https://chromiumcodereview.appspot.com/9358080

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@122053 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

15 months agoMake nss/TPM integration in ChromeOS more robust.
stevenjb@chromium.org [Wed, 15 Feb 2012 04:17:00 +0000 (04:17 +0000)]
Make nss/TPM integration in ChromeOS more robust.

Change-Id: I09e942098cb780f110c115f5097f57e8344170cb

BUG=chromium-os:26177
TEST=See issue. Ensure certificates still work with VPN and wifi.

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@122037 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

15 months agomac: Add _EXPORT macros, crypto/.
thakis@chromium.org [Thu, 9 Feb 2012 04:02:33 +0000 (04:02 +0000)]
mac: Add _EXPORT macros, crypto/.

BUG=90078
TEST=none

Review URL: https://chromiumcodereview.appspot.com/9369020

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@121185 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

15 months agoAdd EnsureNSSInit in SymmetricKey::Import.
xhwang@chromium.org [Thu, 9 Feb 2012 02:04:05 +0000 (02:04 +0000)]
Add EnsureNSSInit in SymmetricKey::Import.

BUG=none
TEST=crypto unit tests

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@121152 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

15 months agoUse a forward declaration of RSAPrivateKey in crypto/signature_creator.h.
wtc@chromium.org [Wed, 8 Feb 2012 00:14:54 +0000 (00:14 +0000)]
Use a forward declaration of RSAPrivateKey in crypto/signature_creator.h.

R=rch@chromium.org
BUG=none
TEST=no compilation errors

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@120872 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

15 months agoUpstream: Build crypto_unittests for Android.
jingzhao@chromium.org [Tue, 7 Feb 2012 06:16:47 +0000 (06:16 +0000)]
Upstream: Build crypto_unittests for Android.

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

git-svn-id: http://src.chromium.org/svn/trunk/src/crypto@120727 4ff67af0-8c30-449e-8e8b-ad334ec8d88c