Mbed TLS v2.28.5
timing.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright The Mbed TLS Contributors
8  * SPDX-License-Identifier: Apache-2.0
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License"); you may
11  * not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 #ifndef MBEDTLS_TIMING_H
23 #define MBEDTLS_TIMING_H
24 
25 #if !defined(MBEDTLS_CONFIG_FILE)
26 #include "mbedtls/config.h"
27 #else
28 #include MBEDTLS_CONFIG_FILE
29 #endif
30 
31 #include <stdint.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #if !defined(MBEDTLS_TIMING_ALT)
38 // Regular implementation
39 //
40 
45  unsigned char opaque[32];
46 };
47 
53  uint32_t int_ms;
54  uint32_t fin_ms;
56 
57 #else /* MBEDTLS_TIMING_ALT */
58 #include "timing_alt.h"
59 #endif /* MBEDTLS_TIMING_ALT */
60 
61 extern volatile int mbedtls_timing_alarmed;
62 
73 unsigned long mbedtls_timing_hardclock(void);
74 
92 unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset);
93 
104 void mbedtls_set_alarm(int seconds);
105 
120 void mbedtls_timing_set_delay(void *data, uint32_t int_ms, uint32_t fin_ms);
121 
134 int mbedtls_timing_get_delay(void *data);
135 
136 #if defined(MBEDTLS_SELF_TEST)
137 
142 int mbedtls_timing_self_test(int verbose);
143 #endif
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif /* timing.h */
unsigned long mbedtls_timing_hardclock(void)
Return the CPU cycle counter value.
unsigned char opaque[32]
Definition: timing.h:45
struct mbedtls_timing_delay_context mbedtls_timing_delay_context
Context for mbedtls_timing_set/get_delay()
Configuration options (set of defines)
struct mbedtls_timing_hr_time timer
Definition: timing.h:52
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().)
Context for mbedtls_timing_set/get_delay()
Definition: timing.h:51
volatile int mbedtls_timing_alarmed
void mbedtls_set_alarm(int seconds)
Setup an alarm clock.
int mbedtls_timing_self_test(int verbose)
Checkup routine.
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:44
int mbedtls_timing_get_delay(void *data)
Get the status of delays (Memory helper: number of delays passed.)