mbed TLS v2.2.0
timing.h
Go to the documentation of this file.
1 
23 #ifndef MBEDTLS_TIMING_H
24 #define MBEDTLS_TIMING_H
25 
26 #if !defined(MBEDTLS_CONFIG_FILE)
27 #include "config.h"
28 #else
29 #include MBEDTLS_CONFIG_FILE
30 #endif
31 
32 #if !defined(MBEDTLS_TIMING_ALT)
33 // Regular implementation
34 //
35 
36 #include <stdint.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
46 {
47  unsigned char opaque[32];
48 };
49 
53 typedef struct
54 {
55  struct mbedtls_timing_hr_time timer;
56  uint32_t int_ms;
57  uint32_t fin_ms;
59 
60 extern volatile int mbedtls_timing_alarmed;
61 
69 unsigned long mbedtls_timing_hardclock( void );
70 
77 unsigned long mbedtls_timing_get_timer( struct mbedtls_timing_hr_time *val, int reset );
78 
88 void mbedtls_set_alarm( int seconds );
89 
100 void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms );
101 
114 int mbedtls_timing_get_delay( void *data );
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #else /* MBEDTLS_TIMING_ALT */
121 #include "timing_alt.h"
122 #endif /* MBEDTLS_TIMING_ALT */
123 
124 #ifdef __cplusplus
125 extern "C" {
126 #endif
127 
128 #if defined(MBEDTLS_SELF_TEST)
129 
134 int mbedtls_timing_self_test( int verbose );
135 #endif
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif /* timing.h */
unsigned long mbedtls_timing_hardclock(void)
Return the CPU cycle counter value.
unsigned char opaque[32]
Definition: timing.h:47
Compatibility names (set of defines)
void mbedtls_timing_set_delay(void *data, uint32_t int_ms, uint32_t fin_ms)
Set a pair of delays to watch (See mbedtls_timing_get_delay().)
Portable interface to the CPU cycle counter.
Context for mbedtls_timing_set/get_delay()
Definition: timing.h:53
volatile int mbedtls_timing_alarmed
void mbedtls_set_alarm(int seconds)
Setup an alarm clock.
unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset)
Return the elapsed time in milliseconds.
timer structure
Definition: timing.h:45
int mbedtls_timing_get_delay(void *data)
Get the status of delays (Memory helper: number of delays passed.)