File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2845,6 +2845,11 @@ int wolfSSL_HwPkMutexUnLock(void)
28452845 int wc_InitMutex (wolfSSL_Mutex * m )
28462846 {
28472847 int i ;
2848+
2849+ if (!osKernelRunning ()) {
2850+ return 0 ;
2851+ }
2852+
28482853 for (i = 0 ; i < CMSIS_NMUTEX ; i ++ ) {
28492854 if (CMSIS_mutexID [i ] == 0 ) {
28502855 CMSIS_mutexID [i ] = osMutexCreate (CMSIS_mutex [i ]);
@@ -2858,6 +2863,11 @@ int wolfSSL_HwPkMutexUnLock(void)
28582863 int wc_FreeMutex (wolfSSL_Mutex * m )
28592864 {
28602865 int i ;
2866+
2867+ if (!osKernelRunning ()) {
2868+ return 0 ;
2869+ }
2870+
28612871 osMutexDelete (* m );
28622872 for (i = 0 ; i < CMSIS_NMUTEX ; i ++ ) {
28632873 if (CMSIS_mutexID [i ] == (* m )) {
@@ -2870,13 +2880,17 @@ int wolfSSL_HwPkMutexUnLock(void)
28702880
28712881 int wc_LockMutex (wolfSSL_Mutex * m )
28722882 {
2873- osMutexWait (* m , osWaitForever );
2883+ if (osKernelRunning ()) {
2884+ osMutexWait (* m , osWaitForever );
2885+ }
28742886 return (0 );
28752887 }
28762888
28772889 int wc_UnLockMutex (wolfSSL_Mutex * m )
28782890 {
2879- osMutexRelease (* m );
2891+ if (osKernelRunning ()) {
2892+ osMutexRelease (* m );
2893+ }
28802894 return 0 ;
28812895 }
28822896
You can’t perform that action at this time.
0 commit comments