Fix standalone build on Mac.

CRYPTO_MUTEX was the wrong size. Fortunately, Apple was kind enough to define
pthread_rwlock_t unconditionally, so we can be spared fighting with feature
macros. Some of the stdlib.h removals were wrong and clang is pick about
multiply-defined typedefs. Apparently that's a C11 thing?

BUG=478598

Change-Id: Ibdcb8de9e5d83ca28e4c55b2979177d1ef0f9721
Reviewed-on: https://boringssl-review.googlesource.com/4404
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-04-20 11:32:12 -04:00 committed by Adam Langley
parent caf6b09598
commit f0df86a1f6
5 changed files with 9 additions and 6 deletions

View File

@ -81,8 +81,6 @@ extern "C" {
/* Use default functions for poin2oct, oct2point and compressed coordinates */
#define EC_FLAGS_DEFAULT_OCT 0x1
typedef struct ec_method_st EC_METHOD;
struct ec_method_st {
/* Various method flags */
int flags;

View File

@ -132,6 +132,9 @@ extern "C" {
#endif /* defined(BORINGSSL_SHARED_LIBRARY) */
/* CRYPTO_THREADID is a dummy value. */
typedef int CRYPTO_THREADID;
typedef int ASN1_BOOLEAN;
typedef int ASN1_NULL;
typedef struct ASN1_ITEM_st ASN1_ITEM;
@ -176,7 +179,6 @@ typedef struct cbb_st CBB;
typedef struct cbs_st CBS;
typedef struct conf_st CONF;
typedef struct conf_value_st CONF_VALUE;
typedef int CRYPTO_THREADID;
typedef struct dh_method DH_METHOD;
typedef struct dh_st DH;
typedef struct dsa_method DSA_METHOD;

View File

@ -57,6 +57,8 @@
#ifndef OPENSSL_HEADER_THREAD_H
#define OPENSSL_HEADER_THREAD_H
#include <sys/types.h>
#include <openssl/base.h>
#if defined(__cplusplus)
@ -72,6 +74,8 @@ typedef union crypto_mutex_st {
double alignment;
uint8_t padding[4*sizeof(void*) + 2*sizeof(int)];
} CRYPTO_MUTEX;
#elif defined(__MACH__) && defined(__APPLE__)
typedef pthread_rwlock_t CRYPTO_MUTEX;
#else
/* It is reasonable to include pthread.h on non-Windows systems, however the
* |pthread_rwlock_t| that we need is hidden under feature flags, and we can't
@ -133,9 +137,6 @@ OPENSSL_EXPORT const char *CRYPTO_get_lock_name(int lock_num);
/* Deprecated functions */
/* CRYPTO_THREADID is a dummy value. */
typedef int CRYPTO_THREADID;
/* CRYPTO_THREADID_set_callback does nothing. */
OPENSSL_EXPORT int CRYPTO_THREADID_set_callback(
void (*threadid_func)(CRYPTO_THREADID *threadid));

View File

@ -16,6 +16,7 @@
#include <vector>
#include <stdint.h>
#include <stdlib.h>
#include <openssl/rand.h>

View File

@ -19,6 +19,7 @@
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>