yh Tang
/
NuMaker-mbed-AWS-IoT-example
NuMaker connection with AWS IoT thru MQTT/HTTPS
mbedtls_utils.h@1:5ffad9f24d63, 2018-01-04 (annotated)
- Committer:
- ccli8
- Date:
- Thu Jan 04 13:09:45 2018 +0800
- Revision:
- 1:5ffad9f24d63
Support AWS IoT MQTT/HTTPS protocol
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ccli8 |
1:5ffad9f24d63 | 1 | /* |
ccli8 |
1:5ffad9f24d63 | 2 | * PackageLicenseDeclared: Apache-2.0 |
ccli8 |
1:5ffad9f24d63 | 3 | * Copyright (c) 2017 ARM Limited |
ccli8 |
1:5ffad9f24d63 | 4 | * |
ccli8 |
1:5ffad9f24d63 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ccli8 |
1:5ffad9f24d63 | 6 | * you may not use this file except in compliance with the License. |
ccli8 |
1:5ffad9f24d63 | 7 | * You may obtain a copy of the License at |
ccli8 |
1:5ffad9f24d63 | 8 | * |
ccli8 |
1:5ffad9f24d63 | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
ccli8 |
1:5ffad9f24d63 | 10 | * |
ccli8 |
1:5ffad9f24d63 | 11 | * Unless required by applicable law or agreed to in writing, software |
ccli8 |
1:5ffad9f24d63 | 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
ccli8 |
1:5ffad9f24d63 | 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ccli8 |
1:5ffad9f24d63 | 14 | * See the License for the specific language governing permissions and |
ccli8 |
1:5ffad9f24d63 | 15 | * limitations under the License. |
ccli8 |
1:5ffad9f24d63 | 16 | */ |
ccli8 |
1:5ffad9f24d63 | 17 | |
ccli8 |
1:5ffad9f24d63 | 18 | #ifndef _MBEDTLS_UTILS_H_ |
ccli8 |
1:5ffad9f24d63 | 19 | #define _MBEDTLS_UTILS_H_ |
ccli8 |
1:5ffad9f24d63 | 20 | |
ccli8 |
1:5ffad9f24d63 | 21 | #include "mbedtls/platform.h" |
ccli8 |
1:5ffad9f24d63 | 22 | #include "mbedtls/ssl.h" |
ccli8 |
1:5ffad9f24d63 | 23 | #include "mbedtls/entropy.h" |
ccli8 |
1:5ffad9f24d63 | 24 | #include "mbedtls/ctr_drbg.h" |
ccli8 |
1:5ffad9f24d63 | 25 | #include "mbedtls/error.h" |
ccli8 |
1:5ffad9f24d63 | 26 | |
ccli8 |
1:5ffad9f24d63 | 27 | /** |
ccli8 |
1:5ffad9f24d63 | 28 | * Helper for pretty-printing mbed TLS error codes |
ccli8 |
1:5ffad9f24d63 | 29 | */ |
ccli8 |
1:5ffad9f24d63 | 30 | __STATIC_INLINE void print_mbedtls_error(const char *name, int err) { |
ccli8 |
1:5ffad9f24d63 | 31 | char buf[128]; |
ccli8 |
1:5ffad9f24d63 | 32 | mbedtls_strerror(err, buf, sizeof (buf)); |
ccli8 |
1:5ffad9f24d63 | 33 | mbedtls_printf("%s() failed: -0x%04x (%d): %s\r\n", name, -err, err, buf); |
ccli8 |
1:5ffad9f24d63 | 34 | } |
ccli8 |
1:5ffad9f24d63 | 35 | |
ccli8 |
1:5ffad9f24d63 | 36 | #endif // _MBEDTLS_UTILS_H_ |