NuMaker connection with AWS IoT thru MQTT/HTTPS

Dependencies:   MQTT_ON_AWS

Revision:
1:5ffad9f24d63
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedtls_utils.h	Thu Jan 04 13:09:45 2018 +0800
@@ -0,0 +1,36 @@
+/*
+ * PackageLicenseDeclared: Apache-2.0
+ * Copyright (c) 2017 ARM Limited
+ *
+ * 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_UTILS_H_
+#define _MBEDTLS_UTILS_H_
+
+#include "mbedtls/platform.h"
+#include "mbedtls/ssl.h"
+#include "mbedtls/entropy.h"
+#include "mbedtls/ctr_drbg.h"
+#include "mbedtls/error.h"
+
+/**
+  * Helper for pretty-printing mbed TLS error codes
+  */
+__STATIC_INLINE void print_mbedtls_error(const char *name, int err) {
+    char buf[128];
+    mbedtls_strerror(err, buf, sizeof (buf));
+    mbedtls_printf("%s() failed: -0x%04x (%d): %s\r\n", name, -err, err, buf);
+}
+
+#endif // _MBEDTLS_UTILS_H_