 - * This module is used by the HAVEGE random number generator.
 - */
 -#define MBEDTLS_TIMING_C
+-
+-/**
+- * \def MBEDTLS_VERSION_C
+- *
+- * Enable run-time version information.
+- *
+- * Module:  library/version.c
+- *
+- * This module provides run-time version information.
+- */
+-#define MBEDTLS_VERSION_C
+-
+-/**
+- * \def MBEDTLS_X509_USE_C
+- *
+- * Enable X.509 core for using certificates.
+- *
+- * Module:  library/x509.c
+- * Caller:  library/x509_crl.c
+- *          library/x509_crt.c
+- *          library/x509_csr.c
+- *
+- * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C,
+- *           MBEDTLS_PK_PARSE_C
+- *
+- * This module is required for the X.509 parsing modules.
+- */
+-#define MBEDTLS_X509_USE_C
+-
+-/**
+- * \def MBEDTLS_X509_CRT_PARSE_C
+- *
+- * Enable X.509 certificate parsing.
+- *
+- * Module:  library/x509_crt.c
+- * Caller:  library/ssl_cli.c
+- *          library/ssl_srv.c
+- *          library/ssl_tls.c
+- *
+- * Requires: MBEDTLS_X509_USE_C
+- *
+- * This module is required for X.509 certificate parsing.
+- */
+-#define MBEDTLS_X509_CRT_PARSE_C
+-
+-/**
+- * \def MBEDTLS_X509_CRL_PARSE_C
+- *
+- * Enable X.509 CRL parsing.
+- *
+- * Module:  library/x509_crl.c
+- * Caller:  library/x509_crt.c
+- *
+- * Requires: MBEDTLS_X509_USE_C
+- *
+- * This module is required for X.509 CRL parsing.
+- */
+-#define MBEDTLS_X509_CRL_PARSE_C
 +/* Save some RAM by adjusting to your exact needs */
 +#define MBEDTLS_PSK_MAX_LEN    16 /* 128-bits keys are generally enough */
  
 -/**
-- * \def MBEDTLS_VERSION_C
-- *
-- * Enable run-time version information.
-- *
-- * Module:  library/version.c
-- *
-- * This module provides run-time version information.
+- * \def MBEDTLS_X509_CSR_PARSE_C
+- *
+- * Enable X.509 Certificate Signing Request (CSR) parsing.
+- *
+- * Module:  library/x509_csr.c
+- * Caller:  library/x509_crt_write.c
+- *
+- * Requires: MBEDTLS_X509_USE_C
+- *
+- * This module is used for reading X.509 certificate request.
+- */
+-#define MBEDTLS_X509_CSR_PARSE_C
+-
+-/**
+- * \def MBEDTLS_X509_CREATE_C
+- *
+- * Enable X.509 core for creating certificates.
+- *
+- * Module:  library/x509_create.c
+- *
+- * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_WRITE_C
+- *
+- * This module is the basis for creating X.509 certificates and CSRs.
+- */
+-#define MBEDTLS_X509_CREATE_C
+-
+-/**
+- * \def MBEDTLS_X509_CRT_WRITE_C
+- *
+- * Enable creating X.509 certificates.
+- *
+- * Module:  library/x509_crt_write.c
+- *
+- * Requires: MBEDTLS_X509_CREATE_C
+- *
+- * This module is required for X.509 certificate creation.
+- */
+-#define MBEDTLS_X509_CRT_WRITE_C
+-
+-/**
+- * \def MBEDTLS_X509_CSR_WRITE_C
+- *
+- * Enable creating X.509 Certificate Signing Requests (CSR).
+- *
+- * Module:  library/x509_csr_write.c
+- *
+- * Requires: MBEDTLS_X509_CREATE_C
+- *
+- * This module is required for X.509 certificate request writing.
+- */
+-#define MBEDTLS_X509_CSR_WRITE_C
+-
+-/**
+- * \def MBEDTLS_XTEA_C
+- *
+- * Enable the XTEA block cipher.
+- *
+- * Module:  library/xtea.c
+- * Caller:
+- */
+-#define MBEDTLS_XTEA_C
+-
+-/* \} name SECTION: mbed TLS modules */
+-
+-/**
+- * \name SECTION: Module configuration options
+- *
+- * This section allows for the setting of module specific sizes and
+- * configuration options. The default values are already present in the
+- * relevant header files and should suffice for the regular use cases.
+- *
+- * Our advice is to enable options and change their values here
+- * only if you have a good reason and know the consequences.
+- *
+- * Please check the respective header file for documentation on these
+- * parameters (to prevent duplicate documentation).
+- * \{
 +/*
 + * You should adjust this to the exact number of sources you're using: default
 + * is the "platform_entropy_poll" source, but you may want to add other ones
 + * Minimum is 2 for the entropy test suite.
   */
