Fix some Alignment Issues

This commit is contained in:
Florian Märkl 2019-11-06 20:56:57 +01:00
commit 4065791f4f
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
8 changed files with 92 additions and 75 deletions

View file

@ -25,11 +25,20 @@
#endif
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUC__
typedef uint32_t chiaki_unaligned_uint32_t __attribute__((aligned(1)));
typedef uint16_t chiaki_unaligned_uint16_t __attribute__((aligned(1)));
#else
typedef uint32_t chiaki_unaligned_uint32_t;
typedef uint16_t chiaki_unaligned_uint16_t;
#endif
#define CHIAKI_EXPORT
#define CHIAKI_NEW(t) ((t*)malloc(sizeof(t)))

View file

@ -48,7 +48,12 @@ typedef struct chiaki_ctrl_t
bool login_pin_requested;
chiaki_socket_t sock;
#ifdef __GNUC__
__attribute__((aligned(__alignof__(uint32_t))))
#endif
uint8_t recv_buf[512];
size_t recv_buf_size;
uint64_t crypt_counter_local;
uint64_t crypt_counter_remote;