Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/crypt32/tests/main.c | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
diff --git a/dlls/crypt32/tests/main.c b/dlls/crypt32/tests/main.c index 11beff11c4..a490c51e3f 100644 --- a/dlls/crypt32/tests/main.c +++ b/dlls/crypt32/tests/main.c @@ -305,8 +305,32 @@ static void test_readTrustedPublisherDWORD(void)
static void test_getDefaultCryptProv(void) { +#define ALG(id) id, #id + static const struct + { + ALG_ID algid; + const char *name; + BOOL optional; + } test_prov[] = + { + { ALG(CALG_MD2), TRUE }, + { ALG(CALG_MD4), TRUE }, + { ALG(CALG_MD5), TRUE }, + { ALG(CALG_SHA), TRUE }, + { ALG(CALG_RSA_SIGN) }, + { ALG(CALG_DSS_SIGN) }, + { ALG(CALG_NO_SIGN) }, + { ALG(CALG_ECDSA), TRUE }, + { ALG(CALG_ECDH), TRUE }, + { ALG(CALG_RSA_KEYX) }, + { ALG(CALG_RSA_KEYX) }, + }; +#undef ALG HCRYPTPROV (WINAPI *pI_CryptGetDefaultCryptProv)(DWORD w); HCRYPTPROV prov; + BOOL ret; + DWORD size, i; + LPSTR name;
pI_CryptGetDefaultCryptProv = (void *)GetProcAddress(hCrypt, "I_CryptGetDefaultCryptProv"); if (!pI_CryptGetDefaultCryptProv) return; @@ -323,6 +347,34 @@ static void test_getDefaultCryptProv(void) prov = pI_CryptGetDefaultCryptProv(0); ok(prov != 0, "I_CryptGetDefaultCryptProv failed: %08x\n", GetLastError()); CryptReleaseContext(prov, 0); + + for (i = 0; i < ARRAY_SIZE(test_prov); i++) + { + if (winetest_debug > 1) + trace("%u: algid %#x (%s): class %u, type %u, sid %u\n", i, test_prov[i].algid, test_prov[i].name, + GET_ALG_CLASS(test_prov[i].algid) >> 13, GET_ALG_TYPE(test_prov[i].algid) >> 9, GET_ALG_SID(test_prov[i].algid)); + + prov = pI_CryptGetDefaultCryptProv(test_prov[i].algid); + if (!prov) + { +todo_wine_if(!test_prov[i].optional) + ok(test_prov[i].optional, "%u: I_CryptGetDefaultCryptProv(%#x) failed\n", i, test_prov[i].algid); + continue; + } + + ret = CryptGetProvParam(prov, PP_NAME, NULL, &size, 0); + if (ret) /* some provders don't support PP_NAME */ + { + name = CryptMemAlloc(size); + ret = CryptGetProvParam(prov, PP_NAME, (BYTE *)name, &size, 0); + ok(ret, "%u: CryptGetProvParam failed %#x\n", i, GetLastError()); + if (winetest_debug > 1) + trace("%u: algid %#x, name %s\n", i, test_prov[i].algid, name); + CryptMemFree(name); + } + + CryptReleaseContext(prov, 0); + } }
static void test_CryptInstallOssGlobal(void)