From c78c8422c25b9dc38f09eded3200d565375522e2 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Tue, 31 Dec 2013 11:55:27 +0100 Subject: [PATCH] Added failure stub for uninitialized POLARSSL_THREADING_ALT functions --- library/threading.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/library/threading.c b/library/threading.c index 9ee6aea3f..744fe27fa 100644 --- a/library/threading.c +++ b/library/threading.c @@ -81,10 +81,16 @@ int (*polarssl_mutex_unlock)( threading_mutex_t * ) = threading_mutex_unlock_pth #endif /* POLARSSL_THREADING_PTHREAD */ #if defined(POLARSSL_THREADING_ALT) -int (*polarssl_mutex_init)( threading_mutex_t * ) = NULL; -int (*polarssl_mutex_free)( threading_mutex_t * ) = NULL; -int (*polarssl_mutex_lock)( threading_mutex_t * ) = NULL; -int (*polarssl_mutex_unlock)( threading_mutex_t * ) = NULL; +static int threading_mutex_fail( threading_mutex_t *mutex ) +{ + ((void) mutex ); + return( POLARSSL_ERR_THREADING_BAD_INPUT_DATA ); +} + +int (*polarssl_mutex_init)( threading_mutex_t * ) = threading_mutex_fail; +int (*polarssl_mutex_free)( threading_mutex_t * ) = threading_mutex_fail; +int (*polarssl_mutex_lock)( threading_mutex_t * ) = threading_mutex_fail; +int (*polarssl_mutex_unlock)( threading_mutex_t * ) = threading_mutex_fail; int threading_set_alt( int (*mutex_init)( threading_mutex_t * ), int (*mutex_free)( threading_mutex_t * ),