Commit b4899f07 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

advapi32: Implement and test SystemFunction010.

parent 64ae8285
......@@ -604,7 +604,7 @@
@ stdcall SystemFunction007(ptr ptr)
@ stdcall SystemFunction008(ptr ptr ptr)
@ stdcall SystemFunction009(ptr ptr ptr)
@ stub SystemFunction010
@ stdcall SystemFunction010(ptr ptr ptr)
@ stub SystemFunction011
@ stub SystemFunction012
@ stub SystemFunction013
......
......@@ -296,3 +296,30 @@ NTSTATUS WINAPI SystemFunction007(PUNICODE_STRING string, LPBYTE hash)
return STATUS_SUCCESS;
}
/******************************************************************************
* SystemFunction010 [ADVAPI32.@]
*
* MD4 hashes 16 bytes of data
*
* PARAMS
* unknown [] seems to have no effect on the output
* data [I] pointer to data to hash (16 bytes)
* output [O] the md4 hash of the data (16 bytes)
*
* RETURNS
* Success: STATUS_SUCCESS
* Failure: STATUS_UNSUCCESSFUL
*
*/
NTSTATUS WINAPI SystemFunction010(LPVOID unknown, LPBYTE data, LPBYTE hash)
{
MD4_CTX ctx;
MD4Init( &ctx );
MD4Update( &ctx, data, 0x10 );
MD4Final( &ctx );
memcpy( hash, ctx.digest, 0x10 );
return STATUS_SUCCESS;
}
......@@ -40,11 +40,13 @@ typedef VOID (WINAPI *fnMD4Init)( MD4_CTX *ctx );
typedef VOID (WINAPI *fnMD4Update)( MD4_CTX *ctx, const unsigned char *src, const int len );
typedef VOID (WINAPI *fnMD4Final)( MD4_CTX *ctx );
typedef int (WINAPI *fnSystemFunction007)(PUNICODE_STRING,LPBYTE);
typedef int (WINAPI *fnSystemFunction010)(LPVOID, const LPBYTE, LPBYTE);
fnMD4Init pMD4Init;
fnMD4Update pMD4Update;
fnMD4Final pMD4Final;
fnSystemFunction007 pSystemFunction007;
fnSystemFunction010 pSystemFunction010;
#define ctxcmp( a, b ) memcmp( (char*)a, (char*)b, FIELD_OFFSET( MD4_CTX, in ) )
......@@ -124,6 +126,21 @@ static void test_SystemFunction007(void)
ok(!memcmp(output, expected, sizeof expected), "response wrong\n");
}
static void test_SystemFunction010(void)
{
unsigned char expected[0x10] = {
0x48, 0x7c, 0x3f, 0x5e, 0x2b, 0x0d, 0x6a, 0x79,
0x32, 0x4e, 0xcd, 0xbe, 0x9c, 0x15, 0x16, 0x6f };
unsigned char in[0x10], output[0x10];
int r;
memset(in, 0, sizeof in);
memset(output, 0, sizeof output);
r = pSystemFunction010(0, in, output);
ok( r == STATUS_SUCCESS, "wrong error code\n");
ok( !memcmp(expected, output, sizeof output), "output wrong\n");
}
START_TEST(crypt_md4)
{
HMODULE module;
......@@ -141,5 +158,9 @@ START_TEST(crypt_md4)
if (pSystemFunction007)
test_SystemFunction007();
pSystemFunction010 = (fnSystemFunction010)GetProcAddress( module, "SystemFunction010" );
if (pSystemFunction010)
test_SystemFunction010();
FreeLibrary( module );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment