Isn't this the job of the compiler?
I don't believe that OpenSSL goes out of it's way to access
values larger than 8-bits on unaligned addresses. One exception is the
hand-optimised crypto routines, such as AES, where 32-bit values may be accessed
on arbitrary addresses. Check out the macros in aes_locl.h for
examples of handling this properly for processors that require it. Typical
RISC processors are more restrictive than what you're asking for, eg. expecting
32-bit values to be aligned to 32-bit addresses, and these are definitely
supported by OpenSSL. The ARM processor is one example. I did the
port for this (for Windows CE) and ran into this problem with the AES
module. If you search for use of the OPENSSL_SYS_WINCE macro which I added
to aes_locl.h you may find other places where this was necessary, which I've now
forgotten.
Your compiler should
be generating code that packs structures appropriately for the target
processor. Except for the optimisations mentioned above, OpenSSL simply
accesses the fields within the structure, so it's the job of the compiler to
ensure that they are aligned appropriately. And it's the job of the
runtime system to ensure that the memory is allocated on an appropriate boundary
(typically a 16-byte boundary).
Regards,
Steven
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Riaz Farnaz
Sent: Monday, 4 July 2005 4:04 PM
To: [email protected]
Subject: does openssl allocate memory with 16 bit alignment?
Hi,
I am working on a proprietary ASIC chip that requires the
memory buffers passed to it to be 16 bit aligned. Does Openssl support
16-bit alignment of the memory being allocated or is there any way that I can
force 16 bit alignment of the data?
-Riaz
