ssl/kssl.c fails on NetBSD

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

ssl/kssl.c fails on NetBSD

GOTOU Yuuzou
Hi,

Compilation of ssl/kssl.c fails on NetBSD 3.99.5.

  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
  In file included from ../include/openssl/crypto.h:120,
                   from ../include/openssl/comp.h:5,
                   from ../include/openssl/ssl.h:176,
                   from kssl.c:78:
  /usr/include/stdlib.h:245: error: parse error before '*' token
  *** Error code 1

This error could be avoided if we read at least one standard
header file before setting _XOPEN_SOURCE macro.

--
gotoyuzo

--- openssl-0.9.8-beta5/ssl/kssl.c 2005-06-15 05:12:28.000000000 +0900
+++ openssl-0.9.8-beta5~/ssl/kssl.c 2005-05-22 02:39:53.000000000 +0900
@@ -66,7 +66,6 @@
 **           Real RFC2712 KerberosWrapper replaces AP_REQ.
 */
 
-#include <stdio.h>
 #include <openssl/opensslconf.h>
 
 #define _XOPEN_SOURCE 500 /* glibc2 needs this to declare strptime() */
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ssl/kssl.c fails on NetBSD

GOTOU Yuuzou
In message <[hidden email]>,
 `GOTOU Yuuzou <[hidden email]>' wrote:
> This error could be avoided if we read at least one standard
> header file before setting _XOPEN_SOURCE macro.

> -#include <stdio.h>
>  #include <openssl/opensslconf.h>
>  
>  #define _XOPEN_SOURCE 500 /* glibc2 needs this to declare strptime() */

Sorry, I sent a reversed patch. It should be:

--- openssl-0.9.8-beta5~/ssl/kssl.c 2005-05-22 02:39:53.000000000 +0900
+++ openssl-0.9.8-beta5/ssl/kssl.c 2005-06-15 05:12:28.000000000 +0900
@@ -68,2 +68,3 @@
 
+#include <stdio.h>
 #include <openssl/opensslconf.h>

--
gotoyuzo
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ssl/kssl.c fails on NetBSD

Richard Levitte - VMS Whacker
In reply to this post by GOTOU Yuuzou
In message <[hidden email]> on Wed, 15 Jun 2005 05:37:15 +0900 (JST), GOTOU Yuuzou <[hidden email]> 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?

Cheers,
Richard

-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

--
Richard Levitte                         [hidden email]
                                        http://richard.levitte.org/

"When I became a man I put away childish things, including
 the fear of childishness and the desire to be very grown up."
                                                -- C.S. Lewis
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ssl/kssl.c fails on NetBSD

GOTOU Yuuzou
In message <[hidden email]>,
 `Richard Levitte - VMS Whacker <[hidden email]>' wrote:

> In message <[hidden email]> on Wed, 15 Jun 2005 05:37:15 +0900 (JST), GOTOU Yuuzou <[hidden email]> 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                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ssl/kssl.c fails on NetBSD

Richard Levitte - VMS Whacker
In message <[hidden email]> on Wed, 15 Jun 2005 18:38:27 +0900 (JST), GOTOU Yuuzou <[hidden email]> said:

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

Does it work if I remove the #undef _XOPEN_SOURCE?  I had it there for
paranoid reasons, and it may not be needed.

Cheers,
Richard

-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

--
Richard Levitte                         [hidden email]
                                        http://richard.levitte.org/

"When I became a man I put away childish things, including
 the fear of childishness and the desire to be very grown up."
                                                -- C.S. Lewis

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ssl/kssl.c fails on NetBSD

GOTOU Yuuzou
In message <[hidden email]>,
 `Richard Levitte - VMS Whacker <[hidden email]>' wrote:
> In message <[hidden email]> on Wed, 15 Jun 2005 18:38:27 +0900 (JST), GOTOU Yuuzou <[hidden email]> said:
> gotoyuzo> It may be an issue of NetBSD, but "#undef _XOPEN_SOURCE"
> gotoyuzo> seems a little wrong too.
>
> Does it work if I remove the #undef _XOPEN_SOURCE?  I had it there for
> paranoid reasons, and it may not be needed.

Yes. Make test passed.

--
gotoyuzo
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: ssl/kssl.c fails on NetBSD

Richard Levitte - VMS Whacker
In message <[hidden email]> on Thu, 16 Jun 2005 14:41:03 +0900 (JST), GOTOU Yuuzou <[hidden email]> said:

gotoyuzo> In message <[hidden email]>,
gotoyuzo>  `Richard Levitte - VMS Whacker <[hidden email]>' wrote:
gotoyuzo> > In message <[hidden email]> on Wed, 15 Jun 2005 18:38:27 +0900 (JST), GOTOU Yuuzou <[hidden email]> said:
gotoyuzo> > gotoyuzo> It may be an issue of NetBSD, but "#undef _XOPEN_SOURCE"
gotoyuzo> > gotoyuzo> seems a little wrong too.
gotoyuzo> >
gotoyuzo> > Does it work if I remove the #undef _XOPEN_SOURCE?  I had
gotoyuzo> > it there for paranoid reasons, and it may not be needed.
gotoyuzo>
gotoyuzo> Yes. Make test passed.

OK, I'll try that then.

Cheers,
Richard

-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

--
Richard Levitte                         [hidden email]
                                        http://richard.levitte.org/

"When I became a man I put away childish things, including
 the fear of childishness and the desire to be very grown up."
                                                -- C.S. Lewis
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]