123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583 |
- #ifndef MBEDTLS_SSL_H
- #define MBEDTLS_SSL_H
- #if !defined(MBEDTLS_CONFIG_FILE)
- #include "config.h"
- #else
- #include MBEDTLS_CONFIG_FILE
- #endif
- #include "bignum.h"
- #include "ecp.h"
- #include "ssl_ciphersuites.h"
- #if defined(MBEDTLS_X509_CRT_PARSE_C)
- #include "x509_crt.h"
- #include "x509_crl.h"
- #endif
- #if defined(MBEDTLS_DHM_C)
- #include "dhm.h"
- #endif
- #if defined(MBEDTLS_ECDH_C)
- #include "ecdh.h"
- #endif
- #if defined(MBEDTLS_ZLIB_SUPPORT)
- #include "zlib.h"
- #endif
- #if defined(MBEDTLS_HAVE_TIME)
- #include "mbedtls/platform_time.h"
- #endif
- #define MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE -0x7080
- #define MBEDTLS_ERR_SSL_BAD_INPUT_DATA -0x7100
- #define MBEDTLS_ERR_SSL_INVALID_MAC -0x7180
- #define MBEDTLS_ERR_SSL_INVALID_RECORD -0x7200
- #define MBEDTLS_ERR_SSL_CONN_EOF -0x7280
- #define MBEDTLS_ERR_SSL_UNKNOWN_CIPHER -0x7300
- #define MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN -0x7380
- #define MBEDTLS_ERR_SSL_NO_RNG -0x7400
- #define MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE -0x7480
- #define MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE -0x7500
- #define MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED -0x7580
- #define MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED -0x7600
- #define MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED -0x7680
- #define MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE -0x7700
- #define MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE -0x7780
- #define MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED -0x7800
- #define MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY -0x7880
- #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO -0x7900
- #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO -0x7980
- #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE -0x7A00
- #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST -0x7A80
- #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE -0x7B00
- #define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE -0x7B80
- #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE -0x7C00
- #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP -0x7C80
- #define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS -0x7D00
- #define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY -0x7D80
- #define MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0x7E00
- #define MBEDTLS_ERR_SSL_BAD_HS_FINISHED -0x7E80
- #define MBEDTLS_ERR_SSL_ALLOC_FAILED -0x7F00
- #define MBEDTLS_ERR_SSL_HW_ACCEL_FAILED -0x7F80
- #define MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH -0x6F80
- #define MBEDTLS_ERR_SSL_COMPRESSION_FAILED -0x6F00
- #define MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION -0x6E80
- #define MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET -0x6E00
- #define MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED -0x6D80
- #define MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH -0x6D00
- #define MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY -0x6C80
- #define MBEDTLS_ERR_SSL_INTERNAL_ERROR -0x6C00
- #define MBEDTLS_ERR_SSL_COUNTER_WRAPPING -0x6B80
- #define MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO -0x6B00
- #define MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED -0x6A80
- #define MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL -0x6A00
- #define MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE -0x6980
- #define MBEDTLS_ERR_SSL_WANT_READ -0x6900
- #define MBEDTLS_ERR_SSL_WANT_WRITE -0x6880
- #define MBEDTLS_ERR_SSL_TIMEOUT -0x6800
- #define MBEDTLS_ERR_SSL_CLIENT_RECONNECT -0x6780
- #define MBEDTLS_ERR_SSL_UNEXPECTED_RECORD -0x6700
- #define MBEDTLS_ERR_SSL_NON_FATAL -0x6680
- #define MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH -0x6600
- #define MBEDTLS_SSL_MAJOR_VERSION_3 3
- #define MBEDTLS_SSL_MINOR_VERSION_0 0
- #define MBEDTLS_SSL_MINOR_VERSION_1 1
- #define MBEDTLS_SSL_MINOR_VERSION_2 2
- #define MBEDTLS_SSL_MINOR_VERSION_3 3
- #define MBEDTLS_SSL_TRANSPORT_STREAM 0
- #define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1
- #define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255
- #define MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0
- #define MBEDTLS_SSL_MAX_FRAG_LEN_512 1
- #define MBEDTLS_SSL_MAX_FRAG_LEN_1024 2
- #define MBEDTLS_SSL_MAX_FRAG_LEN_2048 3
- #define MBEDTLS_SSL_MAX_FRAG_LEN_4096 4
- #define MBEDTLS_SSL_MAX_FRAG_LEN_INVALID 5
- #define MBEDTLS_SSL_IS_CLIENT 0
- #define MBEDTLS_SSL_IS_SERVER 1
- #define MBEDTLS_SSL_IS_NOT_FALLBACK 0
- #define MBEDTLS_SSL_IS_FALLBACK 1
- #define MBEDTLS_SSL_EXTENDED_MS_DISABLED 0
- #define MBEDTLS_SSL_EXTENDED_MS_ENABLED 1
- #define MBEDTLS_SSL_ETM_DISABLED 0
- #define MBEDTLS_SSL_ETM_ENABLED 1
- #define MBEDTLS_SSL_COMPRESS_NULL 0
- #define MBEDTLS_SSL_COMPRESS_DEFLATE 1
- #define MBEDTLS_SSL_VERIFY_NONE 0
- #define MBEDTLS_SSL_VERIFY_OPTIONAL 1
- #define MBEDTLS_SSL_VERIFY_REQUIRED 2
- #define MBEDTLS_SSL_VERIFY_UNSET 3
- #define MBEDTLS_SSL_LEGACY_RENEGOTIATION 0
- #define MBEDTLS_SSL_SECURE_RENEGOTIATION 1
- #define MBEDTLS_SSL_RENEGOTIATION_DISABLED 0
- #define MBEDTLS_SSL_RENEGOTIATION_ENABLED 1
- #define MBEDTLS_SSL_ANTI_REPLAY_DISABLED 0
- #define MBEDTLS_SSL_ANTI_REPLAY_ENABLED 1
- #define MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED -1
- #define MBEDTLS_SSL_RENEGO_MAX_RECORDS_DEFAULT 16
- #define MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION 0
- #define MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION 1
- #define MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE 2
- #define MBEDTLS_SSL_TRUNC_HMAC_DISABLED 0
- #define MBEDTLS_SSL_TRUNC_HMAC_ENABLED 1
- #define MBEDTLS_SSL_TRUNCATED_HMAC_LEN 10
- #define MBEDTLS_SSL_SESSION_TICKETS_DISABLED 0
- #define MBEDTLS_SSL_SESSION_TICKETS_ENABLED 1
- #define MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED 0
- #define MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED 1
- #define MBEDTLS_SSL_ARC4_ENABLED 0
- #define MBEDTLS_SSL_ARC4_DISABLED 1
- #define MBEDTLS_SSL_PRESET_DEFAULT 0
- #define MBEDTLS_SSL_PRESET_SUITEB 2
- #define MBEDTLS_SSL_CERT_REQ_CA_LIST_ENABLED 1
- #define MBEDTLS_SSL_CERT_REQ_CA_LIST_DISABLED 0
- #define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MIN 1000
- #define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MAX 60000
- #if !defined(MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME)
- #define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400
- #endif
- #if !defined(MBEDTLS_SSL_MAX_CONTENT_LEN)
- #define MBEDTLS_SSL_MAX_CONTENT_LEN 16384
- #endif
- #if defined(MBEDTLS_SSL_PROTO_SSL3)
- #define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 36
- #else
- #define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 12
- #endif
- #define MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO 0xFF
- #define MBEDTLS_SSL_FALLBACK_SCSV_VALUE 0x5600
- #define MBEDTLS_SSL_HASH_NONE 0
- #define MBEDTLS_SSL_HASH_MD5 1
- #define MBEDTLS_SSL_HASH_SHA1 2
- #define MBEDTLS_SSL_HASH_SHA224 3
- #define MBEDTLS_SSL_HASH_SHA256 4
- #define MBEDTLS_SSL_HASH_SHA384 5
- #define MBEDTLS_SSL_HASH_SHA512 6
- #define MBEDTLS_SSL_SIG_ANON 0
- #define MBEDTLS_SSL_SIG_RSA 1
- #define MBEDTLS_SSL_SIG_ECDSA 3
- #define MBEDTLS_SSL_CERT_TYPE_RSA_SIGN 1
- #define MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN 64
- #define MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC 20
- #define MBEDTLS_SSL_MSG_ALERT 21
- #define MBEDTLS_SSL_MSG_HANDSHAKE 22
- #define MBEDTLS_SSL_MSG_APPLICATION_DATA 23
- #define MBEDTLS_SSL_ALERT_LEVEL_WARNING 1
- #define MBEDTLS_SSL_ALERT_LEVEL_FATAL 2
- #define MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY 0
- #define MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE 10
- #define MBEDTLS_SSL_ALERT_MSG_BAD_RECORD_MAC 20
- #define MBEDTLS_SSL_ALERT_MSG_DECRYPTION_FAILED 21
- #define MBEDTLS_SSL_ALERT_MSG_RECORD_OVERFLOW 22
- #define MBEDTLS_SSL_ALERT_MSG_DECOMPRESSION_FAILURE 30
- #define MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE 40
- #define MBEDTLS_SSL_ALERT_MSG_NO_CERT 41
- #define MBEDTLS_SSL_ALERT_MSG_BAD_CERT 42
- #define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_CERT 43
- #define MBEDTLS_SSL_ALERT_MSG_CERT_REVOKED 44
- #define MBEDTLS_SSL_ALERT_MSG_CERT_EXPIRED 45
- #define MBEDTLS_SSL_ALERT_MSG_CERT_UNKNOWN 46
- #define MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER 47
- #define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_CA 48
- #define MBEDTLS_SSL_ALERT_MSG_ACCESS_DENIED 49
- #define MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR 50
- #define MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR 51
- #define MBEDTLS_SSL_ALERT_MSG_EXPORT_RESTRICTION 60
- #define MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION 70
- #define MBEDTLS_SSL_ALERT_MSG_INSUFFICIENT_SECURITY 71
- #define MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR 80
- #define MBEDTLS_SSL_ALERT_MSG_INAPROPRIATE_FALLBACK 86
- #define MBEDTLS_SSL_ALERT_MSG_USER_CANCELED 90
- #define MBEDTLS_SSL_ALERT_MSG_NO_RENEGOTIATION 100
- #define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT 110
- #define MBEDTLS_SSL_ALERT_MSG_UNRECOGNIZED_NAME 112
- #define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY 115
- #define MBEDTLS_SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL 120
- #define MBEDTLS_SSL_HS_HELLO_REQUEST 0
- #define MBEDTLS_SSL_HS_CLIENT_HELLO 1
- #define MBEDTLS_SSL_HS_SERVER_HELLO 2
- #define MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST 3
- #define MBEDTLS_SSL_HS_NEW_SESSION_TICKET 4
- #define MBEDTLS_SSL_HS_CERTIFICATE 11
- #define MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE 12
- #define MBEDTLS_SSL_HS_CERTIFICATE_REQUEST 13
- #define MBEDTLS_SSL_HS_SERVER_HELLO_DONE 14
- #define MBEDTLS_SSL_HS_CERTIFICATE_VERIFY 15
- #define MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE 16
- #define MBEDTLS_SSL_HS_FINISHED 20
- #define MBEDTLS_TLS_EXT_SERVERNAME 0
- #define MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME 0
- #define MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH 1
- #define MBEDTLS_TLS_EXT_TRUNCATED_HMAC 4
- #define MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES 10
- #define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS 11
- #define MBEDTLS_TLS_EXT_SIG_ALG 13
- #define MBEDTLS_TLS_EXT_ALPN 16
- #define MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC 22
- #define MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET 0x0017
- #define MBEDTLS_TLS_EXT_SESSION_TICKET 35
- #define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256
- #define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 0xFF01
- #if !defined(MBEDTLS_PSK_MAX_LEN)
- #define MBEDTLS_PSK_MAX_LEN 32
- #endif
- union mbedtls_ssl_premaster_secret
- {
- #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
- unsigned char _pms_rsa[48];
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)
- unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE];
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
- defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
- defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
- defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
- unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES];
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
- unsigned char _pms_psk[4 + 2 * MBEDTLS_PSK_MAX_LEN];
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
- unsigned char _pms_dhe_psk[4 + MBEDTLS_MPI_MAX_SIZE
- + MBEDTLS_PSK_MAX_LEN];
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
- unsigned char _pms_rsa_psk[52 + MBEDTLS_PSK_MAX_LEN];
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
- unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES
- + MBEDTLS_PSK_MAX_LEN];
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
- unsigned char _pms_ecjpake[32];
- #endif
- };
- #define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef enum
- {
- MBEDTLS_SSL_HELLO_REQUEST,
- MBEDTLS_SSL_CLIENT_HELLO,
- MBEDTLS_SSL_SERVER_HELLO,
- MBEDTLS_SSL_SERVER_CERTIFICATE,
- MBEDTLS_SSL_SERVER_KEY_EXCHANGE,
- MBEDTLS_SSL_CERTIFICATE_REQUEST,
- MBEDTLS_SSL_SERVER_HELLO_DONE,
- MBEDTLS_SSL_CLIENT_CERTIFICATE,
- MBEDTLS_SSL_CLIENT_KEY_EXCHANGE,
- MBEDTLS_SSL_CERTIFICATE_VERIFY,
- MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC,
- MBEDTLS_SSL_CLIENT_FINISHED,
- MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC,
- MBEDTLS_SSL_SERVER_FINISHED,
- MBEDTLS_SSL_FLUSH_BUFFERS,
- MBEDTLS_SSL_HANDSHAKE_WRAPUP,
- MBEDTLS_SSL_HANDSHAKE_OVER,
- MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET,
- MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT,
- }
- mbedtls_ssl_states;
- typedef int mbedtls_ssl_send_t( void *ctx,
- const unsigned char *buf,
- size_t len );
- typedef int mbedtls_ssl_recv_t( void *ctx,
- unsigned char *buf,
- size_t len );
- typedef int mbedtls_ssl_recv_timeout_t( void *ctx,
- unsigned char *buf,
- size_t len,
- uint32_t timeout );
- typedef void mbedtls_ssl_set_timer_t( void * ctx,
- uint32_t int_ms,
- uint32_t fin_ms );
- typedef int mbedtls_ssl_get_timer_t( void * ctx );
- typedef struct mbedtls_ssl_session mbedtls_ssl_session;
- typedef struct mbedtls_ssl_context mbedtls_ssl_context;
- typedef struct mbedtls_ssl_config mbedtls_ssl_config;
- typedef struct mbedtls_ssl_transform mbedtls_ssl_transform;
- typedef struct mbedtls_ssl_handshake_params mbedtls_ssl_handshake_params;
- typedef struct mbedtls_ssl_sig_hash_set_t mbedtls_ssl_sig_hash_set_t;
- #if defined(MBEDTLS_X509_CRT_PARSE_C)
- typedef struct mbedtls_ssl_key_cert mbedtls_ssl_key_cert;
- #endif
- #if defined(MBEDTLS_SSL_PROTO_DTLS)
- typedef struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item;
- #endif
- struct mbedtls_ssl_session
- {
- #if defined(MBEDTLS_HAVE_TIME)
- mbedtls_time_t start;
- #endif
- int ciphersuite;
- int compression;
- size_t id_len;
- unsigned char id[32];
- unsigned char master[48];
- #if defined(MBEDTLS_X509_CRT_PARSE_C)
- mbedtls_x509_crt *peer_cert;
- #endif
- uint32_t verify_result;
- #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
- unsigned char *ticket;
- size_t ticket_len;
- uint32_t ticket_lifetime;
- #endif
- #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
- unsigned char mfl_code;
- #endif
- #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
- int trunc_hmac;
- #endif
- #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
- int encrypt_then_mac;
- #endif
- };
- struct mbedtls_ssl_config
- {
-
-
- const int *ciphersuite_list[4];
-
- void (*f_dbg)(void *, int, const char *, int, const char *);
- void *p_dbg;
-
- int (*f_rng)(void *, unsigned char *, size_t);
- void *p_rng;
-
- int (*f_get_cache)(void *, mbedtls_ssl_session *);
-
- int (*f_set_cache)(void *, const mbedtls_ssl_session *);
- void *p_cache;
- #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
-
- int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
- void *p_sni;
- #endif
- #if defined(MBEDTLS_X509_CRT_PARSE_C)
-
- int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *);
- void *p_vrfy;
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
-
- int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
- void *p_psk;
- #endif
- #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
-
- int (*f_cookie_write)( void *, unsigned char **, unsigned char *,
- const unsigned char *, size_t );
-
- int (*f_cookie_check)( void *, const unsigned char *, size_t,
- const unsigned char *, size_t );
- void *p_cookie;
- #endif
- #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
-
- int (*f_ticket_write)( void *, const mbedtls_ssl_session *,
- unsigned char *, const unsigned char *, size_t *, uint32_t * );
-
- int (*f_ticket_parse)( void *, mbedtls_ssl_session *, unsigned char *, size_t);
- void *p_ticket;
- #endif
- #if defined(MBEDTLS_SSL_EXPORT_KEYS)
-
- int (*f_export_keys)( void *, const unsigned char *,
- const unsigned char *, size_t, size_t, size_t );
- void *p_export_keys;
- #endif
- #if defined(MBEDTLS_X509_CRT_PARSE_C)
- const mbedtls_x509_crt_profile *cert_profile;
- mbedtls_ssl_key_cert *key_cert;
- mbedtls_x509_crt *ca_chain;
- mbedtls_x509_crl *ca_crl;
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)
- const int *sig_hashes;
- #endif
- #if defined(MBEDTLS_ECP_C)
- const mbedtls_ecp_group_id *curve_list;
- #endif
- #if defined(MBEDTLS_DHM_C)
- mbedtls_mpi dhm_P;
- mbedtls_mpi dhm_G;
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
- unsigned char *psk;
- size_t psk_len;
- unsigned char *psk_identity;
- size_t psk_identity_len;
- #endif
- #if defined(MBEDTLS_SSL_ALPN)
- const char **alpn_list;
- #endif
-
- uint32_t read_timeout;
- #if defined(MBEDTLS_SSL_PROTO_DTLS)
- uint32_t hs_timeout_min;
- uint32_t hs_timeout_max;
- #endif
- #if defined(MBEDTLS_SSL_RENEGOTIATION)
- int renego_max_records;
- unsigned char renego_period[8];
- #endif
- #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
- unsigned int badmac_limit;
- #endif
- #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
- unsigned int dhm_min_bitlen;
- #endif
- unsigned char max_major_ver;
- unsigned char max_minor_ver;
- unsigned char min_major_ver;
- unsigned char min_minor_ver;
-
- unsigned int endpoint : 1;
- unsigned int transport : 1;
- unsigned int authmode : 2;
-
- unsigned int allow_legacy_renegotiation : 2 ;
- #if defined(MBEDTLS_ARC4_C)
- unsigned int arc4_disabled : 1;
- #endif
- #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
- unsigned int mfl_code : 3;
- #endif
- #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
- unsigned int encrypt_then_mac : 1 ;
- #endif
- #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
- unsigned int extended_ms : 1;
- #endif
- #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
- unsigned int anti_replay : 1;
- #endif
- #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
- unsigned int cbc_record_splitting : 1;
- #endif
- #if defined(MBEDTLS_SSL_RENEGOTIATION)
- unsigned int disable_renegotiation : 1;
- #endif
- #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
- unsigned int trunc_hmac : 1;
- #endif
- #if defined(MBEDTLS_SSL_SESSION_TICKETS)
- unsigned int session_tickets : 1;
- #endif
- #if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)
- unsigned int fallback : 1;
- #endif
- #if defined(MBEDTLS_SSL_SRV_C)
- unsigned int cert_req_ca_list : 1;
- #endif
- };
- struct mbedtls_ssl_context
- {
- const mbedtls_ssl_config *conf;
-
- int state;
- #if defined(MBEDTLS_SSL_RENEGOTIATION)
- int renego_status;
- int renego_records_seen;
- #endif
- int major_ver;
- int minor_ver;
- #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
- unsigned badmac_seen;
- #endif
- mbedtls_ssl_send_t *f_send;
- mbedtls_ssl_recv_t *f_recv;
- mbedtls_ssl_recv_timeout_t *f_recv_timeout;
-
- void *p_bio;
-
- mbedtls_ssl_session *session_in;
- mbedtls_ssl_session *session_out;
- mbedtls_ssl_session *session;
- mbedtls_ssl_session *session_negotiate;
- mbedtls_ssl_handshake_params *handshake;
-
- mbedtls_ssl_transform *transform_in;
- mbedtls_ssl_transform *transform_out;
- mbedtls_ssl_transform *transform;
- mbedtls_ssl_transform *transform_negotiate;
-
- void *p_timer;
- mbedtls_ssl_set_timer_t *f_set_timer;
- mbedtls_ssl_get_timer_t *f_get_timer;
-
- unsigned char *in_buf;
- unsigned char *in_ctr;
- unsigned char *in_hdr;
- unsigned char *in_len;
- unsigned char *in_iv;
- unsigned char *in_msg;
- unsigned char *in_offt;
- int in_msgtype;
- size_t in_msglen;
- size_t in_left;
- #if defined(MBEDTLS_SSL_PROTO_DTLS)
- uint16_t in_epoch;
- size_t next_record_offset;
- #endif
- #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
- uint64_t in_window_top;
- uint64_t in_window;
- #endif
- size_t in_hslen;
- int nb_zero;
- int keep_current_message;
-
- unsigned char *out_buf;
- unsigned char *out_ctr;
- unsigned char *out_hdr;
- unsigned char *out_len;
- unsigned char *out_iv;
- unsigned char *out_msg;
- int out_msgtype;
- size_t out_msglen;
- size_t out_left;
- #if defined(MBEDTLS_ZLIB_SUPPORT)
- unsigned char *compress_buf;
- #endif
- #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
- signed char split_done;
- #endif
-
- int client_auth;
-
- #if defined(MBEDTLS_X509_CRT_PARSE_C)
- char *hostname;
- #endif
- #if defined(MBEDTLS_SSL_ALPN)
- const char *alpn_chosen;
- #endif
-
- #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
- unsigned char *cli_id;
- size_t cli_id_len;
- #endif
-
-
- int secure_renegotiation;
- #if defined(MBEDTLS_SSL_RENEGOTIATION)
- size_t verify_data_len;
- char own_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN];
- char peer_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN];
- #endif
- };
- #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
- #define MBEDTLS_SSL_CHANNEL_OUTBOUND 0
- #define MBEDTLS_SSL_CHANNEL_INBOUND 1
- extern int (*mbedtls_ssl_hw_record_init)(mbedtls_ssl_context *ssl,
- const unsigned char *key_enc, const unsigned char *key_dec,
- size_t keylen,
- const unsigned char *iv_enc, const unsigned char *iv_dec,
- size_t ivlen,
- const unsigned char *mac_enc, const unsigned char *mac_dec,
- size_t maclen);
- extern int (*mbedtls_ssl_hw_record_activate)(mbedtls_ssl_context *ssl, int direction);
- extern int (*mbedtls_ssl_hw_record_reset)(mbedtls_ssl_context *ssl);
- extern int (*mbedtls_ssl_hw_record_write)(mbedtls_ssl_context *ssl);
- extern int (*mbedtls_ssl_hw_record_read)(mbedtls_ssl_context *ssl);
- extern int (*mbedtls_ssl_hw_record_finish)(mbedtls_ssl_context *ssl);
- #endif
- const int *mbedtls_ssl_list_ciphersuites( void );
- const char *mbedtls_ssl_get_ciphersuite_name( const int ciphersuite_id );
- int mbedtls_ssl_get_ciphersuite_id( const char *ciphersuite_name );
- void mbedtls_ssl_init( mbedtls_ssl_context *ssl );
- int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
- const mbedtls_ssl_config *conf );
- int mbedtls_ssl_session_reset( mbedtls_ssl_context *ssl );
- void mbedtls_ssl_conf_endpoint( mbedtls_ssl_config *conf, int endpoint );
- void mbedtls_ssl_conf_transport( mbedtls_ssl_config *conf, int transport );
- void mbedtls_ssl_conf_authmode( mbedtls_ssl_config *conf, int authmode );
- #if defined(MBEDTLS_X509_CRT_PARSE_C)
- void mbedtls_ssl_conf_verify( mbedtls_ssl_config *conf,
- int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
- void *p_vrfy );
- #endif
- void mbedtls_ssl_conf_rng( mbedtls_ssl_config *conf,
- int (*f_rng)(void *, unsigned char *, size_t),
- void *p_rng );
- void mbedtls_ssl_conf_dbg( mbedtls_ssl_config *conf,
- void (*f_dbg)(void *, int, const char *, int, const char *),
- void *p_dbg );
- void mbedtls_ssl_set_bio( mbedtls_ssl_context *ssl,
- void *p_bio,
- mbedtls_ssl_send_t *f_send,
- mbedtls_ssl_recv_t *f_recv,
- mbedtls_ssl_recv_timeout_t *f_recv_timeout );
- void mbedtls_ssl_conf_read_timeout( mbedtls_ssl_config *conf, uint32_t timeout );
- void mbedtls_ssl_set_timer_cb( mbedtls_ssl_context *ssl,
- void *p_timer,
- mbedtls_ssl_set_timer_t *f_set_timer,
- mbedtls_ssl_get_timer_t *f_get_timer );
- typedef int mbedtls_ssl_ticket_write_t( void *p_ticket,
- const mbedtls_ssl_session *session,
- unsigned char *start,
- const unsigned char *end,
- size_t *tlen,
- uint32_t *lifetime );
- #if defined(MBEDTLS_SSL_EXPORT_KEYS)
- typedef int mbedtls_ssl_export_keys_t( void *p_expkey,
- const unsigned char *ms,
- const unsigned char *kb,
- size_t maclen,
- size_t keylen,
- size_t ivlen );
- #endif
- typedef int mbedtls_ssl_ticket_parse_t( void *p_ticket,
- mbedtls_ssl_session *session,
- unsigned char *buf,
- size_t len );
- #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)
- void mbedtls_ssl_conf_session_tickets_cb( mbedtls_ssl_config *conf,
- mbedtls_ssl_ticket_write_t *f_ticket_write,
- mbedtls_ssl_ticket_parse_t *f_ticket_parse,
- void *p_ticket );
- #endif
- #if defined(MBEDTLS_SSL_EXPORT_KEYS)
- void mbedtls_ssl_conf_export_keys_cb( mbedtls_ssl_config *conf,
- mbedtls_ssl_export_keys_t *f_export_keys,
- void *p_export_keys );
- #endif
- typedef int mbedtls_ssl_cookie_write_t( void *ctx,
- unsigned char **p, unsigned char *end,
- const unsigned char *info, size_t ilen );
- typedef int mbedtls_ssl_cookie_check_t( void *ctx,
- const unsigned char *cookie, size_t clen,
- const unsigned char *info, size_t ilen );
- #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
- void mbedtls_ssl_conf_dtls_cookies( mbedtls_ssl_config *conf,
- mbedtls_ssl_cookie_write_t *f_cookie_write,
- mbedtls_ssl_cookie_check_t *f_cookie_check,
- void *p_cookie );
- int mbedtls_ssl_set_client_transport_id( mbedtls_ssl_context *ssl,
- const unsigned char *info,
- size_t ilen );
- #endif
- #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
- void mbedtls_ssl_conf_dtls_anti_replay( mbedtls_ssl_config *conf, char mode );
- #endif
- #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
- void mbedtls_ssl_conf_dtls_badmac_limit( mbedtls_ssl_config *conf, unsigned limit );
- #endif
- #if defined(MBEDTLS_SSL_PROTO_DTLS)
- void mbedtls_ssl_conf_handshake_timeout( mbedtls_ssl_config *conf, uint32_t min, uint32_t max );
- #endif
- #if defined(MBEDTLS_SSL_SRV_C)
- void mbedtls_ssl_conf_session_cache( mbedtls_ssl_config *conf,
- void *p_cache,
- int (*f_get_cache)(void *, mbedtls_ssl_session *),
- int (*f_set_cache)(void *, const mbedtls_ssl_session *) );
- #endif
- #if defined(MBEDTLS_SSL_CLI_C)
- int mbedtls_ssl_set_session( mbedtls_ssl_context *ssl, const mbedtls_ssl_session *session );
- #endif
- void mbedtls_ssl_conf_ciphersuites( mbedtls_ssl_config *conf,
- const int *ciphersuites );
- void mbedtls_ssl_conf_ciphersuites_for_version( mbedtls_ssl_config *conf,
- const int *ciphersuites,
- int major, int minor );
- #if defined(MBEDTLS_X509_CRT_PARSE_C)
- void mbedtls_ssl_conf_cert_profile( mbedtls_ssl_config *conf,
- const mbedtls_x509_crt_profile *profile );
- void mbedtls_ssl_conf_ca_chain( mbedtls_ssl_config *conf,
- mbedtls_x509_crt *ca_chain,
- mbedtls_x509_crl *ca_crl );
- int mbedtls_ssl_conf_own_cert( mbedtls_ssl_config *conf,
- mbedtls_x509_crt *own_cert,
- mbedtls_pk_context *pk_key );
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
- int mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf,
- const unsigned char *psk, size_t psk_len,
- const unsigned char *psk_identity, size_t psk_identity_len );
- int mbedtls_ssl_set_hs_psk( mbedtls_ssl_context *ssl,
- const unsigned char *psk, size_t psk_len );
- void mbedtls_ssl_conf_psk_cb( mbedtls_ssl_config *conf,
- int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *,
- size_t),
- void *p_psk );
- #endif
- #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)
- int mbedtls_ssl_conf_dh_param( mbedtls_ssl_config *conf, const char *dhm_P, const char *dhm_G );
- int mbedtls_ssl_conf_dh_param_ctx( mbedtls_ssl_config *conf, mbedtls_dhm_context *dhm_ctx );
- #endif
- #if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
- void mbedtls_ssl_conf_dhm_min_bitlen( mbedtls_ssl_config *conf,
- unsigned int bitlen );
- #endif
- #if defined(MBEDTLS_ECP_C)
- void mbedtls_ssl_conf_curves( mbedtls_ssl_config *conf,
- const mbedtls_ecp_group_id *curves );
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)
- void mbedtls_ssl_conf_sig_hashes( mbedtls_ssl_config *conf,
- const int *hashes );
- #endif
- #if defined(MBEDTLS_X509_CRT_PARSE_C)
- int mbedtls_ssl_set_hostname( mbedtls_ssl_context *ssl, const char *hostname );
- #endif
- #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
- int mbedtls_ssl_set_hs_own_cert( mbedtls_ssl_context *ssl,
- mbedtls_x509_crt *own_cert,
- mbedtls_pk_context *pk_key );
- void mbedtls_ssl_set_hs_ca_chain( mbedtls_ssl_context *ssl,
- mbedtls_x509_crt *ca_chain,
- mbedtls_x509_crl *ca_crl );
- void mbedtls_ssl_set_hs_authmode( mbedtls_ssl_context *ssl,
- int authmode );
- void mbedtls_ssl_conf_sni( mbedtls_ssl_config *conf,
- int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *,
- size_t),
- void *p_sni );
- #endif
- #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
- int mbedtls_ssl_set_hs_ecjpake_password( mbedtls_ssl_context *ssl,
- const unsigned char *pw,
- size_t pw_len );
- #endif
- #if defined(MBEDTLS_SSL_ALPN)
- int mbedtls_ssl_conf_alpn_protocols( mbedtls_ssl_config *conf, const char **protos );
- const char *mbedtls_ssl_get_alpn_protocol( const mbedtls_ssl_context *ssl );
- #endif
- void mbedtls_ssl_conf_max_version( mbedtls_ssl_config *conf, int major, int minor );
- void mbedtls_ssl_conf_min_version( mbedtls_ssl_config *conf, int major, int minor );
- #if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)
- void mbedtls_ssl_conf_fallback( mbedtls_ssl_config *conf, char fallback );
- #endif
- #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
- void mbedtls_ssl_conf_encrypt_then_mac( mbedtls_ssl_config *conf, char etm );
- #endif
- #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
- void mbedtls_ssl_conf_extended_master_secret( mbedtls_ssl_config *conf, char ems );
- #endif
- #if defined(MBEDTLS_ARC4_C)
- void mbedtls_ssl_conf_arc4_support( mbedtls_ssl_config *conf, char arc4 );
- #endif
- #if defined(MBEDTLS_SSL_SRV_C)
- void mbedtls_ssl_conf_cert_req_ca_list( mbedtls_ssl_config *conf,
- char cert_req_ca_list );
- #endif
- #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
- int mbedtls_ssl_conf_max_frag_len( mbedtls_ssl_config *conf, unsigned char mfl_code );
- #endif
- #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
- void mbedtls_ssl_conf_truncated_hmac( mbedtls_ssl_config *conf, int truncate );
- #endif
- #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
- void mbedtls_ssl_conf_cbc_record_splitting( mbedtls_ssl_config *conf, char split );
- #endif
- #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
- void mbedtls_ssl_conf_session_tickets( mbedtls_ssl_config *conf, int use_tickets );
- #endif
- #if defined(MBEDTLS_SSL_RENEGOTIATION)
- void mbedtls_ssl_conf_renegotiation( mbedtls_ssl_config *conf, int renegotiation );
- #endif
- void mbedtls_ssl_conf_legacy_renegotiation( mbedtls_ssl_config *conf, int allow_legacy );
- #if defined(MBEDTLS_SSL_RENEGOTIATION)
- void mbedtls_ssl_conf_renegotiation_enforced( mbedtls_ssl_config *conf, int max_records );
- void mbedtls_ssl_conf_renegotiation_period( mbedtls_ssl_config *conf,
- const unsigned char period[8] );
- #endif
- size_t mbedtls_ssl_get_bytes_avail( const mbedtls_ssl_context *ssl );
- uint32_t mbedtls_ssl_get_verify_result( const mbedtls_ssl_context *ssl );
- const char *mbedtls_ssl_get_ciphersuite( const mbedtls_ssl_context *ssl );
- const char *mbedtls_ssl_get_version( const mbedtls_ssl_context *ssl );
- int mbedtls_ssl_get_record_expansion( const mbedtls_ssl_context *ssl );
- #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
- size_t mbedtls_ssl_get_max_frag_len( const mbedtls_ssl_context *ssl );
- #endif
- #if defined(MBEDTLS_X509_CRT_PARSE_C)
- const mbedtls_x509_crt *mbedtls_ssl_get_peer_cert( const mbedtls_ssl_context *ssl );
- #endif
- #if defined(MBEDTLS_SSL_CLI_C)
- int mbedtls_ssl_get_session( const mbedtls_ssl_context *ssl, mbedtls_ssl_session *session );
- #endif
- int mbedtls_ssl_handshake( mbedtls_ssl_context *ssl );
- int mbedtls_ssl_handshake_step( mbedtls_ssl_context *ssl );
- #if defined(MBEDTLS_SSL_RENEGOTIATION)
- int mbedtls_ssl_renegotiate( mbedtls_ssl_context *ssl );
- #endif
- int mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len );
- int mbedtls_ssl_write( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len );
- int mbedtls_ssl_send_alert_message( mbedtls_ssl_context *ssl,
- unsigned char level,
- unsigned char message );
- int mbedtls_ssl_close_notify( mbedtls_ssl_context *ssl );
- void mbedtls_ssl_free( mbedtls_ssl_context *ssl );
- void mbedtls_ssl_config_init( mbedtls_ssl_config *conf );
- int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,
- int endpoint, int transport, int preset );
- void mbedtls_ssl_config_free( mbedtls_ssl_config *conf );
- void mbedtls_ssl_session_init( mbedtls_ssl_session *session );
- void mbedtls_ssl_session_free( mbedtls_ssl_session *session );
- #ifdef __cplusplus
- }
- #endif
- #endif
|