Topic: alignment of structures
Hi,
I am trying to cross compile the wolfSSL embedded SSL library (latest from github) and run the testsuite on our embedded device which is running linux. The test is failing when establishing a client / server connection, reason -241 record layer length incorrect. My configure is simply
./configure --host=arm-linux --enable-opensslExtra --prefix=/nx-test/cyassl/release
I am finding that it is some kind of alignment issue:
typedef struct RecordLayerHeader {
byte type;
ProtocolVersion version;
byte length[2];
} RecordLayerHeader;
During negotiation when the AddRecordHeader funtion called the type 0x16 is correct but the version is placed at offset 4, i.e. word aligned. This means that data is not aligned correctly when sent across the wire. Is there a workaround for this?
I have tried building with -fpack-struct argument but this causes previous tests to fail in testsuite and the code size to dramatically increase.
Regards
doddi76