Mbed TLS v3.6.7
Toggle main menu visibility
Loading...
Searching...
No Matches
platform_util.h
Go to the documentation of this file.
1
7
/*
8
* Copyright The Mbed TLS Contributors
9
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
10
*/
11
#ifndef MBEDTLS_PLATFORM_UTIL_H
12
#define MBEDTLS_PLATFORM_UTIL_H
13
14
#include "
mbedtls/build_info.h
"
15
16
#include <stddef.h>
17
#if defined(MBEDTLS_HAVE_TIME_DATE)
18
#include "
mbedtls/platform_time.h
"
19
#include <time.h>
20
#endif
/* MBEDTLS_HAVE_TIME_DATE */
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
/* Internal helper macros for deprecating API constants. */
27
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
28
#if defined(MBEDTLS_DEPRECATED_WARNING)
29
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
30
MBEDTLS_DEPRECATED
typedef
char
const
*mbedtls_deprecated_string_constant_t;
31
#define MBEDTLS_DEPRECATED_STRING_CONSTANT(VAL) \
32
((mbedtls_deprecated_string_constant_t) (VAL))
33
MBEDTLS_DEPRECATED
typedef
int
mbedtls_deprecated_numeric_constant_t;
34
#define MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(VAL) \
35
((mbedtls_deprecated_numeric_constant_t) (VAL))
36
#else
/* MBEDTLS_DEPRECATED_WARNING */
37
#define MBEDTLS_DEPRECATED
38
#define MBEDTLS_DEPRECATED_STRING_CONSTANT(VAL) VAL
39
#define MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(VAL) VAL
40
#endif
/* MBEDTLS_DEPRECATED_WARNING */
41
#endif
/* MBEDTLS_DEPRECATED_REMOVED */
42
43
/* Implementation of the check-return facility.
44
* See the user documentation in mbedtls_config.h.
45
*
46
* Do not use this macro directly to annotate function: instead,
47
* use one of MBEDTLS_CHECK_RETURN_CRITICAL or MBEDTLS_CHECK_RETURN_TYPICAL
48
* depending on how important it is to check the return value.
49
*/
50
#if !defined(MBEDTLS_CHECK_RETURN)
51
#if defined(__GNUC__)
52
#define MBEDTLS_CHECK_RETURN __attribute__((__warn_unused_result__))
53
#elif defined(_MSC_VER) && _MSC_VER >= 1700
54
#include <sal.h>
55
#define MBEDTLS_CHECK_RETURN _Check_return_
56
#else
57
#define MBEDTLS_CHECK_RETURN
58
#endif
59
#endif
60
77
#define MBEDTLS_CHECK_RETURN_CRITICAL MBEDTLS_CHECK_RETURN
78
96
#if defined(MBEDTLS_CHECK_RETURN_WARNING)
97
#define MBEDTLS_CHECK_RETURN_TYPICAL MBEDTLS_CHECK_RETURN
98
#else
99
#define MBEDTLS_CHECK_RETURN_TYPICAL
100
#endif
101
113
#define MBEDTLS_CHECK_RETURN_OPTIONAL
114
120
#if !defined(MBEDTLS_IGNORE_RETURN)
121
/* GCC doesn't silence the warning with just (void)(result).
122
* (void)!(result) is known to work up at least up to GCC 10, as well
123
* as with Clang and MSVC.
124
*
125
* https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Non_002dbugs.html
126
* https://stackoverflow.com/questions/40576003/ignoring-warning-wunused-result
127
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425#c34
128
*/
129
#define MBEDTLS_IGNORE_RETURN(result) ((void) !(result))
130
#endif
131
132
/* If the following macro is defined, the library is being built by the test
133
* framework, and the framework is going to provide a replacement
134
* mbedtls_platform_zeroize() using a preprocessor macro, so the function
135
* declaration should be omitted. */
136
#if !defined(MBEDTLS_TEST_DEFINES_ZEROIZE)
//no-check-names
159
void
mbedtls_platform_zeroize
(
void
*buf,
size_t
len);
160
#endif
161
209
typedef
int
mbedtls_f_rng_t
(
void
*p_rng,
210
unsigned
char
*output,
size_t
output_size);
211
212
#if defined(MBEDTLS_HAVE_TIME_DATE)
239
struct
tm *
mbedtls_platform_gmtime_r
(
const
mbedtls_time_t
*tt,
240
struct
tm *tm_buf);
241
#endif
/* MBEDTLS_HAVE_TIME_DATE */
242
243
#ifdef __cplusplus
244
}
245
#endif
246
247
#endif
/* MBEDTLS_PLATFORM_UTIL_H */
build_info.h
Build-time configuration info.
platform_time.h
Mbed TLS Platform time abstraction.
mbedtls_time_t
time_t mbedtls_time_t
Definition
platform_time.h:27
mbedtls_f_rng_t
int mbedtls_f_rng_t(void *p_rng, unsigned char *output, size_t output_size)
The type of custom random generator (RNG) callbacks.
Definition
platform_util.h:209
mbedtls_platform_zeroize
void mbedtls_platform_zeroize(void *buf, size_t len)
Securely zeroize a buffer.
MBEDTLS_DEPRECATED
#define MBEDTLS_DEPRECATED
Definition
platform_util.h:37
mbedtls_platform_gmtime_r
struct tm * mbedtls_platform_gmtime_r(const mbedtls_time_t *tt, struct tm *tm_buf)
Platform-specific implementation of gmtime_r().
include
mbedtls
platform_util.h
Generated on
for Mbed TLS v3.6.7 by
1.17.0