00001
00031 #ifndef POLARSSL_CONFIG_H
00032 #define POLARSSL_CONFIG_H
00033
00034 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
00035 #define _CRT_SECURE_NO_DEPRECATE 1
00036 #endif
00037
00052
00053
00061
00062
00069 #define POLARSSL_HAVE_LONGLONG
00070
00085 #define POLARSSL_HAVE_ASM
00086
00094
00095
00105 #define POLARSSL_HAVE_READDIR_R
00106
00114 #define POLARSSL_HAVE_TIME
00115
00116
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00162
00163
00169 #define POLARSSL_CIPHER_MODE_CBC
00170
00176 #define POLARSSL_CIPHER_MODE_CFB
00177
00183 #define POLARSSL_CIPHER_MODE_CTR
00184
00226 #define POLARSSL_CIPHER_PADDING_PKCS7
00227 #define POLARSSL_CIPHER_PADDING_ONE_AND_ZEROS
00228 #define POLARSSL_CIPHER_PADDING_ZEROS_AND_LEN
00229 #define POLARSSL_CIPHER_PADDING_ZEROS
00230
00254 #define POLARSSL_ECP_DP_SECP192R1_ENABLED
00255 #define POLARSSL_ECP_DP_SECP224R1_ENABLED
00256 #define POLARSSL_ECP_DP_SECP256R1_ENABLED
00257 #define POLARSSL_ECP_DP_SECP384R1_ENABLED
00258 #define POLARSSL_ECP_DP_SECP521R1_ENABLED
00259 #define POLARSSL_ECP_DP_BP256R1_ENABLED
00260 #define POLARSSL_ECP_DP_BP384R1_ENABLED
00261 #define POLARSSL_ECP_DP_BP512R1_ENABLED
00262
00272 #define POLARSSL_ECP_NIST_OPTIM
00273
00294 #define POLARSSL_KEY_EXCHANGE_PSK_ENABLED
00295
00318 #define POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED
00319
00338 #define POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED
00339
00363 #define POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED
00364
00391 #define POLARSSL_KEY_EXCHANGE_RSA_ENABLED
00392
00417 #define POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED
00418
00442 #define POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED
00443
00466 #define POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
00467
00477 #define POLARSSL_ERROR_STRERROR_BC
00478
00488 #define POLARSSL_ERROR_STRERROR_DUMMY
00489
00497 #define POLARSSL_GENPRIME
00498
00504 #define POLARSSL_FS_IO
00505
00517
00518
00528
00529
00542
00543
00554
00555
00565 #define POLARSSL_PKCS1_V15
00566
00576 #define POLARSSL_PKCS1_V21
00577
00586
00587
00593 #define POLARSSL_SELF_TEST
00594
00607 #define POLARSSL_SSL_ALERT_MESSAGES
00608
00623
00624
00633
00634
00643 #define POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
00644
00652 #define POLARSSL_SSL_MAX_FRAGMENT_LENGTH
00653
00664 #define POLARSSL_SSL_PROTO_SSL3
00665
00676 #define POLARSSL_SSL_PROTO_TLS1
00677
00688 #define POLARSSL_SSL_PROTO_TLS1_1
00689
00700 #define POLARSSL_SSL_PROTO_TLS1_2
00701
00713 #define POLARSSL_SSL_SESSION_TICKETS
00714
00722 #define POLARSSL_SSL_SERVER_NAME_INDICATION
00723
00731 #define POLARSSL_SSL_TRUNCATED_HMAC
00732
00742
00743
00755
00756
00766
00767
00776
00777
00786
00787
00802
00803
00804
00873 #define POLARSSL_AES_C
00874
00894 #define POLARSSL_ARC4_C
00895
00908 #define POLARSSL_ASN1_PARSE_C
00909
00922 #define POLARSSL_ASN1_WRITE_C
00923
00934 #define POLARSSL_BASE64_C
00935
00949 #define POLARSSL_BIGNUM_C
00950
00958 #define POLARSSL_BLOWFISH_C
00959
01005 #define POLARSSL_CAMELLIA_C
01006
01019 #define POLARSSL_CERTS_C
01020
01031 #define POLARSSL_CIPHER_C
01032
01045 #define POLARSSL_CTR_DRBG_C
01046
01059 #define POLARSSL_DEBUG_C
01060
01083 #define POLARSSL_DES_C
01084
01097 #define POLARSSL_DHM_C
01098
01113 #define POLARSSL_ECDH_C
01114
01128 #define POLARSSL_ECDSA_C
01129
01141 #define POLARSSL_ECP_C
01142
01155 #define POLARSSL_ENTROPY_C
01156
01167 #define POLARSSL_ERROR_C
01168
01181 #define POLARSSL_GCM_C
01182
01204
01205
01216 #define POLARSSL_MD_C
01217
01228
01229
01240
01241
01255 #define POLARSSL_MD5_C
01256
01269
01270
01284
01285
01295 #define POLARSSL_NET_C
01296
01318 #define POLARSSL_OID_C
01319
01330 #define POLARSSL_PADLOCK_C
01331
01344 #define POLARSSL_PBKDF2_C
01345
01362 #define POLARSSL_PEM_PARSE_C
01363
01378 #define POLARSSL_PEM_WRITE_C
01379
01394 #define POLARSSL_PK_C
01395
01409 #define POLARSSL_PK_PARSE_C
01410
01423 #define POLARSSL_PK_WRITE_C
01424
01436 #define POLARSSL_PKCS5_C
01437
01451
01452
01467 #define POLARSSL_PKCS12_C
01468
01485 #define POLARSSL_RSA_C
01486
01501 #define POLARSSL_SHA1_C
01502
01519 #define POLARSSL_SHA256_C
01520
01535 #define POLARSSL_SHA512_C
01536
01547 #define POLARSSL_SSL_CACHE_C
01548
01561 #define POLARSSL_SSL_CLI_C
01562
01575 #define POLARSSL_SSL_SRV_C
01576
01591 #define POLARSSL_SSL_TLS_C
01592
01612
01613
01624 #define POLARSSL_TIMING_C
01625
01635 #define POLARSSL_VERSION_C
01636
01652 #define POLARSSL_X509_USE_C
01653
01668 #define POLARSSL_X509_CRT_PARSE_C
01669
01682 #define POLARSSL_X509_CRL_PARSE_C
01683
01696 #define POLARSSL_X509_CSR_PARSE_C
01697
01709 #define POLARSSL_X509_CREATE_C
01710
01722 #define POLARSSL_X509_CRT_WRITE_C
01723
01735 #define POLARSSL_X509_CSR_WRITE_C
01736
01745 #define POLARSSL_XTEA_C
01746
01747
01748
01767
01768
01769 #if defined(POLARSSL_CONFIG_OPTIONS)
01770
01771
01772
01773 #define POLARSSL_MPI_WINDOW_SIZE 6
01774 #define POLARSSL_MPI_MAX_SIZE 512
01776 // CTR_DRBG options
01777
01778 #define CTR_DRBG_ENTROPY_LEN 48
01779 #define CTR_DRBG_RESEED_INTERVAL 10000
01780 #define CTR_DRBG_MAX_INPUT 256
01781 #define CTR_DRBG_MAX_REQUEST 1024
01782 #define CTR_DRBG_MAX_SEED_INPUT 384
01784 // Entropy options
01785
01786 #define ENTROPY_MAX_SOURCES 20
01787 #define ENTROPY_MAX_GATHER 128
01789 // Memory options
01790 #define MEMORY_ALIGN_MULTIPLE 4
01791 #define POLARSSL_MEMORY_STDMALLOC malloc
01792 #define POLARSSL_MEMORY_STDFREE free
01794 // SSL Cache options
01795
01796 #define SSL_CACHE_DEFAULT_TIMEOUT 86400
01797 #define SSL_CACHE_DEFAULT_MAX_ENTRIES 50
01799 // SSL options
01800
01801 #define SSL_MAX_CONTENT_LEN 16384
01802 #define SSL_DEFAULT_TICKET_LIFETIME 86400
01804 #endif
01805
01806
01807
01808
01809
01810
01811 #if defined(POLARSSL_CERTS_C) && !defined(POLARSSL_PEM_PARSE_C)
01812 #error "POLARSSL_CERTS_C defined, but not all prerequisites"
01813 #endif
01814
01815 #if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
01816 #error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
01817 #endif
01818
01819 #if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
01820 #error "POLARSSL_DHM_C defined, but not all prerequisites"
01821 #endif
01822
01823 #if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
01824 #error "POLARSSL_ECDH_C defined, but not all prerequisites"
01825 #endif
01826
01827 #if defined(POLARSSL_ECDSA_C) && \
01828 ( !defined(POLARSSL_ECP_C) || \
01829 !defined(POLARSSL_ASN1_PARSE_C) || \
01830 !defined(POLARSSL_ASN1_WRITE_C) )
01831 #error "POLARSSL_ECDSA_C defined, but not all prerequisites"
01832 #endif
01833
01834 #if defined(POLARSSL_ECP_C) && ( !defined(POLARSSL_BIGNUM_C) || ( \
01835 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
01836 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
01837 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
01838 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
01839 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
01840 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
01841 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
01842 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) ) )
01843 #error "POLARSSL_ECP_C defined, but not all prerequisites"
01844 #endif
01845
01846 #if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
01847 !defined(POLARSSL_SHA256_C))
01848 #error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
01849 #endif
01850 #if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
01851 defined(POLARSSL_CONFIG_OPTIONS) && (CTR_DRBG_ENTROPY_LEN > 64)
01852 #error "CTR_DRBG_ENTROPY_LEN value too high"
01853 #endif
01854 #if defined(POLARSSL_ENTROPY_C) && !defined(POLARSSL_SHA512_C) && \
01855 defined(POLARSSL_CONFIG_OPTIONS) && (CTR_DRBG_ENTROPY_LEN > 32)
01856 #error "CTR_DRBG_ENTROPY_LEN value too high"
01857 #endif
01858
01859 #if defined(POLARSSL_GCM_C) && ( \
01860 !defined(POLARSSL_AES_C) && !defined(POLARSSL_CAMELLIA_C) )
01861 #error "POLARSSL_GCM_C defined, but not all prerequisites"
01862 #endif
01863
01864 #if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
01865 #error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
01866 #endif
01867
01868 #if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
01869 #error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
01870 #endif
01871
01872 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
01873 !defined(POLARSSL_ECDH_C)
01874 #error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
01875 #endif
01876
01877 #if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
01878 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
01879 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
01880 #error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
01881 #endif
01882
01883 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
01884 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
01885 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
01886 #error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
01887 #endif
01888
01889 #if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
01890 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
01891 !defined(POLARSSL_X509_CRT_PARSE_C) )
01892 #error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
01893 #endif
01894
01895 #if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
01896 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
01897 !defined(POLARSSL_PKCS1_V15) )
01898 #error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
01899 #endif
01900
01901 #if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
01902 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
01903 !defined(POLARSSL_PKCS1_V15) )
01904 #error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
01905 #endif
01906
01907 #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && !defined(POLARSSL_MEMORY_C)
01908 #error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
01909 #endif
01910
01911 #if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
01912 #error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
01913 #endif
01914
01915 #if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
01916 #error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
01917 #endif
01918
01919 #if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
01920 #error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
01921 #endif
01922
01923 #if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
01924 #error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
01925 #endif
01926
01927 #if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
01928 #error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
01929 #endif
01930
01931 #if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
01932 #error "POLARSSL_PKCS11_C defined, but not all prerequisites"
01933 #endif
01934
01935 #if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
01936 !defined(POLARSSL_OID_C) )
01937 #error "POLARSSL_RSA_C defined, but not all prerequisites"
01938 #endif
01939
01940 #if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
01941 !defined(POLARSSL_SHA1_C) )
01942 #error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
01943 #endif
01944
01945 #if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
01946 !defined(POLARSSL_SHA1_C) )
01947 #error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
01948 #endif
01949
01950 #if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
01951 !defined(POLARSSL_SHA1_C) )
01952 #error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
01953 #endif
01954
01955 #if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
01956 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
01957 #error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
01958 #endif
01959
01960 #if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
01961 #error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
01962 #endif
01963
01964 #if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
01965 !defined(POLARSSL_MD_C) )
01966 #error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
01967 #endif
01968
01969 #if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
01970 #error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
01971 #endif
01972
01973 #if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
01974 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
01975 !defined(POLARSSL_SSL_PROTO_TLS1_2))
01976 #error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
01977 #endif
01978
01979 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
01980 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
01981 #error "Illegal protocol selection"
01982 #endif
01983
01984 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
01985 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
01986 #error "Illegal protocol selection"
01987 #endif
01988
01989 #if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
01990 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
01991 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
01992 #error "Illegal protocol selection"
01993 #endif
01994
01995 #if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
01996 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
01997 !defined(POLARSSL_CIPHER_MODE_CBC) )
01998 #error "POLARSSL_SSL_SESSION_TICKETS_C defined, but not all prerequisites"
01999 #endif
02000
02001 #if defined(POLARSSL_THREADING_DUMMY)
02002 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
02003 #error "POLARSSL_THREADING_DUMMY defined, but not all prerequisites"
02004 #endif
02005 #define POLARSSL_THREADING_IMPL
02006 #endif
02007
02008 #if defined(POLARSSL_THREADING_PTHREAD)
02009 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
02010 #error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
02011 #endif
02012 #define POLARSSL_THREADING_IMPL
02013 #endif
02014
02015 #if defined(POLARSSL_THREADING_ALT)
02016 #if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
02017 #error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
02018 #endif
02019 #define POLARSSL_THREADING_IMPL
02020 #endif
02021
02022 #if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
02023 #error "POLARSSL_THREADING_C defined, single threading implementation required"
02024 #endif
02025 #undef POLARSSL_THREADING_IMPL
02026
02027 #if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
02028 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
02029 !defined(POLARSSL_PK_PARSE_C) )
02030 #error "POLARSSL_X509_USE_C defined, but not all prerequisites"
02031 #endif
02032
02033 #if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
02034 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
02035 !defined(POLARSSL_PK_WRITE_C) )
02036 #error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
02037 #endif
02038
02039 #if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
02040 #error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
02041 #endif
02042
02043 #if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
02044 #error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
02045 #endif
02046
02047 #if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
02048 #error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
02049 #endif
02050
02051 #if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
02052 #error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
02053 #endif
02054
02055 #if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
02056 #error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"
02057 #endif
02058
02059 #endif