[openssl-dev] [openssl.org #4479] ROLLUP PATCH: OS X 10.8 (x86_64): Compile errors when using "no-asm -ansi"

noloader@gmail.com via RT rt at openssl.org
Fri Mar 25 16:31:14 UTC 2016


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.
Drepper signed-off on roughly the same fix about 15 years ago for
glibc; see http://sourceware.org/ml/libc-hacker/2002-08/msg00031.html.

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.

Its the same patch as for Issue 4480. The patch can be applied with
'patch -p1 < ansi.patch'.

Tested OK on OS X 64-bit, OS X 32-bit, Linux x86_64, Linux i686, ARM32
and ARM64.

----------

$ 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=4479
Please log in as guest with password guest if prompted

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ansi.patch
Type: text/x-diff
Size: 3700 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-dev/attachments/20160325/d7a2f5c2/attachment-0001.patch>


More information about the openssl-dev mailing list