mbed client example for mbed connect asia 2016

Dependencies:   simple-mbed-client

Fork of simple-mbed-client-example by sandbox

Committer:
Jan Jongboom
Date:
Fri Dec 02 15:44:32 2016 +0800
Revision:
34:1e8d914a2876
Move to mbed OS 5.2.3, get rid of Semaphore

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jan Jongboom 34:1e8d914a2876 1 /**
Jan Jongboom 34:1e8d914a2876 2 * Minimal configuration for using mbedtls as part of mbed-client
Jan Jongboom 34:1e8d914a2876 3 *
Jan Jongboom 34:1e8d914a2876 4 * NOTE! This is an optimized, minimal configuration for mbed Client.
Jan Jongboom 34:1e8d914a2876 5 * We know it works with mbed Client but if you want to add more
Jan Jongboom 34:1e8d914a2876 6 * services/communications to the application yourself - please ensure
Jan Jongboom 34:1e8d914a2876 7 * you update this configuration accordingly. The default configuration
Jan Jongboom 34:1e8d914a2876 8 * can be found from mbedTLS Github:
Jan Jongboom 34:1e8d914a2876 9 *
Jan Jongboom 34:1e8d914a2876 10 * https://github.com/ARMmbed/mbedtls/blob/development/include/mbedtls/config.h
Jan Jongboom 34:1e8d914a2876 11 *
Jan Jongboom 34:1e8d914a2876 12 *
Jan Jongboom 34:1e8d914a2876 13 * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
Jan Jongboom 34:1e8d914a2876 14 * SPDX-License-Identifier: Apache-2.0
Jan Jongboom 34:1e8d914a2876 15 *
Jan Jongboom 34:1e8d914a2876 16 * Licensed under the Apache License, Version 2.0 (the "License"); you may
Jan Jongboom 34:1e8d914a2876 17 * not use this file except in compliance with the License.
Jan Jongboom 34:1e8d914a2876 18 * You may obtain a copy of the License at
Jan Jongboom 34:1e8d914a2876 19 *
Jan Jongboom 34:1e8d914a2876 20 * http://www.apache.org/licenses/LICENSE-2.0
Jan Jongboom 34:1e8d914a2876 21 *
Jan Jongboom 34:1e8d914a2876 22 * Unless required by applicable law or agreed to in writing, software
Jan Jongboom 34:1e8d914a2876 23 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
Jan Jongboom 34:1e8d914a2876 24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Jan Jongboom 34:1e8d914a2876 25 * See the License for the specific language governing permissions and
Jan Jongboom 34:1e8d914a2876 26 * limitations under the License.
Jan Jongboom 34:1e8d914a2876 27 *
Jan Jongboom 34:1e8d914a2876 28 * This file is part of mbed TLS (https://tls.mbed.org)
Jan Jongboom 34:1e8d914a2876 29 */
Jan Jongboom 34:1e8d914a2876 30
Jan Jongboom 34:1e8d914a2876 31
Jan Jongboom 34:1e8d914a2876 32 #ifndef MBEDTLS_CUSTOM_CONFIG_H
Jan Jongboom 34:1e8d914a2876 33 #define MBEDTLS_CUSTOM_CONFIG_H
Jan Jongboom 34:1e8d914a2876 34
Jan Jongboom 34:1e8d914a2876 35 /* System support */
Jan Jongboom 34:1e8d914a2876 36 #define MBEDTLS_HAVE_ASM
Jan Jongboom 34:1e8d914a2876 37
Jan Jongboom 34:1e8d914a2876 38 /* mbed TLS feature support */
Jan Jongboom 34:1e8d914a2876 39 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
Jan Jongboom 34:1e8d914a2876 40 #define MBEDTLS_ECP_NIST_OPTIM
Jan Jongboom 34:1e8d914a2876 41 #define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
Jan Jongboom 34:1e8d914a2876 42 #define MBEDTLS_SSL_PROTO_TLS1_2
Jan Jongboom 34:1e8d914a2876 43 #define MBEDTLS_SSL_PROTO_DTLS
Jan Jongboom 34:1e8d914a2876 44 #define MBEDTLS_SSL_DTLS_ANTI_REPLAY
Jan Jongboom 34:1e8d914a2876 45 #define MBEDTLS_SSL_DTLS_HELLO_VERIFY
Jan Jongboom 34:1e8d914a2876 46 #define MBEDTLS_SSL_EXPORT_KEYS
Jan Jongboom 34:1e8d914a2876 47
Jan Jongboom 34:1e8d914a2876 48 /* mbed TLS modules */
Jan Jongboom 34:1e8d914a2876 49 #define MBEDTLS_AES_C
Jan Jongboom 34:1e8d914a2876 50 #define MBEDTLS_ASN1_PARSE_C
Jan Jongboom 34:1e8d914a2876 51 #define MBEDTLS_ASN1_WRITE_C
Jan Jongboom 34:1e8d914a2876 52 #define MBEDTLS_BIGNUM_C
Jan Jongboom 34:1e8d914a2876 53 #define MBEDTLS_CIPHER_C
Jan Jongboom 34:1e8d914a2876 54 #define MBEDTLS_CTR_DRBG_C
Jan Jongboom 34:1e8d914a2876 55 #define MBEDTLS_ECP_C
Jan Jongboom 34:1e8d914a2876 56 #define MBEDTLS_ENTROPY_C
Jan Jongboom 34:1e8d914a2876 57 #define MBEDTLS_MD_C
Jan Jongboom 34:1e8d914a2876 58 #define MBEDTLS_OID_C
Jan Jongboom 34:1e8d914a2876 59 #define MBEDTLS_PK_C
Jan Jongboom 34:1e8d914a2876 60 #define MBEDTLS_PK_PARSE_C
Jan Jongboom 34:1e8d914a2876 61 #define MBEDTLS_SHA256_C
Jan Jongboom 34:1e8d914a2876 62 #define MBEDTLS_SSL_COOKIE_C
Jan Jongboom 34:1e8d914a2876 63 #define MBEDTLS_SSL_CLI_C
Jan Jongboom 34:1e8d914a2876 64 #define MBEDTLS_SSL_SRV_C
Jan Jongboom 34:1e8d914a2876 65 #define MBEDTLS_SSL_TLS_C
Jan Jongboom 34:1e8d914a2876 66
Jan Jongboom 34:1e8d914a2876 67 // XXX mbedclient needs these: mbedtls_x509_crt_free, mbedtls_x509_crt_init, mbedtls_x509_crt_parse
Jan Jongboom 34:1e8d914a2876 68 #define MBEDTLS_X509_USE_C
Jan Jongboom 34:1e8d914a2876 69 #define MBEDTLS_X509_CRT_PARSE_C
Jan Jongboom 34:1e8d914a2876 70
Jan Jongboom 34:1e8d914a2876 71 // XXX: clean these up!!
Jan Jongboom 34:1e8d914a2876 72 #define MBEDTLS_SHA512_C
Jan Jongboom 34:1e8d914a2876 73 #define MBEDTLS_ECDH_C
Jan Jongboom 34:1e8d914a2876 74 #define MBEDTLS_GCM_C
Jan Jongboom 34:1e8d914a2876 75
Jan Jongboom 34:1e8d914a2876 76 #define MBEDTLS_ECDH_C
Jan Jongboom 34:1e8d914a2876 77 #define MBEDTLS_ECDSA_C
Jan Jongboom 34:1e8d914a2876 78 #define MBEDTLS_X509_CRT_PARSE_C
Jan Jongboom 34:1e8d914a2876 79
Jan Jongboom 34:1e8d914a2876 80 // Remove RSA, save 20KB at total
Jan Jongboom 34:1e8d914a2876 81 #undef MBEDTLS_RSA_C
Jan Jongboom 34:1e8d914a2876 82 #undef MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
Jan Jongboom 34:1e8d914a2876 83
Jan Jongboom 34:1e8d914a2876 84 // Remove error messages, save 10KB of ROM
Jan Jongboom 34:1e8d914a2876 85 #undef MBEDTLS_ERROR_C
Jan Jongboom 34:1e8d914a2876 86
Jan Jongboom 34:1e8d914a2876 87 // Remove selftesting and save 11KB of ROM
Jan Jongboom 34:1e8d914a2876 88 #undef MBEDTLS_SELF_TEST
Jan Jongboom 34:1e8d914a2876 89
Jan Jongboom 34:1e8d914a2876 90 // Reduces ROM size by 30 kB
Jan Jongboom 34:1e8d914a2876 91 #undef MBEDTLS_ERROR_STRERROR_DUMMY
Jan Jongboom 34:1e8d914a2876 92 #undef MBEDTLS_VERSION_FEATURES
Jan Jongboom 34:1e8d914a2876 93 #undef MBEDTLS_DEBUG_C
Jan Jongboom 34:1e8d914a2876 94
Jan Jongboom 34:1e8d914a2876 95 // needed for parsing the certificates
Jan Jongboom 34:1e8d914a2876 96 #define MBEDTLS_PEM_PARSE_C
Jan Jongboom 34:1e8d914a2876 97 // dep of the previous
Jan Jongboom 34:1e8d914a2876 98 #define MBEDTLS_BASE64_C
Jan Jongboom 34:1e8d914a2876 99
Jan Jongboom 34:1e8d914a2876 100 // Reduce IO buffer to save RAM, default is 16KB
Jan Jongboom 34:1e8d914a2876 101 #define MBEDTLS_SSL_MAX_CONTENT_LEN 2048
Jan Jongboom 34:1e8d914a2876 102
Jan Jongboom 34:1e8d914a2876 103 // define to save 8KB RAM at the expense of ROM
Jan Jongboom 34:1e8d914a2876 104 #undef MBEDTLS_AES_ROM_TABLES
Jan Jongboom 34:1e8d914a2876 105
Jan Jongboom 34:1e8d914a2876 106 // Save ROM and a few bytes of RAM by specifying our own ciphersuite list
Jan Jongboom 34:1e8d914a2876 107 #define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
Jan Jongboom 34:1e8d914a2876 108
Jan Jongboom 34:1e8d914a2876 109 #include "mbedtls/check_config.h"
Jan Jongboom 34:1e8d914a2876 110
Jan Jongboom 34:1e8d914a2876 111 #endif /* MBEDTLS_CUSTOM_CONFIG_H */