[Ttssh2-commit] [7841] 下記APIへの依存除去

scmno****@osdn***** scmno****@osdn*****
2019年 7月 10日 (水) 23:53:21 JST


Revision: 7841
          https://osdn.net/projects/ttssh2/scm/svn/commits/7841
Author:   yutakapon
Date:     2019-07-10 23:53:20 +0900 (Wed, 10 Jul 2019)
Log Message:
-----------
下記APIへの依存除去
InterlockedCompareExchange
InterlockedExchangeAdd
InitializeCriticalSectionAndSpinCount
チケット #36876 

Ticket Links:
------------
    https://osdn.net/projects/ttssh2/tracker/detail/36876

Modified Paths:
--------------
    branches/openssl_1_1_1_v2/libs/openssl_patch/check_patch.bat

Added Paths:
-----------
    branches/openssl_1_1_1_v2/libs/openssl_patch/thread_win.txt

-------------- next part --------------
Modified: branches/openssl_1_1_1_v2/libs/openssl_patch/check_patch.bat
===================================================================
--- branches/openssl_1_1_1_v2/libs/openssl_patch/check_patch.bat	2019-07-10 12:36:24 UTC (rev 7840)
+++ branches/openssl_1_1_1_v2/libs/openssl_patch/check_patch.bat	2019-07-10 14:53:20 UTC (rev 7841)
@@ -20,7 +20,7 @@
 :patch1
 findstr /c:"# undef AI_PASSIVE" ..\openssl\crypto\bio\bio_lcl.h
 if ERRORLEVEL 1 goto fail1
-goto patch2
+goto patch3
 :fail1
 pushd ..
 %folder%\patch %cmdopt1% < %folder%\ws2_32_dll_patch.txt
@@ -27,6 +27,7 @@
 %folder%\patch %cmdopt2% < %folder%\ws2_32_dll_patch.txt
 popd
 
+rem \x88ȉ\xBA\x82͂\xA0\x82Ƃŏ\xC1\x82\xB7
 :patch2
 findstr /c:"running on Windows95" ..\openssl\crypto\threads_win.c
 if ERRORLEVEL 1 goto fail2
@@ -37,9 +38,20 @@
 %folder%\patch %cmdopt2% < %folder%\InitializeCriticalSectionAndSpinCount_patch.txt
 popd
 
+:patch3
+findstr /c:"myInitializeCriticalSectionAndSpinCount" ..\openssl\crypto\threads_win.c
+if ERRORLEVEL 1 goto fail3
+goto patch4
+:fail3
+pushd ..
+%folder%\patch %cmdopt1% < %folder%\thread_win.txt
+%folder%\patch %cmdopt2% < %folder%\thread_win.txt
+popd
 
 
-:patch3
+
+
+:patch4
 echo "\x83p\x83b\x83`\x82͓K\x97p\x82\xB3\x82\xEA\x82Ă\xA2\x82܂\xB7"
 timeout 5
 goto end

Added: branches/openssl_1_1_1_v2/libs/openssl_patch/thread_win.txt
===================================================================
--- branches/openssl_1_1_1_v2/libs/openssl_patch/thread_win.txt	                        (rev 0)
+++ branches/openssl_1_1_1_v2/libs/openssl_patch/thread_win.txt	2019-07-10 14:53:20 UTC (rev 7841)
@@ -0,0 +1,45 @@
+*** openssl-1.1.1c.org/crypto/threads_win.c	2019-05-28 22:12:20.000000000 +0900
+--- openssl/crypto/threads_win.c	2019-07-10 23:26:55.883810800 +0900
+***************
+*** 13,18 ****
+--- 13,52 ----
+  
+  #include <openssl/crypto.h>
+  
++ // Windows95\x82ŋN\x93\xAE\x82\xB3\x82\xB9\x82邽\x82߂ɁA\x8B[\x8E\x97\x83R\x81[\x83h\x82ŏ㏑\x82\xAB\x82\xB7\x82\xE9\x81B
++ // \x83A\x83g\x83~\x83b\x83N\x82ɂȂ\xC1\x82Ă\xA2\x82Ȃ\xA2\x82̂ŃA\x83Z\x83\x93\x83u\x83\x89\x82ŏ\x91\x82\xAB\x92\xBC\x82\xB7\x95K\x97v\x82\xA0\x82\xE8\x81B
++ #define InitializeCriticalSectionAndSpinCount(a, b) myInitializeCriticalSectionAndSpinCount(a)
++ int myInitializeCriticalSectionAndSpinCount(void *arg)
++ {
++ 	InitializeCriticalSection(arg);
++ 	return 1;
++ }
++ 
++ #define InterlockedCompareExchange(a, b, c) myInterlockedCompareExchange(a, b, c)
++ LONG myInterlockedCompareExchange( 
++     LPLONG volatile Destination,
++     LONG Exchange,
++     LONG Comperand
++ )
++ {
++ 	LONG ret = *Destination;
++ 	
++ 	if (*Destination == Comperand)
++ 		ret = InterlockedExchange(Destination, Exchange);
++ 	return (ret);
++ }
++ 
++ #define InterlockedExchangeAdd(a, b) myInterlockedExchangeAdd(a, b)
++ LONG myInterlockedExchangeAdd(
++   LONG volatile *Addend,
++   LONG          Value
++ )
++ {
++ 	while (Value-- > 0) 
++ 		InterlockedIncrement(Addend);
++ }
++ 
++ 
+  #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && defined(OPENSSL_SYS_WINDOWS)
+  
+  CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)


Ttssh2-commit メーリングリストの案内