39#define ENHANCED_PROV (iProv == 0)
40#define BASE_PROV (iProv == 1)
41#define STRONG_PROV (iProv == 2)
53 {
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',0x2,0x2,
'k',
'l',0},
56 {
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',0x2,0x2,0},
59 {
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',0},
62 {
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',0},
76 static const char szContainer_md5[] =
"9d20fd8d05ed2b8455d125d0bf6d6a70";
77 static const char szCryptography[] =
"Software\\Microsoft\\Cryptography";
78 static const char szMachineGuid[] =
"MachineGuid";
107 for (
i = 0;
i < dwLen-7;
i+=8) {
108 trace(
"0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
112 for (
j=0;
i<dwLen;
j++,
i++) {
116 trace(
"%s\n", szTemp);
137 win_skip(
"RSA full provider not available\n");
145 win_skip(
"Couldn't create crypto provider\n");
190 win_skip(
"RSA_AES provider not supported\n");
236 dwLen =
sizeof(
DWORD);
241 dwLen =
sizeof(
DWORD);
250 BYTE rnd1[16], rnd2[16];
252 memset(rnd1, 0,
sizeof(rnd1));
253 memset(rnd2, 0,
sizeof(rnd2));
261 ok(
memcmp(rnd1, rnd2,
sizeof(rnd1)),
"CryptGenRandom generates non random data\n");
268 unsigned char pbData[2000];
272 for (
i=0;
i<2000;
i++)
pbData[
i] = (
unsigned char)
i;
287 0x07, 0x02, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00,
288 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00,
289 0x01, 0x00, 0x01, 0x00, 0x9b, 0x64, 0xef, 0xce,
290 0x31, 0x7c, 0xad, 0x56, 0xe2, 0x1e, 0x9b, 0x96,
291 0xb3, 0xf0, 0x29, 0x88, 0x6e, 0xa8, 0xc2, 0x11,
292 0x33, 0xd6, 0xcc, 0x8c, 0x69, 0xb2, 0x1a, 0xfd,
293 0xfc, 0x23, 0x21, 0x30, 0x4d, 0x29, 0x45, 0xb6,
294 0x3a, 0x67, 0x11, 0x80, 0x1a, 0x91, 0xf2, 0x9f,
295 0x01, 0xac, 0xc0, 0x11, 0x50, 0x5f, 0xcd, 0xb9,
296 0xad, 0x76, 0x9f, 0x6e, 0x91, 0x55, 0x71, 0xda,
297 0x97, 0x96, 0x96, 0x22, 0x75, 0xb4, 0x83, 0x44,
298 0x89, 0x9e, 0xf8, 0x44, 0x40, 0x7c, 0xd6, 0xcd,
299 0x9d, 0x88, 0xd6, 0x88, 0xbc, 0x56, 0xb7, 0x64,
300 0xe9, 0x2c, 0x24, 0x2f, 0x0d, 0x78, 0x55, 0x1c,
301 0xb2, 0x67, 0xb1, 0x5e, 0xbc, 0x0c, 0xcf, 0x1c,
302 0xe9, 0xd3, 0x9e, 0xa2, 0x15, 0x24, 0x73, 0xd6,
303 0xdb, 0x6f, 0x83, 0xb2, 0xf8, 0xbc, 0xe7, 0x47,
304 0x3b, 0x01, 0xef, 0x49, 0x08, 0x98, 0xd6, 0xa3,
305 0xf9, 0x25, 0x57, 0xe9, 0x39, 0x3c, 0x53, 0x30,
306 0x1b, 0xf2, 0xc9, 0x62, 0x31, 0x43, 0x5d, 0x84,
307 0x24, 0x30, 0x21, 0x9a, 0xad, 0xdb, 0x62, 0x91,
308 0xc8, 0x07, 0xd9, 0x2f, 0xd6, 0xb5, 0x37, 0x6f,
309 0xfe, 0x7a, 0x12, 0xbc, 0xd9, 0xd2, 0x2b, 0xbf,
310 0xd7, 0xb1, 0xfa, 0x7d, 0xc0, 0x48, 0xdd, 0x74,
311 0xdd, 0x55, 0x04, 0xa1, 0x8b, 0xc1, 0x0a, 0xc4,
312 0xa5, 0x57, 0x62, 0xee, 0x08, 0x8b, 0xf9, 0x19,
313 0x6c, 0x52, 0x06, 0xf8, 0x73, 0x0f, 0x24, 0xc9,
314 0x71, 0x9f, 0xc5, 0x45, 0x17, 0x3e, 0xae, 0x06,
315 0x81, 0xa2, 0x96, 0x40, 0x06, 0xbf, 0xeb, 0x9e,
316 0x80, 0x2b, 0x27, 0x20, 0x8f, 0x38, 0xcf, 0xeb,
317 0xff, 0x3b, 0x38, 0x41, 0x35, 0x69, 0x66, 0x13,
318 0x1d, 0x3c, 0x01, 0x3b, 0xf6, 0x37, 0xca, 0x9c,
319 0x61, 0x74, 0x98, 0xcf, 0xc9, 0x6e, 0xe8, 0x90,
320 0xc7, 0xb7, 0x33, 0xc0, 0x07, 0x3c, 0xf8, 0xc8,
321 0xf6, 0xf2, 0xd7, 0xf0, 0x21, 0x62, 0x58, 0x8a,
322 0x55, 0xbf, 0xa1, 0x2d, 0x3d, 0xa6, 0x69, 0xc5,
323 0x02, 0x19, 0x31, 0xf0, 0x94, 0x0f, 0x45, 0x5c,
324 0x95, 0x1b, 0x53, 0xbc, 0xf5, 0xb0, 0x1a, 0x8f,
325 0xbf, 0x40, 0xe0, 0xc7, 0x73, 0xe7, 0x72, 0x6e,
326 0xeb, 0xb1, 0x0f, 0x38, 0xc5, 0xf8, 0xee, 0x04,
327 0xed, 0x34, 0x1a, 0x10, 0xf9, 0x53, 0x34, 0xf3,
328 0x3e, 0xe6, 0x5c, 0xd1, 0x47, 0x65, 0xcd, 0xbd,
329 0xf1, 0x06, 0xcb, 0xb4, 0xb1, 0x26, 0x39, 0x9f,
330 0x71, 0xfe, 0x3d, 0xf8, 0x62, 0xab, 0x22, 0x8b,
331 0x0e, 0xdc, 0xb9, 0xe8, 0x74, 0x06, 0xfc, 0x8c,
332 0x25, 0xa1, 0xa9, 0xcf, 0x07, 0xf9, 0xac, 0x21,
333 0x01, 0x7b, 0x1c, 0xdc, 0x94, 0xbd, 0x47, 0xe1,
334 0xa0, 0x86, 0x59, 0x35, 0x6a, 0x6f, 0xb9, 0x70,
335 0x26, 0x7c, 0x3c, 0xfd, 0xbd, 0x81, 0x39, 0x36,
336 0x42, 0xc2, 0xbd, 0xbe, 0x84, 0x27, 0x9a, 0x69,
337 0x81, 0xda, 0x99, 0x27, 0xc2, 0x4f, 0x62, 0x33,
338 0xf4, 0x79, 0x30, 0xc5, 0x63, 0x54, 0x71, 0xf1,
339 0x47, 0x22, 0x25, 0x9b, 0x6c, 0x00, 0x2f, 0x1c,
340 0xf4, 0x1f, 0x85, 0xbc, 0xf6, 0x67, 0x6a, 0xe3,
341 0xf6, 0x55, 0x8a, 0xef, 0xd0, 0x0b, 0xd3, 0xa2,
342 0xc5, 0x51, 0x70, 0x15, 0x0a, 0xf0, 0x98, 0x4c,
343 0xb7, 0x19, 0x62, 0x0e, 0x2d, 0x2a, 0x4a, 0x7d,
344 0x7a, 0x0a, 0xc4, 0x17, 0xe3, 0x5d, 0x20, 0x52,
345 0xa9, 0x98, 0xc3, 0xaa, 0x11, 0xf6, 0xbf, 0x4c,
346 0x94, 0x99, 0x81, 0x89, 0xf0, 0x7f, 0x66, 0xaa,
347 0xc8, 0x88, 0xd7, 0x31, 0x84, 0x71, 0xb6, 0x64,
348 0x09, 0x76, 0x0b, 0x7f, 0x1a, 0x1f, 0x2e, 0xfe,
349 0xcd, 0x59, 0x2a, 0x54, 0x11, 0x84, 0xd4, 0x6a,
350 0x61, 0xdf, 0xaa, 0x76, 0x66, 0x9d, 0x82, 0x11,
351 0x56, 0x3d, 0xd2, 0x52, 0xe6, 0x42, 0x5a, 0x77,
352 0x92, 0x98, 0x34, 0xf3, 0x56, 0x6c, 0x96, 0x10,
353 0x40, 0x59, 0x16, 0xcb, 0x77, 0x61, 0xe3, 0xbf,
354 0x4b, 0xd4, 0x39, 0xfb, 0xb1, 0x4e, 0xc1, 0x74,
355 0xec, 0x7a, 0xea, 0x3d, 0x68, 0xbb, 0x0b, 0xe6,
356 0xc6, 0x06, 0xbf, 0xdd, 0x7f, 0x94, 0x42, 0xc0,
357 0x0f, 0xe4, 0x92, 0x33, 0x6c, 0x6e, 0x1b, 0xba,
358 0x73, 0xf9, 0x79, 0x84, 0xdf, 0x45, 0x00, 0xe4,
359 0x94, 0x88, 0x9d, 0x08, 0x89, 0xcf, 0xf2, 0xa4,
360 0xc5, 0x47, 0x45, 0x85, 0x86, 0xa5, 0xcc, 0xa8,
361 0xf2, 0x5d, 0x58, 0x07
366 static const unsigned char md2hash[16] = {
367 0x12, 0xcb, 0x1b, 0x08, 0xc8, 0x48, 0xa4, 0xa9,
368 0xaa, 0xf3, 0xf1, 0x9f, 0xfc, 0x29, 0x28, 0x68 };
369 static const unsigned char md4hash[16] = {
370 0x8e, 0x2a, 0x58, 0xbf, 0xf2, 0xf5, 0x26, 0x23,
371 0x79, 0xd2, 0x92, 0x36, 0x1b, 0x23, 0xe3, 0x81 };
372 static const unsigned char empty_md5hash[16] = {
373 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
374 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e };
375 static const unsigned char md5hash[16] = {
376 0x15, 0x76, 0xa9, 0x4d, 0x6c, 0xb3, 0x34, 0xdd,
377 0x12, 0x6c, 0xb1, 0xc2, 0x7f, 0x19, 0xe0, 0xf2 };
378 static const unsigned char sha1hash[20] = {
379 0xf1, 0x0c, 0xcf, 0xde, 0x60, 0xc1, 0x7d, 0xb2, 0x6e, 0x7d,
380 0x85, 0xd3, 0x56, 0x65, 0xc7, 0x66, 0x1d, 0xbb, 0xeb, 0x2c };
381 static const unsigned char signed_ssl3_shamd5_hash[] = {
382 0x4f,0xcc,0x2f,0x33,0x44,0x60,0x76,0x16,0x13,0xc8,0xff,0xd4,0x59,0x19,
383 0xde,0x85,0x44,0x72,0x47,0x98,0x01,0xfb,0x67,0x5c,0x5b,0x35,0x15,0x0f,
384 0x91,0xda,0xc7,0x7c,0xfb,0xe2,0x18,0xef,0xac,0x31,0x40,0x7b,0xa9,0x83,
385 0xdb,0x30,0xcd,0x94,0x4b,0x8e,0x3b,0x6c,0x7a,0x86,0x59,0xf0,0xd1,0xd2,
386 0x5e,0xce,0xd4,0x1b,0x7f,0xed,0x24,0xee,0x53,0x5c,0x15,0x97,0x21,0x7c,
387 0x5c,0xea,0xab,0xf5,0xd6,0x4b,0xb3,0xbb,0x14,0xf5,0x59,0x9e,0x21,0x90,
388 0x21,0x99,0x19,0xad,0xa2,0xa6,0xea,0x61,0xc1,0x41,0xe2,0x70,0x77,0xf7,
389 0x15,0x68,0x96,0x1e,0x5c,0x84,0x97,0xe3,0x5c,0xd2,0xd9,0xfb,0x87,0x6f,
390 0x11,0x21,0x82,0x43,0x76,0x32,0xa4,0x38,0x7b,0x85,0x22,0x30,0x1e,0x55,
392 unsigned char pbData[2048];
396 BYTE pbHashValue[36];
397 BYTE pbSigValue[128];
402 for (
i=0;
i<2048;
i++)
pbData[
i] = (
unsigned char)
i;
418 ok(!
memcmp(pbHashValue, md2hash, 16),
"Wrong MD2 hash!\n");
442 ok(!
memcmp(pbHashValue, md4hash, 16),
"Wrong MD4 hash!\n");
465 ok(!
memcmp(pbHashValue, md5hash, 16),
"Wrong MD5 hash!\n");
478 ok(!
memcmp(pbHashValue, empty_md5hash, 16),
"Wrong MD5 hash!\n");
484 ok(!
memcmp(pbHashValue, empty_md5hash, 16),
"Wrong MD5 hash!\n");
491 "Expected NTE_BAD_HASH_STATE or NTE_BAD_ALGID, got %08lx\n",
GetLastError());
497 ok(!
memcmp(pbHashValue, empty_md5hash, 16),
"Wrong MD5 hash!\n");
523 ok(!
memcmp(pbHashValue, sha1hash, 20),
"Wrong SHA1 hash!\n");
554 ok(!
result,
"CryptHashData succeeded\n");
560 ok(!
result,
"CryptDestroyHash succeeded\n");
631 ok(
len == 128,
"expected len 128, got %ld\n",
len);
634 ok(!
memcmp(pbSigValue, signed_ssl3_shamd5_hash,
len),
"unexpected value\n");
635 if (
len != 128 ||
memcmp(pbSigValue, signed_ssl3_shamd5_hash,
len))
637 printBytes(
"expected", signed_ssl3_shamd5_hash,
638 sizeof(signed_ssl3_shamd5_hash));
651 static const BYTE plain[23] = {
652 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
653 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 };
654 static const BYTE ecb[24] = {
655 0xc0, 0x9a, 0xe4, 0x2f, 0x0a, 0x47, 0x67, 0x11, 0xf2, 0xb2, 0x5d, 0x5f,
656 0x08, 0xff, 0x49, 0xa4, 0x45, 0x3a, 0x68, 0x14, 0xca, 0x18, 0xe5, 0xf4 };
657 static const BYTE cbc[24] = {
658 0xc0, 0x9a, 0xe4, 0x2f, 0x0a, 0x47, 0x67, 0x11, 0x10, 0xf5, 0xda, 0x61,
659 0x4e, 0x3d, 0xab, 0xc0, 0x97, 0x85, 0x01, 0x12, 0x97, 0xa4, 0xf7, 0xd3 };
660 static const BYTE cfb[24] = {
661 0x29, 0xb5, 0x67, 0x85, 0x0b, 0x1b, 0xec, 0x07, 0x67, 0x2d, 0xa1, 0xa4,
662 0x1a, 0x47, 0x24, 0x6a, 0x54, 0xe1, 0xe0, 0x92, 0xf9, 0x0e, 0xf6, 0xeb };
671 memcpy(abData, plain,
sizeof(plain));
675 dwLen =
sizeof(dwMode);
686 ok(dwLen == 11,
"unexpected salt length %ld\n", dwLen);
691 ok(dwLen == 24,
"Unexpected length %ld\n", dwLen);
700 ok(
result && dwLen == 23 && !
memcmp(plain, abData,
sizeof(plain)),
710 ok(dwLen == 24,
"Unexpected length %ld\n", dwLen);
718 ok(
result && dwLen == 23 && !
memcmp(plain, abData,
sizeof(plain)),
744 ok(
result && dwLen == 15 && !
memcmp(plain, abData,
sizeof(plain)),
751 ok(
broken(1),
"OFB mode not supported\n");
770 unsigned char pbData[16], enc_data[16], bad_data[16];
771 static const BYTE des112[16] = {
772 0x8e, 0x0c, 0x3c, 0xa3, 0x05, 0x88, 0x5f, 0x7a,
773 0x32, 0xa1, 0x06, 0x52, 0x64, 0xd2, 0x44, 0x1c };
785 ok(!
memcmp(
pbData, des112,
sizeof(des112)),
"3DES_112 encryption failed!\n");
827 ok(!
result,
"CryptDecrypt should failed!\n");
855 unsigned char pbData[16], enc_data[16], bad_data[16];
856 static const BYTE des[16] = {
857 0x58, 0x86, 0x42, 0x46, 0x65, 0x4b, 0x92, 0x62,
858 0xcf, 0x0f, 0x65, 0x37, 0x43, 0x7a, 0x82, 0xb9 };
868 dwLen =
sizeof(
DWORD);
879 ok(!
memcmp(
pbData, des,
sizeof(des)),
"DES encryption failed!\n");
921 ok(!
result,
"CryptDecrypt should failed!\n");
956 ok(!
memcmp(
pbData, des,
sizeof(des)),
"DES encryption failed!\n");
967 unsigned char pbData[16], enc_data[16], bad_data[16];
968 static const BYTE des3[16] = {
969 0x7b, 0xba, 0xdd, 0xa2, 0x39, 0xd3, 0x7b, 0xb3,
970 0xc7, 0x51, 0x81, 0x41, 0x53, 0xe8, 0xcf, 0xeb };
982 ok(!
memcmp(
pbData, des3,
sizeof(des3)),
"3DES encryption failed!\n");
1024 ok(!
result,
"CryptDecrypt should failed!\n");
1049 static const BYTE aes_plain[32] = {
"AES Test With 2 Blocks Of Data." };
1052 DWORD len_orig, len_dup;
1073 len_orig =
sizeof(aes_plain);
1074 memcpy(orig, aes_plain, len_orig);
1078 len_dup =
sizeof(aes_plain);
1083 ok(len_orig == len_dup && !
memcmp(orig,
dup, len_orig),
1084 "AES-%d: duplicated key produced different ciphertext\n", keylen);
1094 DWORD dwLen, dwMode;
1095 unsigned char pbData[48], enc_data[16], bad_data[16];
1097 static const BYTE aes_plain[32] = {
1098 "AES Test With 2 Blocks Of Data." };
1099 static const BYTE aes_cbc_enc[3][48] = {
1101 { 0xfe, 0x85, 0x3b, 0xe1, 0xf5, 0xe1, 0x58, 0x75, 0xd5, 0xa9, 0x74, 0xe3, 0x09, 0xea, 0xa5, 0x04,
1102 0x23, 0x35, 0xa2, 0x3b, 0x5c, 0xf1, 0x6c, 0x6f, 0xb9, 0xcd, 0x64, 0x06, 0x3e, 0x41, 0x83, 0xef,
1103 0x2a, 0xfe, 0xea, 0xb5, 0x6c, 0x17, 0x20, 0x79, 0x8c, 0x51, 0x3e, 0x56, 0xed, 0xe1, 0x47, 0x68 },
1105 { 0x6b, 0xf0, 0xfd, 0x32, 0xee, 0xc6, 0x06, 0x13, 0xa8, 0xe6, 0x3c, 0x81, 0x85, 0xb8, 0x2e, 0xa1,
1106 0xd4, 0x3b, 0xe8, 0x22, 0xa5, 0x74, 0x4a, 0xbe, 0x9d, 0xcf, 0xcc, 0x37, 0x26, 0x19, 0x5a, 0xd1,
1107 0x7f, 0x76, 0xbf, 0x94, 0x28, 0xce, 0x27, 0x21, 0x61, 0x87, 0xeb, 0xb9, 0x8b, 0xa8, 0xb4, 0x57 },
1109 { 0x20, 0x57, 0x17, 0x0b, 0x17, 0x76, 0xd8, 0x3b, 0x26, 0x90, 0x8b, 0x4c, 0xf2, 0x00, 0x79, 0x33,
1110 0x29, 0x2b, 0x13, 0x9c, 0xe2, 0x95, 0x09, 0xc1, 0xcd, 0x20, 0x87, 0x22, 0x32, 0x70, 0x9d, 0x75,
1111 0x9a, 0x94, 0xf5, 0x76, 0x5c, 0xb1, 0x62, 0x2c, 0xe1, 0x76, 0x7c, 0x86, 0x73, 0xe6, 0x7a, 0x23 }
1131 dwLen =
sizeof(aes_plain);
1135 ok(dwLen == 48,
"Expected dwLen 48, got %ld\n", dwLen);
1136 ok(!
memcmp(aes_cbc_enc[
i],
pbData, dwLen),
"Expected equal data sequences\n");
1148 ok(!dwLen,
"unexpected salt length %ld\n", dwLen);
1151 dwMode = 0xdeadbeef;
1152 dwLen =
sizeof(dwMode);
1201 ok(!
result,
"CryptDecrypt should failed!\n");
1226 static const unsigned char sha256hash[32] = {
1227 0x10, 0xfc, 0x3c, 0x51, 0xa1, 0x52, 0xe9, 0x0e, 0x5b, 0x90,
1228 0x31, 0x9b, 0x60, 0x1d, 0x92, 0xcc, 0xf3, 0x72, 0x90, 0xef,
1229 0x53, 0xc3, 0x5f, 0xf9, 0x25, 0x07, 0x68, 0x7d, 0x8a, 0x91,
1232 static const unsigned char sha384hash[48] = {
1233 0x98, 0xd3, 0x3f, 0x89, 0x0b, 0x23, 0x33, 0x44, 0x61, 0x32,
1234 0x5a, 0x7c, 0xa3, 0x03, 0x89, 0xb5, 0x11, 0xd7, 0x41, 0xc8,
1235 0x54, 0x6b, 0x12, 0x0c, 0x40, 0x15, 0xb6, 0x2a, 0x03, 0x43,
1236 0xe5, 0x64, 0x7f, 0x10, 0x1e, 0xae, 0x47, 0xa9, 0x39, 0x05,
1237 0x6f, 0x40, 0x60, 0x94, 0xd6, 0xad, 0x80, 0x55
1239 static const unsigned char sha512hash[64] = {
1240 0x37, 0x86, 0x0e, 0x7d, 0x25, 0xd9, 0xf9, 0x84, 0x3e, 0x3d,
1241 0xc7, 0x13, 0x95, 0x73, 0x42, 0x04, 0xfd, 0x13, 0xad, 0x23,
1242 0x39, 0x16, 0x32, 0x5f, 0x99, 0x3e, 0x3c, 0xee, 0x3f, 0x11,
1243 0x36, 0xf9, 0xc9, 0x66, 0x08, 0x70, 0xcc, 0x49, 0xd8, 0xe0,
1244 0x7d, 0xa1, 0x57, 0x62, 0x71, 0xa6, 0xc9, 0xa4, 0x24, 0x60,
1245 0xfc, 0xde, 0x9d, 0xb2, 0xf1, 0xd2, 0xc2, 0xfb, 0x2d, 0xbf,
1246 0xb7, 0xf4, 0x81, 0xd4
1248 unsigned char pbData[2048];
1251 BYTE pbHashValue[64];
1255 for (
i=0;
i<2048;
i++)
pbData[
i] = (
unsigned char)
i;
1261 win_skip(
"SHA-256/384/512 hashes are not supported before Windows XP SP3\n");
1277 ok(!
memcmp(pbHashValue, sha256hash, 32),
"Wrong SHA-256 hash!\n");
1298 ok(!
memcmp(pbHashValue, sha384hash, 48),
"Wrong SHA-384 hash!\n");
1319 ok(!
memcmp(pbHashValue, sha512hash, 64),
"Wrong SHA-512 hash!\n");
1328 static const BYTE rc2_40_encrypted[16] = {
1329 0xc0, 0x9a, 0xe4, 0x2f, 0x0a, 0x47, 0x67, 0x11,
1330 0xfb, 0x18, 0x87, 0xce, 0x0c, 0x75, 0x07, 0xb1 };
1331 static const BYTE rc2_128_encrypted[] = {
1332 0x82,0x81,0xf7,0xff,0xdd,0xd7,0x88,0x8c,
1333 0x2a,0x2a,0xc0,0xce,0x4c,0x89,0xb6,0x66 };
1334 static const BYTE rc2_40def_encrypted[] = {
1335 0x23,0xc8,0x70,0x13,0x42,0x2e,0xa8,0x98,
1336 0x5c,0xdf,0x7a,0x9b,0xea,0xdb,0x96,0x1b };
1337 static const BYTE rc2_40_salt_enh[24] = {
1338 0xA3, 0xD7, 0x41, 0x87, 0x7A, 0xD0, 0x18, 0xDB,
1339 0xD4, 0x6A, 0x4F, 0xEE, 0xF3, 0xCA, 0xCD, 0x34,
1340 0xB3, 0x15, 0x9A, 0x2A, 0x88, 0x5F, 0x43, 0xA5 };
1341 static const BYTE rc2_40_salt_base[24] = {
1342 0x8C, 0x4E, 0xA6, 0x00, 0x9B, 0x15, 0xEF, 0x9E,
1343 0x88, 0x81, 0xD0, 0x65, 0xD6, 0x53, 0x57, 0x08,
1344 0x0A, 0x77, 0x80, 0xFA, 0x7E, 0x89, 0x14, 0x55 };
1345 static const BYTE rc2_40_salt_strong[24] = {
1346 0xB9, 0x33, 0xB6, 0x7A, 0x35, 0xC3, 0x06, 0x88,
1347 0xBF, 0xD5, 0xCC, 0xAF, 0x14, 0xAE, 0xE2, 0x31,
1348 0xC6, 0x9A, 0xAA, 0x3F, 0x05, 0x2F, 0x22, 0xDA };
1352 DWORD dwLen, dwKeyLen, dwDataLen, dwMode, dwModeBits;
1353 unsigned char pbData[2000], pbHashValue[16], pszBuffer[256];
1356 for (
i=0;
i<2000;
i++)
pbData[
i] = (
unsigned char)
i;
1375 dwLen =
sizeof(
DWORD);
1380 dwMode = 0xdeadbeef;
1381 dwLen =
sizeof(dwMode);
1390 dwLen =
sizeof(
DWORD);
1394 dwModeBits = 0xdeadbeef;
1395 dwLen =
sizeof(
DWORD);
1399 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_DECRYPT|CRYPT_ENCRYPT got %08lx\n", dwModeBits);
1401 dwLen =
sizeof(
DWORD);
1405 dwLen =
sizeof(
DWORD);
1408 ok(dwLen == 4,
"Expected 4, got %ld\n", dwLen);
1415 ok(dwLen == 8,
"Expected 8, got %ld\n", dwLen);
1421 ok(dwLen == 11,
"unexpected salt length %ld\n", dwLen);
1425 for (
i=0;
i<dwLen;
i++)
1426 ok(!pszBuffer[
i],
"unexpected salt value %02x @ %d\n", pszBuffer[
i],
i);
1428 dwLen =
sizeof(
DWORD);
1431 ok(dwMode ==
CRYPT_MODE_CBC,
"Expected CRYPT_MODE_CBC, got %ld\n", dwMode);
1440 ok(!
memcmp(
pbData, rc2_40_encrypted, 16),
"RC2 encryption failed!\n");
1458 ok(dwLen == 11,
"expected salt length 11, got %ld\n", dwLen);
1460 ok(dwLen == 0,
"expected salt length 0, got %ld\n", dwLen);
1463 for (
i=0;
i<24;
i++)
1471 ok(dwLen ==
i,
"size %d: unexpected salt length %ld\n",
i, dwLen);
1483 for (
i=0;
i<2000;
i++)
pbData[
i] = (
unsigned char)
i;
1511 dwLen =
sizeof(dwKeyLen);
1528 ok(dwKeyLen == 128,
"Expected 128, got %ld\n", dwKeyLen);
1536 ok(dwKeyLen == 40,
"Expected 40, got %ld\n", dwKeyLen);
1539 dwLen =
sizeof(dwKeyLen);
1555 sizeof(rc2_128_encrypted)),
"RC2 encryption failed!\n");
1582 "RC2 encryption failed!\n");
1583 dwLen =
sizeof(
DWORD);
1587 ok(dwKeyLen == 40,
"Expected 40, got %ld\n", dwKeyLen);
1589 dwLen =
sizeof(pszBuffer);
1590 memset(pszBuffer, 0xAF, dwLen);
1594 ok(dwLen == 11,
"Expected 11, got %ld\n", dwLen);
1596 ok(dwLen == 0,
"Expected 0, got %ld\n", dwLen);
1608 static const BYTE rc4[16] = {
1609 0x17, 0x0c, 0x44, 0x8e, 0xae, 0x90, 0xcd, 0xb0,
1610 0x7f, 0x87, 0xf5, 0x7a, 0xec, 0xb2, 0x2e, 0x35 };
1611 static const BYTE rc4_40_salt[16] = {
1612 0x41, 0xE6, 0x33, 0xC9, 0x50, 0xA1, 0xBF, 0x88,
1613 0x12, 0x4D, 0xD3, 0xE3, 0x47, 0x88, 0x6D, 0xA5 };
1614 static const BYTE rc4_40_salt_base[16] = {
1615 0x2F, 0xAC, 0xEA, 0xEA, 0xFF, 0x68, 0x7E, 0x77,
1616 0xF4, 0xB9, 0x48, 0x7C, 0x4E, 0x79, 0xA6, 0xB5 };
1620 DWORD dwDataLen = 5, dwKeyLen, dwLen =
sizeof(
DWORD), dwMode;
1622 unsigned char pbData[2000];
1623 unsigned char pszBuffer[256];
1626 for (
i=0;
i<2000;
i++)
pbData[
i] = (
unsigned char)
i;
1642 dwLen =
sizeof(
DWORD);
1645 ok(dwKeyLen == 56,
"Expected 56, got %ld\n", dwKeyLen);
1647 dwLen =
sizeof(
DWORD);
1650 ok(dwKeyLen == 0,
"Expected 0, got %ld\n", dwKeyLen);
1663 dwLen =
sizeof(
DWORD);
1666 ok(dwMode == 0,
"Expected 0, got %ld\n", dwMode);
1689 ok(dwLen == 11,
"expected salt length 11, got %ld\n", dwLen);
1691 ok(dwLen == 0,
"expected salt length 0, got %ld\n", dwLen);
1694 for (
i = 0;
i < 24;
i++)
1702 ok(dwLen ==
i,
"size %d: unexpected salt length %ld\n",
i, dwLen);
1728 "RC4 encryption failed!\n");
1730 dwLen =
sizeof(
DWORD);
1734 ok(dwKeyLen == 40,
"Expected 40, got %ld\n", dwKeyLen);
1736 dwLen =
sizeof(pszBuffer);
1737 memset(pszBuffer, 0xAF, dwLen);
1741 ok(dwLen == 11,
"Expected 11, got %ld\n", dwLen);
1743 ok(dwLen == 0,
"Expected 0, got %ld\n", dwLen);
1760 static const BYTE hmac[16] = {
1761 0x1a, 0x7d, 0x49, 0xc5, 0x9b, 0x2d, 0x0b, 0x9c,
1762 0xcf, 0x10, 0x6b, 0xb6, 0x7d, 0x0f, 0x13, 0x32 };
1781 ok(dwLen != 0,
"Wrong value\n");
1787 ok(!
memcmp(abData, hmac,
sizeof(hmac)),
"HMAC failed!\n");
1803 static const struct hmac_test_case {
1809 const DWORD data_len;
1814 "what do ya want for nothing?", 28,
1815 "\x5b\xdc\xc1\x46\xbf\x60\x75\x4e\x6a\x04\x24\x26\x08\x95\x75\xc7"
1816 "\x5a\x00\x3f\x08\x9d\x27\x39\x83\x9d\xec\x58\xb9\x64\xec\x38\x43" },
1819 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1820 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1821 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1822 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1823 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1824 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1825 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1826 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1827 "\xaa\xaa\xaa", 131,
1828 "Test Using Larger Than Block-Size Key - Hash Key First", 54,
1829 "\x60\xe4\x31\x59\x1e\xe0\xb6\x7f\x0d\x8a\x26\xaa\xcb\xf5\xb7\x7f"
1830 "\x8e\x0b\xc6\x21\x37\x28\xc5\x14\x05\x46\x04\x0f\x0e\xe3\x7f\x54" },
1834 "what do ya want for nothing?", 28,
1835 "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b\x56\xe0\xa3"
1836 "\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27\x0c\xd7\xea\x25\x05\x54"
1837 "\x97\x58\xbf\x75\xc0\x5a\x99\x4a\x6d\x03\x4f\x65\xf8\xf0\xe6\xfd"
1838 "\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a\x38\xbc\xe7\x37" },
1842 "what do ya want for nothing?", 28,
1843 "\x29\x2f\x9d\x34\xf9\xe3\x11\x84\x6d\xe8\x6c\x49\x5d\x7a\xdf\xa2" }
1859 const struct hmac_test_case *test_case = &cases[
i];
1867 BYTE *key_bytes = (
BYTE *)(key_len + 1);
1875 *key_len = test_case->key_len;
1876 memcpy(key_bytes, test_case->key, *key_len);
1884 HMAC_INFO hmac_info = { test_case->algid, 0 };
1886 DWORD digest_size, hash_size;
1895 digest_size =
sizeof(hash_size);
1898 ok(hash_size == test_case->digest_len,
"Unexpected hash size %ld on test case %ld\n", hash_size,
i);
1903 digest_size =
sizeof(digest);
1906 ok(!
memcmp(digest, test_case->digest, test_case->digest_len),
"Unexpected value on test case %ld\n",
i);
1920 DWORD digest_size, hash_size;
1932 ok(!
result,
"CryptSetHashParam succeeded on algorithm %#x\n", bad_algs[
i]);
1936 hash_size = 0xdeadbeef;
1937 digest_size =
sizeof(hash_size);
1940 ok(!hash_size,
"Unexpected hash size %ld on algorithm %#x\n", hash_size, bad_algs[
i]);
1944 ok(!
result,
"CryptHashData succeeded on algorithm %#x\n", bad_algs[
i]);
1948 digest_size =
sizeof(digest);
1951 ok(!
result,
"CryptGetHashParam succeeded on algorithm %#x\n", bad_algs[
i]);
1975 ok(!
result,
"CryptHashData succeeded\n");
1978 digest_size =
sizeof(digest);
1981 ok(!
result,
"CryptGetHashParam succeeded\n");
1997 BYTE abData[256], abEnc[264];
1998 static const BYTE mac_40[8] = { 0xb7, 0xa2, 0x46, 0xe9, 0x11, 0x31, 0xe0, 0xad};
1999 static const BYTE mac_40_old[8] = { 0x44, 0x78, 0x38, 0xad, 0x10, 0x13, 0x60, 0x8e};
2000 static const BYTE mac_40_2[8] = { 0xef, 0x22, 0x0a, 0x3b, 0xd0, 0xab, 0x48, 0x49};
2001 static const BYTE mac_40_2_old[8] = { 0xa3, 0xf3, 0xfc, 0x70, 0xf4, 0xfa, 0xb0, 0x3e};
2028 ok(!
memcmp(abData, mac_40,
sizeof(mac_40)) ||
broken(!
memcmp(abData, mac_40_old,
sizeof(mac_40_old))),
2029 "Hash does not match.\n");
2070 ok(!
memcmp(abData, mac_40_2,
sizeof(mac_40_2))
2071 ||
broken(!
memcmp(abData, mac_40_2_old,
sizeof(mac_40_2_old))),
"Hash does not match.\n");
2095 static BYTE abSessionKey[148] = {
2096 0x01, 0x02, 0x00, 0x00, 0x01, 0x68, 0x00, 0x00,
2097 0x00, 0xa4, 0x00, 0x00, 0xb8, 0xa4, 0xdf, 0x5e,
2098 0x9e, 0xb1, 0xbf, 0x85, 0x3d, 0x24, 0x2d, 0x1e,
2099 0x69, 0xb7, 0x67, 0x13, 0x8e, 0x78, 0xf2, 0xdf,
2100 0xc6, 0x69, 0xce, 0x46, 0x7e, 0xf2, 0xf2, 0x33,
2101 0x20, 0x6f, 0xa1, 0xa5, 0x59, 0x83, 0x25, 0xcb,
2102 0x3a, 0xb1, 0x8a, 0x12, 0x63, 0x02, 0x3c, 0xfb,
2103 0x4a, 0xfa, 0xef, 0x8e, 0xf7, 0x29, 0x57, 0xb1,
2104 0x9e, 0xa7, 0xf3, 0x02, 0xfd, 0xca, 0xdf, 0x5a,
2105 0x1f, 0x71, 0xb6, 0x26, 0x09, 0x24, 0x39, 0xda,
2106 0xc0, 0xde, 0x2a, 0x0e, 0xcd, 0x1f, 0xe5, 0xb6,
2107 0x4f, 0x82, 0xa0, 0xa9, 0x90, 0xd3, 0xd9, 0x6a,
2108 0x43, 0x14, 0x2a, 0xf7, 0xac, 0xd5, 0xa0, 0x54,
2109 0x93, 0xc4, 0xb9, 0xe7, 0x24, 0x84, 0x4d, 0x69,
2110 0x5e, 0xcc, 0x2a, 0x32, 0xb5, 0xfb, 0xe4, 0xb4,
2111 0x08, 0xd5, 0x36, 0x58, 0x59, 0x40, 0xfb, 0x29,
2112 0x7f, 0xa7, 0x17, 0x25, 0xc4, 0x0d, 0x78, 0x37,
2113 0x04, 0x8c, 0x49, 0x92
2115 static BYTE abEncryptedMessage[12] = {
2116 0x40, 0x64, 0x28, 0xe8, 0x8a, 0xe7, 0xa4, 0xd4,
2117 0x1c, 0xfd, 0xde, 0x71
2126 dwLen =
sizeof(abSessionKey);
2131 dwLen =
sizeof(
DWORD);
2135 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_DECRYPT|CRYPT_ENCRYPT got %08lx\n", dwVal);
2137 dwLen =
sizeof(abEncryptedMessage);
2140 ok(dwLen == 12,
"expected 12, got %ld\n", dwLen);
2141 ok(!
memcmp(abEncryptedMessage,
"Wine rocks!", 12),
"decrypt failed\n");
2146 dwLen =
sizeof(abSessionKey);
2151 dwLen =
sizeof(abSessionKey);
2166 ok(
result,
"CryptImportKey failed at size %ld: %ld (%08lx)\n", dwLen,
2176 BYTE abData[] =
"Wine rocks!",
buf[148];
2179 BYTE abPubKey[148] = {
2180 0x06, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00,
2181 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00,
2182 0x01, 0x00, 0x01, 0x00, 0x71, 0x64, 0x9f, 0x19,
2183 0x89, 0x1c, 0x21, 0xcc, 0x36, 0xa3, 0xc9, 0x27,
2184 0x08, 0x8a, 0x09, 0xc6, 0xbe, 0xeb, 0xd3, 0xf8,
2185 0x19, 0xa9, 0x92, 0x57, 0xe4, 0xb9, 0x5d, 0xda,
2186 0x88, 0x93, 0xe4, 0x6b, 0x38, 0x77, 0x14, 0x8a,
2187 0x96, 0xc0, 0xb6, 0x4e, 0x42, 0xf5, 0x01, 0xdc,
2188 0xf0, 0xeb, 0x3c, 0xc7, 0x7b, 0xc4, 0xfd, 0x7c,
2189 0xde, 0x93, 0x34, 0x0a, 0x92, 0xe5, 0x97, 0x9c,
2190 0x3e, 0x65, 0xb8, 0x91, 0x2f, 0xe3, 0xf3, 0x89,
2191 0xcd, 0x6c, 0x26, 0xa4, 0x6c, 0xc7, 0x6d, 0x0b,
2192 0x2c, 0xa2, 0x0b, 0x29, 0xe2, 0xfc, 0x30, 0xfa,
2193 0x20, 0xdb, 0x4c, 0xb8, 0x91, 0xb8, 0x69, 0x63,
2194 0x96, 0x41, 0xc2, 0xb4, 0x60, 0xeb, 0xcd, 0xff,
2195 0x3a, 0x1f, 0x94, 0xb1, 0x23, 0xcf, 0x0f, 0x49,
2196 0xad, 0xd5, 0x33, 0x85, 0x71, 0xaf, 0x12, 0x87,
2197 0x84, 0xef, 0xa0, 0xea, 0xe1, 0xc1, 0xd4, 0xc7,
2198 0xe1, 0x21, 0x50, 0xac
2201 BYTE abSignatureMD2[128] = {
2202 0x4a, 0x4e, 0xb7, 0x5e, 0x32, 0xda, 0xdb, 0x67,
2203 0x9f, 0x77, 0x84, 0x32, 0x00, 0xba, 0x5f, 0x6b,
2204 0x0d, 0xcf, 0xd9, 0x99, 0xbd, 0x96, 0x31, 0xda,
2205 0x23, 0x4c, 0xd9, 0x4a, 0x90, 0x84, 0x20, 0x59,
2206 0x51, 0xdc, 0xd4, 0x93, 0x3a, 0xae, 0x0a, 0x0a,
2207 0xa1, 0x76, 0xfa, 0xb5, 0x68, 0xee, 0xc7, 0x34,
2208 0x41, 0xd3, 0xe7, 0x5a, 0x0e, 0x22, 0x61, 0x40,
2209 0xea, 0x24, 0x56, 0xf1, 0x91, 0x5a, 0xf7, 0xa7,
2210 0x5b, 0xf4, 0x98, 0x6b, 0xc3, 0xef, 0xad, 0xc0,
2211 0x5e, 0x6b, 0x87, 0x76, 0xcb, 0x1f, 0x62, 0x06,
2212 0x7c, 0xf6, 0x48, 0x97, 0x81, 0x8d, 0xef, 0x51,
2213 0x51, 0xdc, 0x21, 0x91, 0x57, 0x1e, 0x79, 0x6f,
2214 0x49, 0xb5, 0xde, 0x31, 0x07, 0x45, 0x99, 0x46,
2215 0xc3, 0x4f, 0xca, 0x2d, 0x0e, 0x4c, 0x10, 0x25,
2216 0xcb, 0x1a, 0x98, 0x63, 0x41, 0x93, 0x47, 0xc0,
2217 0xb2, 0xbc, 0x10, 0x3c, 0xe7, 0xd4, 0x3c, 0x1e
2220 BYTE abSignatureMD2NoOID[128] = {
2221 0x0c, 0x21, 0x3e, 0x60, 0xf9, 0xd0, 0x36, 0x2d,
2222 0xe1, 0x10, 0x45, 0x45, 0x85, 0x03, 0x29, 0x19,
2223 0xef, 0x19, 0xd9, 0xa6, 0x7e, 0x9c, 0x0d, 0xbd,
2224 0x03, 0x0e, 0xb9, 0x51, 0x9e, 0x74, 0x79, 0xc4,
2225 0xde, 0x25, 0xf2, 0x35, 0x74, 0x55, 0xbc, 0x65,
2226 0x7e, 0x33, 0x28, 0xa8, 0x1e, 0x72, 0xaa, 0x99,
2227 0xdd, 0xf5, 0x26, 0x20, 0x29, 0xf8, 0xa6, 0xdf,
2228 0x28, 0x4b, 0x1c, 0xdb, 0xa1, 0x41, 0x56, 0xbc,
2229 0xf9, 0x9c, 0x66, 0xc0, 0x37, 0x41, 0x55, 0xa0,
2230 0xe2, 0xec, 0xbf, 0x71, 0xf0, 0x5d, 0x25, 0x01,
2231 0x75, 0x91, 0xe2, 0x81, 0xb2, 0x9f, 0x57, 0xa7,
2232 0x5c, 0xd2, 0xfa, 0x66, 0xdb, 0x71, 0x2b, 0x1f,
2233 0xad, 0x30, 0xde, 0xea, 0x49, 0x73, 0x30, 0x6a,
2234 0x22, 0x54, 0x49, 0x4e, 0xae, 0xf6, 0x88, 0xc9,
2235 0xff, 0x71, 0xba, 0xbf, 0x27, 0xc5, 0xfa, 0x06,
2236 0xe2, 0x91, 0x71, 0x8a, 0x7e, 0x0c, 0xc2, 0x07
2239 BYTE abSignatureMD4[128] = {
2240 0x1c, 0x78, 0xaa, 0xea, 0x74, 0xf4, 0x83, 0x51,
2241 0xae, 0x66, 0xe3, 0xa9, 0x1c, 0x03, 0x39, 0x1b,
2242 0xac, 0x7e, 0x4e, 0x85, 0x7e, 0x1c, 0x38, 0xd2,
2243 0x82, 0x43, 0xb3, 0x6f, 0x6f, 0x46, 0x45, 0x8e,
2244 0x17, 0x74, 0x58, 0x29, 0xca, 0xe1, 0x03, 0x13,
2245 0x45, 0x79, 0x34, 0xdf, 0x5c, 0xd6, 0xc3, 0xf9,
2246 0x7a, 0x1c, 0x9d, 0xff, 0x6f, 0x03, 0x7d, 0x0f,
2247 0x59, 0x1a, 0x2d, 0x0e, 0x94, 0xb4, 0x75, 0x96,
2248 0xd1, 0x48, 0x63, 0x6e, 0xb2, 0xc4, 0x5c, 0xd9,
2249 0xab, 0x49, 0xb4, 0x90, 0xd9, 0x57, 0x04, 0x6e,
2250 0x4c, 0xb6, 0xea, 0x00, 0x94, 0x4a, 0x34, 0xa0,
2251 0xd9, 0x63, 0xef, 0x2c, 0xde, 0x5b, 0xb9, 0xbe,
2252 0x35, 0xc8, 0xc1, 0x31, 0xb5, 0x31, 0x15, 0x18,
2253 0x90, 0x39, 0xf5, 0x2a, 0x34, 0x6d, 0xb4, 0xab,
2254 0x09, 0x34, 0x69, 0x54, 0x4d, 0x11, 0x2f, 0xf3,
2255 0xa2, 0x36, 0x0e, 0xa8, 0x45, 0xe7, 0x36, 0xac
2258 BYTE abSignatureMD4NoOID[128] = {
2259 0xd3, 0x60, 0xb2, 0xb0, 0x22, 0x0a, 0x99, 0xda,
2260 0x04, 0x85, 0x64, 0xc6, 0xc6, 0xdb, 0x11, 0x24,
2261 0xe9, 0x68, 0x2d, 0xf7, 0x09, 0xef, 0xb6, 0xa0,
2262 0xa2, 0xfe, 0x45, 0xee, 0x85, 0x49, 0xcd, 0x36,
2263 0xf7, 0xc7, 0x9d, 0x2b, 0x4c, 0x68, 0xda, 0x85,
2264 0x8c, 0x50, 0xcc, 0x4f, 0x4b, 0xe1, 0x82, 0xc3,
2265 0xbe, 0xa3, 0xf1, 0x78, 0x6b, 0x60, 0x42, 0x3f,
2266 0x67, 0x22, 0x14, 0xe4, 0xe1, 0xa4, 0x6e, 0xa9,
2267 0x4e, 0xf1, 0xd4, 0xb0, 0xce, 0x82, 0xac, 0x06,
2268 0xba, 0x2c, 0xbc, 0xf7, 0xcb, 0xf6, 0x0c, 0x3f,
2269 0xf6, 0x79, 0xfe, 0xb3, 0xd8, 0x5a, 0xbc, 0xdb,
2270 0x05, 0x41, 0xa4, 0x07, 0x57, 0x9e, 0xa2, 0x96,
2271 0xfc, 0x60, 0x4b, 0xf7, 0x6f, 0x86, 0x26, 0x1f,
2272 0xc2, 0x2c, 0x67, 0x08, 0xcd, 0x7f, 0x91, 0xe9,
2273 0x16, 0xb5, 0x0e, 0xd9, 0xc4, 0xc4, 0x97, 0xeb,
2274 0x91, 0x3f, 0x20, 0x6c, 0xf0, 0x68, 0x86, 0x7f
2277 BYTE abSignatureMD5[128] = {
2278 0x4f, 0xe0, 0x8c, 0x9b, 0x43, 0xdd, 0x02, 0xe5,
2279 0xf4, 0xa1, 0xdd, 0x88, 0x4c, 0x9c, 0x40, 0x0f,
2280 0x6c, 0x43, 0x86, 0x64, 0x00, 0xe6, 0xac, 0xf7,
2281 0xd0, 0x92, 0xaa, 0xc4, 0x62, 0x9a, 0x48, 0x98,
2282 0x1a, 0x56, 0x6d, 0x75, 0xec, 0x04, 0x89, 0xec,
2283 0x69, 0x93, 0xd6, 0x61, 0x37, 0xb2, 0x36, 0xb5,
2284 0xb2, 0xba, 0xf2, 0xf5, 0x21, 0x0c, 0xf1, 0x04,
2285 0xc8, 0x2d, 0xf5, 0xa0, 0x8d, 0x6d, 0x10, 0x0b,
2286 0x68, 0x63, 0xf2, 0x08, 0x68, 0xdc, 0xbd, 0x95,
2287 0x25, 0x7d, 0xee, 0x63, 0x5c, 0x3b, 0x98, 0x4c,
2288 0xea, 0x41, 0xdc, 0x6a, 0x8b, 0x6c, 0xbb, 0x29,
2289 0x2b, 0x1c, 0x5c, 0x8b, 0x7d, 0x94, 0x24, 0xa9,
2290 0x7a, 0x62, 0x94, 0xf3, 0x3a, 0x6a, 0xb2, 0x4c,
2291 0x33, 0x59, 0x00, 0xcd, 0x7d, 0x37, 0x79, 0x90,
2292 0x31, 0xd1, 0xd9, 0x84, 0x12, 0xe5, 0x08, 0x5e,
2293 0xb3, 0x60, 0x61, 0x27, 0x78, 0x37, 0x63, 0x01
2296 BYTE abSignatureMD5NoOID[128] = {
2297 0xc6, 0xad, 0x5c, 0x2b, 0x9b, 0xe0, 0x99, 0x2f,
2298 0x5e, 0x55, 0x04, 0x32, 0x65, 0xe0, 0xb5, 0x75,
2299 0x01, 0x9a, 0x11, 0x4d, 0x0e, 0x9a, 0xe1, 0x9f,
2300 0xc7, 0xbf, 0x77, 0x6d, 0xa9, 0xfd, 0xcc, 0x9d,
2301 0x8b, 0xd1, 0x31, 0xed, 0x5a, 0xd2, 0xe5, 0x5f,
2302 0x42, 0x3b, 0xb5, 0x3c, 0x32, 0x30, 0x88, 0x49,
2303 0xcb, 0x67, 0xb8, 0x2e, 0xc9, 0xf5, 0x2b, 0xc8,
2304 0x35, 0x71, 0xb5, 0x1b, 0x32, 0x3f, 0x44, 0x4c,
2305 0x66, 0x93, 0xcb, 0xe8, 0x48, 0x7c, 0x14, 0x23,
2306 0xfb, 0x12, 0xa5, 0xb7, 0x86, 0x94, 0x6b, 0x19,
2307 0x17, 0x20, 0xc6, 0xb8, 0x09, 0xe8, 0xbb, 0xdb,
2308 0x00, 0x2b, 0x96, 0x4a, 0x93, 0x00, 0x26, 0xd3,
2309 0x07, 0xa0, 0x06, 0xce, 0x5a, 0x13, 0x69, 0x6b,
2310 0x62, 0x5a, 0x56, 0x61, 0x6a, 0xd8, 0x11, 0x3b,
2311 0xd5, 0x67, 0xc7, 0x4d, 0xf6, 0x66, 0x63, 0xc5,
2312 0xe3, 0x8f, 0x7c, 0x7c, 0xb1, 0x3e, 0x55, 0x43
2315 BYTE abSignatureSHA[128] = {
2316 0x5a, 0x4c, 0x66, 0xc9, 0x30, 0x67, 0xcb, 0x91,
2317 0x3c, 0x4d, 0xd5, 0x8d, 0xea, 0x4e, 0x85, 0xcd,
2318 0xd9, 0x68, 0x3a, 0xf3, 0x24, 0x3c, 0x99, 0x24,
2319 0x25, 0x32, 0x93, 0x3d, 0xd6, 0x2f, 0x86, 0x94,
2320 0x23, 0x09, 0xee, 0x02, 0xd4, 0x15, 0xdc, 0x5f,
2321 0x0e, 0x44, 0x45, 0x13, 0x5f, 0x18, 0x5d, 0x1a,
2322 0xd7, 0x0b, 0xd1, 0x23, 0xd6, 0x35, 0x98, 0x52,
2323 0x57, 0x45, 0x74, 0x92, 0xe3, 0x50, 0xb4, 0x20,
2324 0x28, 0x2a, 0x11, 0xbf, 0x49, 0xb4, 0x2c, 0xc5,
2325 0xd4, 0x1a, 0x27, 0x4e, 0xdf, 0xa0, 0xb5, 0x7a,
2326 0xc8, 0x14, 0xdd, 0x9b, 0xb6, 0xca, 0xd6, 0xff,
2327 0xb2, 0x6b, 0xd8, 0x98, 0x67, 0x80, 0xab, 0x53,
2328 0x52, 0xbb, 0xe1, 0x2a, 0xce, 0x79, 0x2f, 0x00,
2329 0x53, 0x26, 0xd8, 0xa7, 0x43, 0xca, 0x72, 0x0e,
2330 0x68, 0x97, 0x37, 0x71, 0x87, 0xc2, 0x6a, 0x98,
2331 0xbb, 0x6c, 0xa0, 0x01, 0xff, 0x04, 0x9d, 0xa6
2334 BYTE abSignatureSHANoOID[128] = {
2335 0x86, 0xa6, 0x2b, 0x9a, 0x04, 0xda, 0x47, 0xc6,
2336 0x4f, 0x97, 0x8a, 0x8a, 0xf4, 0xfa, 0x63, 0x1a,
2337 0x32, 0x89, 0x56, 0x41, 0x37, 0x91, 0x15, 0x2f,
2338 0x2d, 0x1c, 0x8f, 0xdc, 0x88, 0x40, 0xbb, 0x37,
2339 0x3e, 0x06, 0x33, 0x1b, 0xde, 0xda, 0x7c, 0x65,
2340 0x91, 0x35, 0xca, 0x45, 0x17, 0x0e, 0x24, 0xbe,
2341 0x9e, 0xf6, 0x4e, 0x8a, 0xa4, 0x3e, 0xca, 0xe6,
2342 0x11, 0x36, 0xb8, 0x3a, 0xf0, 0xde, 0x71, 0xfe,
2343 0xdd, 0xb3, 0xcb, 0x6c, 0x39, 0xe0, 0x5f, 0x0c,
2344 0x9e, 0xa8, 0x40, 0x26, 0x9c, 0x81, 0xe9, 0xc4,
2345 0x15, 0x90, 0xbf, 0x4f, 0xd2, 0xc1, 0xa1, 0x80,
2346 0x52, 0xfd, 0xf6, 0x3d, 0x99, 0x1b, 0x9c, 0x8a,
2347 0x27, 0x1b, 0x0c, 0x9a, 0xf3, 0xf9, 0xa2, 0x00,
2348 0x3e, 0x5b, 0xdf, 0xc2, 0xb4, 0x71, 0xa5, 0xbd,
2349 0xf8, 0xae, 0x63, 0xbb, 0x4a, 0xc9, 0xdd, 0x67,
2350 0xc1, 0x3e, 0x93, 0xee, 0xf1, 0x1f, 0x24, 0x5b
2371 "Expected ERROR_INVALID_PARAMETER error, got %08lx\n",
GetLastError());
2447 BYTE abData[2048] =
"Wine rocks!";
2464 ok(dwLen == 128,
"Unexpected length %ld\n", dwLen);
2482 dwLen =
sizeof(abData) - (20 * 2 + 2) + 1;
2490 memcpy(abData,
"Wine rocks!", dwLen);
2498 memcpy(abData,
"Wine rocks!", 12);
2509 memcpy(abData,
"Wine rocks!", dwLen);
2516 dwLen =
sizeof(
DWORD);
2520 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_DECRYPT|CRYPT_ENCRYPT got %08lx\n", dwVal);
2525 "expected NTE_BAD_KEY or NTE_NOT_FOUND, got %08lx\n",
GetLastError());
2540 "expected NTE_BAD_DATA or NTE_BAD_FLAGS, got %08lx\n",
GetLastError());
2553 dwLen =
sizeof(
DWORD);
2557 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_DECRYPT|CRYPT_ENCRYPT got %08lx\n", dwVal);
2572 "expected NTE_BAD_DATA or NTE_BAD_FLAGS, got %08lx\n",
GetLastError());
2583 DWORD dwLen, dwDataLen, dwVal;
2587 BYTE emptyKey[2048], *exported_key, *exported_key2;
2588 static BYTE abPlainPublicKey[84] = {
2589 0x06, 0x02, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00,
2590 0x52, 0x53, 0x41, 0x31, 0x00, 0x02, 0x00, 0x00,
2591 0x01, 0x00, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11,
2592 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2593 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2594 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2595 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2596 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2597 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2598 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2599 0x11, 0x11, 0x11, 0x11
2601 static BYTE priv_key_with_high_bit[] = {
2602 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00,
2603 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00,
2604 0x01, 0x00, 0x01, 0x00, 0xd5, 0xa2, 0x0d, 0x66,
2605 0xfe, 0x65, 0xb5, 0xf1, 0xc9, 0x6b, 0xf5, 0x58,
2606 0x04, 0x38, 0x2d, 0xf4, 0xa3, 0x5a, 0xda, 0x9e,
2607 0x95, 0x81, 0x85, 0x3d, 0x01, 0x07, 0xb2, 0x03,
2608 0x77, 0x70, 0x79, 0x6e, 0x6c, 0x26, 0x42, 0xa4,
2609 0x12, 0xfd, 0xaa, 0x29, 0x83, 0x04, 0xce, 0x91,
2610 0x90, 0x39, 0x5e, 0x49, 0x56, 0xfd, 0x0a, 0xe5,
2611 0xb1, 0xea, 0x3b, 0xb2, 0x70, 0xb0, 0x20, 0xc1,
2612 0x1f, 0x22, 0x07, 0x3e, 0x4d, 0xc0, 0x73, 0xfd,
2613 0x92, 0x8f, 0x87, 0xd8, 0xd1, 0xd1, 0x28, 0xd8,
2614 0x19, 0xd1, 0x93, 0x83, 0xe0, 0xb8, 0x9f, 0x53,
2615 0xf4, 0x6a, 0x7c, 0xcb, 0x10, 0x53, 0xd0, 0x37,
2616 0x02, 0xb4, 0xa5, 0xf7, 0xa2, 0x28, 0x6e, 0x26,
2617 0xef, 0x5c, 0x14, 0x01, 0x40, 0x1e, 0xa3, 0xe1,
2618 0xda, 0x76, 0xd0, 0x12, 0x84, 0xb7, 0x48, 0x7d,
2619 0xc8, 0x67, 0x5c, 0xb2, 0xd5, 0x2e, 0xaf, 0x8e,
2620 0x7d, 0x32, 0x59, 0x92, 0x01, 0xd6, 0x5b, 0x68,
2621 0x28, 0x9b, 0xb1, 0x6c, 0x69, 0xeb, 0x61, 0x5b,
2622 0x4b, 0x13, 0xe2, 0xbd, 0x7d, 0xbe, 0xce, 0xe8,
2623 0x41, 0x54, 0xca, 0xa8, 0xdd, 0xc7, 0xfe, 0x8b,
2624 0xdf, 0xf6, 0x55, 0x6c, 0x50, 0x11, 0xc8, 0x15,
2625 0x13, 0x42, 0x59, 0x9f, 0xbb, 0xea, 0x73, 0x78,
2626 0x7b, 0x22, 0x8d, 0x96, 0x62, 0xe5, 0xda, 0xa2,
2627 0x85, 0x5c, 0x20, 0x74, 0x9f, 0x1c, 0x12, 0xf2,
2628 0x48, 0x06, 0x1a, 0xc6, 0xd5, 0x94, 0xec, 0x31,
2629 0x6b, 0xb6, 0x7b, 0x54, 0x61, 0x77, 0xec, 0x7c,
2630 0x6f, 0xb7, 0x55, 0x3d, 0x6b, 0x98, 0x05, 0xd7,
2631 0x8a, 0x73, 0x25, 0xf2, 0x8f, 0xe4, 0xb8, 0x8d,
2632 0x27, 0x18, 0x0d, 0x05, 0xba, 0x23, 0x54, 0x37,
2633 0x10, 0xf0, 0x1c, 0x41, 0xa6, 0xae, 0x4c, 0x2a,
2634 0x6a, 0x2f, 0x7f, 0x68, 0x43, 0x86, 0xe7, 0x9c,
2635 0xfd, 0x9e, 0xf1, 0xfe, 0x84, 0xe3, 0xb6, 0x99,
2636 0x51, 0xfe, 0x1e, 0xbd, 0x01, 0xc6, 0x10, 0xef,
2637 0x88, 0xa4, 0xd8, 0x53, 0x14, 0x88, 0x15, 0xc9,
2638 0xe5, 0x86, 0xe2, 0x8d, 0x85, 0x2e, 0x0d, 0xec,
2639 0x15, 0xa7, 0x48, 0xfa, 0x18, 0xfb, 0x01, 0x8d,
2640 0x2b, 0x90, 0x70, 0x7f, 0x78, 0xb1, 0x33, 0x7e,
2641 0xfe, 0x82, 0x40, 0x5f, 0x4a, 0x97, 0xc2, 0x42,
2642 0x22, 0xd5, 0x5f, 0xbc, 0xbd, 0xab, 0x26, 0x98,
2643 0xcd, 0xb5, 0xdf, 0x7e, 0xa0, 0x68, 0xa7, 0x12,
2644 0x9e, 0xa5, 0xa2, 0x90, 0x85, 0xc5, 0xca, 0x73,
2645 0x4a, 0x59, 0x8a, 0xec, 0xcf, 0xdd, 0x65, 0x5d,
2646 0xc1, 0xaa, 0x86, 0x53, 0xd5, 0xde, 0xbb, 0x23,
2647 0x24, 0xb8, 0x9b, 0x74, 0x03, 0x20, 0xb4, 0xf0,
2648 0xe4, 0xdd, 0xd2, 0x03, 0xfd, 0x67, 0x55, 0x19,
2649 0x28, 0x1d, 0xc1, 0xb8, 0xa5, 0x89, 0x0e, 0xc0,
2650 0x80, 0x9d, 0xdd, 0xda, 0x9d, 0x30, 0x5c, 0xc8,
2651 0xbb, 0xfe, 0x8f, 0xce, 0xd5, 0xf6, 0xdf, 0xfa,
2652 0x14, 0xaf, 0xe4, 0xba, 0xb0, 0x84, 0x45, 0xd8,
2653 0x67, 0xa7, 0xd0, 0xce, 0x89, 0x2a, 0x30, 0x8c,
2654 0xfa, 0xe9, 0x65, 0xa4, 0x21, 0x2d, 0x6b, 0xa2,
2655 0x9b, 0x8f, 0x92, 0xbd, 0x3a, 0x10, 0x71, 0x12,
2656 0xc2, 0x02, 0x3d, 0xd5, 0x83, 0x1d, 0xfa, 0x42,
2657 0xb7, 0x48, 0x1b, 0x31, 0xe3, 0x82, 0x90, 0x2d,
2658 0x91, 0x59, 0xf9, 0x38, 0x52, 0xe5, 0xdb, 0xc1,
2659 0x4d, 0x3a, 0xe6, 0x9b, 0x6a, 0xbb, 0xea, 0xa4,
2660 0x8d, 0x5e, 0xc4, 0x00, 0x01, 0xb8, 0xec, 0x91,
2661 0xc1, 0xdb, 0x63, 0xbd, 0x57, 0xb6, 0x26, 0x15,
2662 0xb6, 0x3e, 0xa2, 0xdf, 0x62, 0x8d, 0xa8, 0xbe,
2663 0xe1, 0xf1, 0x39, 0xbd, 0x18, 0xd2, 0x6f, 0xd7,
2664 0xda, 0xdc, 0x71, 0x30, 0xf1, 0x21, 0x71, 0xa4,
2665 0x08, 0x43, 0x46, 0xdf, 0x50, 0xbd, 0x3c, 0x60,
2666 0x5b, 0x63, 0x35, 0xe3, 0x37, 0x5b, 0x25, 0x17,
2667 0x54, 0x5e, 0x68, 0x60, 0xb6, 0x49, 0xef, 0x6e,
2668 0x09, 0xef, 0xda, 0x90, 0x3e, 0xd4, 0x09, 0x33,
2669 0x36, 0x57, 0x9a, 0x14, 0xbd, 0xf7, 0xb1, 0x98,
2670 0x30, 0x42, 0x03, 0x84, 0x61, 0xeb, 0x8e, 0x50,
2671 0xdc, 0x6a, 0x93, 0x1b, 0x32, 0x51, 0xf9, 0xc6,
2672 0xc2, 0x19, 0xb3, 0x5d, 0xe2, 0xf8, 0xc5, 0x8f,
2673 0x68, 0xaa, 0x1d, 0xdb, 0xd3, 0x7f, 0x8d, 0x98,
2674 0x9c, 0x16, 0x8c, 0xc3, 0xcd, 0xd9, 0xdb, 0x08,
2675 0xe6, 0x36, 0x60, 0xb6, 0x36, 0xdc, 0x1d, 0x59,
2676 0xb6, 0x5f, 0x01, 0x5e
2679 static const BYTE expected_exported_priv_key[] = {
2681 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00,
2683 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
2685 0xd5, 0xa2, 0x0d, 0x66, 0xfe, 0x65, 0xb5, 0xf1, 0xc9, 0x6b, 0xf5, 0x58, 0x04, 0x38, 0x2d, 0xf4,
2686 0xa3, 0x5a, 0xda, 0x9e, 0x95, 0x81, 0x85, 0x3d, 0x01, 0x07, 0xb2, 0x03, 0x77, 0x70, 0x79, 0x6e,
2687 0x6c, 0x26, 0x42, 0xa4, 0x12, 0xfd, 0xaa, 0x29, 0x83, 0x04, 0xce, 0x91, 0x90, 0x39, 0x5e, 0x49,
2688 0x56, 0xfd, 0x0a, 0xe5, 0xb1, 0xea, 0x3b, 0xb2, 0x70, 0xb0, 0x20, 0xc1, 0x1f, 0x22, 0x07, 0x3e,
2689 0x4d, 0xc0, 0x73, 0xfd, 0x92, 0x8f, 0x87, 0xd8, 0xd1, 0xd1, 0x28, 0xd8, 0x19, 0xd1, 0x93, 0x83,
2690 0xe0, 0xb8, 0x9f, 0x53, 0xf4, 0x6a, 0x7c, 0xcb, 0x10, 0x53, 0xd0, 0x37, 0x02, 0xb4, 0xa5, 0xf7,
2691 0xa2, 0x28, 0x6e, 0x26, 0xef, 0x5c, 0x14, 0x01, 0x40, 0x1e, 0xa3, 0xe1, 0xda, 0x76, 0xd0, 0x12,
2692 0x84, 0xb7, 0x48, 0x7d, 0xc8, 0x67, 0x5c, 0xb2, 0xd5, 0x2e, 0xaf, 0x8e, 0x7d, 0x32, 0x59, 0x92,
2694 0x01, 0xd6, 0x5b, 0x68, 0x28, 0x9b, 0xb1, 0x6c, 0x69, 0xeb, 0x61, 0x5b, 0x4b, 0x13, 0xe2, 0xbd,
2695 0x7d, 0xbe, 0xce, 0xe8, 0x41, 0x54, 0xca, 0xa8, 0xdd, 0xc7, 0xfe, 0x8b, 0xdf, 0xf6, 0x55, 0x6c,
2696 0x50, 0x11, 0xc8, 0x15, 0x13, 0x42, 0x59, 0x9f, 0xbb, 0xea, 0x73, 0x78, 0x7b, 0x22, 0x8d, 0x96,
2697 0x62, 0xe5, 0xda, 0xa2, 0x85, 0x5c, 0x20, 0x74, 0x9f, 0x1c, 0x12, 0xf2, 0x48, 0x06, 0x1a, 0xc6,
2699 0xd5, 0x94, 0xec, 0x31, 0x6b, 0xb6, 0x7b, 0x54, 0x61, 0x77, 0xec, 0x7c, 0x6f, 0xb7, 0x55, 0x3d,
2700 0x6b, 0x98, 0x05, 0xd7, 0x8a, 0x73, 0x25, 0xf2, 0x8f, 0xe4, 0xb8, 0x8d, 0x27, 0x18, 0x0d, 0x05,
2701 0xba, 0x23, 0x54, 0x37, 0x10, 0xf0, 0x1c, 0x41, 0xa6, 0xae, 0x4c, 0x2a, 0x6a, 0x2f, 0x7f, 0x68,
2702 0x43, 0x86, 0xe7, 0x9c, 0xfd, 0x9e, 0xf1, 0xfe, 0x84, 0xe3, 0xb6, 0x99, 0x51, 0xfe, 0x1e, 0xbd,
2704 0x01, 0xc6, 0x10, 0xef, 0x88, 0xa4, 0xd8, 0x53, 0x14, 0x88, 0x15, 0xc9, 0xe5, 0x86, 0xe2, 0x8d,
2705 0x85, 0x2e, 0x0d, 0xec, 0x15, 0xa7, 0x48, 0xfa, 0x18, 0xfb, 0x01, 0x8d, 0x2b, 0x90, 0x70, 0x7f,
2706 0x78, 0xb1, 0x33, 0x7e, 0xfe, 0x82, 0x40, 0x5f, 0x4a, 0x97, 0xc2, 0x42, 0x22, 0xd5, 0x5f, 0xbc,
2707 0xbd, 0xab, 0x26, 0x98, 0xcd, 0xb5, 0xdf, 0x7e, 0xa0, 0x68, 0xa7, 0x12, 0x9e, 0xa5, 0xa2, 0x90,
2709 0x85, 0xc5, 0xca, 0x73, 0x4a, 0x59, 0x8a, 0xec, 0xcf, 0xdd, 0x65, 0x5d, 0xc1, 0xaa, 0x86, 0x53,
2710 0xd5, 0xde, 0xbb, 0x23, 0x24, 0xb8, 0x9b, 0x74, 0x03, 0x20, 0xb4, 0xf0, 0xe4, 0xdd, 0xd2, 0x03,
2711 0xfd, 0x67, 0x55, 0x19, 0x28, 0x1d, 0xc1, 0xb8, 0xa5, 0x89, 0x0e, 0xc0, 0x80, 0x9d, 0xdd, 0xda,
2712 0x9d, 0x30, 0x5c, 0xc8, 0xbb, 0xfe, 0x8f, 0xce, 0xd5, 0xf6, 0xdf, 0xfa, 0x14, 0xaf, 0xe4, 0xba,
2714 0xb0, 0x84, 0x45, 0xd8, 0x67, 0xa7, 0xd0, 0xce, 0x89, 0x2a, 0x30, 0x8c, 0xfa, 0xe9, 0x65, 0xa4,
2715 0x21, 0x2d, 0x6b, 0xa2, 0x9b, 0x8f, 0x92, 0xbd, 0x3a, 0x10, 0x71, 0x12, 0xc2, 0x02, 0x3d, 0xd5,
2716 0x83, 0x1d, 0xfa, 0x42, 0xb7, 0x48, 0x1b, 0x31, 0xe3, 0x82, 0x90, 0x2d, 0x91, 0x59, 0xf9, 0x38,
2717 0x52, 0xe5, 0xdb, 0xc1, 0x4d, 0x3a, 0xe6, 0x9b, 0x6a, 0xbb, 0xea, 0xa4, 0x8d, 0x5e, 0xc4, 0x00,
2719 0x01, 0xb8, 0xec, 0x91, 0xc1, 0xdb, 0x63, 0xbd, 0x57, 0xb6, 0x26, 0x15, 0xb6, 0x3e, 0xa2, 0xdf,
2720 0x62, 0x8d, 0xa8, 0xbe, 0xe1, 0xf1, 0x39, 0xbd, 0x18, 0xd2, 0x6f, 0xd7, 0xda, 0xdc, 0x71, 0x30,
2721 0xf1, 0x21, 0x71, 0xa4, 0x08, 0x43, 0x46, 0xdf, 0x50, 0xbd, 0x3c, 0x60, 0x5b, 0x63, 0x35, 0xe3,
2722 0x37, 0x5b, 0x25, 0x17, 0x54, 0x5e, 0x68, 0x60, 0xb6, 0x49, 0xef, 0x6e, 0x09, 0xef, 0xda, 0x90,
2723 0x3e, 0xd4, 0x09, 0x33, 0x36, 0x57, 0x9a, 0x14, 0xbd, 0xf7, 0xb1, 0x98, 0x30, 0x42, 0x03, 0x84,
2724 0x61, 0xeb, 0x8e, 0x50, 0xdc, 0x6a, 0x93, 0x1b, 0x32, 0x51, 0xf9, 0xc6, 0xc2, 0x19, 0xb3, 0x5d,
2725 0xe2, 0xf8, 0xc5, 0x8f, 0x68, 0xaa, 0x1d, 0xdb, 0xd3, 0x7f, 0x8d, 0x98, 0x9c, 0x16, 0x8c, 0xc3,
2726 0xcd, 0xd9, 0xdb, 0x08, 0xe6, 0x36, 0x60, 0xb6, 0x36, 0xdc, 0x1d, 0x59, 0xb6, 0x5f, 0x01, 0x5e
2731 ok(
result,
"failed to import the public key\n");
2733 dwDataLen=
sizeof(algID);
2735 ok(
result,
"failed to get the KP_ALGID from the imported public key\n");
2736 ok(algID ==
CALG_RSA_KEYX,
"Expected CALG_RSA_KEYX, got %x\n", algID);
2739 dwDataLen =
sizeof(
DWORD);
2743 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_DECRYPT|CRYPT_ENCRYPT," " got %08lx\n", dwVal);
2745 ok(
result,
"failed to export the fresh imported public key\n");
2746 ok(dwLen == 84,
"Expected exported key to be 84 bytes long but got %ld bytes.\n",dwLen);
2747 ok(!
memcmp(emptyKey, abPlainPublicKey, dwLen),
"exported key is different from the imported key\n");
2763 ok(dwDataLen ==
sizeof(expected_exported_priv_key),
"unexpected size %ld\n",
2765 ok(!
memcmp(exported_key, expected_exported_priv_key, dwDataLen),
2766 "unexpected value\n");
2796 result = !
memcmp(exported_key, exported_key2, dwDataLen);
2799 trace(
"Expected public key (%lu):\n", dwDataLen);
2801 trace(
"AT_KEYEXCHANGE public key (%lu):\n", dwDataLen);
2808 sizeof(abPlainPublicKey), 0, 0, &hPublicKey);
2809 ok(
result,
"failed to import the public key\n");
2823 result = !
memcmp(exported_key, exported_key2, dwDataLen);
2826 trace(
"Expected public key (%lu):\n", dwDataLen);
2828 trace(
"AT_KEYEXCHANGE public key (%lu):\n", dwDataLen);
2839 static const struct rfc2202_test_case {
2843 const DWORD data_len;
2846 {
"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
2847 "\x0b\x0b\x0b\x0b", 20,
2849 "\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e"
2850 "\xf1\x46\xbe\x00" },
2852 "what do ya want for nothing?", 28,
2853 "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c"
2854 "\x25\x9a\x7c\x79" },
2855 {
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2856 "\xaa\xaa\xaa\xaa", 20,
2857 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
2858 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
2859 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
2861 "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f"
2862 "\x63\xf1\x75\xd3" },
2863 {
"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
2864 "\x11\x12\x13\x14\x15\x16\x17\x18\x19", 25,
2865 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
2866 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
2867 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
2869 "\x4c\x90\x07\xF4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c"
2870 "\x2d\x72\x35\xda" },
2871 {
"\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c"
2872 "\x0c\x0c\x0c\x0c", 20,
2873 "Test With Truncation", 20,
2874 "\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2\x7b\xe1\xd5\x8b\xb9\x32"
2875 "\x4a\x9a\x5a\x04" },
2876 {
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2877 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2878 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2879 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2880 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
2882 "Test Using Larger Than Block-Size Key - Hash Key First", 54,
2883 "\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70\x56\x37\xce\x8a\x3b\x55"
2884 "\xed\x40\x21\x12" },
2885 {
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2886 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2887 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2888 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2889 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
2891 "Test Using Larger Than Block-Size Key and Larger "
2892 "Than One Block-Size Data", 73,
2893 "\xe8\xe9\x9D\x0f\x45\x23\x7d\x78\x6d\x6b\xba\xa7\x96\x5c\x78\x08"
2894 "\xbb\xff\x1a\x91" }
2900 const struct rfc2202_test_case *test_case = &cases[
i];
2908 BYTE *key_bytes = (
BYTE *)(key_len + 1);
2916 *key_len = test_case->key_len;
2917 memcpy(key_bytes, test_case->key, *key_len);
2933 digest_size =
sizeof(digest);
2936 ok(!
memcmp(digest, test_case->digest,
sizeof(digest)),
"Unexpected value on test case %ld\n",
i);
2948 HCRYPTKEY hRSAKey, hMasterSecret, hServerWriteKey, hServerWriteMACKey;
2955 BYTE abTLS1Master[140] = {
2956 0x01, 0x02, 0x00, 0x00, 0x06, 0x4c, 0x00, 0x00,
2957 0x00, 0xa4, 0x00, 0x00, 0x5b, 0x13, 0xc7, 0x68,
2958 0xd8, 0x55, 0x23, 0x5d, 0xbc, 0xa6, 0x9d, 0x97,
2959 0x0e, 0xcd, 0x6b, 0xcf, 0xc0, 0xdc, 0xc5, 0x53,
2960 0x28, 0xa0, 0xca, 0xc1, 0x63, 0x4e, 0x3a, 0x24,
2961 0x22, 0xe5, 0x4d, 0x15, 0xbb, 0xa5, 0x06, 0xc3,
2962 0x98, 0x25, 0xdc, 0x35, 0xd3, 0xdb, 0xab, 0xb8,
2963 0x44, 0x1b, 0xfe, 0x63, 0x88, 0x7c, 0x2e, 0x6d,
2964 0x34, 0xd9, 0x0f, 0x7e, 0x2f, 0xc2, 0xb2, 0x6e,
2965 0x56, 0xfa, 0xab, 0xb2, 0x88, 0xf6, 0x15, 0x6e,
2966 0xa8, 0xcd, 0x70, 0x16, 0x94, 0x61, 0x07, 0x40,
2967 0x9e, 0x25, 0x22, 0xf8, 0x64, 0x9f, 0xcc, 0x0b,
2968 0xf1, 0x92, 0x4d, 0xfe, 0xc3, 0x5d, 0x52, 0xdb,
2969 0x0f, 0xff, 0x12, 0x0f, 0x49, 0x43, 0x7d, 0xc6,
2970 0x52, 0x61, 0xb0, 0x06, 0xc8, 0x1b, 0x90, 0xac,
2971 0x09, 0x7e, 0x4b, 0x95, 0x69, 0x3b, 0x0d, 0x41,
2972 0x1b, 0x4c, 0x65, 0x75, 0x4d, 0x85, 0x16, 0xc4,
2973 0xd3, 0x1e, 0x82, 0xb3
2975 BYTE abServerSecret[33] =
"Super Secret Server Secret 12345";
2976 BYTE abClientSecret[33] =
"Super Secret Client Secret 12345";
2977 BYTE abHashedHandshakes[37] =
"123456789012345678901234567890123456";
2978 BYTE abClientFinished[16] =
"client finished";
2979 BYTE abData[16] =
"Wine rocks!";
2981 static const BYTE abEncryptedData[16] = {
2982 0x13, 0xd2, 0xdd, 0xeb, 0x6c, 0x3f, 0xbe, 0xb2,
2983 0x04, 0x86, 0xb5, 0xe5, 0x08, 0xe5, 0xf3, 0x0d
2985 static const BYTE abPRF[16] = {
2986 0xa8, 0xb2, 0xa6, 0xef, 0x83, 0x4e, 0x74, 0xb1,
2987 0xf3, 0xb1, 0x51, 0x5a, 0x1a, 0x2b, 0x11, 0x31
2989 static const BYTE abMD5[16] = {
2990 0xe1, 0x65, 0x3f, 0xdb, 0xbb, 0x3d, 0x99, 0x3c,
2991 0x3d, 0xca, 0x6a, 0x6f, 0xfa, 0x15, 0x4e, 0xaa
3009 dwLen =
sizeof(abTLS1Master);
3020 "expected ERROR_INVALID_PARAMETER, got %08lx\n",
GetLastError());
3025 data_blob.
pbData = abClientSecret;
3030 data_blob.
pbData = abServerSecret;
3040 win_skip(
"Broken TLS1 hash creation\n");
3053 "expected NTE_BAD_FLAGS, got %08lx\n",
GetLastError());
3059 saSChannelAlg.
cBits = 64;
3067 saSChannelAlg.
cBits = 128;
3091 data_blob.
pbData = abHashedHandshakes;
3096 data_blob.
pbData = abClientFinished;
3101 dwLen =
sizeof(abData);
3103 ok (
result && (dwLen==
sizeof(abData)) && !
memcmp(abData, abPRF,
sizeof(abData)),
3120 dwLen =
sizeof(abMD5Hash);
3141 static const char test_string[] =
"Well this is a fine how-do-you-do.";
3146 DWORD dataLen, keyLen;
3188 ok(dataLen ==
sizeof(
test_string),
"unexpected size %ld\n", dataLen);
3210 "Expected dwBufferLen to be (MAX_PATH + 1), it was : %ld\n", dwBufferLen);
3213 dwBufferLen =
sizeof(abContainerName);
3219 if (!
strcmp((
const char*)abContainerName,
"winetest")) fFound =
TRUE;
3220 dwBufferLen =
sizeof(abContainerName);
32270x07,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x52,0x53,0x41,0x32,0x00,0x02,0x00,0x00,
32280x01,0x00,0x01,0x00,0xf1,0x82,0x9e,0x84,0xb5,0x79,0x9a,0xbe,0x4d,0x06,0x20,0x21,
32290xb1,0x89,0x0c,0xca,0xb0,0x35,0x72,0x18,0xc6,0x92,0xa8,0xe2,0xb1,0xe1,0xf6,0x56,
32300x53,0x99,0x47,0x10,0x6e,0x1c,0x81,0xaf,0xb8,0xf9,0x5f,0xfe,0x76,0x7f,0x2c,0x93,
32310xec,0x54,0x7e,0x5e,0xc2,0x25,0x3c,0x50,0x56,0x10,0x20,0x72,0x4a,0x93,0x03,0x12,
32320x29,0x98,0xcc,0xc9,0x47,0xbf,0xbf,0x93,0xcc,0xb0,0xe5,0x53,0x14,0xc8,0x7e,0x1f,
32330xa4,0x03,0x2d,0x8e,0x84,0x7a,0xd2,0xeb,0xf7,0x92,0x5e,0xa2,0xc7,0x6b,0x35,0x7d,
32340xcb,0x60,0xae,0xfb,0x07,0x78,0x11,0x73,0xb5,0x79,0xe5,0x7e,0x96,0xe3,0x50,0x95,
32350x80,0x0e,0x1c,0xf6,0x56,0xc6,0xe9,0x0a,0xaf,0x03,0xc6,0xdc,0x9a,0x81,0xcf,0x7a,
32360x63,0x16,0x43,0xcd,0xab,0x74,0xa1,0x7d,0xe7,0xe0,0x75,0x6d,0xbd,0x19,0xae,0x0b,
32370xa3,0x7f,0x6a,0x7b,0x05,0x4e,0xbc,0xec,0x18,0xfc,0x19,0xc2,0x00,0xf0,0x6a,0x2e,
32380xc4,0x31,0x73,0xba,0x07,0xcc,0x9d,0x57,0xeb,0xc7,0x7c,0x00,0x7d,0x5d,0x11,0x16,
32390x42,0x4b,0xe5,0x3a,0xf5,0xc7,0xf8,0xee,0xc3,0x2c,0x0d,0x86,0x03,0xe2,0xaf,0xb2,
32400xd2,0x91,0xdb,0x71,0xcd,0xdf,0x81,0x5f,0x06,0xfc,0x48,0x0d,0xb6,0x88,0x9f,0xc1,
32410x5e,0x24,0xa2,0x05,0x4f,0x30,0x2e,0x8f,0x8b,0x0d,0x76,0xa1,0x84,0xda,0x7b,0x44,
32420x70,0x85,0xf1,0x50,0xb1,0x21,0x3d,0xe2,0x57,0x3d,0xd0,0x01,0x93,0x49,0x8e,0xc5,
32430x0b,0x8b,0x0d,0x7b,0x08,0xe9,0x14,0xec,0x20,0x0d,0xea,0x02,0x00,0x63,0xe8,0x0a,
32440x52,0xe8,0xfb,0x21,0xbd,0x37,0xde,0x4c,0x4d,0xc2,0xf6,0xb9,0x0d,0x2a,0xc3,0xe2,
32450xc9,0xdf,0x48,0x3e,0x55,0x3d,0xe3,0xc0,0x22,0x37,0xf9,0x52,0xc0,0xd7,0x61,0x22,
32460xb6,0x85,0x86,0x07 };
3253 DWORD keySpec, dataLen,dwParam;
3258 "Expected NTE_BAD_PROV_TYPE, got %08lx\n",
GetLastError());
3261 "Expected ERROR_INVALID_PARAMETER or NTE_BAD_KEYSET, got %08lx\n",
GetLastError());
3265 "Expected ERROR_INVALID_PARAMETER or NTE_BAD_KEYSET, got %08lx\n",
GetLastError());
3269 "Expected NTE_BAD_KEYSET, got %08lx\n",
GetLastError());
3272 "Expected NTE_BAD_KEYSET, got %08lx\n",
GetLastError());
3281 "Expected NTE_BAD_KEYSET, got %08lx\n",
GetLastError());
3286 dataLen =
sizeof(keySpec);
3290 "Expected AT_KEYEXCHANGE | AT_SIGNATURE, got %08lx\n", keySpec);
3320 "Expected NTE_BAD_KEYSET, got %08lx\n",
GetLastError());
3324 "Expected NTE_BAD_FLAGS, got %08lx\n",
GetLastError());
3330 dataLen =
sizeof(dwParam);
3333 "Expected PROV_RSA_FULL, got 0x%08lX\n",dwParam);
3334 dataLen =
sizeof(dwParam);
3336 ok(
result && dataLen ==
sizeof(dwParam) && dwParam == 0,
3337 "Expected 0, got 0x%08lX\n",dwParam);
3338 dataLen =
sizeof(dwParam);
3341 "Expected CRYPT_SEC_DESCR to be set, got 0x%08lX\n",dwParam);
3342 dataLen =
sizeof(keySpec);
3346 "Expected AT_KEYEXCHANGE | AT_SIGNATURE, got %08lx\n", keySpec);
3348 dataLen =
sizeof(
szName);
3351 "failed getting PP_CONTAINER. result = %s. Error 0x%08lX. returned length = %ld\n",
3354 dataLen =
sizeof(
szName);
3361 ok(dataLen ==
strlen(
container) + 1,
"Expected a param length of 70, got %ld\n", dataLen);
3417 ok(!
result,
"expected CryptGetUserKey to fail\n");
3437 ok(!
result,
"expected CryptGetUserKey to fail\n");
3475 ok(
result,
"CryptAcquireContextA with CRYPT_DELETEKEYSET|CRYPT_MACHINE_KEYSET failed: %08lx\n",
3480 "Expected NTE_BAD_KEYSET, got %08lx\n",
GetLastError());
3498 dwLen =
sizeof(
DWORD);
3502 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT got %08lx\n", dwVal);
3511 dwVal &= ~CRYPT_EXPORT;
3516 dwLen =
sizeof(
DWORD);
3520 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT got %08lx\n", dwVal);
3534 dwLen =
sizeof(
DWORD);
3538 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT got %08lx\n", dwVal);
3552 static BYTE abSessionKey[148] = {
3553 0x01, 0x02, 0x00, 0x00, 0x01, 0x68, 0x00, 0x00,
3554 0x00, 0xa4, 0x00, 0x00, 0xb8, 0xa4, 0xdf, 0x5e,
3555 0x9e, 0xb1, 0xbf, 0x85, 0x3d, 0x24, 0x2d, 0x1e,
3556 0x69, 0xb7, 0x67, 0x13, 0x8e, 0x78, 0xf2, 0xdf,
3557 0xc6, 0x69, 0xce, 0x46, 0x7e, 0xf2, 0xf2, 0x33,
3558 0x20, 0x6f, 0xa1, 0xa5, 0x59, 0x83, 0x25, 0xcb,
3559 0x3a, 0xb1, 0x8a, 0x12, 0x63, 0x02, 0x3c, 0xfb,
3560 0x4a, 0xfa, 0xef, 0x8e, 0xf7, 0x29, 0x57, 0xb1,
3561 0x9e, 0xa7, 0xf3, 0x02, 0xfd, 0xca, 0xdf, 0x5a,
3562 0x1f, 0x71, 0xb6, 0x26, 0x09, 0x24, 0x39, 0xda,
3563 0xc0, 0xde, 0x2a, 0x0e, 0xcd, 0x1f, 0xe5, 0xb6,
3564 0x4f, 0x82, 0xa0, 0xa9, 0x90, 0xd3, 0xd9, 0x6a,
3565 0x43, 0x14, 0x2a, 0xf7, 0xac, 0xd5, 0xa0, 0x54,
3566 0x93, 0xc4, 0xb9, 0xe7, 0x24, 0x84, 0x4d, 0x69,
3567 0x5e, 0xcc, 0x2a, 0x32, 0xb5, 0xfb, 0xe4, 0xb4,
3568 0x08, 0xd5, 0x36, 0x58, 0x59, 0x40, 0xfb, 0x29,
3569 0x7f, 0xa7, 0x17, 0x25, 0xc4, 0x0d, 0x78, 0x37,
3570 0x04, 0x8c, 0x49, 0x92
3586 dwLen =
sizeof(abSessionKey);
3612 unsigned char pbData[128], dvData[512];
3616 ALG_ID crypt_algo, hash_algo;
3619 const char *expected_hash, *expected_enc;
3623 "\xBA\xBF\x93\xAE\xBC\x77\x45\xAA\x7E\x45\x69\xE5\x90\xE6\x04\x7F",
3624 "\x5D\xDA\x25\xA6\xB5\xC4\x43\xFB",
3628 "\xDA\x4A\x9F\x5D\x2E\x7A\x3A\x4B\xBF\xDE\x47\x5B\x06\x84\x48\xA7",
3629 "\x6B\x18\x3B\xA1\x89\x27\xBF\xD4",
3633 "\x38\xE5\x2E\x95\xA4\xA3\x73\x88\xF8\x1F\x87\xB7\x74\xB1\xA1\x56",
3634 "\x91\xAB\x17\xE5\xDA\x27\x11\x7D",
3638 "\x7D\xA4\xB1\x10\x43\x26\x76\xB1\x0D\xB6\xE6\x9C\xA5\x8B\xCB\xE6",
3639 "\x7D\x45\x3D\x56\x00\xD7\xD1\x54",
3643 "\xFF\x32\xF1\x69\x62\xDE\xEB\x53\x8C\xFF\xA6\x92\x58\xA8\x22\xEA",
3648 "\x8A\xF2\xA3\xDA\xA5\x9A\x8B\x42\x4C\xE0\x2E\x00\xE5\x1E\x98\xE4",
3653 "\xAE\xFE\xD6\xA5\x3E\x4B\xAC\xFA\x0E\x92\xC4\xC0\x06\xC9\x2B\xFD",
3658 "\x30\xF4\xBC\x33\x93\xF3\x58\x19\xD1\x2B\x73\x4A\x92\xC7\xFC\xD7",
3663 "\x07\x3B\x12\xE9\x96\x93\x85\xD7\xEC\xF4\xB1\xAC\x89\x2D\xC6\x9A",
3668 "\xD2\x37\xE2\x49\xEB\x99\x23\xDA\x3E\x88\x55\x7E\x04\x5E\x15\x5D",
3669 "\xA1\x64\x3F\xFE\x99\x7F\x24\x13\x0C\xA9\x03\xEF\x9B\xC8\x1F\x2A",
3673 "\x3E\x74\xED\xBF\x23\xAB\x03\x09\xBB\xD3\xE3\xAB\xCA\x12\x72\x7F",
3674 "\x5D\xEC\xF8\x72\xB2\xA6\x4D\x5C\xEA\x38\x9E\xF0\x86\xB6\x79\x34",
3678 "\xBE\x9A\xE8\xF6\xCE\x79\x86\x5C\x1B\x01\x96\x4E\x5A\x8D\x09\x33",
3679 "\xD9\x4B\xC2\xE3\xCA\x89\x8B\x94\x0D\x87\xBB\xA2\xE8\x3D\x5C\x62",
3684 "\xE8\x2F\x96\xC4\x6C\xC1\x91\xB4\x78\x40\x56\xD8\xA0\x25\xF5\x71",
3685 "\x21\x5A\xBD\x26\xB4\x3E\x86\x04",
3689 "\x23\xBB\x6F\xE4\xB0\xF6\x35\xB6\x89\x2F\xEC\xDC\x06\xA9\xDF\x35",
3690 "\x9B\xE5\xD1\xEB\x8F\x13\x0B\xB3",
3694 "\xE4\x72\x48\xC6\x6E\x38\x2F\x00\xC9\x2D\x01\x12\xB7\x8B\x64\x09",
3695 "\x7D\x5E\xAA\xEA\x10\xA4\xA4\x44",
3699 "\xBF\x54\xDA\x3A\x56\x72\x0D\x9F\x30\x7D\x2F\x54\x13\xB2\xD7\xC6",
3700 "\x77\x42\x0E\xD2\x60\x29\x6F\x68",
3704 "\x9B\x74\x6D\x22\x11\x16\x05\x50\xA3\x75\x6B\xB2\x38\x8C\x2B\xC6",
3709 "\x51\xA8\x29\x8D\xE0\x36\xC1\xD3\x5E\x6A\x51\x4F\xE1\x65\xEE\xF1",
3714 "\xA6\x83\x13\x4C\xB1\xAA\x06\x16\xE6\x4E\x7F\x0B\x8D\x19\xF5\x45",
3719 "\x04\x24\xC8\x64\x98\x84\xE3\x3A\x7B\x9C\x50\x3E\xE7\xC4\x89\x82",
3724 "\xF6\xEF\x81\xF8\xF2\xA3\xF6\x11\xFE\xA4\x7D\xC1\xD2\xF7\x7C\xDC",
3729 "\xFF\xE9\x69\xFF\xC1\xDB\x08\xD4\x5B\xC8\x51\x71\x38\xEF\x8A\x5B",
3730 "\x8A\x24\xD0\x7A\x03\xE7\xA7\x02\xF2\x17\x4C\x01\xD5\x0E\x7F\x12",
3734 "\x12\x01\xDD\x25\xBA\x8F\x1B\xCB\x7B\xAD\x3F\xDF\xB2\x68\x4F\x6A",
3735 "\xA9\x56\xBC\xA7\x97\x4E\x28\xAA\x4B\xE1\xA0\x6C\xE2\x43\x2C\x61",
3739 "\x69\x08\x9F\x76\xD7\x9A\x93\x6F\xC7\x51\xA4\x00\xCF\x5A\xBB\x3D",
3740 "\x04\x07\xEA\xD9\x89\x0A\xD2\x65\x12\x13\x68\x9A\xD0\x86\x15\xED",
3745 "\xEA\x01\x47\xA0\x7F\x96\x44\x6B\x0D\x95\x2C\x97\x4B\x28\x1C\x86",
3746 "\xF3\x75\xCC\x7C\x6C\x0B\xCF\x93",
3750 "\xD2\xA2\xD7\x87\x32\x29\xF9\xE0\x45\x0D\xEC\x8D\xB5\xBC\x8A\xD9",
3751 "\x51\x70\xE0\xB7\x00\x0D\x3E\x21",
3755 "\x2B\x36\xA2\x85\x85\xC0\xEC\xBE\x04\x56\x1D\x97\x8E\x82\xDB\xD8",
3756 "\x58\x23\x75\x25\x3F\x88\x25\xEB",
3760 "\x3B\x89\x72\x3B\x8A\xD1\x2E\x13\x44\xD6\xD0\x97\xE6\xB8\x46\xCD",
3761 "\x90\x1C\x77\x45\x87\xDD\x1C\x2E",
3765 "\x00\x6D\xEF\xB1\xC8\xC6\x25\x5E\x45\x4F\x4E\x3D\xAF\x9C\x53\xD2",
3770 "\x56\x49\xDC\xBA\x32\xC6\x0D\x84\xE9\x2D\x42\x8C\xD6\x7C\x4A\x7A",
3775 "\xDF\xD6\x3A\xE6\x3E\x8D\xB4\x17\x9F\x29\xF0\xFD\x6D\x98\x98\xAD",
3780 "\xD4\x4D\x60\x9A\x39\x27\x88\xB7\xD7\xB4\x34\x2F\x92\x61\x3C\xA8",
3785 "\xF4\x83\x2E\x02\xDE\xAE\x46\x1F\xE1\x31\x65\x03\x08\x58\xE0\x7D",
3790 "\x0E\xA0\x40\x72\x55\xE5\x4C\xEB\x79\xCB\x48\xC3\xD1\xB1\xD0\xF4",
3791 "\x97\x66\x92\x02\x6D\xEC\x33\xF8\x4E\x82\x11\x20\xC7\xE2\xE6\xE8",
3795 "\x3F\x91\x5E\x09\x19\x11\x14\x27\xCA\x6A\x20\x24\x3E\xF0\x02\x3E",
3796 "\x9B\xDA\x73\xF4\xF3\x06\x93\x07\xC9\x32\xF1\xD8\xD4\x96\xD1\x7D",
3800 "\x27\x51\xD8\xB3\xC7\x14\x66\xE1\x99\xC3\x5C\x9C\x90\xF5\xE5\x94",
3801 "\x2A\x0F\xE9\xA9\x6F\x53\x7C\x9E\x07\xE6\xC3\xC9\x15\x99\x7C\xA8",
3806 "\xC1\x91\xF6\x5A\x81\x87\xAC\x6D\x48\x7C\x78\xF7\xEC\x37\xE2\x0C\xEC\xF7\xC0\xB8",
3807 "\xD4\xD8\xAA\x44\xAC\x5E\x0B\x8D",
3811 "\x5D\x9B\xC3\x99\xC4\x73\x90\x78\xCB\x51\x6B\x61\x8A\xBE\x1A\xF3\x7A\x90\xF3\x34",
3812 "\xD8\x1C\xBC\x6C\x92\xD3\x09\xBF",
3816 "\x90\xB8\x01\x89\xEC\x9A\x6C\xAD\x1E\xAC\xB3\x17\x0A\x44\xA2\x4D\x80\xA5\x25\x97",
3817 "\xBD\x58\x5A\x88\x98\xF8\x69\x9A",
3821 "\x42\xBD\xB8\xF2\xB5\xC2\x28\x64\x85\x98\x8E\x49\xE6\xDC\x92\x80\xCD\xC1\x63\x00",
3822 "\xCC\xFB\x1A\x4D\x29\xAD\x3E\x65",
3826 "\x67\x36\xE9\x57\x5E\xCD\x56\x5E\x8B\x25\x35\x23\x74\xBA\x20\x46\xD0\x21\xDE\x0A",
3831 "\x5F\x29\xA5\xA4\x10\x08\x56\x15\x92\xF9\x55\x3B\x4B\xF5\xAB\xBD\xE7\x4D\x47\x28",
3836 "\xD3\xB7\xF8\xB9\xBE\x67\xD1\xFE\x10\x51\x23\x3B\x7D\xB7\x61\xF5\xA7\x1A\x02\x5E",
3841 "\x09\x68\x97\x23\x11\x2B\x6A\x71\xBA\x33\x60\x43\xEE\xC9\x9B\xB7\x8F\x8A\x2E\x33",
3846 "\xCF\x28\x23\x83\x62\x87\x43\xF6\x50\x57\xED\x54\xEC\x93\x5E\xEC\x0E\xD3\x23\x9A",
3851 "\x81\xC1\x7E\x42\xC3\x07\x1F\x5E\xF8\x75\xA3\x5A\xFC\x0B\x61\xBA\x0B\xD8\x53\x0D",
3852 "\x39\xCB\xAF\xD7\x8B\x75\x4A\x3B\xD2\x0E\x0D\xB1\x64\x57\x88\x58",
3856 "\x93\xA7\xE8\x9E\x96\xB5\x97\x23\xD0\x58\x44\x8C\x4D\xBB\xAB\xB6\x3E\x1F\x2C\x1D",
3857 "\xA9\x13\x83\xCA\x21\xA2\xF0\xBE\x13\xBC\x55\x04\x38\x08\xA9\xC4",
3861 "\x15\x6A\xB2\xDF\x32\x57\x14\x69\x09\x07\xAD\x24\x83\xA1\x74\x47\x41\x72\x69\xBC",
3862 "\xE1\x6C\xA8\x54\x0E\x24\x67\x6D\xCA\xA2\xFE\x84\xF0\x9B\x78\x66",
3867 "\x20\x34\xf7\xbb\x7a\x3a\x79\xf0\xb9\x65\x18\x11\xaa\xfd\x26\x6b"
3868 "\x60\x5c\x6d\x4c\x81\x7c\x3f\xc4\xce\x94\xe3\x67\xdf\xf2\x16\xd8",
3869 "\x86\x0d\x8c\xf4\xc0\x22\x4a\xdd",
3873 "\x09\x6e\x7f\xd5\xf2\x72\x4e\x18\x70\x09\xc1\x35\xf4\xd1\x3a\xe8"
3874 "\xe6\x1f\x91\xae\x2f\xfd\xa8\x8c\xce\x47\x0f\x7a\xf5\xef\xfd\xbe",
3875 "\x2d\xe7\x63\xf6\x58\x4d\x9a\xa6",
3879 "\x54\x7f\x84\x7f\xfe\x83\xc6\x50\xbc\xd9\x92\x78\x32\x67\x50\x7d"
3880 "\xdf\x44\x55\x7d\x87\x74\xd2\x56\xff\xd9\x74\x44\xd5\x07\x9e\xdc",
3881 "\x20\xaa\x66\xd0\xac\x83\x9d\x99",
3885 "\xc6\x22\x46\x15\xa1\x27\x38\x23\x91\xf2\x29\xda\x15\xc9\x5d\x92"
3886 "\x7c\x34\x4a\x1f\xb0\x8a\x81\xd6\x17\x09\xda\x52\x1f\xb9\x64\x60",
3887 "\x8c\x01\x19\x47\x7e\xd2\x10\x2c",
3891 "\xcd\x53\x95\xa6\xb6\x6e\x25\x92\x78\xac\xe6\x7e\xfc\xd3\x8d\xaa"
3892 "\xc3\x15\x83\xb5\xe6\xaf\xf9\x32\x4c\x17\xb8\x82\xdf\xc0\x45\x9e",
3897 "\x2a\x3b\x08\xe1\xec\xa7\x04\xf9\xc9\x42\x74\x9a\x82\xad\x99\xd2"
3898 "\x10\x51\xe3\x51\x6c\x67\xa4\xf2\xca\x99\x21\x43\xdf\xa0\xfc\xa1",
3903 "\x10\x1d\x36\xc7\x38\x73\xc3\x80\xf0\x7a\x4e\x25\x52\x8a\x5c\x3f"
3904 "\xfc\x41\xa7\xe5\x20\xed\xd5\x1d\x00\x6e\x77\xf4\xa7\x71\x81\x6b",
3909 "\x0a\x74\xde\x4f\x07\xce\x73\xd6\xd9\xa3\xba\xbb\x7c\x98\xe1\x94"
3910 "\x13\x93\xb1\xfd\x26\x31\x4b\xfc\x61\x27\xef\x4d\xd0\x48\x76\x67",
3915 "\xf0\x13\xbc\x25\x2a\x2f\xba\xf1\x39\xe5\x7d\xb8\x5f\xaa\xd0\x19"
3916 "\xbd\x1c\xd8\x7b\x39\x5a\xb3\x85\x84\x80\xbd\xe0\x4a\x65\x03\xdd",
3921 "\xc8\xc2\x6f\xe2\xbe\xa7\x38\x87\x04\xc7\x39\xcb\x9f\x57\xfc\xde"
3922 "\x14\x81\x46\xa4\xbb\xa7\x0f\x01\x1d\xc2\x6d\x7a\x43\x5f\x38\xc3",
3923 "\xf8\x75\xc6\x71\x8b\xb6\x54\xd3\xdc\xff\x0e\x84\x8a\x3f\x19\x46",
3927 "\xb7\x3a\x43\x0f\xea\x90\x4f\x0f\xb9\x82\xf6\x1e\x07\xc4\x25\x4e"
3928 "\xdb\xe7\xf7\x1d\x7c\xd0\xe5\x51\xd8\x1b\x97\xc8\xc2\x46\xb9\xfe",
3929 "\x35\xf2\x20\xc7\x6c\xb2\x8e\x51\x3e\xc7\x6b\x3e\x64\xa5\x05\xdf",
3933 "\xbd\xcc\x0c\x59\x99\x29\xa7\x24\xf3\xdc\x20\x40\x4e\xe8\xe5\x48"
3934 "\xdd\x27\x0e\xdf\x7e\x50\x65\x17\x34\x50\x47\x78\x9a\x23\x1b\x40",
3935 "\x8c\xeb\x1f\xd3\x78\x77\xf5\xbf\x7a\xde\x8d\x2c\xa5\x16\xcc\xe9",
3940 memset(old_broken, 0,
sizeof(old_broken));
3941 old_broken[3] = old_broken[4] = old_broken[15] = old_broken[16] = 1;
3942 old_broken[27] = old_broken[28] = old_broken[39] = old_broken[40] = 1;
3943 old_broken[48] = old_broken[49] = old_broken[50] = old_broken[51] = 1;
3944 old_broken[52] = old_broken[53] = old_broken[54] = old_broken[55] = 1;
3945 old_broken[56] = old_broken[57] = old_broken[58] = old_broken[59] = 1;
3950 if (old_broken[
i])
continue;
3952 for (
j=0;
j<
sizeof(dvData);
j++) dvData[
j] = (
unsigned char)
j+
i;
3959 trace(
"hash %x not supported\n",
tests[
i].hash_algo);
3969 ok(
result,
"Test [%s %ld]: CryptGetHashParam failed with error 0x%08lx\n", prov,
i,
GetLastError());
3970 ok(
len ==
tests[
i].hashlen,
"Test [%s %ld]: Expected hash len %d, got %ld\n",
3973 "Test [%s %ld]: Hash comparison failed\n", prov,
i);
3992 ok(
len ==
tests[
i].blocklen,
"Test [%s %ld]: Expected block len %d, got %ld\n",
3995 "Test [%s %ld]: Encrypted data comparison failed\n", prov,
i);
4005 static const DWORD test_lengths[] = { 128 + 8, 256, 512, 1024 };
4008 {0xc13650cf, 0xa3e93efb},
4009 {0x6f7be248, 0x444b38b2},
4010 {0x2c3534d2, 0x29fca10c},
4011 {0x2c3534d2, 0x29fca10c},
4013 static const DWORD mac_baseprov_results[
ARRAY_SIZE(test_lengths)][2] =
4015 {0x7e94a244, 0x12a9ae17},
4016 {0x2aaa6719, 0xa671d9a6},
4017 {0x2e730ce2, 0x9ebe6016},
4018 {0x2e730ce2, 0x9ebe6016},
4022 {0xebe2155a, 0xab2f58b7},
4023 {0x4394ccb2, 0xbe5c629b},
4024 {0xd7bc2195, 0x63fb2785},
4025 {0xd7bc2195, 0x63fb2785},
4027 static const DWORD mac_baseprov_results_old[
ARRAY_SIZE(test_lengths)][2] =
4029 {0xe2ed2dec, 0x5ae837ed},
4030 {0x12f4b193, 0xe3f6afc1},
4031 {0x04d7f905, 0x686d357b},
4032 {0x04d7f905, 0x686d357b},
4036 {0x2f44586d, 0x76d04c9f, 0xdae8fc03, 0x27e870bd},
4037 {0xbcde3186, 0xd9892cd5, 0x578c89f5, 0xc2cba8e5},
4038 {0xad2bf1cc, 0xae4e2c1f, 0xd1599a67, 0x0167d802},
4039 {0x6ee75968, 0x52a0eff5, 0x75340d85, 0x87b64962},
4041 static const DWORD decrypt_baseprov_results[
ARRAY_SIZE(test_lengths)][2] =
4043 {0x48c4ff05, 0x9d880b90},
4044 {0xcfee0629, 0xfeab04a1},
4045 {0x23c9336c, 0x7f67b26e},
4046 {0x23c9336c, 0x7f67b26e},
4050 {0xb37e1be2, 0x1ed67048},
4051 {0x7c7d0b04, 0x3a74bb76},
4052 {0x7bfd232c, 0x93d52c4f},
4053 {0x7bfd232c, 0x93d52c4f},
4088 ok(!
ret,
"Expected failure.\n");
4093 ok(
ret,
"CryptGetUserKey failed.\n");
4095 memset(&key_data.h, 0,
sizeof(key_data.h));
4101 memset(key_data.data, 0xcc,
sizeof(key_data.data));
4109 memset(key_data.data +
len, 0xee,
sizeof(key_data.data) -
len);
4115 ok(!
ret,
"Expected failure.\n");
4121 exchange_key, 0, &
key);
4143 ok(!
ret,
"Expected failure.\n");
4147 ok(!
ret,
"Expected failure.\n");
4153 ok(
len == 8,
"Unexpected len %lu.\n",
len);
4173 ok(
len == 8,
"Unexpected len %lu.\n",
len);
4176 broken_results =
BASE_PROV ? mac_baseprov_results_old[
i] : mac_results_old[
i];
4184 memset(&hmac, 0,
sizeof(hmac));
4207 ok(
len == 16,
"Unexpected len %lu.\n",
len);
42190x07,0x02,0x00,0x00,0x00,0xa4,0x00,0x00,0x52,0x53,0x41,0x32,0x00,0x02,0x00,0x00,
42200x01,0x00,0x01,0x00,0x55,0x7b,0x36,0x13,0xae,0x4b,0xc9,0x6f,0x78,0x1e,0xff,0x38,
42210xd4,0x26,0x38,0x77,0x89,0x9b,0xf6,0x6b,0xf7,0xaa,0xea,0xad,0x27,0x11,0x1e,0xa5,
42220x98,0x23,0xcb,0xaa,0x32,0x34,0xaf,0x19,0xd8,0x24,0x95,0xe4,0xae,0x4e,0x03,0x1d,
42230x75,0xeb,0xec,0xc1,0x09,0xd0,0x02,0xed,0x1f,0x0e,0xcf,0x23,0xce,0xe9,0x09,0x34,
42240xe3,0xc9,0xb9,0xbb,0xef,0x59,0x26,0xab,0xf5,0x11,0xdb,0x8d,0x0f,0x07,0xaf,0x53,
42250x5c,0xaf,0xcd,0x8c,0xa2,0xaf,0x4e,0x3e,0xc9,0xe8,0x02,0x69,0x4b,0x87,0x1f,0xe1,
42260x62,0x65,0x0a,0xf8,0xfb,0x92,0xce,0x69,0xcc,0xea,0x86,0x41,0x43,0xe8,0x4a,0x41,
42270x75,0xf0,0xb6,0x17,0x64,0xa1,0x0e,0x52,0xd3,0x4c,0xdf,0x6f,0xa8,0x15,0x57,0x7c,
42280x00,0xeb,0xbf,0xc1,0x69,0xfe,0x6d,0x50,0x55,0x89,0xfe,0x8a,0x1c,0x14,0x60,0xff,
42290x5a,0xe6,0x80,0x22,0xa0,0xfc,0xe9,0x5f,0xa4,0x48,0xbb,0xc1,0xf0,0x4f,0xba,0x57,
42300xeb,0x83,0xe9,0xe9,0x21,0x23,0x9a,0x83,0x71,0xd7,0x2e,0xb9,0x88,0x24,0x37,0x6b,
42310x1d,0x73,0xcb,0x64,0xa4,0x6d,0xcf,0xed,0xbb,0x65,0x4c,0xf7,0xcc,0x86,0xf8,0x94,
42320x40,0x61,0xb2,0x09,0x2e,0xea,0xb7,0xa2,0x1d,0xc2,0x4b,0x37,0x5d,0xc1,0x54,0xdf,
42330x45,0x16,0x16,0xe1,0x08,0x6b,0xad,0x51,0xbf,0x62,0x0c,0xe0,0xe5,0x22,0x65,0xc5,
42340x6a,0xca,0xc7,0xb0,0x49,0x48,0xae,0x6b,0x27,0x86,0xe8,0xe9,0x90,0x15,0x38,0x4f,
42350x7f,0x3b,0x9e,0x38,0xd1,0x25,0x62,0x91,0xfe,0x18,0x08,0x79,0xcc,0x7c,0xaf,0x41,
42360x8d,0xd1,0xa1,0xd3,0x63,0x3c,0xb0,0x7b,0x2d,0xda,0x6f,0x72,0x9c,0xd1,0xa8,0xaa,
42370xb5,0x6a,0xde,0xed,0x00,0x0a,0x39,0xe9,0xc6,0x45,0x7a,0x39,0x6d,0x07,0x86,0xa9,
42380xe5,0x4f,0xb4,0x9b };
42400x06,0x02,0x00,0x00,0x00,0xa4,0x00,0x00,0x52,0x53,0x41,0x31,0x00,0x02,0x00,0x00,
42410x01,0x00,0x01,0x00,0x55,0x7b,0x36,0x13,0xae,0x4b,0xc9,0x6f,0x78,0x1e,0xff,0x38,
42420xd4,0x26,0x38,0x77,0x89,0x9b,0xf6,0x6b,0xf7,0xaa,0xea,0xad,0x27,0x11,0x1e,0xa5,
42430x98,0x23,0xcb,0xaa,0x32,0x34,0xaf,0x19,0xd8,0x24,0x95,0xe4,0xae,0x4e,0x03,0x1d,
42440x75,0xeb,0xec,0xc1,0x09,0xd0,0x02,0xed,0x1f,0x0e,0xcf,0x23,0xce,0xe9,0x09,0x34,
42450xe3,0xc9,0xb9,0xbb };
4298 ok(
size ==
td[
i].salt_length,
"got %lu, expected %lu\n",
size,
td[
i].salt_length);
4340 ok(
size == 11,
"got %lu, expected 11\n",
size);
4342 ok(
size == 0,
"got %lu, expected 0\n",
size);
4359 static const char hello_world[12] =
"Hello World!";
4436 0x07, 0x02, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32, 0x00, 0x02, 0x00, 0x00,
4437 0x01, 0x00, 0x00, 0x00, 0xab, 0xef, 0xfa, 0xc6, 0x7d, 0xe8, 0xde, 0xfb, 0x68, 0x38, 0x09, 0x92,
4438 0xd9, 0x42, 0x7e, 0x6b, 0x89, 0x9e, 0x21, 0xd7, 0x52, 0x1c, 0x99, 0x3c, 0x17, 0x48, 0x4e, 0x3a,
4439 0x44, 0x02, 0xf2, 0xfa, 0x74, 0x57, 0xda, 0xe4, 0xd3, 0xc0, 0x35, 0x67, 0xfa, 0x6e, 0xdf, 0x78,
4440 0x4c, 0x75, 0x35, 0x1c, 0xa0, 0x74, 0x49, 0xe3, 0x20, 0x13, 0x71, 0x35, 0x65, 0xdf, 0x12, 0x20,
4441 0xf5, 0xf5, 0xf5, 0xc1, 0xed, 0x5c, 0x91, 0x36, 0x75, 0xb0, 0xa9, 0x9c, 0x04, 0xdb, 0x0c, 0x8c,
4442 0xbf, 0x99, 0x75, 0x13, 0x7e, 0x87, 0x80, 0x4b, 0x71, 0x94, 0xb8, 0x00, 0xa0, 0x7d, 0xb7, 0x53,
4443 0xdd, 0x20, 0x63, 0xee, 0xf7, 0x83, 0x41, 0xfe, 0x16, 0xa7, 0x6e, 0xdf, 0x21, 0x7d, 0x76, 0xc0,
4444 0x85, 0xd5, 0x65, 0x7f, 0x00, 0x23, 0x57, 0x45, 0x52, 0x02, 0x9d, 0xea, 0x69, 0xac, 0x1f, 0xfd,
4445 0x3f, 0x8c, 0x4a, 0xd0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4446 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4447 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4448 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4449 0x00, 0x00, 0x00, 0x00, 0x64, 0xd5, 0xaa, 0xb1, 0xa6, 0x03, 0x18, 0x92, 0x03, 0xaa, 0x31, 0x2e,
4450 0x48, 0x4b, 0x65, 0x20, 0x99, 0xcd, 0xc6, 0x0c, 0x15, 0x0c, 0xbf, 0x3e, 0xff, 0x78, 0x95, 0x67,
4451 0xb1, 0x74, 0x5b, 0x60, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4452 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4453 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4455 0x00, 0x00, 0x00, 0x00,
4462 0xab, 0xef, 0xfa, 0xc6, 0x7d, 0xe8, 0xde, 0xfb, 0x68, 0x38, 0x09, 0x92, 0xd9, 0x42, 0x7e, 0x6b,
4463 0x89, 0x9e, 0x21, 0xd7, 0x52, 0x1c, 0x99, 0x3c, 0x17, 0x48, 0x4e, 0x3a, 0x44, 0x02, 0xf2, 0xfa,
4464 0x74, 0x57, 0xda, 0xe4, 0xd3, 0xc0, 0x35, 0x67, 0xfa, 0x6e, 0xdf, 0x78, 0x4c, 0x75, 0x35, 0x1c,
4465 0xa0, 0x74, 0x49, 0xe3, 0x20, 0x13, 0x71, 0x35, 0x65, 0xdf, 0x12, 0x20, 0xf5, 0xf5, 0xf5, 0xc1,
4469 0xed, 0x5c, 0x91, 0x36, 0x75, 0xb0, 0xa9, 0x9c, 0x04, 0xdb, 0x0c, 0x8c, 0xbf, 0x99, 0x75, 0x13,
4470 0x7e, 0x87, 0x80, 0x4b, 0x71, 0x94, 0xb8, 0x00, 0xa0, 0x7d, 0xb7, 0x53, 0xdd, 0x20, 0x63, 0xee,
4474 0xf7, 0x83, 0x41, 0xfe, 0x16, 0xa7, 0x6e, 0xdf, 0x21, 0x7d, 0x76, 0xc0, 0x85, 0xd5, 0x65, 0x7f,
4475 0x00, 0x23, 0x57, 0x45, 0x52, 0x02, 0x9d, 0xea, 0x69, 0xac, 0x1f, 0xfd, 0x3f, 0x8c, 0x4a, 0xd0,
4479 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4484 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4485 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4487 static const BYTE coeff[] =
4489 0x64, 0xd5, 0xaa, 0xb1, 0xa6, 0x03, 0x18, 0x92, 0x03, 0xaa, 0x31, 0x2e, 0x48, 0x4b, 0x65, 0x20,
4490 0x99, 0xcd, 0xc6, 0x0c, 0x15, 0x0c, 0xbf, 0x3e, 0xff, 0x78, 0x95, 0x67, 0xb1, 0x74, 0x5b, 0x60,
4492 static const BYTE priv_exp[] =
4494 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4495 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4496 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4497 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4518 ok(
size == 308,
"unexpected size: %ld\n",
size);
4535 p +=
sizeof(priv_exp);
4550 const char *prov_name;
4570 ok(
ret,
"%s: CryptAcquireContextA failed: %#lx\n",
4576 ok(
ret,
"%s: CryptGetProvParam(PP_PROVTYPE) failed: %#lx\n",
4578 ok(
len ==
sizeof(got),
"%s: wrong PP_PROVTYPE size %lu\n",
4581 "%s: PP_PROVTYPE = %lu, expected %lu\n",
4634 trace(
"Testing AES provider.\n");
static struct _test_info results[8]
static void test_aes(void)
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
BOOL WINAPI CryptExportKey(HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen)
BOOL WINAPI CryptCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, HCRYPTHASH *phHash)
BOOL WINAPI CryptGenRandom(HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer)
BOOL WINAPI CryptGetHashParam(HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags)
BOOL WINAPI CryptDestroyKey(HCRYPTKEY hKey)
BOOL WINAPI CryptDestroyHash(HCRYPTHASH hHash)
BOOL WINAPI CryptSignHashA(HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescription, DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen)
BOOL WINAPI CryptDuplicateKey(HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey)
BOOL WINAPI CryptVerifySignatureA(HCRYPTHASH hHash, const BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCSTR sDescription, DWORD dwFlags)
BOOL WINAPI CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags)
BOOL WINAPI CryptDuplicateHash(HCRYPTHASH hHash, DWORD *pdwReserved, DWORD dwFlags, HCRYPTHASH *phHash)
BOOL WINAPI CryptHashData(HCRYPTHASH hHash, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags)
BOOL WINAPI CryptAcquireContextA(HCRYPTPROV *phProv, LPCSTR pszContainer, LPCSTR pszProvider, DWORD dwProvType, DWORD dwFlags)
BOOL WINAPI CryptDeriveKey(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData, DWORD dwFlags, HCRYPTKEY *phKey)
BOOL WINAPI CryptGenKey(HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey)
BOOL WINAPI CryptDecrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen)
BOOL WINAPI CryptGetUserKey(HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey)
BOOL WINAPI CryptGetKeyParam(HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags)
BOOL WINAPI CryptSetKeyParam(HCRYPTKEY hKey, DWORD dwParam, const BYTE *pbData, DWORD dwFlags)
BOOL WINAPI CryptSetHashParam(HCRYPTHASH hHash, DWORD dwParam, const BYTE *pbData, DWORD dwFlags)
BOOL WINAPI CryptGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags)
BOOL WINAPI CryptEncrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen)
BOOL WINAPI CryptImportKey(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey)
static struct list providers
#define ERROR_INVALID_PARAMETER
#define INVALID_HANDLE_VALUE
static __inline const char * debugstr_an(const char *s, int n)
#define ERROR_NO_MORE_ITEMS
#define HeapFree(x, y, z)
#define ERROR_INVALID_HANDLE
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
#define todo_wine_if(is_todo)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
#define memcpy(s1, s2, n)
static struct test_info tests[]
static const char pub_key[]
static void test_length(void)
static const BYTE rsa_blob[]
static const char szContainer[]
static void test_key_permissions(void)
static void test_mac(void)
static void trace_hex(BYTE *pbData, DWORD dwLen)
static BYTE abPlainPrivateKey[596]
static void test_import_private(void)
static void test_null_provider(void)
static void test_gen_random(void)
static void test_rc4(void)
struct _ctdatatype cryptdata
static void test_pubexp(void)
static void test_rc2(void)
static void test_hmac(void)
static void test_enum_container(void)
static void test_verify_signature(void)
static void test_prov(void)
static const cryptdata cTestData[4]
static void test_des(void)
static void test_rsa_round_trip(void)
static void test_RC4_salt(void)
static const char * szProvider
static void uniquecontainer(char *unique)
static void test_block_cipher_modes(void)
static void test_aes_duplicate_key(int keylen)
static void clean_up_base_environment(void)
static void test_import_export(void)
static void printBytes(const char *heading, const BYTE *pb, size_t cb)
static const BYTE PRIVATE_EXCH_blob[308]
static void test_rsa_encrypt(void)
static void clean_up_aes_environment(void)
static const BYTE PUBLIC_EXCH_blob[84]
static void test_pp_provtype(void)
static void test_3des112(void)
static void test_key_derivation(const char *prov)
static void test_import_hmac(void)
static void test_RC4_session_key(void)
static void test_3des(void)
static BOOL init_base_environment(const char *provider, DWORD dwKeyFlags)
static BOOL derive_key(ALG_ID aiAlgid, HCRYPTKEY *phKey, DWORD len)
static void test_sha2(void)
static void test_rc2_import(void)
static const char * szProviders[]
static BOOL init_aes_environment(void)
static void test_schannel_provider(void)
static void test_key_initialization(void)
static void test_hmac_info(void)
static void test_hashes(void)
static const WCHAR szName[]
#define offsetof(TYPE, MEMBER)
unsigned char origstr[32]
SYMCRYPT_MAGIC_FIELD union @5329 td
DWORD WINAPI GetLastError(void)
#define CRYPT_VERIFYCONTEXT
#define PROV_RSA_SCHANNEL
#define CALG_SCHANNEL_MASTER_HASH
#define CRYPT_DELETEKEYSET
#define PP_ENUMCONTAINERS
#define CRYPT_CREATE_SALT
#define CALG_SCHANNEL_MAC_KEY
#define KP_EFFECTIVE_KEYLEN
#define PP_UNIQUE_CONTAINER
#define PP_SIG_KEYSIZE_INC
#define PP_KEYX_KEYSIZE_INC
struct _PUBLICKEYSTRUC BLOBHEADER
#define MS_DEF_RSA_SCHANNEL_PROV_A
#define MS_ENHANCED_PROV_A
#define CRYPT_IPSEC_HMAC_KEY
#define CALG_SCHANNEL_ENC_KEY
#define CRYPT_MACHINE_KEYSET
#define MS_ENH_RSA_AES_PROV_A
#define NTE_BAD_PROV_TYPE
#define NTE_BAD_HASH_STATE
#define NTE_BAD_SIGNATURE
#define NTE_TEMPORARY_PROFILE
#define NTE_PROV_TYPE_NOT_DEF
#define ERROR_INTERNAL_ERROR
#define NTE_BAD_KEY_STATE
static const char hello_world[]
#define HKEY_LOCAL_MACHINE