Issue #21141: The Windows build process no longer attempts to find Perl,
instead relying on OpenSSL source being configured and ready to build.  The
``PCbuild\build_ssl.py`` script has been re-written and re-named to
``PCbuild\prepare_ssl.py``, and takes care of configuring OpenSSL source
for both 32 and 64 bit platforms.  OpenSSL sources obtained from
svn.python.org will always be pre-configured and ready to build.
diff --git a/Misc/NEWS b/Misc/NEWS
index 04bf854..d47cebc 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -354,6 +354,13 @@
 Build
 -----
 
+- Issue #21141: The Windows build process no longer attempts to find Perl,
+  instead relying on OpenSSL source being configured and ready to build.  The
+  ``PCbuild\build_ssl.py`` script has been re-written and re-named to
+  ``PCbuild\prepare_ssl.py``, and takes care of configuring OpenSSL source
+  for both 32 and 64 bit platforms.  OpenSSL sources obtained from
+  svn.python.org will always be pre-configured and ready to build.
+
 - Issue #21037: Add a build option to enable AddressSanitizer support.
 
 - The Windows build now includes OpenSSL 1.0.1g
diff --git a/PCbuild/build_ssl.py b/PCbuild/build_ssl.py
deleted file mode 100644
index 5a7a89e..0000000
--- a/PCbuild/build_ssl.py
+++ /dev/null
@@ -1,253 +0,0 @@
-# Script for building the _ssl and _hashlib modules for Windows.
-# Uses Perl to setup the OpenSSL environment correctly
-# and build OpenSSL, then invokes a simple nmake session
-# for the actual _ssl.pyd and _hashlib.pyd DLLs.
-
-# THEORETICALLY, you can:
-# * Unpack the latest SSL release one level above your main Python source
-#   directory.  It is likely you will already find the zlib library and
-#   any other external packages there.
-# * Install ActivePerl and ensure it is somewhere on your path.
-# * Run this script from the PCBuild directory.
-#
-# it should configure and build SSL, then build the _ssl and _hashlib
-# Python extensions without intervention.
-
-# Modified by Christian Heimes
-# Now this script supports pre-generated makefiles and assembly files.
-# Developers don't need an installation of Perl anymore to build Python. A svn
-# checkout from our svn repository is enough.
-#
-# In Order to create the files in the case of an update you still need Perl.
-# Run build_ssl in this order:
-# python.exe build_ssl.py Release x64
-# python.exe build_ssl.py Release Win32
-
-import os, sys, re, shutil
-
-# Find all "foo.exe" files on the PATH.
-def find_all_on_path(filename, extras = None):
-    entries = os.environ["PATH"].split(os.pathsep)
-    ret = []
-    for p in entries:
-        fname = os.path.abspath(os.path.join(p, filename))
-        if os.path.isfile(fname) and fname not in ret:
-            ret.append(fname)
-    if extras:
-        for p in extras:
-            fname = os.path.abspath(os.path.join(p, filename))
-            if os.path.isfile(fname) and fname not in ret:
-                ret.append(fname)
-    return ret
-
-# Find a suitable Perl installation for OpenSSL.
-# cygwin perl does *not* work.  ActivePerl does.
-# Being a Perl dummy, the simplest way I can check is if the "Win32" package
-# is available.
-def find_working_perl(perls):
-    for perl in perls:
-        fh = os.popen('"%s" -e "use Win32;"' % perl)
-        fh.read()
-        rc = fh.close()
-        if rc:
-            continue
-        return perl
-    print("Can not find a suitable PERL:")
-    if perls:
-        print(" the following perl interpreters were found:")
-        for p in perls:
-            print(" ", p)
-        print(" None of these versions appear suitable for building OpenSSL")
-    else:
-        print(" NO perl interpreters were found on this machine at all!")
-    print(" Please install ActivePerl and ensure it appears on your path")
-    return None
-
-# Fetch SSL directory from VC properties
-def get_ssl_dir():
-    propfile = (os.path.join(os.path.dirname(__file__), 'pyproject.props'))
-    with open(propfile) as f:
-        m = re.search('openssl-([^<]+)<', f.read())
-        return "..\..\openssl-"+m.group(1)
-
-
-def create_makefile64(makefile, m32):
-    """Create and fix makefile for 64bit
-
-    Replace 32 with 64bit directories
-    """
-    if not os.path.isfile(m32):
-        return
-    with open(m32) as fin:
-        with open(makefile, 'w') as fout:
-            for line in fin:
-                line = line.replace("=tmp32", "=tmp64")
-                line = line.replace("=out32", "=out64")
-                line = line.replace("=inc32", "=inc64")
-                # force 64 bit machine
-                line = line.replace("MKLIB=lib", "MKLIB=lib /MACHINE:X64")
-                line = line.replace("LFLAGS=", "LFLAGS=/MACHINE:X64 ")
-                # don't link against the lib on 64bit systems
-                line = line.replace("bufferoverflowu.lib", "")
-                fout.write(line)
-    os.unlink(m32)
-
-def fix_makefile(makefile):
-    """Fix some stuff in all makefiles
-    """
-    if not os.path.isfile(makefile):
-        return
-    with open(makefile) as fin:
-        lines = fin.readlines()
-    with open(makefile, 'w') as fout:
-        for line in lines:
-            if line.startswith("PERL="):
-                continue
-            if line.startswith("CP="):
-                line = "CP=copy\n"
-            if line.startswith("MKDIR="):
-                line = "MKDIR=mkdir\n"
-            if line.startswith("CFLAG="):
-                line = line.strip()
-                for algo in ("RC5", "MDC2", "IDEA"):
-                    noalgo = " -DOPENSSL_NO_%s" % algo
-                    if noalgo not in line:
-                        line = line + noalgo
-                line = line + '\n'
-            fout.write(line)
-
-def run_configure(configure, do_script):
-    print("perl Configure "+configure+" no-idea no-mdc2")
-    os.system("perl Configure "+configure+" no-idea no-mdc2")
-    print(do_script)
-    os.system(do_script)
-
-def cmp(f1, f2):
-    bufsize = 1024 * 8
-    with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
-        while True:
-            b1 = fp1.read(bufsize)
-            b2 = fp2.read(bufsize)
-            if b1 != b2:
-                return False
-            if not b1:
-                return True
-
-def copy(src, dst):
-    if os.path.isfile(dst) and cmp(src, dst):
-        return
-    shutil.copy(src, dst)
-
-def main():
-    build_all = "-a" in sys.argv
-    if sys.argv[1] == "Release":
-        debug = False
-    elif sys.argv[1] == "Debug":
-        debug = True
-    else:
-        raise ValueError(str(sys.argv))
-
-    if sys.argv[2] == "Win32":
-        arch = "x86"
-        configure = "VC-WIN32"
-        do_script = "ms\\do_nasm"
-        makefile="ms\\nt.mak"
-        m32 = makefile
-        dirsuffix = "32"
-    elif sys.argv[2] == "x64":
-        arch="amd64"
-        configure = "VC-WIN64A"
-        do_script = "ms\\do_win64a"
-        makefile = "ms\\nt64.mak"
-        m32 = makefile.replace('64', '')
-        dirsuffix = "64"
-        #os.environ["VSEXTCOMP_USECL"] = "MS_OPTERON"
-    else:
-        raise ValueError(str(sys.argv))
-
-    make_flags = ""
-    if build_all:
-        make_flags = "-a"
-    # perl should be on the path, but we also look in "\perl" and "c:\\perl"
-    # as "well known" locations
-    perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"])
-    perl = find_working_perl(perls)
-    if perl:
-        print("Found a working perl at '%s'" % (perl,))
-    else:
-        print("No Perl installation was found. Existing Makefiles are used.")
-    sys.stdout.flush()
-    # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live.
-    ssl_dir = get_ssl_dir()
-    if ssl_dir is None:
-        sys.exit(1)
-
-    old_cd = os.getcwd()
-    try:
-        os.chdir(ssl_dir)
-        # rebuild makefile when we do the role over from 32 to 64 build
-        if arch == "amd64" and os.path.isfile(m32) and not os.path.isfile(makefile):
-            os.unlink(m32)
-
-        # If the ssl makefiles do not exist, we invoke Perl to generate them.
-        # Due to a bug in this script, the makefile sometimes ended up empty
-        # Force a regeneration if it is.
-        if not os.path.isfile(makefile) or os.path.getsize(makefile)==0:
-            if perl is None:
-                print("Perl is required to build the makefiles!")
-                sys.exit(1)
-
-            print("Creating the makefiles...")
-            sys.stdout.flush()
-            # Put our working Perl at the front of our path
-            os.environ["PATH"] = os.path.dirname(perl) + \
-                                          os.pathsep + \
-                                          os.environ["PATH"]
-            run_configure(configure, do_script)
-            if debug:
-                print("OpenSSL debug builds aren't supported.")
-            #if arch=="x86" and debug:
-            #    # the do_masm script in openssl doesn't generate a debug
-            #    # build makefile so we generate it here:
-            #    os.system("perl util\mk1mf.pl debug "+configure+" >"+makefile)
-
-            if arch == "amd64":
-                create_makefile64(makefile, m32)
-            fix_makefile(makefile)
-            copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch)
-            copy(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch)
-
-        # If the assembler files don't exist in tmpXX, copy them there
-        if perl is None and os.path.exists("asm"+dirsuffix):
-            if not os.path.exists("tmp"+dirsuffix):
-                os.mkdir("tmp"+dirsuffix)
-            for f in os.listdir("asm"+dirsuffix):
-                if not f.endswith(".asm"): continue
-                if os.path.isfile(r"tmp%s\%s" % (dirsuffix, f)): continue
-                shutil.copy(r"asm%s\%s" % (dirsuffix, f), "tmp"+dirsuffix)
-
-        # Now run make.
-        if arch == "amd64":
-            rc = os.system("nasm -f win64 -DNEAR -Ox -g ms\\uptable.asm")
-            if rc:
-                print("nasm assembler has failed.")
-                sys.exit(rc)
-
-        copy(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h")
-        copy(r"crypto\opensslconf_%s.h" % arch, r"crypto\opensslconf.h")
-
-        #makeCommand = "nmake /nologo PERL=\"%s\" -f \"%s\"" %(perl, makefile)
-        makeCommand = "nmake /nologo -f \"%s\"" % makefile
-        print("Executing ssl makefiles:", makeCommand)
-        sys.stdout.flush()
-        rc = os.system(makeCommand)
-        if rc:
-            print("Executing "+makefile+" failed")
-            print(rc)
-            sys.exit(rc)
-    finally:
-        os.chdir(old_cd)
-    sys.exit(rc)
-
-if __name__=='__main__':
-    main()
diff --git a/PCbuild/build_ssl.bat b/PCbuild/prepare_ssl.bat
similarity index 83%
rename from PCbuild/build_ssl.bat
rename to PCbuild/prepare_ssl.bat
index ee551c9..cb06500 100644
--- a/PCbuild/build_ssl.bat
+++ b/PCbuild/prepare_ssl.bat
@@ -1,6 +1,7 @@
 @echo off
 if not defined HOST_PYTHON (
   if %1 EQU Debug (
+    shift
     set HOST_PYTHON=python_d.exe
     if not exist python35_d.dll exit 1
   ) ELSE (
@@ -8,5 +9,4 @@
     if not exist python35.dll exit 1
   )
 )
-%HOST_PYTHON% build_ssl.py %1 %2 %3
-
+%HOST_PYTHON% prepare_ssl.py %1
diff --git a/PCbuild/prepare_ssl.py b/PCbuild/prepare_ssl.py
new file mode 100644
index 0000000..7dc5365
--- /dev/null
+++ b/PCbuild/prepare_ssl.py
@@ -0,0 +1,217 @@
+# Script for preparing OpenSSL for building on Windows.
+# Uses Perl to create nmake makefiles and otherwise prepare the way
+# for building on 32 or 64 bit platforms.
+
+# Script originally authored by Mark Hammond.
+# Major revisions by:
+#   Martin v. Löwis
+#   Christian Heimes
+#   Zachary Ware
+
+# THEORETICALLY, you can:
+# * Unpack the latest OpenSSL release where $(opensslDir) in
+#   PCbuild\pyproject.props expects it to be.
+# * Install ActivePerl and ensure it is somewhere on your path.
+# * Run this script with the OpenSSL source dir as the only argument.
+#
+# it should configure OpenSSL such that it is ready to be built by
+# ssl.vcxproj on 32 or 64 bit platforms.
+
+import os
+import re
+import sys
+import shutil
+
+# Find all "foo.exe" files on the PATH.
+def find_all_on_path(filename, extras = None):
+    entries = os.environ["PATH"].split(os.pathsep)
+    ret = []
+    for p in entries:
+        fname = os.path.abspath(os.path.join(p, filename))
+        if os.path.isfile(fname) and fname not in ret:
+            ret.append(fname)
+    if extras:
+        for p in extras:
+            fname = os.path.abspath(os.path.join(p, filename))
+            if os.path.isfile(fname) and fname not in ret:
+                ret.append(fname)
+    return ret
+
+# Find a suitable Perl installation for OpenSSL.
+# cygwin perl does *not* work.  ActivePerl does.
+# Being a Perl dummy, the simplest way I can check is if the "Win32" package
+# is available.
+def find_working_perl(perls):
+    for perl in perls:
+        fh = os.popen('"%s" -e "use Win32;"' % perl)
+        fh.read()
+        rc = fh.close()
+        if rc:
+            continue
+        return perl
+    print("Can not find a suitable PERL:")
+    if perls:
+        print(" the following perl interpreters were found:")
+        for p in perls:
+            print(" ", p)
+        print(" None of these versions appear suitable for building OpenSSL")
+    else:
+        print(" NO perl interpreters were found on this machine at all!")
+    print(" Please install ActivePerl and ensure it appears on your path")
+    return None
+
+def create_makefile64(makefile, m32):
+    """Create and fix makefile for 64bit
+
+    Replace 32 with 64bit directories
+    """
+    if not os.path.isfile(m32):
+        return
+    with open(m32) as fin:
+        with open(makefile, 'w') as fout:
+            for line in fin:
+                line = line.replace("=tmp32", "=tmp64")
+                line = line.replace("=out32", "=out64")
+                line = line.replace("=inc32", "=inc64")
+                # force 64 bit machine
+                line = line.replace("MKLIB=lib", "MKLIB=lib /MACHINE:X64")
+                line = line.replace("LFLAGS=", "LFLAGS=/MACHINE:X64 ")
+                # don't link against the lib on 64bit systems
+                line = line.replace("bufferoverflowu.lib", "")
+                fout.write(line)
+    os.unlink(m32)
+
+def fix_makefile(makefile):
+    """Fix some stuff in all makefiles
+    """
+    if not os.path.isfile(makefile):
+        return
+    with open(makefile) as fin:
+        lines = fin.readlines()
+    with open(makefile, 'w') as fout:
+        for line in lines:
+            if line.startswith("PERL="):
+                continue
+            if line.startswith("CP="):
+                line = "CP=copy\n"
+            if line.startswith("MKDIR="):
+                line = "MKDIR=mkdir\n"
+            if line.startswith("CFLAG="):
+                line = line.strip()
+                for algo in ("RC5", "MDC2", "IDEA"):
+                    noalgo = " -DOPENSSL_NO_%s" % algo
+                    if noalgo not in line:
+                        line = line + noalgo
+                line = line + '\n'
+            fout.write(line)
+
+def run_configure(configure, do_script):
+    print("perl Configure "+configure+" no-idea no-mdc2")
+    os.system("perl Configure "+configure+" no-idea no-mdc2")
+    print(do_script)
+    os.system(do_script)
+
+def cmp(f1, f2):
+    bufsize = 1024 * 8
+    with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
+        while True:
+            b1 = fp1.read(bufsize)
+            b2 = fp2.read(bufsize)
+            if b1 != b2:
+                return False
+            if not b1:
+                return True
+
+def copy(src, dst):
+    if os.path.isfile(dst) and cmp(src, dst):
+        return
+    shutil.copy(src, dst)
+
+def prep(arch):
+    if arch == "x86":
+        configure = "VC-WIN32"
+        do_script = "ms\\do_nasm"
+        makefile="ms\\nt.mak"
+        m32 = makefile
+        dirsuffix = "32"
+    elif arch == "amd64":
+        configure = "VC-WIN64A"
+        do_script = "ms\\do_win64a"
+        makefile = "ms\\nt64.mak"
+        m32 = makefile.replace('64', '')
+        dirsuffix = "64"
+        #os.environ["VSEXTCOMP_USECL"] = "MS_OPTERON"
+    else:
+        raise ValueError('Unrecognized platform: %s' % arch)
+
+    # rebuild makefile when we do the role over from 32 to 64 build
+    if arch == "amd64" and os.path.isfile(m32) and not os.path.isfile(makefile):
+        os.unlink(m32)
+
+    # If the ssl makefiles do not exist, we invoke Perl to generate them.
+    # Due to a bug in this script, the makefile sometimes ended up empty
+    # Force a regeneration if it is.
+    if not os.path.isfile(makefile) or os.path.getsize(makefile)==0:
+        print("Creating the makefiles...")
+        sys.stdout.flush()
+        run_configure(configure, do_script)
+
+        if arch == "amd64":
+            create_makefile64(makefile, m32)
+        fix_makefile(makefile)
+        copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch)
+        copy(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch)
+    else:
+        print(makefile, 'already exists!')
+
+    # If the assembler files don't exist in tmpXX, copy them there
+    if os.path.exists("asm"+dirsuffix):
+        if not os.path.exists("tmp"+dirsuffix):
+            os.mkdir("tmp"+dirsuffix)
+        for f in os.listdir("asm"+dirsuffix):
+            if not f.endswith(".asm"): continue
+            if os.path.isfile(r"tmp%s\%s" % (dirsuffix, f)): continue
+            shutil.copy(r"asm%s\%s" % (dirsuffix, f), "tmp"+dirsuffix)
+
+def main():
+    if len(sys.argv) == 1:
+        print("Not enough arguments: directory containing OpenSSL",
+              "sources must be supplied")
+        sys.exit(1)
+
+    if len(sys.argv) > 2:
+        print("Too many arguments supplied, all we need is the directory",
+              "containing OpenSSL sources")
+        sys.exit(1)
+
+    ssl_dir = sys.argv[1]
+
+    if not os.path.exists(ssl_dir) and os.path.isdir(ssl_dir):
+        print(ssl_dir, "is not an existing directory!")
+        sys.exit(1)
+
+    # perl should be on the path, but we also look in "\perl" and "c:\\perl"
+    # as "well known" locations
+    perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"])
+    perl = find_working_perl(perls)
+    if perl:
+        print("Found a working perl at '%s'" % (perl,))
+    else:
+        sys.exit(1)
+    sys.stdout.flush()
+
+    # Put our working Perl at the front of our path
+    os.environ["PATH"] = os.path.dirname(perl) + \
+                                os.pathsep + \
+                                os.environ["PATH"]
+
+    old_cwd = os.getcwd()
+    try:
+        os.chdir(ssl_dir)
+        for arch in ['amd64', 'x86']:
+            prep(arch)
+    finally:
+        os.chdir(old_cwd)
+
+if __name__=='__main__':
+    main()
diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt
index 62c6685..5d6c0eb 100644
--- a/PCbuild/readme.txt
+++ b/PCbuild/readme.txt
@@ -181,30 +181,19 @@
     you should first try to update NASM and do a full rebuild of
     OpenSSL.
 
