From 0fd669cbc3ab4980a0011880e71704f5936fcc5a Mon Sep 17 00:00:00 2001 From: Bryan Hunt Date: Fri, 4 Nov 2022 15:57:47 -0600 Subject: [PATCH] Fix MacOS build and atcacert padding validation failure --- .github/workflows/build.yml | 7 +++++-- lib/atca_platform.h | 5 ++--- lib/hal/hal_linux_uart_userspace.c | 8 ++++++++ python/cryptoauthlib/atcacert.py | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 704c0fd49..9c9bc72ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v2 @@ -41,8 +41,11 @@ jobs: with: package-dir: python env: - CIBW_SKIP: "cp27-* pp*-macosx* cp35-macosx_x86_64" + CIBW_SKIP: "cp27-* cp36-* *-musllinux* pp*-macosx* cp35-macosx_x86_64" + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28" + CIBW_BEFORE_BUILD_LINUX: "yum update -y && yum install -y libusb-devel" CIBW_BUILD_VERBOSITY: 3 + CIBW_ARCHS_LINUX: "x86_64" CIBW_ARCHS_MACOS: "x86_64 arm64" # Skip trying to test arm64 builds on Intel Macs CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64" diff --git a/lib/atca_platform.h b/lib/atca_platform.h index ccd2588a8..39d9757ce 100644 --- a/lib/atca_platform.h +++ b/lib/atca_platform.h @@ -28,6 +28,7 @@ #define ATCA_PLATFORM_H #include +#include #if defined(ATCA_TESTS_ENABLED) || !defined(ATCA_PLATFORM_MALLOC) void* hal_malloc(size_t size); @@ -36,22 +37,20 @@ void hal_free(void* ptr); #define hal_malloc ATCA_PLATFORM_MALLOC #define hal_free ATCA_PLATFORM_FREE #endif -#endif #ifdef ATCA_PLATFORM_MEMSET_S #define hal_memset_s ATCA_PLATFORM_MEMSET_S #else -#include #ifndef memset_s #define hal_memset_s atcab_memset_s #else #define hal_memset_s memset_s #endif +#endif #ifdef ATCA_PLATFORM_STRCASESTR #define lib_strcasestr ATCA_PLATFORM_STRCASESTR #else -#include #ifndef strcasestr char *lib_strcasestr(const char *haystack, const char *needle); #else diff --git a/lib/hal/hal_linux_uart_userspace.c b/lib/hal/hal_linux_uart_userspace.c index 1a998d6db..204a364ae 100644 --- a/lib/hal/hal_linux_uart_userspace.c +++ b/lib/hal/hal_linux_uart_userspace.c @@ -129,6 +129,7 @@ static ATCA_STATUS hal_uart_open_file(atca_uart_host_t * hal_data, ATCAIfaceCfg { struct termios tty; speed_t rate; + int flags; /* Get existing device attributes */ tcgetattr(hal_data->fd_uart, &tty); @@ -190,6 +191,13 @@ static ATCA_STATUS hal_uart_open_file(atca_uart_host_t * hal_data, ATCAIfaceCfg return ATCA_COMM_FAIL; } + flags = TIOCM_DTR; + if (-1 == ioctl(hal_data->fd_uart, TIOCMBIS, &flags)) + { + close(hal_data->fd_uart); + return ATCA_COMM_FAIL; + } + status = ATCA_SUCCESS; } else diff --git a/python/cryptoauthlib/atcacert.py b/python/cryptoauthlib/atcacert.py index 6e0837964..5363bd778 100644 --- a/python/cryptoauthlib/atcacert.py +++ b/python/cryptoauthlib/atcacert.py @@ -241,7 +241,7 @@ class atcacert_def_t(AtcaStructure): """ CTypes mirror of atcacert_def_t from atcacert_def.h """ - _pack_ = 1 + pass # Need to define fields outside the class due to ca_cert_def, which is a pointer # to the same class.