Skip to content

Commit

Permalink
Fix MacOS build and atcacert padding validation failure
Browse files Browse the repository at this point in the history
  • Loading branch information
bryan-hunt committed Nov 5, 2022
1 parent e723fd0 commit 0fd669c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions lib/atca_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define ATCA_PLATFORM_H

#include <stddef.h>
#include <string.h>

#if defined(ATCA_TESTS_ENABLED) || !defined(ATCA_PLATFORM_MALLOC)
void* hal_malloc(size_t size);
Expand All @@ -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 <string.h>
#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 <string.h>
#ifndef strcasestr
char *lib_strcasestr(const char *haystack, const char *needle);
#else
Expand Down
8 changes: 8 additions & 0 deletions lib/hal/hal_linux_uart_userspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/cryptoauthlib/atcacert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0fd669c

Please sign in to comment.