> I have used openssl in an application for the first time, so this might be
> my code, but there is strong evidence that it is not.  I linked Electric
> Fence in my application and when I use the sha512 digest, I get a Bus Error,
> when I use the md5 digest, I do not.
> 
> I am running on a sparc Ultra-2 with Solaris 8, and using OpenSSL 0.9.8.
> 
> The backtrace from the core dump is:
> 
> #0  0xff0d95d8 in SHA512_Init () from /usr/local/lib/libcrypto.so.0.9.8
> #1  0xff134798 in EVP_DigestInit_ex () from
> /usr/local/lib/libcrypto.so.0.9.8
> #2  0xff0dd724 in HMAC_Init_ex () from /usr/local/lib/libcrypto.so.0.9.8
> #3  0x0001113c in main (argc=1, argv=0xffbef7a4) at hmac.c:33
> 
> I have attached the source of the test file that gets this error.

Well, one can not actually claim that it's OpenSSL bug either. As we all 
know, Electric Fence replaces malloc(3) and the trouble is that its 
implementation formally violates ISO specification. To be specific "... 
pointer returned [by malloc] ... is suitably aligned so that it may be 
assigned to a pointer to any type of object" clause. The thing is that 
EFence malloc is asked to allocate amount of bytes not divisible by 8 
and returns pointer not aligned at 64-bit boundary, while SHA512_Init 
requires aligned one. EFence has its reasons to return non-aligned 
pointer, but SHA512_Init is allowed by specification to not expect one. 
In other words above crash does not constitute OpenSSL bug. One can 
compensate for this in OpenSSL code by padding certain structures, but 
the thing is that *formally* it's not required and therefore you should 
not expect SHA512 to work under EFence on platforms not capable to 
tolerate misaligned reference to memory. Platforms like SPARC, Alpha, 
PA-RISC2, IA64, ... A.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to