Skip to content

Commit

Permalink
Merge branch 'main' into prebuild-aws-lc
Browse files Browse the repository at this point in the history
  • Loading branch information
graebm committed Oct 8, 2024
2 parents 6d9e9b9 + 49959e3 commit 7811488
Show file tree
Hide file tree
Showing 39 changed files with 478 additions and 276 deletions.
210 changes: 147 additions & 63 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This library is licensed under the Apache 2.0 License.

## Minimum Requirements:

* Python 3.7+
* Python 3.8+

## Installation

Expand Down Expand Up @@ -45,10 +45,10 @@ To simplify installation, aws-crt-python has its own copy of libcrypto.
This lets you install a wheel from PyPI without having OpenSSL installed.
Unix wheels on PyPI come with libcrypto statically compiled in.
Code to build libcrypto comes from [AWS-LC](https://github.com/aws/aws-lc).
AWS-LC's code is included in the PyPI source package,
AWS-LC's code is included in the PyPI source package,
and the git repository includes it as a submodule.

If you need aws-crt-python to use the libcrypto included on your system,
If you need aws-crt-python to use the libcrypto included on your system,
set environment variable `AWS_CRT_BUILD_USE_SYSTEM_LIBCRYPTO=1` while building from source:

```sh
Expand All @@ -59,6 +59,19 @@ AWS_CRT_BUILD_USE_SYSTEM_LIBCRYPTO=1 python3 -m pip install --no-binary :all: --
You can ignore all this on Windows and Apple platforms, where aws-crt-python
uses the OS's default libraries for TLS and cryptography math.

### AWS_CRT_BUILD_USE_SYSTEM_LIBS ###

aws-crt-python depends on several C libraries that make up the AWS Common Runtime (libaws-c-common, libaws-c-s3, etc).
By default, these libraries are built along with aws-crt-python and statically compiled in
(their source code is under [crt/](crt/)).

To skip building these dependencies, because they're already available on your system,
set environment variable `AWS_CRT_BUILD_USE_SYSTEM_LIBS=1` while building from source:

```sh
AWS_CRT_BUILD_USE_SYSTEM_LIBS=1 python3 -m pip install .
```

## Mac-Only TLS Behavior

Please note that on Mac, once a private key is used with a certificate, that certificate-key pair is imported into the Mac Keychain. All subsequent uses of that certificate will use the stored private key and ignore anything passed in programmatically. Beginning in v0.6.2, when a stored private key from the Keychain is used, the following will be logged at the "info" log level:
Expand Down
2 changes: 1 addition & 1 deletion awscrt/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ class AwsSignedBodyHeaderType(IntEnum):
"""Do not add a header."""

X_AMZ_CONTENT_SHA_256 = 1
"""Add the "x-amz-content-sha-256" header with the canonical request's signed body value"""
"""Add the "x-amz-content-sha256" header with the canonical request's signed body value"""


class AwsSigningConfig(NativeResource):
Expand Down
9 changes: 9 additions & 0 deletions awscrt/checksums.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ def crc32c(input: bytes, previous_crc32c: int = 0) -> int:
Returns an unsigned 32-bit integer.
"""
return _awscrt.checksums_crc32c(input, previous_crc32c)


def crc64nvme(input: bytes, previous_crc64nvme: int = 0) -> int:
"""
Perform a CRC64 NVME computation.
If continuing to update a running CRC, pass its value into `previous_crc64nvme`.
Returns an unsigned 64-bit integer.
"""
return _awscrt.checksums_crc64nvme(input, previous_crc64nvme)
2 changes: 0 additions & 2 deletions codebuild/cd/manylinux-x64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ phases:
build:
commands:
- echo Build started on `date`
- /opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
- auditwheel repair --plat manylinux1_x86_64 dist/awscrt-*cp37-cp37m-linux_x86_64.whl
- /opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
- auditwheel repair --plat manylinux1_x86_64 dist/awscrt-*cp38-cp38-linux_x86_64.whl
- /opt/python/cp39-cp39/bin/python setup.py sdist bdist_wheel
Expand Down
2 changes: 0 additions & 2 deletions codebuild/cd/manylinux-x86-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ phases:
build:
commands:
- echo Build started on `date`
- /opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
- auditwheel repair --plat manylinux1_i686 dist/awscrt-*cp37-cp37m-linux_i686.whl
- /opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
- auditwheel repair --plat manylinux1_i686 dist/awscrt-*cp38-cp38-linux_i686.whl
- /opt/python/cp39-cp39/bin/python setup.py sdist bdist_wheel
Expand Down
13 changes: 9 additions & 4 deletions continuous-delivery/build-wheels-manylinux2014-aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ set -ex

/opt/python/cp39-cp39/bin/python ./continuous-delivery/update-version.py

/opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat manylinux2014_aarch64 dist/awscrt-*cp37*.whl

/opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat manylinux2014_aarch64 dist/awscrt-*cp38*.whl

Expand All @@ -19,9 +16,17 @@ auditwheel repair --plat manylinux2014_aarch64 dist/awscrt-*cp310*.whl
/opt/python/cp311-cp311/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat manylinux2014_aarch64 dist/awscrt-*cp311*.whl

# Don't need to build wheels for Python 3.12 and later.
# Don't need to build wheels for Python 3.12.
# The 3.11 wheel uses the stable ABI, so it works with newer versions too.

# We are using the Python 3.13 stable ABI from Python 3.13 onwards because of deprecated functions.
# Manylinux images don't contain setuptools from Python 3.13, so we need to install it.
# Install in a custom location due to access issues.
/opt/python/cp313-cp313/bin/python -m pip install --target ./local -r requirements-dev.txt
export PYTHONPATH=./local:$PYTHONPATH
/opt/python/cp313-cp313/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat manylinux2014_aarch64 dist/awscrt-*cp313*.whl

rm dist/*.whl
cp -rv wheelhouse/* dist/

Expand Down
13 changes: 9 additions & 4 deletions continuous-delivery/build-wheels-manylinux2014-x86_64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ set -ex

/opt/python/cp39-cp39/bin/python ./continuous-delivery/update-version.py

/opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat manylinux2014_x86_64 dist/awscrt-*cp37*.whl

/opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat manylinux2014_x86_64 dist/awscrt-*cp38*.whl

Expand All @@ -19,9 +16,17 @@ auditwheel repair --plat manylinux2014_x86_64 dist/awscrt-*cp310*.whl
/opt/python/cp311-cp311/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat manylinux2014_x86_64 dist/awscrt-*cp311*.whl

# Don't need to build wheels for Python 3.12 and later.
# Don't need to build wheels for Python 3.12.
# The 3.11 wheel uses the stable ABI, so it works with newer versions too.

# We are using the Python 3.13 stable ABI from Python 3.13 onwards because of deprecated functions.
# Manylinux images don't contain setuptools from Python 3.13, so we need to install it.
# Install in a custom location due to access issues.
/opt/python/cp313-cp313/bin/python -m pip install --target ./local -r requirements-dev.txt
export PYTHONPATH=./local:$PYTHONPATH
/opt/python/cp313-cp313/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat manylinux2014_x86_64 dist/awscrt-*cp313*.whl

rm dist/*.whl
cp -rv wheelhouse/* dist/

Expand Down
13 changes: 9 additions & 4 deletions continuous-delivery/build-wheels-musllinux-1-1-aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ set -ex

/opt/python/cp39-cp39/bin/python ./continuous-delivery/update-version.py

/opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat musllinux_1_1_aarch64 dist/awscrt-*cp37*.whl

/opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat musllinux_1_1_aarch64 dist/awscrt-*cp38*.whl

Expand All @@ -19,9 +16,17 @@ auditwheel repair --plat musllinux_1_1_aarch64 dist/awscrt-*cp310*.whl
/opt/python/cp311-cp311/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat musllinux_1_1_aarch64 dist/awscrt-*cp311*.whl

# Don't need to build wheels for Python 3.12 and later.
# Don't need to build wheels for Python 3.12.
# The 3.11 wheel uses the stable ABI, so it works with newer versions too.

# We are using the Python 3.13 stable ABI from Python 3.13 onwards because of deprecated functions.
# Manylinux images don't contain setuptools from Python 3.13, so we need to install it.
# Install in a custom location due to access issues.
/opt/python/cp313-cp313/bin/python -m pip install --target ./local -r requirements-dev.txt
export PYTHONPATH=./local:$PYTHONPATH
/opt/python/cp313-cp313/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat musllinux_1_1_aarch64 dist/awscrt-*cp313*.whl

rm dist/*.whl
cp -rv wheelhouse/* dist/

Expand Down
13 changes: 9 additions & 4 deletions continuous-delivery/build-wheels-musllinux-1-1-x86_64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ set -ex

/opt/python/cp39-cp39/bin/python ./continuous-delivery/update-version.py

/opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat musllinux_1_1_x86_64 dist/awscrt-*cp37*.whl

/opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat musllinux_1_1_x86_64 dist/awscrt-*cp38*.whl

Expand All @@ -19,9 +16,17 @@ auditwheel repair --plat musllinux_1_1_x86_64 dist/awscrt-*cp310*.whl
/opt/python/cp311-cp311/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat musllinux_1_1_x86_64 dist/awscrt-*cp311*.whl

# Don't need to build wheels for Python 3.12 and later.
# Don't need to build wheels for Python 3.12.
# The 3.11 wheel uses the stable ABI, so it works with newer versions too.

# We are using the Python 3.13 stable ABI from Python 3.13 onwards because of deprecated functions.
# Manylinux images don't contain setuptools from Python 3.13, so we need to install it.
# Install in a custom location due to access issues.
/opt/python/cp313-cp313/bin/python -m pip install --target ./local -r requirements-dev.txt
export PYTHONPATH=./local:$PYTHONPATH
/opt/python/cp313-cp313/bin/python setup.py sdist bdist_wheel
auditwheel repair --plat musllinux_1_1_x86_64 dist/awscrt-*cp313*.whl

rm dist/*.whl
cp -rv wheelhouse/* dist/

Expand Down
6 changes: 4 additions & 2 deletions continuous-delivery/build-wheels-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ set -ex

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 ./continuous-delivery/update-version.py

/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 setup.py sdist bdist_wheel
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 setup.py sdist bdist_wheel
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 setup.py sdist bdist_wheel
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 setup.py sdist bdist_wheel
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3 setup.py sdist bdist_wheel

# Don't need to build wheels for Python 3.12 and later.
# Don't need to build wheels for Python 3.12.
# The 3.11 wheel uses the stable ABI, so it works with newer versions too.

# We are using the Python 3.13 stable ABI from Python 3.13 onwards because of deprecated functions.
/Library/Frameworks/Python.framework/Versions/3.13/bin/python3 setup.py sdist bdist_wheel

#now you just need to run twine (that's in a different script)
7 changes: 6 additions & 1 deletion continuous-delivery/build-wheels-win32.bat
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@

"C:\Program Files (x86)\Python39-32\python.exe" .\continuous-delivery\update-version.py || goto error

"C:\Program Files (x86)\Python37-32\python.exe" setup.py sdist bdist_wheel || goto error
"C:\Program Files (x86)\Python38-32\python.exe" setup.py sdist bdist_wheel || goto error
"C:\Program Files (x86)\Python39-32\python.exe" setup.py sdist bdist_wheel || goto error
"C:\Program Files (x86)\Python310-32\python.exe" setup.py sdist bdist_wheel || goto error
"C:\Program Files (x86)\Python311-32\python.exe" setup.py sdist bdist_wheel || goto error

:: Don't need to build wheels for Python 3.12.
:: The 3.11 wheel uses the stable ABI, so it works with newer versions too.

:: We are using the 3.13 stable ABI from 3.13 onwards because of deprecated functions.
"C:\Program Files (x86)\Python313-32\python.exe" setup.py sdist bdist_wheel || goto error

goto :EOF

:error
Expand Down
7 changes: 6 additions & 1 deletion continuous-delivery/build-wheels-win64.bat
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
"C:\Program Files\Python39\python.exe" continuous-delivery\update-version.py || goto error

"C:\Program Files\Python37\python.exe" setup.py sdist bdist_wheel || goto error
"C:\Program Files\Python38\python.exe" setup.py sdist bdist_wheel || goto error
"C:\Program Files\Python39\python.exe" setup.py sdist bdist_wheel || goto error
"C:\Program Files\Python310\python.exe" setup.py sdist bdist_wheel || goto error
"C:\Program Files\Python311\python.exe" setup.py sdist bdist_wheel || goto error

:: Don't need to build wheels for Python 3.12.
:: The 3.11 wheel uses the stable ABI, so it works with newer versions too.

:: We are using the 3.13 stable ABI from 3.13 onwards because of deprecated functions.
"C:\Program Files\Python313\python.exe" setup.py sdist bdist_wheel || goto error

goto :EOF

:error
Expand Down
2 changes: 1 addition & 1 deletion crt/aws-c-cal
2 changes: 1 addition & 1 deletion crt/aws-c-mqtt
Submodule aws-c-mqtt updated 45 files
+12 −3 .github/workflows/ci.yml
+4 −6 .github/workflows/clang-format.yml
+2 −0 CMakeLists.txt
+29 −0 bin/elastishadow/CMakeLists.txt
+1,272 −0 bin/elastishadow/main.c
+47 −0 format-check.py
+0 −24 format-check.sh
+9 −0 include/aws/mqtt/mqtt.h
+54 −0 include/aws/mqtt/private/client_impl.h
+24 −0 include/aws/mqtt/private/client_impl_shared.h
+204 −0 include/aws/mqtt/private/mqtt311_listener.h
+220 −0 include/aws/mqtt/private/request-response/protocol_adapter.h
+23 −0 include/aws/mqtt/private/request-response/request_response_client.h
+264 −0 include/aws/mqtt/private/request-response/subscription_manager.h
+2 −0 include/aws/mqtt/private/shared.h
+274 −0 include/aws/mqtt/request-response/request_response_client.h
+3 −0 include/aws/mqtt/v5/mqtt5_client.h
+176 −58 source/client.c
+6 −0 source/client_channel_handler.c
+9 −0 source/client_impl_shared.c
+25 −0 source/mqtt.c
+329 −0 source/mqtt311_listener.c
+2 −3 source/packets.c
+964 −0 source/request-response/protocol_adapter.c
+2,276 −0 source/request-response/request_response_client.c
+822 −0 source/request-response/subscription_manager.c
+1 −1 source/shared.c
+1 −1 source/v5/mqtt5_client.c
+1 −0 source/v5/mqtt5_listener.c
+14 −0 source/v5/mqtt5_to_mqtt3_adapter.c
+135 −3 tests/CMakeLists.txt
+1,784 −0 tests/request-response/protocol_adapter_tests.c
+3,151 −0 tests/request-response/request_response_client_tests.c
+2,877 −0 tests/request-response/subscription_manager_tests.c
+739 −998 tests/v3/connection_state_test.c
+488 −0 tests/v3/mqtt311_listener_test.c
+582 −0 tests/v3/mqtt311_testing_utils.c
+155 −0 tests/v3/mqtt311_testing_utils.h
+51 −2 tests/v3/mqtt_mock_server_handler.c
+18 −0 tests/v3/mqtt_mock_server_handler.h
+22 −42 tests/v5/mqtt5_client_tests.c
+26 −0 tests/v5/mqtt5_testing_utils.c
+20 −0 tests/v5/mqtt5_testing_utils.h
+0 −4 tests/v5/mqtt5_to_mqtt3_adapter_tests.c
+2 −1 tests/v5/mqtt5_topic_alias_tests.c
2 changes: 1 addition & 1 deletion crt/aws-lc
2 changes: 1 addition & 1 deletion crt/s2n
Submodule s2n updated from 073c7b to 08d413
5 changes: 5 additions & 0 deletions docsrc/source/api/checksums.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
awscrt.checksums
================

.. automodule:: awscrt.checksums
:members:
1 change: 1 addition & 0 deletions docsrc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ API Reference
:maxdepth: 2

api/auth
api/checksums
api/common
api/crypto
api/exceptions
Expand Down
Loading

0 comments on commit 7811488

Please sign in to comment.