Alexandre Julliard : advapi32: Move SHA1 implementation to ntdll.

Alexandre Julliard julliard at winehq.org
Mon Jun 24 16:06:24 CDT 2019


Module: wine
Branch: master
Commit: 45e0f91de1c2521f0f1b3669bce95f6de2df8b69
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=45e0f91de1c2521f0f1b3669bce95f6de2df8b69

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jun 24 14:40:45 2019 +0200

advapi32: Move SHA1 implementation to ntdll.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/advapi32/Makefile.in                    |  1 -
 dlls/advapi32/advapi32.spec                  |  6 +++---
 dlls/ntdll/Makefile.in                       |  1 +
 dlls/{advapi32/crypt_sha.c => ntdll/crypt.c} | 23 ++++++++++-------------
 dlls/ntdll/ntdll.spec                        |  3 +++
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/dlls/advapi32/Makefile.in b/dlls/advapi32/Makefile.in
index 224286f..a55a317 100644
--- a/dlls/advapi32/Makefile.in
+++ b/dlls/advapi32/Makefile.in
@@ -13,7 +13,6 @@ C_SRCS = \
 	crypt_lmhash.c \
 	crypt_md4.c \
 	crypt_md5.c \
-	crypt_sha.c \
 	eventlog.c \
 	lsa.c \
 	perf.c \
diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
index 1c92f62..c8d8d85 100644
--- a/dlls/advapi32/advapi32.spec
+++ b/dlls/advapi32/advapi32.spec
@@ -1,7 +1,7 @@
 # 1000 stub ADVAPI32_1000
-@ stdcall A_SHAFinal(ptr ptr)
-@ stdcall A_SHAInit(ptr)
-@ stdcall A_SHAUpdate(ptr ptr long)
+@ stdcall A_SHAFinal(ptr ptr) ntdll.A_SHAFinal
+@ stdcall A_SHAInit(ptr) ntdll.A_SHAInit
+@ stdcall A_SHAUpdate(ptr ptr long) ntdll.A_SHAUpdate
 @ stdcall AbortSystemShutdownA(ptr)
 @ stdcall AbortSystemShutdownW(ptr)
 @ stdcall AccessCheck(ptr long long ptr ptr ptr ptr ptr)
diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in
index ed4bb94..1ad674e 100644
--- a/dlls/ntdll/Makefile.in
+++ b/dlls/ntdll/Makefile.in
@@ -10,6 +10,7 @@ C_SRCS = \
 	atom.c \
 	cdrom.c \
 	critsection.c \
+	crypt.c \
 	debugbuffer.c \
 	debugtools.c \
 	directory.c \
diff --git a/dlls/advapi32/crypt_sha.c b/dlls/ntdll/crypt.c
similarity index 95%
rename from dlls/advapi32/crypt_sha.c
rename to dlls/ntdll/crypt.c
index ffd59a7..2a1db55 100644
--- a/dlls/advapi32/crypt_sha.c
+++ b/dlls/ntdll/crypt.c
@@ -1,6 +1,5 @@
 /*
  * Copyright 2004 Filip Navara
- * Based on public domain SHA code by Steve Reid <steve at edmweb.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -20,7 +19,10 @@
 #include <stdarg.h>
 #include "windef.h"
 
-/* SHA Context Structure Declaration */
+/* SHA1 algorithm
+ *
+ * Based on public domain SHA code by Steve Reid <steve at edmweb.com>
+ */
 
 typedef struct {
    ULONG Unknown[6];
@@ -29,8 +31,6 @@ typedef struct {
    UCHAR Buffer[64];
 } SHA_CTX, *PSHA_CTX;
 
-/* SHA1 Helper Macros */
-
 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
 /* FIXME: This definition of DWORD2BE is little endian specific! */
 #define DWORD2BE(x) (((x) >> 24) & 0xff) | (((x) >> 8) & 0xff00) | (((x) << 8) & 0xff0000) | (((x) << 24) & 0xff000000);
@@ -98,7 +98,7 @@ static void SHA1Transform(ULONG State[5], UCHAR Buffer[64])
 
 
 /******************************************************************************
- * A_SHAInit [ADVAPI32.@]
+ * A_SHAInit (ntdll.@)
  *
  * Initialize a SHA context structure.
  *
@@ -108,8 +108,7 @@ static void SHA1Transform(ULONG State[5], UCHAR Buffer[64])
  * RETURNS
  *  Nothing
  */
-VOID WINAPI
-A_SHAInit(PSHA_CTX Context)
+void WINAPI A_SHAInit(PSHA_CTX Context)
 {
    /* SHA1 initialization constants */
    Context->State[0] = 0x67452301;
@@ -122,7 +121,7 @@ A_SHAInit(PSHA_CTX Context)
 }
 
 /******************************************************************************
- * A_SHAUpdate [ADVAPI32.@]
+ * A_SHAUpdate (ntdll.@)
  *
  * Update a SHA context with a hashed data from supplied buffer.
  *
@@ -134,8 +133,7 @@ A_SHAInit(PSHA_CTX Context)
  * RETURNS
  *  Nothing
  */
-VOID WINAPI
-A_SHAUpdate(PSHA_CTX Context, const unsigned char *Buffer, UINT BufferSize)
+void WINAPI A_SHAUpdate(PSHA_CTX Context, const unsigned char *Buffer, UINT BufferSize)
 {
    ULONG BufferContentSize;
 
@@ -166,7 +164,7 @@ A_SHAUpdate(PSHA_CTX Context, const unsigned char *Buffer, UINT BufferSize)
 }
 
 /******************************************************************************
- * A_SHAFinal [ADVAPI32.@]
+ * A_SHAFinal (ntdll.@)
  *
  * Finalize SHA context and return the resulting hash.
  *
@@ -177,8 +175,7 @@ A_SHAUpdate(PSHA_CTX Context, const unsigned char *Buffer, UINT BufferSize)
  * RETURNS
  *  Nothing
  */
-VOID WINAPI
-A_SHAFinal(PSHA_CTX Context, PULONG Result)
+void WINAPI A_SHAFinal(PSHA_CTX Context, PULONG Result)
 {
    INT Pad, Index;
    UCHAR Buffer[72];
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 5d3b0ca..a650646 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -3,6 +3,9 @@
 #if you change a Nt.. function DON'T FORGET to change the
 #Zw one too.
 
+@ stdcall A_SHAFinal(ptr ptr)
+@ stdcall A_SHAInit(ptr)
+@ stdcall A_SHAUpdate(ptr ptr long)
 @ stdcall ApiSetQueryApiSetPresence(ptr ptr)
 @ stub CsrAllocateCaptureBuffer
 @ stub CsrAllocateCapturePointer




More information about the wine-cvs mailing list