forked from pyca/cryptography
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert to cffi 1.0 precompile system
- Loading branch information
1 parent
ca820de
commit 68b3b1e
Showing
68 changed files
with
251 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ _build/ | |
build/ | ||
dist/ | ||
htmlcov/ | ||
src/cryptography/_Cryptography_cffi_* | ||
*.so | ||
.tox/ | ||
.cache/ | ||
.coverage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This file is dual licensed under the terms of the Apache License, Version | ||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository | ||
# for complete details. | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
from _cffi_src.utils import build_ffi_for_binding | ||
|
||
|
||
ffi = build_ffi_for_binding( | ||
module_name="_commoncrypto", | ||
module_prefix="_cffi_src.commoncrypto.", | ||
modules=[ | ||
"cf", | ||
"common_digest", | ||
"common_hmac", | ||
"common_key_derivation", | ||
"common_cryptor", | ||
"common_symmetric_key_wrap", | ||
"secimport", | ||
"secitem", | ||
"seckey", | ||
"seckeychain", | ||
"sectransform", | ||
], | ||
extra_link_args=[ | ||
"-framework", "Security", "-framework", "CoreFoundation" | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This file is dual licensed under the terms of the Apache License, Version | ||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository | ||
# for complete details. | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
import os | ||
|
||
from _cffi_src.utils import build_ffi | ||
|
||
|
||
with open(os.path.join( | ||
os.path.dirname(__file__), "hazmat_src/constant_time.h" | ||
)) as f: | ||
types = f.read() | ||
|
||
with open(os.path.join( | ||
os.path.dirname(__file__), "hazmat_src/constant_time.c" | ||
)) as f: | ||
functions = f.read() | ||
|
||
ffi = build_ffi( | ||
module_name="_constant_time", | ||
cdef_source=types, | ||
verify_source=functions | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# This file is dual licensed under the terms of the Apache License, Version | ||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository | ||
# for complete details. | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
import os | ||
import sys | ||
|
||
from _cffi_src.utils import ( | ||
build_ffi_for_binding | ||
) | ||
|
||
|
||
def _get_openssl_libraries(platform): | ||
# OpenSSL goes by a different library name on different operating systems. | ||
if platform != "win32": | ||
# In some circumstances, the order in which these libs are | ||
# specified on the linker command-line is significant; | ||
# libssl must come before libcrypto | ||
# (http://marc.info/?l=openssl-users&m=135361825921871) | ||
return ["ssl", "crypto"] | ||
else: | ||
link_type = os.environ.get("PYCA_WINDOWS_LINK_TYPE", "static") | ||
return _get_openssl_windows_libraries(link_type) | ||
|
||
|
||
def _get_openssl_windows_libraries(link_type): | ||
if link_type == "dynamic": | ||
return ["libeay32", "ssleay32", "advapi32"] | ||
elif link_type == "static" or link_type == "": | ||
return ["libeay32mt", "ssleay32mt", "advapi32", | ||
"crypt32", "gdi32", "user32", "ws2_32"] | ||
else: | ||
raise ValueError( | ||
"PYCA_WINDOWS_LINK_TYPE must be 'static' or 'dynamic'" | ||
) | ||
|
||
|
||
_OSX_PRE_INCLUDE = """ | ||
#ifdef __APPLE__ | ||
#include <AvailabilityMacros.h> | ||
#define __ORIG_DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER \ | ||
DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER | ||
#undef DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER | ||
#define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER | ||
#endif | ||
""" | ||
|
||
_OSX_POST_INCLUDE = """ | ||
#ifdef __APPLE__ | ||
#undef DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER | ||
#define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER \ | ||
__ORIG_DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER | ||
#endif | ||
""" | ||
|
||
|
||
ffi = build_ffi_for_binding( | ||
module_name="_openssl", | ||
module_prefix="_cffi_src.openssl.", | ||
modules=[ | ||
"aes", | ||
"asn1", | ||
"bignum", | ||
"bio", | ||
"cmac", | ||
"cms", | ||
"conf", | ||
"crypto", | ||
"dh", | ||
"dsa", | ||
"ec", | ||
"ecdh", | ||
"ecdsa", | ||
"engine", | ||
"err", | ||
"evp", | ||
"hmac", | ||
"nid", | ||
"objects", | ||
"opensslv", | ||
"osrandom_engine", | ||
"pem", | ||
"pkcs7", | ||
"pkcs12", | ||
"rand", | ||
"rsa", | ||
"ssl", | ||
"x509", | ||
"x509name", | ||
"x509v3", | ||
"x509_vfy" | ||
], | ||
pre_include=_OSX_PRE_INCLUDE, | ||
post_include=_OSX_POST_INCLUDE, | ||
libraries=_get_openssl_libraries(sys.platform) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This file is dual licensed under the terms of the Apache License, Version | ||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository | ||
# for complete details. | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
import os | ||
|
||
from _cffi_src.utils import build_ffi | ||
|
||
|
||
with open(os.path.join( | ||
os.path.dirname(__file__), "hazmat_src/padding.h" | ||
)) as f: | ||
types = f.read() | ||
|
||
with open(os.path.join( | ||
os.path.dirname(__file__), "hazmat_src/padding.c" | ||
)) as f: | ||
functions = f.read() | ||
|
||
ffi = build_ffi( | ||
module_name="_padding", | ||
cdef_source=types, | ||
verify_source=functions | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file is dual licensed under the terms of the Apache License, Version | ||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository | ||
# for complete details. | ||
|
||
from __future__ import absolute_import, division, print_function |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file is dual licensed under the terms of the Apache License, Version | ||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository | ||
# for complete details. | ||
|
||
from __future__ import absolute_import, division, print_function |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.