-    If you like to use the official sources instead of the files from
-    python.org's subversion repository, Perl is required to build the
-    necessary makefiles and assembly files.  ActivePerl is available
-    from
+    The ssl sub-project expects your OpenSSL sources to have already
+    been configured and be ready to build.  If you get your sources
+    from svn.python.org as suggested in the "Getting External Sources"
+    section below, the OpenSSL source will already be ready to go.  If
+    you want to build a different version, you will need to run
+
+       PCbuild\prepare_ssl.py path\to\openssl-source-dir
+
+    That script will prepare your OpenSSL sources in the same way that
+    those available on svn.python.org have been prepared.  Note that
+    Perl must be installed and available on your PATH to configure
+    OpenSSL.  ActivePerl is recommended and is available from
         http://www.activestate.com/activeperl/
-    The svn.python.org version contains pre-built makefiles and assembly
-    files.
-
-    The build process makes sure that no patented algorithms are
-    included.  For now RC5, MDC2 and IDEA are excluded from the build.
-    You may have to manually remove $(OBJ_D)\i_*.obj from ms\nt.mak if
-    using official sources; the svn.python.org-hosted version is already
-    fixed.
-
-    The ssl.vcxproj sub-project simply invokes PCbuild/build_ssl.py,
-    which locates and builds OpenSSL.
-
-    build_ssl.py attempts to catch the most common errors (such as not
-    being able to find OpenSSL sources, or not being able to find a Perl
-    that works with OpenSSL) and give a reasonable error message.  If
-    you have a problem that doesn't seem to be handled correctly (e.g.,
-    you know you have ActivePerl but we can't find it), please take a
-    peek at build_ssl.py and suggest patches.  Note that build_ssl.py
-    should be able to be run directly from the command-line.
 
     The ssl sub-project does not have the ability to clean the OpenSSL
     build; if you need to rebuild, you'll have to clean it by hand.
