NuMaker connection with AWS IoT thru MQTT/HTTPS

Dependencies:   MQTT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbedtls_utils.h Source File

mbedtls_utils.h

00001 /*
00002  * PackageLicenseDeclared: Apache-2.0
00003  * Copyright (c) 2017 ARM Limited
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _MBEDTLS_UTILS_H_
00019 #define _MBEDTLS_UTILS_H_
00020 
00021 #include "mbedtls/platform.h"
00022 #include "mbedtls/ssl.h"
00023 #include "mbedtls/entropy.h"
00024 #include "mbedtls/ctr_drbg.h"
00025 #include "mbedtls/error.h"
00026 
00027 /**
00028   * Helper for pretty-printing mbed TLS error codes
00029   */
00030 __STATIC_INLINE void print_mbedtls_error(const char *name, int err) {
00031     char buf[128];
00032     mbedtls_strerror(err, buf, sizeof (buf));
00033     mbedtls_printf("%s() failed: -0x%04x (%d): %s\r\n", name, -err, err, buf);
00034 }
00035 
00036 #endif // _MBEDTLS_UTILS_H_