Revision | 7957 (tree) |
---|---|
Time | 2019-08-15 17:38:48 |
Author | (del#24082) |
WindowsMeで RAND_bytes が落ちる問題への処置を追加した。
チケット #36876
@@ -0,0 +1,20 @@ | ||
1 | +*** openssl/crypto/rand/rand_lib.c 2019-05-28 22:12:20.000000000 +0900 | |
2 | +--- openssl.debugprint/crypto/rand/rand_lib.c 2019-08-15 16:54:19.583122400 +0900 | |
3 | +*************** int RAND_bytes(unsigned char *buf, int n | |
4 | +*** 832,838 **** | |
5 | + { | |
6 | + const RAND_METHOD *meth = RAND_get_rand_method(); | |
7 | + | |
8 | +! if (meth->bytes != NULL) | |
9 | + return meth->bytes(buf, num); | |
10 | + RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED); | |
11 | + return -1; | |
12 | +--- 832,839 ---- | |
13 | + { | |
14 | + const RAND_METHOD *meth = RAND_get_rand_method(); | |
15 | + | |
16 | +! // added if meth is NULL pointer. | |
17 | +! if (meth && meth->bytes != NULL) | |
18 | + return meth->bytes(buf, num); | |
19 | + RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED); | |
20 | + return -1; |
@@ -28,7 +28,6 @@ | ||
28 | 28 | %folder%\patch %cmdopt1% < %folder%\ws2_32_dll_patch.txt |
29 | 29 | %folder%\patch %cmdopt2% < %folder%\ws2_32_dll_patch.txt |
30 | 30 | popd |
31 | -goto patch4 | |
32 | 31 | |
33 | 32 | |
34 | 33 | rem CryptAcquireContextW API依存除去のため |
@@ -43,9 +42,23 @@ | ||
43 | 42 | rem popd |
44 | 43 | |
45 | 44 | |
45 | +rem WindowsMeでRAND_bytesで落ちる現象回避のため。 | |
46 | 46 | :patch5 |
47 | +findstr /c:"added if meth is NULL pointer" ..\openssl\crypto\rand\rand_lib.c | |
48 | +if ERRORLEVEL 1 goto fail5 | |
49 | +goto patch6 | |
50 | +:fail5 | |
51 | +pushd .. | |
52 | +%folder%\patch %cmdopt1% < %folder%\RAND_bytes.txt | |
53 | +%folder%\patch %cmdopt2% < %folder%\RAND_bytes.txt | |
54 | +popd | |
47 | 55 | |
48 | 56 | |
57 | + | |
58 | +:patch6 | |
59 | + | |
60 | + | |
61 | + | |
49 | 62 | :patch_end |
50 | 63 | echo "パッチは適用されています" |
51 | 64 | timeout 5 |
@@ -463,7 +463,14 @@ | ||
463 | 463 | |
464 | 464 | void CRYPT_set_random_data(PTInstVar pvar, unsigned char *buf, int bytes) |
465 | 465 | { |
466 | - RAND_bytes(buf, bytes); | |
466 | + int ret; | |
467 | + | |
468 | + // OpenSSL 1.1.1を使った場合、WindowsMeでは RAND_bytes() の呼び出しで落ちる。 | |
469 | + logprintf(LOG_LEVEL_VERBOSE, "%s: RAND_bytes call", __FUNCTION__); | |
470 | + ret = RAND_bytes(buf, bytes); | |
471 | + if (ret < 0) { | |
472 | + logprintf(LOG_LEVEL_ERROR, "%s: RAND_bytes error(%d)", __FUNCTION__, ret); | |
473 | + } | |
467 | 474 | } |
468 | 475 | |
469 | 476 | void CRYPT_initialize_random_numbers(PTInstVar pvar) |