2019-06-05 01:35:23 -04:00
|
|
|
/*
|
|
|
|
* This file is part of the MicroPython project, http://micropython.org/
|
|
|
|
*
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2018-2019 Damien P. George
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
#ifndef MICROPY_INCLUDED_MBEDTLS_CONFIG_H
|
|
|
|
#define MICROPY_INCLUDED_MBEDTLS_CONFIG_H
|
|
|
|
|
|
|
|
// Set mbedtls configuration
|
|
|
|
#define MBEDTLS_PLATFORM_MEMORY
|
|
|
|
#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
|
|
|
|
#define MBEDTLS_DEPRECATED_REMOVED
|
|
|
|
#define MBEDTLS_ENTROPY_HARDWARE_ALT
|
|
|
|
#define MBEDTLS_AES_ROM_TABLES
|
|
|
|
#define MBEDTLS_CIPHER_MODE_CBC
|
|
|
|
#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_SECP192K1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_BP256R1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_BP384R1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_BP512R1_ENABLED
|
|
|
|
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
|
|
|
|
#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
|
|
|
|
#define MBEDTLS_NO_PLATFORM_ENTROPY
|
|
|
|
#define MBEDTLS_PKCS1_V15
|
|
|
|
#define MBEDTLS_SHA256_SMALLER
|
|
|
|
#define MBEDTLS_SSL_PROTO_TLS1
|
|
|
|
#define MBEDTLS_SSL_PROTO_TLS1_1
|
|
|
|
#define MBEDTLS_SSL_PROTO_TLS1_2
|
|
|
|
#define MBEDTLS_SSL_SERVER_NAME_INDICATION
|
|
|
|
|
2019-11-07 06:15:33 -05:00
|
|
|
// Use a smaller output buffer to reduce size of SSL context
|
|
|
|
#define MBEDTLS_SSL_MAX_CONTENT_LEN (16384)
|
|
|
|
#define MBEDTLS_SSL_IN_CONTENT_LEN (MBEDTLS_SSL_MAX_CONTENT_LEN)
|
|
|
|
#define MBEDTLS_SSL_OUT_CONTENT_LEN (4096)
|
|
|
|
|
2019-06-05 01:35:23 -04:00
|
|
|
// Enable mbedtls modules
|
|
|
|
#define MBEDTLS_AES_C
|
|
|
|
#define MBEDTLS_ASN1_PARSE_C
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
#define MBEDTLS_CIPHER_C
|
|
|
|
#define MBEDTLS_CTR_DRBG_C
|
|
|
|
// #define MBEDTLS_ECP_C
|
|
|
|
#define MBEDTLS_ENTROPY_C
|
2020-07-02 15:34:36 -04:00
|
|
|
#define MBEDTLS_ERROR_C
|
2019-06-05 01:35:23 -04:00
|
|
|
#define MBEDTLS_MD_C
|
|
|
|
#define MBEDTLS_MD5_C
|
|
|
|
#define MBEDTLS_OID_C
|
|
|
|
#define MBEDTLS_PKCS5_C
|
|
|
|
#define MBEDTLS_PK_C
|
|
|
|
#define MBEDTLS_PK_PARSE_C
|
|
|
|
#define MBEDTLS_PLATFORM_C
|
|
|
|
#define MBEDTLS_RSA_C
|
|
|
|
#define MBEDTLS_SHA1_C
|
|
|
|
#define MBEDTLS_SHA256_C
|
|
|
|
#define MBEDTLS_SHA512_C
|
|
|
|
#define MBEDTLS_SSL_CLI_C
|
|
|
|
#define MBEDTLS_SSL_SRV_C
|
|
|
|
#define MBEDTLS_SSL_TLS_C
|
2022-01-17 01:21:48 -05:00
|
|
|
#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE
|
2019-06-05 01:35:23 -04:00
|
|
|
#define MBEDTLS_X509_CRT_PARSE_C
|
|
|
|
#define MBEDTLS_X509_USE_C
|
|
|
|
|
|
|
|
// Memory allocation hooks
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
void *m_calloc_mbedtls(size_t nmemb, size_t size);
|
|
|
|
void m_free_mbedtls(void *ptr);
|
|
|
|
#define MBEDTLS_PLATFORM_STD_CALLOC m_calloc_mbedtls
|
|
|
|
#define MBEDTLS_PLATFORM_STD_FREE m_free_mbedtls
|
|
|
|
#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf
|
|
|
|
|
|
|
|
#include "mbedtls/check_config.h"
|
|
|
|
|
|
|
|
#endif /* MICROPY_INCLUDED_MBEDTLS_CONFIG_H */
|