From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/advapi32/advapi32.spec | 12 ++-- dlls/advapi32/crypt.c | 97 ---------------------------- dlls/cryptsp/Makefile.in | 1 + dlls/cryptsp/crypt.c | 122 ++++++++++++++++++++++++++++++++++++ dlls/cryptsp/cryptsp.spec | 14 ++--- 5 files changed, 136 insertions(+), 110 deletions(-) create mode 100644 dlls/cryptsp/crypt.c
diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec index 60855c8b526..7f5fbb07138 100644 --- a/dlls/advapi32/advapi32.spec +++ b/dlls/advapi32/advapi32.spec @@ -783,11 +783,11 @@ @ stdcall SystemFunction004(ptr ptr ptr) @ stdcall SystemFunction005(ptr ptr ptr) @ stdcall SystemFunction006(ptr ptr) cryptsp.SystemFunction006 -@ stdcall SystemFunction007(ptr ptr) +@ stdcall SystemFunction007(ptr ptr) cryptsp.SystemFunction007 @ stdcall SystemFunction008(ptr ptr ptr) cryptsp.SystemFunction008 @ stdcall SystemFunction009(ptr ptr ptr) cryptsp.SystemFunction009 -@ stdcall SystemFunction010(ptr ptr ptr) -@ stdcall SystemFunction011(ptr ptr ptr) SystemFunction010 +@ stdcall SystemFunction010(ptr ptr ptr) cryptsp.SystemFunction010 +@ stdcall SystemFunction011(ptr ptr ptr) cryptsp.SystemFunction011 @ stdcall SystemFunction012(ptr ptr ptr) cryptsp.SystemFunction012 @ stdcall SystemFunction013(ptr ptr ptr) cryptsp.SystemFunction013 @ stdcall SystemFunction014(ptr ptr ptr) cryptsp.SystemFunction014 @@ -806,12 +806,12 @@ @ stdcall SystemFunction027(ptr ptr ptr) cryptsp.SystemFunction027 @ stub SystemFunction028 @ stub SystemFunction029 -@ stdcall SystemFunction030(ptr ptr) -@ stdcall SystemFunction031(ptr ptr) SystemFunction030 +@ stdcall SystemFunction030(ptr ptr) cryptsp.SystemFunction030 +@ stdcall SystemFunction031(ptr ptr) cryptsp.SystemFunction031 @ stdcall SystemFunction032(ptr ptr) cryptsp.SystemFunction032 @ stub SystemFunction033 @ stub SystemFunction034 -@ stdcall SystemFunction035(str) +@ stdcall SystemFunction035(str) cryptsp.SystemFunction035 @ stdcall SystemFunction036(ptr long) # RtlGenRandom @ stdcall SystemFunction040(ptr long long) # RtlEncryptMemory @ stdcall SystemFunction041(ptr long long) # RtlDecryptMemory diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c index 0c94999660a..03591e041e1 100644 --- a/dlls/advapi32/crypt.c +++ b/dlls/advapi32/crypt.c @@ -42,17 +42,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(crypt);
-typedef struct tagMD4_CTX { - unsigned int buf[4]; - unsigned int i[2]; - unsigned char in[64]; - unsigned char digest[16]; -} MD4_CTX; - -void WINAPI MD4Init(MD4_CTX *ctx); -void WINAPI MD4Update(MD4_CTX *ctx, const unsigned char *buf, unsigned int len); -void WINAPI MD4Final(MD4_CTX *ctx); - static HWND crypt_hWindow;
#define CRYPT_Alloc(size) (LocalAlloc(LMEM_ZEROINIT, size)) @@ -2295,92 +2284,6 @@ DWORD WINAPI ReadEncryptedFileRaw(PFE_EXPORT_FUNC export, PVOID callback, PVOID return ERROR_CALL_NOT_IMPLEMENTED; }
-/****************************************************************************** - * SystemFunction007 [ADVAPI32.@] - * - * MD4 hash a unicode string - * - * PARAMS - * string [I] the string to hash - * output [O] the md4 hash of the string (16 bytes) - * - * RETURNS - * Success: STATUS_SUCCESS - * Failure: STATUS_UNSUCCESSFUL - * - */ -NTSTATUS WINAPI SystemFunction007(const UNICODE_STRING *string, LPBYTE hash) -{ - MD4_CTX ctx; - - MD4Init( &ctx ); - MD4Update( &ctx, (const BYTE *)string->Buffer, string->Length ); - MD4Final( &ctx ); - memcpy( hash, ctx.digest, 0x10 ); - - return STATUS_SUCCESS; -} - -/****************************************************************************** - * SystemFunction010 [ADVAPI32.@] - * SystemFunction011 [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, const BYTE *data, LPBYTE hash) -{ - MD4_CTX ctx; - - MD4Init( &ctx ); - MD4Update( &ctx, data, 0x10 ); - MD4Final( &ctx ); - memcpy( hash, ctx.digest, 0x10 ); - - return STATUS_SUCCESS; -} - -/****************************************************************************** - * SystemFunction030 (ADVAPI32.@) - * - * Tests if two blocks of 16 bytes are equal - * - * PARAMS - * b1,b2 [I] block of 16 bytes - * - * RETURNS - * TRUE if blocks are the same - * FALSE if blocks are different - */ -BOOL WINAPI SystemFunction030(LPCVOID b1, LPCVOID b2) -{ - return !memcmp(b1, b2, 0x10); -} - -/****************************************************************************** - * SystemFunction035 (ADVAPI32.@) - * - * Described here: -http://disc.server.com/discussion.cgi?disc=148775;article=942;title=Coding%2... - * - * NOTES - * Stub, always return TRUE. - */ -BOOL WINAPI SystemFunction035(LPCSTR lpszDllFilePath) -{ - FIXME("%s: stub\n", debugstr_a(lpszDllFilePath)); - return TRUE; -} - static CRITICAL_SECTION random_cs; static CRITICAL_SECTION_DEBUG random_debug = { diff --git a/dlls/cryptsp/Makefile.in b/dlls/cryptsp/Makefile.in index 8d466541625..568acdded1f 100644 --- a/dlls/cryptsp/Makefile.in +++ b/dlls/cryptsp/Makefile.in @@ -4,4 +4,5 @@ IMPORTS = advapi32
SOURCES = \ arc4.c \ + crypt.c \ lmhash.c diff --git a/dlls/cryptsp/crypt.c b/dlls/cryptsp/crypt.c new file mode 100644 index 00000000000..03a9a89cbea --- /dev/null +++ b/dlls/cryptsp/crypt.c @@ -0,0 +1,122 @@ +/* + * Copyright 1999 Ian Schmidt + * Copyright 2001 Travis Michielsen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winternl.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(crypt); + +typedef struct tagMD4_CTX +{ + unsigned int buf[4]; + unsigned int i[2]; + unsigned char in[64]; + unsigned char digest[16]; +} MD4_CTX; + +void WINAPI MD4Init(MD4_CTX *ctx); +void WINAPI MD4Update(MD4_CTX *ctx, const unsigned char *buf, unsigned int len); +void WINAPI MD4Final(MD4_CTX *ctx); + +/****************************************************************************** + * SystemFunction007 (cryptsp.@) + * + * MD4 hash a unicode string + * + * PARAMS + * string [I] the string to hash + * output [O] the md4 hash of the string (16 bytes) + * + * RETURNS + * Success: STATUS_SUCCESS + * Failure: STATUS_UNSUCCESSFUL + * + */ +NTSTATUS WINAPI SystemFunction007( const UNICODE_STRING *string, BYTE *hash ) +{ + MD4_CTX ctx; + + MD4Init( &ctx ); + MD4Update( &ctx, (const BYTE *)string->Buffer, string->Length ); + MD4Final( &ctx ); + memcpy( hash, ctx.digest, 0x10 ); + + return STATUS_SUCCESS; +} + +/****************************************************************************** + * SystemFunction010 (cryptsp.@) + * SystemFunction011 (cryptsp.@) + * + * 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( void *unknown, const BYTE *data, BYTE *hash ) +{ + MD4_CTX ctx; + + MD4Init( &ctx ); + MD4Update( &ctx, data, 0x10 ); + MD4Final( &ctx ); + memcpy( hash, ctx.digest, 0x10 ); + + return STATUS_SUCCESS; +} + +/****************************************************************************** + * SystemFunction030 (cryptsp.@) + * SystemFunction031 (cryptsp.@) + * + * Tests if two blocks of 16 bytes are equal + * + * PARAMS + * b1,b2 [I] block of 16 bytes + * + * RETURNS + * TRUE if blocks are the same + * FALSE if blocks are different + */ +BOOL WINAPI SystemFunction030( const void *b1, const void *b2 ) +{ + return !memcmp( b1, b2, 0x10 ); +} + +/****************************************************************************** + * CheckSignatureInFile (cryptsp.@) + * SystemFunction035 (cryptsp.@) + */ +BOOL WINAPI CheckSignatureInFile( const char *file ) +{ + FIXME( "%s: stub\n", debugstr_a(file) ); + return TRUE; +} diff --git a/dlls/cryptsp/cryptsp.spec b/dlls/cryptsp/cryptsp.spec index 6e541c9ec82..a76fe1756c8 100644 --- a/dlls/cryptsp/cryptsp.spec +++ b/dlls/cryptsp/cryptsp.spec @@ -1,4 +1,4 @@ -@ stub CheckSignatureInFile +@ stdcall CheckSignatureInFile(str) @ stdcall -import CryptAcquireContextA(ptr str str long long) @ stdcall -import CryptAcquireContextW(ptr wstr wstr long long) @ stdcall -import CryptContextAddRef(long ptr long) @@ -39,11 +39,11 @@ @ stdcall -import CryptVerifySignatureA(long ptr long long str long) @ stdcall -import CryptVerifySignatureW(long ptr long long wstr long) @ stdcall SystemFunction006(ptr ptr) -@ stdcall -import SystemFunction007(ptr ptr) +@ stdcall SystemFunction007(ptr ptr) @ stdcall SystemFunction008(ptr ptr ptr) @ stdcall SystemFunction009(ptr ptr ptr) SystemFunction008 -@ stdcall -import SystemFunction010(ptr ptr ptr) -@ stdcall -import SystemFunction011(ptr ptr ptr) +@ stdcall SystemFunction010(ptr ptr ptr) +@ stdcall SystemFunction011(ptr ptr ptr) SystemFunction010 @ stdcall SystemFunction012(ptr ptr ptr) @ stdcall SystemFunction013(ptr ptr ptr) @ stdcall SystemFunction014(ptr ptr ptr) SystemFunction012 @@ -58,8 +58,8 @@ @ stdcall SystemFunction025(ptr ptr ptr) @ stdcall SystemFunction026(ptr ptr ptr) SystemFunction024 @ stdcall SystemFunction027(ptr ptr ptr) SystemFunction025 -@ stdcall -import SystemFunction030(ptr ptr) -@ stdcall -import SystemFunction031(ptr ptr) +@ stdcall SystemFunction030(ptr ptr) +@ stdcall SystemFunction031(ptr ptr) SystemFunction030 @ stdcall SystemFunction032(ptr ptr) @ stub SystemFunction033 -@ stdcall -import SystemFunction035(str) +@ stdcall SystemFunction035(str) CheckSignatureInFile