crypt32: Support an alternate OID in order to fix a test on some Windows 98 systems.

This commit is contained in:
Juan Lang 2009-02-11 20:33:25 -08:00 committed by Alexandre Julliard
parent 1137d630a6
commit b972a5d355
1 changed files with 66 additions and 47 deletions

View File

@ -34,58 +34,59 @@ static BOOL (WINAPI *pCryptEnumOIDInfo)(DWORD,DWORD,void*,PFN_CRYPT_ENUM_OID_INF
struct OIDToAlgID
{
LPCSTR oid;
LPCSTR altOid;
DWORD algID;
};
static const struct OIDToAlgID oidToAlgID[] = {
{ szOID_RSA_RSA, CALG_RSA_KEYX },
{ szOID_RSA_MD2RSA, CALG_MD2 },
{ szOID_RSA_MD4RSA, CALG_MD4 },
{ szOID_RSA_MD5RSA, CALG_MD5 },
{ szOID_RSA_SHA1RSA, CALG_SHA },
{ szOID_RSA_DH, CALG_DH_SF },
{ szOID_RSA_SMIMEalgESDH, CALG_DH_EPHEM },
{ szOID_RSA_SMIMEalgCMS3DESwrap, CALG_3DES },
{ szOID_RSA_SMIMEalgCMSRC2wrap, CALG_RC2 },
{ szOID_RSA_MD2, CALG_MD2 },
{ szOID_RSA_MD4, CALG_MD4 },
{ szOID_RSA_MD5, CALG_MD5 },
{ szOID_RSA_RC2CBC, CALG_RC2 },
{ szOID_RSA_RC4, CALG_RC4 },
{ szOID_RSA_DES_EDE3_CBC, CALG_3DES },
{ szOID_ANSI_X942_DH, CALG_DH_SF },
{ szOID_X957_DSA, CALG_DSS_SIGN },
{ szOID_X957_SHA1DSA, CALG_SHA },
{ szOID_OIWSEC_md4RSA, CALG_MD4 },
{ szOID_OIWSEC_md5RSA, CALG_MD5 },
{ szOID_OIWSEC_md4RSA2, CALG_MD4 },
{ szOID_OIWSEC_desCBC, CALG_DES },
{ szOID_OIWSEC_dsa, CALG_DSS_SIGN },
{ szOID_OIWSEC_shaDSA, CALG_SHA },
{ szOID_OIWSEC_shaRSA, CALG_SHA },
{ szOID_OIWSEC_sha, CALG_SHA },
{ szOID_OIWSEC_rsaXchg, CALG_RSA_KEYX },
{ szOID_OIWSEC_sha1, CALG_SHA },
{ szOID_OIWSEC_dsaSHA1, CALG_SHA },
{ szOID_OIWSEC_sha1RSASign, CALG_SHA },
{ szOID_OIWDIR_md2RSA, CALG_MD2 },
{ szOID_INFOSEC_mosaicUpdatedSig, CALG_SHA },
{ szOID_INFOSEC_mosaicKMandUpdSig, CALG_DSS_SIGN },
{ szOID_RSA_RSA, NULL, CALG_RSA_KEYX },
{ szOID_RSA_MD2RSA, NULL, CALG_MD2 },
{ szOID_RSA_MD4RSA, NULL, CALG_MD4 },
{ szOID_RSA_MD5RSA, NULL, CALG_MD5 },
{ szOID_RSA_SHA1RSA, NULL, CALG_SHA },
{ szOID_RSA_DH, NULL, CALG_DH_SF },
{ szOID_RSA_SMIMEalgESDH, NULL, CALG_DH_EPHEM },
{ szOID_RSA_SMIMEalgCMS3DESwrap, NULL, CALG_3DES },
{ szOID_RSA_SMIMEalgCMSRC2wrap, NULL, CALG_RC2 },
{ szOID_RSA_MD2, NULL, CALG_MD2 },
{ szOID_RSA_MD4, NULL, CALG_MD4 },
{ szOID_RSA_MD5, NULL, CALG_MD5 },
{ szOID_RSA_RC2CBC, NULL, CALG_RC2 },
{ szOID_RSA_RC4, NULL, CALG_RC4 },
{ szOID_RSA_DES_EDE3_CBC, NULL, CALG_3DES },
{ szOID_ANSI_X942_DH, NULL, CALG_DH_SF },
{ szOID_X957_DSA, NULL, CALG_DSS_SIGN },
{ szOID_X957_SHA1DSA, NULL, CALG_SHA },
{ szOID_OIWSEC_md4RSA, NULL, CALG_MD4 },
{ szOID_OIWSEC_md5RSA, NULL, CALG_MD5 },
{ szOID_OIWSEC_md4RSA2, NULL, CALG_MD4 },
{ szOID_OIWSEC_desCBC, NULL, CALG_DES },
{ szOID_OIWSEC_dsa, NULL, CALG_DSS_SIGN },
{ szOID_OIWSEC_shaDSA, NULL, CALG_SHA },
{ szOID_OIWSEC_shaRSA, NULL, CALG_SHA },
{ szOID_OIWSEC_sha, NULL, CALG_SHA },
{ szOID_OIWSEC_rsaXchg, NULL, CALG_RSA_KEYX },
{ szOID_OIWSEC_sha1, NULL, CALG_SHA },
{ szOID_OIWSEC_dsaSHA1, NULL, CALG_SHA },
{ szOID_OIWSEC_sha1RSASign, NULL, CALG_SHA },
{ szOID_OIWDIR_md2RSA, NULL, CALG_MD2 },
{ szOID_INFOSEC_mosaicUpdatedSig, NULL, CALG_SHA },
{ szOID_INFOSEC_mosaicKMandUpdSig, NULL, CALG_DSS_SIGN },
};
static const struct OIDToAlgID algIDToOID[] = {
{ szOID_RSA_RSA, CALG_RSA_KEYX },
{ szOID_RSA_SMIMEalgESDH, CALG_DH_EPHEM },
{ szOID_RSA_MD2, CALG_MD2 },
{ szOID_RSA_MD4, CALG_MD4 },
{ szOID_RSA_MD5, CALG_MD5 },
{ szOID_RSA_RC2CBC, CALG_RC2 },
{ szOID_RSA_RC4, CALG_RC4 },
{ szOID_RSA_DES_EDE3_CBC, CALG_3DES },
{ szOID_ANSI_X942_DH, CALG_DH_SF },
{ szOID_X957_DSA, CALG_DSS_SIGN },
{ szOID_OIWSEC_desCBC, CALG_DES },
{ szOID_OIWSEC_sha1, CALG_SHA },
{ szOID_RSA_RSA, NULL, CALG_RSA_KEYX },
{ szOID_RSA_SMIMEalgESDH, NULL, CALG_DH_EPHEM },
{ szOID_RSA_MD2, NULL, CALG_MD2 },
{ szOID_RSA_MD4, NULL, CALG_MD4 },
{ szOID_RSA_MD5, NULL, CALG_MD5 },
{ szOID_RSA_RC2CBC, NULL, CALG_RC2 },
{ szOID_RSA_RC4, NULL, CALG_RC4 },
{ szOID_RSA_DES_EDE3_CBC, NULL, CALG_3DES },
{ szOID_ANSI_X942_DH, NULL, CALG_DH_SF },
{ szOID_X957_DSA, szOID_OIWSEC_dsa /* some Win98 */, CALG_DSS_SIGN },
{ szOID_OIWSEC_desCBC, NULL, CALG_DES },
{ szOID_OIWSEC_sha1, NULL, CALG_SHA },
};
static const WCHAR bogusDll[] = { 'b','o','g','u','s','.','d','l','l',0 };
@ -134,8 +135,26 @@ static void testAlgIDToOID(void)
oid = CertAlgIdToOID(algIDToOID[i].algID);
/* Allow failure, not every version of Windows supports every algo */
if (oid)
ok(!strcmp(oid, algIDToOID[i].oid),
"Expected %s, got %s\n", algIDToOID[i].oid, oid);
{
if (strcmp(oid, algIDToOID[i].oid))
{
if (algIDToOID[i].altOid)
ok(!strcmp(oid, algIDToOID[i].oid) ||
!strcmp(oid, algIDToOID[i].altOid),
"Expected %s or %s, got %s\n", algIDToOID[i].oid,
algIDToOID[i].altOid, oid);
else
{
/* No need to rerun the test, we already know it failed. */
ok(0, "Expected %s, got %s\n", algIDToOID[i].oid, oid);
}
}
else
{
/* No need to rerun the test, we already know it succeeded. */
ok(1, "Expected %s, got %s\n", algIDToOID[i].oid, oid);
}
}
}
}