diff --git a/PCbuild/ssl.vcxproj b/PCbuild/ssl.vcxproj
index d5eac9a..5f318d0 100644
--- a/PCbuild/ssl.vcxproj
+++ b/PCbuild/ssl.vcxproj
@@ -118,9 +118,12 @@
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
     <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
-    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cd "$(SolutionDir)"
-"$(PythonExe)" build_ssl.py Release $(Platform) -a
-</NMakeBuildCommandLine>
+    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+cd "$(SolutionDir)$(opensslDir)"
+copy /Y crypto\buildinf_x86.h crypto\buildinf.h
+copy /Y crypto\opensslconf_x86.h crypto\opensslconf.h
+nmake /nologo -f "ms\nt.mak"
+	</NMakeBuildCommandLine>
     <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
     <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">echo OpenSSL must be cleaned manually if you want to rebuild it.</NMakeCleanCommandLine>
     <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
@@ -129,9 +132,13 @@
     <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
     <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
     <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
-    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cd "$(SolutionDir)"
-"$(PythonExe)" build_ssl.py Release $(Platform) -a
-</NMakeBuildCommandLine>
+    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+cd "$(SolutionDir)$(opensslDir)"
+nasm -f win64 -DNEAR -Ox -g ms\\uptable.asm || echo nasm failed! &amp;&amp; exit
+copy /Y crypto\buildinf_amd64.h crypto\buildinf.h
+copy /Y crypto\opensslconf_amd64.h crypto\opensslconf.h
+nmake /nologo -f "ms\nt64.mak"
+	</NMakeBuildCommandLine>
     <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">echo OpenSSL must be cleaned manually if you want to rebuild it.</NMakeCleanCommandLine>
     <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
