Module: wine Branch: master Commit: e1903dc6e06da3fd9faa92fc63e784510ed26626 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e1903dc6e06da3fd9faa92fc63...
Author: Juan Lang juan.lang@gmail.com Date: Tue Oct 20 13:33:15 2009 -0700
crypt32: Encode public keys with NULL parameters if they're empty (and make tests more restrictive).
---
dlls/crypt32/encode.c | 2 +- dlls/crypt32/tests/encode.c | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/dlls/crypt32/encode.c b/dlls/crypt32/encode.c index 93c4a29..3cd2b1e 100644 --- a/dlls/crypt32/encode.c +++ b/dlls/crypt32/encode.c @@ -415,7 +415,7 @@ static BOOL WINAPI CRYPT_AsnEncodePubKeyInfo(DWORD dwCertEncodingType, { const CERT_PUBLIC_KEY_INFO *info = pvStructInfo; struct AsnEncodeSequenceItem items[] = { - { &info->Algorithm, CRYPT_AsnEncodeAlgorithmId, 0 }, + { &info->Algorithm, CRYPT_AsnEncodeAlgorithmIdWithNullParams, 0 }, { &info->PublicKey, CRYPT_AsnEncodeBits, 0 }, };
diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c index 9babafd..1e93dfc 100644 --- a/dlls/crypt32/tests/encode.c +++ b/dlls/crypt32/tests/encode.c @@ -2613,8 +2613,8 @@ static void test_decodeExtensions(DWORD dwEncoding)
/* MS encodes public key info with a NULL if the algorithm identifier's * parameters are empty. However, when encoding an algorithm in a CERT_INFO, - * it encodes them by omitting the algorithm parameters. This latter approach - * seems more correct, so accept either form. + * it encodes them by omitting the algorithm parameters. It accepts either + * form for decoding. */ struct encodedPublicKey { @@ -2692,16 +2692,11 @@ static void test_encodePublicKeyInfo(DWORD dwEncoding) "CryptEncodeObjectEx failed: %08x\n", GetLastError()); if (buf) { - ok(bufSize == pubKeys[i].encoded[1] + 2 || - bufSize == pubKeys[i].encodedNoNull[1] + 2, - "Expected %d or %d bytes, got %d\n", pubKeys[i].encoded[1] + 2, - pubKeys[i].encodedNoNull[1] + 2, bufSize); + ok(bufSize == pubKeys[i].encoded[1] + 2, + "Expected %d bytes, got %d\n", pubKeys[i].encoded[1] + 2, bufSize); if (bufSize == pubKeys[i].encoded[1] + 2) ok(!memcmp(buf, pubKeys[i].encoded, pubKeys[i].encoded[1] + 2), "Unexpected value\n"); - else if (bufSize == pubKeys[i].encodedNoNull[1] + 2) - ok(!memcmp(buf, pubKeys[i].encodedNoNull, - pubKeys[i].encodedNoNull[1] + 2), "Unexpected value\n"); LocalFree(buf); } }