Mbed TLS v3.6.1
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 #include "mbedtls/build_info.h"
14 
15 #include <stddef.h>
16 
93 #ifdef __cplusplus
94 extern "C" {
95 #endif
96 
98 #define MBEDTLS_ERR_ERROR_GENERIC_ERROR -0x0001
100 #define MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED -0x006E
101 
103 #define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED -0x0070
105 #define MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED -0x0072
106 
113 #define MBEDTLS_ERROR_ADD(high, low) \
114  mbedtls_error_add(high, low, __FILE__, __LINE__)
115 
116 #if defined(MBEDTLS_TEST_HOOKS)
121 extern void (*mbedtls_test_hook_error_add)(int, int, const char *, int);
122 #endif
123 
142 static inline int mbedtls_error_add(int high, int low,
143  const char *file, int line)
144 {
145 #if defined(MBEDTLS_TEST_HOOKS)
146  if (*mbedtls_test_hook_error_add != NULL) {
147  (*mbedtls_test_hook_error_add)(high, low, file, line);
148  }
149 #endif
150  (void) file;
151  (void) line;
152 
153  return high + low;
154 }
155 
165 void mbedtls_strerror(int errnum, char *buffer, size_t buflen);
166 
180 const char *mbedtls_high_level_strerr(int error_code);
181 
195 const char *mbedtls_low_level_strerr(int error_code);
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 #endif /* error.h */
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:142
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...
const char * mbedtls_low_level_strerr(int error_code)
Translate the low-level part of an Mbed TLS error code into a string representation.
const char * mbedtls_high_level_strerr(int error_code)
Translate the high-level part of an Mbed TLS error code into a string representation.
Build-time configuration info.