summaryrefslogtreecommitdiffstats
path: root/base/crypto
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-19 21:40:55 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-19 21:40:55 +0000
commit0472c7eb21a2ae50bb28287fda899b12eaa900f2 (patch)
tree4c31ae4bbeb5c05010e383a6e26a9e9f8612a1da /base/crypto
parentc0295d2e3e371808871f54c19082ab3ff5348f83 (diff)
downloadchromium_src-0472c7eb21a2ae50bb28287fda899b12eaa900f2.zip
chromium_src-0472c7eb21a2ae50bb28287fda899b12eaa900f2.tar.gz
chromium_src-0472c7eb21a2ae50bb28287fda899b12eaa900f2.tar.bz2
Minor no-op change to ASN.1 encoding of private key.
The logic for when to prepend a null byte to integers was reversed. Fortunately, this had no impact on anything, because: a) We ignore the null byte on the parse side because we know the integers we're interested in are always unsigned. b) It appears openssl does the same thing (I tried it both ways and it always came up with the same private key data). Still, better to be correct. Also, re-enable previously disabled unit tests. BUG=14640 Review URL: http://codereview.chromium.org/131095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18855 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/crypto')
-rw-r--r--base/crypto/rsa_private_key_win.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/base/crypto/rsa_private_key_win.cc b/base/crypto/rsa_private_key_win.cc
index e963f7f..c29c5ce 100644
--- a/base/crypto/rsa_private_key_win.cc
+++ b/base/crypto/rsa_private_key_win.cc
@@ -83,8 +83,8 @@ static void PrependTypeHeaderAndLength(uint8 type, uint32 length,
// Helper to prepend an ASN.1 integer.
static void PrependInteger(uint8* val, int num_bytes, std::list<uint8>* data) {
- // If the MSB is set, we need an extra null byte at the front.
- bool needs_null_byte = !(val[num_bytes - 1] & 0x80);
+ // If the MSB is set, we are supposed to add an extra null byte at the front.
+ bool needs_null_byte = (val[num_bytes - 1] & 0x80) != 0;
int length = needs_null_byte ? num_bytes + 1 : num_bytes;
PrependBytesInReverseOrder(val, num_bytes, data);