In message <[EMAIL PROTECTED]>,
 `Richard Levitte - VMS Whacker <[EMAIL PROTECTED]>' wrote:
> In message <[EMAIL PROTECTED]> on Wed, 15 Jun 2005 05:37:15 +0900 (JST), 
> GOTOU Yuuzou <[EMAIL PROTECTED]> said:
> 
> gotoyuzo> Hi,
> gotoyuzo> 
> gotoyuzo> Compilation of ssl/kssl.c fails on NetBSD 3.99.5.
> gotoyuzo> 
> gotoyuzo>   gcc -I../crypto -I.. -I../include  -DOPENSSL_THREADS -pthread 
> -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIOS 
> -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DSHA1_ASM 
> -DMD5_ASM -DRMD160_ASM -DAES_ASM  -c kssl.c
> gotoyuzo>   In file included from ../include/openssl/crypto.h:120,
> gotoyuzo>                    from ../include/openssl/comp.h:5,
> gotoyuzo>                    from ../include/openssl/ssl.h:176,
> gotoyuzo>                    from kssl.c:78:
> gotoyuzo>   /usr/include/stdlib.h:245: error: parse error before '*' token
> gotoyuzo>   *** Error code 1
> gotoyuzo> 
> gotoyuzo> This error could be avoided if we read at least one standard
> gotoyuzo> header file before setting _XOPEN_SOURCE macro.
> 
> That's not a good solution, because it basically disables the effect
> of _XOPEN_SOURCE.  It would be interesting to know what, exactly,
> fails.  Could it be that _XOPEN_SOURCE needs to have a different value
> on NetBSD 3.99.5?

<sys/featuretest.h> defines _NETBSD_SOURCE if any other
_XXXX_SOURCEs are not defined.

  <sys/featuretest.h>:
    65  #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
    66      !defined(_XOPEN_SOURCE) && !defined(_NETBSD_SOURCE)
    67  #define _NETBSD_SOURCE 1
    68  #endif

And <sys/types.h> defines u_char only if _NETBSD_SOURCE is
defined.

  <sys/types.h>:
   100  #if defined(_NETBSD_SOURCE)
   101  typedef unsigned char   u_char;
   102  typedef unsigned short  u_short;

<stdlib.h> includes <sys/featuretest.h> and <sys/types.h> again.
An inconsistency comes here, because _XOPEN_SOURCE is already
undefined in ssl/kssl.c.

  <stdlib.h>:
    38  #include <sys/featuretest.h>  <== _NETBSD_SOURCE is defined
    39  
    40  #if defined(_NETBSD_SOURCE)
    41  #include <sys/types.h>        <== disabled by _SYS_TYPES_H_
    42  #endif
        ...
   236  #if defined(_NETBSD_SOURCE)
        ...
   244  void     arc4random_stir(void);
   245  void     arc4random_addrandom(u_char *, int);  <== error!
   246  char    *getbsize(int *, long *);

In fact, <sys/featuretest.h> doesn't define guarding macro
(e.g. _SYS_FEATURETEST_H_), so _NETBSD_SOURCE could be defined at
the second include :-(

It may be an issue of NetBSD, but "#undef _XOPEN_SOURCE"
seems a little wrong too.

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

Reply via email to