NuMaker connection with AWS IoT thru MQTT/HTTPS

Dependencies:   MQTT

mbedtls_utils.h

Committer:
ccli8
Date:
13 months ago
Revision:
45:7d315fb1ba3e
Parent:
1:5ffad9f24d63

File content as of revision 45:7d315fb1ba3e:

/*
 * 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_