Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Issue 7247005: crypto: add OpenPGP symmetric encryption for ChromeOS (Closed)

Created:
9 years, 6 months ago by agl
Modified:
9 years, 6 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

crypto: add OpenPGP symmetric encryption for ChromeOS This contains a basic implementation of OpenPGP (RFC 4880) symmetric encryption and decryption. It's written specifically on top of OpenSSL, which should suffice for the intended use case. BUG=none TEST=crypto_unittest Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=90633

Patch Set 1 #

Total comments: 34
Unified diffs Side-by-side diffs Delta from patch set Stats (+868 lines, -3 lines) Patch
M crypto/crypto.gyp View 4 chunks +11 lines, -3 lines 0 comments Download
A crypto/openpgp_symmetric_encryption.h View 1 chunk +45 lines, -0 lines 0 comments Download
A crypto/openpgp_symmetric_encryption_openssl.cc View 1 chunk +701 lines, -0 lines 32 comments Download
A crypto/openpgp_symmetric_encryption_test_openssl.cc View 1 chunk +111 lines, -0 lines 2 comments Download

Messages

Total messages: 4 (0 generated)
agl
9 years, 6 months ago (2011-06-23 14:11:45 UTC) #1
Greg Spencer (Chromium)
Most of my comments are around naming, use of unsigned, or inclusion of some links ...
9 years, 6 months ago (2011-06-23 20:55:00 UTC) #2
agl
http://codereview.chromium.org/7247005/diff/1/crypto/openpgp_symmetric_encryption_openssl.cc File crypto/openpgp_symmetric_encryption_openssl.cc (right): http://codereview.chromium.org/7247005/diff/1/crypto/openpgp_symmetric_encryption_openssl.cc#newcode92 crypto/openpgp_symmetric_encryption_openssl.cc:92: base::StringPiece s_; On 2011/06/23 20:55:00, Greg Spencer (Chromium) wrote: ...
9 years, 6 months ago (2011-06-27 20:42:53 UTC) #3
Greg Spencer (Chromium)
9 years, 6 months ago (2011-06-27 21:00:07 UTC) #4
Can you upload a new patch set?  I don't see your changes yet.

http://codereview.chromium.org/7247005/diff/1/crypto/openpgp_symmetric_encryp...
File crypto/openpgp_symmetric_encryption_openssl.cc (right):

http://codereview.chromium.org/7247005/diff/1/crypto/openpgp_symmetric_encryp...
crypto/openpgp_symmetric_encryption_openssl.cc:118: unsigned written = 0;
On 2011/06/27 20:42:53, agl wrote:
> On 2011/06/23 20:55:00, Greg Spencer (Chromium) wrote:
> > Please use uint32_t here (or uint32) and elsewhere, to be more explicit
about
> > the size of the int.  In fact, use of unsigned types is discouraged
generally,
> > except for specific uses.
> 
> Although I don't mind changing unsigned for uint32 everywhere, I'm certainly
not
> going to use signed numbers here. Inappropriate use of signed numbers causes
> horrible bugs, even in the most careful hands. (See the bcrypt bug in OpenBSD
> from last week for example.) 

Well, while I'm not entirely in this camp myself, the style guide is pretty
clear on this point, so you probably will have to use signed types here:

"Decision: You should not use the unsigned integer types such as uint32_t,
unless the quantity you are representing is really a bit pattern rather than a
number, or unless you need defined twos-complement overflow. In particular, do
not use unsigned types to say a number will never be negative. Instead, use
assertions for this."

It's also true that inappropriate use of unsigned types can cause horrible bugs
as well, so given that they are both potentially dangerous, I'm inclined to
follow the style guide.

http://codereview.chromium.org/7247005/diff/1/crypto/openpgp_symmetric_encryp...
crypto/openpgp_symmetric_encryption_openssl.cc:161:
OpenPGPSymmetricEncrytion::Result Decrypt(base::StringPiece in,
On 2011/06/27 20:42:53, agl wrote:
> On 2011/06/23 20:55:00, Greg Spencer (Chromium) wrote:
> > This should be a const reference: const base::StringPiece& in, as should the
> > passphrase argument.
> 
> That's a misguided optimization in non-performance critical code. Using a
const
> reference is even slower on 64-bit platforms.

It's not meant to just be an optimization.  It is also widely used convention in
most Google code to pass read-only parameters this way, and indicates to the
reader which parts are inputs and not modified.

Powered by Google App Engine
This is Rietveld 408576698