--#define MBEDTLS_VERSION_C
 +#define MBEDTLS_ENTROPY_MAX_SOURCES 2
  
--/**
-- * \def MBEDTLS_X509_USE_C
-- *
-- * Enable X.509 core for using certificates.
-- *
-- * Module:  library/x509.c
-- * Caller:  library/x509_crl.c
-- *          library/x509_crt.c
-- *          library/x509_csr.c
-- *
-- * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C,
-- *           MBEDTLS_PK_PARSE_C
-- *
-- * This module is required for the X.509 parsing modules.
-- */
--#define MBEDTLS_X509_USE_C
-+#define MBEDTLS_SSL_BUFFER_MIN 512
- 
--/**
-- * \def MBEDTLS_X509_CRT_PARSE_C
-- *
-- * Enable X.509 certificate parsing.
-- *
-- * Module:  library/x509_crt.c
-- * Caller:  library/ssl_cli.c
-- *          library/ssl_srv.c
-- *          library/ssl_tls.c
-- *
-- * Requires: MBEDTLS_X509_USE_C
-- *
-- * This module is required for X.509 certificate parsing.
-- */
-+#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
-+#define MBEDTLS_ECP_C
-+#define MBEDTLS_BIGNUM_C
-+#define MBEDTLS_KEY_EXCHANGE_ECDH_ANON_ENABLED
-+#define MBEDTLS_ECDH_C
-+#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
-+#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
-+#define MBEDTLS_RSA_C
-+#define MBEDTLS_PKCS1_V15
- #define MBEDTLS_X509_CRT_PARSE_C
- 
--/**
-- * \def MBEDTLS_X509_CRL_PARSE_C
-- *
-- * Enable X.509 CRL parsing.
-- *
-- * Module:  library/x509_crl.c
-- * Caller:  library/x509_crt.c
-- *
-- * Requires: MBEDTLS_X509_USE_C
-- *
-- * This module is required for X.509 CRL parsing.
-- */
--#define MBEDTLS_X509_CRL_PARSE_C
--
--/**
-- * \def MBEDTLS_X509_CSR_PARSE_C
-- *
-- * Enable X.509 Certificate Signing Request (CSR) parsing.
-- *
-- * Module:  library/x509_csr.c
-- * Caller:  library/x509_crt_write.c
-- *
-- * Requires: MBEDTLS_X509_USE_C
-- *
-- * This module is used for reading X.509 certificate request.
-- */
--#define MBEDTLS_X509_CSR_PARSE_C
--
--/**
-- * \def MBEDTLS_X509_CREATE_C
-- *
-- * Enable X.509 core for creating certificates.
-- *
-- * Module:  library/x509_create.c
-- *
-- * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_WRITE_C
-- *
-- * This module is the basis for creating X.509 certificates and CSRs.
-- */
--#define MBEDTLS_X509_CREATE_C
--
--/**
-- * \def MBEDTLS_X509_CRT_WRITE_C
-- *
-- * Enable creating X.509 certificates.
-- *
-- * Module:  library/x509_crt_write.c
-- *
-- * Requires: MBEDTLS_X509_CREATE_C
-- *
-- * This module is required for X.509 certificate creation.
-- */
--#define MBEDTLS_X509_CRT_WRITE_C
--
--/**
-- * \def MBEDTLS_X509_CSR_WRITE_C
-- *
-- * Enable creating X.509 Certificate Signing Requests (CSR).
-- *
-- * Module:  library/x509_csr_write.c
-- *
-- * Requires: MBEDTLS_X509_CREATE_C
-- *
-- * This module is required for X.509 certificate request writing.
-- */
--#define MBEDTLS_X509_CSR_WRITE_C
--
--/**
-- * \def MBEDTLS_XTEA_C
-- *
-- * Enable the XTEA block cipher.
-- *
-- * Module:  library/xtea.c
-- * Caller:
-- */
--#define MBEDTLS_XTEA_C
--
--/* \} name SECTION: mbed TLS modules */
--
--/**
-- * \name SECTION: Module configuration options
-- *
-- * This section allows for the setting of module specific sizes and
-- * configuration options. The default values are already present in the
-- * relevant header files and should suffice for the regular use cases.
-- *
-- * Our advice is to enable options and change their values here
-- * only if you have a good reason and know the consequences.
-- *
-- * Please check the respective header file for documentation on these
-- * parameters (to prevent duplicate documentation).
-- * \{
-- */
--
 -/* MPI / BIGNUM options */
 -//#define MBEDTLS_MPI_WINDOW_SIZE            6 /**< Maximum windows size used. */
 -//#define MBEDTLS_MPI_MAX_SIZE            1024 /**< Maximum number of bytes for usable MPIs. */
