[Ttssh2-commit] [7957] WindowsMeで RAND_bytes が落ちる問題への処置を追加した。

Zurück zum Archiv-Index
scmno****@osdn***** scmno****@osdn*****
2019年 8月 15日 (木) 17:38:48 JST


Revision: 7957
          https://osdn.net/projects/ttssh2/scm/svn/commits/7957
Author:   yutakapon
Date:     2019-08-15 17:38:48 +0900 (Thu, 15 Aug 2019)
Log Message:
-----------
WindowsMeで RAND_bytes が落ちる問題への処置を追加した。
チケット #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
    branches/openssl_1_1_1_v2/ttssh2/ttxssh/crypt.c

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

-------------- next part --------------
Added: branches/openssl_1_1_1_v2/libs/openssl_patch/RAND_bytes.txt
===================================================================
--- branches/openssl_1_1_1_v2/libs/openssl_patch/RAND_bytes.txt	                        (rev 0)
+++ branches/openssl_1_1_1_v2/libs/openssl_patch/RAND_bytes.txt	2019-08-15 08:38:48 UTC (rev 7957)
@@ -0,0 +1,20 @@
+*** openssl/crypto/rand/rand_lib.c	2019-05-28 22:12:20.000000000 +0900
+--- openssl.debugprint/crypto/rand/rand_lib.c	2019-08-15 16:54:19.583122400 +0900
+*************** int RAND_bytes(unsigned char *buf, int n
+*** 832,838 ****
+  {
+      const RAND_METHOD *meth = RAND_get_rand_method();
+  
+!     if (meth->bytes != NULL)
+          return meth->bytes(buf, num);
+      RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
+      return -1;
+--- 832,839 ----
+  {
+      const RAND_METHOD *meth = RAND_get_rand_method();
+  
+! 	// added if meth is NULL pointer.
+!     if (meth && meth->bytes != NULL)
+          return meth->bytes(buf, num);
+      RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
+      return -1;

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-08-14 13:01:59 UTC (rev 7956)
+++ branches/openssl_1_1_1_v2/libs/openssl_patch/check_patch.bat	2019-08-15 08:38:48 UTC (rev 7957)
@@ -28,7 +28,6 @@
 %folder%\patch %cmdopt1% < %folder%\ws2_32_dll_patch.txt
 %folder%\patch %cmdopt2% < %folder%\ws2_32_dll_patch.txt
 popd
-goto patch4
 
 
 rem CryptAcquireContextW API\x88ˑ\xB6\x8F\x9C\x8B\x8E\x82̂\xBD\x82\xDF
@@ -43,9 +42,23 @@
 rem popd
 
 
+rem WindowsMe\x82\xC5RAND_bytes\x82ŗ\x8E\x82\xBF\x82錻\x8Fۉ\xF1\x94\xF0\x82̂\xBD\x82߁B
 :patch5
+findstr /c:"added if meth is NULL pointer" ..\openssl\crypto\rand\rand_lib.c
+if ERRORLEVEL 1 goto fail5
+goto patch6
+:fail5
+pushd ..
+%folder%\patch %cmdopt1% < %folder%\RAND_bytes.txt
+%folder%\patch %cmdopt2% < %folder%\RAND_bytes.txt
+popd
 
 
+
+:patch6
+
+
+
 :patch_end
 echo "\x83p\x83b\x83`\x82͓K\x97p\x82\xB3\x82\xEA\x82Ă\xA2\x82܂\xB7"
 timeout 5

Modified: branches/openssl_1_1_1_v2/ttssh2/ttxssh/crypt.c
===================================================================
--- branches/openssl_1_1_1_v2/ttssh2/ttxssh/crypt.c	2019-08-14 13:01:59 UTC (rev 7956)
+++ branches/openssl_1_1_1_v2/ttssh2/ttxssh/crypt.c	2019-08-15 08:38:48 UTC (rev 7957)
@@ -463,7 +463,14 @@
 
 void CRYPT_set_random_data(PTInstVar pvar, unsigned char *buf, int bytes)
 {
-	RAND_bytes(buf, bytes);
+	int ret;
+
+	// OpenSSL 1.1.1\x82\xF0\x8Eg\x82\xC1\x82\xBD\x8Fꍇ\x81AWindowsMe\x82ł\xCD RAND_bytes() \x82̌Ăяo\x82\xB5\x82ŗ\x8E\x82\xBF\x82\xE9\x81B
+	logprintf(LOG_LEVEL_VERBOSE, "%s: RAND_bytes call", __FUNCTION__);
+	ret = RAND_bytes(buf, bytes);
+	if (ret < 0) {
+		logprintf(LOG_LEVEL_ERROR, "%s: RAND_bytes error(%d)", __FUNCTION__, ret);
+	}
 }
 
 void CRYPT_initialize_random_numbers(PTInstVar pvar)


Ttssh2-commit メーリングリストの案内
Zurück zum Archiv-Index