On Tue, Feb 20, 2018 at 01:26:02PM +0000, Salz, Rich via openssl-users wrote:
> Would making buf a union also avoid the problem?
>
> union { unsigned long dummy[2]; char buf[DATA_BUF_SIZE]; } d
> and then replace 'buf' with 'd.buf' in the code?
If alignment of "buf" is the issue, then yes, a suitable union
would be an alternative to using malloc. We could make the union:
union {
unsigned long long dummyl;
ossl_uintmax_t dummym;
char *dummyp;
char buf[DATA_BUF_SIZE];
} d;
just in case that's what it takes for the required alignment. But,
OPENSSL_malloc() should do the job simply, without such hoop jumping.
Either way, the OP should confirm that aligning "buf" solves the
reported problem.
--
Viktor.
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users