Richard Levitte - VMS Whacker wrote:
In message <[EMAIL PROTECTED]> on Mon, 27 Sep 2004 15:17:47 +0200, Raf Schietekat <[EMAIL PROTECTED]> said:
f0586712> Joseph Bruni wrote:
f0586712> f0586712> > When attempting to compile openssl-SNAP-20040910.tar.gz on Mac OS X f0586712> > (10.3.5), I ran into a header file problem in f0586712> > crypto/engine/eng_padlock.c. The "malloc.h" header is located in f0586712> > "/usr/include/malloc/malloc.h". See diff:
f0586712> > f0586712> > --- crypto/engine/eng_padlock.c.orig Fri Sep 10 15:06:33 2004
f0586712> > +++ crypto/engine/eng_padlock.c Fri Sep 10 15:03:59 2004
f0586712> > @@ -65,7 +65,7 @@
f0586712> > f0586712> > #include <stdio.h>
f0586712> > #include <string.h>
f0586712> > -#include <malloc.h>
f0586712> > +#include <malloc/malloc.h>
f0586712> > #ifdef _MSC_VER
f0586712> > # define alloca _alloca
f0586712> > # define snprintf _snprintf
f0586712> > f0586712> > After fixing this, the compile (including "make test") worked fine.
f0586712> f0586712> It seems to me that the appropriate way to declare malloc()
f0586712> is to #include <stdlib.h> rather than <malloc.h> (with an
f0586712> additional #include "malloc.h" inside the #ifdef
f0586712> _MSC_VER). Don't take my word for it, just consult the
f0586712> standard documents for C(++), several manual pages
f0586712> (including the one for Darwin, underlying Mac OS X), and
f0586712> MSDN for MS-specific code. I'm sure <malloc/malloc.h> will
f0586712> be (ultimately) included from there, so there's no need to
f0586712> go ad hoc yourself. In openssl-SNAP-20040908, only this file
f0586712> needs to be fixed, the rest (e_os.h, ms/uplink.c) is already
f0586712> using "malloc.h" only for MS-specific code.
True, if malloc() was the issue. The thing is that eng_padlock.c uses alloca(), which isn't standard. On GNU systems, the correct header to use is really alloca.h, BTW, at least according to the man page I'm reading.
Do you have a solution for this that works better?
Sorry for the delay. alloca() indeed isn't standard (and several man pages discourage its use), but it's still #include <stdlib.h> on FreeBSD and Darwin. On Darwin (yes, either header can be used) and Red Hat, it's #include <alloca.h>. MSDN on the other hand states only <malloc.h> as a required header for _alloca(), without the <stdlib.h> it requires for malloc(). There's apparently no consensus here, so eng_padlock.c.diff may still need to be modified or checked for FreeBSD and Red Hat. (My sources are the nice multi-platform man page viewer on www.freebsd.org, and an admittedly rather old MSDN Library (from 2001-01).)
Raf Schietekat <[EMAIL PROTECTED]> ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]