00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef MBEDTLS_TIMING_H
00025 #define MBEDTLS_TIMING_H
00026
00027 #if !defined(MBEDTLS_CONFIG_FILE)
00028 #include "config.h"
00029 #else
00030 #include MBEDTLS_CONFIG_FILE
00031 #endif
00032
00033 #if !defined(MBEDTLS_TIMING_ALT)
00034
00035
00036
00037 #include <stdint.h>
00038
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042
00046 struct mbedtls_timing_hr_time
00047 {
00048 unsigned char opaque[32];
00049 };
00050
00054 typedef struct
00055 {
00056 struct mbedtls_timing_hr_time timer;
00057 uint32_t int_ms;
00058 uint32_t fin_ms;
00059 } mbedtls_timing_delay_context;
00060
00061 extern volatile int mbedtls_timing_alarmed;
00062
00073 unsigned long mbedtls_timing_hardclock( void );
00074
00092 unsigned long mbedtls_timing_get_timer( struct mbedtls_timing_hr_time *val, int reset );
00093
00104 void mbedtls_set_alarm( int seconds );
00105
00120 void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms );
00121
00134 int mbedtls_timing_get_delay( void *data );
00135
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139
00140 #else
00141 #include "timing_alt.h"
00142 #endif
00143
00144 #ifdef __cplusplus
00145 extern "C" {
00146 #endif
00147
00148 #if defined(MBEDTLS_SELF_TEST)
00149
00154 int mbedtls_timing_self_test( int verbose );
00155 #endif
00156
00157 #ifdef __cplusplus
00158 }
00159 #endif
00160
00161 #endif