Here's the rollup patch that makes -ansi work. Most of it was "inline"
-> "ossl_inline". Some hoops were jumped through to get SSIZE_MAX
defined correctly.

To configure:

    ./config shared no-asm -ansi -D_DEFAULT_SOURCE=__STRICT_ANSI__

I'm not sure if Configure should set
_DEFAULT_SOURCE=__STRICT_ANSI__automatically.

****

$ git diff > ansi.patch
$ cat ansi.patch
diff --git a/crypto/async/arch/async_posix.h b/crypto/async/arch/async_posix.h
index de80f95..968358f 100644
--- a/crypto/async/arch/async_posix.h
+++ b/crypto/async/arch/async_posix.h
@@ -74,7 +74,7 @@ typedef struct async_fibre_st {
     int env_init;
 } async_fibre;

-static inline int async_fibre_swapcontext(async_fibre *o, async_fibre
*n, int r)
+static ossl_inline int async_fibre_swapcontext(async_fibre *o,
async_fibre *n, int r)
 {
     o->env_init = 1;

diff --git a/engines/afalg/e_afalg.c b/engines/afalg/e_afalg.c
index 3ccf9d5..1914be5 100644
--- a/engines/afalg/e_afalg.c
+++ b/engines/afalg/e_afalg.c
@@ -136,27 +136,27 @@ static int afalg_cipher_nids[] = {

 static EVP_CIPHER *_hidden_aes_128_cbc = NULL;

-static inline int io_setup(unsigned n, aio_context_t *ctx)
+static ossl_inline int io_setup(unsigned n, aio_context_t *ctx)
 {
     return syscall(__NR_io_setup, n, ctx);
 }

-static inline int eventfd(int n)
+static ossl_inline int eventfd(int n)
 {
     return syscall(__NR_eventfd, n);
 }

-static inline int io_destroy(aio_context_t ctx)
+static ossl_inline int io_destroy(aio_context_t ctx)
 {
     return syscall(__NR_io_destroy, ctx);
 }

-static inline int io_read(aio_context_t ctx, long n, struct iocb **iocb)
+static ossl_inline int io_read(aio_context_t ctx, long n, struct iocb **iocb)
 {
     return syscall(__NR_io_submit, ctx, n, iocb);
 }

-static inline int io_getevents(aio_context_t ctx, long min, long max,
+static ossl_inline int io_getevents(aio_context_t ctx, long min, long max,
                                struct io_event *events,
                                struct timespec *timeout)
 {
@@ -272,7 +272,7 @@ int afalg_fin_cipher_aio(afalg_aio *aio, int sfd,
unsigned char *buf,
     memset(cb, '\0', sizeof(*cb));
     cb->aio_fildes = sfd;
     cb->aio_lio_opcode = IOCB_CMD_PREAD;
-    cb->aio_buf = (unsigned long)buf;
+    cb->aio_buf = (uint64_t)buf;
     cb->aio_offset = 0;
     cb->aio_data = 0;
     cb->aio_nbytes = len;
@@ -352,7 +352,7 @@ int afalg_fin_cipher_aio(afalg_aio *aio, int sfd,
unsigned char *buf,
     return 1;
 }

-static inline void afalg_set_op_sk(struct cmsghdr *cmsg,
+static ossl_inline void afalg_set_op_sk(struct cmsghdr *cmsg,
                                    const unsigned int op)
 {
     cmsg->cmsg_level = SOL_ALG;
@@ -374,7 +374,7 @@ static void afalg_set_iv_sk(struct cmsghdr *cmsg,
const unsigned char *iv,
     memcpy(aiv->iv, iv, len);
 }

-static inline int afalg_set_key(afalg_ctx *actx, const unsigned char *key,
+static ossl_inline int afalg_set_key(afalg_ctx *actx, const unsigned char *key,
                                 const int klen)
 {
     int ret;
diff --git a/include/openssl/e_os2.h b/include/openssl/e_os2.h
index bbd6116..73058c0 100644
--- a/include/openssl/e_os2.h
+++ b/include/openssl/e_os2.h
@@ -264,7 +264,15 @@ extern "C" {

 # ifndef ossl_ssize_t
 #  define ossl_ssize_t ssize_t
-#  define OSSL_SSIZE_MAX SSIZE_MAX
+#  if defined(SSIZE_MAX)
+#   define OSSL_SSIZE_MAX SSIZE_MAX
+#  elif defined(_POSIX_SSIZE_MAX)
+#   define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX
+#  elif (__WORDSIZE == 64)
+#   define OSSL_SSIZE_MAX LONG_MAX
+#  elif(__WORDSIZE == 32)
+#   define OSSL_SSIZE_MAX INT_MAX
+#  endif
 # endif

 # ifdef DEBUG_UNUSED
diff --git a/test/ssltest.c b/test/ssltest.c
index a2dd445..6c1575c 100644
--- a/test/ssltest.c
+++ b/test/ssltest.c
@@ -140,8 +140,12 @@
  */

 /* Or gethostname won't be declared properly on Linux and GNU platforms. */
-#define _BSD_SOURCE 1
-#define _DEFAULT_SOURCE 1
+#ifndef _BSD_SOURCE
+# define _BSD_SOURCE 1
+#endif
+#ifndef _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE 1
+#endif

 #include <assert.h>
 #include <errno.h>

-- 
Ticket here: http://rt.openssl.org/Ticket/Display.html?id=4480
Please log in as guest with password guest if prompted

diff --git a/crypto/async/arch/async_posix.h b/crypto/async/arch/async_posix.h
index de80f95..968358f 100644
--- a/crypto/async/arch/async_posix.h
+++ b/crypto/async/arch/async_posix.h
@@ -74,7 +74,7 @@ typedef struct async_fibre_st {
     int env_init;
 } async_fibre;
 
-static inline int async_fibre_swapcontext(async_fibre *o, async_fibre *n, int r)
+static ossl_inline int async_fibre_swapcontext(async_fibre *o, async_fibre *n, int r)
 {
     o->env_init = 1;
 
diff --git a/engines/afalg/e_afalg.c b/engines/afalg/e_afalg.c
index 3ccf9d5..1914be5 100644
--- a/engines/afalg/e_afalg.c
+++ b/engines/afalg/e_afalg.c
@@ -136,27 +136,27 @@ static int afalg_cipher_nids[] = {
 
 static EVP_CIPHER *_hidden_aes_128_cbc = NULL;
 
-static inline int io_setup(unsigned n, aio_context_t *ctx)
+static ossl_inline int io_setup(unsigned n, aio_context_t *ctx)
 {
     return syscall(__NR_io_setup, n, ctx);
 }
 
-static inline int eventfd(int n)
+static ossl_inline int eventfd(int n)
 {
     return syscall(__NR_eventfd, n);
 }
 
-static inline int io_destroy(aio_context_t ctx)
+static ossl_inline int io_destroy(aio_context_t ctx)
 {
     return syscall(__NR_io_destroy, ctx);
 }
 
-static inline int io_read(aio_context_t ctx, long n, struct iocb **iocb)
+static ossl_inline int io_read(aio_context_t ctx, long n, struct iocb **iocb)
 {
     return syscall(__NR_io_submit, ctx, n, iocb);
 }
 
-static inline int io_getevents(aio_context_t ctx, long min, long max,
+static ossl_inline int io_getevents(aio_context_t ctx, long min, long max,
                                struct io_event *events,
                                struct timespec *timeout)
 {
@@ -272,7 +272,7 @@ int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf,
     memset(cb, '\0', sizeof(*cb));
     cb->aio_fildes = sfd;
     cb->aio_lio_opcode = IOCB_CMD_PREAD;
-    cb->aio_buf = (unsigned long)buf;
+    cb->aio_buf = (uint64_t)buf;
     cb->aio_offset = 0;
     cb->aio_data = 0;
     cb->aio_nbytes = len;
@@ -352,7 +352,7 @@ int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf,
     return 1;
 }
 
-static inline void afalg_set_op_sk(struct cmsghdr *cmsg,
+static ossl_inline void afalg_set_op_sk(struct cmsghdr *cmsg,
                                    const unsigned int op)
 {
     cmsg->cmsg_level = SOL_ALG;
@@ -374,7 +374,7 @@ static void afalg_set_iv_sk(struct cmsghdr *cmsg, const unsigned char *iv,
     memcpy(aiv->iv, iv, len);
 }
 
-static inline int afalg_set_key(afalg_ctx *actx, const unsigned char *key,
+static ossl_inline int afalg_set_key(afalg_ctx *actx, const unsigned char *key,
                                 const int klen)
 {
     int ret;
diff --git a/include/openssl/e_os2.h b/include/openssl/e_os2.h
index bbd6116..73058c0 100644
--- a/include/openssl/e_os2.h
+++ b/include/openssl/e_os2.h
@@ -264,7 +264,15 @@ extern "C" {
 
 # ifndef ossl_ssize_t
 #  define ossl_ssize_t ssize_t
-#  define OSSL_SSIZE_MAX SSIZE_MAX
+#  if defined(SSIZE_MAX)
+#   define OSSL_SSIZE_MAX SSIZE_MAX
+#  elif defined(_POSIX_SSIZE_MAX)
+#   define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX
+#  elif (__WORDSIZE == 64)
+#   define OSSL_SSIZE_MAX LONG_MAX
+#  elif(__WORDSIZE == 32)
+#   define OSSL_SSIZE_MAX INT_MAX
+#  endif
 # endif
 
 # ifdef DEBUG_UNUSED
diff --git a/test/ssltest.c b/test/ssltest.c
index a2dd445..6c1575c 100644
--- a/test/ssltest.c
+++ b/test/ssltest.c
@@ -140,8 +140,12 @@
  */
 
 /* Or gethostname won't be declared properly on Linux and GNU platforms. */
-#define _BSD_SOURCE 1
-#define _DEFAULT_SOURCE 1
+#ifndef _BSD_SOURCE
+# define _BSD_SOURCE 1
+#endif
+#ifndef _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE 1
+#endif
 
 #include <assert.h>
 #include <errno.h>
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

Reply via email to