21 static KERNEL_DATA krnlDataBlock = { 0 }, *krnlData;
46 THREADFUNC_DEFINE( threadServiceFunction, threadInfoPtr )
53 assert( threadServiceFunction != NULL );
79 ( threadState == NULL ) ? &krnlData->threadInfo : \
84 assert( threadState == NULL || \
88 "Thread storage size" );
153 #if defined( __WIN32__ ) || defined( __WINCE__ )
161 #elif defined( __GNUC__ ) && defined( __PIC__ ) && defined( USE_THREADS )
168 void preInit(
void ) __attribute__ ((constructor));
169 void postShutdown(
void ) __attribute__ ((destructor));
170 #elif defined( __SUNPRO_C ) && ( __SUNPRO_C >= 0x570 )
175 #pragma init ( preInit )
176 #pragma fini ( postShutdown )
177 #elif defined( __PALMOS__ )
211 krnlData = &krnlDataBlock;
229 void postShutdown(
void )
256 krnlData = &krnlDataBlock;
274 #ifndef USE_EMBEDDED_OS
283 DEBUG_PRINT((
"System time is severely messed up, cannot continue "
284 "without a correctly set system clock" ));
299 status = initAllocation( krnlData );
301 status = initAttributeACL( krnlData );
303 status = initCertMgmtACL( krnlData );
305 status = initInternalMsgs( krnlData );
307 status = initKeymgmtACL( krnlData );
309 status = initMechanismACL( krnlData );
311 status = initMessageACL( krnlData );
313 status = initObjects( krnlData );
315 status = initObjectAltAccess( krnlData );
317 status = initSemaphores( krnlData );
319 status = initSendMessage( krnlData );
453 #if defined( INC_ALL )
460 static
BOOLEAN testGeneralAlgorithms(
void )
642 BYTE buffer[ 16 + 8 ];
651 memset( buffer, 0, 16 );
711 #ifdef USE_CERTIFICATES
781 timeVal =
roundUp( timeVal, 0x10000000L );
795 BYTE buffer[ 16 + 8 ];
803 memset( buffer, 0, 16 );
869 value = CRYPT_CERTINFO_FIRST_EXTENSION - 1;
873 value = CRYPT_CERTINFO_FIRST_EXTENSION;
877 value = CRYPT_CERTINFO_LAST_EXTENSION;
881 value = CRYPT_CERTINFO_LAST_EXTENSION + 1;
891 static
BOOLEAN testKernelMechanisms(
void )
896 static const BYTE FAR_BSS key[] = { 0x10, 0x46, 0x91, 0x34, 0x89, 0x98, 0x01, 0x31 };
897 BYTE buffer[ 128 + 8 ];
906 DEBUG_DIAG((
"Object creation self-test failed" ));
922 DEBUG_DIAG((
"Object internal/external self-test failed" ));
929 memset( buffer, 0, 16 );
936 DEBUG_DIAG((
"Object low/high state self-test failed" ));
942 if( !checkNumericRange( iCryptHandle ) )
945 DEBUG_DIAG((
"Kernel numeric range checking self-test failed" ));
951 if( !checkStringRange( iCryptHandle ) )
954 DEBUG_DIAG((
"Kernel string range checking self-test failed" ));
965 DEBUG_DIAG((
"Object state transition self-test failed" ));
981 DEBUG_DIAG((
"Attribute read/write self-test failed" ));
994 DEBUG_DIAG((
"Object state access self-test failed" ));
1009 memset( buffer, 0, 16 );
1011 CRYPT_IATTRIBUTE_ACTIONPERMS );
1020 DEBUG_DIAG((
"Object internal/external action self-test failed" ));
1027 DEBUG_DIAG((
"Object internal/external action self-test failed" ));
1036 if( !checkUsageCount( iCryptHandle ) )
1039 DEBUG_DIAG((
"Object usage-count self-test failed" ));
1045 if( !checkLocking( iCryptHandle ) )
1048 DEBUG_DIAG((
"Object locking self-test failed" ));
1059 #ifdef USE_CERTIFICATES
1067 DEBUG_DIAG((
"Certificate object creation self-test failed" ));
1074 if( !checkBooleanRange( iCryptHandle ) )
1077 DEBUG_DIAG((
"Kernel boolean range checking self-test failed" ));
1083 if( !checkTimeRange( iCryptHandle ) )
1086 DEBUG_DIAG((
"Kernel time range checking self-test failed" ));
1092 if( !checkAllowedValuesRange( iCryptHandle ) )
1095 DEBUG_DIAG((
"Kernel allowed-values range checking self-test failed" ));
1101 if( !checkSubrangeRange( iCryptHandle ) )
1104 DEBUG_DIAG((
"Kernel subranges range checking self-test failed" ));
1116 ENSURES( testGeneralAlgorithms() );
1117 ENSURES( testKernelMechanisms() );