Browse Source

linuxkm: tweak setup of wolfSSL_Mutex to assure complete type availability in applications (client modules).

Daniel Pouzzner 1 year ago
parent
commit
a22da10956
2 changed files with 7 additions and 4 deletions
  1. 7 2
      linuxkm/linuxkm_wc_port.h
  2. 0 2
      wolfssl/wolfcrypt/wc_port.h

+ 7 - 2
linuxkm/linuxkm_wc_port.h

@@ -61,8 +61,6 @@
 
     #define WOLFSSL_KTHREADS
 
-    typedef struct mutex wolfSSL_Mutex;
-
     #ifdef BUILDING_WOLFSSL
 
     #if defined(CONFIG_MIPS) && defined(HAVE_LINUXKM_PIE_SUPPORT)
@@ -578,6 +576,13 @@
 
     #endif /* BUILDING_WOLFSSL */
 
+    /* if BUILDING_WOLFSSL, mutex.h will have already been included recursively
+     * above, with the bevy of warnings suppressed, and the below include will
+     * be a redundant no-op.
+     */
+    #include <linux/mutex.h>
+    typedef struct mutex wolfSSL_Mutex;
+
     #define XMALLOC(s, h, t)     ({(void)(h); (void)(t); kmalloc(s, GFP_KERNEL);})
     #define XFREE(p, h, t)       ({void* _xp; (void)(h); _xp = (p); if(_xp) kfree(_xp);})
     #define XREALLOC(p, n, h, t) ({(void)(h); (void)(t); krealloc((p), (n), GFP_KERNEL);})

+ 0 - 2
wolfssl/wolfcrypt/wc_port.h

@@ -219,8 +219,6 @@
         typedef CRITICAL_SECTION wolfSSL_Mutex;
     #elif defined(WOLFSSL_PTHREADS)
         typedef pthread_mutex_t wolfSSL_Mutex;
-    #elif defined(WOLFSSL_KTHREADS)
-        typedef struct mutex wolfSSL_Mutex;
     #elif defined(THREADX)
         typedef TX_MUTEX wolfSSL_Mutex;
     #elif defined(WOLFSSL_DEOS)