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
103 #define POLARSSL_HAVE_TIME
115 #define POLARSSL_HAVE_IPV6
170 #define POLARSSL_CIPHER_MODE_CBC
177 #define POLARSSL_CIPHER_MODE_CFB
184 #define POLARSSL_CIPHER_MODE_CTR
229 #define POLARSSL_CIPHER_PADDING_PKCS7
230 #define POLARSSL_CIPHER_PADDING_ONE_AND_ZEROS
231 #define POLARSSL_CIPHER_PADDING_ZEROS_AND_LEN
232 #define POLARSSL_CIPHER_PADDING_ZEROS
257 #define POLARSSL_ECP_DP_SECP192R1_ENABLED
258 #define POLARSSL_ECP_DP_SECP224R1_ENABLED
259 #define POLARSSL_ECP_DP_SECP256R1_ENABLED
260 #define POLARSSL_ECP_DP_SECP384R1_ENABLED
261 #define POLARSSL_ECP_DP_SECP521R1_ENABLED
262 #define POLARSSL_ECP_DP_BP256R1_ENABLED
263 #define POLARSSL_ECP_DP_BP384R1_ENABLED
264 #define POLARSSL_ECP_DP_BP512R1_ENABLED
266 #define POLARSSL_ECP_DP_M255_ENABLED
279 #define POLARSSL_ECP_NIST_OPTIM
301 #define POLARSSL_KEY_EXCHANGE_PSK_ENABLED
325 #define POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED
345 #define POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED
370 #define POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED
398 #define POLARSSL_KEY_EXCHANGE_RSA_ENABLED
424 #define POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED
449 #define POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED
473 #define POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
497 #define POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
521 #define POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED
532 #define POLARSSL_ERROR_STRERROR_BC
543 #define POLARSSL_ERROR_STRERROR_DUMMY
552 #define POLARSSL_GENPRIME
559 #define POLARSSL_FS_IO
620 #define POLARSSL_PKCS1_V15
631 #define POLARSSL_PKCS1_V21
648 #define POLARSSL_SELF_TEST
662 #define POLARSSL_SSL_ALERT_MESSAGES
698 #define POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
717 #define POLARSSL_SSL_MAX_FRAGMENT_LENGTH
729 #define POLARSSL_SSL_PROTO_SSL3
741 #define POLARSSL_SSL_PROTO_TLS1
753 #define POLARSSL_SSL_PROTO_TLS1_1
765 #define POLARSSL_SSL_PROTO_TLS1_2
778 #define POLARSSL_SSL_SESSION_TICKETS
787 #define POLARSSL_SSL_SERVER_NAME_INDICATION
796 #define POLARSSL_SSL_TRUNCATED_HMAC
876 #define POLARSSL_AESNI_C
951 #define POLARSSL_AES_C
974 #define POLARSSL_ARC4_C
988 #define POLARSSL_ASN1_PARSE_C
1002 #define POLARSSL_ASN1_WRITE_C
1014 #define POLARSSL_BASE64_C
1029 #define POLARSSL_BIGNUM_C
1038 #define POLARSSL_BLOWFISH_C
1093 #define POLARSSL_CAMELLIA_C
1107 #define POLARSSL_CERTS_C
1119 #define POLARSSL_CIPHER_C
1133 #define POLARSSL_CTR_DRBG_C
1147 #define POLARSSL_DEBUG_C
1173 #define POLARSSL_DES_C
1187 #define POLARSSL_DHM_C
1203 #define POLARSSL_ECDH_C
1218 #define POLARSSL_ECDSA_C
1231 #define POLARSSL_ECP_C
1245 #define POLARSSL_ENTROPY_C
1257 #define POLARSSL_ERROR_C
1271 #define POLARSSL_GCM_C
1306 #define POLARSSL_MD_C
1345 #define POLARSSL_MD5_C
1385 #define POLARSSL_NET_C
1408 #define POLARSSL_OID_C
1422 #define POLARSSL_PADLOCK_C
1436 #define POLARSSL_PBKDF2_C
1454 #define POLARSSL_PEM_PARSE_C
1470 #define POLARSSL_PEM_WRITE_C
1486 #define POLARSSL_PK_C
1501 #define POLARSSL_PK_PARSE_C
1515 #define POLARSSL_PK_WRITE_C
1528 #define POLARSSL_PKCS5_C
1559 #define POLARSSL_PKCS12_C
1577 #define POLARSSL_RSA_C
1593 #define POLARSSL_SHA1_C
1611 #define POLARSSL_SHA256_C
1627 #define POLARSSL_SHA512_C
1639 #define POLARSSL_SSL_CACHE_C
1653 #define POLARSSL_SSL_CLI_C
1667 #define POLARSSL_SSL_SRV_C
1683 #define POLARSSL_SSL_TLS_C
1716 #define POLARSSL_TIMING_C
1727 #define POLARSSL_VERSION_C
1744 #define POLARSSL_X509_USE_C
1760 #define POLARSSL_X509_CRT_PARSE_C
1774 #define POLARSSL_X509_CRL_PARSE_C
1788 #define POLARSSL_X509_CSR_PARSE_C
1801 #define POLARSSL_X509_CREATE_C
1814 #define POLARSSL_X509_CRT_WRITE_C
1827 #define POLARSSL_X509_CSR_WRITE_C
1837 #define POLARSSL_XTEA_C
1861 #if defined(POLARSSL_CONFIG_OPTIONS)
1865 #define POLARSSL_MPI_WINDOW_SIZE 6
1866 #define POLARSSL_MPI_MAX_SIZE 512
1870 #define CTR_DRBG_ENTROPY_LEN 48
1871 #define CTR_DRBG_RESEED_INTERVAL 10000
1872 #define CTR_DRBG_MAX_INPUT 256
1873 #define CTR_DRBG_MAX_REQUEST 1024
1874 #define CTR_DRBG_MAX_SEED_INPUT 384
1878 #define POLARSSL_ECP_MAX_BITS 521
1879 #define POLARSSL_ECP_WINDOW_SIZE 6
1880 #define POLARSSL_ECP_FIXED_POINT_OPTIM 1
1884 #define ENTROPY_MAX_SOURCES 20
1885 #define ENTROPY_MAX_GATHER 128
1888 #define MEMORY_ALIGN_MULTIPLE 4
1889 #define POLARSSL_MEMORY_STDMALLOC malloc
1890 #define POLARSSL_MEMORY_STDFREE free
1892 // SSL Cache options
1894 #define SSL_CACHE_DEFAULT_TIMEOUT 86400
1895 #define SSL_CACHE_DEFAULT_MAX_ENTRIES 50
1899 #define SSL_MAX_CONTENT_LEN 16384
1900 #define SSL_DEFAULT_TICKET_LIFETIME 86400
1909 #if defined(POLARSSL_AESNI_C) && !defined(POLARSSL_HAVE_ASM)
1910 #error "POLARSSL_AESNI_C defined, but not all prerequisites"
1913 #if defined(POLARSSL_CERTS_C) && !defined(POLARSSL_PEM_PARSE_C)
1914 #error "POLARSSL_CERTS_C defined, but not all prerequisites"
1917 #if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
1918 #error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
1921 #if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
1922 #error "POLARSSL_DHM_C defined, but not all prerequisites"
1925 #if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
1926 #error "POLARSSL_ECDH_C defined, but not all prerequisites"
1929 #if defined(POLARSSL_ECDSA_C) && \
1930 ( !defined(POLARSSL_ECP_C) || \
1931 !defined(POLARSSL_ASN1_PARSE_C) || \
1932 !defined(POLARSSL_ASN1_WRITE_C) )
1933 #error "POLARSSL_ECDSA_C defined, but not all prerequisites"
1936 #if defined(POLARSSL_ECP_C) && ( !defined(POLARSSL_BIGNUM_C) || ( \
1937 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
1938 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
1939 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
1940 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
1941 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
1942 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
1943 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
1944 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) ) )
1945 #error "POLARSSL_ECP_C defined, but not all prerequisites"
1948 #if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
1949 !defined(POLARSSL_SHA256_C))
1950 #error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
1952 #if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
1953 defined(POLARSSL_CONFIG_OPTIONS) && (CTR_DRBG_ENTROPY_LEN > 64)
1954 #error "CTR_DRBG_ENTROPY_LEN value too high"
1956 #if defined(POLARSSL_ENTROPY_C) && !defined(POLARSSL_SHA512_C) && \
1957 defined(POLARSSL_CONFIG_OPTIONS) && (CTR_DRBG_ENTROPY_LEN > 32)
1958 #error "CTR_DRBG_ENTROPY_LEN value too high"
1961 #if defined(POLARSSL_GCM_C) && ( \
1962 !defined(POLARSSL_AES_C) && !defined(POLARSSL_CAMELLIA_C) )
1963 #error "POLARSSL_GCM_C defined, but not all prerequisites"
1966 #if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
1967 #error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
1970 #if defined(POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
1971 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
1972 #error "POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
1975 #if defined(POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
1976 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
1977 #error "POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
1980 #if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
1981 #error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
1984 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
1985 !defined(POLARSSL_ECDH_C)
1986 #error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
1989 #if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
1990 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
1991 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
1992 #error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
1995 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
1996 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
1997 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
1998 #error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
2001 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
2002 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
2003 !defined(POLARSSL_X509_CRT_PARSE_C) )
2004 #error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
2007 #if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
2008 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
2009 !defined(POLARSSL_PKCS1_V15) )
2010 #error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
2013 #if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
2014 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
2015 !defined(POLARSSL_PKCS1_V15) )
2016 #error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
2019 #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && !defined(POLARSSL_MEMORY_C)
2020 #error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
2023 #if defined(POLARSSL_PADLOCK_C) && !defined(POLARSSL_HAVE_ASM)
2024 #error "POLARSSL_PADLOCK_C defined, but not all prerequisites"
2027 #if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
2028 #error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
2031 #if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
2032 #error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
2035 #if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
2036 #error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
2039 #if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
2040 #error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
2043 #if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
2044 #error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
2047 #if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
2048 #error "POLARSSL_PKCS11_C defined, but not all prerequisites"
2051 #if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
2052 !defined(POLARSSL_OID_C) )
2053 #error "POLARSSL_RSA_C defined, but not all prerequisites"
2056 #if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
2057 !defined(POLARSSL_SHA1_C) )
2058 #error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
2061 #if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
2062 !defined(POLARSSL_SHA1_C) )
2063 #error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
2066 #if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
2067 !defined(POLARSSL_SHA1_C) )
2068 #error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
2071 #if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
2072 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
2073 #error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
2076 #if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
2077 #error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
2080 #if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
2081 !defined(POLARSSL_MD_C) )
2082 #error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
2085 #if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
2086 #error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
2089 #if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
2090 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
2091 !defined(POLARSSL_SSL_PROTO_TLS1_2))
2092 #error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
2095 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
2096 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
2097 #error "Illegal protocol selection"
2100 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
2101 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
2102 #error "Illegal protocol selection"
2105 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
2106 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
2107 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
2108 #error "Illegal protocol selection"
2111 #if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
2112 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
2113 !defined(POLARSSL_CIPHER_MODE_CBC) )
2114 #error "POLARSSL_SSL_SESSION_TICKETS_C defined, but not all prerequisites"
2117 #if defined(POLARSSL_THREADING_PTHREAD)
2118 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
2119 #error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
2121 #define POLARSSL_THREADING_IMPL
2124 #if defined(POLARSSL_THREADING_ALT)
2125 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
2126 #error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
2128 #define POLARSSL_THREADING_IMPL
2131 #if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
2132 #error "POLARSSL_THREADING_C defined, single threading implementation required"
2134 #undef POLARSSL_THREADING_IMPL
2136 #if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
2137 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
2138 !defined(POLARSSL_PK_PARSE_C) )
2139 #error "POLARSSL_X509_USE_C defined, but not all prerequisites"
2142 #if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
2143 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
2144 !defined(POLARSSL_PK_WRITE_C) )
2145 #error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
2148 #if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
2149 #error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
2152 #if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
2153 #error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
2156 #if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
2157 #error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
2160 #if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
2161 #error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
2164 #if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
2165 #error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"