|
XenevaOS
|
Utility macros for internal use in the library. More...
#include "mbedtls/build_info.h"#include "alignment.h"#include <assert.h>#include <stddef.h>#include <stdint.h>
Go to the source code of this file.
Macros | |
| #define | MBEDTLS_STATIC_TESTABLE static |
| #define | MBEDTLS_TEST_HOOK_TEST_ASSERT(TEST) |
| #define | ARRAY_LENGTH_UNSAFE(array) (sizeof(array) / sizeof(*(array))) |
| #define | ARRAY_LENGTH(array) ARRAY_LENGTH_UNSAFE(array) |
| #define | MBEDTLS_ALLOW_PRIVATE_ACCESS |
| #define | asm __asm__ |
| #define | MBEDTLS_STATIC_ASSERT(expr, msg) struct ISO_C_does_not_allow_extra_semicolon_outside_of_a_function |
| #define | MBEDTLS_HAS_BUILTIN(x) 0 |
| #define | MBEDTLS_LIKELY(x) x |
| #define | MBEDTLS_UNLIKELY(x) x |
| #define | MBEDTLS_ASSUME(x) do { } while (0) |
| #define | MBEDTLS_OPTIMIZE_FOR_PERFORMANCE |
| #define | MBEDTLS_MAYBE_UNUSED |
| #define | MBEDTLS_ATTRIBUTE_UNTERMINATED_STRING |
Functions | |
| void | mbedtls_zeroize_and_free (void *buf, size_t len) |
| Securely zeroize a buffer then free it. | |
Utility macros for internal use in the library.
| #define ARRAY_LENGTH | ( | array | ) | ARRAY_LENGTH_UNSAFE(array) |
Return the number of elements of a static or stack array.
| array | A value of array (not pointer) type. |
| #define ARRAY_LENGTH_UNSAFE | ( | array | ) | (sizeof(array) / sizeof(*(array))) |
| #define asm __asm__ |
| #define MBEDTLS_ALLOW_PRIVATE_ACCESS |
Allow library to access its structs' private members.
Although structs defined in header files are publicly available, their members are private and should not be accessed by the user.
| #define MBEDTLS_ASSUME | ( | x | ) | do { } while (0) |
| #define MBEDTLS_ATTRIBUTE_UNTERMINATED_STRING |
| #define MBEDTLS_HAS_BUILTIN | ( | x | ) | 0 |
| #define MBEDTLS_LIKELY | ( | x | ) | x |
| #define MBEDTLS_MAYBE_UNUSED |
| #define MBEDTLS_OPTIMIZE_FOR_PERFORMANCE |
| #define MBEDTLS_STATIC_ASSERT | ( | expr, | |
| msg | |||
| ) | struct ISO_C_does_not_allow_extra_semicolon_outside_of_a_function |
| #define MBEDTLS_STATIC_TESTABLE static |
Helper to define a function as static except when building invasive tests.
If a function is only used inside its own source file and should be declared static to allow the compiler to optimize for code size, but that function has unit tests, define it with
and declare it in a header in the library/ directory with
| #define MBEDTLS_TEST_HOOK_TEST_ASSERT | ( | TEST | ) |
| #define MBEDTLS_UNLIKELY | ( | x | ) | x |
| void mbedtls_zeroize_and_free | ( | void * | buf, |
| size_t | len | ||
| ) |
Securely zeroize a buffer then free it.
Similar to making consecutive calls to
\c mbedtls_platform_zeroize() and \c mbedtls_free(), but has
code size savings, and potential for optimisation in the future.
Guaranteed to be a no-op if \p buf is \c NULL and \p len is 0.
| buf | Buffer to be zeroized then freed. |
| len | Length of the buffer in bytes |