From 0472c7eb21a2ae50bb28287fda899b12eaa900f2 Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Fri, 19 Jun 2009 21:40:55 +0000 Subject: 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 --- base/crypto/rsa_private_key_win.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'base') 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* 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); -- cgit v1.1