@@ -140,9 +147,12 @@
     <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
     <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
     <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
-    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cd "$(SolutionDir)"
-"$(PythonExe)" build_ssl.py Release $(Platform) -a
-</NMakeBuildCommandLine>
+    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+cd "$(SolutionDir)$(opensslDir)"
+copy /Y crypto\buildinf_x86.h crypto\buildinf.h
+copy /Y crypto\opensslconf_x86.h crypto\opensslconf.h
+nmake /nologo -f "ms\nt.mak"
+	</NMakeBuildCommandLine>
     <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
     <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">echo OpenSSL must be cleaned manually if you want to rebuild it.</NMakeCleanCommandLine>
     <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
@@ -151,9 +161,13 @@
     <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
     <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
     <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
-    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cd "$(SolutionDir)"
-"$(PythonExe)" build_ssl.py Release $(Platform) -a
-</NMakeBuildCommandLine>
+    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+cd "$(SolutionDir)$(opensslDir)"
+nasm -f win64 -DNEAR -Ox -g ms\\uptable.asm || echo nasm failed! &amp;&amp; exit
+copy /Y crypto\buildinf_amd64.h crypto\buildinf.h
+copy /Y crypto\opensslconf_amd64.h crypto\opensslconf.h
+nmake /nologo -f "ms\nt64.mak"
+	</NMakeBuildCommandLine>
     <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
     <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">echo OpenSSL must be cleaned manually if you want to rebuild it.</NMakeCleanCommandLine>
     <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
