static int selfTest( void ) { /* Check the 3DES test vectors. Note that we don't perform the RS test, since it's valid only for single DES */ if( ( testLoop( testIP, sizeof( testIP ) / sizeof( DES_TEST ) ) != CRYPT_OK ) || \ ( testLoop( testVP, sizeof( testVP ) / sizeof( DES_TEST ) ) != CRYPT_OK ) || \ ( testLoop( testKP, sizeof( testKP ) / sizeof( DES_TEST ) ) != CRYPT_OK ) || \ ( testLoop( testDP, sizeof( testDP ) / sizeof( DES_TEST ) ) != CRYPT_OK ) || \ ( testLoop( testSB, sizeof( testSB ) / sizeof( DES_TEST ) ) != CRYPT_OK ) ) return( CRYPT_ERROR_FAILED ); return( CRYPT_OK ); }
void main() { u8 cur_detect_pos=1; OSCCR = 0x20; // internal OSC 8MHz BITCR = 0x2E; // BIT 16.384ms delay_ms(16); LVRCR = 0x02; // builtin reset 2.0V set, LVRCR.0=0 enable !!! InitConfig(); WDTDR = 0xFF; ClrWdt(); //timer0 as system tick T0DR = 38; T0CR = 0x8D; //ADC ADCCRH = 0x07; ADCCRL = 0x90; //interrupt IE = 0x20; IE1 = 0x00; IE2 = 0x02; //enable timer0 overflow IE3 = 0x00; EIPOL0L = 0x00; EIFLAG0 = 0; EIFLAG1 = 0; IIFLAG = 0; IE |= (1<<7); //global interrupt // LED1_G_ON();delay_ms(500); // LED1_G_OFF(); #ifdef IO_DEBUG led_test(); #endif if(GET_BATTERY_STATUS()) // AA battery status { gTestMode = TEST_AA_BATTERY; } else { gTestMode = TEST_AAA_BATTERY; } testLoop(); while(1) { ClrWdt(); NOP(); } }