mbedtls_config.h 153 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392
  1. /**
  2. * \file mbedtls_config.h
  3. *
  4. * \brief Configuration options (set of defines)
  5. *
  6. * This set of compile-time options may be used to enable
  7. * or disable features selectively, and reduce the global
  8. * memory footprint.
  9. */
  10. /*
  11. * Copyright The Mbed TLS Contributors
  12. * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
  13. */
  14. /**
  15. * This is an optional version symbol that enables compatibility handling of
  16. * config files.
  17. *
  18. * It is equal to the #MBEDTLS_VERSION_NUMBER of the Mbed TLS version that
  19. * introduced the config format we want to be compatible with.
  20. */
  21. //#define MBEDTLS_CONFIG_VERSION 0x03000000
  22. /**
  23. * \name SECTION: System support
  24. *
  25. * This section sets system specific settings.
  26. * \{
  27. */
  28. /**
  29. * \def MBEDTLS_HAVE_ASM
  30. *
  31. * The compiler has support for asm().
  32. *
  33. * Requires support for asm() in compiler.
  34. *
  35. * Used in:
  36. * library/aesni.h
  37. * library/aria.c
  38. * library/bn_mul.h
  39. * library/constant_time.c
  40. * library/padlock.h
  41. *
  42. * Required by:
  43. * MBEDTLS_AESCE_C
  44. * MBEDTLS_AESNI_C (on some platforms)
  45. * MBEDTLS_PADLOCK_C
  46. *
  47. * Comment to disable the use of assembly code.
  48. */
  49. #define MBEDTLS_HAVE_ASM
  50. /**
  51. * \def MBEDTLS_NO_UDBL_DIVISION
  52. *
  53. * The platform lacks support for double-width integer division (64-bit
  54. * division on a 32-bit platform, 128-bit division on a 64-bit platform).
  55. *
  56. * Used in:
  57. * include/mbedtls/bignum.h
  58. * library/bignum.c
  59. *
  60. * The bignum code uses double-width division to speed up some operations.
  61. * Double-width division is often implemented in software that needs to
  62. * be linked with the program. The presence of a double-width integer
  63. * type is usually detected automatically through preprocessor macros,
  64. * but the automatic detection cannot know whether the code needs to
  65. * and can be linked with an implementation of division for that type.
  66. * By default division is assumed to be usable if the type is present.
  67. * Uncomment this option to prevent the use of double-width division.
  68. *
  69. * Note that division for the native integer type is always required.
  70. * Furthermore, a 64-bit type is always required even on a 32-bit
  71. * platform, but it need not support multiplication or division. In some
  72. * cases it is also desirable to disable some double-width operations. For
  73. * example, if double-width division is implemented in software, disabling
  74. * it can reduce code size in some embedded targets.
  75. */
  76. //#define MBEDTLS_NO_UDBL_DIVISION
  77. /**
  78. * \def MBEDTLS_NO_64BIT_MULTIPLICATION
  79. *
  80. * The platform lacks support for 32x32 -> 64-bit multiplication.
  81. *
  82. * Used in:
  83. * library/poly1305.c
  84. *
  85. * Some parts of the library may use multiplication of two unsigned 32-bit
  86. * operands with a 64-bit result in order to speed up computations. On some
  87. * platforms, this is not available in hardware and has to be implemented in
  88. * software, usually in a library provided by the toolchain.
  89. *
  90. * Sometimes it is not desirable to have to link to that library. This option
  91. * removes the dependency of that library on platforms that lack a hardware
  92. * 64-bit multiplier by embedding a software implementation in Mbed TLS.
  93. *
  94. * Note that depending on the compiler, this may decrease performance compared
  95. * to using the library function provided by the toolchain.
  96. */
  97. //#define MBEDTLS_NO_64BIT_MULTIPLICATION
  98. /**
  99. * \def MBEDTLS_HAVE_SSE2
  100. *
  101. * CPU supports SSE2 instruction set.
  102. *
  103. * Uncomment if the CPU supports SSE2 (IA-32 specific).
  104. */
  105. //#define MBEDTLS_HAVE_SSE2
  106. /**
  107. * \def MBEDTLS_HAVE_TIME
  108. *
  109. * System has time.h and time().
  110. * The time does not need to be correct, only time differences are used,
  111. * by contrast with MBEDTLS_HAVE_TIME_DATE
  112. *
  113. * Defining MBEDTLS_HAVE_TIME allows you to specify MBEDTLS_PLATFORM_TIME_ALT,
  114. * MBEDTLS_PLATFORM_TIME_MACRO, MBEDTLS_PLATFORM_TIME_TYPE_MACRO and
  115. * MBEDTLS_PLATFORM_STD_TIME.
  116. *
  117. * Comment if your system does not support time functions.
  118. *
  119. * \note If MBEDTLS_TIMING_C is set - to enable the semi-portable timing
  120. * interface - timing.c will include time.h on suitable platforms
  121. * regardless of the setting of MBEDTLS_HAVE_TIME, unless
  122. * MBEDTLS_TIMING_ALT is used. See timing.c for more information.
  123. */
  124. #define MBEDTLS_HAVE_TIME
  125. /**
  126. * \def MBEDTLS_HAVE_TIME_DATE
  127. *
  128. * System has time.h, time(), and an implementation for
  129. * mbedtls_platform_gmtime_r() (see below).
  130. * The time needs to be correct (not necessarily very accurate, but at least
  131. * the date should be correct). This is used to verify the validity period of
  132. * X.509 certificates.
  133. *
  134. * Comment if your system does not have a correct clock.
  135. *
  136. * \note mbedtls_platform_gmtime_r() is an abstraction in platform_util.h that
  137. * behaves similarly to the gmtime_r() function from the C standard. Refer to
  138. * the documentation for mbedtls_platform_gmtime_r() for more information.
  139. *
  140. * \note It is possible to configure an implementation for
  141. * mbedtls_platform_gmtime_r() at compile-time by using the macro
  142. * MBEDTLS_PLATFORM_GMTIME_R_ALT.
  143. */
  144. #define MBEDTLS_HAVE_TIME_DATE
  145. /**
  146. * \def MBEDTLS_PLATFORM_MEMORY
  147. *
  148. * Enable the memory allocation layer.
  149. *
  150. * By default Mbed TLS uses the system-provided calloc() and free().
  151. * This allows different allocators (self-implemented or provided) to be
  152. * provided to the platform abstraction layer.
  153. *
  154. * Enabling #MBEDTLS_PLATFORM_MEMORY without the
  155. * MBEDTLS_PLATFORM_{FREE,CALLOC}_MACROs will provide
  156. * "mbedtls_platform_set_calloc_free()" allowing you to set an alternative calloc() and
  157. * free() function pointer at runtime.
  158. *
  159. * Enabling #MBEDTLS_PLATFORM_MEMORY and specifying
  160. * MBEDTLS_PLATFORM_{CALLOC,FREE}_MACROs will allow you to specify the
  161. * alternate function at compile time.
  162. *
  163. * An overview of how the value of mbedtls_calloc is determined:
  164. *
  165. * - if !MBEDTLS_PLATFORM_MEMORY
  166. * - mbedtls_calloc = calloc
  167. * - if MBEDTLS_PLATFORM_MEMORY
  168. * - if (MBEDTLS_PLATFORM_CALLOC_MACRO && MBEDTLS_PLATFORM_FREE_MACRO):
  169. * - mbedtls_calloc = MBEDTLS_PLATFORM_CALLOC_MACRO
  170. * - if !(MBEDTLS_PLATFORM_CALLOC_MACRO && MBEDTLS_PLATFORM_FREE_MACRO):
  171. * - Dynamic setup via mbedtls_platform_set_calloc_free is now possible with a default value MBEDTLS_PLATFORM_STD_CALLOC.
  172. * - How is MBEDTLS_PLATFORM_STD_CALLOC handled?
  173. * - if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS:
  174. * - MBEDTLS_PLATFORM_STD_CALLOC is not set to anything;
  175. * - MBEDTLS_PLATFORM_STD_MEM_HDR can be included if present;
  176. * - if !MBEDTLS_PLATFORM_NO_STD_FUNCTIONS:
  177. * - if MBEDTLS_PLATFORM_STD_CALLOC is present:
  178. * - User-defined MBEDTLS_PLATFORM_STD_CALLOC is respected;
  179. * - if !MBEDTLS_PLATFORM_STD_CALLOC:
  180. * - MBEDTLS_PLATFORM_STD_CALLOC = calloc
  181. *
  182. * - At this point the presence of MBEDTLS_PLATFORM_STD_CALLOC is checked.
  183. * - if !MBEDTLS_PLATFORM_STD_CALLOC
  184. * - MBEDTLS_PLATFORM_STD_CALLOC = uninitialized_calloc
  185. *
  186. * - mbedtls_calloc = MBEDTLS_PLATFORM_STD_CALLOC.
  187. *
  188. * Defining MBEDTLS_PLATFORM_CALLOC_MACRO and #MBEDTLS_PLATFORM_STD_CALLOC at the same time is not possible.
  189. * MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_FREE_MACRO must both be defined or undefined at the same time.
  190. * #MBEDTLS_PLATFORM_STD_CALLOC and #MBEDTLS_PLATFORM_STD_FREE do not have to be defined at the same time, as, if they are used,
  191. * dynamic setup of these functions is possible. See the tree above to see how are they handled in all cases.
  192. * An uninitialized #MBEDTLS_PLATFORM_STD_CALLOC always fails, returning a null pointer.
  193. * An uninitialized #MBEDTLS_PLATFORM_STD_FREE does not do anything.
  194. *
  195. * Requires: MBEDTLS_PLATFORM_C
  196. *
  197. * Enable this layer to allow use of alternative memory allocators.
  198. */
  199. //#define MBEDTLS_PLATFORM_MEMORY
  200. /**
  201. * \def MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
  202. *
  203. * Do not assign standard functions in the platform layer (e.g. calloc() to
  204. * MBEDTLS_PLATFORM_STD_CALLOC and printf() to MBEDTLS_PLATFORM_STD_PRINTF)
  205. *
  206. * This makes sure there are no linking errors on platforms that do not support
  207. * these functions. You will HAVE to provide alternatives, either at runtime
  208. * via the platform_set_xxx() functions or at compile time by setting
  209. * the MBEDTLS_PLATFORM_STD_XXX defines, or enabling a
  210. * MBEDTLS_PLATFORM_XXX_MACRO.
  211. *
  212. * Requires: MBEDTLS_PLATFORM_C
  213. *
  214. * Uncomment to prevent default assignment of standard functions in the
  215. * platform layer.
  216. */
  217. //#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
  218. /**
  219. * \def MBEDTLS_PLATFORM_EXIT_ALT
  220. *
  221. * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let Mbed TLS support the
  222. * function in the platform abstraction layer.
  223. *
  224. * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, Mbed TLS will
  225. * provide a function "mbedtls_platform_set_printf()" that allows you to set an
  226. * alternative printf function pointer.
  227. *
  228. * All these define require MBEDTLS_PLATFORM_C to be defined!
  229. *
  230. * \note MBEDTLS_PLATFORM_SNPRINTF_ALT is required on Windows;
  231. * it will be enabled automatically by check_config.h
  232. *
  233. * \warning MBEDTLS_PLATFORM_XXX_ALT cannot be defined at the same time as
  234. * MBEDTLS_PLATFORM_XXX_MACRO!
  235. *
  236. * Requires: MBEDTLS_PLATFORM_TIME_ALT requires MBEDTLS_HAVE_TIME
  237. *
  238. * Uncomment a macro to enable alternate implementation of specific base
  239. * platform function
  240. */
  241. //#define MBEDTLS_PLATFORM_SETBUF_ALT
  242. //#define MBEDTLS_PLATFORM_EXIT_ALT
  243. //#define MBEDTLS_PLATFORM_TIME_ALT
  244. //#define MBEDTLS_PLATFORM_FPRINTF_ALT
  245. //#define MBEDTLS_PLATFORM_PRINTF_ALT
  246. //#define MBEDTLS_PLATFORM_SNPRINTF_ALT
  247. //#define MBEDTLS_PLATFORM_VSNPRINTF_ALT
  248. //#define MBEDTLS_PLATFORM_NV_SEED_ALT
  249. //#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT
  250. //#define MBEDTLS_PLATFORM_MS_TIME_ALT
  251. /**
  252. * Uncomment the macro to let Mbed TLS use your alternate implementation of
  253. * mbedtls_platform_gmtime_r(). This replaces the default implementation in
  254. * platform_util.c.
  255. *
  256. * gmtime() is not a thread-safe function as defined in the C standard. The
  257. * library will try to use safer implementations of this function, such as
  258. * gmtime_r() when available. However, if Mbed TLS cannot identify the target
  259. * system, the implementation of mbedtls_platform_gmtime_r() will default to
  260. * using the standard gmtime(). In this case, calls from the library to
  261. * gmtime() will be guarded by the global mutex mbedtls_threading_gmtime_mutex
  262. * if MBEDTLS_THREADING_C is enabled. We recommend that calls from outside the
  263. * library are also guarded with this mutex to avoid race conditions. However,
  264. * if the macro MBEDTLS_PLATFORM_GMTIME_R_ALT is defined, Mbed TLS will
  265. * unconditionally use the implementation for mbedtls_platform_gmtime_r()
  266. * supplied at compile time.
  267. */
  268. //#define MBEDTLS_PLATFORM_GMTIME_R_ALT
  269. /**
  270. * Uncomment the macro to let Mbed TLS use your alternate implementation of
  271. * mbedtls_platform_zeroize(), to wipe sensitive data in memory. This replaces
  272. * the default implementation in platform_util.c.
  273. *
  274. * By default, the library uses a system function such as memset_s()
  275. * (optional feature of C11), explicit_bzero() (BSD and compatible), or
  276. * SecureZeroMemory (Windows). If no such function is detected, the library
  277. * falls back to a plain C implementation. Compilers are technically
  278. * permitted to optimize this implementation out, meaning that the memory is
  279. * not actually wiped. The library tries to prevent that, but the C language
  280. * makes it impossible to guarantee that the memory will always be wiped.
  281. *
  282. * If your platform provides a guaranteed method to wipe memory which
  283. * `platform_util.c` does not detect, define this macro to the name of
  284. * a function that takes two arguments, a `void *` pointer and a length,
  285. * and wipes that many bytes starting at the specified address. For example,
  286. * if your platform has explicit_bzero() but `platform_util.c` does not
  287. * detect its presence, define `MBEDTLS_PLATFORM_ZEROIZE_ALT` to be
  288. * `explicit_bzero` to use that function as mbedtls_platform_zeroize().
  289. */
  290. //#define MBEDTLS_PLATFORM_ZEROIZE_ALT
  291. /**
  292. * \def MBEDTLS_DEPRECATED_WARNING
  293. *
  294. * Mark deprecated functions and features so that they generate a warning if
  295. * used. Functionality deprecated in one version will usually be removed in the
  296. * next version. You can enable this to help you prepare the transition to a
  297. * new major version by making sure your code is not using this functionality.
  298. *
  299. * This only works with GCC and Clang. With other compilers, you may want to
  300. * use MBEDTLS_DEPRECATED_REMOVED
  301. *
  302. * Uncomment to get warnings on using deprecated functions and features.
  303. */
  304. //#define MBEDTLS_DEPRECATED_WARNING
  305. /**
  306. * \def MBEDTLS_DEPRECATED_REMOVED
  307. *
  308. * Remove deprecated functions and features so that they generate an error if
  309. * used. Functionality deprecated in one version will usually be removed in the
  310. * next version. You can enable this to help you prepare the transition to a
  311. * new major version by making sure your code is not using this functionality.
  312. *
  313. * Uncomment to get errors on using deprecated functions and features.
  314. */
  315. //#define MBEDTLS_DEPRECATED_REMOVED
  316. /** \} name SECTION: System support */
  317. /**
  318. * \name SECTION: Mbed TLS feature support
  319. *
  320. * This section sets support for features that are or are not needed
  321. * within the modules that are enabled.
  322. * \{
  323. */
  324. /**
  325. * \def MBEDTLS_TIMING_ALT
  326. *
  327. * Uncomment to provide your own alternate implementation for
  328. * mbedtls_timing_get_timer(), mbedtls_set_alarm(), mbedtls_set/get_delay()
  329. *
  330. * Only works if you have MBEDTLS_TIMING_C enabled.
  331. *
  332. * You will need to provide a header "timing_alt.h" and an implementation at
  333. * compile time.
  334. */
  335. //#define MBEDTLS_TIMING_ALT
  336. /**
  337. * \def MBEDTLS_AES_ALT
  338. *
  339. * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let Mbed TLS use your
  340. * alternate core implementation of a symmetric crypto, an arithmetic or hash
  341. * module (e.g. platform specific assembly optimized implementations). Keep
  342. * in mind that the function prototypes should remain the same.
  343. *
  344. * This replaces the whole module. If you only want to replace one of the
  345. * functions, use one of the MBEDTLS__FUNCTION_NAME__ALT flags.
  346. *
  347. * Example: In case you uncomment MBEDTLS_AES_ALT, Mbed TLS will no longer
  348. * provide the "struct mbedtls_aes_context" definition and omit the base
  349. * function declarations and implementations. "aes_alt.h" will be included from
  350. * "aes.h" to include the new function definitions.
  351. *
  352. * Uncomment a macro to enable alternate implementation of the corresponding
  353. * module.
  354. *
  355. * \warning MD5, DES and SHA-1 are considered weak and their
  356. * use constitutes a security risk. If possible, we recommend
  357. * avoiding dependencies on them, and considering stronger message
  358. * digests and ciphers instead.
  359. *
  360. */
  361. //#define MBEDTLS_AES_ALT
  362. //#define MBEDTLS_ARIA_ALT
  363. //#define MBEDTLS_CAMELLIA_ALT
  364. //#define MBEDTLS_CCM_ALT
  365. //#define MBEDTLS_CHACHA20_ALT
  366. //#define MBEDTLS_CHACHAPOLY_ALT
  367. //#define MBEDTLS_CMAC_ALT
  368. //#define MBEDTLS_DES_ALT
  369. //#define MBEDTLS_DHM_ALT
  370. //#define MBEDTLS_ECJPAKE_ALT
  371. //#define MBEDTLS_GCM_ALT
  372. //#define MBEDTLS_NIST_KW_ALT
  373. //#define MBEDTLS_MD5_ALT
  374. //#define MBEDTLS_POLY1305_ALT
  375. //#define MBEDTLS_RIPEMD160_ALT
  376. //#define MBEDTLS_RSA_ALT
  377. //#define MBEDTLS_SHA1_ALT
  378. //#define MBEDTLS_SHA256_ALT
  379. //#define MBEDTLS_SHA512_ALT
  380. /*
  381. * When replacing the elliptic curve module, please consider, that it is
  382. * implemented with two .c files:
  383. * - ecp.c
  384. * - ecp_curves.c
  385. * You can replace them very much like all the other MBEDTLS__MODULE_NAME__ALT
  386. * macros as described above. The only difference is that you have to make sure
  387. * that you provide functionality for both .c files.
  388. */
  389. //#define MBEDTLS_ECP_ALT
  390. /**
  391. * \def MBEDTLS_SHA256_PROCESS_ALT
  392. *
  393. * MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let Mbed TLS use you
  394. * alternate core implementation of symmetric crypto or hash function. Keep in
  395. * mind that function prototypes should remain the same.
  396. *
  397. * This replaces only one function. The header file from Mbed TLS is still
  398. * used, in contrast to the MBEDTLS__MODULE_NAME__ALT flags.
  399. *
  400. * Example: In case you uncomment MBEDTLS_SHA256_PROCESS_ALT, Mbed TLS will
  401. * no longer provide the mbedtls_sha1_process() function, but it will still provide
  402. * the other function (using your mbedtls_sha1_process() function) and the definition
  403. * of mbedtls_sha1_context, so your implementation of mbedtls_sha1_process must be compatible
  404. * with this definition.
  405. *
  406. * \note If you use the AES_xxx_ALT macros, then it is recommended to also set
  407. * MBEDTLS_AES_ROM_TABLES in order to help the linker garbage-collect the AES
  408. * tables.
  409. *
  410. * Uncomment a macro to enable alternate implementation of the corresponding
  411. * function.
  412. *
  413. * \warning MD5, DES and SHA-1 are considered weak and their use
  414. * constitutes a security risk. If possible, we recommend avoiding
  415. * dependencies on them, and considering stronger message digests
  416. * and ciphers instead.
  417. *
  418. * \warning If both MBEDTLS_ECDSA_SIGN_ALT and MBEDTLS_ECDSA_DETERMINISTIC are
  419. * enabled, then the deterministic ECDH signature functions pass the
  420. * the static HMAC-DRBG as RNG to mbedtls_ecdsa_sign(). Therefore
  421. * alternative implementations should use the RNG only for generating
  422. * the ephemeral key and nothing else. If this is not possible, then
  423. * MBEDTLS_ECDSA_DETERMINISTIC should be disabled and an alternative
  424. * implementation should be provided for mbedtls_ecdsa_sign_det_ext().
  425. *
  426. */
  427. //#define MBEDTLS_MD5_PROCESS_ALT
  428. //#define MBEDTLS_RIPEMD160_PROCESS_ALT
  429. //#define MBEDTLS_SHA1_PROCESS_ALT
  430. //#define MBEDTLS_SHA256_PROCESS_ALT
  431. //#define MBEDTLS_SHA512_PROCESS_ALT
  432. //#define MBEDTLS_DES_SETKEY_ALT
  433. //#define MBEDTLS_DES_CRYPT_ECB_ALT
  434. //#define MBEDTLS_DES3_CRYPT_ECB_ALT
  435. //#define MBEDTLS_AES_SETKEY_ENC_ALT
  436. //#define MBEDTLS_AES_SETKEY_DEC_ALT
  437. //#define MBEDTLS_AES_ENCRYPT_ALT
  438. //#define MBEDTLS_AES_DECRYPT_ALT
  439. //#define MBEDTLS_ECDH_GEN_PUBLIC_ALT
  440. //#define MBEDTLS_ECDH_COMPUTE_SHARED_ALT
  441. //#define MBEDTLS_ECDSA_VERIFY_ALT
  442. //#define MBEDTLS_ECDSA_SIGN_ALT
  443. //#define MBEDTLS_ECDSA_GENKEY_ALT
  444. /**
  445. * \def MBEDTLS_ECP_INTERNAL_ALT
  446. *
  447. * Expose a part of the internal interface of the Elliptic Curve Point module.
  448. *
  449. * MBEDTLS_ECP__FUNCTION_NAME__ALT: Uncomment a macro to let Mbed TLS use your
  450. * alternative core implementation of elliptic curve arithmetic. Keep in mind
  451. * that function prototypes should remain the same.
  452. *
  453. * This partially replaces one function. The header file from Mbed TLS is still
  454. * used, in contrast to the MBEDTLS_ECP_ALT flag. The original implementation
  455. * is still present and it is used for group structures not supported by the
  456. * alternative.
  457. *
  458. * The original implementation can in addition be removed by setting the
  459. * MBEDTLS_ECP_NO_FALLBACK option, in which case any function for which the
  460. * corresponding MBEDTLS_ECP__FUNCTION_NAME__ALT macro is defined will not be
  461. * able to fallback to curves not supported by the alternative implementation.
  462. *
  463. * Any of these options become available by defining MBEDTLS_ECP_INTERNAL_ALT
  464. * and implementing the following functions:
  465. * unsigned char mbedtls_internal_ecp_grp_capable(
  466. * const mbedtls_ecp_group *grp )
  467. * int mbedtls_internal_ecp_init( const mbedtls_ecp_group *grp )
  468. * void mbedtls_internal_ecp_free( const mbedtls_ecp_group *grp )
  469. * The mbedtls_internal_ecp_grp_capable function should return 1 if the
  470. * replacement functions implement arithmetic for the given group and 0
  471. * otherwise.
  472. * The functions mbedtls_internal_ecp_init and mbedtls_internal_ecp_free are
  473. * called before and after each point operation and provide an opportunity to
  474. * implement optimized set up and tear down instructions.
  475. *
  476. * Example: In case you set MBEDTLS_ECP_INTERNAL_ALT and
  477. * MBEDTLS_ECP_DOUBLE_JAC_ALT, Mbed TLS will still provide the ecp_double_jac()
  478. * function, but will use your mbedtls_internal_ecp_double_jac() if the group
  479. * for the operation is supported by your implementation (i.e. your
  480. * mbedtls_internal_ecp_grp_capable() function returns 1 for this group). If the
  481. * group is not supported by your implementation, then the original Mbed TLS
  482. * implementation of ecp_double_jac() is used instead, unless this fallback
  483. * behaviour is disabled by setting MBEDTLS_ECP_NO_FALLBACK (in which case
  484. * ecp_double_jac() will return MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE).
  485. *
  486. * The function prototypes and the definition of mbedtls_ecp_group and
  487. * mbedtls_ecp_point will not change based on MBEDTLS_ECP_INTERNAL_ALT, so your
  488. * implementation of mbedtls_internal_ecp__function_name__ must be compatible
  489. * with their definitions.
  490. *
  491. * Uncomment a macro to enable alternate implementation of the corresponding
  492. * function.
  493. */
  494. /* Required for all the functions in this section */
  495. //#define MBEDTLS_ECP_INTERNAL_ALT
  496. /* Turn off software fallback for curves not supported in hardware */
  497. //#define MBEDTLS_ECP_NO_FALLBACK
  498. /* Support for Weierstrass curves with Jacobi representation */
  499. //#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT
  500. //#define MBEDTLS_ECP_ADD_MIXED_ALT
  501. //#define MBEDTLS_ECP_DOUBLE_JAC_ALT
  502. //#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
  503. //#define MBEDTLS_ECP_NORMALIZE_JAC_ALT
  504. /* Support for curves with Montgomery arithmetic */
  505. //#define MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT
  506. //#define MBEDTLS_ECP_RANDOMIZE_MXZ_ALT
  507. //#define MBEDTLS_ECP_NORMALIZE_MXZ_ALT
  508. /**
  509. * \def MBEDTLS_ENTROPY_HARDWARE_ALT
  510. *
  511. * Uncomment this macro to let Mbed TLS use your own implementation of a
  512. * hardware entropy collector.
  513. *
  514. * Your function must be called \c mbedtls_hardware_poll(), have the same
  515. * prototype as declared in library/entropy_poll.h, and accept NULL as first
  516. * argument.
  517. *
  518. * Uncomment to use your own hardware entropy collector.
  519. */
  520. //#define MBEDTLS_ENTROPY_HARDWARE_ALT
  521. /**
  522. * \def MBEDTLS_AES_ROM_TABLES
  523. *
  524. * Use precomputed AES tables stored in ROM.
  525. *
  526. * Uncomment this macro to use precomputed AES tables stored in ROM.
  527. * Comment this macro to generate AES tables in RAM at runtime.
  528. *
  529. * Tradeoff: Using precomputed ROM tables reduces RAM usage by ~8kb
  530. * (or ~2kb if \c MBEDTLS_AES_FEWER_TABLES is used) and reduces the
  531. * initialization time before the first AES operation can be performed.
  532. * It comes at the cost of additional ~8kb ROM use (resp. ~2kb if \c
  533. * MBEDTLS_AES_FEWER_TABLES below is used), and potentially degraded
  534. * performance if ROM access is slower than RAM access.
  535. *
  536. * This option is independent of \c MBEDTLS_AES_FEWER_TABLES.
  537. */
  538. //#define MBEDTLS_AES_ROM_TABLES
  539. /**
  540. * \def MBEDTLS_AES_FEWER_TABLES
  541. *
  542. * Use less ROM/RAM for AES tables.
  543. *
  544. * Uncommenting this macro omits 75% of the AES tables from
  545. * ROM / RAM (depending on the value of \c MBEDTLS_AES_ROM_TABLES)
  546. * by computing their values on the fly during operations
  547. * (the tables are entry-wise rotations of one another).
  548. *
  549. * Tradeoff: Uncommenting this reduces the RAM / ROM footprint
  550. * by ~6kb but at the cost of more arithmetic operations during
  551. * runtime. Specifically, one has to compare 4 accesses within
  552. * different tables to 4 accesses with additional arithmetic
  553. * operations within the same table. The performance gain/loss
  554. * depends on the system and memory details.
  555. *
  556. * This option is independent of \c MBEDTLS_AES_ROM_TABLES.
  557. */
  558. //#define MBEDTLS_AES_FEWER_TABLES
  559. /**
  560. * \def MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
  561. *
  562. * Use only 128-bit keys in AES operations to save ROM.
  563. *
  564. * Uncomment this macro to remove support for AES operations that use 192-
  565. * or 256-bit keys.
  566. *
  567. * Uncommenting this macro reduces the size of AES code by ~300 bytes
  568. * on v8-M/Thumb2.
  569. *
  570. * Module: library/aes.c
  571. *
  572. * Requires: MBEDTLS_AES_C
  573. */
  574. //#define MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
  575. /*
  576. * Disable plain C implementation for AES.
  577. *
  578. * When the plain C implementation is enabled, and an implementation using a
  579. * special CPU feature (such as MBEDTLS_AESCE_C) is also enabled, runtime
  580. * detection will be used to select between them.
  581. *
  582. * If only one implementation is present, runtime detection will not be used.
  583. * This configuration will crash at runtime if running on a CPU without the
  584. * necessary features. It will not build unless at least one of MBEDTLS_AESCE_C
  585. * and/or MBEDTLS_AESNI_C is enabled & present in the build.
  586. */
  587. //#define MBEDTLS_AES_USE_HARDWARE_ONLY
  588. /**
  589. * \def MBEDTLS_CAMELLIA_SMALL_MEMORY
  590. *
  591. * Use less ROM for the Camellia implementation (saves about 768 bytes).
  592. *
  593. * Uncomment this macro to use less memory for Camellia.
  594. */
  595. //#define MBEDTLS_CAMELLIA_SMALL_MEMORY
  596. /**
  597. * \def MBEDTLS_CHECK_RETURN_WARNING
  598. *
  599. * If this macro is defined, emit a compile-time warning if application code
  600. * calls a function without checking its return value, but the return value
  601. * should generally be checked in portable applications.
  602. *
  603. * This is only supported on platforms where #MBEDTLS_CHECK_RETURN is
  604. * implemented. Otherwise this option has no effect.
  605. *
  606. * Uncomment to get warnings on using fallible functions without checking
  607. * their return value.
  608. *
  609. * \note This feature is a work in progress.
  610. * Warnings will be added to more functions in the future.
  611. *
  612. * \note A few functions are considered critical, and ignoring the return
  613. * value of these functions will trigger a warning even if this
  614. * macro is not defined. To completely disable return value check
  615. * warnings, define #MBEDTLS_CHECK_RETURN with an empty expansion.
  616. */
  617. //#define MBEDTLS_CHECK_RETURN_WARNING
  618. /**
  619. * \def MBEDTLS_CIPHER_MODE_CBC
  620. *
  621. * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers.
  622. */
  623. #define MBEDTLS_CIPHER_MODE_CBC
  624. /**
  625. * \def MBEDTLS_CIPHER_MODE_CFB
  626. *
  627. * Enable Cipher Feedback mode (CFB) for symmetric ciphers.
  628. */
  629. #define MBEDTLS_CIPHER_MODE_CFB
  630. /**
  631. * \def MBEDTLS_CIPHER_MODE_CTR
  632. *
  633. * Enable Counter Block Cipher mode (CTR) for symmetric ciphers.
  634. */
  635. #define MBEDTLS_CIPHER_MODE_CTR
  636. /**
  637. * \def MBEDTLS_CIPHER_MODE_OFB
  638. *
  639. * Enable Output Feedback mode (OFB) for symmetric ciphers.
  640. */
  641. #define MBEDTLS_CIPHER_MODE_OFB
  642. /**
  643. * \def MBEDTLS_CIPHER_MODE_XTS
  644. *
  645. * Enable Xor-encrypt-xor with ciphertext stealing mode (XTS) for AES.
  646. */
  647. #define MBEDTLS_CIPHER_MODE_XTS
  648. /**
  649. * \def MBEDTLS_CIPHER_NULL_CIPHER
  650. *
  651. * Enable NULL cipher.
  652. * Warning: Only do so when you know what you are doing. This allows for
  653. * encryption or channels without any security!
  654. *
  655. * To enable the following ciphersuites:
  656. * MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA
  657. * MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA
  658. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA
  659. * MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA
  660. * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384
  661. * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256
  662. * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA
  663. * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA384
  664. * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA256
  665. * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA
  666. * MBEDTLS_TLS_RSA_WITH_NULL_SHA256
  667. * MBEDTLS_TLS_RSA_WITH_NULL_SHA
  668. * MBEDTLS_TLS_RSA_WITH_NULL_MD5
  669. * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA384
  670. * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA256
  671. * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA
  672. * MBEDTLS_TLS_PSK_WITH_NULL_SHA384
  673. * MBEDTLS_TLS_PSK_WITH_NULL_SHA256
  674. * MBEDTLS_TLS_PSK_WITH_NULL_SHA
  675. *
  676. * Uncomment this macro to enable the NULL cipher and ciphersuites
  677. */
  678. //#define MBEDTLS_CIPHER_NULL_CIPHER
  679. /**
  680. * \def MBEDTLS_CIPHER_PADDING_PKCS7
  681. *
  682. * MBEDTLS_CIPHER_PADDING_XXX: Uncomment or comment macros to add support for
  683. * specific padding modes in the cipher layer with cipher modes that support
  684. * padding (e.g. CBC)
  685. *
  686. * If you disable all padding modes, only full blocks can be used with CBC.
  687. *
  688. * Enable padding modes in the cipher layer.
  689. */
  690. #define MBEDTLS_CIPHER_PADDING_PKCS7
  691. #define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
  692. #define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
  693. #define MBEDTLS_CIPHER_PADDING_ZEROS
  694. /** \def MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
  695. *
  696. * Uncomment this macro to use a 128-bit key in the CTR_DRBG module.
  697. * Without this, CTR_DRBG uses a 256-bit key
  698. * unless \c MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH is set.
  699. */
  700. //#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
  701. /**
  702. * Enable the verified implementations of ECDH primitives from Project Everest
  703. * (currently only Curve25519). This feature changes the layout of ECDH
  704. * contexts and therefore is a compatibility break for applications that access
  705. * fields of a mbedtls_ecdh_context structure directly. See also
  706. * MBEDTLS_ECDH_LEGACY_CONTEXT in include/mbedtls/ecdh.h.
  707. *
  708. * The Everest code is provided under the Apache 2.0 license only; therefore enabling this
  709. * option is not compatible with taking the library under the GPL v2.0-or-later license.
  710. */
  711. //#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
  712. /**
  713. * \def MBEDTLS_ECP_DP_SECP192R1_ENABLED
  714. *
  715. * MBEDTLS_ECP_XXXX_ENABLED: Enables specific curves within the Elliptic Curve
  716. * module. By default all supported curves are enabled.
  717. *
  718. * Comment macros to disable the curve and functions for it
  719. */
  720. /* Short Weierstrass curves (supporting ECP, ECDH, ECDSA) */
  721. #define MBEDTLS_ECP_DP_SECP192R1_ENABLED
  722. #define MBEDTLS_ECP_DP_SECP224R1_ENABLED
  723. #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
  724. #define MBEDTLS_ECP_DP_SECP384R1_ENABLED
  725. #define MBEDTLS_ECP_DP_SECP521R1_ENABLED
  726. #define MBEDTLS_ECP_DP_SECP192K1_ENABLED
  727. #define MBEDTLS_ECP_DP_SECP224K1_ENABLED
  728. #define MBEDTLS_ECP_DP_SECP256K1_ENABLED
  729. #define MBEDTLS_ECP_DP_BP256R1_ENABLED
  730. #define MBEDTLS_ECP_DP_BP384R1_ENABLED
  731. #define MBEDTLS_ECP_DP_BP512R1_ENABLED
  732. /* Montgomery curves (supporting ECP) */
  733. #define MBEDTLS_ECP_DP_CURVE25519_ENABLED
  734. #define MBEDTLS_ECP_DP_CURVE448_ENABLED
  735. /**
  736. * \def MBEDTLS_ECP_NIST_OPTIM
  737. *
  738. * Enable specific 'modulo p' routines for each NIST prime.
  739. * Depending on the prime and architecture, makes operations 4 to 8 times
  740. * faster on the corresponding curve.
  741. *
  742. * Comment this macro to disable NIST curves optimisation.
  743. */
  744. #define MBEDTLS_ECP_NIST_OPTIM
  745. /**
  746. * \def MBEDTLS_ECP_RESTARTABLE
  747. *
  748. * Enable "non-blocking" ECC operations that can return early and be resumed.
  749. *
  750. * This allows various functions to pause by returning
  751. * #MBEDTLS_ERR_ECP_IN_PROGRESS (or, for functions in the SSL module,
  752. * #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) and then be called later again in
  753. * order to further progress and eventually complete their operation. This is
  754. * controlled through mbedtls_ecp_set_max_ops() which limits the maximum
  755. * number of ECC operations a function may perform before pausing; see
  756. * mbedtls_ecp_set_max_ops() for more information.
  757. *
  758. * This is useful in non-threaded environments if you want to avoid blocking
  759. * for too long on ECC (and, hence, X.509 or SSL/TLS) operations.
  760. *
  761. * This option:
  762. * - Adds xxx_restartable() variants of existing operations in the
  763. * following modules, with corresponding restart context types:
  764. * - ECP (for Short Weierstrass curves only): scalar multiplication (mul),
  765. * linear combination (muladd);
  766. * - ECDSA: signature generation & verification;
  767. * - PK: signature generation & verification;
  768. * - X509: certificate chain verification.
  769. * - Adds mbedtls_ecdh_enable_restart() in the ECDH module.
  770. * - Changes the behaviour of TLS 1.2 clients (not servers) when using the
  771. * ECDHE-ECDSA key exchange (not other key exchanges) to make all ECC
  772. * computations restartable:
  773. * - ECDH operations from the key exchange, only for Short Weierstrass
  774. * curves, only when MBEDTLS_USE_PSA_CRYPTO is not enabled.
  775. * - verification of the server's key exchange signature;
  776. * - verification of the server's certificate chain;
  777. * - generation of the client's signature if client authentication is used,
  778. * with an ECC key/certificate.
  779. *
  780. * \note In the cases above, the usual SSL/TLS functions, such as
  781. * mbedtls_ssl_handshake(), can now return
  782. * MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS.
  783. *
  784. * \note When this option and MBEDTLS_USE_PSA_CRYPTO are both enabled,
  785. * restartable operations in PK, X.509 and TLS (see above) are not
  786. * using PSA. On the other hand, ECDH computations in TLS are using
  787. * PSA, and are not restartable. These are temporary limitations that
  788. * should be lifted in the future.
  789. *
  790. * \note This option only works with the default software implementation of
  791. * elliptic curve functionality. It is incompatible with
  792. * MBEDTLS_ECP_ALT, MBEDTLS_ECDH_XXX_ALT, MBEDTLS_ECDSA_XXX_ALT.
  793. *
  794. * Requires: MBEDTLS_ECP_C
  795. *
  796. * Uncomment this macro to enable restartable ECC computations.
  797. */
  798. //#define MBEDTLS_ECP_RESTARTABLE
  799. /**
  800. * Uncomment to enable using new bignum code in the ECC modules.
  801. *
  802. * \warning This is currently experimental, incomplete and therefore should not
  803. * be used in production.
  804. */
  805. //#define MBEDTLS_ECP_WITH_MPI_UINT
  806. /**
  807. * \def MBEDTLS_ECDSA_DETERMINISTIC
  808. *
  809. * Enable deterministic ECDSA (RFC 6979).
  810. * Standard ECDSA is "fragile" in the sense that lack of entropy when signing
  811. * may result in a compromise of the long-term signing key. This is avoided by
  812. * the deterministic variant.
  813. *
  814. * Requires: MBEDTLS_HMAC_DRBG_C, MBEDTLS_ECDSA_C
  815. *
  816. * Comment this macro to disable deterministic ECDSA.
  817. */
  818. #define MBEDTLS_ECDSA_DETERMINISTIC
  819. /**
  820. * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
  821. *
  822. * Enable the PSK based ciphersuite modes in SSL / TLS.
  823. *
  824. * This enables the following ciphersuites (if other requisites are
  825. * enabled as well):
  826. * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384
  827. * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384
  828. * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA
  829. * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384
  830. * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384
  831. * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256
  832. * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256
  833. * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA
  834. * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
  835. * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
  836. */
  837. #define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
  838. /**
  839. * \def MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
  840. *
  841. * Enable the DHE-PSK based ciphersuite modes in SSL / TLS.
  842. *
  843. * Requires: MBEDTLS_DHM_C
  844. *
  845. * This enables the following ciphersuites (if other requisites are
  846. * enabled as well):
  847. * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
  848. * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384
  849. * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA
  850. * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384
  851. * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
  852. * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
  853. * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256
  854. * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA
  855. * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256
  856. * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
  857. *
  858. * \warning Using DHE constitutes a security risk as it
  859. * is not possible to validate custom DH parameters.
  860. * If possible, it is recommended users should consider
  861. * preferring other methods of key exchange.
  862. * See dhm.h for more details.
  863. *
  864. */
  865. #define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
  866. /**
  867. * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
  868. *
  869. * Enable the ECDHE-PSK based ciphersuite modes in SSL / TLS.
  870. *
  871. * Requires: MBEDTLS_ECDH_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDH)
  872. *
  873. * This enables the following ciphersuites (if other requisites are
  874. * enabled as well):
  875. * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384
  876. * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA
  877. * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
  878. * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
  879. * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
  880. * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
  881. */
  882. #define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
  883. /**
  884. * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
  885. *
  886. * Enable the RSA-PSK based ciphersuite modes in SSL / TLS.
  887. *
  888. * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
  889. * MBEDTLS_X509_CRT_PARSE_C
  890. *
  891. * This enables the following ciphersuites (if other requisites are
  892. * enabled as well):
  893. * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384
  894. * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384
  895. * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA
  896. * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384
  897. * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384
  898. * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256
  899. * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256
  900. * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA
  901. * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256
  902. * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256
  903. */
  904. #define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
  905. /**
  906. * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
  907. *
  908. * Enable the RSA-only based ciphersuite modes in SSL / TLS.
  909. *
  910. * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
  911. * MBEDTLS_X509_CRT_PARSE_C
  912. *
  913. * This enables the following ciphersuites (if other requisites are
  914. * enabled as well):
  915. * MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384
  916. * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256
  917. * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA
  918. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384
  919. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256
  920. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
  921. * MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256
  922. * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256
  923. * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA
  924. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256
  925. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
  926. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
  927. */
  928. #define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
  929. /**
  930. * \def MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
  931. *
  932. * Enable the DHE-RSA based ciphersuite modes in SSL / TLS.
  933. *
  934. * Requires: MBEDTLS_DHM_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
  935. * MBEDTLS_X509_CRT_PARSE_C
  936. *
  937. * This enables the following ciphersuites (if other requisites are
  938. * enabled as well):
  939. * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
  940. * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
  941. * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA
  942. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
  943. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256
  944. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
  945. * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
  946. * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
  947. * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA
  948. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
  949. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
  950. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
  951. *
  952. * \warning Using DHE constitutes a security risk as it
  953. * is not possible to validate custom DH parameters.
  954. * If possible, it is recommended users should consider
  955. * preferring other methods of key exchange.
  956. * See dhm.h for more details.
  957. *
  958. */
  959. #define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
  960. /**
  961. * \def MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
  962. *
  963. * Enable the ECDHE-RSA based ciphersuite modes in SSL / TLS.
  964. *
  965. * Requires: MBEDTLS_ECDH_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDH)
  966. * MBEDTLS_RSA_C
  967. * MBEDTLS_PKCS1_V15
  968. * MBEDTLS_X509_CRT_PARSE_C
  969. *
  970. * This enables the following ciphersuites (if other requisites are
  971. * enabled as well):
  972. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
  973. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
  974. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
  975. * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
  976. * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384
  977. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  978. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
  979. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
  980. * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
  981. * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
  982. */
  983. #define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
  984. /**
  985. * \def MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
  986. *
  987. * Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS.
  988. *
  989. * Requires: MBEDTLS_ECDH_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDH)
  990. * MBEDTLS_ECDSA_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDSA)
  991. * MBEDTLS_X509_CRT_PARSE_C
  992. *
  993. * This enables the following ciphersuites (if other requisites are
  994. * enabled as well):
  995. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
  996. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
  997. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
  998. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
  999. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
  1000. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
  1001. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
  1002. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
  1003. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
  1004. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
  1005. */
  1006. #define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
  1007. /**
  1008. * \def MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
  1009. *
  1010. * Enable the ECDH-ECDSA based ciphersuite modes in SSL / TLS.
  1011. *
  1012. * Requires: MBEDTLS_ECDH_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDH)
  1013. * MBEDTLS_ECDSA_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDSA)
  1014. * MBEDTLS_X509_CRT_PARSE_C
  1015. *
  1016. * This enables the following ciphersuites (if other requisites are
  1017. * enabled as well):
  1018. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
  1019. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
  1020. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
  1021. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
  1022. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
  1023. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
  1024. * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
  1025. * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
  1026. * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
  1027. * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
  1028. */
  1029. #define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
  1030. /**
  1031. * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
  1032. *
  1033. * Enable the ECDH-RSA based ciphersuite modes in SSL / TLS.
  1034. *
  1035. * Requires: MBEDTLS_ECDH_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDH)
  1036. * MBEDTLS_RSA_C
  1037. * MBEDTLS_X509_CRT_PARSE_C
  1038. *
  1039. * This enables the following ciphersuites (if other requisites are
  1040. * enabled as well):
  1041. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
  1042. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
  1043. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
  1044. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
  1045. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
  1046. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
  1047. * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256
  1048. * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384
  1049. * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
  1050. * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
  1051. */
  1052. #define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
  1053. /**
  1054. * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
  1055. *
  1056. * Enable the ECJPAKE based ciphersuite modes in SSL / TLS.
  1057. *
  1058. * \warning This is currently experimental. EC J-PAKE support is based on the
  1059. * Thread v1.0.0 specification; incompatible changes to the specification
  1060. * might still happen. For this reason, this is disabled by default.
  1061. *
  1062. * Requires: MBEDTLS_ECJPAKE_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_JPAKE)
  1063. * SHA-256 (via MBEDTLS_SHA256_C or a PSA driver)
  1064. * MBEDTLS_ECP_DP_SECP256R1_ENABLED
  1065. *
  1066. * \warning If SHA-256 is provided only by a PSA driver, you must call
  1067. * psa_crypto_init() before the first handshake (even if
  1068. * MBEDTLS_USE_PSA_CRYPTO is disabled).
  1069. *
  1070. * This enables the following ciphersuites (if other requisites are
  1071. * enabled as well):
  1072. * MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8
  1073. */
  1074. //#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
  1075. /**
  1076. * \def MBEDTLS_PK_PARSE_EC_EXTENDED
  1077. *
  1078. * Enhance support for reading EC keys using variants of SEC1 not allowed by
  1079. * RFC 5915 and RFC 5480.
  1080. *
  1081. * Currently this means parsing the SpecifiedECDomain choice of EC
  1082. * parameters (only known groups are supported, not arbitrary domains, to
  1083. * avoid validation issues).
  1084. *
  1085. * Disable if you only need to support RFC 5915 + 5480 key formats.
  1086. */
  1087. #define MBEDTLS_PK_PARSE_EC_EXTENDED
  1088. /**
  1089. * \def MBEDTLS_PK_PARSE_EC_COMPRESSED
  1090. *
  1091. * Enable the support for parsing public keys of type Short Weierstrass
  1092. * (MBEDTLS_ECP_DP_SECP_XXX and MBEDTLS_ECP_DP_BP_XXX) which are using the
  1093. * compressed point format. This parsing is done through ECP module's functions.
  1094. *
  1095. * \note As explained in the description of MBEDTLS_ECP_PF_COMPRESSED (in ecp.h)
  1096. * the only unsupported curves are MBEDTLS_ECP_DP_SECP224R1 and
  1097. * MBEDTLS_ECP_DP_SECP224K1.
  1098. */
  1099. #define MBEDTLS_PK_PARSE_EC_COMPRESSED
  1100. /**
  1101. * \def MBEDTLS_ERROR_STRERROR_DUMMY
  1102. *
  1103. * Enable a dummy error function to make use of mbedtls_strerror() in
  1104. * third party libraries easier when MBEDTLS_ERROR_C is disabled
  1105. * (no effect when MBEDTLS_ERROR_C is enabled).
  1106. *
  1107. * You can safely disable this if MBEDTLS_ERROR_C is enabled, or if you're
  1108. * not using mbedtls_strerror() or error_strerror() in your application.
  1109. *
  1110. * Disable if you run into name conflicts and want to really remove the
  1111. * mbedtls_strerror()
  1112. */
  1113. #define MBEDTLS_ERROR_STRERROR_DUMMY
  1114. /**
  1115. * \def MBEDTLS_GENPRIME
  1116. *
  1117. * Enable the prime-number generation code.
  1118. *
  1119. * Requires: MBEDTLS_BIGNUM_C
  1120. */
  1121. #define MBEDTLS_GENPRIME
  1122. /**
  1123. * \def MBEDTLS_FS_IO
  1124. *
  1125. * Enable functions that use the filesystem.
  1126. */
  1127. #define MBEDTLS_FS_IO
  1128. /**
  1129. * \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
  1130. *
  1131. * Do not add default entropy sources in mbedtls_entropy_init().
  1132. *
  1133. * This is useful to have more control over the added entropy sources in an
  1134. * application.
  1135. *
  1136. * Uncomment this macro to prevent loading of default entropy functions.
  1137. */
  1138. //#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
  1139. /**
  1140. * \def MBEDTLS_NO_PLATFORM_ENTROPY
  1141. *
  1142. * Do not use built-in platform entropy functions.
  1143. * This is useful if your platform does not support
  1144. * standards like the /dev/urandom or Windows CryptoAPI.
  1145. *
  1146. * Uncomment this macro to disable the built-in platform entropy functions.
  1147. */
  1148. // #define MBEDTLS_NO_PLATFORM_ENTROPY
  1149. /**
  1150. * \def MBEDTLS_ENTROPY_FORCE_SHA256
  1151. *
  1152. * Force the entropy accumulator to use a SHA-256 accumulator instead of the
  1153. * default SHA-512 based one (if both are available).
  1154. *
  1155. * Requires: MBEDTLS_SHA256_C
  1156. *
  1157. * On 32-bit systems SHA-256 can be much faster than SHA-512. Use this option
  1158. * if you have performance concerns.
  1159. *
  1160. * This option is only useful if both MBEDTLS_SHA256_C and
  1161. * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used.
  1162. */
  1163. //#define MBEDTLS_ENTROPY_FORCE_SHA256
  1164. /**
  1165. * \def MBEDTLS_ENTROPY_NV_SEED
  1166. *
  1167. * Enable the non-volatile (NV) seed file-based entropy source.
  1168. * (Also enables the NV seed read/write functions in the platform layer)
  1169. *
  1170. * This is crucial (if not required) on systems that do not have a
  1171. * cryptographic entropy source (in hardware or kernel) available.
  1172. *
  1173. * Requires: MBEDTLS_ENTROPY_C, MBEDTLS_PLATFORM_C
  1174. *
  1175. * \note The read/write functions that are used by the entropy source are
  1176. * determined in the platform layer, and can be modified at runtime and/or
  1177. * compile-time depending on the flags (MBEDTLS_PLATFORM_NV_SEED_*) used.
  1178. *
  1179. * \note If you use the default implementation functions that read a seedfile
  1180. * with regular fopen(), please make sure you make a seedfile with the
  1181. * proper name (defined in MBEDTLS_PLATFORM_STD_NV_SEED_FILE) and at
  1182. * least MBEDTLS_ENTROPY_BLOCK_SIZE bytes in size that can be read from
  1183. * and written to or you will get an entropy source error! The default
  1184. * implementation will only use the first MBEDTLS_ENTROPY_BLOCK_SIZE
  1185. * bytes from the file.
  1186. *
  1187. * \note The entropy collector will write to the seed file before entropy is
  1188. * given to an external source, to update it.
  1189. */
  1190. //#define MBEDTLS_ENTROPY_NV_SEED
  1191. /* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
  1192. *
  1193. * Enable key identifiers that encode a key owner identifier.
  1194. *
  1195. * The owner of a key is identified by a value of type ::mbedtls_key_owner_id_t
  1196. * which is currently hard-coded to be int32_t.
  1197. *
  1198. * Note that this option is meant for internal use only and may be removed
  1199. * without notice.
  1200. */
  1201. //#define MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
  1202. /**
  1203. * \def MBEDTLS_MEMORY_DEBUG
  1204. *
  1205. * Enable debugging of buffer allocator memory issues. Automatically prints
  1206. * (to stderr) all (fatal) messages on memory allocation issues. Enables
  1207. * function for 'debug output' of allocated memory.
  1208. *
  1209. * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C
  1210. *
  1211. * Uncomment this macro to let the buffer allocator print out error messages.
  1212. */
  1213. //#define MBEDTLS_MEMORY_DEBUG
  1214. /**
  1215. * \def MBEDTLS_MEMORY_BACKTRACE
  1216. *
  1217. * Include backtrace information with each allocated block.
  1218. *
  1219. * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C
  1220. * GLIBC-compatible backtrace() and backtrace_symbols() support
  1221. *
  1222. * Uncomment this macro to include backtrace information
  1223. */
  1224. //#define MBEDTLS_MEMORY_BACKTRACE
  1225. /**
  1226. * \def MBEDTLS_PK_RSA_ALT_SUPPORT
  1227. *
  1228. * Support external private RSA keys (eg from a HSM) in the PK layer.
  1229. *
  1230. * Comment this macro to disable support for external private RSA keys.
  1231. */
  1232. #define MBEDTLS_PK_RSA_ALT_SUPPORT
  1233. /**
  1234. * \def MBEDTLS_PKCS1_V15
  1235. *
  1236. * Enable support for PKCS#1 v1.5 encoding.
  1237. *
  1238. * Requires: MBEDTLS_RSA_C
  1239. *
  1240. * This enables support for PKCS#1 v1.5 operations.
  1241. */
  1242. #define MBEDTLS_PKCS1_V15
  1243. /**
  1244. * \def MBEDTLS_PKCS1_V21
  1245. *
  1246. * Enable support for PKCS#1 v2.1 encoding.
  1247. *
  1248. * Requires: MBEDTLS_RSA_C
  1249. *
  1250. * \warning If using a hash that is only provided by PSA drivers, you must
  1251. * call psa_crypto_init() before doing any PKCS#1 v2.1 operation.
  1252. *
  1253. * This enables support for RSAES-OAEP and RSASSA-PSS operations.
  1254. */
  1255. #define MBEDTLS_PKCS1_V21
  1256. /** \def MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
  1257. *
  1258. * Enable support for platform built-in keys. If you enable this feature,
  1259. * you must implement the function mbedtls_psa_platform_get_builtin_key().
  1260. * See the documentation of that function for more information.
  1261. *
  1262. * Built-in keys are typically derived from a hardware unique key or
  1263. * stored in a secure element.
  1264. *
  1265. * Requires: MBEDTLS_PSA_CRYPTO_C.
  1266. *
  1267. * \warning This interface is experimental and may change or be removed
  1268. * without notice.
  1269. */
  1270. //#define MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
  1271. /** \def MBEDTLS_PSA_CRYPTO_CLIENT
  1272. *
  1273. * Enable support for PSA crypto client.
  1274. *
  1275. * \note This option allows to include the code necessary for a PSA
  1276. * crypto client when the PSA crypto implementation is not included in
  1277. * the library (MBEDTLS_PSA_CRYPTO_C disabled). The code included is the
  1278. * code to set and get PSA key attributes.
  1279. * The development of PSA drivers partially relying on the library to
  1280. * fulfill the hardware gaps is another possible usage of this option.
  1281. *
  1282. * \warning This interface is experimental and may change or be removed
  1283. * without notice.
  1284. */
  1285. //#define MBEDTLS_PSA_CRYPTO_CLIENT
  1286. /** \def MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
  1287. *
  1288. * Make the PSA Crypto module use an external random generator provided
  1289. * by a driver, instead of Mbed TLS's entropy and DRBG modules.
  1290. *
  1291. * \note This random generator must deliver random numbers with cryptographic
  1292. * quality and high performance. It must supply unpredictable numbers
  1293. * with a uniform distribution. The implementation of this function
  1294. * is responsible for ensuring that the random generator is seeded
  1295. * with sufficient entropy. If you have a hardware TRNG which is slow
  1296. * or delivers non-uniform output, declare it as an entropy source
  1297. * with mbedtls_entropy_add_source() instead of enabling this option.
  1298. *
  1299. * If you enable this option, you must configure the type
  1300. * ::mbedtls_psa_external_random_context_t in psa/crypto_platform.h
  1301. * and define a function called mbedtls_psa_external_get_random()
  1302. * with the following prototype:
  1303. * ```
  1304. * psa_status_t mbedtls_psa_external_get_random(
  1305. * mbedtls_psa_external_random_context_t *context,
  1306. * uint8_t *output, size_t output_size, size_t *output_length);
  1307. * );
  1308. * ```
  1309. * The \c context value is initialized to 0 before the first call.
  1310. * The function must fill the \c output buffer with \c output_size bytes
  1311. * of random data and set \c *output_length to \c output_size.
  1312. *
  1313. * Requires: MBEDTLS_PSA_CRYPTO_C
  1314. *
  1315. * \warning If you enable this option, code that uses the PSA cryptography
  1316. * interface will not use any of the entropy sources set up for
  1317. * the entropy module, nor the NV seed that MBEDTLS_ENTROPY_NV_SEED
  1318. * enables.
  1319. *
  1320. * \note This option is experimental and may be removed without notice.
  1321. */
  1322. //#define MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
  1323. /**
  1324. * \def MBEDTLS_PSA_CRYPTO_SPM
  1325. *
  1326. * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is built for SPM (Secure
  1327. * Partition Manager) integration which separates the code into two parts: a
  1328. * NSPE (Non-Secure Process Environment) and an SPE (Secure Process
  1329. * Environment).
  1330. *
  1331. * If you enable this option, your build environment must include a header
  1332. * file `"crypto_spe.h"` (either in the `psa` subdirectory of the Mbed TLS
  1333. * header files, or in another directory on the compiler's include search
  1334. * path). Alternatively, your platform may customize the header
  1335. * `psa/crypto_platform.h`, in which case it can skip or replace the
  1336. * inclusion of `"crypto_spe.h"`.
  1337. *
  1338. * Module: library/psa_crypto.c
  1339. * Requires: MBEDTLS_PSA_CRYPTO_C
  1340. *
  1341. */
  1342. //#define MBEDTLS_PSA_CRYPTO_SPM
  1343. /**
  1344. * \def MBEDTLS_PSA_KEY_STORE_DYNAMIC
  1345. *
  1346. * Dynamically resize the PSA key store to accommodate any number of
  1347. * volatile keys (until the heap memory is exhausted).
  1348. *
  1349. * If this option is disabled, the key store has a fixed size
  1350. * #MBEDTLS_PSA_KEY_SLOT_COUNT for volatile keys and loaded persistent keys
  1351. * together.
  1352. *
  1353. * This option has no effect when #MBEDTLS_PSA_CRYPTO_C is disabled.
  1354. *
  1355. * Module: library/psa_crypto.c
  1356. * Requires: MBEDTLS_PSA_CRYPTO_C
  1357. */
  1358. #define MBEDTLS_PSA_KEY_STORE_DYNAMIC
  1359. /**
  1360. * Uncomment to enable p256-m. This is an alternative implementation of
  1361. * key generation, ECDH and (randomized) ECDSA on the curve SECP256R1.
  1362. * Compared to the default implementation:
  1363. *
  1364. * - p256-m has a much smaller code size and RAM footprint.
  1365. * - p256-m is only available via the PSA API. This includes the pk module
  1366. * when #MBEDTLS_USE_PSA_CRYPTO is enabled.
  1367. * - p256-m does not support deterministic ECDSA, EC-JPAKE, custom protocols
  1368. * over the core arithmetic, or deterministic derivation of keys.
  1369. *
  1370. * We recommend enabling this option if your application uses the PSA API
  1371. * and the only elliptic curve support it needs is ECDH and ECDSA over
  1372. * SECP256R1.
  1373. *
  1374. * If you enable this option, you do not need to enable any ECC-related
  1375. * MBEDTLS_xxx option. You do need to separately request support for the
  1376. * cryptographic mechanisms through the PSA API:
  1377. * - #MBEDTLS_PSA_CRYPTO_C and #MBEDTLS_PSA_CRYPTO_CONFIG for PSA-based
  1378. * configuration;
  1379. * - #MBEDTLS_USE_PSA_CRYPTO if you want to use p256-m from PK, X.509 or TLS;
  1380. * - #PSA_WANT_ECC_SECP_R1_256;
  1381. * - #PSA_WANT_ALG_ECDH and/or #PSA_WANT_ALG_ECDSA as needed;
  1382. * - #PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY, #PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC,
  1383. * #PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT,
  1384. * #PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT and/or
  1385. * #PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE as needed.
  1386. *
  1387. * \note To benefit from the smaller code size of p256-m, make sure that you
  1388. * do not enable any ECC-related option not supported by p256-m: this
  1389. * would cause the built-in ECC implementation to be built as well, in
  1390. * order to provide the required option.
  1391. * Make sure #PSA_WANT_ALG_DETERMINISTIC_ECDSA, #PSA_WANT_ALG_JPAKE and
  1392. * #PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE, and curves other than
  1393. * SECP256R1 are disabled as they are not supported by this driver.
  1394. * Also, avoid defining #MBEDTLS_PK_PARSE_EC_COMPRESSED or
  1395. * #MBEDTLS_PK_PARSE_EC_EXTENDED as those currently require a subset of
  1396. * the built-in ECC implementation, see docs/driver-only-builds.md.
  1397. */
  1398. //#define MBEDTLS_PSA_P256M_DRIVER_ENABLED
  1399. /**
  1400. * \def MBEDTLS_PSA_INJECT_ENTROPY
  1401. *
  1402. * Enable support for entropy injection at first boot. This feature is
  1403. * required on systems that do not have a built-in entropy source (TRNG).
  1404. * This feature is currently not supported on systems that have a built-in
  1405. * entropy source.
  1406. *
  1407. * Requires: MBEDTLS_PSA_CRYPTO_STORAGE_C, MBEDTLS_ENTROPY_NV_SEED
  1408. *
  1409. */
  1410. //#define MBEDTLS_PSA_INJECT_ENTROPY
  1411. /**
  1412. * \def MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
  1413. *
  1414. * Assume all buffers passed to PSA functions are owned exclusively by the
  1415. * PSA function and are not stored in shared memory.
  1416. *
  1417. * This option may be enabled if all buffers passed to any PSA function reside
  1418. * in memory that is accessible only to the PSA function during its execution.
  1419. *
  1420. * This option MUST be disabled whenever buffer arguments are in memory shared
  1421. * with an untrusted party, for example where arguments to PSA calls are passed
  1422. * across a trust boundary.
  1423. *
  1424. * \note Enabling this option reduces memory usage and code size.
  1425. *
  1426. * \note Enabling this option causes overlap of input and output buffers
  1427. * not to be supported by PSA functions.
  1428. */
  1429. //#define MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
  1430. /**
  1431. * \def MBEDTLS_RSA_NO_CRT
  1432. *
  1433. * Do not use the Chinese Remainder Theorem
  1434. * for the RSA private operation.
  1435. *
  1436. * Uncomment this macro to disable the use of CRT in RSA.
  1437. *
  1438. */
  1439. //#define MBEDTLS_RSA_NO_CRT
  1440. /**
  1441. * \def MBEDTLS_SELF_TEST
  1442. *
  1443. * Enable the checkup functions (*_self_test).
  1444. */
  1445. #define MBEDTLS_SELF_TEST
  1446. /**
  1447. * \def MBEDTLS_SHA256_SMALLER
  1448. *
  1449. * Enable an implementation of SHA-256 that has lower ROM footprint but also
  1450. * lower performance.
  1451. *
  1452. * The default implementation is meant to be a reasonable compromise between
  1453. * performance and size. This version optimizes more aggressively for size at
  1454. * the expense of performance. Eg on Cortex-M4 it reduces the size of
  1455. * mbedtls_sha256_process() from ~2KB to ~0.5KB for a performance hit of about
  1456. * 30%.
  1457. *
  1458. * Uncomment to enable the smaller implementation of SHA256.
  1459. */
  1460. //#define MBEDTLS_SHA256_SMALLER
  1461. /**
  1462. * \def MBEDTLS_SHA512_SMALLER
  1463. *
  1464. * Enable an implementation of SHA-512 that has lower ROM footprint but also
  1465. * lower performance.
  1466. *
  1467. * Uncomment to enable the smaller implementation of SHA512.
  1468. */
  1469. //#define MBEDTLS_SHA512_SMALLER
  1470. /**
  1471. * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
  1472. *
  1473. * Enable sending of alert messages in case of encountered errors as per RFC.
  1474. * If you choose not to send the alert messages, Mbed TLS can still communicate
  1475. * with other servers, only debugging of failures is harder.
  1476. *
  1477. * The advantage of not sending alert messages, is that no information is given
  1478. * about reasons for failures thus preventing adversaries of gaining intel.
  1479. *
  1480. * Enable sending of all alert messages
  1481. */
  1482. #define MBEDTLS_SSL_ALL_ALERT_MESSAGES
  1483. /**
  1484. * \def MBEDTLS_SSL_DTLS_CONNECTION_ID
  1485. *
  1486. * Enable support for the DTLS Connection ID (CID) extension,
  1487. * which allows to identify DTLS connections across changes
  1488. * in the underlying transport. The CID functionality is described
  1489. * in RFC 9146.
  1490. *
  1491. * Setting this option enables the SSL APIs `mbedtls_ssl_set_cid()`,
  1492. * mbedtls_ssl_get_own_cid()`, `mbedtls_ssl_get_peer_cid()` and
  1493. * `mbedtls_ssl_conf_cid()`. See the corresponding documentation for
  1494. * more information.
  1495. *
  1496. * The maximum lengths of outgoing and incoming CIDs can be configured
  1497. * through the options
  1498. * - MBEDTLS_SSL_CID_OUT_LEN_MAX
  1499. * - MBEDTLS_SSL_CID_IN_LEN_MAX.
  1500. *
  1501. * Requires: MBEDTLS_SSL_PROTO_DTLS
  1502. *
  1503. * Uncomment to enable the Connection ID extension.
  1504. */
  1505. #define MBEDTLS_SSL_DTLS_CONNECTION_ID
  1506. /**
  1507. * \def MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT
  1508. *
  1509. * Defines whether RFC 9146 (default) or the legacy version
  1510. * (version draft-ietf-tls-dtls-connection-id-05,
  1511. * https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05)
  1512. * is used.
  1513. *
  1514. * Set the value to 0 for the standard version, and
  1515. * 1 for the legacy draft version.
  1516. *
  1517. * \deprecated Support for the legacy version of the DTLS
  1518. * Connection ID feature is deprecated. Please
  1519. * switch to the standardized version defined
  1520. * in RFC 9146 enabled by utilizing
  1521. * MBEDTLS_SSL_DTLS_CONNECTION_ID without use
  1522. * of MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT.
  1523. *
  1524. * Requires: MBEDTLS_SSL_DTLS_CONNECTION_ID
  1525. */
  1526. #define MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT 0
  1527. /**
  1528. * \def MBEDTLS_SSL_ASYNC_PRIVATE
  1529. *
  1530. * Enable asynchronous external private key operations in SSL. This allows
  1531. * you to configure an SSL connection to call an external cryptographic
  1532. * module to perform private key operations instead of performing the
  1533. * operation inside the library.
  1534. *
  1535. * Requires: MBEDTLS_X509_CRT_PARSE_C
  1536. */
  1537. //#define MBEDTLS_SSL_ASYNC_PRIVATE
  1538. /** \def MBEDTLS_SSL_CLI_ALLOW_WEAK_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME
  1539. *
  1540. * In TLS clients, when a client authenticates a server through its
  1541. * certificate, the client normally checks three things:
  1542. * - the certificate chain must be valid;
  1543. * - the chain must start from a trusted CA;
  1544. * - the certificate must cover the server name that is expected by the client.
  1545. *
  1546. * Omitting any of these checks is generally insecure, and can allow a
  1547. * malicious server to impersonate a legitimate server.
  1548. *
  1549. * The third check may be safely skipped in some unusual scenarios,
  1550. * such as networks where eavesdropping is a risk but not active attacks,
  1551. * or a private PKI where the client equally trusts all servers that are
  1552. * accredited by the root CA.
  1553. *
  1554. * You should call mbedtls_ssl_set_hostname() with the expected server name
  1555. * before starting a TLS handshake on a client (unless the client is
  1556. * set up to only use PSK-based authentication, which does not rely on the
  1557. * host name). This configuration option controls what happens if a TLS client
  1558. * is configured with the authentication mode #MBEDTLS_SSL_VERIFY_REQUIRED
  1559. * (default), certificate authentication is enabled and the client does not
  1560. * call mbedtls_ssl_set_hostname():
  1561. *
  1562. * - If this option is unset (default), the connection attempt is aborted
  1563. * with the error #MBEDTLS_ERR_SSL_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME.
  1564. * - If this option is set, the TLS library does not check the server name
  1565. * that the certificate is valid for. This is the historical behavior
  1566. * of Mbed TLS, but may be insecure as explained above.
  1567. *
  1568. * Enable this option for strict backward compatibility if you have
  1569. * determined that it is secure in the scenario where you are using
  1570. * Mbed TLS.
  1571. *
  1572. * \deprecated This option exists only for backward compatibility and will
  1573. * be removed in the next major version of Mbed TLS.
  1574. *
  1575. */
  1576. //#define MBEDTLS_SSL_CLI_ALLOW_WEAK_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME
  1577. /**
  1578. * \def MBEDTLS_SSL_CONTEXT_SERIALIZATION
  1579. *
  1580. * Enable serialization of the TLS context structures, through use of the
  1581. * functions mbedtls_ssl_context_save() and mbedtls_ssl_context_load().
  1582. *
  1583. * This pair of functions allows one side of a connection to serialize the
  1584. * context associated with the connection, then free or re-use that context
  1585. * while the serialized state is persisted elsewhere, and finally deserialize
  1586. * that state to a live context for resuming read/write operations on the
  1587. * connection. From a protocol perspective, the state of the connection is
  1588. * unaffected, in particular this is entirely transparent to the peer.
  1589. *
  1590. * Note: this is distinct from TLS session resumption, which is part of the
  1591. * protocol and fully visible by the peer. TLS session resumption enables
  1592. * establishing new connections associated to a saved session with shorter,
  1593. * lighter handshakes, while context serialization is a local optimization in
  1594. * handling a single, potentially long-lived connection.
  1595. *
  1596. * Enabling these APIs makes some SSL structures larger, as 64 extra bytes are
  1597. * saved after the handshake to allow for more efficient serialization, so if
  1598. * you don't need this feature you'll save RAM by disabling it.
  1599. *
  1600. * Requires: MBEDTLS_GCM_C or MBEDTLS_CCM_C or MBEDTLS_CHACHAPOLY_C
  1601. *
  1602. * Comment to disable the context serialization APIs.
  1603. */
  1604. #define MBEDTLS_SSL_CONTEXT_SERIALIZATION
  1605. /**
  1606. * \def MBEDTLS_SSL_DEBUG_ALL
  1607. *
  1608. * Enable the debug messages in SSL module for all issues.
  1609. * Debug messages have been disabled in some places to prevent timing
  1610. * attacks due to (unbalanced) debugging function calls.
  1611. *
  1612. * If you need all error reporting you should enable this during debugging,
  1613. * but remove this for production servers that should log as well.
  1614. *
  1615. * Uncomment this macro to report all debug messages on errors introducing
  1616. * a timing side-channel.
  1617. *
  1618. */
  1619. //#define MBEDTLS_SSL_DEBUG_ALL
  1620. /** \def MBEDTLS_SSL_ENCRYPT_THEN_MAC
  1621. *
  1622. * Enable support for Encrypt-then-MAC, RFC 7366.
  1623. *
  1624. * This allows peers that both support it to use a more robust protection for
  1625. * ciphersuites using CBC, providing deep resistance against timing attacks
  1626. * on the padding or underlying cipher.
  1627. *
  1628. * This only affects CBC ciphersuites, and is useless if none is defined.
  1629. *
  1630. * Requires: MBEDTLS_SSL_PROTO_TLS1_2
  1631. *
  1632. * Comment this macro to disable support for Encrypt-then-MAC
  1633. */
  1634. #define MBEDTLS_SSL_ENCRYPT_THEN_MAC
  1635. /** \def MBEDTLS_SSL_EXTENDED_MASTER_SECRET
  1636. *
  1637. * Enable support for RFC 7627: Session Hash and Extended Master Secret
  1638. * Extension.
  1639. *
  1640. * This was introduced as "the proper fix" to the Triple Handshake family of
  1641. * attacks, but it is recommended to always use it (even if you disable
  1642. * renegotiation), since it actually fixes a more fundamental issue in the
  1643. * original SSL/TLS design, and has implications beyond Triple Handshake.
  1644. *
  1645. * Requires: MBEDTLS_SSL_PROTO_TLS1_2
  1646. *
  1647. * Comment this macro to disable support for Extended Master Secret.
  1648. */
  1649. #define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
  1650. /**
  1651. * \def MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
  1652. *
  1653. * This option controls the availability of the API mbedtls_ssl_get_peer_cert()
  1654. * giving access to the peer's certificate after completion of the handshake.
  1655. *
  1656. * Unless you need mbedtls_ssl_peer_cert() in your application, it is
  1657. * recommended to disable this option for reduced RAM usage.
  1658. *
  1659. * \note If this option is disabled, mbedtls_ssl_get_peer_cert() is still
  1660. * defined, but always returns \c NULL.
  1661. *
  1662. * \note This option has no influence on the protection against the
  1663. * triple handshake attack. Even if it is disabled, Mbed TLS will
  1664. * still ensure that certificates do not change during renegotiation,
  1665. * for example by keeping a hash of the peer's certificate.
  1666. *
  1667. * \note This option is required if MBEDTLS_SSL_PROTO_TLS1_3 is set.
  1668. *
  1669. * Comment this macro to disable storing the peer's certificate
  1670. * after the handshake.
  1671. */
  1672. #define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
  1673. /**
  1674. * \def MBEDTLS_SSL_KEYING_MATERIAL_EXPORT
  1675. *
  1676. * When this option is enabled, the client and server can extract additional
  1677. * shared symmetric keys after an SSL handshake using the function
  1678. * mbedtls_ssl_export_keying_material().
  1679. *
  1680. * The process for deriving the keys is specified in RFC 5705 for TLS 1.2 and
  1681. * in RFC 8446, Section 7.5, for TLS 1.3.
  1682. *
  1683. * Comment this macro to disable mbedtls_ssl_export_keying_material().
  1684. */
  1685. #define MBEDTLS_SSL_KEYING_MATERIAL_EXPORT
  1686. /**
  1687. * \def MBEDTLS_SSL_RENEGOTIATION
  1688. *
  1689. * Enable support for TLS renegotiation.
  1690. *
  1691. * The two main uses of renegotiation are (1) refresh keys on long-lived
  1692. * connections and (2) client authentication after the initial handshake.
  1693. * If you don't need renegotiation, it's probably better to disable it, since
  1694. * it has been associated with security issues in the past and is easy to
  1695. * misuse/misunderstand.
  1696. *
  1697. * Requires: MBEDTLS_SSL_PROTO_TLS1_2
  1698. *
  1699. * Comment this to disable support for renegotiation.
  1700. *
  1701. * \note Even if this option is disabled, both client and server are aware
  1702. * of the Renegotiation Indication Extension (RFC 5746) used to
  1703. * prevent the SSL renegotiation attack (see RFC 5746 Sect. 1).
  1704. * (See \c mbedtls_ssl_conf_legacy_renegotiation for the
  1705. * configuration of this extension).
  1706. *
  1707. */
  1708. #define MBEDTLS_SSL_RENEGOTIATION
  1709. /**
  1710. * \def MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
  1711. *
  1712. * Enable support for RFC 6066 max_fragment_length extension in SSL.
  1713. *
  1714. * Comment this macro to disable support for the max_fragment_length extension
  1715. */
  1716. #define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
  1717. /**
  1718. * \def MBEDTLS_SSL_RECORD_SIZE_LIMIT
  1719. *
  1720. * Enable support for RFC 8449 record_size_limit extension in SSL (TLS 1.3 only).
  1721. *
  1722. * Requires: MBEDTLS_SSL_PROTO_TLS1_3
  1723. *
  1724. * Uncomment this macro to enable support for the record_size_limit extension
  1725. */
  1726. //#define MBEDTLS_SSL_RECORD_SIZE_LIMIT
  1727. /**
  1728. * \def MBEDTLS_SSL_PROTO_TLS1_2
  1729. *
  1730. * Enable support for TLS 1.2 (and DTLS 1.2 if DTLS is enabled).
  1731. *
  1732. * Requires: Without MBEDTLS_USE_PSA_CRYPTO: MBEDTLS_MD_C and
  1733. * (MBEDTLS_SHA256_C or MBEDTLS_SHA384_C or
  1734. * SHA-256 or SHA-512 provided by a PSA driver)
  1735. * With MBEDTLS_USE_PSA_CRYPTO:
  1736. * PSA_WANT_ALG_SHA_256 or PSA_WANT_ALG_SHA_384
  1737. *
  1738. * \warning If building with MBEDTLS_USE_PSA_CRYPTO, or if the hash(es) used
  1739. * are only provided by PSA drivers, you must call psa_crypto_init() before
  1740. * doing any TLS operations.
  1741. *
  1742. * Comment this macro to disable support for TLS 1.2 / DTLS 1.2
  1743. */
  1744. #define MBEDTLS_SSL_PROTO_TLS1_2
  1745. /**
  1746. * \def MBEDTLS_SSL_PROTO_TLS1_3
  1747. *
  1748. * Enable support for TLS 1.3.
  1749. *
  1750. * \note See docs/architecture/tls13-support.md for a description of the TLS
  1751. * 1.3 support that this option enables.
  1752. *
  1753. * Requires: MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
  1754. * Requires: MBEDTLS_PSA_CRYPTO_C
  1755. *
  1756. * \note TLS 1.3 uses PSA crypto for cryptographic operations that are
  1757. * directly performed by TLS 1.3 code. As a consequence, when TLS 1.3
  1758. * is enabled, a TLS handshake may call psa_crypto_init(), even
  1759. * if it ends up negotiating a different TLS version.
  1760. *
  1761. * \note Cryptographic operations performed indirectly via another module
  1762. * (X.509, PK) or by code shared with TLS 1.2 (record protection,
  1763. * running handshake hash) only use PSA crypto if
  1764. * #MBEDTLS_USE_PSA_CRYPTO is enabled.
  1765. *
  1766. * \note In multithreaded applications, you must also enable
  1767. * #MBEDTLS_THREADING_C, even if individual TLS contexts are not
  1768. * shared between threads, unless only one thread ever calls
  1769. * TLS functions.
  1770. *
  1771. * Uncomment this macro to enable the support for TLS 1.3.
  1772. */
  1773. #define MBEDTLS_SSL_PROTO_TLS1_3
  1774. /**
  1775. * \def MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
  1776. *
  1777. * Enable TLS 1.3 middlebox compatibility mode.
  1778. *
  1779. * As specified in Section D.4 of RFC 8446, TLS 1.3 offers a compatibility
  1780. * mode to make a TLS 1.3 connection more likely to pass through middle boxes
  1781. * expecting TLS 1.2 traffic.
  1782. *
  1783. * Turning on the compatibility mode comes at the cost of a few added bytes
  1784. * on the wire, but it doesn't affect compatibility with TLS 1.3 implementations
  1785. * that don't use it. Therefore, unless transmission bandwidth is critical and
  1786. * you know that middlebox compatibility issues won't occur, it is therefore
  1787. * recommended to set this option.
  1788. *
  1789. * Comment to disable compatibility mode for TLS 1.3. If
  1790. * MBEDTLS_SSL_PROTO_TLS1_3 is not enabled, this option does not have any
  1791. * effect on the build.
  1792. *
  1793. */
  1794. #define MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
  1795. /**
  1796. * \def MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
  1797. *
  1798. * Enable TLS 1.3 PSK key exchange mode.
  1799. *
  1800. * Comment to disable support for the PSK key exchange mode in TLS 1.3. If
  1801. * MBEDTLS_SSL_PROTO_TLS1_3 is not enabled, this option does not have any
  1802. * effect on the build.
  1803. *
  1804. */
  1805. #define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
  1806. /**
  1807. * \def MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
  1808. *
  1809. * Enable TLS 1.3 ephemeral key exchange mode.
  1810. *
  1811. * Requires: PSA_WANT_ALG_ECDH or PSA_WANT_ALG_FFDH
  1812. * MBEDTLS_X509_CRT_PARSE_C
  1813. * and at least one of:
  1814. * MBEDTLS_ECDSA_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDSA)
  1815. * MBEDTLS_PKCS1_V21
  1816. *
  1817. * Comment to disable support for the ephemeral key exchange mode in TLS 1.3.
  1818. * If MBEDTLS_SSL_PROTO_TLS1_3 is not enabled, this option does not have any
  1819. * effect on the build.
  1820. *
  1821. */
  1822. #define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
  1823. /**
  1824. * \def MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
  1825. *
  1826. * Enable TLS 1.3 PSK ephemeral key exchange mode.
  1827. *
  1828. * Requires: PSA_WANT_ALG_ECDH or PSA_WANT_ALG_FFDH
  1829. *
  1830. * Comment to disable support for the PSK ephemeral key exchange mode in
  1831. * TLS 1.3. If MBEDTLS_SSL_PROTO_TLS1_3 is not enabled, this option does not
  1832. * have any effect on the build.
  1833. *
  1834. */
  1835. #define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
  1836. /**
  1837. * \def MBEDTLS_SSL_EARLY_DATA
  1838. *
  1839. * Enable support for RFC 8446 TLS 1.3 early data.
  1840. *
  1841. * Requires: MBEDTLS_SSL_SESSION_TICKETS and either
  1842. * MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED or
  1843. * MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
  1844. *
  1845. * Comment this to disable support for early data. If MBEDTLS_SSL_PROTO_TLS1_3
  1846. * is not enabled, this option does not have any effect on the build.
  1847. *
  1848. * \note The maximum amount of early data can be set with
  1849. * MBEDTLS_SSL_MAX_EARLY_DATA_SIZE.
  1850. *
  1851. */
  1852. //#define MBEDTLS_SSL_EARLY_DATA
  1853. /**
  1854. * \def MBEDTLS_SSL_PROTO_DTLS
  1855. *
  1856. * Enable support for DTLS (all available versions).
  1857. *
  1858. * Enable this and MBEDTLS_SSL_PROTO_TLS1_2 to enable DTLS 1.2.
  1859. *
  1860. * Requires: MBEDTLS_SSL_PROTO_TLS1_2
  1861. *
  1862. * Comment this macro to disable support for DTLS
  1863. */
  1864. #define MBEDTLS_SSL_PROTO_DTLS
  1865. /**
  1866. * \def MBEDTLS_SSL_ALPN
  1867. *
  1868. * Enable support for RFC 7301 Application Layer Protocol Negotiation.
  1869. *
  1870. * Comment this macro to disable support for ALPN.
  1871. */
  1872. #define MBEDTLS_SSL_ALPN
  1873. /**
  1874. * \def MBEDTLS_SSL_DTLS_ANTI_REPLAY
  1875. *
  1876. * Enable support for the anti-replay mechanism in DTLS.
  1877. *
  1878. * Requires: MBEDTLS_SSL_TLS_C
  1879. * MBEDTLS_SSL_PROTO_DTLS
  1880. *
  1881. * \warning Disabling this is often a security risk!
  1882. * See mbedtls_ssl_conf_dtls_anti_replay() for details.
  1883. *
  1884. * Comment this to disable anti-replay in DTLS.
  1885. */
  1886. #define MBEDTLS_SSL_DTLS_ANTI_REPLAY
  1887. /**
  1888. * \def MBEDTLS_SSL_DTLS_HELLO_VERIFY
  1889. *
  1890. * Enable support for HelloVerifyRequest on DTLS servers.
  1891. *
  1892. * This feature is highly recommended to prevent DTLS servers being used as
  1893. * amplifiers in DoS attacks against other hosts. It should always be enabled
  1894. * unless you know for sure amplification cannot be a problem in the
  1895. * environment in which your server operates.
  1896. *
  1897. * \warning Disabling this can be a security risk! (see above)
  1898. *
  1899. * Requires: MBEDTLS_SSL_PROTO_DTLS
  1900. *
  1901. * Comment this to disable support for HelloVerifyRequest.
  1902. */
  1903. #define MBEDTLS_SSL_DTLS_HELLO_VERIFY
  1904. /**
  1905. * \def MBEDTLS_SSL_DTLS_SRTP
  1906. *
  1907. * Enable support for negotiation of DTLS-SRTP (RFC 5764)
  1908. * through the use_srtp extension.
  1909. *
  1910. * \note This feature provides the minimum functionality required
  1911. * to negotiate the use of DTLS-SRTP and to allow the derivation of
  1912. * the associated SRTP packet protection key material.
  1913. * In particular, the SRTP packet protection itself, as well as the
  1914. * demultiplexing of RTP and DTLS packets at the datagram layer
  1915. * (see Section 5 of RFC 5764), are not handled by this feature.
  1916. * Instead, after successful completion of a handshake negotiating
  1917. * the use of DTLS-SRTP, the extended key exporter API
  1918. * mbedtls_ssl_conf_export_keys_cb() should be used to implement
  1919. * the key exporter described in Section 4.2 of RFC 5764 and RFC 5705
  1920. * (this is implemented in the SSL example programs).
  1921. * The resulting key should then be passed to an SRTP stack.
  1922. *
  1923. * Setting this option enables the runtime API
  1924. * mbedtls_ssl_conf_dtls_srtp_protection_profiles()
  1925. * through which the supported DTLS-SRTP protection
  1926. * profiles can be configured. You must call this API at
  1927. * runtime if you wish to negotiate the use of DTLS-SRTP.
  1928. *
  1929. * Requires: MBEDTLS_SSL_PROTO_DTLS
  1930. *
  1931. * Uncomment this to enable support for use_srtp extension.
  1932. */
  1933. //#define MBEDTLS_SSL_DTLS_SRTP
  1934. /**
  1935. * \def MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
  1936. *
  1937. * Enable server-side support for clients that reconnect from the same port.
  1938. *
  1939. * Some clients unexpectedly close the connection and try to reconnect using the
  1940. * same source port. This needs special support from the server to handle the
  1941. * new connection securely, as described in section 4.2.8 of RFC 6347. This
  1942. * flag enables that support.
  1943. *
  1944. * Requires: MBEDTLS_SSL_DTLS_HELLO_VERIFY
  1945. *
  1946. * Comment this to disable support for clients reusing the source port.
  1947. */
  1948. #define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
  1949. /**
  1950. * \def MBEDTLS_SSL_SESSION_TICKETS
  1951. *
  1952. * Enable support for RFC 5077 session tickets in SSL.
  1953. * Client-side, provides full support for session tickets (maintenance of a
  1954. * session store remains the responsibility of the application, though).
  1955. * Server-side, you also need to provide callbacks for writing and parsing
  1956. * tickets, including authenticated encryption and key management. Example
  1957. * callbacks are provided by MBEDTLS_SSL_TICKET_C.
  1958. *
  1959. * Comment this macro to disable support for SSL session tickets
  1960. */
  1961. #define MBEDTLS_SSL_SESSION_TICKETS
  1962. /**
  1963. * \def MBEDTLS_SSL_SERVER_NAME_INDICATION
  1964. *
  1965. * Enable support for RFC 6066 server name indication (SNI) in SSL.
  1966. *
  1967. * Requires: MBEDTLS_X509_CRT_PARSE_C
  1968. *
  1969. * Comment this macro to disable support for server name indication in SSL
  1970. */
  1971. #define MBEDTLS_SSL_SERVER_NAME_INDICATION
  1972. /**
  1973. * \def MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
  1974. *
  1975. * When this option is enabled, the SSL buffer will be resized automatically
  1976. * based on the negotiated maximum fragment length in each direction.
  1977. *
  1978. * Requires: MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
  1979. */
  1980. //#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
  1981. /**
  1982. * \def MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN
  1983. *
  1984. * Enable testing of the constant-flow nature of some sensitive functions with
  1985. * clang's MemorySanitizer. This causes some existing tests to also test
  1986. * this non-functional property of the code under test.
  1987. *
  1988. * This setting requires compiling with clang -fsanitize=memory. The test
  1989. * suites can then be run normally.
  1990. *
  1991. * \warning This macro is only used for extended testing; it is not considered
  1992. * part of the library's API, so it may change or disappear at any time.
  1993. *
  1994. * Uncomment to enable testing of the constant-flow nature of selected code.
  1995. */
  1996. //#define MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN
  1997. /**
  1998. * \def MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND
  1999. *
  2000. * Enable testing of the constant-flow nature of some sensitive functions with
  2001. * valgrind's memcheck tool. This causes some existing tests to also test
  2002. * this non-functional property of the code under test.
  2003. *
  2004. * This setting requires valgrind headers for building, and is only useful for
  2005. * testing if the tests suites are run with valgrind's memcheck. This can be
  2006. * done for an individual test suite with 'valgrind ./test_suite_xxx', or when
  2007. * using CMake, this can be done for all test suites with 'make memcheck'.
  2008. *
  2009. * \warning This macro is only used for extended testing; it is not considered
  2010. * part of the library's API, so it may change or disappear at any time.
  2011. *
  2012. * Uncomment to enable testing of the constant-flow nature of selected code.
  2013. */
  2014. //#define MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND
  2015. /**
  2016. * \def MBEDTLS_TEST_HOOKS
  2017. *
  2018. * Enable features for invasive testing such as introspection functions and
  2019. * hooks for fault injection. This enables additional unit tests.
  2020. *
  2021. * Merely enabling this feature should not change the behavior of the product.
  2022. * It only adds new code, and new branching points where the default behavior
  2023. * is the same as when this feature is disabled.
  2024. * However, this feature increases the attack surface: there is an added
  2025. * risk of vulnerabilities, and more gadgets that can make exploits easier.
  2026. * Therefore this feature must never be enabled in production.
  2027. *
  2028. * See `docs/architecture/testing/mbed-crypto-invasive-testing.md` for more
  2029. * information.
  2030. *
  2031. * Uncomment to enable invasive tests.
  2032. */
  2033. //#define MBEDTLS_TEST_HOOKS
  2034. /**
  2035. * \def MBEDTLS_THREADING_ALT
  2036. *
  2037. * Provide your own alternate implementation of threading primitives
  2038. * for mutexes. If you enable this option:
  2039. *
  2040. * - Provide a header file `"threading_alt.h"`, defining the
  2041. * type `mbedtls_threading_mutex_t` of mutex objects.
  2042. *
  2043. * - Call the function mbedtls_threading_set_alt() in your application
  2044. * before calling any other library function (in particular before
  2045. * calling psa_crypto_init(), performing an asymmetric cryptography
  2046. * operation, or starting a TLS connection).
  2047. *
  2048. * See mbedtls/threading.h for more details, especially the documentation
  2049. * of mbedtls_threading_set_alt().
  2050. *
  2051. * Requires: MBEDTLS_THREADING_C
  2052. *
  2053. * Uncomment this to allow your own alternate threading implementation.
  2054. */
  2055. //#define MBEDTLS_THREADING_ALT
  2056. /**
  2057. * \def MBEDTLS_THREADING_PTHREAD
  2058. *
  2059. * Enable the pthread wrapper layer for the threading layer.
  2060. *
  2061. * Requires: MBEDTLS_THREADING_C
  2062. *
  2063. * Uncomment this to enable pthread mutexes.
  2064. */
  2065. //#define MBEDTLS_THREADING_PTHREAD
  2066. /**
  2067. * \def MBEDTLS_USE_PSA_CRYPTO
  2068. *
  2069. * Make the X.509 and TLS libraries use PSA for cryptographic operations as
  2070. * much as possible, and enable new APIs for using keys handled by PSA Crypto.
  2071. *
  2072. * \note Development of this option is currently in progress, and parts of Mbed
  2073. * TLS's X.509 and TLS modules are not ported to PSA yet. However, these parts
  2074. * will still continue to work as usual, so enabling this option should not
  2075. * break backwards compatibility.
  2076. *
  2077. * \warning If you enable this option, you need to call `psa_crypto_init()`
  2078. * before calling any function from the SSL/TLS, X.509 or PK modules, except
  2079. * for the various mbedtls_xxx_init() functions which can be called at any time.
  2080. *
  2081. * \warning In multithreaded applications, you must also enable
  2082. * #MBEDTLS_THREADING_C, unless only one thread ever calls PSA functions
  2083. * (`psa_xxx()`), including indirect calls through SSL/TLS, X.509 or PK.
  2084. *
  2085. * \note An important and desirable effect of this option is that it allows
  2086. * PK, X.509 and TLS to take advantage of PSA drivers. For example, enabling
  2087. * this option is what allows use of drivers for ECDSA, ECDH and EC J-PAKE in
  2088. * those modules. However, note that even with this option disabled, some code
  2089. * in PK, X.509, TLS or the crypto library might still use PSA drivers, if it
  2090. * can determine it's safe to do so; currently that's the case for hashes.
  2091. *
  2092. * \note See docs/use-psa-crypto.md for a complete description this option.
  2093. *
  2094. * Requires: MBEDTLS_PSA_CRYPTO_C.
  2095. *
  2096. * Uncomment this to enable internal use of PSA Crypto and new associated APIs.
  2097. */
  2098. //#define MBEDTLS_USE_PSA_CRYPTO
  2099. /**
  2100. * \def MBEDTLS_PSA_CRYPTO_CONFIG
  2101. *
  2102. * This setting allows support for cryptographic mechanisms through the PSA
  2103. * API to be configured separately from support through the mbedtls API.
  2104. *
  2105. * When this option is disabled, the PSA API exposes the cryptographic
  2106. * mechanisms that can be implemented on top of the `mbedtls_xxx` API
  2107. * configured with `MBEDTLS_XXX` symbols.
  2108. *
  2109. * When this option is enabled, the PSA API exposes the cryptographic
  2110. * mechanisms requested by the `PSA_WANT_XXX` symbols defined in
  2111. * include/psa/crypto_config.h. The corresponding `MBEDTLS_XXX` settings are
  2112. * automatically enabled if required (i.e. if no PSA driver provides the
  2113. * mechanism). You may still freely enable additional `MBEDTLS_XXX` symbols
  2114. * in mbedtls_config.h.
  2115. *
  2116. * If the symbol #MBEDTLS_PSA_CRYPTO_CONFIG_FILE is defined, it specifies
  2117. * an alternative header to include instead of include/psa/crypto_config.h.
  2118. *
  2119. * \warning This option is experimental, in that the set of `PSA_WANT_XXX`
  2120. * symbols is not completely finalized yet, and the configuration
  2121. * tooling is not ideally adapted to having two separate configuration
  2122. * files.
  2123. * Future minor releases of Mbed TLS may make minor changes to those
  2124. * symbols, but we will endeavor to provide a transition path.
  2125. * Nonetheless, this option is considered mature enough to use in
  2126. * production, as long as you accept that you may need to make
  2127. * minor changes to psa/crypto_config.h when upgrading Mbed TLS.
  2128. */
  2129. //#define MBEDTLS_PSA_CRYPTO_CONFIG
  2130. /**
  2131. * \def MBEDTLS_VERSION_FEATURES
  2132. *
  2133. * Allow run-time checking of compile-time enabled features. Thus allowing users
  2134. * to check at run-time if the library is for instance compiled with threading
  2135. * support via mbedtls_version_check_feature().
  2136. *
  2137. * Requires: MBEDTLS_VERSION_C
  2138. *
  2139. * Comment this to disable run-time checking and save ROM space
  2140. */
  2141. #define MBEDTLS_VERSION_FEATURES
  2142. /**
  2143. * \def MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
  2144. *
  2145. * If set, this enables the X.509 API `mbedtls_x509_crt_verify_with_ca_cb()`
  2146. * and the SSL API `mbedtls_ssl_conf_ca_cb()` which allow users to configure
  2147. * the set of trusted certificates through a callback instead of a linked
  2148. * list.
  2149. *
  2150. * This is useful for example in environments where a large number of trusted
  2151. * certificates is present and storing them in a linked list isn't efficient
  2152. * enough, or when the set of trusted certificates changes frequently.
  2153. *
  2154. * See the documentation of `mbedtls_x509_crt_verify_with_ca_cb()` and
  2155. * `mbedtls_ssl_conf_ca_cb()` for more information.
  2156. *
  2157. * Requires: MBEDTLS_X509_CRT_PARSE_C
  2158. *
  2159. * Uncomment to enable trusted certificate callbacks.
  2160. */
  2161. //#define MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
  2162. /**
  2163. * \def MBEDTLS_X509_REMOVE_INFO
  2164. *
  2165. * Disable mbedtls_x509_*_info() and related APIs.
  2166. *
  2167. * Uncomment to omit mbedtls_x509_*_info(), as well as mbedtls_debug_print_crt()
  2168. * and other functions/constants only used by these functions, thus reducing
  2169. * the code footprint by several KB.
  2170. */
  2171. //#define MBEDTLS_X509_REMOVE_INFO
  2172. /**
  2173. * \def MBEDTLS_X509_RSASSA_PSS_SUPPORT
  2174. *
  2175. * Enable parsing and verification of X.509 certificates, CRLs and CSRS
  2176. * signed with RSASSA-PSS (aka PKCS#1 v2.1).
  2177. *
  2178. * Requires: MBEDTLS_PKCS1_V21
  2179. *
  2180. * Comment this macro to disallow using RSASSA-PSS in certificates.
  2181. */
  2182. #define MBEDTLS_X509_RSASSA_PSS_SUPPORT
  2183. /** \} name SECTION: Mbed TLS feature support */
  2184. /**
  2185. * \name SECTION: Mbed TLS modules
  2186. *
  2187. * This section enables or disables entire modules in Mbed TLS
  2188. * \{
  2189. */
  2190. /**
  2191. * \def MBEDTLS_AESNI_C
  2192. *
  2193. * Enable AES-NI support on x86-64 or x86-32.
  2194. *
  2195. * \note AESNI is only supported with certain compilers and target options:
  2196. * - Visual Studio: supported
  2197. * - GCC, x86-64, target not explicitly supporting AESNI:
  2198. * requires MBEDTLS_HAVE_ASM.
  2199. * - GCC, x86-32, target not explicitly supporting AESNI:
  2200. * not supported.
  2201. * - GCC, x86-64 or x86-32, target supporting AESNI: supported.
  2202. * For this assembly-less implementation, you must currently compile
  2203. * `library/aesni.c` and `library/aes.c` with machine options to enable
  2204. * SSE2 and AESNI instructions: `gcc -msse2 -maes -mpclmul` or
  2205. * `clang -maes -mpclmul`.
  2206. * - Non-x86 targets: this option is silently ignored.
  2207. * - Other compilers: this option is silently ignored.
  2208. *
  2209. * \note
  2210. * Above, "GCC" includes compatible compilers such as Clang.
  2211. * The limitations on target support are likely to be relaxed in the future.
  2212. *
  2213. * Module: library/aesni.c
  2214. * Caller: library/aes.c
  2215. *
  2216. * Requires: MBEDTLS_HAVE_ASM (on some platforms, see note)
  2217. *
  2218. * This modules adds support for the AES-NI instructions on x86.
  2219. */
  2220. #define MBEDTLS_AESNI_C
  2221. /**
  2222. * \def MBEDTLS_AESCE_C
  2223. *
  2224. * Enable AES cryptographic extension support on Armv8.
  2225. *
  2226. * Module: library/aesce.c
  2227. * Caller: library/aes.c
  2228. *
  2229. * Requires: MBEDTLS_AES_C
  2230. *
  2231. * \warning Runtime detection only works on Linux. For non-Linux operating
  2232. * system, Armv8-A Cryptographic Extensions must be supported by
  2233. * the CPU when this option is enabled.
  2234. *
  2235. * \note Minimum compiler versions for this feature when targeting aarch64
  2236. * are Clang 4.0; armclang 6.6; GCC 6.0; or MSVC 2019 version 16.11.2.
  2237. * Minimum compiler versions for this feature when targeting 32-bit
  2238. * Arm or Thumb are Clang 11.0; armclang 6.20; or GCC 6.0.
  2239. *
  2240. * \note \c CFLAGS must be set to a minimum of \c -march=armv8-a+crypto for
  2241. * armclang <= 6.9
  2242. *
  2243. * This module adds support for the AES Armv8-A Cryptographic Extensions on Armv8 systems.
  2244. */
  2245. #define MBEDTLS_AESCE_C
  2246. /**
  2247. * \def MBEDTLS_AES_C
  2248. *
  2249. * Enable the AES block cipher.
  2250. *
  2251. * Module: library/aes.c
  2252. * Caller: library/cipher.c
  2253. * library/pem.c
  2254. * library/ctr_drbg.c
  2255. *
  2256. * This module enables the following ciphersuites (if other requisites are
  2257. * enabled as well):
  2258. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
  2259. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
  2260. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
  2261. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
  2262. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
  2263. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
  2264. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
  2265. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
  2266. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
  2267. * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
  2268. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
  2269. * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
  2270. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
  2271. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
  2272. * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
  2273. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
  2274. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
  2275. * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
  2276. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
  2277. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
  2278. * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA
  2279. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
  2280. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  2281. * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
  2282. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
  2283. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
  2284. * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
  2285. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
  2286. * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
  2287. * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA
  2288. * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
  2289. * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384
  2290. * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384
  2291. * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA
  2292. * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA
  2293. * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
  2294. * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
  2295. * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256
  2296. * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
  2297. * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA
  2298. * MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384
  2299. * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256
  2300. * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA
  2301. * MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256
  2302. * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256
  2303. * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA
  2304. * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384
  2305. * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384
  2306. * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA
  2307. * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256
  2308. * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256
  2309. * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA
  2310. * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384
  2311. * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384
  2312. * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA
  2313. * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256
  2314. * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256
  2315. * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA
  2316. *
  2317. * PEM_PARSE uses AES for decrypting encrypted keys.
  2318. */
  2319. #define MBEDTLS_AES_C
  2320. /**
  2321. * \def MBEDTLS_ASN1_PARSE_C
  2322. *
  2323. * Enable the generic ASN1 parser.
  2324. *
  2325. * Module: library/asn1.c
  2326. * Caller: library/x509.c
  2327. * library/dhm.c
  2328. * library/pkcs12.c
  2329. * library/pkcs5.c
  2330. * library/pkparse.c
  2331. */
  2332. #define MBEDTLS_ASN1_PARSE_C
  2333. /**
  2334. * \def MBEDTLS_ASN1_WRITE_C
  2335. *
  2336. * Enable the generic ASN1 writer.
  2337. *
  2338. * Module: library/asn1write.c
  2339. * Caller: library/ecdsa.c
  2340. * library/pkwrite.c
  2341. * library/x509_create.c
  2342. * library/x509write_crt.c
  2343. * library/x509write_csr.c
  2344. */
  2345. #define MBEDTLS_ASN1_WRITE_C
  2346. /**
  2347. * \def MBEDTLS_BASE64_C
  2348. *
  2349. * Enable the Base64 module.
  2350. *
  2351. * Module: library/base64.c
  2352. * Caller: library/pem.c
  2353. *
  2354. * This module is required for PEM support (required by X.509).
  2355. */
  2356. #define MBEDTLS_BASE64_C
  2357. /**
  2358. * \def MBEDTLS_BLOCK_CIPHER_NO_DECRYPT
  2359. *
  2360. * Remove decryption operation for AES, ARIA and Camellia block cipher.
  2361. *
  2362. * \note This feature is incompatible with insecure block cipher,
  2363. * MBEDTLS_DES_C, and cipher modes which always require decryption
  2364. * operation, MBEDTLS_CIPHER_MODE_CBC, MBEDTLS_CIPHER_MODE_XTS and
  2365. * MBEDTLS_NIST_KW_C. When #MBEDTLS_PSA_CRYPTO_CONFIG is enabled,
  2366. * this feature is incompatible with following supported PSA equivalence,
  2367. * PSA_WANT_ALG_ECB_NO_PADDING, PSA_WANT_ALG_CBC_NO_PADDING,
  2368. * PSA_WANT_ALG_CBC_PKCS7 and PSA_WANT_KEY_TYPE_DES.
  2369. *
  2370. * Module: library/aes.c
  2371. * library/aesce.c
  2372. * library/aesni.c
  2373. * library/aria.c
  2374. * library/camellia.c
  2375. * library/cipher.c
  2376. */
  2377. //#define MBEDTLS_BLOCK_CIPHER_NO_DECRYPT
  2378. /**
  2379. * \def MBEDTLS_BIGNUM_C
  2380. *
  2381. * Enable the multi-precision integer library.
  2382. *
  2383. * Module: library/bignum.c
  2384. * library/bignum_core.c
  2385. * library/bignum_mod.c
  2386. * library/bignum_mod_raw.c
  2387. * Caller: library/dhm.c
  2388. * library/ecp.c
  2389. * library/ecdsa.c
  2390. * library/rsa.c
  2391. * library/rsa_alt_helpers.c
  2392. * library/ssl_tls.c
  2393. *
  2394. * This module is required for RSA, DHM and ECC (ECDH, ECDSA) support.
  2395. */
  2396. #define MBEDTLS_BIGNUM_C
  2397. /**
  2398. * \def MBEDTLS_CAMELLIA_C
  2399. *
  2400. * Enable the Camellia block cipher.
  2401. *
  2402. * Module: library/camellia.c
  2403. * Caller: library/cipher.c
  2404. *
  2405. * This module enables the following ciphersuites (if other requisites are
  2406. * enabled as well):
  2407. * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
  2408. * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
  2409. * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256
  2410. * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384
  2411. * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
  2412. * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
  2413. * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
  2414. * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
  2415. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
  2416. * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
  2417. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
  2418. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
  2419. * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384
  2420. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256
  2421. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
  2422. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
  2423. * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
  2424. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
  2425. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
  2426. * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
  2427. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
  2428. * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
  2429. * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384
  2430. * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
  2431. * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
  2432. * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256
  2433. * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
  2434. * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
  2435. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384
  2436. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256
  2437. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
  2438. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256
  2439. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
  2440. * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
  2441. * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384
  2442. * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384
  2443. * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256
  2444. * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256
  2445. * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384
  2446. * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384
  2447. * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
  2448. * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
  2449. */
  2450. #define MBEDTLS_CAMELLIA_C
  2451. /**
  2452. * \def MBEDTLS_ARIA_C
  2453. *
  2454. * Enable the ARIA block cipher.
  2455. *
  2456. * Module: library/aria.c
  2457. * Caller: library/cipher.c
  2458. *
  2459. * This module enables the following ciphersuites (if other requisites are
  2460. * enabled as well):
  2461. *
  2462. * MBEDTLS_TLS_RSA_WITH_ARIA_128_CBC_SHA256
  2463. * MBEDTLS_TLS_RSA_WITH_ARIA_256_CBC_SHA384
  2464. * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256
  2465. * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384
  2466. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256
  2467. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384
  2468. * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256
  2469. * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384
  2470. * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256
  2471. * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384
  2472. * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256
  2473. * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384
  2474. * MBEDTLS_TLS_RSA_WITH_ARIA_128_GCM_SHA256
  2475. * MBEDTLS_TLS_RSA_WITH_ARIA_256_GCM_SHA384
  2476. * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256
  2477. * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384
  2478. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256
  2479. * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384
  2480. * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256
  2481. * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384
  2482. * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256
  2483. * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384
  2484. * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256
  2485. * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384
  2486. * MBEDTLS_TLS_PSK_WITH_ARIA_128_CBC_SHA256
  2487. * MBEDTLS_TLS_PSK_WITH_ARIA_256_CBC_SHA384
  2488. * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256
  2489. * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384
  2490. * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256
  2491. * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384
  2492. * MBEDTLS_TLS_PSK_WITH_ARIA_128_GCM_SHA256
  2493. * MBEDTLS_TLS_PSK_WITH_ARIA_256_GCM_SHA384
  2494. * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256
  2495. * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384
  2496. * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256
  2497. * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384
  2498. * MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256
  2499. * MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384
  2500. */
  2501. #define MBEDTLS_ARIA_C
  2502. /**
  2503. * \def MBEDTLS_CCM_C
  2504. *
  2505. * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher.
  2506. *
  2507. * Module: library/ccm.c
  2508. *
  2509. * Requires: MBEDTLS_CIPHER_C, MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C or
  2510. * MBEDTLS_ARIA_C
  2511. *
  2512. * This module enables the AES-CCM ciphersuites, if other requisites are
  2513. * enabled as well.
  2514. */
  2515. #define MBEDTLS_CCM_C
  2516. /**
  2517. * \def MBEDTLS_CHACHA20_C
  2518. *
  2519. * Enable the ChaCha20 stream cipher.
  2520. *
  2521. * Module: library/chacha20.c
  2522. */
  2523. #define MBEDTLS_CHACHA20_C
  2524. /**
  2525. * \def MBEDTLS_CHACHAPOLY_C
  2526. *
  2527. * Enable the ChaCha20-Poly1305 AEAD algorithm.
  2528. *
  2529. * Module: library/chachapoly.c
  2530. *
  2531. * This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C
  2532. */
  2533. #define MBEDTLS_CHACHAPOLY_C
  2534. /**
  2535. * \def MBEDTLS_CIPHER_C
  2536. *
  2537. * Enable the generic cipher layer.
  2538. *
  2539. * Module: library/cipher.c
  2540. * Caller: library/ccm.c
  2541. * library/cmac.c
  2542. * library/gcm.c
  2543. * library/nist_kw.c
  2544. * library/pkcs12.c
  2545. * library/pkcs5.c
  2546. * library/psa_crypto_aead.c
  2547. * library/psa_crypto_mac.c
  2548. * library/ssl_ciphersuites.c
  2549. * library/ssl_msg.c
  2550. * library/ssl_ticket.c (unless MBEDTLS_USE_PSA_CRYPTO is enabled)
  2551. * Auto-enabled by: MBEDTLS_PSA_CRYPTO_C depending on which ciphers are enabled
  2552. * (see the documentation of that option for details).
  2553. *
  2554. * Uncomment to enable generic cipher wrappers.
  2555. */
  2556. #define MBEDTLS_CIPHER_C
  2557. /**
  2558. * \def MBEDTLS_CMAC_C
  2559. *
  2560. * Enable the CMAC (Cipher-based Message Authentication Code) mode for block
  2561. * ciphers.
  2562. *
  2563. * \note When #MBEDTLS_CMAC_ALT is active, meaning that the underlying
  2564. * implementation of the CMAC algorithm is provided by an alternate
  2565. * implementation, that alternate implementation may opt to not support
  2566. * AES-192 or 3DES as underlying block ciphers for the CMAC operation.
  2567. *
  2568. * Module: library/cmac.c
  2569. *
  2570. * Requires: MBEDTLS_CIPHER_C, MBEDTLS_AES_C or MBEDTLS_DES_C
  2571. *
  2572. */
  2573. #define MBEDTLS_CMAC_C
  2574. /**
  2575. * \def MBEDTLS_CTR_DRBG_C
  2576. *
  2577. * Enable the CTR_DRBG AES-based random generator.
  2578. * The CTR_DRBG generator uses AES-256 by default.
  2579. * To use AES-128 instead, enable \c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY above.
  2580. *
  2581. * AES support can either be achieved through builtin (MBEDTLS_AES_C) or PSA.
  2582. * Builtin is the default option when MBEDTLS_AES_C is defined otherwise PSA
  2583. * is used.
  2584. *
  2585. * \warning When using PSA, the user should call `psa_crypto_init()` before
  2586. * using any CTR_DRBG operation (except `mbedtls_ctr_drbg_init()`).
  2587. *
  2588. * \note AES-128 will be used if \c MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH is set.
  2589. *
  2590. * \note To achieve a 256-bit security strength with CTR_DRBG,
  2591. * you must use AES-256 *and* use sufficient entropy.
  2592. * See ctr_drbg.h for more details.
  2593. *
  2594. * Module: library/ctr_drbg.c
  2595. * Caller:
  2596. *
  2597. * Requires: MBEDTLS_AES_C or
  2598. * (PSA_WANT_KEY_TYPE_AES and PSA_WANT_ALG_ECB_NO_PADDING and
  2599. * MBEDTLS_PSA_CRYPTO_C)
  2600. *
  2601. * This module provides the CTR_DRBG AES random number generator.
  2602. */
  2603. #define MBEDTLS_CTR_DRBG_C
  2604. /**
  2605. * \def MBEDTLS_DEBUG_C
  2606. *
  2607. * Enable the debug functions.
  2608. *
  2609. * Module: library/debug.c
  2610. * Caller: library/ssl_msg.c
  2611. * library/ssl_tls.c
  2612. * library/ssl_tls12_*.c
  2613. * library/ssl_tls13_*.c
  2614. *
  2615. * This module provides debugging functions.
  2616. */
  2617. #define MBEDTLS_DEBUG_C
  2618. /**
  2619. * \def MBEDTLS_DES_C
  2620. *
  2621. * Enable the DES block cipher.
  2622. *
  2623. * Module: library/des.c
  2624. * Caller: library/pem.c
  2625. * library/cipher.c
  2626. *
  2627. * PEM_PARSE uses DES/3DES for decrypting encrypted keys.
  2628. *
  2629. * \warning DES/3DES are considered weak ciphers and their use constitutes a
  2630. * security risk. We recommend considering stronger ciphers instead.
  2631. */
  2632. #define MBEDTLS_DES_C
  2633. /**
  2634. * \def MBEDTLS_DHM_C
  2635. *
  2636. * Enable the Diffie-Hellman-Merkle module.
  2637. *
  2638. * Module: library/dhm.c
  2639. * Caller: library/ssl_tls.c
  2640. * library/ssl*_client.c
  2641. * library/ssl*_server.c
  2642. *
  2643. * This module is used by the following key exchanges:
  2644. * DHE-RSA, DHE-PSK
  2645. *
  2646. * \warning Using DHE constitutes a security risk as it
  2647. * is not possible to validate custom DH parameters.
  2648. * If possible, it is recommended users should consider
  2649. * preferring other methods of key exchange.
  2650. * See dhm.h for more details.
  2651. *
  2652. */
  2653. #define MBEDTLS_DHM_C
  2654. /**
  2655. * \def MBEDTLS_ECDH_C
  2656. *
  2657. * Enable the elliptic curve Diffie-Hellman library.
  2658. *
  2659. * Module: library/ecdh.c
  2660. * Caller: library/psa_crypto.c
  2661. * library/ssl_tls.c
  2662. * library/ssl*_client.c
  2663. * library/ssl*_server.c
  2664. *
  2665. * This module is used by the following key exchanges:
  2666. * ECDHE-ECDSA, ECDHE-RSA, DHE-PSK
  2667. *
  2668. * Requires: MBEDTLS_ECP_C
  2669. */
  2670. #define MBEDTLS_ECDH_C
  2671. /**
  2672. * \def MBEDTLS_ECDSA_C
  2673. *
  2674. * Enable the elliptic curve DSA library.
  2675. *
  2676. * Module: library/ecdsa.c
  2677. * Caller:
  2678. *
  2679. * This module is used by the following key exchanges:
  2680. * ECDHE-ECDSA
  2681. *
  2682. * Requires: MBEDTLS_ECP_C, MBEDTLS_ASN1_WRITE_C, MBEDTLS_ASN1_PARSE_C,
  2683. * and at least one MBEDTLS_ECP_DP_XXX_ENABLED for a
  2684. * short Weierstrass curve.
  2685. */
  2686. #define MBEDTLS_ECDSA_C
  2687. /**
  2688. * \def MBEDTLS_ECJPAKE_C
  2689. *
  2690. * Enable the elliptic curve J-PAKE library.
  2691. *
  2692. * \note EC J-PAKE support is based on the Thread v1.0.0 specification.
  2693. * It has not been reviewed for compliance with newer standards such as
  2694. * Thread v1.1 or RFC 8236.
  2695. *
  2696. * Module: library/ecjpake.c
  2697. * Caller:
  2698. *
  2699. * This module is used by the following key exchanges:
  2700. * ECJPAKE
  2701. *
  2702. * Requires: MBEDTLS_ECP_C and either MBEDTLS_MD_C or MBEDTLS_PSA_CRYPTO_C
  2703. *
  2704. * \warning If using a hash that is only provided by PSA drivers, you must
  2705. * call psa_crypto_init() before doing any EC J-PAKE operations.
  2706. */
  2707. #define MBEDTLS_ECJPAKE_C
  2708. /**
  2709. * \def MBEDTLS_ECP_C
  2710. *
  2711. * Enable the elliptic curve over GF(p) library.
  2712. *
  2713. * Module: library/ecp.c
  2714. * Caller: library/ecdh.c
  2715. * library/ecdsa.c
  2716. * library/ecjpake.c
  2717. *
  2718. * Requires: MBEDTLS_BIGNUM_C and at least one MBEDTLS_ECP_DP_XXX_ENABLED
  2719. */
  2720. #define MBEDTLS_ECP_C
  2721. /**
  2722. * \def MBEDTLS_ENTROPY_C
  2723. *
  2724. * Enable the platform-specific entropy code.
  2725. *
  2726. * Module: library/entropy.c
  2727. * Caller:
  2728. *
  2729. * Requires: MBEDTLS_SHA512_C or MBEDTLS_SHA256_C
  2730. *
  2731. * This module provides a generic entropy pool
  2732. */
  2733. #define MBEDTLS_ENTROPY_C
  2734. /**
  2735. * \def MBEDTLS_ERROR_C
  2736. *
  2737. * Enable error code to error string conversion.
  2738. *
  2739. * Module: library/error.c
  2740. * Caller:
  2741. *
  2742. * This module enables mbedtls_strerror().
  2743. */
  2744. #define MBEDTLS_ERROR_C
  2745. /**
  2746. * \def MBEDTLS_GCM_C
  2747. *
  2748. * Enable the Galois/Counter Mode (GCM).
  2749. *
  2750. * Module: library/gcm.c
  2751. *
  2752. * Requires: MBEDTLS_CIPHER_C, MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C or
  2753. * MBEDTLS_ARIA_C
  2754. *
  2755. * This module enables the AES-GCM and CAMELLIA-GCM ciphersuites, if other
  2756. * requisites are enabled as well.
  2757. */
  2758. #define MBEDTLS_GCM_C
  2759. /**
  2760. * \def MBEDTLS_GCM_LARGE_TABLE
  2761. *
  2762. * Enable large pre-computed tables for Galois/Counter Mode (GCM).
  2763. * Can significantly increase throughput on systems without GCM hardware
  2764. * acceleration (e.g., AESNI, AESCE).
  2765. *
  2766. * The mbedtls_gcm_context size will increase by 3840 bytes.
  2767. * The code size will increase by roughly 344 bytes.
  2768. *
  2769. * Module: library/gcm.c
  2770. *
  2771. * Requires: MBEDTLS_GCM_C
  2772. */
  2773. //#define MBEDTLS_GCM_LARGE_TABLE
  2774. /**
  2775. * \def MBEDTLS_HKDF_C
  2776. *
  2777. * Enable the HKDF algorithm (RFC 5869).
  2778. *
  2779. * Module: library/hkdf.c
  2780. * Caller:
  2781. *
  2782. * Requires: MBEDTLS_MD_C
  2783. *
  2784. * This module adds support for the Hashed Message Authentication Code
  2785. * (HMAC)-based key derivation function (HKDF).
  2786. */
  2787. #define MBEDTLS_HKDF_C
  2788. /**
  2789. * \def MBEDTLS_HMAC_DRBG_C
  2790. *
  2791. * Enable the HMAC_DRBG random generator.
  2792. *
  2793. * Module: library/hmac_drbg.c
  2794. * Caller:
  2795. *
  2796. * Requires: MBEDTLS_MD_C
  2797. *
  2798. * Uncomment to enable the HMAC_DRBG random number generator.
  2799. */
  2800. #define MBEDTLS_HMAC_DRBG_C
  2801. /**
  2802. * \def MBEDTLS_LMS_C
  2803. *
  2804. * Enable the LMS stateful-hash asymmetric signature algorithm.
  2805. *
  2806. * Module: library/lms.c
  2807. * Caller:
  2808. *
  2809. * Requires: MBEDTLS_PSA_CRYPTO_C
  2810. *
  2811. * Uncomment to enable the LMS verification algorithm and public key operations.
  2812. */
  2813. #define MBEDTLS_LMS_C
  2814. /**
  2815. * \def MBEDTLS_LMS_PRIVATE
  2816. *
  2817. * Enable LMS private-key operations and signing code. Functions enabled by this
  2818. * option are experimental, and should not be used in production.
  2819. *
  2820. * Requires: MBEDTLS_LMS_C
  2821. *
  2822. * Uncomment to enable the LMS signature algorithm and private key operations.
  2823. */
  2824. //#define MBEDTLS_LMS_PRIVATE
  2825. /**
  2826. * \def MBEDTLS_NIST_KW_C
  2827. *
  2828. * Enable the Key Wrapping mode for 128-bit block ciphers,
  2829. * as defined in NIST SP 800-38F. Only KW and KWP modes
  2830. * are supported. At the moment, only AES is approved by NIST.
  2831. *
  2832. * Module: library/nist_kw.c
  2833. *
  2834. * Requires: MBEDTLS_AES_C and MBEDTLS_CIPHER_C
  2835. */
  2836. #define MBEDTLS_NIST_KW_C
  2837. /**
  2838. * \def MBEDTLS_MD_C
  2839. *
  2840. * Enable the generic layer for message digest (hashing) and HMAC.
  2841. *
  2842. * Requires: one of: MBEDTLS_MD5_C, MBEDTLS_RIPEMD160_C, MBEDTLS_SHA1_C,
  2843. * MBEDTLS_SHA224_C, MBEDTLS_SHA256_C, MBEDTLS_SHA384_C,
  2844. * MBEDTLS_SHA512_C, or MBEDTLS_PSA_CRYPTO_C with at least
  2845. * one hash.
  2846. * Module: library/md.c
  2847. * Caller: library/constant_time.c
  2848. * library/ecdsa.c
  2849. * library/ecjpake.c
  2850. * library/hkdf.c
  2851. * library/hmac_drbg.c
  2852. * library/pk.c
  2853. * library/pkcs5.c
  2854. * library/pkcs12.c
  2855. * library/psa_crypto_ecp.c
  2856. * library/psa_crypto_rsa.c
  2857. * library/rsa.c
  2858. * library/ssl_cookie.c
  2859. * library/ssl_msg.c
  2860. * library/ssl_tls.c
  2861. * library/x509.c
  2862. * library/x509_crt.c
  2863. * library/x509write_crt.c
  2864. * library/x509write_csr.c
  2865. *
  2866. * Uncomment to enable generic message digest wrappers.
  2867. */
  2868. #define MBEDTLS_MD_C
  2869. /**
  2870. * \def MBEDTLS_MD5_C
  2871. *
  2872. * Enable the MD5 hash algorithm.
  2873. *
  2874. * Module: library/md5.c
  2875. * Caller: library/md.c
  2876. * library/pem.c
  2877. * library/ssl_tls.c
  2878. *
  2879. * This module is required for TLS 1.2 depending on the handshake parameters.
  2880. * Further, it is used for checking MD5-signed certificates, and for PBKDF1
  2881. * when decrypting PEM-encoded encrypted keys.
  2882. *
  2883. * \warning MD5 is considered a weak message digest and its use constitutes a
  2884. * security risk. If possible, we recommend avoiding dependencies on
  2885. * it, and considering stronger message digests instead.
  2886. *
  2887. */
  2888. #define MBEDTLS_MD5_C
  2889. /**
  2890. * \def MBEDTLS_MEMORY_BUFFER_ALLOC_C
  2891. *
  2892. * Enable the buffer allocator implementation that makes use of a (stack)
  2893. * based buffer to 'allocate' dynamic memory. (replaces calloc() and free()
  2894. * calls)
  2895. *
  2896. * Module: library/memory_buffer_alloc.c
  2897. *
  2898. * Requires: MBEDTLS_PLATFORM_C
  2899. * MBEDTLS_PLATFORM_MEMORY (to use it within Mbed TLS)
  2900. *
  2901. * Enable this module to enable the buffer memory allocator.
  2902. */
  2903. //#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
  2904. /**
  2905. * \def MBEDTLS_NET_C
  2906. *
  2907. * Enable the TCP and UDP over IPv6/IPv4 networking routines.
  2908. *
  2909. * \note This module only works on POSIX/Unix (including Linux, BSD and OS X)
  2910. * and Windows. For other platforms, you'll want to disable it, and write your
  2911. * own networking callbacks to be passed to \c mbedtls_ssl_set_bio().
  2912. *
  2913. * \note See also our Knowledge Base article about porting to a new
  2914. * environment:
  2915. * https://mbed-tls.readthedocs.io/en/latest/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
  2916. *
  2917. * Module: library/net_sockets.c
  2918. *
  2919. * This module provides networking routines.
  2920. */
  2921. #define MBEDTLS_NET_C
  2922. /**
  2923. * \def MBEDTLS_OID_C
  2924. *
  2925. * Enable the OID database.
  2926. *
  2927. * Module: library/oid.c
  2928. * Caller: library/asn1write.c
  2929. * library/pkcs5.c
  2930. * library/pkparse.c
  2931. * library/pkwrite.c
  2932. * library/rsa.c
  2933. * library/x509.c
  2934. * library/x509_create.c
  2935. * library/x509_crl.c
  2936. * library/x509_crt.c
  2937. * library/x509_csr.c
  2938. * library/x509write_crt.c
  2939. * library/x509write_csr.c
  2940. *
  2941. * This modules translates between OIDs and internal values.
  2942. */
  2943. #define MBEDTLS_OID_C
  2944. /**
  2945. * \def MBEDTLS_PADLOCK_C
  2946. *
  2947. * Enable VIA Padlock support on x86.
  2948. *
  2949. * Module: library/padlock.c
  2950. * Caller: library/aes.c
  2951. *
  2952. * Requires: MBEDTLS_HAVE_ASM
  2953. *
  2954. * This modules adds support for the VIA PadLock on x86.
  2955. */
  2956. #define MBEDTLS_PADLOCK_C
  2957. /**
  2958. * \def MBEDTLS_PEM_PARSE_C
  2959. *
  2960. * Enable PEM decoding / parsing.
  2961. *
  2962. * Module: library/pem.c
  2963. * Caller: library/dhm.c
  2964. * library/pkparse.c
  2965. * library/x509_crl.c
  2966. * library/x509_crt.c
  2967. * library/x509_csr.c
  2968. *
  2969. * Requires: MBEDTLS_BASE64_C
  2970. * optionally MBEDTLS_MD5_C, or PSA Crypto with MD5 (see below)
  2971. *
  2972. * \warning When parsing password-protected files, if MD5 is provided only by
  2973. * a PSA driver, you must call psa_crypto_init() before the first file.
  2974. *
  2975. * This modules adds support for decoding / parsing PEM files.
  2976. */
  2977. #define MBEDTLS_PEM_PARSE_C
  2978. /**
  2979. * \def MBEDTLS_PEM_WRITE_C
  2980. *
  2981. * Enable PEM encoding / writing.
  2982. *
  2983. * Module: library/pem.c
  2984. * Caller: library/pkwrite.c
  2985. * library/x509write_crt.c
  2986. * library/x509write_csr.c
  2987. *
  2988. * Requires: MBEDTLS_BASE64_C
  2989. *
  2990. * This modules adds support for encoding / writing PEM files.
  2991. */
  2992. #define MBEDTLS_PEM_WRITE_C
  2993. /**
  2994. * \def MBEDTLS_PK_C
  2995. *
  2996. * Enable the generic public (asymmetric) key layer.
  2997. *
  2998. * Module: library/pk.c
  2999. * Caller: library/psa_crypto_rsa.c
  3000. * library/ssl_tls.c
  3001. * library/ssl*_client.c
  3002. * library/ssl*_server.c
  3003. * library/x509.c
  3004. *
  3005. * Requires: MBEDTLS_MD_C, MBEDTLS_RSA_C or MBEDTLS_ECP_C
  3006. *
  3007. * Uncomment to enable generic public key wrappers.
  3008. */
  3009. #define MBEDTLS_PK_C
  3010. /**
  3011. * \def MBEDTLS_PK_PARSE_C
  3012. *
  3013. * Enable the generic public (asymmetric) key parser.
  3014. *
  3015. * Module: library/pkparse.c
  3016. * Caller: library/x509_crt.c
  3017. * library/x509_csr.c
  3018. *
  3019. * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_OID_C, MBEDTLS_PK_C
  3020. *
  3021. * Uncomment to enable generic public key parse functions.
  3022. */
  3023. #define MBEDTLS_PK_PARSE_C
  3024. /**
  3025. * \def MBEDTLS_PK_WRITE_C
  3026. *
  3027. * Enable the generic public (asymmetric) key writer.
  3028. *
  3029. * Module: library/pkwrite.c
  3030. * Caller: library/x509write.c
  3031. *
  3032. * Requires: MBEDTLS_ASN1_WRITE_C, MBEDTLS_OID_C, MBEDTLS_PK_C
  3033. *
  3034. * Uncomment to enable generic public key write functions.
  3035. */
  3036. #define MBEDTLS_PK_WRITE_C
  3037. /**
  3038. * \def MBEDTLS_PKCS5_C
  3039. *
  3040. * Enable PKCS#5 functions.
  3041. *
  3042. * Module: library/pkcs5.c
  3043. *
  3044. * Auto-enables: MBEDTLS_MD_C
  3045. *
  3046. * \warning If using a hash that is only provided by PSA drivers, you must
  3047. * call psa_crypto_init() before doing any PKCS5 operations.
  3048. *
  3049. * This module adds support for the PKCS#5 functions.
  3050. */
  3051. #define MBEDTLS_PKCS5_C
  3052. /**
  3053. * \def MBEDTLS_PKCS7_C
  3054. *
  3055. * Enable PKCS #7 core for using PKCS #7-formatted signatures.
  3056. * RFC Link - https://tools.ietf.org/html/rfc2315
  3057. *
  3058. * Module: library/pkcs7.c
  3059. *
  3060. * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_OID_C, MBEDTLS_PK_PARSE_C,
  3061. * MBEDTLS_X509_CRT_PARSE_C MBEDTLS_X509_CRL_PARSE_C,
  3062. * MBEDTLS_BIGNUM_C, MBEDTLS_MD_C
  3063. *
  3064. * This module is required for the PKCS #7 parsing modules.
  3065. */
  3066. #define MBEDTLS_PKCS7_C
  3067. /**
  3068. * \def MBEDTLS_PKCS12_C
  3069. *
  3070. * Enable PKCS#12 PBE functions.
  3071. * Adds algorithms for parsing PKCS#8 encrypted private keys
  3072. *
  3073. * Module: library/pkcs12.c
  3074. * Caller: library/pkparse.c
  3075. *
  3076. * Requires: MBEDTLS_ASN1_PARSE_C and either MBEDTLS_MD_C or
  3077. * MBEDTLS_PSA_CRYPTO_C.
  3078. *
  3079. * \warning If using a hash that is only provided by PSA drivers, you must
  3080. * call psa_crypto_init() before doing any PKCS12 operations.
  3081. *
  3082. * This module enables PKCS#12 functions.
  3083. */
  3084. #define MBEDTLS_PKCS12_C
  3085. /**
  3086. * \def MBEDTLS_PLATFORM_C
  3087. *
  3088. * Enable the platform abstraction layer that allows you to re-assign
  3089. * functions like calloc(), free(), snprintf(), printf(), fprintf(), exit().
  3090. *
  3091. * Enabling MBEDTLS_PLATFORM_C enables to use of MBEDTLS_PLATFORM_XXX_ALT
  3092. * or MBEDTLS_PLATFORM_XXX_MACRO directives, allowing the functions mentioned
  3093. * above to be specified at runtime or compile time respectively.
  3094. *
  3095. * \note This abstraction layer must be enabled on Windows (including MSYS2)
  3096. * as other modules rely on it for a fixed snprintf implementation.
  3097. *
  3098. * Module: library/platform.c
  3099. * Caller: Most other .c files
  3100. *
  3101. * This module enables abstraction of common (libc) functions.
  3102. */
  3103. #define MBEDTLS_PLATFORM_C
  3104. /**
  3105. * \def MBEDTLS_POLY1305_C
  3106. *
  3107. * Enable the Poly1305 MAC algorithm.
  3108. *
  3109. * Module: library/poly1305.c
  3110. * Caller: library/chachapoly.c
  3111. */
  3112. #define MBEDTLS_POLY1305_C
  3113. /**
  3114. * \def MBEDTLS_PSA_CRYPTO_C
  3115. *
  3116. * Enable the Platform Security Architecture (PSA) cryptography API.
  3117. *
  3118. * \note In multithreaded applications, you must enable #MBEDTLS_THREADING_C,
  3119. * unless only one thread ever calls `psa_xxx()` functions.
  3120. * That includes indirect calls, such as:
  3121. * - performing a TLS handshake if support for TLS 1.3 is enabled;
  3122. * - using a TLS 1.3 connection;
  3123. * - indirect calls from PK, X.509 or SSL functions when
  3124. * #MBEDTLS_USE_PSA_CRYPTO is enabled;
  3125. * - indirect calls to calculate a hash when #MBEDTLS_MD_C is disabled;
  3126. * - any other call to a function that requires calling psa_crypto_init()
  3127. * beforehand.
  3128. *
  3129. * Module: library/psa_crypto.c
  3130. *
  3131. * Requires: either MBEDTLS_CTR_DRBG_C and MBEDTLS_ENTROPY_C,
  3132. * or MBEDTLS_HMAC_DRBG_C and MBEDTLS_ENTROPY_C,
  3133. * or MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG.
  3134. * Auto-enables: MBEDTLS_CIPHER_C if any unauthenticated (ie, non-AEAD) cipher
  3135. * is enabled in PSA (unless it's fully accelerated, see
  3136. * docs/driver-only-builds.md about that).
  3137. */
  3138. #define MBEDTLS_PSA_CRYPTO_C
  3139. /**
  3140. * \def MBEDTLS_PSA_CRYPTO_SE_C
  3141. *
  3142. * Enable dynamic secure element support in the Platform Security Architecture
  3143. * cryptography API.
  3144. *
  3145. * \deprecated This feature is deprecated. Please switch to the PSA driver
  3146. * interface.
  3147. *
  3148. * \warning This feature is not thread-safe, and should not be used in a
  3149. * multi-threaded environment.
  3150. *
  3151. * Module: library/psa_crypto_se.c
  3152. *
  3153. * Requires: MBEDTLS_PSA_CRYPTO_C, MBEDTLS_PSA_CRYPTO_STORAGE_C
  3154. *
  3155. */
  3156. //#define MBEDTLS_PSA_CRYPTO_SE_C
  3157. /**
  3158. * \def MBEDTLS_PSA_CRYPTO_STORAGE_C
  3159. *
  3160. * Enable the Platform Security Architecture persistent key storage.
  3161. *
  3162. * Module: library/psa_crypto_storage.c
  3163. *
  3164. * Requires: MBEDTLS_PSA_CRYPTO_C,
  3165. * either MBEDTLS_PSA_ITS_FILE_C or a native implementation of
  3166. * the PSA ITS interface
  3167. */
  3168. #define MBEDTLS_PSA_CRYPTO_STORAGE_C
  3169. /**
  3170. * \def MBEDTLS_PSA_ITS_FILE_C
  3171. *
  3172. * Enable the emulation of the Platform Security Architecture
  3173. * Internal Trusted Storage (PSA ITS) over files.
  3174. *
  3175. * Module: library/psa_its_file.c
  3176. *
  3177. * Requires: MBEDTLS_FS_IO
  3178. */
  3179. #define MBEDTLS_PSA_ITS_FILE_C
  3180. /**
  3181. * \def MBEDTLS_PSA_STATIC_KEY_SLOTS
  3182. *
  3183. * Statically preallocate memory to store keys' material in PSA instead
  3184. * of allocating it dynamically when required. This allows builds without a
  3185. * heap, if none of the enabled cryptographic implementations or other features
  3186. * require it.
  3187. * This feature affects both volatile and persistent keys which means that
  3188. * it's not possible to persistently store a key which is larger than
  3189. * #MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE.
  3190. *
  3191. * \note This feature comes with a (potentially) higher RAM usage since:
  3192. * - All the key slots are allocated no matter if they are used or not.
  3193. * - Each key buffer's length is #MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE bytes.
  3194. *
  3195. * Requires: MBEDTLS_PSA_CRYPTO_C
  3196. *
  3197. */
  3198. //#define MBEDTLS_PSA_STATIC_KEY_SLOTS
  3199. /**
  3200. * \def MBEDTLS_RIPEMD160_C
  3201. *
  3202. * Enable the RIPEMD-160 hash algorithm.
  3203. *
  3204. * Module: library/ripemd160.c
  3205. * Caller: library/md.c
  3206. *
  3207. */
  3208. #define MBEDTLS_RIPEMD160_C
  3209. /**
  3210. * \def MBEDTLS_RSA_C
  3211. *
  3212. * Enable the RSA public-key cryptosystem.
  3213. *
  3214. * Module: library/rsa.c
  3215. * library/rsa_alt_helpers.c
  3216. * Caller: library/pk.c
  3217. * library/psa_crypto.c
  3218. * library/ssl_tls.c
  3219. * library/ssl*_client.c
  3220. * library/ssl*_server.c
  3221. *
  3222. * This module is used by the following key exchanges:
  3223. * RSA, DHE-RSA, ECDHE-RSA, RSA-PSK
  3224. *
  3225. * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C
  3226. */
  3227. #define MBEDTLS_RSA_C
  3228. /**
  3229. * \def MBEDTLS_SHA1_C
  3230. *
  3231. * Enable the SHA1 cryptographic hash algorithm.
  3232. *
  3233. * Module: library/sha1.c
  3234. * Caller: library/md.c
  3235. * library/psa_crypto_hash.c
  3236. *
  3237. * This module is required for TLS 1.2 depending on the handshake parameters,
  3238. * and for SHA1-signed certificates.
  3239. *
  3240. * \warning SHA-1 is considered a weak message digest and its use constitutes
  3241. * a security risk. If possible, we recommend avoiding dependencies
  3242. * on it, and considering stronger message digests instead.
  3243. *
  3244. */
  3245. #define MBEDTLS_SHA1_C
  3246. /**
  3247. * \def MBEDTLS_SHA224_C
  3248. *
  3249. * Enable the SHA-224 cryptographic hash algorithm.
  3250. *
  3251. * Module: library/sha256.c
  3252. * Caller: library/md.c
  3253. * library/ssl_cookie.c
  3254. *
  3255. * This module adds support for SHA-224.
  3256. */
  3257. #define MBEDTLS_SHA224_C
  3258. /**
  3259. * \def MBEDTLS_SHA256_C
  3260. *
  3261. * Enable the SHA-256 cryptographic hash algorithm.
  3262. *
  3263. * Module: library/sha256.c
  3264. * Caller: library/entropy.c
  3265. * library/md.c
  3266. * library/ssl_tls.c
  3267. * library/ssl*_client.c
  3268. * library/ssl*_server.c
  3269. *
  3270. * This module adds support for SHA-256.
  3271. * This module is required for the SSL/TLS 1.2 PRF function.
  3272. */
  3273. #define MBEDTLS_SHA256_C
  3274. /**
  3275. * \def MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT
  3276. *
  3277. * Enable acceleration of the SHA-256 and SHA-224 cryptographic hash algorithms
  3278. * with the ARMv8 cryptographic extensions if they are available at runtime.
  3279. * If not, the library will fall back to the C implementation.
  3280. *
  3281. * \note If MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT is defined when building
  3282. * for a non-Armv8-A build it will be silently ignored.
  3283. *
  3284. * \note Minimum compiler versions for this feature are Clang 4.0,
  3285. * armclang 6.6 or GCC 6.0.
  3286. *
  3287. * \note \c CFLAGS must be set to a minimum of \c -march=armv8-a+crypto for
  3288. * armclang <= 6.9
  3289. *
  3290. * \note This was previously known as MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT.
  3291. * That name is deprecated, but may still be used as an alternative form for this
  3292. * option.
  3293. *
  3294. * \warning MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT cannot be defined at the
  3295. * same time as MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY.
  3296. *
  3297. * Requires: MBEDTLS_SHA256_C.
  3298. *
  3299. * Module: library/sha256.c
  3300. *
  3301. * Uncomment to have the library check for the Armv8-A SHA-256 crypto extensions
  3302. * and use them if available.
  3303. */
  3304. //#define MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT
  3305. /**
  3306. * \def MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT
  3307. *
  3308. * \deprecated This is now known as MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT.
  3309. * This name is now deprecated, but may still be used as an alternative form for
  3310. * this option.
  3311. */
  3312. //#define MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT
  3313. /**
  3314. * \def MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY
  3315. *
  3316. * Enable acceleration of the SHA-256 and SHA-224 cryptographic hash algorithms
  3317. * with the ARMv8 cryptographic extensions, which must be available at runtime
  3318. * or else an illegal instruction fault will occur.
  3319. *
  3320. * \note This allows builds with a smaller code size than with
  3321. * MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT
  3322. *
  3323. * \note Minimum compiler versions for this feature are Clang 4.0,
  3324. * armclang 6.6 or GCC 6.0.
  3325. *
  3326. * \note \c CFLAGS must be set to a minimum of \c -march=armv8-a+crypto for
  3327. * armclang <= 6.9
  3328. *
  3329. * \note This was previously known as MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY.
  3330. * That name is deprecated, but may still be used as an alternative form for this
  3331. * option.
  3332. *
  3333. * \warning MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY cannot be defined at the same
  3334. * time as MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT.
  3335. *
  3336. * Requires: MBEDTLS_SHA256_C.
  3337. *
  3338. * Module: library/sha256.c
  3339. *
  3340. * Uncomment to have the library use the Armv8-A SHA-256 crypto extensions
  3341. * unconditionally.
  3342. */
  3343. //#define MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY
  3344. /**
  3345. * \def MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY
  3346. *
  3347. * \deprecated This is now known as MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY.
  3348. * This name is now deprecated, but may still be used as an alternative form for
  3349. * this option.
  3350. */
  3351. //#define MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY
  3352. /**
  3353. * \def MBEDTLS_SHA384_C
  3354. *
  3355. * Enable the SHA-384 cryptographic hash algorithm.
  3356. *
  3357. * Module: library/sha512.c
  3358. * Caller: library/md.c
  3359. * library/psa_crypto_hash.c
  3360. * library/ssl_tls.c
  3361. * library/ssl*_client.c
  3362. * library/ssl*_server.c
  3363. *
  3364. * Comment to disable SHA-384
  3365. */
  3366. #define MBEDTLS_SHA384_C
  3367. /**
  3368. * \def MBEDTLS_SHA512_C
  3369. *
  3370. * Enable SHA-512 cryptographic hash algorithms.
  3371. *
  3372. * Module: library/sha512.c
  3373. * Caller: library/entropy.c
  3374. * library/md.c
  3375. * library/ssl_tls.c
  3376. * library/ssl_cookie.c
  3377. *
  3378. * This module adds support for SHA-512.
  3379. */
  3380. #define MBEDTLS_SHA512_C
  3381. /**
  3382. * \def MBEDTLS_SHA3_C
  3383. *
  3384. * Enable the SHA3 cryptographic hash algorithm.
  3385. *
  3386. * Module: library/sha3.c
  3387. *
  3388. * This module adds support for SHA3.
  3389. */
  3390. #define MBEDTLS_SHA3_C
  3391. /**
  3392. * \def MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT
  3393. *
  3394. * Enable acceleration of the SHA-512 and SHA-384 cryptographic hash algorithms
  3395. * with the ARMv8 cryptographic extensions if they are available at runtime.
  3396. * If not, the library will fall back to the C implementation.
  3397. *
  3398. * \note If MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT is defined when building
  3399. * for a non-Aarch64 build it will be silently ignored.
  3400. *
  3401. * \note Minimum compiler versions for this feature are Clang 7.0,
  3402. * armclang 6.9 or GCC 8.0.
  3403. *
  3404. * \note \c CFLAGS must be set to a minimum of \c -march=armv8.2-a+sha3 for
  3405. * armclang 6.9
  3406. *
  3407. * \warning MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT cannot be defined at the
  3408. * same time as MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY.
  3409. *
  3410. * Requires: MBEDTLS_SHA512_C.
  3411. *
  3412. * Module: library/sha512.c
  3413. *
  3414. * Uncomment to have the library check for the A64 SHA-512 crypto extensions
  3415. * and use them if available.
  3416. */
  3417. //#define MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT
  3418. /**
  3419. * \def MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY
  3420. *
  3421. * Enable acceleration of the SHA-512 and SHA-384 cryptographic hash algorithms
  3422. * with the ARMv8 cryptographic extensions, which must be available at runtime
  3423. * or else an illegal instruction fault will occur.
  3424. *
  3425. * \note This allows builds with a smaller code size than with
  3426. * MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT
  3427. *
  3428. * \note Minimum compiler versions for this feature are Clang 7.0,
  3429. * armclang 6.9 or GCC 8.0.
  3430. *
  3431. * \note \c CFLAGS must be set to a minimum of \c -march=armv8.2-a+sha3 for
  3432. * armclang 6.9
  3433. *
  3434. * \warning MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY cannot be defined at the same
  3435. * time as MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT.
  3436. *
  3437. * Requires: MBEDTLS_SHA512_C.
  3438. *
  3439. * Module: library/sha512.c
  3440. *
  3441. * Uncomment to have the library use the A64 SHA-512 crypto extensions
  3442. * unconditionally.
  3443. */
  3444. //#define MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY
  3445. /**
  3446. * \def MBEDTLS_SSL_CACHE_C
  3447. *
  3448. * Enable simple SSL cache implementation.
  3449. *
  3450. * Module: library/ssl_cache.c
  3451. * Caller:
  3452. *
  3453. * Requires: MBEDTLS_SSL_CACHE_C
  3454. */
  3455. #define MBEDTLS_SSL_CACHE_C
  3456. /**
  3457. * \def MBEDTLS_SSL_COOKIE_C
  3458. *
  3459. * Enable basic implementation of DTLS cookies for hello verification.
  3460. *
  3461. * Module: library/ssl_cookie.c
  3462. * Caller:
  3463. */
  3464. #define MBEDTLS_SSL_COOKIE_C
  3465. /**
  3466. * \def MBEDTLS_SSL_TICKET_C
  3467. *
  3468. * Enable an implementation of TLS server-side callbacks for session tickets.
  3469. *
  3470. * Module: library/ssl_ticket.c
  3471. * Caller:
  3472. *
  3473. * Requires: (MBEDTLS_CIPHER_C || MBEDTLS_USE_PSA_CRYPTO) &&
  3474. * (MBEDTLS_GCM_C || MBEDTLS_CCM_C || MBEDTLS_CHACHAPOLY_C)
  3475. */
  3476. #define MBEDTLS_SSL_TICKET_C
  3477. /**
  3478. * \def MBEDTLS_SSL_CLI_C
  3479. *
  3480. * Enable the SSL/TLS client code.
  3481. *
  3482. * Module: library/ssl*_client.c
  3483. * Caller:
  3484. *
  3485. * Requires: MBEDTLS_SSL_TLS_C
  3486. *
  3487. * This module is required for SSL/TLS client support.
  3488. */
  3489. #define MBEDTLS_SSL_CLI_C
  3490. /**
  3491. * \def MBEDTLS_SSL_SRV_C
  3492. *
  3493. * Enable the SSL/TLS server code.
  3494. *
  3495. * Module: library/ssl*_server.c
  3496. * Caller:
  3497. *
  3498. * Requires: MBEDTLS_SSL_TLS_C
  3499. *
  3500. * This module is required for SSL/TLS server support.
  3501. */
  3502. #define MBEDTLS_SSL_SRV_C
  3503. /**
  3504. * \def MBEDTLS_SSL_TLS_C
  3505. *
  3506. * Enable the generic SSL/TLS code.
  3507. *
  3508. * Module: library/ssl_tls.c
  3509. * Caller: library/ssl*_client.c
  3510. * library/ssl*_server.c
  3511. *
  3512. * Requires: MBEDTLS_CIPHER_C, MBEDTLS_MD_C
  3513. * and at least one of the MBEDTLS_SSL_PROTO_XXX defines
  3514. *
  3515. * This module is required for SSL/TLS.
  3516. */
  3517. #define MBEDTLS_SSL_TLS_C
  3518. /**
  3519. * \def MBEDTLS_THREADING_C
  3520. *
  3521. * Enable the threading abstraction layer.
  3522. *
  3523. * Traditionally, Mbed TLS assumes it is used in a non-threaded environment or
  3524. * that contexts are not shared between threads. If you do intend to use contexts
  3525. * between threads, you will need to enable this layer to prevent race
  3526. * conditions.
  3527. *
  3528. * The PSA subsystem has an implicit shared context. Therefore, you must
  3529. * enable this option if more than one thread may use any part of
  3530. * Mbed TLS that is implemented on top of the PSA subsystem.
  3531. *
  3532. * You must enable this option in multithreaded applications where more than
  3533. * one thread performs any of the following operations:
  3534. *
  3535. * - Any call to a PSA function (`psa_xxx()`).
  3536. * - Any call to a TLS, X.509 or PK function (`mbedtls_ssl_xxx()`,
  3537. * `mbedtls_x509_xxx()`, `mbedtls_pkcs7_xxx()`, `mbedtls_pk_xxx()`)
  3538. * if `MBEDTLS_USE_PSA_CRYPTO` is enabled (regardless of whether individual
  3539. * TLS, X.509 or PK contexts are shared between threads).
  3540. * - A TLS 1.3 connection, regardless of the compile-time configuration.
  3541. * - Any library feature that calculates a hash, if `MBEDTLS_MD_C` is disabled.
  3542. * As an exception, algorithm-specific low-level modules do not require
  3543. * threading protection unless the contexts are shared between threads.
  3544. * - Any library feature that performs symmetric encryption or decryption,
  3545. * if `MBEDTLS_CIPHER_C` is disabled.
  3546. * As an exception, algorithm-specific low-level modules do not require
  3547. * threading protection unless the contexts are shared between threads.
  3548. * - Any use of a cryptographic context if the same context is used in
  3549. * multiple threads.
  3550. * - Any call to a function where the documentation specifies that
  3551. * psa_crypto_init() must be called prior to that function.
  3552. *
  3553. * See also our Knowledge Base article about threading:
  3554. * https://mbed-tls.readthedocs.io/en/latest/kb/development/thread-safety-and-multi-threading
  3555. *
  3556. * Module: library/threading.c
  3557. *
  3558. * This allows different threading implementations (self-implemented or
  3559. * provided).
  3560. *
  3561. * You will have to enable either MBEDTLS_THREADING_ALT or
  3562. * MBEDTLS_THREADING_PTHREAD.
  3563. *
  3564. * Enable this layer to allow use of mutexes within Mbed TLS
  3565. */
  3566. //#define MBEDTLS_THREADING_C
  3567. /**
  3568. * \def MBEDTLS_TIMING_C
  3569. *
  3570. * Enable the semi-portable timing interface.
  3571. *
  3572. * \note The provided implementation only works on POSIX/Unix (including Linux,
  3573. * BSD and OS X) and Windows. On other platforms, you can either disable that
  3574. * module and provide your own implementations of the callbacks needed by
  3575. * \c mbedtls_ssl_set_timer_cb() for DTLS, or leave it enabled and provide
  3576. * your own implementation of the whole module by setting
  3577. * \c MBEDTLS_TIMING_ALT in the current file.
  3578. *
  3579. * \note The timing module will include time.h on suitable platforms
  3580. * regardless of the setting of MBEDTLS_HAVE_TIME, unless
  3581. * MBEDTLS_TIMING_ALT is used. See timing.c for more information.
  3582. *
  3583. * \note See also our Knowledge Base article about porting to a new
  3584. * environment:
  3585. * https://mbed-tls.readthedocs.io/en/latest/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
  3586. *
  3587. * Module: library/timing.c
  3588. */
  3589. #define MBEDTLS_TIMING_C
  3590. /**
  3591. * \def MBEDTLS_VERSION_C
  3592. *
  3593. * Enable run-time version information.
  3594. *
  3595. * Module: library/version.c
  3596. *
  3597. * This module provides run-time version information.
  3598. */
  3599. #define MBEDTLS_VERSION_C
  3600. /**
  3601. * \def MBEDTLS_X509_USE_C
  3602. *
  3603. * Enable X.509 core for using certificates.
  3604. *
  3605. * Module: library/x509.c
  3606. * Caller: library/x509_crl.c
  3607. * library/x509_crt.c
  3608. * library/x509_csr.c
  3609. *
  3610. * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_PARSE_C,
  3611. * (MBEDTLS_MD_C or MBEDTLS_USE_PSA_CRYPTO)
  3612. *
  3613. * \warning If building with MBEDTLS_USE_PSA_CRYPTO, you must call
  3614. * psa_crypto_init() before doing any X.509 operation.
  3615. *
  3616. * This module is required for the X.509 parsing modules.
  3617. */
  3618. #define MBEDTLS_X509_USE_C
  3619. /**
  3620. * \def MBEDTLS_X509_CRT_PARSE_C
  3621. *
  3622. * Enable X.509 certificate parsing.
  3623. *
  3624. * Module: library/x509_crt.c
  3625. * Caller: library/ssl_tls.c
  3626. * library/ssl*_client.c
  3627. * library/ssl*_server.c
  3628. *
  3629. * Requires: MBEDTLS_X509_USE_C
  3630. *
  3631. * This module is required for X.509 certificate parsing.
  3632. */
  3633. #define MBEDTLS_X509_CRT_PARSE_C
  3634. /**
  3635. * \def MBEDTLS_X509_CRL_PARSE_C
  3636. *
  3637. * Enable X.509 CRL parsing.
  3638. *
  3639. * Module: library/x509_crl.c
  3640. * Caller: library/x509_crt.c
  3641. *
  3642. * Requires: MBEDTLS_X509_USE_C
  3643. *
  3644. * This module is required for X.509 CRL parsing.
  3645. */
  3646. #define MBEDTLS_X509_CRL_PARSE_C
  3647. /**
  3648. * \def MBEDTLS_X509_CSR_PARSE_C
  3649. *
  3650. * Enable X.509 Certificate Signing Request (CSR) parsing.
  3651. *
  3652. * Module: library/x509_csr.c
  3653. * Caller: library/x509_crt_write.c
  3654. *
  3655. * Requires: MBEDTLS_X509_USE_C
  3656. *
  3657. * This module is used for reading X.509 certificate request.
  3658. */
  3659. #define MBEDTLS_X509_CSR_PARSE_C
  3660. /**
  3661. * \def MBEDTLS_X509_CREATE_C
  3662. *
  3663. * Enable X.509 core for creating certificates.
  3664. *
  3665. * Module: library/x509_create.c
  3666. *
  3667. * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_PARSE_C,
  3668. * (MBEDTLS_MD_C or MBEDTLS_USE_PSA_CRYPTO)
  3669. *
  3670. * \warning If building with MBEDTLS_USE_PSA_CRYPTO, you must call
  3671. * psa_crypto_init() before doing any X.509 create operation.
  3672. *
  3673. * This module is the basis for creating X.509 certificates and CSRs.
  3674. */
  3675. #define MBEDTLS_X509_CREATE_C
  3676. /**
  3677. * \def MBEDTLS_X509_CRT_WRITE_C
  3678. *
  3679. * Enable creating X.509 certificates.
  3680. *
  3681. * Module: library/x509_crt_write.c
  3682. *
  3683. * Requires: MBEDTLS_X509_CREATE_C
  3684. *
  3685. * This module is required for X.509 certificate creation.
  3686. */
  3687. #define MBEDTLS_X509_CRT_WRITE_C
  3688. /**
  3689. * \def MBEDTLS_X509_CSR_WRITE_C
  3690. *
  3691. * Enable creating X.509 Certificate Signing Requests (CSR).
  3692. *
  3693. * Module: library/x509_csr_write.c
  3694. *
  3695. * Requires: MBEDTLS_X509_CREATE_C
  3696. *
  3697. * This module is required for X.509 certificate request writing.
  3698. */
  3699. #define MBEDTLS_X509_CSR_WRITE_C
  3700. /** \} name SECTION: Mbed TLS modules */
  3701. /**
  3702. * \name SECTION: General configuration options
  3703. *
  3704. * This section contains Mbed TLS build settings that are not associated
  3705. * with a particular module.
  3706. *
  3707. * \{
  3708. */
  3709. /**
  3710. * \def MBEDTLS_CONFIG_FILE
  3711. *
  3712. * If defined, this is a header which will be included instead of
  3713. * `"mbedtls/mbedtls_config.h"`.
  3714. * This header file specifies the compile-time configuration of Mbed TLS.
  3715. * Unlike other configuration options, this one must be defined on the
  3716. * compiler command line: a definition in `mbedtls_config.h` would have
  3717. * no effect.
  3718. *
  3719. * This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
  3720. * non-standard feature of the C language, so this feature is only available
  3721. * with compilers that perform macro expansion on an <tt>\#include</tt> line.
  3722. *
  3723. * The value of this symbol is typically a path in double quotes, either
  3724. * absolute or relative to a directory on the include search path.
  3725. */
  3726. //#define MBEDTLS_CONFIG_FILE "mbedtls/mbedtls_config.h"
  3727. /**
  3728. * \def MBEDTLS_USER_CONFIG_FILE
  3729. *
  3730. * If defined, this is a header which will be included after
  3731. * `"mbedtls/mbedtls_config.h"` or #MBEDTLS_CONFIG_FILE.
  3732. * This allows you to modify the default configuration, including the ability
  3733. * to undefine options that are enabled by default.
  3734. *
  3735. * This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
  3736. * non-standard feature of the C language, so this feature is only available
  3737. * with compilers that perform macro expansion on an <tt>\#include</tt> line.
  3738. *
  3739. * The value of this symbol is typically a path in double quotes, either
  3740. * absolute or relative to a directory on the include search path.
  3741. */
  3742. //#define MBEDTLS_USER_CONFIG_FILE "/dev/null"
  3743. /**
  3744. * \def MBEDTLS_PSA_CRYPTO_CONFIG_FILE
  3745. *
  3746. * If defined, this is a header which will be included instead of
  3747. * `"psa/crypto_config.h"`.
  3748. * This header file specifies which cryptographic mechanisms are available
  3749. * through the PSA API when #MBEDTLS_PSA_CRYPTO_CONFIG is enabled, and
  3750. * is not used when #MBEDTLS_PSA_CRYPTO_CONFIG is disabled.
  3751. *
  3752. * This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
  3753. * non-standard feature of the C language, so this feature is only available
  3754. * with compilers that perform macro expansion on an <tt>\#include</tt> line.
  3755. *
  3756. * The value of this symbol is typically a path in double quotes, either
  3757. * absolute or relative to a directory on the include search path.
  3758. */
  3759. //#define MBEDTLS_PSA_CRYPTO_CONFIG_FILE "psa/crypto_config.h"
  3760. /**
  3761. * \def MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE
  3762. *
  3763. * If defined, this is a header which will be included after
  3764. * `"psa/crypto_config.h"` or #MBEDTLS_PSA_CRYPTO_CONFIG_FILE.
  3765. * This allows you to modify the default configuration, including the ability
  3766. * to undefine options that are enabled by default.
  3767. *
  3768. * This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
  3769. * non-standard feature of the C language, so this feature is only available
  3770. * with compilers that perform macro expansion on an <tt>\#include</tt> line.
  3771. *
  3772. * The value of this symbol is typically a path in double quotes, either
  3773. * absolute or relative to a directory on the include search path.
  3774. */
  3775. //#define MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE "/dev/null"
  3776. /**
  3777. * \def MBEDTLS_PSA_CRYPTO_PLATFORM_FILE
  3778. *
  3779. * If defined, this is a header which will be included instead of
  3780. * `"psa/crypto_platform.h"`. This file should declare the same identifiers
  3781. * as the one in Mbed TLS, but with definitions adapted to the platform on
  3782. * which the library code will run.
  3783. *
  3784. * \note The required content of this header can vary from one version of
  3785. * Mbed TLS to the next. Integrators who provide an alternative file
  3786. * should review the changes in the original file whenever they
  3787. * upgrade Mbed TLS.
  3788. *
  3789. * This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
  3790. * non-standard feature of the C language, so this feature is only available
  3791. * with compilers that perform macro expansion on an <tt>\#include</tt> line.
  3792. *
  3793. * The value of this symbol is typically a path in double quotes, either
  3794. * absolute or relative to a directory on the include search path.
  3795. */
  3796. //#define MBEDTLS_PSA_CRYPTO_PLATFORM_FILE "psa/crypto_platform_alt.h"
  3797. /**
  3798. * \def MBEDTLS_PSA_CRYPTO_STRUCT_FILE
  3799. *
  3800. * If defined, this is a header which will be included instead of
  3801. * `"psa/crypto_struct.h"`. This file should declare the same identifiers
  3802. * as the one in Mbed TLS, but with definitions adapted to the environment
  3803. * in which the library code will run. The typical use for this feature
  3804. * is to provide alternative type definitions on the client side in
  3805. * client-server integrations of PSA crypto, where operation structures
  3806. * contain handles instead of cryptographic data.
  3807. *
  3808. * \note The required content of this header can vary from one version of
  3809. * Mbed TLS to the next. Integrators who provide an alternative file
  3810. * should review the changes in the original file whenever they
  3811. * upgrade Mbed TLS.
  3812. *
  3813. * This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
  3814. * non-standard feature of the C language, so this feature is only available
  3815. * with compilers that perform macro expansion on an <tt>\#include</tt> line.
  3816. *
  3817. * The value of this symbol is typically a path in double quotes, either
  3818. * absolute or relative to a directory on the include search path.
  3819. */
  3820. //#define MBEDTLS_PSA_CRYPTO_STRUCT_FILE "psa/crypto_struct_alt.h"
  3821. /** \} name SECTION: General configuration options */
  3822. /**
  3823. * \name SECTION: Module configuration options
  3824. *
  3825. * This section allows for the setting of module specific sizes and
  3826. * configuration options. The default values are already present in the
  3827. * relevant header files and should suffice for the regular use cases.
  3828. *
  3829. * Our advice is to enable options and change their values here
  3830. * only if you have a good reason and know the consequences.
  3831. * \{
  3832. */
  3833. /* The Doxygen documentation here is used when a user comments out a
  3834. * setting and runs doxygen themselves. On the other hand, when we typeset
  3835. * the full documentation including disabled settings, the documentation
  3836. * in specific modules' header files is used if present. When editing this
  3837. * file, make sure that each option is documented in exactly one place,
  3838. * plus optionally a same-line Doxygen comment here if there is a Doxygen
  3839. * comment in the specific module. */
  3840. /* MPI / BIGNUM options */
  3841. //#define MBEDTLS_MPI_WINDOW_SIZE 2 /**< Maximum window size used. */
  3842. //#define MBEDTLS_MPI_MAX_SIZE 1024 /**< Maximum number of bytes for usable MPIs. */
  3843. /* CTR_DRBG options */
  3844. //#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */
  3845. //#define MBEDTLS_CTR_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */
  3846. //#define MBEDTLS_CTR_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */
  3847. //#define MBEDTLS_CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */
  3848. //#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */
  3849. /* HMAC_DRBG options */
  3850. //#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */
  3851. //#define MBEDTLS_HMAC_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */
  3852. //#define MBEDTLS_HMAC_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */
  3853. //#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */
  3854. /* ECP options */
  3855. //#define MBEDTLS_ECP_WINDOW_SIZE 4 /**< Maximum window size used */
  3856. //#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */
  3857. /* Entropy options */
  3858. //#define MBEDTLS_ENTROPY_MAX_SOURCES 20 /**< Maximum number of sources supported */
  3859. //#define MBEDTLS_ENTROPY_MAX_GATHER 128 /**< Maximum amount requested from entropy sources */
  3860. //#define MBEDTLS_ENTROPY_MIN_HARDWARE 32 /**< Default minimum number of bytes required for the hardware entropy source mbedtls_hardware_poll() before entropy is released */
  3861. /* Memory buffer allocator options */
  3862. //#define MBEDTLS_MEMORY_ALIGN_MULTIPLE 4 /**< Align on multiples of this value */
  3863. /* Platform options */
  3864. //#define MBEDTLS_PLATFORM_STD_MEM_HDR <stdlib.h> /**< Header to include if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS is defined. Don't define if no header is needed. */
  3865. /** \def MBEDTLS_PLATFORM_STD_CALLOC
  3866. *
  3867. * Default allocator to use, can be undefined.
  3868. * It must initialize the allocated buffer memory to zeroes.
  3869. * The size of the buffer is the product of the two parameters.
  3870. * The calloc function returns either a null pointer or a pointer to the allocated space.
  3871. * If the product is 0, the function may either return NULL or a valid pointer to an array of size 0 which is a valid input to the deallocation function.
  3872. * An uninitialized #MBEDTLS_PLATFORM_STD_CALLOC always fails, returning a null pointer.
  3873. * See the description of #MBEDTLS_PLATFORM_MEMORY for more details.
  3874. * The corresponding deallocation function is #MBEDTLS_PLATFORM_STD_FREE.
  3875. */
  3876. //#define MBEDTLS_PLATFORM_STD_CALLOC calloc
  3877. /** \def MBEDTLS_PLATFORM_STD_FREE
  3878. *
  3879. * Default free to use, can be undefined.
  3880. * NULL is a valid parameter, and the function must do nothing.
  3881. * A non-null parameter will always be a pointer previously returned by #MBEDTLS_PLATFORM_STD_CALLOC and not yet freed.
  3882. * An uninitialized #MBEDTLS_PLATFORM_STD_FREE does not do anything.
  3883. * See the description of #MBEDTLS_PLATFORM_MEMORY for more details (same principles as for MBEDTLS_PLATFORM_STD_CALLOC apply).
  3884. */
  3885. //#define MBEDTLS_PLATFORM_STD_FREE free
  3886. //#define MBEDTLS_PLATFORM_STD_SETBUF setbuf /**< Default setbuf to use, can be undefined */
  3887. //#define MBEDTLS_PLATFORM_STD_EXIT exit /**< Default exit to use, can be undefined */
  3888. //#define MBEDTLS_PLATFORM_STD_TIME time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
  3889. //#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */
  3890. //#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */
  3891. /* Note: your snprintf must correctly zero-terminate the buffer! */
  3892. //#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
  3893. //#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */
  3894. //#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */
  3895. //#define MBEDTLS_PLATFORM_STD_NV_SEED_READ mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
  3896. //#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
  3897. //#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE "seedfile" /**< Seed file to read/write with default implementation */
  3898. /* To use the following function macros, MBEDTLS_PLATFORM_C must be enabled. */
  3899. /* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */
  3900. //#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined. See MBEDTLS_PLATFORM_STD_CALLOC for requirements. */
  3901. //#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined. See MBEDTLS_PLATFORM_STD_FREE for requirements. */
  3902. //#define MBEDTLS_PLATFORM_EXIT_MACRO exit /**< Default exit macro to use, can be undefined */
  3903. //#define MBEDTLS_PLATFORM_SETBUF_MACRO setbuf /**< Default setbuf macro to use, can be undefined */
  3904. //#define MBEDTLS_PLATFORM_TIME_MACRO time /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
  3905. //#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO time_t /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
  3906. //#define MBEDTLS_PLATFORM_FPRINTF_MACRO fprintf /**< Default fprintf macro to use, can be undefined */
  3907. //#define MBEDTLS_PLATFORM_PRINTF_MACRO printf /**< Default printf macro to use, can be undefined */
  3908. /* Note: your snprintf must correctly zero-terminate the buffer! */
  3909. //#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf /**< Default snprintf macro to use, can be undefined */
  3910. //#define MBEDTLS_PLATFORM_VSNPRINTF_MACRO vsnprintf /**< Default vsnprintf macro to use, can be undefined */
  3911. //#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
  3912. //#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
  3913. //#define MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO int64_t //#define MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO int64_t /**< Default milliseconds time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled. It must be signed, and at least 64 bits. If it is changed from the default, MBEDTLS_PRINTF_MS_TIME must be updated to match.*/
  3914. //#define MBEDTLS_PRINTF_MS_TIME PRId64 /**< Default fmt for printf. That's avoid compiler warning if mbedtls_ms_time_t is redefined */
  3915. /** \def MBEDTLS_CHECK_RETURN
  3916. *
  3917. * This macro is used at the beginning of the declaration of a function
  3918. * to indicate that its return value should be checked. It should
  3919. * instruct the compiler to emit a warning or an error if the function
  3920. * is called without checking its return value.
  3921. *
  3922. * There is a default implementation for popular compilers in platform_util.h.
  3923. * You can override the default implementation by defining your own here.
  3924. *
  3925. * If the implementation here is empty, this will effectively disable the
  3926. * checking of functions' return values.
  3927. */
  3928. //#define MBEDTLS_CHECK_RETURN __attribute__((__warn_unused_result__))
  3929. /** \def MBEDTLS_IGNORE_RETURN
  3930. *
  3931. * This macro requires one argument, which should be a C function call.
  3932. * If that function call would cause a #MBEDTLS_CHECK_RETURN warning, this
  3933. * warning is suppressed.
  3934. */
  3935. //#define MBEDTLS_IGNORE_RETURN( result ) ((void) !(result))
  3936. /* PSA options */
  3937. /**
  3938. * Use HMAC_DRBG with the specified hash algorithm for HMAC_DRBG for the
  3939. * PSA crypto subsystem.
  3940. *
  3941. * If this option is unset, the library chooses a hash (currently between
  3942. * #MBEDTLS_MD_SHA512 and #MBEDTLS_MD_SHA256) based on availability and
  3943. * unspecified heuristics.
  3944. *
  3945. * \note The PSA crypto subsystem uses the first available mechanism amongst
  3946. * the following:
  3947. * - #MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG if enabled;
  3948. * - Entropy from #MBEDTLS_ENTROPY_C plus CTR_DRBG with AES
  3949. * if #MBEDTLS_CTR_DRBG_C is enabled;
  3950. * - Entropy from #MBEDTLS_ENTROPY_C plus HMAC_DRBG.
  3951. *
  3952. * A future version may reevaluate the prioritization of DRBG mechanisms.
  3953. */
  3954. //#define MBEDTLS_PSA_HMAC_DRBG_MD_TYPE MBEDTLS_MD_SHA256
  3955. /** \def MBEDTLS_PSA_KEY_SLOT_COUNT
  3956. *
  3957. * When #MBEDTLS_PSA_KEY_STORE_DYNAMIC is disabled,
  3958. * the maximum amount of PSA keys simultaneously in memory. This counts all
  3959. * volatile keys, plus loaded persistent keys.
  3960. *
  3961. * When #MBEDTLS_PSA_KEY_STORE_DYNAMIC is enabled,
  3962. * the maximum number of loaded persistent keys.
  3963. *
  3964. * Currently, persistent keys do not need to be loaded all the time while
  3965. * a multipart operation is in progress, only while the operation is being
  3966. * set up. This may change in future versions of the library.
  3967. *
  3968. * Currently, the library traverses of the whole table on each access to a
  3969. * persistent key. Therefore large values may cause poor performance.
  3970. *
  3971. * This option has no effect when #MBEDTLS_PSA_CRYPTO_C is disabled.
  3972. */
  3973. //#define MBEDTLS_PSA_KEY_SLOT_COUNT 32
  3974. /**
  3975. * \def MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
  3976. *
  3977. * Define the size (in bytes) of each static key buffer when
  3978. * #MBEDTLS_PSA_STATIC_KEY_SLOTS is set. If not
  3979. * explicitly defined then it's automatically guessed from available PSA keys
  3980. * enabled in the build through PSA_WANT_xxx symbols.
  3981. * If required by the application this parameter can be set to higher values
  3982. * in order to store larger objects (ex: raw keys), but please note that this
  3983. * will increase RAM usage.
  3984. */
  3985. //#define MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE 256
  3986. /* RSA OPTIONS */
  3987. //#define MBEDTLS_RSA_GEN_KEY_MIN_BITS 1024 /**< Minimum RSA key size that can be generated in bits (Minimum possible value is 128 bits) */
  3988. /* SSL Cache options */
  3989. //#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */
  3990. //#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /**< Maximum entries in cache */
  3991. /* SSL options */
  3992. /** \def MBEDTLS_SSL_IN_CONTENT_LEN
  3993. *
  3994. * Maximum length (in bytes) of incoming plaintext fragments.
  3995. *
  3996. * This determines the size of the incoming TLS I/O buffer in such a way
  3997. * that it is capable of holding the specified amount of plaintext data,
  3998. * regardless of the protection mechanism used.
  3999. *
  4000. * \note When using a value less than the default of 16KB on the client, it is
  4001. * recommended to use the Maximum Fragment Length (MFL) extension to
  4002. * inform the server about this limitation. On the server, there
  4003. * is no supported, standardized way of informing the client about
  4004. * restriction on the maximum size of incoming messages, and unless
  4005. * the limitation has been communicated by other means, it is recommended
  4006. * to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN
  4007. * while keeping the default value of 16KB for the incoming buffer.
  4008. *
  4009. * Uncomment to set the maximum plaintext size of the incoming I/O buffer.
  4010. */
  4011. //#define MBEDTLS_SSL_IN_CONTENT_LEN 16384
  4012. /** \def MBEDTLS_SSL_CID_IN_LEN_MAX
  4013. *
  4014. * The maximum length of CIDs used for incoming DTLS messages.
  4015. *
  4016. */
  4017. //#define MBEDTLS_SSL_CID_IN_LEN_MAX 32
  4018. /** \def MBEDTLS_SSL_CID_OUT_LEN_MAX
  4019. *
  4020. * The maximum length of CIDs used for outgoing DTLS messages.
  4021. *
  4022. */
  4023. //#define MBEDTLS_SSL_CID_OUT_LEN_MAX 32
  4024. /** \def MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY
  4025. *
  4026. * This option controls the use of record plaintext padding
  4027. * in TLS 1.3 and when using the Connection ID extension in DTLS 1.2.
  4028. *
  4029. * The padding will always be chosen so that the length of the
  4030. * padded plaintext is a multiple of the value of this option.
  4031. *
  4032. * Note: A value of \c 1 means that no padding will be used
  4033. * for outgoing records.
  4034. *
  4035. * Note: On systems lacking division instructions,
  4036. * a power of two should be preferred.
  4037. */
  4038. //#define MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY 16
  4039. /** \def MBEDTLS_SSL_OUT_CONTENT_LEN
  4040. *
  4041. * Maximum length (in bytes) of outgoing plaintext fragments.
  4042. *
  4043. * This determines the size of the outgoing TLS I/O buffer in such a way
  4044. * that it is capable of holding the specified amount of plaintext data,
  4045. * regardless of the protection mechanism used.
  4046. *
  4047. * It is possible to save RAM by setting a smaller outward buffer, while keeping
  4048. * the default inward 16384 byte buffer to conform to the TLS specification.
  4049. *
  4050. * The minimum required outward buffer size is determined by the handshake
  4051. * protocol's usage. Handshaking will fail if the outward buffer is too small.
  4052. * The specific size requirement depends on the configured ciphers and any
  4053. * certificate data which is sent during the handshake.
  4054. *
  4055. * Uncomment to set the maximum plaintext size of the outgoing I/O buffer.
  4056. */
  4057. //#define MBEDTLS_SSL_OUT_CONTENT_LEN 16384
  4058. /** \def MBEDTLS_SSL_DTLS_MAX_BUFFERING
  4059. *
  4060. * Maximum number of heap-allocated bytes for the purpose of
  4061. * DTLS handshake message reassembly and future message buffering.
  4062. *
  4063. * This should be at least 9/8 * MBEDTLS_SSL_IN_CONTENT_LEN
  4064. * to account for a reassembled handshake message of maximum size,
  4065. * together with its reassembly bitmap.
  4066. *
  4067. * A value of 2 * MBEDTLS_SSL_IN_CONTENT_LEN (32768 by default)
  4068. * should be sufficient for all practical situations as it allows
  4069. * to reassembly a large handshake message (such as a certificate)
  4070. * while buffering multiple smaller handshake messages.
  4071. *
  4072. */
  4073. //#define MBEDTLS_SSL_DTLS_MAX_BUFFERING 32768
  4074. //#define MBEDTLS_PSK_MAX_LEN 32 /**< Max size of TLS pre-shared keys, in bytes (default 256 or 384 bits) */
  4075. //#define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */
  4076. /**
  4077. * Complete list of ciphersuites to use, in order of preference.
  4078. *
  4079. * \warning No dependency checking is done on that field! This option can only
  4080. * be used to restrict the set of available ciphersuites. It is your
  4081. * responsibility to make sure the needed modules are active.
  4082. *
  4083. * Use this to save a few hundred bytes of ROM (default ordering of all
  4084. * available ciphersuites) and a few to a few hundred bytes of RAM.
  4085. *
  4086. * The value below is only an example, not the default.
  4087. */
  4088. //#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
  4089. /**
  4090. * \def MBEDTLS_SSL_MAX_EARLY_DATA_SIZE
  4091. *
  4092. * The default maximum amount of 0-RTT data. See the documentation of
  4093. * \c mbedtls_ssl_conf_max_early_data_size() for more information.
  4094. *
  4095. * It must be positive and smaller than UINT32_MAX.
  4096. *
  4097. * If MBEDTLS_SSL_EARLY_DATA is not defined, this default value does not
  4098. * have any impact on the build.
  4099. */
  4100. //#define MBEDTLS_SSL_MAX_EARLY_DATA_SIZE 1024
  4101. /**
  4102. * \def MBEDTLS_SSL_TLS1_3_TICKET_AGE_TOLERANCE
  4103. *
  4104. * Maximum allowed ticket age difference in milliseconds tolerated between
  4105. * server and client. Default value is 6000. This is not used in TLS 1.2.
  4106. *
  4107. * - The client ticket age is the time difference between the time when the
  4108. * client proposes to the server to use the ticket and the time the client
  4109. * received the ticket from the server.
  4110. * - The server ticket age is the time difference between the time when the
  4111. * server receives a proposition from the client to use the ticket and the
  4112. * time when the ticket was created by the server.
  4113. *
  4114. * The ages might be different due to the client and server clocks not running
  4115. * at the same pace. The typical accuracy of an RTC crystal is ±100 to ±20 parts
  4116. * per million (360 to 72 milliseconds per hour). Default tolerance window is
  4117. * 6s, thus in the worst case clients and servers must sync up their system time
  4118. * every 6000/360/2~=8 hours.
  4119. *
  4120. * See section 8.3 of the TLS 1.3 specification(RFC 8446) for more information.
  4121. */
  4122. //#define MBEDTLS_SSL_TLS1_3_TICKET_AGE_TOLERANCE 6000
  4123. /**
  4124. * \def MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH
  4125. *
  4126. * Size in bytes of a ticket nonce. This is not used in TLS 1.2.
  4127. *
  4128. * This must be less than 256.
  4129. */
  4130. //#define MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH 32
  4131. /**
  4132. * \def MBEDTLS_SSL_TLS1_3_DEFAULT_NEW_SESSION_TICKETS
  4133. *
  4134. * Default number of NewSessionTicket messages to be sent by a TLS 1.3 server
  4135. * after handshake completion. This is not used in TLS 1.2 and relevant only if
  4136. * the MBEDTLS_SSL_SESSION_TICKETS option is enabled.
  4137. *
  4138. */
  4139. //#define MBEDTLS_SSL_TLS1_3_DEFAULT_NEW_SESSION_TICKETS 1
  4140. /* X509 options */
  4141. //#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8 /**< Maximum number of intermediate CAs in a verification chain. */
  4142. //#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512 /**< Maximum length of a path/filename string in bytes including the null terminator character ('\0'). */
  4143. /** \} name SECTION: Module configuration options */