@@ -162,9 +176,12 @@
     <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
     <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
     <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
-    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">cd "$(SolutionDir)"
-"$(PythonExe)" build_ssl.py Release $(Platform) -a
-</NMakeBuildCommandLine>
+    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">
+cd "$(SolutionDir)$(opensslDir)"
+copy /Y crypto\buildinf_x86.h crypto\buildinf.h
+copy /Y crypto\opensslconf_x86.h crypto\opensslconf.h
+nmake /nologo -f "ms\nt.mak"
+	</NMakeBuildCommandLine>
     <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'" />
     <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">echo OpenSSL must be cleaned manually if you want to rebuild it.</NMakeCleanCommandLine>
     <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'" />
@@ -173,9 +190,13 @@
     <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
     <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
     <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
-    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'">cd "$(SolutionDir)"
-"$(PythonExe)" build_ssl.py Release $(Platform) -a
-</NMakeBuildCommandLine>
+    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'">
+cd "$(SolutionDir)$(opensslDir)"
+nasm -f win64 -DNEAR -Ox -g ms\\uptable.asm || echo nasm failed! &amp;&amp; exit
+copy /Y crypto\buildinf_amd64.h crypto\buildinf.h
+copy /Y crypto\opensslconf_amd64.h crypto\opensslconf.h
+nmake /nologo -f "ms\nt64.mak"
+	</NMakeBuildCommandLine>
     <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'" />
     <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'">echo OpenSSL must be cleaned manually if you want to rebuild it.</NMakeCleanCommandLine>
     <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'" />
