Mbed TLS v2.28.8
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9 */
10#ifndef MBEDTLS_ERROR_H
11#define MBEDTLS_ERROR_H
12
13#if !defined(MBEDTLS_CONFIG_FILE)
14#include "mbedtls/config.h"
15#else
16#include MBEDTLS_CONFIG_FILE
17#endif
18
19#include <stddef.h>
20
21#if (defined(__ARMCC_VERSION) || defined(_MSC_VER)) && \
22 !defined(inline) && !defined(__cplusplus)
23#define inline __inline
24#endif
25
103#ifdef __cplusplus
104extern "C" {
105#endif
106
108#define MBEDTLS_ERR_ERROR_GENERIC_ERROR -0x0001
110#define MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED -0x006E
111
118#define MBEDTLS_ERROR_ADD(high, low) \
119 mbedtls_error_add(high, low, __FILE__, __LINE__)
120
121#if defined(MBEDTLS_TEST_HOOKS)
126extern void (*mbedtls_test_hook_error_add)(int, int, const char *, int);
127#endif
128
147static inline int mbedtls_error_add(int high, int low,
148 const char *file, int line)
149{
150#if defined(MBEDTLS_TEST_HOOKS)
151 if (*mbedtls_test_hook_error_add != NULL) {
152 (*mbedtls_test_hook_error_add)(high, low, file, line);
153 }
154#endif
155 (void) file;
156 (void) line;
157
158 return high + low;
159}
160
170void mbedtls_strerror(int errnum, char *buffer, size_t buflen);
171
185const char *mbedtls_high_level_strerr(int error_code);
186
200const char *mbedtls_low_level_strerr(int error_code);
201
202#ifdef __cplusplus
203}
204#endif
205
206#endif /* error.h */
Configuration options (set of defines)
const char * mbedtls_low_level_strerr(int error_code)
Translate the low-level part of an Mbed TLS error code into a string representation.
static int mbedtls_error_add(int high, int low, const char *file, int line)
Combines a high-level and low-level error code together.
Definition error.h:147
const char * mbedtls_high_level_strerr(int error_code)
Translate the high-level part of an Mbed TLS error code into a string representation.
void mbedtls_strerror(int errnum, char *buffer, size_t buflen)
Translate an Mbed TLS error code into a string representation. The result is truncated if necessary a...