33static char secret[] =
"I am a super secret string that no one can see!";
34static char secret2[] =
"I am a super secret string indescribable string";
35static char key[] =
"Wibble wibble wibble";
36static const WCHAR desc[] = {
'U',
'l',
't',
'r',
'a',
' ',
's',
'e',
'c',
'r',
'e',
't',
' ',
't',
'e',
's',
't',
' ',
'm',
'e',
's',
's',
'a',
'g',
'e',0};
56 ok(!
protected,
"Encrypting without plain data source.\n");
62 ok(!
protected,
"Encrypting without cipher destination.\n");
74 "Encrypting without entropy.\n");
80 "Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %d\n",
r);
91 "Encrypting with entropy.\n");
105 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
123 skip(
"CryptProtectData failed to run\n");
132 ok(!okay,
"Decrypting without destination\n");
138 ok(!okay,
"Decrypting without source\n");
147 ok(!okay,
"Decrypting without needed entropy\n");
158 ok(okay,
"Decrypting without entropy\n");
160 ok(plain.
pbData!=
NULL,
"Plain DATA_BLOB missing data\n");
163 ok(data_desc!=
NULL,
"Description not allocated\n");
176 ok(!okay,
"Decrypting with wrong entropy\n");
183 ok(okay,
"Decrypting with entropy\n");
185 ok(plain.
pbData!=
NULL,
"Plain DATA_BLOB missing data\n");
188 ok(data_desc!=
NULL,
"Description not allocated\n");
201 ok(okay,
"Decrypting with entropy and no description\n");
203 ok(plain.
pbData!=
NULL,
"Plain DATA_BLOB missing data\n");
206 ok(data_desc!=
NULL,
"Description not allocated\n");
207 ok(data_desc[0]==
'\0',
"Description not empty\n");
225 input.pbData = (
unsigned char *)plaintext;
232 win_skip(
"CryptProtectData failed\n");
238 ok(output.
cbData ==
strlen(plaintext),
"output wrong length %d for input '%s', wanted %d\n", output.
cbData, plaintext,
lstrlenA(plaintext));
239 ok(!
memcmp(plaintext, (
char *)output.
pbData, output.
cbData),
"output wrong contents for input '%s'\n", plaintext);
247 pCryptProtectData = (
void*)
GetProcAddress(hCrypt32,
"CryptProtectData");
248 pCryptUnprotectData = (
void*)
GetProcAddress(hCrypt32,
"CryptUnprotectData");
249 if (!pCryptProtectData || !pCryptUnprotectData)
251 win_skip(
"Crypt(Un)ProtectData() is not available\n");
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
#define ERROR_INVALID_PARAMETER
#define GetProcAddress(x, y)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
GLdouble GLdouble GLdouble r
GLenum GLenum GLenum input
HLOCAL NTAPI LocalFree(HLOCAL hMem)
static const WCHAR emptyW[]
int WINAPI lstrlenA(LPCSTR lpString)
static DATA_BLOB cipher_no_desc
static const WCHAR desc[]
static void test_simpleroundtrip(const char *plaintext)
static void test_cryptprotectdata(void)
static DATA_BLOB CRYPTPROTECT_PROMPTSTRUCT DATA_BLOB *static LPWSTR DATA_BLOB CRYPTPROTECT_PROMPTSTRUCT DATA_BLOB *static char secret[]
static void test_cryptunprotectdata(void)
static DATA_BLOB cipher_entropy
DWORD WINAPI GetLastError(void)
#define ERROR_INVALID_DATA