@@ -184,9 +205,12 @@
     <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
     <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
     <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
-    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">cd "$(SolutionDir)"
-"$(PythonExe)" build_ssl.py Release $(Platform) -a
-</NMakeBuildCommandLine>
+    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">
+cd "$(SolutionDir)$(opensslDir)"
+copy /Y crypto\buildinf_x86.h crypto\buildinf.h
+copy /Y crypto\opensslconf_x86.h crypto\opensslconf.h
+nmake /nologo -f "ms\nt.mak"
+	</NMakeBuildCommandLine>
     <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'" />
     <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">echo OpenSSL must be cleaned manually if you want to rebuild it.</NMakeCleanCommandLine>
     <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'" />
@@ -195,9 +219,13 @@
     <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
     <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
     <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
-    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGUpdate|x64'">cd "$(SolutionDir)"
-"$(PythonExe)" build_ssl.py Release $(Platform) -a
-</NMakeBuildCommandLine>
+    <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGUpdate|x64'">
+cd "$(SolutionDir)$(opensslDir)"
+nasm -f win64 -DNEAR -Ox -g ms\\uptable.asm || echo nasm failed! &amp;&amp; exit
+copy /Y crypto\buildinf_amd64.h crypto\buildinf.h
+copy /Y crypto\opensslconf_amd64.h crypto\opensslconf.h
+nmake /nologo -f "ms\nt64.mak"
+	</NMakeBuildCommandLine>
     <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='PGUpdate|x64'" />
     <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='PGUpdate|x64'">echo OpenSSL must be cleaned manually if you want to rebuild it.</NMakeCleanCommandLine>
     <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='PGUpdate|x64'" />
@@ -209,12 +237,6 @@
   </PropertyGroup>
   <ItemDefinitionGroup>
   </ItemDefinitionGroup>
-  <ItemGroup>
-    <ProjectReference Include="python.vcxproj">
-      <Project>{b11d750f-cd1f-4a96-85ce-e69a5c5259f9}</Project>
-      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
-    </ProjectReference>
-  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>