error.h
Go to the documentation of this file.
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBEDTLS_ERROR_H
#define MBEDTLS_ERROR_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include <stddef.h>
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define MBEDTLS_ERR_ERROR_GENERIC_ERROR -0x0001
#define MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED -0x006E
#define MBEDTLS_ERROR_ADD( high, low ) \
mbedtls_error_add( high, low, __FILE__, __LINE__ )
#if defined(MBEDTLS_TEST_HOOKS)
extern void (*mbedtls_test_hook_error_add)( int, int, const char *, int );
#endif
static inline int mbedtls_error_add( int high, int low,
const char *file, int line )
{
#if defined(MBEDTLS_TEST_HOOKS)
if( *mbedtls_test_hook_error_add != NULL )
( *mbedtls_test_hook_error_add )( high, low, file, line );
#endif
(void)file;
(void)line;
return( high + low );
}
void mbedtls_strerror( int errnum, char *buffer, size_t buflen );
const char * mbedtls_high_level_strerr( int error_code );
const char * mbedtls_low_level_strerr( int error_code );
#ifdef __cplusplus
}
#endif
#endif /* error.h */
config.h
Configuration options (set of defines)
mbedtls_error_add
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
mbedtls_strerror
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...
mbedtls_low_level_strerr
const char * mbedtls_low_level_strerr(int error_code)
Translate the low-level part of an Mbed TLS error code into a string representation.
mbedtls_high_level_strerr
const char * mbedtls_high_level_strerr(int error_code)
Translate the high-level part of an Mbed TLS error code into a string representation.