--
++#ifndef OC_DYNAMIC_ALLOCATION
++#define MBEDTLS_SSL_MAX_CONTENT_LEN (OC_PDU_SIZE)
++#endif /* !OC_DYNAMIC_ALLOCATION */
+ 
 -/* CTR_DRBG options */
 -//#define MBEDTLS_CTR_DRBG_ENTROPY_LEN               48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */
 -//#define MBEDTLS_CTR_DRBG_RESEED_INTERVAL        10000 /**< Interval before reseed is performed by default */
 -//#define MBEDTLS_CTR_DRBG_MAX_INPUT                256 /**< Maximum number of additional input bytes */
 -//#define MBEDTLS_CTR_DRBG_MAX_REQUEST             1024 /**< Maximum number of requested bytes per call */
 -//#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT           384 /**< Maximum size of (re)seed buffer */
--
++#define MBEDTLS_SSL_BUFFER_MIN 512
+ 
 -/* HMAC_DRBG options */
 -//#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL   10000 /**< Interval before reseed is performed by default */
 -//#define MBEDTLS_HMAC_DRBG_MAX_INPUT           256 /**< Maximum number of additional input bytes */

 
 #endif /* MBEDTLS_CONFIG_H */
diff --git a/library/entropy_poll.c b/library/entropy_poll.c
index c022caf..4f3ecb9 100644
--- a/library/entropy_poll.c
+++ b/library/entropy_poll.c
@@ -44,11 +44,31 @@

-/* X509 options */
-//#define MBEDTLS_X509_MAX_INTERMEDIATE_CA   8   /**< Maximum number of intermediate CAs in a verification chain. */
-//#define MBEDTLS_X509_MAX_FILE_PATH_LEN     512 /**< Maximum length of a path/filename string in bytes including the null terminator character ('\0'). */
+#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
+#define MBEDTLS_ECP_C
+#define MBEDTLS_BIGNUM_C
+#define MBEDTLS_KEY_EXCHANGE_ECDH_ANON_ENABLED
+#define MBEDTLS_ECDH_C
+#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
+#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
+#define MBEDTLS_RSA_C
+#define MBEDTLS_PKCS1_V15
+#define MBEDTLS_X509_CRT_PARSE_C
 
-/**
- * Allow SHA-1 in the default TLS configuration for certificate signing.
- * Without this build-time option, SHA-1 support must be activated explicitly
