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
225 #define POLARSSL_CIPHER_PADDING_PKCS7
226 #define POLARSSL_CIPHER_PADDING_ONE_AND_ZEROS
227 #define POLARSSL_CIPHER_PADDING_ZEROS_AND_LEN
228 #define POLARSSL_CIPHER_PADDING_ZEROS
253 #define POLARSSL_ECP_DP_SECP192R1_ENABLED
254 #define POLARSSL_ECP_DP_SECP224R1_ENABLED
255 #define POLARSSL_ECP_DP_SECP256R1_ENABLED
256 #define POLARSSL_ECP_DP_SECP384R1_ENABLED
257 #define POLARSSL_ECP_DP_SECP521R1_ENABLED
258 #define POLARSSL_ECP_DP_BP256R1_ENABLED
259 #define POLARSSL_ECP_DP_BP384R1_ENABLED
260 #define POLARSSL_ECP_DP_BP512R1_ENABLED
278 #define POLARSSL_KEY_EXCHANGE_PSK_ENABLED
298 #define POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED
318 #define POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED
339 #define POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED
365 #define POLARSSL_KEY_EXCHANGE_RSA_ENABLED
387 #define POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED
410 #define POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED
432 #define POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
443 #define POLARSSL_ERROR_STRERROR_BC
454 #define POLARSSL_ERROR_STRERROR_DUMMY
463 #define POLARSSL_GENPRIME
470 #define POLARSSL_FS_IO
531 #define POLARSSL_PKCS1_V15
542 #define POLARSSL_PKCS1_V21
559 #define POLARSSL_SELF_TEST
573 #define POLARSSL_SSL_ALERT_MESSAGES
609 #define POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
618 #define POLARSSL_SSL_MAX_FRAGMENT_LENGTH
630 #define POLARSSL_SSL_PROTO_SSL3
642 #define POLARSSL_SSL_PROTO_TLS1
654 #define POLARSSL_SSL_PROTO_TLS1_1
666 #define POLARSSL_SSL_PROTO_TLS1_2
679 #define POLARSSL_SSL_SESSION_TICKETS
688 #define POLARSSL_SSL_SERVER_NAME_INDICATION
697 #define POLARSSL_SSL_TRUNCATED_HMAC
807 #define POLARSSL_AES_C
824 #define POLARSSL_ARC4_C
838 #define POLARSSL_ASN1_PARSE_C
852 #define POLARSSL_ASN1_WRITE_C
864 #define POLARSSL_BASE64_C
879 #define POLARSSL_BIGNUM_C
888 #define POLARSSL_BLOWFISH_C
909 #define POLARSSL_CAMELLIA_C
921 #define POLARSSL_CERTS_C
933 #define POLARSSL_CIPHER_C
947 #define POLARSSL_CTR_DRBG_C
961 #define POLARSSL_DEBUG_C
981 #define POLARSSL_DES_C
1007 #define POLARSSL_DHM_C
1028 #define POLARSSL_ECDH_C
1040 #define POLARSSL_ECDSA_C
1053 #define POLARSSL_ECP_C
1067 #define POLARSSL_ENTROPY_C
1079 #define POLARSSL_ERROR_C
1095 #define POLARSSL_GCM_C
1130 #define POLARSSL_MD_C
1169 #define POLARSSL_MD5_C
1209 #define POLARSSL_NET_C
1232 #define POLARSSL_OID_C
1244 #define POLARSSL_PADLOCK_C
1258 #define POLARSSL_PBKDF2_C
1276 #define POLARSSL_PEM_PARSE_C
1292 #define POLARSSL_PEM_WRITE_C
1308 #define POLARSSL_PK_C
1323 #define POLARSSL_PK_PARSE_C
1337 #define POLARSSL_PK_WRITE_C
1350 #define POLARSSL_PKCS5_C
1381 #define POLARSSL_PKCS12_C
1398 #define POLARSSL_RSA_C
1414 #define POLARSSL_SHA1_C
1432 #define POLARSSL_SHA256_C
1448 #define POLARSSL_SHA512_C
1460 #define POLARSSL_SSL_CACHE_C
1474 #define POLARSSL_SSL_CLI_C
1488 #define POLARSSL_SSL_SRV_C
1504 #define POLARSSL_SSL_TLS_C
1537 #define POLARSSL_TIMING_C
1548 #define POLARSSL_VERSION_C
1565 #define POLARSSL_X509_USE_C
1581 #define POLARSSL_X509_CRT_PARSE_C
1595 #define POLARSSL_X509_CRL_PARSE_C
1609 #define POLARSSL_X509_CSR_PARSE_C
1622 #define POLARSSL_X509_CREATE_C
1635 #define POLARSSL_X509_CRT_WRITE_C
1648 #define POLARSSL_X509_CSR_WRITE_C
1658 #define POLARSSL_XTEA_C
1682 #if defined(POLARSSL_CONFIG_OPTIONS)
1686 #define POLARSSL_MPI_WINDOW_SIZE 6
1687 #define POLARSSL_MPI_MAX_SIZE 512
1691 #define CTR_DRBG_ENTROPY_LEN 48
1692 #define CTR_DRBG_RESEED_INTERVAL 10000
1693 #define CTR_DRBG_MAX_INPUT 256
1694 #define CTR_DRBG_MAX_REQUEST 1024
1695 #define CTR_DRBG_MAX_SEED_INPUT 384
1699 #define ENTROPY_MAX_SOURCES 20
1700 #define ENTROPY_MAX_GATHER 128
1703 #define MEMORY_ALIGN_MULTIPLE 4
1704 #define POLARSSL_MEMORY_STDMALLOC malloc
1705 #define POLARSSL_MEMORY_STDFREE free
1707 // SSL Cache options
1709 #define SSL_CACHE_DEFAULT_TIMEOUT 86400
1710 #define SSL_CACHE_DEFAULT_MAX_ENTRIES 50
1714 #define SSL_MAX_CONTENT_LEN 16384
1715 #define SSL_DEFAULT_TICKET_LIFETIME 86400
1724 #if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
1725 #error "POLARSSL_DHM_C defined, but not all prerequisites"
1728 #if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
1729 #error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
1732 #if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
1733 #error "POLARSSL_ECDH_C defined, but not all prerequisites"
1736 #if defined(POLARSSL_ECDSA_C) && \
1737 ( !defined(POLARSSL_ECP_C) || \
1738 !defined(POLARSSL_ASN1_PARSE_C) || \
1739 !defined(POLARSSL_ASN1_WRITE_C) )
1740 #error "POLARSSL_ECDSA_C defined, but not all prerequisites"
1743 #if defined(POLARSSL_ECP_C) && !defined(POLARSSL_BIGNUM_C) || ( \
1744 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
1745 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
1746 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
1747 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
1748 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
1749 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
1750 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
1751 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) )
1752 #error "POLARSSL_ECP_C defined, but not all prerequisites"
1755 #if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
1756 !defined(POLARSSL_SHA256_C))
1757 #error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
1759 #if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
1760 defined(POLARSSL_CONFIG_OPTIONS) && (CTR_DRBG_ENTROPY_LEN > 64)
1761 #error "CTR_DRBG_ENTROPY_LEN value too high"
1763 #if defined(POLARSSL_ENTROPY_C) && !defined(POLARSSL_SHA512_C) && \
1764 defined(POLARSSL_CONFIG_OPTIONS) && (CTR_DRBG_ENTROPY_LEN > 32)
1765 #error "CTR_DRBG_ENTROPY_LEN value too high"
1768 #if defined(POLARSSL_GCM_C) && !defined(POLARSSL_AES_C)
1769 #error "POLARSSL_GCM_C defined, but not all prerequisites"
1772 #if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
1773 #error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
1776 #if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
1777 #error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
1780 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
1781 !defined(POLARSSL_ECDH_C)
1782 #error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
1785 #if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
1786 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
1787 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
1788 #error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
1791 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
1792 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
1793 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
1794 #error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
1797 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
1798 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
1799 !defined(POLARSSL_X509_CRT_PARSE_C) )
1800 #error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
1803 #if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
1804 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
1805 !defined(POLARSSL_PKCS1_V15) )
1806 #error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
1809 #if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
1810 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
1811 !defined(POLARSSL_PKCS1_V15) )
1812 #error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
1815 #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && !defined(POLARSSL_MEMORY_C)
1816 #error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
1819 #if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
1820 #error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
1823 #if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
1824 #error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
1827 #if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
1828 #error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
1831 #if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
1832 #error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
1835 #if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
1836 #error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
1839 #if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
1840 #error "POLARSSL_PKCS11_C defined, but not all prerequisites"
1843 #if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
1844 !defined(POLARSSL_OID_C) )
1845 #error "POLARSSL_RSA_C defined, but not all prerequisites"
1848 #if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
1849 #error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
1852 #if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
1853 !defined(POLARSSL_MD_C) )
1854 #error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
1857 #if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
1858 #error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
1861 #if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
1862 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
1863 !defined(POLARSSL_SSL_PROTO_TLS1_2))
1864 #error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
1867 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
1868 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
1869 #error "Illegal protocol selection"
1872 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
1873 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
1874 #error "Illegal protocol selection"
1877 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
1878 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
1879 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
1880 #error "Illegal protocol selection"
1883 #if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
1884 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
1885 !defined(POLARSSL_CIPHER_MODE_CBC) )
1886 #error "POLARSSL_SSL_SESSION_TICKETS_C defined, but not all prerequisites"
1889 #if defined(POLARSSL_THREADING_DUMMY)
1890 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
1891 #error "POLARSSL_THREADING_DUMMY defined, but not all prerequisites"
1893 #define POLARSSL_THREADING_IMPL
1896 #if defined(POLARSSL_THREADING_PTHREAD)
1897 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
1898 #error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
1900 #define POLARSSL_THREADING_IMPL
1903 #if defined(POLARSSL_THREADING_ALT)
1904 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
1905 #error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
1907 #define POLARSSL_THREADING_IMPL
1910 #if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
1911 #error "POLARSSL_THREADING_C defined, single threading implementation required"
1913 #undef POLARSSL_THREADING_IMPL
1915 #if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
1916 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
1917 !defined(POLARSSL_PK_PARSE_C) )
1918 #error "POLARSSL_X509_USE_C defined, but not all prerequisites"
1921 #if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
1922 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
1923 !defined(POLARSSL_PK_WRITE_C) )
1924 #error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
1927 #if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
1928 #error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
1931 #if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
1932 #error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
1935 #if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
1936 #error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
1939 #if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
1940 #error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
1943 #if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
1944 #error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"