Juan Lang : crypt32: Fix encoding OIDs with only two components.
Alexandre Julliard
julliard at winehq.org
Sat Dec 20 06:35:01 CST 2008
Module: wine
Branch: master
Commit: 519478e0485cec9cff58dadc494dfc97ccce7ed9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=519478e0485cec9cff58dadc494dfc97ccce7ed9
Author: Juan Lang <juan.lang at gmail.com>
Date: Fri Dec 19 15:40:35 2008 -0800
crypt32: Fix encoding OIDs with only two components.
---
dlls/crypt32/encode.c | 7 ++++++-
dlls/crypt32/tests/encode.c | 5 +++++
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/dlls/crypt32/encode.c b/dlls/crypt32/encode.c
index 12ab05f..2440d16 100644
--- a/dlls/crypt32/encode.c
+++ b/dlls/crypt32/encode.c
@@ -796,7 +796,7 @@ BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType,
const char *ptr;
int val1, val2;
- if (sscanf(pszObjId, "%d.%d.%n", &val1, &val2, &firstPos) != 2)
+ if (sscanf(pszObjId, "%d.%d%n", &val1, &val2, &firstPos) != 2)
{
SetLastError(CRYPT_E_ASN1_ERROR);
return FALSE;
@@ -804,6 +804,11 @@ BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType,
bytesNeeded++;
firstByte = val1 * 40 + val2;
ptr = pszObjId + firstPos;
+ if (*ptr == '.')
+ {
+ ptr++;
+ firstPos++;
+ }
while (ret && *ptr)
{
int pos;
diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c
index 952e246..bb60798 100644
--- a/dlls/crypt32/tests/encode.c
+++ b/dlls/crypt32/tests/encode.c
@@ -2536,17 +2536,22 @@ static CERT_EXTENSION criticalExt =
{ oid_basic_constraints2, TRUE, { 8, crit_ext_data } };
static CERT_EXTENSION nonCriticalExt =
{ oid_basic_constraints2, FALSE, { 8, noncrit_ext_data } };
+static CHAR oid_short[] = "1.1";
+static CERT_EXTENSION extWithShortOid =
+ { oid_short, FALSE, { 0, NULL } };
static const BYTE ext0[] = { 0x30,0x00 };
static const BYTE ext1[] = { 0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,
0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 };
static const BYTE ext2[] = { 0x30,0x11,0x30,0x0f,0x06,0x03,0x55,0x1d,0x13,0x04,
0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 };
+static const BYTE ext3[] = { 0x30,0x07,0x30,0x05,0x06,0x01,0x29,0x04,0x00 };
static const struct encodedExtensions exts[] = {
{ { 0, NULL }, ext0 },
{ { 1, &criticalExt }, ext1 },
{ { 1, &nonCriticalExt }, ext2 },
+ { { 1, &extWithShortOid }, ext3 }
};
static void test_encodeExtensions(DWORD dwEncoding)
More information about the wine-cvs
mailing list