Skip to content

Commit

Permalink
Merge pull request #283 from bryan-hunt/fix_aarch64_unaligned_pointers
Browse files Browse the repository at this point in the history
Don't attempt to pack structures with pointers - should fix aarch64 issues
  • Loading branch information
bryan-hunt authored Feb 17, 2022
2 parents df360b1 + 4c49925 commit 7c76e1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 6 additions & 6 deletions lib/atcacert/atcacert_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,17 @@ typedef struct ATCA_PACKED atcacert_cert_element_s
atcacert_transform_t transforms[ATCA_MAX_TRANSFORMS]; //!< List of transforms from device to cert for this element.
} atcacert_cert_element_t;

#ifndef ATCA_NO_PRAGMA_PACK
#pragma pack(pop)
#endif

/**
* Defines a certificate and all the pieces to work with it.
*
* If any of the standard certificate elements (std_cert_elements) are not a part of the certificate
* definition, set their count to 0 to indicate their absence.
*/
typedef struct ATCA_PACKED atcacert_def_s
typedef struct atcacert_def_s
{
atcacert_cert_type_t type; //!< Certificate type.
uint8_t template_id; //!< ID for the this certificate definition (4-bit value).
Expand All @@ -198,7 +202,7 @@ typedef struct ATCA_PACKED atcacert_def_s
* Tracks the state of a certificate as it's being rebuilt from device information.
*/

typedef struct ATCA_PACKED atcacert_build_state_s
typedef struct atcacert_build_state_s
{
const atcacert_def_t* cert_def; //!< Certificate definition for the certificate being rebuilt.
uint8_t* cert; //!< Buffer to contain the rebuilt certificate.
Expand All @@ -208,10 +212,6 @@ typedef struct ATCA_PACKED atcacert_build_state_s
uint8_t device_sn[9]; //!< Storage for the device SN, when it's found.
} atcacert_build_state_t;

#ifndef ATCA_NO_PRAGMA_PACK
#pragma pack(pop)
#endif

// Inform function naming when compiling in C++
#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 0 additions & 2 deletions python/cryptoauthlib/atcacert.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ class atcacert_def_t(AtcaStructure):
"""
CTypes mirror of atcacert_def_t from atcacert_def.h
"""
_pack_ = 1

def __init__(self, *args, **kwargs):
if kwargs is not None:
_atcacert_convert_enum(kwargs, 'type', atcacert_cert_type_t)
Expand Down

0 comments on commit 7c76e1a

Please sign in to comment.