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
171 #define POLARSSL_CIPHER_MODE_CBC
178 #define POLARSSL_CIPHER_MODE_CFB
185 #define POLARSSL_CIPHER_MODE_CTR
230 #define POLARSSL_CIPHER_PADDING_PKCS7
231 #define POLARSSL_CIPHER_PADDING_ONE_AND_ZEROS
232 #define POLARSSL_CIPHER_PADDING_ZEROS_AND_LEN
233 #define POLARSSL_CIPHER_PADDING_ZEROS
258 #define POLARSSL_ECP_DP_SECP192R1_ENABLED
259 #define POLARSSL_ECP_DP_SECP224R1_ENABLED
260 #define POLARSSL_ECP_DP_SECP256R1_ENABLED
261 #define POLARSSL_ECP_DP_SECP384R1_ENABLED
262 #define POLARSSL_ECP_DP_SECP521R1_ENABLED
263 #define POLARSSL_ECP_DP_SECP192K1_ENABLED
264 #define POLARSSL_ECP_DP_SECP224K1_ENABLED
265 #define POLARSSL_ECP_DP_SECP256K1_ENABLED
266 #define POLARSSL_ECP_DP_BP256R1_ENABLED
267 #define POLARSSL_ECP_DP_BP384R1_ENABLED
268 #define POLARSSL_ECP_DP_BP512R1_ENABLED
270 #define POLARSSL_ECP_DP_M255_ENABLED
283 #define POLARSSL_ECP_NIST_OPTIM
297 #define POLARSSL_ECDSA_DETERMINISTIC
319 #define POLARSSL_KEY_EXCHANGE_PSK_ENABLED
343 #define POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED
363 #define POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED
388 #define POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED
416 #define POLARSSL_KEY_EXCHANGE_RSA_ENABLED
442 #define POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED
467 #define POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED
491 #define POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
515 #define POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
539 #define POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED
550 #define POLARSSL_ERROR_STRERROR_BC
561 #define POLARSSL_ERROR_STRERROR_DUMMY
570 #define POLARSSL_GENPRIME
577 #define POLARSSL_FS_IO
638 #define POLARSSL_PKCS1_V15
649 #define POLARSSL_PKCS1_V21
666 #define POLARSSL_SELF_TEST
680 #define POLARSSL_SSL_ALERT_MESSAGES
716 #define POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
735 #define POLARSSL_SSL_MAX_FRAGMENT_LENGTH
747 #define POLARSSL_SSL_PROTO_SSL3
759 #define POLARSSL_SSL_PROTO_TLS1
771 #define POLARSSL_SSL_PROTO_TLS1_1
783 #define POLARSSL_SSL_PROTO_TLS1_2
796 #define POLARSSL_SSL_SESSION_TICKETS
805 #define POLARSSL_SSL_SERVER_NAME_INDICATION
814 #define POLARSSL_SSL_TRUNCATED_HMAC
894 #define POLARSSL_AESNI_C
969 #define POLARSSL_AES_C
992 #define POLARSSL_ARC4_C
1006 #define POLARSSL_ASN1_PARSE_C
1020 #define POLARSSL_ASN1_WRITE_C
1032 #define POLARSSL_BASE64_C
1047 #define POLARSSL_BIGNUM_C
1056 #define POLARSSL_BLOWFISH_C
1111 #define POLARSSL_CAMELLIA_C
1125 #define POLARSSL_CERTS_C
1137 #define POLARSSL_CIPHER_C
1151 #define POLARSSL_CTR_DRBG_C
1165 #define POLARSSL_DEBUG_C
1191 #define POLARSSL_DES_C
1205 #define POLARSSL_DHM_C
1221 #define POLARSSL_ECDH_C
1236 #define POLARSSL_ECDSA_C
1249 #define POLARSSL_ECP_C
1263 #define POLARSSL_ENTROPY_C
1275 #define POLARSSL_ERROR_C
1289 #define POLARSSL_GCM_C
1324 #define POLARSSL_MD_C
1363 #define POLARSSL_MD5_C
1403 #define POLARSSL_NET_C
1426 #define POLARSSL_OID_C
1440 #define POLARSSL_PADLOCK_C
1454 #define POLARSSL_PBKDF2_C
1472 #define POLARSSL_PEM_PARSE_C
1488 #define POLARSSL_PEM_WRITE_C
1504 #define POLARSSL_PK_C
1519 #define POLARSSL_PK_PARSE_C
1533 #define POLARSSL_PK_WRITE_C
1546 #define POLARSSL_PKCS5_C
1577 #define POLARSSL_PKCS12_C
1588 #define POLARSSL_RIPEMD160_C
1606 #define POLARSSL_RSA_C
1622 #define POLARSSL_SHA1_C
1640 #define POLARSSL_SHA256_C
1656 #define POLARSSL_SHA512_C
1668 #define POLARSSL_SSL_CACHE_C
1682 #define POLARSSL_SSL_CLI_C
1696 #define POLARSSL_SSL_SRV_C
1712 #define POLARSSL_SSL_TLS_C
1745 #define POLARSSL_TIMING_C
1756 #define POLARSSL_VERSION_C
1773 #define POLARSSL_X509_USE_C
1789 #define POLARSSL_X509_CRT_PARSE_C
1803 #define POLARSSL_X509_CRL_PARSE_C
1817 #define POLARSSL_X509_CSR_PARSE_C
1830 #define POLARSSL_X509_CREATE_C
1843 #define POLARSSL_X509_CRT_WRITE_C
1856 #define POLARSSL_X509_CSR_WRITE_C
1866 #define POLARSSL_XTEA_C
1890 #if defined(POLARSSL_CONFIG_OPTIONS)
1894 #define POLARSSL_MPI_WINDOW_SIZE 6
1895 #define POLARSSL_MPI_MAX_SIZE 512
1899 #define CTR_DRBG_ENTROPY_LEN 48
1900 #define CTR_DRBG_RESEED_INTERVAL 10000
1901 #define CTR_DRBG_MAX_INPUT 256
1902 #define CTR_DRBG_MAX_REQUEST 1024
1903 #define CTR_DRBG_MAX_SEED_INPUT 384
1907 #define POLARSSL_ECP_MAX_BITS 521
1908 #define POLARSSL_ECP_WINDOW_SIZE 6
1909 #define POLARSSL_ECP_FIXED_POINT_OPTIM 1
1913 #define ENTROPY_MAX_SOURCES 20
1914 #define ENTROPY_MAX_GATHER 128
1917 #define MEMORY_ALIGN_MULTIPLE 4
1918 #define POLARSSL_MEMORY_STDMALLOC malloc
1919 #define POLARSSL_MEMORY_STDFREE free
1921 // SSL Cache options
1923 #define SSL_CACHE_DEFAULT_TIMEOUT 86400
1924 #define SSL_CACHE_DEFAULT_MAX_ENTRIES 50
1928 #define SSL_MAX_CONTENT_LEN 16384
1929 #define SSL_DEFAULT_TICKET_LIFETIME 86400
1938 #if defined(POLARSSL_AESNI_C) && !defined(POLARSSL_HAVE_ASM)
1939 #error "POLARSSL_AESNI_C defined, but not all prerequisites"
1942 #if defined(POLARSSL_CERTS_C) && !defined(POLARSSL_PEM_PARSE_C)
1943 #error "POLARSSL_CERTS_C defined, but not all prerequisites"
1946 #if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
1947 #error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
1950 #if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
1951 #error "POLARSSL_DHM_C defined, but not all prerequisites"
1954 #if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
1955 #error "POLARSSL_ECDH_C defined, but not all prerequisites"
1958 #if defined(POLARSSL_ECDSA_C) && \
1959 ( !defined(POLARSSL_ECP_C) || \
1960 !defined(POLARSSL_ASN1_PARSE_C) || \
1961 !defined(POLARSSL_ASN1_WRITE_C) )
1962 #error "POLARSSL_ECDSA_C defined, but not all prerequisites"
1965 #if defined(POLARSSL_ECDSA_DETERMINISTIC) && !defined(POLARSSL_MD_C)
1966 #error "POLARSSL_ECDSA_DETERMINISTIC defined, but not all prerequisites"
1969 #if defined(POLARSSL_ECP_C) && ( !defined(POLARSSL_BIGNUM_C) || ( \
1970 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
1971 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
1972 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
1973 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
1974 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
1975 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
1976 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
1977 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) ) )
1978 #error "POLARSSL_ECP_C defined, but not all prerequisites"
1981 #if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
1982 !defined(POLARSSL_SHA256_C))
1983 #error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
1985 #if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
1986 defined(POLARSSL_CONFIG_OPTIONS) && (CTR_DRBG_ENTROPY_LEN > 64)
1987 #error "CTR_DRBG_ENTROPY_LEN value too high"
1989 #if defined(POLARSSL_ENTROPY_C) && !defined(POLARSSL_SHA512_C) && \
1990 defined(POLARSSL_CONFIG_OPTIONS) && (CTR_DRBG_ENTROPY_LEN > 32)
1991 #error "CTR_DRBG_ENTROPY_LEN value too high"
1994 #if defined(POLARSSL_GCM_C) && ( \
1995 !defined(POLARSSL_AES_C) && !defined(POLARSSL_CAMELLIA_C) )
1996 #error "POLARSSL_GCM_C defined, but not all prerequisites"
1999 #if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
2000 #error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
2003 #if defined(POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
2004 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
2005 #error "POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
2008 #if defined(POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
2009 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
2010 #error "POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
2013 #if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
2014 #error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
2017 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
2018 !defined(POLARSSL_ECDH_C)
2019 #error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
2022 #if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
2023 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
2024 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
2025 #error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
2028 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
2029 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
2030 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
2031 #error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
2034 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
2035 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
2036 !defined(POLARSSL_X509_CRT_PARSE_C) )
2037 #error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
2040 #if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
2041 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
2042 !defined(POLARSSL_PKCS1_V15) )
2043 #error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
2046 #if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
2047 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
2048 !defined(POLARSSL_PKCS1_V15) )
2049 #error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
2052 #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && !defined(POLARSSL_MEMORY_C)
2053 #error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
2056 #if defined(POLARSSL_PADLOCK_C) && !defined(POLARSSL_HAVE_ASM)
2057 #error "POLARSSL_PADLOCK_C defined, but not all prerequisites"
2060 #if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
2061 #error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
2064 #if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
2065 #error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
2068 #if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
2069 #error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
2072 #if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
2073 #error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
2076 #if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
2077 #error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
2080 #if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
2081 #error "POLARSSL_PKCS11_C defined, but not all prerequisites"
2084 #if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
2085 !defined(POLARSSL_OID_C) )
2086 #error "POLARSSL_RSA_C defined, but not all prerequisites"
2089 #if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
2090 !defined(POLARSSL_SHA1_C) )
2091 #error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
2094 #if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
2095 !defined(POLARSSL_SHA1_C) )
2096 #error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
2099 #if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
2100 !defined(POLARSSL_SHA1_C) )
2101 #error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
2104 #if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
2105 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
2106 #error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
2109 #if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
2110 #error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
2113 #if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
2114 !defined(POLARSSL_MD_C) )
2115 #error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
2118 #if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
2119 #error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
2122 #if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
2123 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
2124 !defined(POLARSSL_SSL_PROTO_TLS1_2))
2125 #error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
2128 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
2129 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
2130 #error "Illegal protocol selection"
2133 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
2134 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
2135 #error "Illegal protocol selection"
2138 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
2139 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
2140 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
2141 #error "Illegal protocol selection"
2144 #if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
2145 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
2146 !defined(POLARSSL_CIPHER_MODE_CBC) )
2147 #error "POLARSSL_SSL_SESSION_TICKETS_C defined, but not all prerequisites"
2150 #if defined(POLARSSL_THREADING_PTHREAD)
2151 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
2152 #error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
2154 #define POLARSSL_THREADING_IMPL
2157 #if defined(POLARSSL_THREADING_ALT)
2158 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
2159 #error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
2161 #define POLARSSL_THREADING_IMPL
2164 #if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
2165 #error "POLARSSL_THREADING_C defined, single threading implementation required"
2167 #undef POLARSSL_THREADING_IMPL
2169 #if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
2170 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
2171 !defined(POLARSSL_PK_PARSE_C) )
2172 #error "POLARSSL_X509_USE_C defined, but not all prerequisites"
2175 #if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
2176 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
2177 !defined(POLARSSL_PK_WRITE_C) )
2178 #error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
2181 #if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
2182 #error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
2185 #if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
2186 #error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
2189 #if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
2190 #error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
2193 #if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
2194 #error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
2197 #if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
2198 #error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"