2 * Unit test suite for crypt32.dll's OID support functions.
4 * Copyright 2005 Juan Lang
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/test.h"
31 static BOOL (WINAPI
*pCryptEnumOIDInfo
)(DWORD
,DWORD
,void*,PFN_CRYPT_ENUM_OID_INFO
);
40 static const struct OIDToAlgID oidToAlgID
[] = {
41 { szOID_RSA_RSA
, CALG_RSA_KEYX
},
42 { szOID_RSA_MD2RSA
, CALG_MD2
},
43 { szOID_RSA_MD4RSA
, CALG_MD4
},
44 { szOID_RSA_MD5RSA
, CALG_MD5
},
45 { szOID_RSA_SHA1RSA
, CALG_SHA
},
46 { szOID_RSA_DH
, CALG_DH_SF
},
47 { szOID_RSA_SMIMEalgESDH
, CALG_DH_EPHEM
},
48 { szOID_RSA_SMIMEalgCMS3DESwrap
, CALG_3DES
},
49 { szOID_RSA_SMIMEalgCMSRC2wrap
, CALG_RC2
},
50 { szOID_RSA_MD2
, CALG_MD2
},
51 { szOID_RSA_MD4
, CALG_MD4
},
52 { szOID_RSA_MD5
, CALG_MD5
},
53 { szOID_RSA_RC2CBC
, CALG_RC2
},
54 { szOID_RSA_RC4
, CALG_RC4
},
55 { szOID_RSA_DES_EDE3_CBC
, CALG_3DES
},
56 { szOID_ANSI_X942_DH
, CALG_DH_SF
},
57 { szOID_X957_DSA
, CALG_DSS_SIGN
},
58 { szOID_X957_SHA1DSA
, CALG_SHA
},
59 { szOID_OIWSEC_md4RSA
, CALG_MD4
},
60 { szOID_OIWSEC_md5RSA
, CALG_MD5
},
61 { szOID_OIWSEC_md4RSA2
, CALG_MD4
},
62 { szOID_OIWSEC_desCBC
, CALG_DES
},
63 { szOID_OIWSEC_dsa
, CALG_DSS_SIGN
},
64 { szOID_OIWSEC_shaDSA
, CALG_SHA
},
65 { szOID_OIWSEC_shaRSA
, CALG_SHA
},
66 { szOID_OIWSEC_sha
, CALG_SHA
},
67 { szOID_OIWSEC_rsaXchg
, CALG_RSA_KEYX
},
68 { szOID_OIWSEC_sha1
, CALG_SHA
},
69 { szOID_OIWSEC_dsaSHA1
, CALG_SHA
},
70 { szOID_OIWSEC_sha1RSASign
, CALG_SHA
},
71 { szOID_OIWDIR_md2RSA
, CALG_MD2
},
72 { szOID_INFOSEC_mosaicUpdatedSig
, CALG_SHA
},
73 { szOID_INFOSEC_mosaicKMandUpdSig
, CALG_DSS_SIGN
},
76 static const struct OIDToAlgID algIDToOID
[] = {
77 { szOID_RSA_RSA
, CALG_RSA_KEYX
},
78 { szOID_RSA_SMIMEalgESDH
, CALG_DH_EPHEM
},
79 { szOID_RSA_MD2
, CALG_MD2
},
80 { szOID_RSA_MD4
, CALG_MD4
},
81 { szOID_RSA_MD5
, CALG_MD5
},
82 { szOID_RSA_RC2CBC
, CALG_RC2
},
83 { szOID_RSA_RC4
, CALG_RC4
},
84 { szOID_RSA_DES_EDE3_CBC
, CALG_3DES
},
85 { szOID_ANSI_X942_DH
, CALG_DH_SF
},
86 { szOID_X957_DSA
, CALG_DSS_SIGN
},
87 { szOID_OIWSEC_desCBC
, CALG_DES
},
88 { szOID_OIWSEC_sha1
, CALG_SHA
},
91 static const WCHAR bogusDll
[] = { 'b','o','g','u','s','.','d','l','l',0 };
92 static const WCHAR bogus2Dll
[] = { 'b','o','g','u','s','2','.','d','l','l',0 };
94 static void testOIDToAlgID(void)
99 /* Test with a bogus one */
100 SetLastError(0xdeadbeef);
101 alg
= CertOIDToAlgId("1.2.3");
102 ok(!alg
&& (GetLastError() == 0xdeadbeef ||
103 GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND
),
104 "Expected ERROR_RESOURCE_NAME_NOT_FOUND or no error set, got %08x\n",
107 for (i
= 0; i
< sizeof(oidToAlgID
) / sizeof(oidToAlgID
[0]); i
++)
109 alg
= CertOIDToAlgId(oidToAlgID
[i
].oid
);
110 /* Not all Windows installations support all these, so make sure it's
111 * at least not the wrong one.
113 ok(alg
== 0 || alg
== oidToAlgID
[i
].algID
,
114 "Expected %d, got %d\n", oidToAlgID
[i
].algID
, alg
);
118 static void testAlgIDToOID(void)
123 /* Test with a bogus one */
124 SetLastError(0xdeadbeef);
125 oid
= CertAlgIdToOID(ALG_CLASS_SIGNATURE
| ALG_TYPE_ANY
| 80);
126 ok(!oid
&& GetLastError() == 0xdeadbeef,
127 "Didn't expect last error (%08x) to be set\n", GetLastError());
128 for (i
= 0; i
< sizeof(algIDToOID
) / sizeof(algIDToOID
[0]); i
++)
130 oid
= CertAlgIdToOID(algIDToOID
[i
].algID
);
131 /* Allow failure, not every version of Windows supports every algo */
133 ok(!strcmp(oid
, algIDToOID
[i
].oid
),
134 "Expected %s, got %s\n", algIDToOID
[i
].oid
, oid
);
138 static void test_oidFunctionSet(void)
140 HCRYPTOIDFUNCSET set1
, set2
;
146 set = CryptInitOIDFunctionSet(NULL, 0);
149 /* The name doesn't mean much */
150 set1
= CryptInitOIDFunctionSet("funky", 0);
151 ok(set1
!= 0, "CryptInitOIDFunctionSet failed: %08x\n", GetLastError());
155 ret = CryptGetDefaultOIDDllList(NULL, 0, NULL, NULL);
156 ret = CryptGetDefaultOIDDllList(NULL, 0, NULL, &size);
159 ret
= CryptGetDefaultOIDDllList(set1
, 0, NULL
, &size
);
160 ok(ret
, "CryptGetDefaultOIDDllList failed: %08x\n", GetLastError());
163 buf
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(WCHAR
));
166 ret
= CryptGetDefaultOIDDllList(set1
, 0, buf
, &size
);
167 ok(ret
, "CryptGetDefaultOIDDllList failed: %08x\n",
169 ok(!*buf
, "Expected empty DLL list\n");
170 HeapFree(GetProcessHeap(), 0, buf
);
175 /* MSDN says flags must be 0, but it's not checked */
176 set1
= CryptInitOIDFunctionSet("", 1);
177 ok(set1
!= 0, "CryptInitOIDFunctionSet failed: %08x\n", GetLastError());
178 set2
= CryptInitOIDFunctionSet("", 0);
179 ok(set2
!= 0, "CryptInitOIDFunctionSet failed: %08x\n", GetLastError());
180 /* There isn't a free function, so there must be only one set per name to
181 * limit leaks. (I guess the sets are freed when crypt32 is unloaded.)
183 ok(set1
== set2
, "Expected identical sets\n");
186 /* The empty name function set used here seems to correspond to
191 /* There's no installed function for a built-in encoding. */
192 set1
= CryptInitOIDFunctionSet("CryptDllEncodeObject", 0);
193 ok(set1
!= 0, "CryptInitOIDFunctionSet failed: %08x\n", GetLastError());
197 HCRYPTOIDFUNCADDR hFuncAddr
;
199 ret
= CryptGetOIDFunctionAddress(set1
, X509_ASN_ENCODING
, X509_CERT
, 0,
200 &funcAddr
, &hFuncAddr
);
201 ok(!ret
&& GetLastError() == ERROR_FILE_NOT_FOUND
,
202 "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
206 typedef int (*funcY
)(int);
208 static int funky(int x
)
213 static void test_installOIDFunctionAddress(void)
216 CRYPT_OID_FUNC_ENTRY entry
= { CRYPT_DEFAULT_OID
, funky
};
217 HCRYPTOIDFUNCSET set
;
220 ret = CryptInstallOIDFunctionAddress(NULL, 0, NULL, 0, NULL, 0);
223 /* Installing zero functions should work */
224 SetLastError(0xdeadbeef);
225 ret
= CryptInstallOIDFunctionAddress(NULL
, 0, "CryptDllEncodeObject", 0,
227 ok(ret
&& GetLastError() == 0xdeadbeef, "Expected success, got %08x\n",
230 /* The function name doesn't much matter */
231 SetLastError(0xdeadbeef);
232 ret
= CryptInstallOIDFunctionAddress(NULL
, 0, "OhSoFunky", 0, NULL
, 0);
233 ok(ret
&& GetLastError() == 0xdeadbeef, "Expected success, got %08x\n",
235 SetLastError(0xdeadbeef);
236 entry
.pszOID
= X509_CERT
;
237 ret
= CryptInstallOIDFunctionAddress(NULL
, 0, "OhSoFunky", 1, &entry
, 0);
238 ok(ret
&& GetLastError() == 0xdeadbeef, "Expected success, got %08x\n",
240 set
= CryptInitOIDFunctionSet("OhSoFunky", 0);
241 ok(set
!= 0, "CryptInitOIDFunctionSet failed: %08x\n", GetLastError());
244 funcY funcAddr
= NULL
;
245 HCRYPTOIDFUNCADDR hFuncAddr
= NULL
;
248 ret = CryptGetOIDFunctionAddress(set, X509_ASN_ENCODING, 0, 0, NULL,
251 ret
= CryptGetOIDFunctionAddress(set
, X509_ASN_ENCODING
, 0, 0,
252 (void **)&funcAddr
, &hFuncAddr
);
253 ok(!ret
&& GetLastError() == ERROR_FILE_NOT_FOUND
,
254 "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
255 ret
= CryptGetOIDFunctionAddress(set
, X509_ASN_ENCODING
, X509_CERT
, 0,
256 (void **)&funcAddr
, &hFuncAddr
);
257 ok(!ret
&& GetLastError() == ERROR_FILE_NOT_FOUND
,
258 "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
259 ret
= CryptGetOIDFunctionAddress(set
, 0, X509_CERT
, 0,
260 (void **)&funcAddr
, &hFuncAddr
);
261 ok(ret
, "CryptGetOIDFunctionAddress failed: %d\n", GetLastError());
264 int y
= funcAddr(0xabadc0da);
266 ok(y
== 0xabadc0da, "Unexpected return (%d) from function\n", y
);
267 CryptFreeOIDFunctionAddress(hFuncAddr
, 0);
272 static void test_registerOIDFunction(void)
276 /* oddly, this succeeds under WinXP; the function name key is merely
277 * omitted. This may be a side effect of the registry code, I don't know.
278 * I don't check it because I doubt anyone would depend on it.
279 ret = CryptRegisterOIDFunction(X509_ASN_ENCODING, NULL,
280 "1.2.3.4.5.6.7.8.9.10", bogusDll, NULL);
282 /* On windows XP, GetLastError is incorrectly being set with an HRESULT,
285 ret
= CryptRegisterOIDFunction(X509_ASN_ENCODING
, "foo", NULL
, bogusDll
,
287 ok(!ret
&& GetLastError() == E_INVALIDARG
,
288 "Expected E_INVALIDARG: %d\n", GetLastError());
289 /* This has no effect, but "succeeds" on XP */
290 ret
= CryptRegisterOIDFunction(X509_ASN_ENCODING
, "foo",
291 "1.2.3.4.5.6.7.8.9.10", NULL
, NULL
);
292 ok(ret
, "Expected pseudo-success, got %d\n", GetLastError());
293 SetLastError(0xdeadbeef);
294 ret
= CryptRegisterOIDFunction(X509_ASN_ENCODING
, "CryptDllEncodeObject",
295 "1.2.3.4.5.6.7.8.9.10", bogusDll
, NULL
);
296 if (!ret
&& GetLastError() == ERROR_ACCESS_DENIED
)
298 skip("Need admin rights\n");
301 ok(ret
, "CryptRegisterOIDFunction failed: %d\n", GetLastError());
302 ret
= CryptUnregisterOIDFunction(X509_ASN_ENCODING
, "CryptDllEncodeObject",
303 "1.2.3.4.5.6.7.8.9.10");
304 ok(ret
, "CryptUnregisterOIDFunction failed: %d\n", GetLastError());
305 ret
= CryptRegisterOIDFunction(X509_ASN_ENCODING
, "bogus",
306 "1.2.3.4.5.6.7.8.9.10", bogusDll
, NULL
);
307 ok(ret
, "CryptRegisterOIDFunction failed: %d\n", GetLastError());
308 ret
= CryptUnregisterOIDFunction(X509_ASN_ENCODING
, "bogus",
309 "1.2.3.4.5.6.7.8.9.10");
310 ok(ret
, "CryptUnregisterOIDFunction failed: %d\n", GetLastError());
311 /* This has no effect */
312 ret
= CryptRegisterOIDFunction(PKCS_7_ASN_ENCODING
, "CryptDllEncodeObject",
313 "1.2.3.4.5.6.7.8.9.10", bogusDll
, NULL
);
314 ok(ret
, "CryptRegisterOIDFunction failed: %d\n", GetLastError());
315 /* Check with bogus encoding type: */
316 ret
= CryptRegisterOIDFunction(0, "CryptDllEncodeObject",
317 "1.2.3.4.5.6.7.8.9.10", bogusDll
, NULL
);
318 ok(ret
, "CryptRegisterOIDFunction failed: %d\n", GetLastError());
319 /* This is written with value 3 verbatim. Thus, the encoding type isn't
320 * (for now) treated as a mask.
322 ret
= CryptRegisterOIDFunction(3, "CryptDllEncodeObject",
323 "1.2.3.4.5.6.7.8.9.10", bogusDll
, NULL
);
324 ok(ret
, "CryptRegisterOIDFunction failed: %d\n", GetLastError());
325 ret
= CryptUnregisterOIDFunction(3, "CryptDllEncodeObject",
326 "1.2.3.4.5.6.7.8.9.10");
327 ok(ret
, "CryptUnregisterOIDFunction failed: %d\n", GetLastError());
330 static void test_registerDefaultOIDFunction(void)
332 static const char fmt
[] =
333 "Software\\Microsoft\\Cryptography\\OID\\EncodingType %d\\%s\\DEFAULT";
334 static const char func
[] = "CertDllOpenStoreProv";
340 ret
= CryptRegisterDefaultOIDFunction(0, NULL
, 0, NULL
);
341 ok(!ret
&& GetLastError() == E_INVALIDARG
,
342 "Expected E_INVALIDARG, got %08x\n", GetLastError());
343 /* This succeeds on WinXP, although the bogus entry is unusable.
344 ret = CryptRegisterDefaultOIDFunction(0, NULL, 0, bogusDll);
346 /* Register one at index 0 */
347 SetLastError(0xdeadbeef);
348 ret
= CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 0,
350 if (!ret
&& GetLastError() == ERROR_ACCESS_DENIED
)
352 skip("Need admin rights\n");
355 ok(ret
, "CryptRegisterDefaultOIDFunction failed: %08x\n", GetLastError());
356 /* Reregistering should fail */
357 ret
= CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 0,
359 ok(!ret
&& GetLastError() == ERROR_FILE_EXISTS
,
360 "Expected ERROR_FILE_EXISTS, got %08x\n", GetLastError());
361 /* Registering the same one at index 1 should also fail */
362 ret
= CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 1,
364 ok(!ret
&& GetLastError() == ERROR_FILE_EXISTS
,
365 "Expected ERROR_FILE_EXISTS, got %08x\n", GetLastError());
366 /* Registering a different one at index 1 succeeds */
367 ret
= CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 1,
369 ok(ret
, "CryptRegisterDefaultOIDFunction failed: %08x\n", GetLastError());
370 sprintf(buf
, fmt
, 0, func
);
371 rc
= RegOpenKeyA(HKEY_LOCAL_MACHINE
, buf
, &key
);
372 ok(rc
== 0, "Expected key to exist, RegOpenKeyA failed: %ld\n", rc
);
375 static const CHAR dllA
[] = "Dll";
376 static const CHAR bogusDll_A
[] = "bogus.dll";
377 static const CHAR bogus2Dll_A
[] = "bogus2.dll";
378 CHAR dllBuf
[MAX_PATH
];
382 size
= sizeof(dllBuf
) / sizeof(dllBuf
[0]);
383 rc
= RegQueryValueExA(key
, dllA
, NULL
, &type
, (LPBYTE
)dllBuf
, &size
);
385 "Expected Dll value to exist, RegQueryValueExA failed: %ld\n", rc
);
386 ok(type
== REG_MULTI_SZ
, "Expected type REG_MULTI_SZ, got %d\n", type
);
387 /* bogusDll was registered first, so that should be first */
389 ok(!lstrcmpiA(ptr
, bogusDll_A
), "Unexpected dll\n");
390 ptr
+= lstrlenA(ptr
) + 1;
391 ok(!lstrcmpiA(ptr
, bogus2Dll_A
), "Unexpected dll\n");
394 /* Unregister both of them */
395 ret
= CryptUnregisterDefaultOIDFunction(0, "CertDllOpenStoreProv",
397 ok(ret
, "CryptUnregisterDefaultOIDFunction failed: %08x\n",
399 ret
= CryptUnregisterDefaultOIDFunction(0, "CertDllOpenStoreProv",
401 ok(ret
, "CryptUnregisterDefaultOIDFunction failed: %08x\n",
403 /* Now that they're both unregistered, unregistering should fail */
404 ret
= CryptUnregisterDefaultOIDFunction(0, "CertDllOpenStoreProv",
406 ok(!ret
&& GetLastError() == ERROR_FILE_NOT_FOUND
,
407 "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
409 /* Repeat a few tests on the normal encoding type */
410 ret
= CryptRegisterDefaultOIDFunction(X509_ASN_ENCODING
,
411 "CertDllOpenStoreProv", 0, bogusDll
);
412 ret
= CryptUnregisterDefaultOIDFunction(X509_ASN_ENCODING
,
413 "CertDllOpenStoreProv", bogusDll
);
414 ok(ret
, "CryptUnregisterDefaultOIDFunction failed\n");
415 ret
= CryptUnregisterDefaultOIDFunction(X509_ASN_ENCODING
,
416 "CertDllOpenStoreProv", bogusDll
);
417 ok(!ret
&& GetLastError() == ERROR_FILE_NOT_FOUND
,
418 "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
421 static void test_getDefaultOIDFunctionAddress(void)
424 HCRYPTOIDFUNCSET set
;
426 HCRYPTOIDFUNCADDR hFuncAddr
;
429 ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, NULL, NULL);
430 ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, &funcAddr, NULL);
431 ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, NULL, &hFuncAddr);
432 ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, &funcAddr,
435 set
= CryptInitOIDFunctionSet("CertDllOpenStoreProv", 0);
436 ok(set
!= 0, "CryptInitOIDFunctionSet failed: %d\n", GetLastError());
437 /* This crashes if hFuncAddr is not 0 to begin with */
439 ret
= CryptGetDefaultOIDFunctionAddress(set
, 0, NULL
, 0, &funcAddr
,
441 ok(!ret
&& GetLastError() == ERROR_FILE_NOT_FOUND
,
442 "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
443 /* This fails with the normal encoding too, so built-in functions aren't
446 ret
= CryptGetDefaultOIDFunctionAddress(set
, X509_ASN_ENCODING
, NULL
, 0,
447 &funcAddr
, &hFuncAddr
);
448 ok(!ret
&& GetLastError() == ERROR_FILE_NOT_FOUND
,
449 "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
451 /* Even with a registered dll, this fails (since the dll doesn't exist) */
452 ret
= CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 0,
454 ok(ret
, "CryptRegisterDefaultOIDFunction failed: %08x\n", GetLastError());
455 ret
= CryptGetDefaultOIDFunctionAddress(set
, 0, NULL
, 0, &funcAddr
,
457 ok(!ret
&& GetLastError() == ERROR_FILE_NOT_FOUND
,
458 "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
459 CryptUnregisterDefaultOIDFunction(0, "CertDllOpenStoreProv", bogusDll
);
462 static BOOL WINAPI
countOidInfo(PCCRYPT_OID_INFO pInfo
, void *pvArg
)
468 static BOOL WINAPI
noOidInfo(PCCRYPT_OID_INFO pInfo
, void *pvArg
)
473 static void test_enumOIDInfo(void)
478 if (!pCryptEnumOIDInfo
)
480 skip("CryptEnumOIDInfo() is not available\n");
485 ret = pCryptEnumOIDInfo(7, 0, NULL, NULL);
488 /* Silly tests, check that more than one thing is enumerated */
489 ret
= pCryptEnumOIDInfo(0, 0, &count
, countOidInfo
);
490 ok(ret
&& count
> 0, "Expected more than item enumerated\n");
491 ret
= pCryptEnumOIDInfo(0, 0, NULL
, noOidInfo
);
492 ok(!ret
, "Expected FALSE\n");
495 static void test_findOIDInfo(void)
497 static WCHAR sha1
[] = { 's','h','a','1',0 };
498 static CHAR oid_rsa_md5
[] = szOID_RSA_MD5
;
499 ALG_ID alg
= CALG_SHA1
;
500 ALG_ID algs
[2] = { CALG_MD5
, CALG_RSA_SIGN
};
501 PCCRYPT_OID_INFO info
;
503 info
= CryptFindOIDInfo(0, NULL
, 0);
504 ok(info
== NULL
, "Expected NULL\n");
505 info
= CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY
, oid_rsa_md5
, 0);
506 ok(info
!= NULL
, "Expected to find szOID_RSA_MD5\n");
509 ok(!strcmp(info
->pszOID
, szOID_RSA_MD5
), "Expected %s, got %s\n",
510 szOID_RSA_MD5
, info
->pszOID
);
511 ok(U(*info
).Algid
== CALG_MD5
, "Expected CALG_MD5, got %d\n",
514 info
= CryptFindOIDInfo(CRYPT_OID_INFO_NAME_KEY
, sha1
, 0);
515 ok(info
!= NULL
, "Expected to find sha1\n");
518 ok(!strcmp(info
->pszOID
, szOID_OIWSEC_sha1
), "Expected %s, got %s\n",
519 szOID_OIWSEC_sha1
, info
->pszOID
);
520 ok(U(*info
).Algid
== CALG_SHA1
, "Expected CALG_SHA1, got %d\n",
523 info
= CryptFindOIDInfo(CRYPT_OID_INFO_ALGID_KEY
, &alg
, 0);
524 ok(info
!= NULL
, "Expected to find sha1\n");
527 ok(!strcmp(info
->pszOID
, szOID_OIWSEC_sha1
), "Expected %s, got %s\n",
528 szOID_OIWSEC_sha1
, info
->pszOID
);
529 ok(U(*info
).Algid
== CALG_SHA1
, "Expected CALG_SHA1, got %d\n",
532 info
= CryptFindOIDInfo(CRYPT_OID_INFO_SIGN_KEY
, algs
, 0);
533 ok(info
!= NULL
, "Expected to find md5RSA\n");
536 ok(!strcmp(info
->pszOID
, szOID_RSA_MD5RSA
), "Expected %s, got %s\n",
537 szOID_RSA_MD5RSA
, info
->pszOID
);
538 ok(U(*info
).Algid
== CALG_MD5
, "Expected CALG_MD5, got %d\n",
545 HMODULE hCrypt32
= GetModuleHandleA("crypt32.dll");
546 pCryptEnumOIDInfo
= (void*)GetProcAddress(hCrypt32
, "CryptEnumOIDInfo");
552 test_oidFunctionSet();
553 test_installOIDFunctionAddress();
554 test_registerOIDFunction();
555 test_registerDefaultOIDFunction();
556 test_getDefaultOIDFunctionAddress();