00001 00023 #ifndef MBEDTLS_TIMING_H 00024 #define MBEDTLS_TIMING_H 00025 00026 #if !defined(MBEDTLS_CONFIG_FILE) 00027 #include "config.h" 00028 #else 00029 #include MBEDTLS_CONFIG_FILE 00030 #endif 00031 00032 #if !defined(MBEDTLS_TIMING_ALT) 00033 // Regular implementation 00034 // 00035 00036 #include <stdint.h> 00037 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00045 struct mbedtls_timing_hr_time 00046 { 00047 unsigned char opaque[32]; 00048 }; 00049 00053 typedef struct 00054 { 00055 struct mbedtls_timing_hr_time timer; 00056 uint32_t int_ms; 00057 uint32_t fin_ms; 00058 } mbedtls_timing_delay_context; 00059 00060 extern volatile int mbedtls_timing_alarmed; 00061 00069 unsigned long mbedtls_timing_hardclock( void ); 00070 00077 unsigned long mbedtls_timing_get_timer( struct mbedtls_timing_hr_time *val, int reset ); 00078 00088 void mbedtls_set_alarm( int seconds ); 00089 00100 void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms ); 00101 00114 int mbedtls_timing_get_delay( void *data ); 00115 00116 #ifdef __cplusplus 00117 } 00118 #endif 00119 00120 #else /* MBEDTLS_TIMING_ALT */ 00121 #include "timing_alt.h" 00122 #endif /* MBEDTLS_TIMING_ALT */ 00123 00124 #ifdef __cplusplus 00125 extern "C" { 00126 #endif 00127 00128 #if defined(MBEDTLS_SELF_TEST) 00129 00134 int mbedtls_timing_self_test( int verbose ); 00135 #endif 00136 00137 #ifdef __cplusplus 00138 } 00139 #endif 00140 00141 #endif /* timing.h */