Jump to content

Python 3.5 Runtime Redistributable backported to XP


FranceBB

Recommended Posts


On 1/28/2019 at 9:35 PM, -SnooPY- said:

File "C:\Temp\python-3.7.1\Lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 14, in <module> from cryptography.hazmat.bindings._openssl import ffi, lib ImportError: DLL load failed: The specified module could not be found.

At this time I don't know exact what the problem is.

I compile a updated version of HTTPSProxy under Python 3.4.4 to a little suite for XP (see my signature) and found that the package "cryptography v2.5" results in this error.

So I step back to "cryptography v2.4.2" an it works OK.

Link to comment
Share on other sites

19 minutes ago, Thomas S. said:

I compile a updated version of HTTPSProxy under Python 3.4.4 to a little suite for XP (see my signature) and found that the package "cryptography v2.5" results in this error.

So I step back to "cryptography v2.4.2" an it works OK.

In my latest version of HTTPSProxy, I also found the misconduct of the cryptography module version 2.5 (Jan 22, 2019). Yesterday again updated the modules for Python 3.4.4, because the support should end in March 2019. From GitHub I downloaded the cryptography module version 2.5 from the developer side and created it again with the help of "GRMSDK Version 7.1", without success. A test for creating cryptography version 2.4.2 was positive.

:)

Link to comment
Share on other sites

10 hours ago, Thomas S. said:

I think it is a problem with missing OpenSSL libraries which are not in the cryptography package

Under "cryptography\hazmat\bindings" in the file "_openssl.pyd" I have no more errors after the exchange from the file from the version 2.4.2 under HTTPSProxy, maybe it helps narrow down the error.

:)

Edited by heinoganda
Link to comment
Share on other sites

I dare to offer you the results of my experiments. I just built an empty bcrypt.dll and the error disappeared. However, I have no ideas about replacing missing functions with XP-compatible ones. Can you advise something? This is my first such experience. Sorry if something is wrong. 

bcrypt.zip

Link to comment
Share on other sites

On 2/21/2019 at 1:11 PM, heinoganda said:

 From GitHub I downloaded the cryptography module version 2.5 from the developer side and created it again with the help of "GRMSDK Version 7.1", without success.

Unfortunately, I did not find any instructions at all on how to build "cryptography-2.5" from sources. The only thing I could find was OpenSSL code like this:

/* On Windows 7 or higher use BCrypt instead of the legacy CryptoAPI */
# if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0601
#  define USE_BCRYPTGENRANDOM
# endif

# ifdef USE_BCRYPTGENRANDOM
#  include <bcrypt.h>
#  pragma comment(lib, "bcrypt.lib")
#  ifndef STATUS_SUCCESS
#   define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
#  endif
# else
#  include <wincrypt.h>

But "cryptography-2.5" modules seem to come only in binaries. :(

Edited by -SnooPY-
Link to comment
Share on other sites

From the sources :
https://github.com/openssl/openssl/blob/master/crypto/rand/rand_win.c

Line 64, if the macro USE_BCRYPTGENRANDOM is defined, the block from
line 65 to 77 is built, using BCryptGenRandom.

Otherwise, the block from 79 to 115 is built, using CryptAcquireContextW and other functions.

Rebuilding OpenSSL should fix that problem but unfortunately, OpenSSL seems to use a horrid build system written in Perl and that makes it not so easy. :angry: In a perfect world, it would simply use CMake but we're not in a perfect world.

Link to comment
Share on other sites

4 hours ago, hotnuma said:

From the sources :
https://github.com/openssl/openssl/blob/master/crypto/rand/rand_win.c

Line 64, if the macro USE_BCRYPTGENRANDOM is defined, the block from
line 65 to 77 is built, using BCryptGenRandom.

Otherwise, the block from 79 to 115 is built, using CryptAcquireContextW and other functions.

By the way, what happens if add the XP-compatible code to the BCryptGenRandom function in the empty bcrypt.dll that I built?

        /* poll the CryptoAPI PRNG */
        if (CryptAcquireContextW(&hProvider, NULL, NULL, PROV_RSA_FULL,
                                 CRYPT_VERIFYCONTEXT | CRYPT_SILENT) != 0) {
            if (CryptGenRandom(hProvider, bytes_needed, buffer) != 0)
                bytes = bytes_needed;

            CryptReleaseContext(hProvider, 0);
        }

 

Link to comment
Share on other sites

27 minutes ago, -SnooPY- said:

By the way, what happens if add the XP-compatible code to the BCryptGenRandom function in the empty bcrypt.dll that I built?

I'm not sure but It may work.
 

Edited by hotnuma
Link to comment
Share on other sites

@jumper

I once tested your "BCrypt.dll" on Windows XP with the module "cryptography-2.5" in Python 3.4.4 and HTTPSProxy started with no errors, but crashed on a connection (just closed). But still have HTTPSProxy compiled under Windows XP and tested under Windows 7 where it worked flawlessly. Definitely there is a problem in Windows XP where the system file "BCrypt.dll" does not exist. I assume that here in addition some functions in the "BCrypt.dll" are needed. Thank you for your effort.


Update:

A check of the files of Crptography 2.5 (_constant_time.pyd, _openssl.pyd and _padding.pyd) with Dependency Walker shows many red functions in the various system files under Windows XP, which is not the case with Crptography 2.4.2. The library "BCrypt.dll" is only part of the many problems.

:)

Edited by heinoganda
Link to comment
Share on other sites

On 2/23/2019 at 6:40 PM, jumper said:

BCryptGenRandom calls RtlGenRandom (aka SystemFunction036) as implemented by the KernelEx project.

I tested your BCrypt.dll on XP in Python 3.7.1 and it crashed a couple of minutes after launch with the "BEX EventType" error:

C:\Temp\ProxHTTPSProxy>python C:\Temp\ProxHTTPSProxy\ProxHTTPSProxy.py
============================================================================
ProxHTTPSProxyMII v1.5 (urllib3/1.24.1)

  FrontServer  : localhost:8079
  RearServer   : localhost:8081
  ParentServer : None
  Proxomitron  : http://localhost:8118
============================================================================

bcrypt-err.jpg.50d334f844afa68b90e37fbb92e492f8.jpg

Thank you so much for the great work. :)

Edited by -SnooPY-
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...