mbed TLS v2.28.0
error.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_ERROR_H
23#define MBEDTLS_ERROR_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 <stddef.h>
32
33#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
34 !defined(inline) && !defined(__cplusplus)
35#define inline __inline
36#endif
37
115#ifdef __cplusplus
116extern "C" {
117#endif
118
120#define MBEDTLS_ERR_ERROR_GENERIC_ERROR -0x0001
122#define MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED -0x006E
123
130#define MBEDTLS_ERROR_ADD( high, low ) \
131 mbedtls_error_add( high, low, __FILE__, __LINE__ )
132
133#if defined(MBEDTLS_TEST_HOOKS)
138extern void (*mbedtls_test_hook_error_add)( int, int, const char *, int );
139#endif
140
159static inline int mbedtls_error_add( int high, int low,
160 const char *file, int line )
161{
162#if defined(MBEDTLS_TEST_HOOKS)
163 if( *mbedtls_test_hook_error_add != NULL )
164 ( *mbedtls_test_hook_error_add )( high, low, file, line );
165#endif
166 (void)file;
167 (void)line;
168
169 return( high + low );
170}
171
181void mbedtls_strerror( int errnum, char *buffer, size_t buflen );
182
196const char * mbedtls_high_level_strerr( int error_code );
197
211const char * mbedtls_low_level_strerr( int error_code );
212
213#ifdef __cplusplus
214}
215#endif
216
217#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:159
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 a mbed TLS error code into a string representation, Result is truncated if necessary and al...