From bb8661e0066fddaf9a161091ad7a012cd60c31bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 14 Mar 2014 09:21:20 +0100 Subject: [PATCH] Work around a compiler bug on OS X. --- ChangeLog | 2 ++ library/bignum.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a2505aaf3..e6f167993 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ Changes * entropy_add_source(), entropy_update_manual() and entropy_gather() now thread-safe if POLARSSL_THREADING_C defined * Improvements to the CMake build system, contributed by Julian Ospald. + * Work around a bug of the version of Clang shipped by Apple with Mavericks + that prevented bignum.c from compiling. (Reported by Rafael Baptista.) Security * Forbid change of server certificate during renegotiation to prevent diff --git a/library/bignum.c b/library/bignum.c index a73bf7665..d9a22c1dd 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -1232,7 +1232,14 @@ int mpi_div_mpi( mpi *Q, mpi *R, const mpi *A, const mpi *B ) Z.p[i - t - 1] = ~0; else { -#if defined(POLARSSL_HAVE_UDBL) + /* + * The version of Clang shipped by Apple with Mavericks can't + * handle 128-bit division properly. Disable 128-bits division + * for Clang on Apple for now, while waiting for more input on the + * exact version(s) affected and their identification macros. + */ +#if defined(POLARSSL_HAVE_UDBL) && \ + ! ( defined(__x86_64__) && defined(__clang__) && defined(__APPLE__) ) t_udbl r; r = (t_udbl) X.p[i] << biL;