mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
enable ASLR and NX on windows builds (affects 2.x only)
This commit is contained in:
parent
325453c941
commit
dccbc9b00a
4 changed files with 20 additions and 8 deletions
|
|
@ -5,8 +5,9 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from _cffi_src.utils import build_ffi
|
||||
from _cffi_src.utils import build_ffi, extra_link_args
|
||||
|
||||
|
||||
with open(os.path.join(
|
||||
|
|
@ -22,5 +23,6 @@ with open(os.path.join(
|
|||
ffi = build_ffi(
|
||||
module_name="_constant_time",
|
||||
cdef_source=types,
|
||||
verify_source=functions
|
||||
verify_source=functions,
|
||||
extra_link_args=extra_link_args(sys.platform),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@ from __future__ import absolute_import, division, print_function
|
|||
import os
|
||||
import sys
|
||||
|
||||
from _cffi_src.utils import (
|
||||
build_ffi_for_binding
|
||||
)
|
||||
from _cffi_src.utils import build_ffi_for_binding, extra_link_args
|
||||
|
||||
|
||||
def _get_openssl_libraries(platform):
|
||||
|
|
@ -94,5 +92,6 @@ ffi = build_ffi_for_binding(
|
|||
],
|
||||
pre_include=_OSX_PRE_INCLUDE,
|
||||
post_include=_OSX_POST_INCLUDE,
|
||||
libraries=_get_openssl_libraries(sys.platform)
|
||||
libraries=_get_openssl_libraries(sys.platform),
|
||||
extra_link_args=extra_link_args(sys.platform),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from _cffi_src.utils import build_ffi
|
||||
from _cffi_src.utils import build_ffi, extra_link_args
|
||||
|
||||
|
||||
with open(os.path.join(
|
||||
|
|
@ -22,5 +23,6 @@ with open(os.path.join(
|
|||
ffi = build_ffi(
|
||||
module_name="_padding",
|
||||
cdef_source=types,
|
||||
verify_source=functions
|
||||
verify_source=functions,
|
||||
extra_link_args=extra_link_args(sys.platform),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -80,3 +80,12 @@ def build_ffi(module_name, cdef_source, verify_source, libraries=[],
|
|||
extra_link_args=extra_link_args,
|
||||
)
|
||||
return ffi
|
||||
|
||||
|
||||
def extra_link_args(platform):
|
||||
if platform != "win32":
|
||||
return []
|
||||
else:
|
||||
# Enable NX and ASLR for Windows builds. These are enabled by default
|
||||
# on Python 3.3+ but not on 2.x.
|
||||
return ["/NXCOMPAT", "/DYNAMICBASE"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue