Skip to content

Commit 7c76e1a

Browse files
authored
Merge pull request #283 from bryan-hunt/fix_aarch64_unaligned_pointers
Don't attempt to pack structures with pointers - should fix aarch64 issues
2 parents df360b1 + 4c49925 commit 7c76e1a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/atcacert/atcacert_def.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,17 @@ typedef struct ATCA_PACKED atcacert_cert_element_s
166166
atcacert_transform_t transforms[ATCA_MAX_TRANSFORMS]; //!< List of transforms from device to cert for this element.
167167
} atcacert_cert_element_t;
168168

169+
#ifndef ATCA_NO_PRAGMA_PACK
170+
#pragma pack(pop)
171+
#endif
172+
169173
/**
170174
* Defines a certificate and all the pieces to work with it.
171175
*
172176
* If any of the standard certificate elements (std_cert_elements) are not a part of the certificate
173177
* definition, set their count to 0 to indicate their absence.
174178
*/
175-
typedef struct ATCA_PACKED atcacert_def_s
179+
typedef struct atcacert_def_s
176180
{
177181
atcacert_cert_type_t type; //!< Certificate type.
178182
uint8_t template_id; //!< ID for the this certificate definition (4-bit value).
@@ -198,7 +202,7 @@ typedef struct ATCA_PACKED atcacert_def_s
198202
* Tracks the state of a certificate as it's being rebuilt from device information.
199203
*/
200204

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

211-
#ifndef ATCA_NO_PRAGMA_PACK
212-
#pragma pack(pop)
213-
#endif
214-
215215
// Inform function naming when compiling in C++
216216
#ifdef __cplusplus
217217
extern "C" {

python/cryptoauthlib/atcacert.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,6 @@ class atcacert_def_t(AtcaStructure):
221221
"""
222222
CTypes mirror of atcacert_def_t from atcacert_def.h
223223
"""
224-
_pack_ = 1
225-
226224
def __init__(self, *args, **kwargs):
227225
if kwargs is not None:
228226
_atcacert_convert_enum(kwargs, 'type', atcacert_cert_type_t)

0 commit comments

Comments
 (0)