Go to the documentation of this file.
31 #ifndef POLARSSL_CONFIG_H
32 #define POLARSSL_CONFIG_H
34 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
35 #define _CRT_SECURE_NO_DEPRECATE 1
69 #define POLARSSL_HAVE_LONGLONG
85 #define POLARSSL_HAVE_ASM
105 #define POLARSSL_HAVE_READDIR_R
114 #define POLARSSL_HAVE_TIME
169 #define POLARSSL_CIPHER_MODE_CBC
176 #define POLARSSL_CIPHER_MODE_CFB
183 #define POLARSSL_CIPHER_MODE_CTR
226 #define POLARSSL_CIPHER_PADDING_PKCS7
227 #define POLARSSL_CIPHER_PADDING_ONE_AND_ZEROS
228 #define POLARSSL_CIPHER_PADDING_ZEROS_AND_LEN
229 #define POLARSSL_CIPHER_PADDING_ZEROS
254 #define POLARSSL_ECP_DP_SECP192R1_ENABLED
255 #define POLARSSL_ECP_DP_SECP224R1_ENABLED
256 #define POLARSSL_ECP_DP_SECP256R1_ENABLED
257 #define POLARSSL_ECP_DP_SECP384R1_ENABLED
258 #define POLARSSL_ECP_DP_SECP521R1_ENABLED
259 #define POLARSSL_ECP_DP_BP256R1_ENABLED
260 #define POLARSSL_ECP_DP_BP384R1_ENABLED
261 #define POLARSSL_ECP_DP_BP512R1_ENABLED
272 #define POLARSSL_ECP_NIST_OPTIM
294 #define POLARSSL_KEY_EXCHANGE_PSK_ENABLED
318 #define POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED
338 #define POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED
363 #define POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED
391 #define POLARSSL_KEY_EXCHANGE_RSA_ENABLED
417 #define POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED
442 #define POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED
466 #define POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
477 #define POLARSSL_ERROR_STRERROR_BC
488 #define POLARSSL_ERROR_STRERROR_DUMMY
497 #define POLARSSL_GENPRIME
504 #define POLARSSL_FS_IO
565 #define POLARSSL_PKCS1_V15
576 #define POLARSSL_PKCS1_V21
593 #define POLARSSL_SELF_TEST
607 #define POLARSSL_SSL_ALERT_MESSAGES
643 #define POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
652 #define POLARSSL_SSL_MAX_FRAGMENT_LENGTH
664 #define POLARSSL_SSL_PROTO_SSL3
676 #define POLARSSL_SSL_PROTO_TLS1
688 #define POLARSSL_SSL_PROTO_TLS1_1
700 #define POLARSSL_SSL_PROTO_TLS1_2
713 #define POLARSSL_SSL_SESSION_TICKETS
722 #define POLARSSL_SSL_SERVER_NAME_INDICATION
731 #define POLARSSL_SSL_TRUNCATED_HMAC
873 #define POLARSSL_AES_C
894 #define POLARSSL_ARC4_C
908 #define POLARSSL_ASN1_PARSE_C
922 #define POLARSSL_ASN1_WRITE_C
934 #define POLARSSL_BASE64_C
949 #define POLARSSL_BIGNUM_C
958 #define POLARSSL_BLOWFISH_C
1005 #define POLARSSL_CAMELLIA_C
1019 #define POLARSSL_CERTS_C
1031 #define POLARSSL_CIPHER_C
1045 #define POLARSSL_CTR_DRBG_C
1059 #define POLARSSL_DEBUG_C
1083 #define POLARSSL_DES_C
1097 #define POLARSSL_DHM_C
1113 #define POLARSSL_ECDH_C
1128 #define POLARSSL_ECDSA_C
1141 #define POLARSSL_ECP_C
1155 #define POLARSSL_ENTROPY_C
1167 #define POLARSSL_ERROR_C
1181 #define POLARSSL_GCM_C
1216 #define POLARSSL_MD_C
1255 #define POLARSSL_MD5_C
1295 #define POLARSSL_NET_C
1318 #define POLARSSL_OID_C
1330 #define POLARSSL_PADLOCK_C
1344 #define POLARSSL_PBKDF2_C
1362 #define POLARSSL_PEM_PARSE_C
1378 #define POLARSSL_PEM_WRITE_C
1394 #define POLARSSL_PK_C
1409 #define POLARSSL_PK_PARSE_C
1423 #define POLARSSL_PK_WRITE_C
1436 #define POLARSSL_PKCS5_C
1467 #define POLARSSL_PKCS12_C
1485 #define POLARSSL_RSA_C
1501 #define POLARSSL_SHA1_C
1519 #define POLARSSL_SHA256_C
1535 #define POLARSSL_SHA512_C
1547 #define POLARSSL_SSL_CACHE_C
1561 #define POLARSSL_SSL_CLI_C
1575 #define POLARSSL_SSL_SRV_C
1591 #define POLARSSL_SSL_TLS_C
1624 #define POLARSSL_TIMING_C
1635 #define POLARSSL_VERSION_C
1652 #define POLARSSL_X509_USE_C
1668 #define POLARSSL_X509_CRT_PARSE_C
1682 #define POLARSSL_X509_CRL_PARSE_C
1696 #define POLARSSL_X509_CSR_PARSE_C
1709 #define POLARSSL_X509_CREATE_C
1722 #define POLARSSL_X509_CRT_WRITE_C
1735 #define POLARSSL_X509_CSR_WRITE_C
1745 #define POLARSSL_XTEA_C
1769 #if defined(POLARSSL_CONFIG_OPTIONS)
1773 #define POLARSSL_MPI_WINDOW_SIZE 6
1774 #define POLARSSL_MPI_MAX_SIZE 512
1778 #define CTR_DRBG_ENTROPY_LEN 48
1779 #define CTR_DRBG_RESEED_INTERVAL 10000
1780 #define CTR_DRBG_MAX_INPUT 256
1781 #define CTR_DRBG_MAX_REQUEST 1024
1782 #define CTR_DRBG_MAX_SEED_INPUT 384
1786 #define ENTROPY_MAX_SOURCES 20
1787 #define ENTROPY_MAX_GATHER 128
1790 #define MEMORY_ALIGN_MULTIPLE 4
1791 #define POLARSSL_MEMORY_STDMALLOC malloc
1792 #define POLARSSL_MEMORY_STDFREE free
1794 // SSL Cache options
1796 #define SSL_CACHE_DEFAULT_TIMEOUT 86400
1797 #define SSL_CACHE_DEFAULT_MAX_ENTRIES 50
1801 #define SSL_MAX_CONTENT_LEN 16384
1802 #define SSL_DEFAULT_TICKET_LIFETIME 86400
1811 #if defined(POLARSSL_CERTS_C) && !defined(POLARSSL_PEM_PARSE_C)
1812 #error "POLARSSL_CERTS_C defined, but not all prerequisites"
1815 #if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
1816 #error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
1819 #if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
1820 #error "POLARSSL_DHM_C defined, but not all prerequisites"
1823 #if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
1824 #error "POLARSSL_ECDH_C defined, but not all prerequisites"
1827 #if defined(POLARSSL_ECDSA_C) && \
1828 ( !defined(POLARSSL_ECP_C) || \
1829 !defined(POLARSSL_ASN1_PARSE_C) || \
1830 !defined(POLARSSL_ASN1_WRITE_C) )
1831 #error "POLARSSL_ECDSA_C defined, but not all prerequisites"
1834 #if defined(POLARSSL_ECP_C) && ( !defined(POLARSSL_BIGNUM_C) || ( \
1835 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
1836 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
1837 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
1838 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
1839 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
1840 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
1841 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
1842 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) ) )
1843 #error "POLARSSL_ECP_C defined, but not all prerequisites"
1846 #if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
1847 !defined(POLARSSL_SHA256_C))
1848 #error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
1850 #if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
1851 defined(POLARSSL_CONFIG_OPTIONS) && (CTR_DRBG_ENTROPY_LEN > 64)
1852 #error "CTR_DRBG_ENTROPY_LEN value too high"
1854 #if defined(POLARSSL_ENTROPY_C) && !defined(POLARSSL_SHA512_C) && \
1855 defined(POLARSSL_CONFIG_OPTIONS) && (CTR_DRBG_ENTROPY_LEN > 32)
1856 #error "CTR_DRBG_ENTROPY_LEN value too high"
1859 #if defined(POLARSSL_GCM_C) && ( \
1860 !defined(POLARSSL_AES_C) && !defined(POLARSSL_CAMELLIA_C) )
1861 #error "POLARSSL_GCM_C defined, but not all prerequisites"
1864 #if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
1865 #error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
1868 #if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
1869 #error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
1872 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
1873 !defined(POLARSSL_ECDH_C)
1874 #error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
1877 #if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
1878 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
1879 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
1880 #error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
1883 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
1884 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
1885 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
1886 #error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
1889 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
1890 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
1891 !defined(POLARSSL_X509_CRT_PARSE_C) )
1892 #error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
1895 #if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
1896 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
1897 !defined(POLARSSL_PKCS1_V15) )
1898 #error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
1901 #if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
1902 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
1903 !defined(POLARSSL_PKCS1_V15) )
1904 #error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
1907 #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && !defined(POLARSSL_MEMORY_C)
1908 #error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
1911 #if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
1912 #error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
1915 #if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
1916 #error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
1919 #if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
1920 #error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
1923 #if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
1924 #error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
1927 #if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
1928 #error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
1931 #if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
1932 #error "POLARSSL_PKCS11_C defined, but not all prerequisites"
1935 #if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
1936 !defined(POLARSSL_OID_C) )
1937 #error "POLARSSL_RSA_C defined, but not all prerequisites"
1940 #if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
1941 !defined(POLARSSL_SHA1_C) )
1942 #error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
1945 #if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
1946 !defined(POLARSSL_SHA1_C) )
1947 #error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
1950 #if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
1951 !defined(POLARSSL_SHA1_C) )
1952 #error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
1955 #if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
1956 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
1957 #error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
1960 #if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
1961 #error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
1964 #if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
1965 !defined(POLARSSL_MD_C) )
1966 #error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
1969 #if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
1970 #error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
1973 #if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
1974 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
1975 !defined(POLARSSL_SSL_PROTO_TLS1_2))
1976 #error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
1979 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
1980 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
1981 #error "Illegal protocol selection"
1984 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
1985 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
1986 #error "Illegal protocol selection"
1989 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
1990 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
1991 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
1992 #error "Illegal protocol selection"
1995 #if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
1996 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
1997 !defined(POLARSSL_CIPHER_MODE_CBC) )
1998 #error "POLARSSL_SSL_SESSION_TICKETS_C defined, but not all prerequisites"
2001 #if defined(POLARSSL_THREADING_DUMMY)
2002 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
2003 #error "POLARSSL_THREADING_DUMMY defined, but not all prerequisites"
2005 #define POLARSSL_THREADING_IMPL
2008 #if defined(POLARSSL_THREADING_PTHREAD)
2009 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
2010 #error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
2012 #define POLARSSL_THREADING_IMPL
2015 #if defined(POLARSSL_THREADING_ALT)
2016 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
2017 #error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
2019 #define POLARSSL_THREADING_IMPL
2022 #if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
2023 #error "POLARSSL_THREADING_C defined, single threading implementation required"
2025 #undef POLARSSL_THREADING_IMPL
2027 #if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
2028 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
2029 !defined(POLARSSL_PK_PARSE_C) )
2030 #error "POLARSSL_X509_USE_C defined, but not all prerequisites"
2033 #if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
2034 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
2035 !defined(POLARSSL_PK_WRITE_C) )
2036 #error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
2039 #if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
2040 #error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
2043 #if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
2044 #error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
2047 #if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
2048 #error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
2051 #if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
2052 #error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
2055 #if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
2056 #error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"