2
0

configure.ac 132 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518
  1. # configure.ac
  2. #
  3. # Copyright (C) 2006-2017 wolfSSL Inc.
  4. #
  5. # This file is part of wolfSSL. (formerly known as CyaSSL)
  6. #
  7. #
  8. AC_COPYRIGHT([Copyright (C) 2006-2018 wolfSSL Inc.])
  9. AC_INIT([wolfssl],[3.14.0],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[http://www.wolfssl.com])
  10. AC_CONFIG_AUX_DIR([build-aux])
  11. # The following sets CFLAGS and CXXFLAGS to empty if unset on command line.
  12. # We do not want the default "-g -O2" that AC_PROG_CC AC_PROG_CXX sets
  13. # automatically.
  14. : ${CFLAGS=""}
  15. : ${CXXFLAGS=""}
  16. AC_CANONICAL_HOST
  17. AC_CANONICAL_BUILD
  18. AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests])
  19. AC_PREREQ([2.63])
  20. AC_ARG_PROGRAM
  21. AC_DEFUN([PROTECT_AC_USE_SYSTEM_EXTENSIONS],
  22. [AX_SAVE_FLAGS
  23. AC_LANG_PUSH([C])
  24. AC_USE_SYSTEM_EXTENSIONS
  25. AC_LANG_POP([C])
  26. AX_RESTORE_FLAGS
  27. ])
  28. #PROTECT_AC_USE_SYSTEM_EXTENSIONS
  29. AC_CONFIG_MACRO_DIR([m4])
  30. AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
  31. #shared library versioning
  32. WOLFSSL_LIBRARY_VERSION=16:0:0
  33. # | | |
  34. # +------+ | +---+
  35. # | | |
  36. # current:revision:age
  37. # | | |
  38. # | | +- increment if interfaces have been added
  39. # | | set to zero if interfaces have been removed
  40. # | | or changed
  41. # | +- increment if source code has changed
  42. # | set to zero if current is incremented
  43. # +- increment if interfaces have been added, removed or changed
  44. AC_SUBST([WOLFSSL_LIBRARY_VERSION])
  45. # capture user C_EXTRA_FLAGS from ./configure line, CFLAGS may hold -g -O2 even
  46. # if user doesn't override, no way to tell
  47. USER_C_EXTRA_FLAGS="$C_EXTRA_FLAGS"
  48. USER_CFLAGS="$CFLAGS"
  49. LT_PREREQ([2.2])
  50. LT_INIT([disable-static],[win32-dll])
  51. LT_LANG([C++])
  52. LT_LANG([C])
  53. gl_VISIBILITY
  54. AS_IF([ test -n "$CFLAG_VISIBILITY" ], [
  55. AM_CPPFLAGS="$AM_CPPFLAGS $CFLAG_VISIBILITY"
  56. CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"
  57. ])
  58. m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
  59. # Moved these size of and type checks before the library checks.
  60. # The library checks add the library to subsequent test compiles
  61. # and in some rare cases, the networking check causes these sizeof
  62. # checks to fail.
  63. AC_CHECK_SIZEOF(long long, 8)
  64. AC_CHECK_SIZEOF(long, 4)
  65. AC_CHECK_TYPES(__uint128_t)
  66. AC_CHECK_FUNCS([gethostbyname])
  67. AC_CHECK_FUNCS([getaddrinfo])
  68. AC_CHECK_FUNCS([gettimeofday])
  69. AC_CHECK_FUNCS([gmtime_r])
  70. AC_CHECK_FUNCS([inet_ntoa])
  71. AC_CHECK_FUNCS([memset])
  72. AC_CHECK_FUNCS([socket])
  73. AC_CHECK_HEADERS([arpa/inet.h])
  74. AC_CHECK_HEADERS([fcntl.h])
  75. AC_CHECK_HEADERS([limits.h])
  76. AC_CHECK_HEADERS([netdb.h])
  77. AC_CHECK_HEADERS([netinet/in.h])
  78. AC_CHECK_HEADERS([stddef.h])
  79. AC_CHECK_HEADERS([sys/ioctl.h])
  80. AC_CHECK_HEADERS([sys/socket.h])
  81. AC_CHECK_HEADERS([sys/time.h])
  82. AC_CHECK_HEADERS([errno.h])
  83. AC_CHECK_LIB(network,socket)
  84. AC_C_BIGENDIAN
  85. # mktime check takes forever on some systems, if time supported it would be
  86. # highly unusual for mktime to be missing
  87. #AC_FUNC_MKTIME
  88. AC_PROG_CC
  89. AC_PROG_CC_C_O
  90. AC_PROG_CXX
  91. AC_PROG_INSTALL
  92. AC_TYPE_SIZE_T
  93. AC_TYPE_UINT8_T
  94. AM_PROG_AS
  95. AM_PROG_CC_C_O
  96. LT_LIB_M
  97. OPTIMIZE_CFLAGS="-Os -fomit-frame-pointer"
  98. OPTIMIZE_FAST_CFLAGS="-O2 -fomit-frame-pointer"
  99. OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET"
  100. DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_WOLFSSL"
  101. LIB_ADD=
  102. LIB_STATIC_ADD=
  103. thread_ls_on=no
  104. # Thread local storage
  105. AX_TLS([
  106. [AM_CFLAGS="$AM_CFLAGS -DHAVE_THREAD_LS"]
  107. [thread_ls_on=yes]
  108. ] , [:])
  109. # DEBUG
  110. AX_DEBUG
  111. AS_IF([test "$ax_enable_debug" = "yes"],
  112. [AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"],
  113. [AM_CFLAGS="$AM_CFLAGS -DNDEBUG"])
  114. # Distro build feature subset (Debian, Ubuntu, etc.)
  115. AC_ARG_ENABLE([distro],
  116. [AS_HELP_STRING([--enable-distro],[Enable wolfSSL distro build (default: disabled)])],
  117. [ ENABLED_DISTRO=$enableval ],
  118. [ ENABLED_DISTRO=no ]
  119. )
  120. if test "$ENABLED_DISTRO" = "yes"
  121. then
  122. enable_shared=yes
  123. enable_static=yes
  124. enable_all=yes
  125. fi
  126. AM_CONDITIONAL([BUILD_DISTRO], [test "x$ENABLED_DISTRO" = "xyes"])
  127. # ALL FEATURES
  128. AC_ARG_ENABLE([all],
  129. [AS_HELP_STRING([--enable-all],[Enable all wolfSSL features, except SSLv3 (default: disabled)])],
  130. [ ENABLED_ALL=$enableval ],
  131. [ ENABLED_ALL=no ]
  132. )
  133. if test "$ENABLED_ALL" = "yes"
  134. then
  135. enable_dtls=yes
  136. enable_tls13=yes
  137. enable_openssh=yes
  138. enable_opensslextra=yes
  139. enable_opensslall=yes
  140. enable_savesession=yes
  141. enable_savecert=yes
  142. enable_atomicuser=yes
  143. enable_pkcallbacks=yes
  144. enable_aesgcm=yes
  145. enable_aesccm=yes
  146. enable_aesctr=yes
  147. enable_aescfb=yes
  148. enable_camellia=yes
  149. enable_ripemd=yes
  150. enable_sha512=yes
  151. enable_sha224=yes
  152. enable_sha3=yes
  153. enable_sessioncerts=yes
  154. enable_keygen=yes
  155. enable_certgen=yes
  156. enable_certreq=yes
  157. enable_certext=yes
  158. enable_sep=yes
  159. enable_hkdf=yes
  160. enable_dsa=yes
  161. enable_ecccustcurves=yes
  162. enable_compkey=yes
  163. enable_curve25519=yes
  164. enable_ed25519=yes
  165. enable_fpecc=yes
  166. enable_eccencrypt=yes
  167. enable_psk=yes
  168. enable_idea=yes
  169. enable_cmac=yes
  170. enable_xts=yes
  171. enable_webserver=yes
  172. enable_hc128=yes
  173. enable_rabbit=yes
  174. enable_ocsp=yes
  175. enable_ocspstapling=yes
  176. enable_ocspstapling2=yes
  177. enable_crl=yes
  178. enable_crl_monitor=yes
  179. enable_sni=yes
  180. enable_maxfragment=yes
  181. enable_alpn=yes
  182. enable_truncatedhmac=yes
  183. enable_supportedcurves=yes
  184. enable_session_ticket=yes
  185. enable_tlsx=yes
  186. enable_pkcs7=yes
  187. enable_ssh=yes
  188. enable_scep=yes
  189. enable_srp=yes
  190. enable_certservice=yes
  191. enable_jni=yes
  192. enable_lighty=yes
  193. enable_haproxy=yes
  194. enable_stunnel=yes
  195. enable_nginx=yes
  196. enable_pwdbased=yes
  197. enable_aeskeywrap=yes
  198. enable_x963kdf=yes
  199. enable_scrypt=yes
  200. enable_indef=yes
  201. enable_enckeys=yes
  202. # Enable AES Decrypt, AES ECB, Alt Names, DER Load, Keep Certs, CRL IO with Timeout
  203. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_DECRYPT -DHAVE_AES_ECB -DWOLFSSL_ALT_NAMES -DWOLFSSL_DER_LOAD -DKEEP_OUR_CERT -DKEEP_PEER_CERT -DHAVE_CRL_IO -DHAVE_IO_TIMEOUT"
  204. # Enable DH const table speedups (eliminates `-lm` math lib dependency)
  205. AM_CFLAGS="$AM_CFLAGS -DHAVE_FFDHE_2048 -DHAVE_FFDHE_3072 -DHAVE_FFDHE_4096 -DHAVE_FFDHE_6144 -DHAVE_FFDHE_8192"
  206. fi
  207. AM_CONDITIONAL([BUILD_ALL], [test "x$ENABLED_ALL" = "xyes"])
  208. # Support for forcing 32-bit mode
  209. AC_ARG_ENABLE([32bit],
  210. [AS_HELP_STRING([--enable-32bit],[Enables 32-bit support (default: disabled)])],
  211. [ ENABLED_32BIT=$enableval ],
  212. [ ENABLED_32BIT=no ]
  213. )
  214. if test "$ENABLED_32BIT" = "yes"
  215. then
  216. AM_CFLAGS="$AM_CFLAGS -DNO_64BIT -DNO_CURVED25519_128BIT -m32"
  217. AM_LDFLAGS="$AM_LDFLAGS -m32"
  218. fi
  219. # Support for disabling all ASM
  220. AC_ARG_ENABLE([asm],
  221. [AS_HELP_STRING([--enable-asm],[Enables option for assembly (default: enabled)])],
  222. [ ENABLED_ASM=$enableval ],
  223. [ ENABLED_ASM=yes ]
  224. )
  225. if test "$ENABLED_ASM" = "no"
  226. then
  227. AM_CFLAGS="$AM_CFLAGS -DTFM_NO_ASM -DWOLFSSL_NO_ASM"
  228. fi
  229. # SINGLE THREADED
  230. AC_ARG_ENABLE([singlethreaded],
  231. [AS_HELP_STRING([--enable-singlethreaded],[Enable wolfSSL single threaded (default: disabled)])],
  232. [ ENABLED_SINGLETHREADED=$enableval ],
  233. [ ENABLED_SINGLETHREADED=no ])
  234. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xno" ],[
  235. AX_PTHREAD([
  236. AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
  237. # If AX_PTHREAD is adding -Qunused-arguments, need to prepend with -Xcompiler libtool will use it. Newer
  238. # versions of clang don't need the -Q flag when using pthreads.
  239. AS_CASE([$PTHREAD_CFLAGS],[-Qunused-arguments*],[PTHREAD_CFLAGS="-Xcompiler $PTHREAD_CFLAGS"])
  240. AM_CFLAGS="-D_POSIX_THREADS $AM_CFLAGS $PTHREAD_CFLAGS"
  241. LIBS="$LIBS $PTHREAD_LIBS"
  242. ],[
  243. ENABLED_SINGLETHREADED=yes
  244. ])
  245. ])
  246. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xyes" ],[ AM_CFLAGS="-DSINGLE_THREADED $AM_CFLAGS" ])
  247. # DTLS
  248. AC_ARG_ENABLE([dtls],
  249. [AS_HELP_STRING([--enable-dtls],[Enable wolfSSL DTLS (default: disabled)])],
  250. [ ENABLED_DTLS=$enableval ],
  251. [ ENABLED_DTLS=no ]
  252. )
  253. if test "$ENABLED_DTLS" = "yes"
  254. then
  255. AM_CFLAGS="-DWOLFSSL_DTLS $AM_CFLAGS"
  256. fi
  257. # TLS v1.3 Draft 18
  258. AC_ARG_ENABLE([tls13-draft18],
  259. [AS_HELP_STRING([--enable-tls13-draft18],[Enable wolfSSL TLS v1.3 Draft 18 (default: disabled)])],
  260. [ ENABLED_TLS13_DRAFT18=$enableval ],
  261. [ ENABLED_TLS13_DRAFT18=no ]
  262. )
  263. if test "$ENABLED_TLS13_DRAFT18" = "yes"
  264. then
  265. AM_CFLAGS="-DWOLFSSL_TLS13_DRAFT_18 $AM_CFLAGS"
  266. fi
  267. # TLS v1.3 Draft 22
  268. AC_ARG_ENABLE([tls13-draft22],
  269. [AS_HELP_STRING([--enable-tls13-draft22],[Enable wolfSSL TLS v1.3 Draft 22 (default: disabled)])],
  270. [ ENABLED_TLS13_DRAFT22=$enableval ],
  271. [ ENABLED_TLS13_DRAFT22=no ]
  272. )
  273. if test "$ENABLED_TLS13_DRAFT22" = "yes"
  274. then
  275. AM_CFLAGS="-DWOLFSSL_TLS13_DRAFT_22 $AM_CFLAGS"
  276. fi
  277. # TLS v1.3 Draft 23
  278. AC_ARG_ENABLE([tls13-draft23],
  279. [AS_HELP_STRING([--enable-tls13-draft23],[Enable wolfSSL TLS v1.3 Draft 23 (default: disabled)])],
  280. [ ENABLED_TLS13_DRAFT23=$enableval ],
  281. [ ENABLED_TLS13_DRAFT23=no ]
  282. )
  283. if test "$ENABLED_TLS13_DRAFT23" = "yes"
  284. then
  285. AM_CFLAGS="-DWOLFSSL_TLS13_DRAFT_23 $AM_CFLAGS"
  286. fi
  287. # TLS v1.3 Draft 26
  288. AC_ARG_ENABLE([tls13-draft26],
  289. [AS_HELP_STRING([--enable-tls13-draft26],[Enable wolfSSL TLS v1.3 Draft 26 (default: disabled)])],
  290. [ ENABLED_TLS13_DRAFT26=$enableval ],
  291. [ ENABLED_TLS13_DRAFT26=no ]
  292. )
  293. if test "$ENABLED_TLS13_DRAFT26" = "yes"
  294. then
  295. AM_CFLAGS="-DWOLFSSL_TLS13_DRAFT_26 $AM_CFLAGS"
  296. fi
  297. # TLS v1.3
  298. AC_ARG_ENABLE([tls13],
  299. [AS_HELP_STRING([--enable-tls13],[Enable wolfSSL TLS v1.3 (default: disabled)])],
  300. [ ENABLED_TLS13=$enableval ],
  301. [ ENABLED_TLS13=no ]
  302. )
  303. if test "$ENABLED_TLS13_DRAFT18" = "yes" || test "$ENABLED_TLS13_DRAFT22" = "yes" || test "$ENABLED_TLS13_DRAFT23" = "yes" || test "$ENABLED_TLS13_DRAFT26" = "yes"
  304. then
  305. ENABLED_TLS13="yes"
  306. fi
  307. if test "$ENABLED_TLS13" = "yes"
  308. then
  309. AM_CFLAGS="-DWOLFSSL_TLS13 -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES $AM_CFLAGS"
  310. fi
  311. # check if TLS v1.3 was enabled for conditionally running tls13.test script
  312. AM_CONDITIONAL([BUILD_TLS13], [test "x$ENABLED_TLS13" = "xyes"])
  313. # Post-handshake Authentication
  314. AC_ARG_ENABLE([postauth],
  315. [AS_HELP_STRING([--enable-postauth],[Enable wolfSSL Post-handshake Authentication (default: disabled)])],
  316. [ ENABLED_TLS13_POST_AUTH=$enableval ],
  317. [ ENABLED_TLS13_POST_AUTH=no ]
  318. )
  319. if test "$ENABLED_TLS13_POST_AUTH" = "yes"
  320. then
  321. if test "x$ENABLED_TLS13" = "xno"
  322. then
  323. AC_MSG_ERROR([cannot enable postauth without enabling tls13.])
  324. fi
  325. AM_CFLAGS="-DWOLFSSL_POST_HANDSHAKE_AUTH $AM_CFLAGS"
  326. fi
  327. # Hello Retry Request Cookie
  328. AC_ARG_ENABLE([hrrcookie],
  329. [AS_HELP_STRING([--enable-hrrcookie],[Enable the server to send Cookie Extension in HRR with state (default: disabled)])],
  330. [ ENABLED_SEND_HRR_COOKIE=$enableval ],
  331. [ ENABLED_SEND_HRR_COOKIE=no ]
  332. )
  333. if test "$ENABLED_SEND_HRR_COOKIE" = "yes"
  334. then
  335. if test "x$ENABLED_TLS13" = "xno"
  336. then
  337. AC_MSG_ERROR([cannot enable hrrcookie without enabling tls13.])
  338. fi
  339. AM_CFLAGS="-DWOLFSSL_SEND_HRR_COOKIE $AM_CFLAGS"
  340. fi
  341. AC_ARG_ENABLE([rng],
  342. [AS_HELP_STRING([--enable-rng],[Enable compiling and using RNG (default: enabled)])],
  343. [ ENABLED_RNG=$enableval ],
  344. [ ENABLED_RNG=yes ]
  345. )
  346. if test "$ENABLED_RNG" = "no"
  347. then
  348. AM_CFLAGS="$AM_CFLAGS -DWC_NO_RNG"
  349. fi
  350. AM_CONDITIONAL([BUILD_RNG], [test "x$ENABLED_RNG" = "xyes"])
  351. # DTLS-SCTP
  352. AC_ARG_ENABLE([sctp],
  353. [AS_HELP_STRING([--enable-sctp],[Enable wolfSSL DTLS-SCTP support (default: disabled)])],
  354. [ENABLED_SCTP=$enableval],
  355. [ENABLED_SCTP=no])
  356. AM_CONDITIONAL([BUILD_SCTP], [test "x$ENABLED_SCTP" = "xyes"])
  357. AS_IF([test "x$ENABLED_SCTP" = "xyes"],
  358. [AC_MSG_CHECKING([for SCTP])
  359. AC_RUN_IFELSE(
  360. [AC_LANG_PROGRAM(
  361. [[
  362. #include <sys/socket.h>
  363. #include <arpa/inet.h>
  364. ]],
  365. [[int s = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); if (s == -1) return 1;]])],
  366. [AC_MSG_RESULT(yes)],
  367. [AC_MSG_RESULT(no)
  368. AC_MSG_ERROR([SCTP not available, remove enable-sctp from configure])])
  369. ])
  370. # DTLS-MULTICAST
  371. AC_ARG_ENABLE([mcast],
  372. [AS_HELP_STRING([--enable-mcast],[Enable wolfSSL DTLS multicast support (default: disabled)])],
  373. [ENABLED_MCAST=$enableval],
  374. [ENABLED_MCAST=no])
  375. AM_CONDITIONAL([BUILD_MCAST], [test "x$ENABLED_MCAST" = "xyes"])
  376. # RNG
  377. AC_ARG_ENABLE([rng],
  378. [AS_HELP_STRING([--enable-rng],[Enable compiling and using RNG (default: enabled)])],
  379. [ ENABLED_RNG=$enableval ],
  380. [ ENABLED_RNG=yes ]
  381. )
  382. if test "$ENABLED_RNG" = "no"
  383. then
  384. AM_CFLAGS="$AM_CFLAGS -DWC_NO_RNG"
  385. fi
  386. AM_CONDITIONAL([BUILD_RNG], [test "x$ENABLED_RNG" = "xyes"])
  387. # List of open source project defines using our openssl compatibility layer:
  388. # openssh (--enable-openssh)
  389. # nginix (--enable-nginx) WOLFSSL_NGINX
  390. # haproxy (--enable-haproxy) WOLFSSL_HAPROXY
  391. # wpa_supplicant (--enable-wpas) WOLFSSL_WPAS
  392. # ssl fortress (--enable-fortress) FORTRESS
  393. # ssl bump (--enable-bump)
  394. # signal (--enable-signal)
  395. # lighty (--enable-lighty) HAVE_LIGHTY
  396. # stunnel (--enable-stunnel) HAVE_STUNNEL
  397. # HAVE_POCO_LIB
  398. # WOLFSSL_MYSQL_COMPATIBLE
  399. # web server (--enable-webserver) HAVE_WEBSERVER
  400. # OpenSSH compatibility Build
  401. AC_ARG_ENABLE([openssh],
  402. [AS_HELP_STRING([--enable-openssh],[Enable OpenSSH compatibility build (default: disabled)])],
  403. [ENABLED_OPENSSH=$enableval],
  404. [ENABLED_OPENSSH=no])
  405. # nginx compatibility build
  406. AC_ARG_ENABLE([nginx],
  407. [AS_HELP_STRING([--enable-nginx],[Enable nginx (default: disabled)])],
  408. [ ENABLED_NGINX=$enableval ],
  409. [ ENABLED_NGINX=no ]
  410. )
  411. # haproxy compatibility build
  412. AC_ARG_ENABLE([haproxy],
  413. [AS_HELP_STRING([--enable-haproxy],[Enable haproxy (default: disabled)])],
  414. [ ENABLED_HAPROXY=$enableval ],
  415. [ ENABLED_HAPROXY=no ]
  416. )
  417. # wpa_supplicant support
  418. AC_ARG_ENABLE([wpas],
  419. [AS_HELP_STRING([--enable-wpas],[Enable wpa_supplicant support (default: disabled)])],
  420. [ ENABLED_WPAS=$enableval ],
  421. [ ENABLED_WPAS=no ]
  422. )
  423. # Fortress build
  424. AC_ARG_ENABLE([fortress],
  425. [AS_HELP_STRING([--enable-fortress],[Enable SSL fortress build (default: disabled)])],
  426. [ ENABLED_FORTRESS=$enableval ],
  427. [ ENABLED_FORTRESS=no ]
  428. )
  429. if test "$ENABLED_OPENSSH" = "yes"
  430. then
  431. ENABLED_FORTRESS="yes"
  432. fi
  433. # ssl bump build
  434. AC_ARG_ENABLE([bump],
  435. [AS_HELP_STRING([--enable-bump],[Enable SSL Bump build (default: disabled)])],
  436. [ ENABLED_BUMP=$enableval ],
  437. [ ENABLED_BUMP=no ]
  438. )
  439. # SNIFFER
  440. AC_ARG_ENABLE([sniffer],
  441. [AS_HELP_STRING([--enable-sniffer],[Enable wolfSSL sniffer support (default: disabled)])],
  442. [ ENABLED_SNIFFER=$enableval ],
  443. [ ENABLED_SNIFFER=no ]
  444. )
  445. # signal compatibility build
  446. AC_ARG_ENABLE([signal],
  447. [AS_HELP_STRING([--enable-signal],[Enable signal (default: disabled)])],
  448. [ ENABLED_SIGNAL=$enableval ],
  449. [ ENABLED_SIGNAL=no ]
  450. )
  451. # OpenSSL Coexist
  452. AC_ARG_ENABLE([opensslcoexist],
  453. [AS_HELP_STRING([--enable-opensslcoexist],[Enable coexistence of wolfssl/openssl (default: disabled)])],
  454. [ ENABLED_OPENSSLCOEXIST=$enableval ],
  455. [ ENABLED_OPENSSLCOEXIST=no ]
  456. )
  457. if test "x$ENABLED_OPENSSLCOEXIST" = "xyes"
  458. then
  459. # make sure old names are disabled
  460. enable_oldnames=no
  461. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_COEXIST"
  462. fi
  463. # OPENSSL Compatibility ALL
  464. AC_ARG_ENABLE([opensslall],
  465. [AS_HELP_STRING([--enable-opensslall],[Enable all OpenSSL API, size++ (default: disabled)])],
  466. [ ENABLED_OPENSSLALL=$enableval ],
  467. [ ENABLED_OPENSSLALL=no ]
  468. )
  469. if test "$ENABLED_OPENSSLALL" = "yes"
  470. then
  471. AM_CFLAGS="-DOPENSSL_ALL $AM_CFLAGS"
  472. fi
  473. # OPENSSL Extra Compatibility
  474. AC_ARG_ENABLE([opensslextra],
  475. [AS_HELP_STRING([--enable-opensslextra],[Enable extra OpenSSL API, size+ (default: disabled)])],
  476. [ ENABLED_OPENSSLEXTRA=$enableval ],
  477. [ ENABLED_OPENSSLEXTRA=no ]
  478. )
  479. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$ENABLED_SIGNAL" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_FORTRESS" = "yes" || test "$ENABLED_BUMP" = "yes" || test "$ENABLED_SNIFFER" = "yes" || test "$ENABLED_OPENSSLALL" = "yes"
  480. then
  481. ENABLED_OPENSSLEXTRA="yes"
  482. fi
  483. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  484. then
  485. AM_CFLAGS="-DOPENSSL_EXTRA -DWOLFSSL_ALWAYS_VERIFY_CB $AM_CFLAGS"
  486. AM_CFLAGS="-DWOLFSSL_VERIFY_CB_ALL_CERTS $AM_CFLAGS"
  487. fi
  488. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_SMALL" = "yes"
  489. then
  490. AC_MSG_ERROR([cannot enable small and opensslextra, only one or the other.])
  491. fi
  492. if test "$ENABLED_OPENSSLEXTRA" = "x509small"
  493. then
  494. AC_MSG_NOTICE([Enabling only a subset of X509 opensslextra])
  495. AM_CFLAGS="-DOPENSSL_EXTRA_X509_SMALL $AM_CFLAGS"
  496. AM_CFLAGS="-DWOLFSSL_EKU_OID -DWOLFSSL_MULTI_ATTRIB $AM_CFLAGS"
  497. fi
  498. # High Strength Build
  499. AC_ARG_ENABLE([maxstrength],
  500. [AS_HELP_STRING([--enable-maxstrength],[Enable Max Strength build, allows TLSv1.2-AEAD-PFS ciphers only (default: disabled)])],
  501. [ENABLED_MAXSTRENGTH=$enableval],
  502. [ENABLED_MAXSTRENGTH=no])
  503. # Harden, enable Timing Resistance and Blinding by default
  504. AC_ARG_ENABLE([harden],
  505. [AS_HELP_STRING([--enable-harden],[Enable Hardened build, Enables Timing Resistance and Blinding (default: enabled)])],
  506. [ENABLED_HARDEN=$enableval],
  507. [ENABLED_HARDEN=yes])
  508. if test "$ENABLED_HARDEN" = "yes"
  509. then
  510. AM_CFLAGS="$AM_CFLAGS -DTFM_TIMING_RESISTANT -DECC_TIMING_RESISTANT -DWC_RSA_BLINDING"
  511. else
  512. AM_CFLAGS="$AM_CFLAGS -DWC_NO_HARDEN"
  513. fi
  514. # IPv6 Test Apps
  515. AC_ARG_ENABLE([ipv6],
  516. [AS_HELP_STRING([--enable-ipv6],[Enable testing of IPV6 (default: disabled)])],
  517. [ ENABLED_IPV6=$enableval ],
  518. [ ENABLED_IPV6=no ]
  519. )
  520. if test "$ENABLED_IPV6" = "yes"
  521. then
  522. AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6 -DWOLFSSL_IPV6"
  523. fi
  524. AM_CONDITIONAL([BUILD_IPV6], [test "x$ENABLED_IPV6" = "xyes"])
  525. if test "$ENABLED_WPAS" = "yes"
  526. then
  527. AM_CFLAGS="$AM_CFLAGS -DHAVE_SECRET_CALLBACK -DWOLFSSL_STATIC_RSA"
  528. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PUBLIC_MP -DWOLFSSL_PUBLIC_ECC_ADD_DBL"
  529. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER -DHAVE_EX_DATA -DWOLFSSL_KEEP_PEER_CERT"
  530. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE"
  531. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_VERIFY_CB"
  532. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT -DWOLFSSL_DER_LOAD"
  533. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN -DWOLFSSL_DES_ECB"
  534. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WPAS"
  535. fi
  536. if test "$ENABLED_FORTRESS" = "yes"
  537. then
  538. AM_CFLAGS="$AM_CFLAGS -DFORTRESS -DWOLFSSL_ALWAYS_VERIFY_CB -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT -DWOLFSSL_DER_LOAD -DWOLFSSL_KEY_GEN"
  539. fi
  540. if test "$ENABLED_BUMP" = "yes"
  541. then
  542. AM_CFLAGS="$AM_CFLAGS -DLARGE_STATIC_BUFFERS -DWOLFSSL_CERT_GEN -DWOLFSSL_KEY_GEN -DHUGE_SESSION_CACHE -DFP_MAX_BITS=8192 -DWOLFSSL_DER_LOAD -DWOLFSSL_ALT_NAMES -DWOLFSSL_TEST_CERT"
  543. fi
  544. ENABLED_SLOWMATH="yes"
  545. # lean psk build
  546. AC_ARG_ENABLE([leanpsk],
  547. [AS_HELP_STRING([--enable-leanpsk],[Enable Lean PSK build (default: disabled)])],
  548. [ ENABLED_LEANPSK=$enableval ],
  549. [ ENABLED_LEANPSK=no ]
  550. )
  551. if test "$ENABLED_LEANPSK" = "yes"
  552. then
  553. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LEANPSK -DWOLFSSL_STATIC_PSK -DHAVE_NULL_CIPHER -DSINGLE_THREADED -DNO_AES -DNO_FILESYSTEM -DNO_RABBIT -DNO_RSA -DNO_DSA -DNO_DH -DNO_CERTS -DNO_PWDBASED -DNO_MD4 -DNO_MD5 -DNO_ERROR_STRINGS -DNO_OLD_TLS -DNO_RC4 -DNO_WRITEV -DNO_DEV_RANDOM -DWOLFSSL_USER_IO -DNO_SHA"
  554. ENABLED_SLOWMATH="no"
  555. ENABLED_SINGLETHREADED="yes"
  556. enable_lowresource=yes
  557. fi
  558. AM_CONDITIONAL([BUILD_LEANPSK], [test "x$ENABLED_LEANPSK" = "xyes"])
  559. # lean TLS build (TLS 1.2 client only (no client auth), ECC256, AES128 and SHA256 w/o Shamir)
  560. AC_ARG_ENABLE([leantls],
  561. [AS_HELP_STRING([--enable-leantls],[Enable Lean TLS build (default: disabled)])],
  562. [ ENABLED_LEANTLS=$enableval ],
  563. [ ENABLED_LEANTLS=no ]
  564. )
  565. if test "$ENABLED_LEANTLS" = "yes"
  566. then
  567. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LEANTLS -DNO_WRITEV -DHAVE_ECC -DTFM_ECC256 -DECC_USER_CURVES -DNO_WOLFSSL_SERVER -DNO_RABBIT -DNO_RSA -DNO_DSA -DNO_DH -DNO_PWDBASED -DNO_MD5 -DNO_ERROR_STRINGS -DNO_OLD_TLS -DNO_RC4 -DNO_SHA -DNO_PSK -DNO_WOLFSSL_MEMORY"
  568. enable_lowresource=yes
  569. fi
  570. AM_CONDITIONAL([BUILD_LEANTLS], [test "x$ENABLED_LEANTLS" = "xyes"])
  571. # low resource options to reduce flash and memory use
  572. AC_ARG_ENABLE([lowresource],
  573. [AS_HELP_STRING([--enable-lowresource],[Enable low resource options for memory/flash (default: disabled)])],
  574. [ ENABLED_LOWRESOURCE=$enableval ],
  575. [ ENABLED_LOWRESOURCE=no ]
  576. )
  577. if test "$ENABLED_LOWRESOURCE" = "yes"
  578. then
  579. # low memory / flash flags
  580. AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE -DRSA_LOW_MEM -DGCM_SMALL -DCURVE25519_SMALL -DED25519_SMALL"
  581. # low flash flags
  582. AM_CFLAGS="$AM_CFLAGS -DUSE_SLOW_SHA -DUSE_SLOW_SHA256 -DUSE_SLOW_SHA512"
  583. fi
  584. AM_CONDITIONAL([BUILD_LOWMEM], [test "x$ENABLED_LOWRESOURCE" = "xyes"])
  585. # big cache
  586. AC_ARG_ENABLE([bigcache],
  587. [AS_HELP_STRING([--enable-bigcache],[Enable big session cache (default: disabled)])],
  588. [ ENABLED_BIGCACHE=$enableval ],
  589. [ ENABLED_BIGCACHE=no ]
  590. )
  591. if test "$ENABLED_BIGCACHE" = "yes"
  592. then
  593. AM_CFLAGS="$AM_CFLAGS -DBIG_SESSION_CACHE"
  594. fi
  595. # HUGE cache
  596. AC_ARG_ENABLE([hugecache],
  597. [AS_HELP_STRING([--enable-hugecache],[Enable huge session cache (default: disabled)])],
  598. [ ENABLED_HUGECACHE=$enableval ],
  599. [ ENABLED_HUGECACHE=no ]
  600. )
  601. if test "$ENABLED_HUGECACHE" = "yes"
  602. then
  603. AM_CFLAGS="$AM_CFLAGS -DHUGE_SESSION_CACHE"
  604. fi
  605. # SMALL cache
  606. AC_ARG_ENABLE([smallcache],
  607. [AS_HELP_STRING([--enable-smallcache],[Enable small session cache (default: disabled)])],
  608. [ ENABLED_SMALLCACHE=$enableval ],
  609. [ ENABLED_SMALLCACHE=no ]
  610. )
  611. if test "$ENABLED_SMALLCACHE" = "yes"
  612. then
  613. AM_CFLAGS="$AM_CFLAGS -DSMALL_SESSION_CACHE"
  614. fi
  615. # Persistent session cache
  616. AC_ARG_ENABLE([savesession],
  617. [AS_HELP_STRING([--enable-savesession],[Enable persistent session cache (default: disabled)])],
  618. [ ENABLED_SAVESESSION=$enableval ],
  619. [ ENABLED_SAVESESSION=no ]
  620. )
  621. if test "$ENABLED_SAVESESSION" = "yes"
  622. then
  623. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  624. fi
  625. # Persistent cert cache
  626. AC_ARG_ENABLE([savecert],
  627. [AS_HELP_STRING([--enable-savecert],[Enable persistent cert cache (default: disabled)])],
  628. [ ENABLED_SAVECERT=$enableval ],
  629. [ ENABLED_SAVECERT=no ]
  630. )
  631. if test "$ENABLED_SAVECERT" = "yes"
  632. then
  633. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  634. fi
  635. # Write duplicate WOLFSSL object
  636. AC_ARG_ENABLE([writedup],
  637. [AS_HELP_STRING([--enable-writedup],[Enable write duplication of WOLFSSL objects (default: disabled)])],
  638. [ ENABLED_WRITEDUP=$enableval ],
  639. [ ENABLED_WRITEDUP=no ]
  640. )
  641. if test "$ENABLED_WRITEDUP" = "yes"
  642. then
  643. AM_CFLAGS="$AM_CFLAGS -DHAVE_WRITE_DUP"
  644. fi
  645. # Atomic User Record Layer
  646. AC_ARG_ENABLE([atomicuser],
  647. [AS_HELP_STRING([--enable-atomicuser],[Enable Atomic User Record Layer (default: disabled)])],
  648. [ ENABLED_ATOMICUSER=$enableval ],
  649. [ ENABLED_ATOMICUSER=no ]
  650. )
  651. if test "$ENABLED_ATOMICUSER" = "yes"
  652. then
  653. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  654. fi
  655. # Public Key Callbacks
  656. AC_ARG_ENABLE([pkcallbacks],
  657. [AS_HELP_STRING([--enable-pkcallbacks],[Enable Public Key Callbacks (default: disabled)])],
  658. [ ENABLED_PKCALLBACKS=$enableval ],
  659. [ ENABLED_PKCALLBACKS=no ]
  660. )
  661. if test "$ENABLED_PKCALLBACKS" = "yes"
  662. then
  663. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  664. fi
  665. AM_CONDITIONAL([BUILD_PKCALLBACKS], [ test "x$ENABLED_PKCALLBACKS" = "xyes" ])
  666. # sniffer doesn't work in maxstrength mode
  667. if test "$ENABLED_SNIFFER" = "yes" && test "$ENABLED_MAXSTRENGTH" = "yes"
  668. then
  669. AC_MSG_ERROR([cannot enable maxstrength in sniffer mode.])
  670. fi
  671. ENABLED_SNIFFTEST=no
  672. AS_IF([ test "x$ENABLED_SNIFFER" = "xyes" ],
  673. [
  674. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SNIFFER"
  675. AC_CHECK_HEADERS([pcap/pcap.h],
  676. [ ENABLED_SNIFFTEST=yes ],
  677. [ AC_MSG_WARN([cannot enable sniffer test without having libpcap available.]) ]
  678. )
  679. ])
  680. AM_CONDITIONAL([BUILD_SNIFFER], [ test "x$ENABLED_SNIFFER" = "xyes" ])
  681. AM_CONDITIONAL([BUILD_SNIFFTEST], [ test "x$ENABLED_SNIFFTEST" = "xyes" ])
  682. # AES-GCM
  683. AC_ARG_ENABLE([aesgcm],
  684. [AS_HELP_STRING([--enable-aesgcm],[Enable wolfSSL AES-GCM support (default: enabled)])],
  685. [ ENABLED_AESGCM=$enableval ],
  686. [ ENABLED_AESGCM=yes ]
  687. )
  688. # leanpsk and leantls don't need gcm
  689. if test "$ENABLED_LEANPSK" = "yes" || ( test "$ENABLED_LEANTLS" = "yes" &&
  690. test "$ENABLED_TLS13" = "no")
  691. then
  692. ENABLED_AESGCM=no
  693. fi
  694. if test "$ENABLED_AESGCM" != "no"
  695. then
  696. if test "$ENABLED_AESGCM" = "word32"
  697. then
  698. AM_CFLAGS="$AM_CFLAGS -DGCM_WORD32"
  699. ENABLED_AESGCM=yes
  700. fi
  701. if test "$ENABLED_AESGCM" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  702. then
  703. AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL"
  704. ENABLED_AESGCM=yes
  705. fi
  706. if test "$ENABLED_AESGCM" = "table"
  707. then
  708. AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE"
  709. ENABLED_AESGCM=yes
  710. fi
  711. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  712. fi
  713. AM_CONDITIONAL([BUILD_AESGCM], [test "x$ENABLED_AESGCM" = "xyes"])
  714. # AES-CCM
  715. AC_ARG_ENABLE([aesccm],
  716. [AS_HELP_STRING([--enable-aesccm],[Enable wolfSSL AES-CCM support (default: disabled)])],
  717. [ ENABLED_AESCCM=$enableval ],
  718. [ ENABLED_AESCCM=no ]
  719. )
  720. if test "$ENABLED_AESCCM" = "yes"
  721. then
  722. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"
  723. fi
  724. AM_CONDITIONAL([BUILD_AESCCM], [test "x$ENABLED_AESCCM" = "xyes"])
  725. # AES-CTR
  726. AC_ARG_ENABLE([aesctr],
  727. [AS_HELP_STRING([--enable-aesctr],[Enable wolfSSL AES-CTR support (default: disabled)])],
  728. [ ENABLED_AESCTR=$enableval ],
  729. [ ENABLED_AESCTR=no ]
  730. )
  731. if test "$ENABLED_AESCTR" = "yes"
  732. then
  733. if test "x$ENABLED_FORTRESS" != "xyes"
  734. then
  735. # This is already implied by fortress build
  736. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  737. fi
  738. fi
  739. # AES-CFB
  740. AC_ARG_ENABLE([aescfb],
  741. [AS_HELP_STRING([--enable-aescfb],[Enable wolfSSL AES-CFB support (default: disabled)])],
  742. [ ENABLED_AESCFB=$enableval ],
  743. [ ENABLED_AESCFB=no ]
  744. )
  745. if test "$ENABLED_AESCFB" = "yes"
  746. then
  747. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_CFB"
  748. fi
  749. # AES-ARM
  750. AC_ARG_ENABLE([armasm],
  751. [AS_HELP_STRING([--enable-armasm],[Enable wolfSSL ARMv8 ASM support (default: disabled)])],
  752. [ ENABLED_ARMASM=$enableval ],
  753. [ ENABLED_ARMASM=no ]
  754. )
  755. if test "$ENABLED_ARMASM" = "yes" && test "$ENABLED_ASM" = "yes"
  756. then
  757. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM"
  758. #Check if mcpu and mfpu values already set if not use default
  759. case $CPPFLAGS in
  760. *mcpu* | *mfpu*)
  761. break;; #Do not override user set values
  762. *)
  763. case $host_cpu in
  764. *aarch64*)
  765. #+crypto needed for hardware acceleration
  766. AM_CPPFLAGS="$AM_CPPFLAGS -mcpu=generic+crypto"
  767. AC_MSG_NOTICE([64bit ARMv8 found, setting mcpu to generic+crypto]);;
  768. *)
  769. AM_CPPFLAGS="$AM_CPPFLAGS -mfpu=crypto-neon-fp-armv8"
  770. AC_MSG_NOTICE([32bit ARMv8 found, setting mfpu to crypto-neon-fp-armv8]);;
  771. esac
  772. esac
  773. fi
  774. AM_CONDITIONAL([BUILD_ARMASM], [test "x$ENABLED_ARMASM" = "xyes"])
  775. # Xilinx hardened crypto
  776. AC_ARG_ENABLE([xilinx],
  777. [AS_HELP_STRING([--enable-xilinx],[Enable wolfSSL support for Xilinx hardened crypto(default: disabled)])],
  778. [ ENABLED_XILINX=$enableval ],
  779. [ ENABLED_XILINX=no ]
  780. )
  781. if test "$ENABLED_XILINX" = "yes"
  782. then
  783. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_XILINX -DWOLFSSL_XILINX_CRYPT"
  784. fi
  785. AM_CONDITIONAL([BUILD_XILINX], [test "x$ENABLED_XILINX" = "xyes"])
  786. # INTEL AES-NI
  787. AC_ARG_ENABLE([aesni],
  788. [AS_HELP_STRING([--enable-aesni],[Enable wolfSSL AES-NI support (default: disabled)])],
  789. [ ENABLED_AESNI=$enableval ],
  790. [ ENABLED_AESNI=no ]
  791. )
  792. # INTEL ASM
  793. AC_ARG_ENABLE([intelasm],
  794. [AS_HELP_STRING([--enable-intelasm],[Enable All Intel ASM speedups (default: disabled)])],
  795. [ ENABLED_INTELASM=$enableval ],
  796. [ ENABLED_INTELASM=no ]
  797. )
  798. if test "$ENABLED_ASM" = "yes"
  799. then
  800. if test "$ENABLED_AESNI" = "small"
  801. then
  802. AM_CFLAGS="$AM_CFLAGS -DAES_GCM_AESNI_NO_UNROLL"
  803. ENABLED_AESNI=yes
  804. fi
  805. if test "$ENABLED_AESNI" = "yes" || test "$ENABLED_INTELASM" = "yes"
  806. then
  807. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI"
  808. if test "$GCC" = "yes"
  809. then
  810. # GCC needs these flags, icc doesn't
  811. # opt levels greater than 2 may cause problems on systems w/o aesni
  812. if test "$CC" != "icc"
  813. then
  814. AM_CFLAGS="$AM_CFLAGS -maes -msse4 -mpclmul"
  815. fi
  816. fi
  817. AS_IF([test "x$ENABLED_AESGCM" != "xno"],[AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"])
  818. fi
  819. if test "$ENABLED_INTELASM" = "yes"
  820. then
  821. AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDSEED -DUSE_INTEL_SPEEDUP"
  822. ENABLED_AESNI=yes
  823. fi
  824. fi
  825. # INTEL RDRAND
  826. AC_ARG_ENABLE([intelrand],
  827. [AS_HELP_STRING([--enable-intelrand],[Enable Intel rdrand as preferred RNG source (default: disabled)])],
  828. [ ENABLED_INTELRDRAND=$enableval ],
  829. [ ENABLED_INTELRDRAND=no ]
  830. )
  831. if test "$ENABLED_INTELRDRAND" = "yes"
  832. then
  833. AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDRAND"
  834. fi
  835. AM_CONDITIONAL([BUILD_AESNI], [test "x$ENABLED_AESNI" = "xyes"])
  836. # Camellia
  837. AC_ARG_ENABLE([camellia],
  838. [AS_HELP_STRING([--enable-camellia],[Enable wolfSSL Camellia support (default: disabled)])],
  839. [ ENABLED_CAMELLIA=$enableval ],
  840. [ ENABLED_CAMELLIA=no ]
  841. )
  842. if test "$ENABLED_CAMELLIA" = "yes"
  843. then
  844. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAMELLIA"
  845. fi
  846. AM_CONDITIONAL([BUILD_CAMELLIA], [test "x$ENABLED_CAMELLIA" = "xyes"])
  847. # MD2
  848. AC_ARG_ENABLE([md2],
  849. [AS_HELP_STRING([--enable-md2],[Enable wolfSSL MD2 support (default: disabled)])],
  850. [ ENABLED_MD2=$enableval ],
  851. [ ENABLED_MD2=no ]
  852. )
  853. if test "$ENABLED_BUMP" = "yes"
  854. then
  855. ENABLED_MD2="yes"
  856. fi
  857. if test "$ENABLED_MD2" = "yes"
  858. then
  859. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MD2"
  860. fi
  861. AM_CONDITIONAL([BUILD_MD2], [test "x$ENABLED_MD2" = "xyes"])
  862. # NULL CIPHER
  863. AC_ARG_ENABLE([nullcipher],
  864. [AS_HELP_STRING([--enable-nullcipher],[Enable wolfSSL NULL cipher support (default: disabled)])],
  865. [ ENABLED_NULL_CIPHER=$enableval ],
  866. [ ENABLED_NULL_CIPHER=no ]
  867. )
  868. if test "$ENABLED_OPENSSH" = "yes"
  869. then
  870. ENABLED_NULL_CIPHER="yes"
  871. fi
  872. if test "$ENABLED_NULL_CIPHER" = "yes"
  873. then
  874. AM_CFLAGS="$AM_CFLAGS -DHAVE_NULL_CIPHER"
  875. fi
  876. # RIPEMD
  877. AC_ARG_ENABLE([ripemd],
  878. [AS_HELP_STRING([--enable-ripemd],[Enable wolfSSL RIPEMD-160 support (default: disabled)])],
  879. [ ENABLED_RIPEMD=$enableval ],
  880. [ ENABLED_RIPEMD=no ]
  881. )
  882. if test "$ENABLED_OPENSSH" = "yes"
  883. then
  884. ENABLED_RIPEMD="yes"
  885. fi
  886. if test "$ENABLED_RIPEMD" = "yes"
  887. then
  888. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RIPEMD"
  889. fi
  890. AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"])
  891. # BLAKE2
  892. AC_ARG_ENABLE([blake2],
  893. [AS_HELP_STRING([--enable-blake2],[Enable wolfSSL BLAKE2 support (default: disabled)])],
  894. [ ENABLED_BLAKE2=$enableval ],
  895. [ ENABLED_BLAKE2=no ]
  896. )
  897. if test "$ENABLED_BLAKE2" = "yes"
  898. then
  899. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2"
  900. fi
  901. AM_CONDITIONAL([BUILD_BLAKE2], [test "x$ENABLED_BLAKE2" = "xyes"])
  902. # SHA512
  903. AC_ARG_ENABLE([sha512],
  904. [AS_HELP_STRING([--enable-sha512],[Enable wolfSSL SHA-512 support (default: enabled)])],
  905. [ ENABLED_SHA512=$enableval ],
  906. [ ENABLED_SHA512=yes ]
  907. )
  908. # options that don't require sha512
  909. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  910. then
  911. ENABLED_SHA512=no
  912. fi
  913. # options that require sha512
  914. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_FORTRESS" = "yes"
  915. then
  916. ENABLED_SHA512="yes"
  917. fi
  918. if test "$ENABLED_SHA512" = "yes" && test "$ENABLED_32BIT" = "no"
  919. then
  920. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"
  921. fi
  922. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  923. # SESSION CERTS
  924. AC_ARG_ENABLE([sessioncerts],
  925. [AS_HELP_STRING([--enable-sessioncerts],[Enable session cert storing (default: disabled)])],
  926. [ ENABLED_SESSIONCERTS=$enableval ],
  927. [ ENABLED_SESSIONCERTS=no ]
  928. )
  929. if test "x$ENABLED_NGINX" = "xyes"
  930. then
  931. ENABLED_SESSIONCERTS=yes
  932. fi
  933. if test "$ENABLED_TLS13" = "yes" && test "$ENABLED_PSK" = "yes"
  934. then
  935. ENABLED_SESSIONCERTS=yes
  936. fi
  937. if test "$ENABLED_SESSIONCERTS" = "yes"
  938. then
  939. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  940. fi
  941. # KEY GENERATION
  942. AC_ARG_ENABLE([keygen],
  943. [AS_HELP_STRING([--enable-keygen],[Enable key generation (default: disabled)])],
  944. [ ENABLED_KEYGEN=$enableval ],
  945. [ ENABLED_KEYGEN=no ]
  946. )
  947. if test "$ENABLED_KEYGEN" = "yes"
  948. then
  949. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  950. fi
  951. # CERT GENERATION
  952. AC_ARG_ENABLE([certgen],
  953. [AS_HELP_STRING([--enable-certgen],[Enable cert generation (default: disabled)])],
  954. [ ENABLED_CERTGEN=$enableval ],
  955. [ ENABLED_CERTGEN=no ]
  956. )
  957. if test "$ENABLED_CERTGEN" = "yes"
  958. then
  959. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  960. fi
  961. # CERT REQUEST GENERATION
  962. AC_ARG_ENABLE([certreq],
  963. [AS_HELP_STRING([--enable-certreq],[Enable cert request generation (default: disabled)])],
  964. [ ENABLED_CERTREQ=$enableval ],
  965. [ ENABLED_CERTREQ=no ]
  966. )
  967. if test "$ENABLED_CERTREQ" = "yes"
  968. then
  969. if test "$ENABLED_CERTGEN" = "no"
  970. then
  971. AC_MSG_ERROR([cannot enable certreq without enabling certgen.])
  972. fi
  973. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  974. fi
  975. # CERT REQUEST EXTENSION
  976. AC_ARG_ENABLE([certext],
  977. [AS_HELP_STRING([--enable-certext],[Enable cert request extensions (default: disabled)])],
  978. [ ENABLED_CERTEXT=$enableval ],
  979. [ ENABLED_CERTEXT=no ]
  980. )
  981. if test "$ENABLED_CERTEXT" = "yes"
  982. then
  983. if test "$ENABLED_CERTGEN" = "no"
  984. then
  985. AC_MSG_ERROR([cannot enable certext without enabling certgen.])
  986. fi
  987. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  988. fi
  989. # SEP
  990. AC_ARG_ENABLE([sep],
  991. [AS_HELP_STRING([--enable-sep],[Enable sep extensions (default: disabled)])],
  992. [ ENABLED_SEP=$enableval ],
  993. [ ENABLED_SEP=no ]
  994. )
  995. if test "$ENABLED_SEP" = "yes"
  996. then
  997. AM_CFLAGS="-DWOLFSSL_SEP -DKEEP_PEER_CERT $AM_CFLAGS"
  998. fi
  999. # HKDF
  1000. AC_ARG_ENABLE([hkdf],
  1001. [AS_HELP_STRING([--enable-hkdf],[Enable HKDF (HMAC-KDF) support (default: disabled)])],
  1002. [ ENABLED_HKDF=$enableval ],
  1003. [ ENABLED_HKDF=no ]
  1004. )
  1005. if test "$ENABLED_TLS13" = "yes"
  1006. then
  1007. ENABLED_HKDF="yes"
  1008. fi
  1009. if test "$ENABLED_HKDF" = "yes"
  1010. then
  1011. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"
  1012. fi
  1013. # X9.63 KDF
  1014. AC_ARG_ENABLE([x963kdf],
  1015. [AS_HELP_STRING([--enable-x963kdf],[Enable X9.63 KDF support (default: disabled)])],
  1016. [ ENABLED_X963KDF=$enableval ],
  1017. [ ENABLED_X963KDF=no ]
  1018. )
  1019. if test "$ENABLED_X963KDF" = "yes"
  1020. then
  1021. AM_CFLAGS="$AM_CFLAGS -DHAVE_X963_KDF"
  1022. fi
  1023. # DSA
  1024. AC_ARG_ENABLE([dsa],
  1025. [AS_HELP_STRING([--enable-dsa],[Enable DSA (default: disabled)])],
  1026. [ ENABLED_DSA=$enableval ],
  1027. [ ENABLED_DSA=no ]
  1028. )
  1029. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$ENABLED_WPAS" = "yes"
  1030. then
  1031. ENABLED_DSA="yes"
  1032. fi
  1033. if test "$ENABLED_DSA" = "no"
  1034. then
  1035. AM_CFLAGS="$AM_CFLAGS -DNO_DSA"
  1036. fi
  1037. AM_CONDITIONAL([BUILD_DSA], [test "x$ENABLED_DSA" = "xyes"])
  1038. # ECC Shamir
  1039. AC_ARG_ENABLE([eccshamir],
  1040. [AS_HELP_STRING([--enable-eccshamir],[Enable ECC Shamir (default: enabled)])],
  1041. [ ENABLED_ECC_SHAMIR=$enableval ],
  1042. [ ENABLED_ECC_SHAMIR=yes ]
  1043. )
  1044. # ECC
  1045. AC_ARG_ENABLE([ecc],
  1046. [AS_HELP_STRING([--enable-ecc],[Enable ECC (default: enabled)])],
  1047. [ ENABLED_ECC=$enableval ],
  1048. [ ENABLED_ECC=yes ]
  1049. )
  1050. # lean psk doesn't need ecc
  1051. if test "$ENABLED_LEANPSK" = "yes"
  1052. then
  1053. ENABLED_ECC=no
  1054. fi
  1055. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$ENABLED_SIGNAL" = "yes"
  1056. then
  1057. ENABLED_ECC="yes"
  1058. fi
  1059. if test "$ENABLED_ECC" = "yes"
  1060. then
  1061. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  1062. if test "$ENABLED_ECC_SHAMIR" = "yes"
  1063. then
  1064. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  1065. fi
  1066. fi
  1067. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  1068. # ECC Custom Curves
  1069. AC_ARG_ENABLE([ecccustcurves],
  1070. [AS_HELP_STRING([--enable-ecccustcurves],[Enable ECC custom curves (default: disabled)])],
  1071. [ ENABLED_ECCCUSTCURVES=$enableval ],
  1072. [ ENABLED_ECCCUSTCURVES=no ]
  1073. )
  1074. if test "$ENABLED_ECCCUSTCURVES" = "yes"
  1075. then
  1076. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES"
  1077. # For distro or all builds, enable all curve types
  1078. if test "$ENABLED_DISTRO" = "yes" || test "$ENABLED_ALL" = "yes"
  1079. then
  1080. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ"
  1081. fi
  1082. fi
  1083. # Compressed Key
  1084. AC_ARG_ENABLE([compkey],
  1085. [AS_HELP_STRING([--enable-compkey],[Enable compressed keys support (default: disabled)])],
  1086. [ ENABLED_COMPKEY=$enableval ],
  1087. [ ENABLED_COMPKEY=no ]
  1088. )
  1089. if test "$ENABLED_WPAS" = "yes"
  1090. then
  1091. ENABLED_COMPKEY=yes
  1092. fi
  1093. if test "$ENABLED_COMPKEY" = "yes"
  1094. then
  1095. AM_CFLAGS="$AM_CFLAGS -DHAVE_COMP_KEY"
  1096. fi
  1097. # for using memory optimization setting on both curve25519 and ed25519
  1098. ENABLED_CURVE25519_SMALL=no
  1099. ENABLED_ED25519_SMALL=no
  1100. # CURVE25519
  1101. AC_ARG_ENABLE([curve25519],
  1102. [AS_HELP_STRING([--enable-curve25519],[Enable Curve25519 (default: disabled)])],
  1103. [ ENABLED_CURVE25519=$enableval ],
  1104. [ ENABLED_CURVE25519=no ]
  1105. )
  1106. if test "$ENABLED_OPENSSH" = "yes"
  1107. then
  1108. ENABLED_CURVE25519="yes"
  1109. fi
  1110. if test "$ENABLED_CURVE25519" != "no"
  1111. then
  1112. if test "$ENABLED_CURVE25519" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1113. then
  1114. AM_CFLAGS="$AM_CFLAGS -DCURVE25519_SMALL"
  1115. ENABLED_CURVE25519_SMALL=yes
  1116. ENABLED_CURVE25519=yes
  1117. fi
  1118. if test "$ENABLED_CURVE25519" = "no128bit"
  1119. then
  1120. AM_CFLAGS="$AM_CFLAGS -DNO_CURVED25519_128BIT"
  1121. ENABLED_CURVE25519=yes
  1122. fi
  1123. AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE25519"
  1124. ENABLED_FEMATH=yes
  1125. fi
  1126. # ED25519
  1127. AC_ARG_ENABLE([ed25519],
  1128. [AS_HELP_STRING([--enable-ed25519],[Enable ED25519 (default: disabled)])],
  1129. [ ENABLED_ED25519=$enableval ],
  1130. [ ENABLED_ED25519=no ]
  1131. )
  1132. if test "$ENABLED_OPENSSH" = "yes"
  1133. then
  1134. ENABLED_ED25519="yes"
  1135. fi
  1136. if test "$ENABLED_ED25519" != "no" && test "$ENABLED_32BIT" = "no"
  1137. then
  1138. if test "$ENABLED_ED25519" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1139. then
  1140. AM_CFLAGS="$AM_CFLAGS -DED25519_SMALL"
  1141. ENABLED_ED25519_SMALL=yes
  1142. ENABLED_CURVE25519_SMALL=yes
  1143. ENABLED_ED25519=yes
  1144. fi
  1145. if test "$ENABLED_SHA512" = "no"
  1146. then
  1147. AC_MSG_ERROR([cannot enable ed25519 without enabling sha512.])
  1148. fi
  1149. ENABLED_FEMATH=yes
  1150. ENABLED_GEMATH=yes
  1151. AM_CFLAGS="$AM_CFLAGS -DHAVE_ED25519"
  1152. fi
  1153. AM_CONDITIONAL([BUILD_ED25519], [test "x$ENABLED_ED25519" = "xyes"])
  1154. AM_CONDITIONAL([BUILD_ED25519_SMALL], [test "x$ENABLED_ED25519_SMALL" = "xyes"])
  1155. AM_CONDITIONAL([BUILD_FEMATH], [test "x$ENABLED_FEMATH" = "xyes"])
  1156. AM_CONDITIONAL([BUILD_GEMATH], [test "x$ENABLED_GEMATH" = "xyes"])
  1157. AM_CONDITIONAL([BUILD_CURVE25519], [test "x$ENABLED_CURVE25519" = "xyes"])
  1158. AM_CONDITIONAL([BUILD_CURVE25519_SMALL], [test "x$ENABLED_CURVE25519_SMALL" = "xyes"])
  1159. # FP ECC, Fixed Point cache ECC
  1160. AC_ARG_ENABLE([fpecc],
  1161. [AS_HELP_STRING([--enable-fpecc],[Enable Fixed Point cache ECC (default: disabled)])],
  1162. [ ENABLED_FPECC=$enableval ],
  1163. [ ENABLED_FPECC=no ]
  1164. )
  1165. if test "$ENABLED_FPECC" = "yes"
  1166. then
  1167. if test "$ENABLED_ECC" = "no"
  1168. then
  1169. AC_MSG_ERROR([cannot enable fpecc without enabling ecc.])
  1170. fi
  1171. AM_CFLAGS="$AM_CFLAGS -DFP_ECC"
  1172. fi
  1173. # ECC encrypt
  1174. AC_ARG_ENABLE([eccencrypt],
  1175. [AS_HELP_STRING([--enable-eccencrypt],[Enable ECC encrypt (default: disabled)])],
  1176. [ ENABLED_ECC_ENCRYPT=$enableval ],
  1177. [ ENABLED_ECC_ENCRYPT=no ]
  1178. )
  1179. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  1180. then
  1181. if test "$ENABLED_ECC" = "no"
  1182. then
  1183. AC_MSG_ERROR([cannot enable eccencrypt without enabling ecc.])
  1184. fi
  1185. if test "$ENABLED_HKDF" = "no"
  1186. then
  1187. AC_MSG_ERROR([cannot enable eccencrypt without enabling hkdf.])
  1188. fi
  1189. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_ENCRYPT"
  1190. fi
  1191. # PSK
  1192. AC_ARG_ENABLE([psk],
  1193. [AS_HELP_STRING([--enable-psk],[Enable PSK (default: disabled)])],
  1194. [ ENABLED_PSK=$enableval ],
  1195. [ ENABLED_PSK=no ]
  1196. )
  1197. # ERROR STRINGS
  1198. AC_ARG_ENABLE([errorstrings],
  1199. [AS_HELP_STRING([--enable-errorstrings],[Enable error strings table (default: enabled)])],
  1200. [ ENABLED_ERROR_STRINGS=$enableval ],
  1201. [ ENABLED_ERROR_STRINGS=yes ]
  1202. )
  1203. if test "$ENABLED_ERROR_STRINGS" = "no"
  1204. then
  1205. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  1206. else
  1207. # turn off error strings if leanpsk or leantls on
  1208. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1209. then
  1210. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  1211. ENABLED_ERROR_STRINGS=no
  1212. fi
  1213. fi
  1214. # OLD TLS
  1215. AC_ARG_ENABLE([oldtls],
  1216. [AS_HELP_STRING([--enable-oldtls],[Enable old TLS versions < 1.2 (default: enabled)])],
  1217. [ ENABLED_OLD_TLS=$enableval ],
  1218. [ ENABLED_OLD_TLS=yes ]
  1219. )
  1220. if test "$ENABLED_OLD_TLS" = "no"
  1221. then
  1222. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  1223. else
  1224. # turn off old if leanpsk or leantls on
  1225. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1226. then
  1227. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  1228. ENABLED_OLD_TLS=no
  1229. fi
  1230. fi
  1231. # TLSv1.0
  1232. AC_ARG_ENABLE([tlsv10],
  1233. [AS_HELP_STRING([--enable-tlsv10],[Enable old TLS versions 1.0 (default: disabled)])],
  1234. [ ENABLED_TLSV10=$enableval ],
  1235. [ ENABLED_TLSV10=no ]
  1236. )
  1237. if test "$ENABLED_TLSV10" = "yes"
  1238. then
  1239. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_TLSV10"
  1240. fi
  1241. # SSLv3
  1242. AC_ARG_ENABLE([sslv3],
  1243. [AS_HELP_STRING([--enable-sslv3],[Enable SSL version 3.0 (default: disabled)])],
  1244. [ ENABLED_SSLV3=$enableval ],
  1245. [ ENABLED_SSLV3=no]
  1246. )
  1247. if test "$ENABLED_SSLV3" = "yes"
  1248. then
  1249. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_SSLV3"
  1250. fi
  1251. # STACK SIZE info for examples
  1252. AC_ARG_ENABLE([stacksize],
  1253. [AS_HELP_STRING([--enable-stacksize],[Enable stack size info on examples (default: disabled)])],
  1254. [ ENABLED_STACKSIZE=$enableval ],
  1255. [ ENABLED_STACKSIZE=no ]
  1256. )
  1257. if test "$ENABLED_STACKSIZE" = "yes"
  1258. then
  1259. AC_CHECK_FUNC([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  1260. AC_CHECK_FUNC([pthread_attr_setstack], [], AC_CHECK_LIB([pthread],[pthread_attr_setstack]))
  1261. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE -DWOLFSSL_LOW_MEMORY"
  1262. fi
  1263. # MEMORY
  1264. AC_ARG_ENABLE([memory],
  1265. [AS_HELP_STRING([--enable-memory],[Enable memory callbacks (default: enabled)])],
  1266. [ ENABLED_MEMORY=$enableval ],
  1267. [ ENABLED_MEMORY=yes ]
  1268. )
  1269. if test "$ENABLED_MEMORY" = "no"
  1270. then
  1271. AM_CFLAGS="$AM_CFLAGS -DNO_WOLFSSL_MEMORY"
  1272. else
  1273. # turn off memory cb if leanpsk or leantls on
  1274. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1275. then
  1276. # but don't turn on NO_WOLFSSL_MEMORY because using own
  1277. ENABLED_MEMORY=no
  1278. fi
  1279. fi
  1280. AM_CONDITIONAL([BUILD_MEMORY], [test "x$ENABLED_MEMORY" = "xyes"])
  1281. # MEMORY SIZE info
  1282. AC_ARG_ENABLE([trackmemory],
  1283. [AS_HELP_STRING([--enable-trackmemory],[Enable memory use info on wolfCrypt and wolfSSL cleanup (default: disabled)])],
  1284. [ ENABLED_TRACKMEMORY=$enableval ],
  1285. [ ENABLED_TRACKMEMORY=no ]
  1286. )
  1287. if test "$ENABLED_TRACKMEMORY" = "yes"
  1288. then
  1289. if test "$ENABLED_MEMORY" = "yes"
  1290. then
  1291. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY"
  1292. else
  1293. AC_MSG_ERROR([trackmemory requires using wolfSSL memory (--enable-memory).])
  1294. fi
  1295. fi
  1296. # RSA
  1297. AC_ARG_ENABLE([rsa],
  1298. [AS_HELP_STRING([--enable-rsa],[Enable RSA (default: enabled)])],
  1299. [ ENABLED_RSA=$enableval ],
  1300. [ ENABLED_RSA=yes ]
  1301. )
  1302. if test "$ENABLED_RSA" = "no"
  1303. then
  1304. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  1305. else
  1306. # turn off RSA if leanpsk or leantls on
  1307. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1308. then
  1309. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  1310. ENABLED_RSA=no
  1311. fi
  1312. fi
  1313. AM_CONDITIONAL([BUILD_RSA], [test "x$ENABLED_RSA" = "xyes"])
  1314. # RSA-PSS
  1315. AC_ARG_ENABLE([rsapss],
  1316. [ --enable-rsapss Enable RSA-PSS (default: disabled)],
  1317. [ ENABLED_RSAPSS=$enableval ],
  1318. [ ENABLED_RSAPSS=no ]
  1319. )
  1320. if test "$ENABLED_RSA" = "no"
  1321. then
  1322. ENABLED_RSAPSS="no"
  1323. else
  1324. if test "$ENABLED_TLS13" = "yes"
  1325. then
  1326. ENABLED_RSAPSS="yes"
  1327. fi
  1328. fi
  1329. if test "$ENABLED_RSAPSS" = "yes"
  1330. then
  1331. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS"
  1332. fi
  1333. # DH
  1334. AC_ARG_ENABLE([dh],
  1335. [AS_HELP_STRING([--enable-dh],[Enable DH (default: enabled)])],
  1336. [ ENABLED_DH=$enableval ],
  1337. [ ENABLED_DH=yes ]
  1338. )
  1339. if test "$ENABLED_OPENSSH" = "yes"
  1340. then
  1341. ENABLED_DH="yes"
  1342. fi
  1343. if test "$ENABLED_DH" = "no"
  1344. then
  1345. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  1346. else
  1347. # turn off DH if leanpsk or leantls on
  1348. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1349. then
  1350. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  1351. ENABLED_DH=no
  1352. fi
  1353. fi
  1354. if test "$ENABLED_TLS13" = "yes" && test "$ENABLED_DH" = "yes"
  1355. then
  1356. AM_CFLAGS="-DHAVE_FFDHE_2048 $AM_CFLAGS"
  1357. fi
  1358. AM_CONDITIONAL([BUILD_DH], [test "x$ENABLED_DH" = "xyes"])
  1359. # Anonymous
  1360. AC_ARG_ENABLE([anon],
  1361. [AS_HELP_STRING([--enable-anon],[Enable Anonymous (default: disabled)])],
  1362. [ ENABLED_ANON=$enableval ],
  1363. [ ENABLED_ANON=no ]
  1364. )
  1365. if test "x$ENABLED_WPAS" = "xyes"
  1366. then
  1367. ENABLED_ANON=yes
  1368. fi
  1369. if test "x$ENABLED_ANON" = "xyes"
  1370. then
  1371. if test "x$ENABLED_DH" != "xyes"
  1372. then
  1373. AC_MSG_ERROR([Anonymous suite requires DH.])
  1374. fi
  1375. AM_CFLAGS="$AM_CFLAGS -DHAVE_ANON"
  1376. fi
  1377. # ASN
  1378. # turn off asn, which means no certs, no rsa, no dsa, no ecc,
  1379. # and no big int (unless dh is on)
  1380. AC_ARG_ENABLE([asn],
  1381. [AS_HELP_STRING([--enable-asn],[Enable ASN (default: enabled)])],
  1382. [ ENABLED_ASN=$enableval ],
  1383. [ ENABLED_ASN=yes ]
  1384. )
  1385. if test "$ENABLED_ASN" = "no"
  1386. then
  1387. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS"
  1388. if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" == "no"
  1389. then
  1390. # DH and ECC need bigint
  1391. AM_CFLAGS="$AM_CFLAGS -DNO_BIG_INT"
  1392. fi
  1393. else
  1394. # turn off ASN if leanpsk on
  1395. if test "$ENABLED_LEANPSK" = "yes"
  1396. then
  1397. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
  1398. ENABLED_ASN=no
  1399. fi
  1400. fi
  1401. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_ASN" = "no"
  1402. then
  1403. AC_MSG_ERROR([please disable rsa if disabling asn.])
  1404. fi
  1405. if test "$ENABLED_DSA" = "yes" && test "$ENABLED_ASN" = "no"
  1406. then
  1407. AC_MSG_ERROR([please disable dsa if disabling asn.])
  1408. fi
  1409. # DH and ECC need bigint
  1410. if test "$ENABLED_ASN" = "no" && test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no"
  1411. then
  1412. ENABLED_FASTMATH=no
  1413. ENABLED_SLOWMATH=no
  1414. fi
  1415. AM_CONDITIONAL([BUILD_ASN], [test "x$ENABLED_ASN" = "xyes"])
  1416. # AES
  1417. AC_ARG_ENABLE([aes],
  1418. [AS_HELP_STRING([--enable-aes],[Enable AES (default: enabled)])],
  1419. [ ENABLED_AES=$enableval ],
  1420. [ ENABLED_AES=yes ]
  1421. )
  1422. if test "$ENABLED_AES" = "no"
  1423. then
  1424. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  1425. if test "$ENABLED_FORTRESS" = "yes"
  1426. then
  1427. AC_MSG_ERROR([fortress requires aes])
  1428. fi
  1429. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  1430. then
  1431. AC_MSG_ERROR([cannot enable eccencrypt and hkdf without aes.])
  1432. fi
  1433. if test "$ENABLED_AESGCM" = "yes"
  1434. then
  1435. AC_MSG_ERROR([AESGCM requires AES.])
  1436. fi
  1437. if test "$ENABLED_AESCCM" = "yes"
  1438. then
  1439. AC_MSG_ERROR([AESCCM requires AES.])
  1440. fi
  1441. if test "$ENABLED_AESCTR" = "yes"
  1442. then
  1443. AC_MSG_ERROR([AESCTR requires AES.])
  1444. fi
  1445. else
  1446. # turn off AES if leanpsk on
  1447. if test "$ENABLED_LEANPSK" = "yes"
  1448. then
  1449. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  1450. ENABLED_AES=no
  1451. fi
  1452. fi
  1453. AM_CONDITIONAL([BUILD_AES], [test "x$ENABLED_AES" = "xyes"])
  1454. # CODING
  1455. AC_ARG_ENABLE([coding],
  1456. [AS_HELP_STRING([--enable-coding],[Enable Coding base 16/64 (default: enabled)])],
  1457. [ ENABLED_CODING=$enableval ],
  1458. [ ENABLED_CODING=yes ]
  1459. )
  1460. if test "$ENABLED_CODING" = "no"
  1461. then
  1462. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  1463. else
  1464. # turn off CODING if leanpsk on
  1465. if test "$ENABLED_LEANPSK" = "yes"
  1466. then
  1467. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  1468. ENABLED_CODING=no
  1469. fi
  1470. fi
  1471. AM_CONDITIONAL([BUILD_CODING], [test "x$ENABLED_CODING" = "xyes"])
  1472. # Base64 Encode
  1473. BASE64ENCODE_DEFAULT=no
  1474. if test "$host_cpu" = "x86_64"
  1475. then
  1476. BASE64ENCODE_DEFAULT=yes
  1477. fi
  1478. AC_ARG_ENABLE([base64encode],
  1479. [AS_HELP_STRING([--enable-base64encode],[Enable Base64 encoding (default: enabled on x86_64)])],
  1480. [ ENABLED_BASE64ENCODE=$enableval ],
  1481. [ ENABLED_BASE64ENCODE=$BASE64ENCODE_DEFAULT ]
  1482. )
  1483. if test "$ENABLED_BASE64ENCODE" = "yes"
  1484. then
  1485. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BASE64_ENCODE"
  1486. fi
  1487. # Base16
  1488. AC_ARG_ENABLE([base16],
  1489. [AS_HELP_STRING([--enable-base16],[Enable Base16 encoding/decoding (default: disabled)])],
  1490. [ ENABLED_BASE16=$enableval ],
  1491. [ ENABLED_BASE16=no ]
  1492. )
  1493. if test "$ENABLED_BASE16" = "yes"
  1494. then
  1495. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BASE16"
  1496. fi
  1497. # DES3
  1498. AC_ARG_ENABLE([des3],
  1499. [AS_HELP_STRING([--enable-des3],[Enable DES3 (default: disabled)])],
  1500. [ ENABLED_DES3=$enableval ],
  1501. [ ENABLED_DES3=no ]
  1502. )
  1503. # IDEA
  1504. AC_ARG_ENABLE([idea],
  1505. [AS_HELP_STRING([--enable-idea],[Enable IDEA Cipher (default: disabled)])],
  1506. [ ENABLED_IDEA=$enableval ],
  1507. [ ENABLED_IDEA=no ]
  1508. )
  1509. if test "x$ENABLED_IDEA" = "xyes"
  1510. then
  1511. AM_CFLAGS="$AM_CFLAGS -DHAVE_IDEA"
  1512. fi
  1513. AM_CONDITIONAL([BUILD_IDEA], [test "x$ENABLED_IDEA" = "xyes"])
  1514. # ARC4
  1515. AC_ARG_ENABLE([arc4],
  1516. [AS_HELP_STRING([--enable-arc4],[Enable ARC4 (default: disabled)])],
  1517. [ ENABLED_ARC4=$enableval ],
  1518. [ ENABLED_ARC4=no ]
  1519. )
  1520. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes"
  1521. then
  1522. ENABLED_ARC4="yes"
  1523. fi
  1524. if test "$ENABLED_ARC4" = "no"
  1525. then
  1526. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  1527. else
  1528. # turn off ARC4 if leanpsk or leantls on
  1529. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1530. then
  1531. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  1532. ENABLED_ARC4=no
  1533. fi
  1534. fi
  1535. AM_CONDITIONAL([BUILD_RC4], [test "x$ENABLED_ARC4" = "xyes"])
  1536. # MD5
  1537. AC_ARG_ENABLE([md5],
  1538. [AS_HELP_STRING([--enable-md5],[Enable MD5 (default: enabled)])],
  1539. [ ENABLED_MD5=$enableval ],
  1540. [ ENABLED_MD5=yes ]
  1541. )
  1542. if test "$ENABLED_MD5" = "no"
  1543. then
  1544. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  1545. else
  1546. # turn off MD5 if leanpsk or leantls on
  1547. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1548. then
  1549. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  1550. ENABLED_MD5=no
  1551. fi
  1552. fi
  1553. AM_CONDITIONAL([BUILD_MD5], [test "x$ENABLED_MD5" = "xyes"])
  1554. # SHA
  1555. AC_ARG_ENABLE([sha],
  1556. [AS_HELP_STRING([--enable-sha],[Enable SHA (default: enabled)])],
  1557. [ ENABLED_SHA=$enableval ],
  1558. [ ENABLED_SHA=yes ]
  1559. )
  1560. if test "$ENABLED_SHA" = "no"
  1561. then
  1562. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  1563. else
  1564. # turn off SHA if leanpsk or leantls on
  1565. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1566. then
  1567. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  1568. ENABLED_SHA=no
  1569. fi
  1570. fi
  1571. AM_CONDITIONAL([BUILD_SHA], [test "x$ENABLED_SHA" = "xyes"])
  1572. # CMAC
  1573. AC_ARG_ENABLE([cmac],
  1574. [AS_HELP_STRING([--enable-cmac],[Enable CMAC (default: disabled)])],
  1575. [ ENABLED_CMAC=$enableval ],
  1576. [ ENABLED_CMAC=no ]
  1577. )
  1578. if test "$ENABLED_WPAS" = "yes"
  1579. then
  1580. ENABLED_CMAC=yes
  1581. fi
  1582. AS_IF([test "x$ENABLED_CMAC" = "xyes"],
  1583. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC -DWOLFSSL_AES_DIRECT"])
  1584. #AM_CONDITIONAL([BUILD_CMAC], [test "x$ENABLED_CMAC" = "xyes"])
  1585. #moved to FIPS section
  1586. # AES-XTS
  1587. AC_ARG_ENABLE([xts],
  1588. [AS_HELP_STRING([--enable-xts],[Enable XTS (default: disabled)])],
  1589. [ ENABLED_XTS=$enableval ],
  1590. [ ENABLED_XTS=no ]
  1591. )
  1592. AS_IF([test "x$ENABLED_XTS" = "xyes"],
  1593. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_XTS -DWOLFSSL_AES_DIRECT"])
  1594. # Web Server Build
  1595. AC_ARG_ENABLE([webserver],
  1596. [AS_HELP_STRING([--enable-webserver],[Enable Web Server (default: disabled)])],
  1597. [ ENABLED_WEBSERVER=$enableval ],
  1598. [ ENABLED_WEBSERVER=no ]
  1599. )
  1600. if test "$ENABLED_WEBSERVER" = "yes"
  1601. then
  1602. AM_CFLAGS="$AM_CFLAGS -DHAVE_WEBSERVER"
  1603. fi
  1604. # Web Client Build (HTTP Client)
  1605. AC_ARG_ENABLE([webclient],
  1606. [AS_HELP_STRING([--enable-webclient],[Enable Web Client (HTTP) (default: disabled)])],
  1607. [ ENABLED_WEBCLIENT=$enableval ],
  1608. [ ENABLED_WEBCLIENT=no ]
  1609. )
  1610. if test "$ENABLED_WEBCLIENT" = "yes"
  1611. then
  1612. AM_CFLAGS="$AM_CFLAGS -DHAVE_HTTP_CLIENT"
  1613. fi
  1614. # HC128
  1615. AC_ARG_ENABLE([hc128],
  1616. [AS_HELP_STRING([--enable-hc128],[Enable HC-128 (default: disabled)])],
  1617. [ ENABLED_HC128=$enableval ],
  1618. [ ENABLED_HC128=no ]
  1619. )
  1620. if test "$ENABLED_HC128" = "no"
  1621. then
  1622. AM_CFLAGS="$AM_CFLAGS -DNO_HC128"
  1623. else
  1624. AM_CFLAGS="$AM_CFLAGS -DHAVE_HC128"
  1625. fi
  1626. AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"])
  1627. # RABBIT
  1628. AC_ARG_ENABLE([rabbit],
  1629. [AS_HELP_STRING([--enable-rabbit],[Enable RABBIT (default: disabled)])],
  1630. [ ENABLED_RABBIT=$enableval ],
  1631. [ ENABLED_RABBIT=no ]
  1632. )
  1633. if test "$ENABLED_RABBIT" = "no"
  1634. then
  1635. AM_CFLAGS="$AM_CFLAGS -DNO_RABBIT"
  1636. else
  1637. AM_CFLAGS="$AM_CFLAGS -DHAVE_RABBIT"
  1638. fi
  1639. AM_CONDITIONAL([BUILD_RABBIT], [test "x$ENABLED_RABBIT" = "xyes"])
  1640. # FIPS
  1641. AC_ARG_ENABLE([fips],
  1642. [AS_HELP_STRING([--enable-fips],[Enable FIPS 140-2, Will NOT work w/o FIPS license (default: disabled)])],
  1643. [ ENABLED_FIPS=$enableval ],
  1644. [ ENABLED_FIPS=no ]
  1645. )
  1646. if test "x$ENABLED_FIPS" != "xno"
  1647. then
  1648. FIPS_VERSION=$ENABLED_FIPS
  1649. ENABLED_FIPS=yes
  1650. # requires thread local storage
  1651. if test "$thread_ls_on" = "no"
  1652. then
  1653. AC_MSG_ERROR([FIPS requires Thread Local Storage])
  1654. fi
  1655. # requires SHA512
  1656. if test "x$ENABLED_SHA512" = "xno"
  1657. then
  1658. ENABLED_SHA512="yes"
  1659. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"
  1660. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  1661. fi
  1662. # requires AESGCM
  1663. if test "x$ENABLED_AESGCM" != "xyes"
  1664. then
  1665. ENABLED_AESGCM="yes"
  1666. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  1667. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  1668. fi
  1669. # requires DES3
  1670. if test "x$ENABLED_DES3" = "xno"
  1671. then
  1672. ENABLED_DES3="yes"
  1673. fi
  1674. AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS"
  1675. # Add the FIPS flag.
  1676. AS_IF([test "x$FIPS_VERSION" = "xv2"],
  1677. [AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS_VERSION=2 -DWOLFSSL_KEY_GEN -DWOLFSSL_SHA224 -DWOLFSSL_AES_DIRECT -DHAVE_AES_ECB -DHAVE_ECC_CDH -DWC_RSA_NO_PADDING -DFP_MAX_BITS=6144 -DWOLFSSL_VALIDATE_FFC_IMPORT"
  1678. ENABLED_KEYGEN="yes"
  1679. ENABLED_SHA224="yes"
  1680. AS_IF([test "x$ENABLED_AESCCM" != "xyes"],
  1681. [ENABLED_AESCCM="yes"
  1682. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"])
  1683. AS_IF([test "x$ENABLED_RSAPSS" != "xyes"],
  1684. [ENABLED_RSAPSS="yes"
  1685. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS"])
  1686. AS_IF([test "x$ENABLED_ECC" != "xyes"],
  1687. [ENABLED_ECC="yes"
  1688. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DWOLFSSL_VALIDATE_ECC_IMPORT"
  1689. AS_IF([test "x$ENABLED_ECC_SHAMIR" = "xyes"],
  1690. [AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"])])
  1691. AS_IF([test "x$ENABLED_AESCTR" != "xyes"],
  1692. [ENABLED_AESCTR="yes"
  1693. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER"])
  1694. AS_IF([test "x$ENABLED_CMAC" != "xyes"],
  1695. [ENABLED_CMAC="yes"
  1696. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC"])
  1697. AS_IF([test "x$ENABLED_HKDF" != "xyes"],
  1698. [ENABLED_HKDF="yes"
  1699. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"])
  1700. AS_IF([test "x$ENABLED_INTELASM" = "xyes"],
  1701. [AM_CFLAGS="$AM_CFLAGS -DFORCE_FAILURE_RDSEED"])
  1702. ])
  1703. else
  1704. if test "x$ENABLED_FORTRESS" = "xyes"
  1705. then
  1706. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB"
  1707. fi
  1708. fi
  1709. AM_CONDITIONAL([BUILD_FIPS], [test "x$ENABLED_FIPS" = "xyes"])
  1710. AM_CONDITIONAL([BUILD_FIPS_V2], [test "x$FIPS_VERSION" = "xv2"])
  1711. AM_CONDITIONAL([BUILD_CMAC], [test "x$ENABLED_CMAC" = "xyes"])
  1712. # SELFTEST
  1713. AC_ARG_ENABLE([selftest],
  1714. [AS_HELP_STRING([--enable-selftest],[Enable selftest, Will NOT work w/o CAVP selftest license (default: disabled)])],
  1715. [ ENABLED_SELFTEST=$enableval ],
  1716. [ ENABLED_SELFTEST=no ]
  1717. )
  1718. if test "x$ENABLED_SELFTEST" == "xyes"
  1719. then
  1720. AM_CFLAGS="$AM_CFLAGS -DHAVE_SELFTEST"
  1721. fi
  1722. AM_CONDITIONAL([BUILD_SELFTEST], [test "x$ENABLED_SELFTEST" = "xyes"])
  1723. # set sha224 default
  1724. SHA224_DEFAULT=no
  1725. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64"
  1726. then
  1727. if test "x$ENABLED_FIPS" = "xno" || test "x$FIPS_VERSION" = "xv2"
  1728. then
  1729. SHA224_DEFAULT=yes
  1730. fi
  1731. fi
  1732. # SHA224
  1733. AC_ARG_ENABLE([sha224],
  1734. [AS_HELP_STRING([--enable-sha224],[Enable wolfSSL SHA-224 support (default: enabled on x86_64/aarch64)])],
  1735. [ ENABLED_SHA224=$enableval ],
  1736. [ ENABLED_SHA224=$SHA224_DEFAULT ]
  1737. )
  1738. if test "$ENABLED_SHA224" = "yes"
  1739. then
  1740. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA224"
  1741. fi
  1742. AM_CONDITIONAL([BUILD_SHA224], [test "x$ENABLED_SHA224" = "xyes"])
  1743. # set sha3 default
  1744. SHA3_DEFAULT=no
  1745. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64"
  1746. then
  1747. if test "x$ENABLED_FIPS" = "xno" || test "x$FIPS_VERSION" = "xv2"
  1748. then
  1749. SHA3_DEFAULT=yes
  1750. fi
  1751. fi
  1752. # SHA3
  1753. AC_ARG_ENABLE([sha3],
  1754. [AS_HELP_STRING([--enable-sha3],[Enable wolfSSL SHA-3 support (default: enabled on x86_64/aarch64)])],
  1755. [ ENABLED_SHA3=$enableval ],
  1756. [ ENABLED_SHA3=$SHA3_DEFAULT ]
  1757. )
  1758. if test "$ENABLED_SHA3" = "small"
  1759. then
  1760. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3_SMALL"
  1761. ENABLED_SHA3="yes"
  1762. fi
  1763. if test "$ENABLED_SHA3" = "yes" && test "$ENABLED_32BIT" = "no"
  1764. then
  1765. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3"
  1766. fi
  1767. AM_CONDITIONAL([BUILD_SHA3], [test "x$ENABLED_SHA3" = "xyes"])
  1768. # set POLY1305 default
  1769. POLY1305_DEFAULT=yes
  1770. if test "x$ENABLED_FIPS" = "xyes"
  1771. then
  1772. POLY1305_DEFAULT=no
  1773. fi
  1774. # POLY1305
  1775. AC_ARG_ENABLE([poly1305],
  1776. [AS_HELP_STRING([--enable-poly1305],[Enable wolfSSL POLY1305 support (default: enabled)])],
  1777. [ ENABLED_POLY1305=$enableval ],
  1778. [ ENABLED_POLY1305=$POLY1305_DEFAULT]
  1779. )
  1780. # leanpsk and leantls don't need poly1305
  1781. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1782. then
  1783. ENABLED_POLY1305=no
  1784. fi
  1785. if test "$ENABLED_POLY1305" = "yes" && test "$ENABLED_32BIT" = "no"
  1786. then
  1787. AM_CFLAGS="$AM_CFLAGS -DHAVE_POLY1305 -DHAVE_ONE_TIME_AUTH"
  1788. fi
  1789. AM_CONDITIONAL([BUILD_POLY1305], [test "x$ENABLED_POLY1305" = "xyes"])
  1790. # set CHACHA default
  1791. CHACHA_DEFAULT=yes
  1792. if test "x$ENABLED_FIPS" = "xyes"
  1793. then
  1794. CHACHA_DEFAULT=no
  1795. fi
  1796. # CHACHA
  1797. AC_ARG_ENABLE([chacha],
  1798. [AS_HELP_STRING([--enable-chacha],[Enable CHACHA (default: enabled). Use `=noasm` to disable ASM AVX/AVX2 speedups])],
  1799. [ ENABLED_CHACHA=$enableval ],
  1800. [ ENABLED_CHACHA=$CHACHA_DEFAULT]
  1801. )
  1802. # leanpsk and leantls don't need chacha
  1803. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1804. then
  1805. ENABLED_CHACHA=no
  1806. fi
  1807. if test "$ENABLED_CHACHA" = "noasm" || test "$ENABLED_ASM" = "no"
  1808. then
  1809. AM_CFLAGS="$AM_CFLAGS -DNO_CHACHA_ASM"
  1810. fi
  1811. if test "$ENABLED_CHACHA" = "yes"
  1812. then
  1813. AM_CFLAGS="$AM_CFLAGS -DHAVE_CHACHA"
  1814. fi
  1815. AM_CONDITIONAL([BUILD_CHACHA], [test "x$ENABLED_CHACHA" = "xyes"])
  1816. # Hash DRBG
  1817. AC_ARG_ENABLE([hashdrbg],
  1818. [AS_HELP_STRING([--enable-hashdrbg],[Enable Hash DRBG support (default: enabled)])],
  1819. [ ENABLED_HASHDRBG=$enableval ],
  1820. [ ENABLED_HASHDRBG=yes ]
  1821. )
  1822. if test "x$ENABLED_HASHDRBG" = "xyes"
  1823. then
  1824. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  1825. else
  1826. # turn on Hash DRBG if FIPS is on
  1827. if test "x$ENABLED_FIPS" = "xyes"
  1828. then
  1829. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  1830. ENABLED_HASHDRBG=yes
  1831. else
  1832. AM_CFLAGS="$AM_CFLAGS -DWC_NO_HASHDRBG"
  1833. fi
  1834. fi
  1835. # Filesystem Build
  1836. AC_ARG_ENABLE([filesystem],
  1837. [AS_HELP_STRING([--enable-filesystem],[Enable Filesystem support (default: enabled)])],
  1838. [ ENABLED_FILESYSTEM=$enableval ],
  1839. [ ENABLED_FILESYSTEM=yes ]
  1840. )
  1841. if test "$ENABLED_FILESYSTEM" = "no"
  1842. then
  1843. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  1844. else
  1845. # turn off filesystem if leanpsk on
  1846. if test "$ENABLED_LEANPSK" = "yes"
  1847. then
  1848. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  1849. ENABLED_FILESYSTEM=no
  1850. fi
  1851. fi
  1852. # inline Build
  1853. AC_ARG_ENABLE([inline],
  1854. [AS_HELP_STRING([--enable-inline],[Enable inline functions (default: enabled)])],
  1855. [ ENABLED_INLINE=$enableval ],
  1856. [ ENABLED_INLINE=yes ]
  1857. )
  1858. if test "$ENABLED_INLINE" = "no"
  1859. then
  1860. AM_CFLAGS="$AM_CFLAGS -DNO_INLINE"
  1861. fi
  1862. AM_CONDITIONAL([BUILD_INLINE], [test "x$ENABLED_INLINE" = "xyes"])
  1863. # OCSP
  1864. AC_ARG_ENABLE([ocsp],
  1865. [AS_HELP_STRING([--enable-ocsp],[Enable OCSP (default: disabled)])],
  1866. [ ENABLED_OCSP=$enableval ],
  1867. [ ENABLED_OCSP=no ],
  1868. )
  1869. if test "x$ENABLED_OPENSSLALL" = "xyes" || test "x$ENABLED_NGINX" = "xyes"
  1870. then
  1871. ENABLED_OCSP=yes
  1872. fi
  1873. if test "$ENABLED_OCSP" = "yes"
  1874. then
  1875. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1876. fi
  1877. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1878. if test "$ENABLED_OCSP" = "yes"
  1879. then
  1880. # check openssl command tool for testing ocsp
  1881. AC_CHECK_PROG([HAVE_OPENSSL_CMD],[openssl],[yes],[no])
  1882. if test "$HAVE_OPENSSL_CMD" = "yes"
  1883. then
  1884. AM_CFLAGS="$AM_CFLAGS -DHAVE_OPENSSL_CMD"
  1885. else
  1886. AC_MSG_WARN([openssl command line tool not available for testing ocsp])
  1887. fi
  1888. fi
  1889. # Certificate Status Request : a.k.a. OCSP Stapling
  1890. AC_ARG_ENABLE([ocspstapling],
  1891. [AS_HELP_STRING([--enable-ocspstapling],[Enable OCSP Stapling (default: disabled)])],
  1892. [ ENABLED_CERTIFICATE_STATUS_REQUEST=$enableval ],
  1893. [ ENABLED_CERTIFICATE_STATUS_REQUEST=no ]
  1894. )
  1895. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes"
  1896. then
  1897. ENABLED_CERTIFICATE_STATUS_REQUEST="yes"
  1898. fi
  1899. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"
  1900. then
  1901. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST"
  1902. # Requires OCSP make sure on
  1903. if test "x$ENABLED_OCSP" = "xno"
  1904. then
  1905. ENABLED_OCSP="yes"
  1906. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1907. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1908. fi
  1909. fi
  1910. AM_CONDITIONAL([BUILD_OCSP_STAPLING], [test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"])
  1911. # Certificate Status Request v2 : a.k.a. OCSP stapling v2
  1912. AC_ARG_ENABLE([ocspstapling2],
  1913. [AS_HELP_STRING([--enable-ocspstapling2],[Enable OCSP Stapling v2 (default: disabled)])],
  1914. [ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=$enableval ],
  1915. [ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=no ]
  1916. )
  1917. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes"
  1918. then
  1919. ENABLED_CERTIFICATE_STATUS_REQUEST_V2=yes
  1920. fi
  1921. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"
  1922. then
  1923. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST_V2"
  1924. # Requires OCSP make sure on
  1925. if test "x$ENABLED_OCSP" = "xno"
  1926. then
  1927. ENABLED_OCSP="yes"
  1928. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1929. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1930. fi
  1931. fi
  1932. AM_CONDITIONAL([BUILD_OCSP_STAPLING_V2], [test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"])
  1933. # CRL
  1934. AC_ARG_ENABLE([crl],
  1935. [AS_HELP_STRING([--enable-crl],[Enable CRL (default: disabled)])],
  1936. [ ENABLED_CRL=$enableval ],
  1937. [ ENABLED_CRL=no ],
  1938. )
  1939. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes"
  1940. then
  1941. ENABLED_CRL=yes
  1942. fi
  1943. if test "$ENABLED_CRL" = "yes"
  1944. then
  1945. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  1946. fi
  1947. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  1948. # CRL Monitor
  1949. AC_ARG_ENABLE([crl-monitor],
  1950. [AS_HELP_STRING([--enable-crl-monitor],[Enable CRL Monitor (default: disabled)])],
  1951. [ ENABLED_CRL_MONITOR=$enableval ],
  1952. [ ENABLED_CRL_MONITOR=no ],
  1953. )
  1954. if test "$ENABLED_CRL_MONITOR" = "yes"
  1955. then
  1956. case $host_os in
  1957. *linux* | *darwin* | *freebsd*)
  1958. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;;
  1959. *)
  1960. if test "x$ENABLED_DISTRO" = "xyes" ; then
  1961. ENABLED_CRL_MONITOR="no"
  1962. else
  1963. AC_MSG_ERROR( [crl monitor only allowed on linux, OS X, or freebsd])
  1964. fi
  1965. break;;
  1966. esac
  1967. fi
  1968. AM_CONDITIONAL([BUILD_CRL_MONITOR], [test "x$ENABLED_CRL_MONITOR" = "xyes"])
  1969. # USER CRYPTO
  1970. ENABLED_USER_CRYPTO="no"
  1971. ENABLED_USER_RSA="no"
  1972. AC_DEFINE([BUILD_USER_RSA], [], [User RSA is being defined])
  1973. trycryptodir=""
  1974. AC_ARG_WITH([user-crypto],
  1975. [AS_HELP_STRING([--with-user-crypto=PATH],[Path to USER_CRYPTO install (default /usr/local)])],
  1976. [
  1977. CPPFLAGS="$CPPFLAGS -DHAVE_USER_CRYPTO"
  1978. LIBS="$LIBS -lusercrypto"
  1979. if test "x$withval" != "xno" ; then
  1980. trycryptodir=$withval
  1981. fi
  1982. if test "x$withval" == "xyes" ; then
  1983. trycryptodir="/usr/local"
  1984. fi
  1985. LDFLAGS="$LDFLAGS -L$trycryptodir/lib"
  1986. CPPFLAGS="$CPPFLAGS -I$trycryptodir/include"
  1987. #Look for RSA Init function in usercrypto lib
  1988. AC_CHECK_LIB([usercrypto], [wc_InitRsaKey], [user_rsa_linked=yes], [user_rsa_linked=no])
  1989. if test "x$user_rsa_linked" == "xyes" ; then
  1990. AC_MSG_NOTICE([User user_rsa.h being used])
  1991. AM_CFLAGS="$AM_CFLAGS -DHAVE_USER_RSA"
  1992. ENABLED_USER_RSA=yes
  1993. ENABLED_USER_CRYPTO=yes
  1994. fi
  1995. #Display check and find result of link attempts
  1996. AC_MSG_CHECKING([for USER_CRYPTO])
  1997. if test "x$ENABLED_USER_CRYPTO" == "xno" ; then
  1998. AC_MSG_RESULT([no])
  1999. AC_MSG_ERROR([USER_CRYPTO not found. Either move to /usr/include and /usr/lib or
  2000. Specify its path using --with-user-crypto=/dir/])
  2001. else
  2002. AC_MSG_RESULT([yes])
  2003. # Check if .la is available if not then rely on exported path
  2004. AC_CHECK_FILE($trycryptodir/lib/libusercrypto.la, [LIB_ADD="$trycryptodir/lib/libusercrypto.la $LIB_ADD"], [LIB_ADD="-lusercrypto $LIB_ADD"])
  2005. AM_LDFLAGS="$AM_LDFLAGS -L$trycryptodir/lib"
  2006. AM_CFLAGS="$AM_CFLAGS -DHAVE_USER_CRYPTO"
  2007. fi
  2008. ]
  2009. )
  2010. AM_CONDITIONAL([BUILD_USER_RSA], [test "x$ENABLED_USER_RSA" == "xyes"] )
  2011. AM_CONDITIONAL([BUILD_USER_CRYPTO], [test "x$ENABLED_USER_CRYPTO" = "xyes"])
  2012. if test "$ENABLED_USER_CRYPTO" = "yes" && test "$ENABLED_FIPS" = "yes"
  2013. then
  2014. AC_MSG_ERROR([cannot enable user crypto and fips, user crypto posibility of using code in fips boundary.])
  2015. fi
  2016. # NTRU
  2017. ENABLED_NTRU="no"
  2018. tryntrudir=""
  2019. AC_ARG_WITH([ntru],
  2020. [AS_HELP_STRING([--with-ntru=PATH],[Path to NTRU install (default /usr/)])],
  2021. [
  2022. AC_MSG_CHECKING([for NTRU])
  2023. CPPFLAGS="$CPPFLAGS -DHAVE_NTRU -DHAVE_TLS_EXTENSIONS"
  2024. LIBS="$LIBS -lntruencrypt"
  2025. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libntruencrypt/ntru_crypto_drbg.h>]], [[ ntru_crypto_drbg_instantiate(0, 0, 0, 0, 0); ]])], [ ntru_linked=yes ],[ ntru_linked=no ])
  2026. if test "x$ntru_linked" == "xno" ; then
  2027. if test "x$withval" != "xno" ; then
  2028. tryntrudir=$withval
  2029. fi
  2030. if test "x$withval" == "xyes" ; then
  2031. tryntrudir="/usr"
  2032. fi
  2033. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$tryntrudir/lib"
  2034. CPPFLAGS="$CPPFLAGS -I$tryntrudir/include"
  2035. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libntruencrypt/ntru_crypto_drbg.h>]], [[ ntru_crypto_drbg_instantiate(0, 0, 0, 0, 0); ]])], [ ntru_linked=yes ],[ ntru_linked=no ])
  2036. if test "x$ntru_linked" == "xno" ; then
  2037. AC_MSG_ERROR([NTRU isn't found.
  2038. If it's already installed, specify its path using --with-ntru=/dir/])
  2039. fi
  2040. AC_MSG_RESULT([yes])
  2041. AM_LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
  2042. else
  2043. AC_MSG_RESULT([yes])
  2044. fi
  2045. AM_CFLAGS="$AM_CFLAGS -DHAVE_NTRU -DHAVE_TLS_EXTENSIONS"
  2046. ENABLED_NTRU="yes"
  2047. ]
  2048. )
  2049. AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
  2050. # QSH
  2051. AC_ARG_ENABLE([qsh],
  2052. [AS_HELP_STRING([--enable-qsh],[Enable QSH (default: disabled)])],
  2053. [ ENABLED_QSH=$enableval ],
  2054. [ ENABLED_QSH=no ]
  2055. )
  2056. if test "x$ENABLED_QSH" = "xyes"
  2057. then
  2058. if test "x$ENABLED_NTRU" = "xno"
  2059. then
  2060. AC_MSG_ERROR([cannot enable qsh without NTRU])
  2061. fi
  2062. AM_CFLAGS="$AM_CFLAGS -DHAVE_QSH"
  2063. fi
  2064. # Whitewood netRandom client library
  2065. ENABLED_WNR="no"
  2066. trywnrdir=""
  2067. AC_ARG_WITH([wnr],
  2068. [AS_HELP_STRING([--with-wnr=PATH],[Path to Whitewood netRandom install (default /usr/local)])],
  2069. [
  2070. AC_MSG_CHECKING([for Whitewood netRandom])
  2071. CPPFLAGS="$CPPFLAGS -DHAVE_WNR"
  2072. LIBS="$LIBS -lwnr"
  2073. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wnr.h>]], [[ wnr_setup(0, 0); ]])], [ wnr_linked=yes ],[ wnr_linked=no ])
  2074. if test "x$wnr_linked" == "xno" ; then
  2075. if test "x$withval" != "xno" ; then
  2076. trywnrdir=$withval
  2077. fi
  2078. if test "x$withval" == "xyes" ; then
  2079. trywnrdir="/usr/local"
  2080. fi
  2081. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$trywnrdir/lib"
  2082. CPPFLAGS="$CPPFLAGS -I$trywnrdir/include"
  2083. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wnr.h>]], [[ wnr_setup(0, 0); ]])], [ wnr_linked=yes ],[ wnr_linked=no ])
  2084. if test "x$wnr_linked" == "xno" ; then
  2085. AC_MSG_ERROR([Whitewood netRandom isn't found.
  2086. If it's already installed, specify its path using --with-wnr=/dir/])
  2087. fi
  2088. AC_MSG_RESULT([yes])
  2089. AM_LDFLAGS="$AM_LDFLAGS -L$trywnrdir/lib"
  2090. else
  2091. AC_MSG_RESULT([yes])
  2092. fi
  2093. AM_CFLAGS="$AM_CFLAGS -DHAVE_WNR"
  2094. ENABLED_WNR="yes"
  2095. ]
  2096. )
  2097. AM_CONDITIONAL([BUILD_WNR], [test "x$ENABLED_WNR" = "xyes"])
  2098. # SNI
  2099. AC_ARG_ENABLE([sni],
  2100. [AS_HELP_STRING([--enable-sni],[Enable SNI (default: disabled)])],
  2101. [ ENABLED_SNI=$enableval ],
  2102. [ ENABLED_SNI=no ]
  2103. )
  2104. if test "x$ENABLED_SNI" = "xyes"
  2105. then
  2106. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  2107. fi
  2108. # Maximum Fragment Length
  2109. AC_ARG_ENABLE([maxfragment],
  2110. [AS_HELP_STRING([--enable-maxfragment],[Enable Maximum Fragment Length (default: disabled)])],
  2111. [ ENABLED_MAX_FRAGMENT=$enableval ],
  2112. [ ENABLED_MAX_FRAGMENT=no ]
  2113. )
  2114. # ALPN
  2115. AC_ARG_ENABLE([alpn],
  2116. [AS_HELP_STRING([--enable-alpn],[Enable ALPN (default: disabled)])],
  2117. [ ENABLED_ALPN=$enableval ],
  2118. [ ENABLED_ALPN=no ]
  2119. )
  2120. if test "x$ENABLED_ALPN" = "xyes"
  2121. then
  2122. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
  2123. fi
  2124. # Maximum Fragment Length
  2125. if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
  2126. then
  2127. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
  2128. fi
  2129. # Truncated HMAC
  2130. AC_ARG_ENABLE([truncatedhmac],
  2131. [AS_HELP_STRING([--enable-truncatedhmac],[Enable Truncated HMAC (default: disabled)])],
  2132. [ ENABLED_TRUNCATED_HMAC=$enableval ],
  2133. [ ENABLED_TRUNCATED_HMAC=no ]
  2134. )
  2135. if test "x$ENABLED_TRUNCATED_HMAC" = "xyes"
  2136. then
  2137. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUNCATED_HMAC"
  2138. fi
  2139. # Renegotiation Indication - (FAKE Secure Renegotiation)
  2140. AC_ARG_ENABLE([renegotiation-indication],
  2141. [AS_HELP_STRING([--enable-renegotiation-indication],[Enable Renegotiation Indication (default: disabled)])],
  2142. [ ENABLED_RENEGOTIATION_INDICATION=$enableval ],
  2143. [ ENABLED_RENEGOTIATION_INDICATION=no ]
  2144. )
  2145. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  2146. then
  2147. AM_CFLAGS="$AM_CFLAGS -DHAVE_RENEGOTIATION_INDICATION"
  2148. fi
  2149. # Secure Renegotiation
  2150. AC_ARG_ENABLE([secure-renegotiation],
  2151. [AS_HELP_STRING([--enable-secure-renegotiation],[Enable Secure Renegotiation (default: disabled)])],
  2152. [ ENABLED_SECURE_RENEGOTIATION=$enableval ],
  2153. [ ENABLED_SECURE_RENEGOTIATION=no ]
  2154. )
  2155. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xyes"
  2156. then
  2157. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  2158. then
  2159. AC_MSG_ERROR([cannot enable renegotiation-indication and secure-renegotiation.])
  2160. fi
  2161. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION"
  2162. fi
  2163. # Supported Elliptic Curves Extensions
  2164. AC_ARG_ENABLE([supportedcurves],
  2165. [AS_HELP_STRING([--enable-supportedcurves],[Enable Supported Elliptic Curves (default: enabled)])],
  2166. [ENABLED_SUPPORTED_CURVES=$enableval],
  2167. [ENABLED_SUPPORTED_CURVES=yes])
  2168. if test "x$ENABLED_SUPPORTED_CURVES" = "xyes"
  2169. then
  2170. AS_IF([test "x$ENABLED_ECC" = "xno"],
  2171. [ENABLED_SUPPORTED_CURVES=no],
  2172. [AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES"])
  2173. fi
  2174. # Session Ticket Extension
  2175. AC_ARG_ENABLE([session-ticket],
  2176. [AS_HELP_STRING([--enable-session-ticket],[Enable Session Ticket (default: disabled)])],
  2177. [ ENABLED_SESSION_TICKET=$enableval ],
  2178. [ ENABLED_SESSION_TICKET=no ]
  2179. )
  2180. if test "x$ENABLED_NGINX" = "xyes" || test "$ENABLED_WPAS" = "yes" || test "x$ENABLED_HAPROXY" = "xyes"
  2181. then
  2182. ENABLED_SESSION_TICKET=yes
  2183. fi
  2184. if test "x$ENABLED_SESSION_TICKET" = "xyes"
  2185. then
  2186. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
  2187. fi
  2188. # Extended Master Secret Extension
  2189. AC_ARG_ENABLE([extended-master],
  2190. [AS_HELP_STRING([--enable-extended-master],[Enable Extended Master Secret (default: enabled)])],
  2191. [ ENABLED_EXTENDED_MASTER=$enableval ],
  2192. [ ENABLED_EXTENDED_MASTER=yes ]
  2193. )
  2194. if test "x$ENABLED_EXTENDED_MASTER" = "xyes"
  2195. then
  2196. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXTENDED_MASTER"
  2197. fi
  2198. # TLS Extensions
  2199. AC_ARG_ENABLE([tlsx],
  2200. [AS_HELP_STRING([--enable-tlsx],[Enable all TLS Extensions (default: disabled)])],
  2201. [ ENABLED_TLSX=$enableval ],
  2202. [ ENABLED_TLSX=no ]
  2203. )
  2204. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_SIGNAL" = "xyes"
  2205. then
  2206. ENABLED_TLSX=yes
  2207. fi
  2208. if test "x$ENABLED_TLSX" = "xyes"
  2209. then
  2210. ENABLED_SNI=yes
  2211. ENABLED_MAX_FRAGMENT=yes
  2212. ENABLED_TRUNCATED_HMAC=yes
  2213. ENABLED_ALPN=yes
  2214. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_ALPN"
  2215. # Check the ECC supported curves prereq
  2216. AS_IF([test "x$ENABLED_ECC" = "xyes"],
  2217. [ENABLED_SUPPORTED_CURVES=yes
  2218. AM_CFLAGS="$AM_CFLAGS -DHAVE_SUPPORTED_CURVES"])
  2219. fi
  2220. # Early Data handshake in TLS v1.3 and above
  2221. AC_ARG_ENABLE([earlydata],
  2222. [AS_HELP_STRING([--enable-earlydata],[Enable Early Data handshake with wolfSSL TLS v1.3 (default: disabled)])],
  2223. [ ENABLED_TLS13_EARLY_DATA=$enableval ],
  2224. [ ENABLED_TLS13_EARLY_DATA=no ]
  2225. )
  2226. if test "$ENABLED_TLS13_EARLY_DATA" = "yes"
  2227. then
  2228. if test "x$ENABLED_TLS13" = "xno"
  2229. then
  2230. AC_MSG_ERROR([cannot enable earlydata without enabling tls13.])
  2231. fi
  2232. if test "x$ENABLED_SESSION_TICKET" = "xno" && test "x$ENABLED_PSK" = "xno"
  2233. then
  2234. AC_MSG_ERROR([cannot enable earlydata without enabling session tickets and/or PSK.])
  2235. fi
  2236. AM_CFLAGS="-DWOLFSSL_EARLY_DATA $AM_CFLAGS"
  2237. fi
  2238. # PKCS7
  2239. AC_ARG_ENABLE([pkcs7],
  2240. [AS_HELP_STRING([--enable-pkcs7],[Enable PKCS7 (default: disabled)])],
  2241. [ ENABLED_PKCS7=$enableval ],
  2242. [ ENABLED_PKCS7=no ],
  2243. )
  2244. # wolfSSH Options
  2245. AC_ARG_ENABLE([ssh],
  2246. [AS_HELP_STRING([--enable-ssh],[Enable wolfSSH options (default: disabled)])],
  2247. [ ENABLED_WOLFSSH=$enableval ],
  2248. [ ENABLED_WOLFSSH=no ]
  2249. )
  2250. # Simple Certificate Enrollment Protocol (SCEP)
  2251. AC_ARG_ENABLE([scep],
  2252. [AS_HELP_STRING([--enable-scep],[Enable wolfSCEP (default: disabled)])],
  2253. [ ENABLED_WOLFSCEP=$enableval ],
  2254. [ ENABLED_WOLFSCEP=no ]
  2255. )
  2256. # Secure Remote Password
  2257. AC_ARG_ENABLE([srp],
  2258. [AS_HELP_STRING([--enable-srp],[Enable Secure Remote Password (default: disabled)])],
  2259. [ ENABLED_SRP=$enableval ],
  2260. [ ENABLED_SRP=no ]
  2261. )
  2262. if test "x$ENABLED_SRP" = "xyes"
  2263. then
  2264. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_SRP"
  2265. fi
  2266. AM_CONDITIONAL([BUILD_SRP], [test "x$ENABLED_SRP" = "xyes"])
  2267. # Indefinite length encoded BER message support
  2268. AC_ARG_ENABLE([indef],
  2269. [AS_HELP_STRING([--enable-indef],[Enable parsing of indefinite length encoded msgs (default: disabled)])],
  2270. [ ENABLED_BER_INDEF=$enableval ],
  2271. [ ENABLED_BER_INDEF=no ]
  2272. )
  2273. if test "x$ENABLED_BER_INDEF" = "xyes"
  2274. then
  2275. AM_CFLAGS="$AM_CFLAGS -DASN_BER_TO_DER"
  2276. fi
  2277. # Small Stack
  2278. AC_ARG_ENABLE([smallstack],
  2279. [AS_HELP_STRING([--enable-smallstack],[Enable Small Stack Usage (default: disabled)])],
  2280. [ ENABLED_SMALL_STACK=$enableval ],
  2281. [ ENABLED_SMALL_STACK=no ]
  2282. )
  2283. if test "x$ENABLED_SMALL_STACK" = "xyes"
  2284. then
  2285. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SMALL_STACK"
  2286. fi
  2287. #valgrind
  2288. AC_ARG_ENABLE([valgrind],
  2289. [AS_HELP_STRING([--enable-valgrind],[Enable valgrind for unit tests (default: disabled)])],
  2290. [ ENABLED_VALGRIND=$enableval ],
  2291. [ ENABLED_VALGRIND=no ]
  2292. )
  2293. if test "$ENABLED_VALGRIND" = "yes"
  2294. then
  2295. AC_CHECK_PROG([HAVE_VALGRIND],[valgrind],[yes],[no])
  2296. if test "$HAVE_VALGRIND" = "no"
  2297. then
  2298. AC_MSG_ERROR([Valgrind not found.])
  2299. fi
  2300. enable_shared=no
  2301. enable_static=yes
  2302. AM_CFLAGS="$AM_CFLAGS -DHAVE_VALGRIND"
  2303. fi
  2304. AM_CONDITIONAL([USE_VALGRIND], [test "x$ENABLED_VALGRIND" = "xyes"])
  2305. # Test certs, use internal cert functions for extra testing
  2306. AC_ARG_ENABLE([testcert],
  2307. [AS_HELP_STRING([--enable-testcert],[Enable Test Cert (default: disabled)])],
  2308. [ ENABLED_TESTCERT=$enableval ],
  2309. [ ENABLED_TESTCERT=no ]
  2310. )
  2311. if test "$ENABLED_TESTCERT" = "yes"
  2312. then
  2313. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TEST_CERT"
  2314. fi
  2315. # I/O Pool, an example to show user how to override memory handler and use
  2316. # a pool for the input/output buffer requests
  2317. AC_ARG_ENABLE([iopool],
  2318. [AS_HELP_STRING([--enable-iopool],[Enable I/O Pool example (default: disabled)])],
  2319. [ ENABLED_IOPOOL=$enableval ],
  2320. [ ENABLED_IOPOOL=no ]
  2321. )
  2322. if test "$ENABLED_IOPOOL" = "yes"
  2323. then
  2324. if test "$thread_ls_on" = "no"
  2325. then
  2326. AC_MSG_ERROR([I/O Pool example requires Thread Local Storage])
  2327. fi
  2328. AM_CFLAGS="$AM_CFLAGS -DHAVE_IO_POOL -DXMALLOC_USER"
  2329. fi
  2330. # Certificate Service Support
  2331. AC_ARG_ENABLE([certservice],
  2332. [AS_HELP_STRING([--enable-certservice],[Enable cert service (default: disabled)])],
  2333. [ ENABLED_CERT_SERVICE=$enableval ],
  2334. [ ENABLED_CERT_SERVICE=no ]
  2335. )
  2336. if test "$ENABLED_CERT_SERVICE" = "yes"
  2337. then
  2338. # Requires ecc,certgen, and opensslextra make sure on
  2339. if test "x$ENABLED_CERTGEN" = "xno"
  2340. then
  2341. ENABLED_CERTGEN="yes"
  2342. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  2343. fi
  2344. if test "x$ENABLED_ECC" = "xno"
  2345. then
  2346. ENABLED_ECC="yes"
  2347. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  2348. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  2349. if test "$ENABLED_ECC_SHAMIR" = "yes"
  2350. then
  2351. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  2352. fi
  2353. fi
  2354. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  2355. then
  2356. ENABLED_OPENSSLEXTRA="yes"
  2357. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  2358. fi
  2359. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_CERT_SERVICE"
  2360. fi
  2361. # wolfSSL JNI
  2362. AC_ARG_ENABLE([jni],
  2363. [AS_HELP_STRING([--enable-jni],[Enable wolfSSL JNI (default: disabled)])],
  2364. [ ENABLED_JNI=$enableval ],
  2365. [ ENABLED_JNI=no ]
  2366. )
  2367. if test "$ENABLED_JNI" = "yes"
  2368. then
  2369. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_JNI"
  2370. # Enable prereqs if not already enabled
  2371. if test "x$ENABLED_DTLS" = "xno"
  2372. then
  2373. ENABLED_DTLS="yes"
  2374. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS"
  2375. fi
  2376. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  2377. then
  2378. ENABLED_OPENSSLEXTRA="yes"
  2379. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  2380. fi
  2381. if test "x$ENABLED_CRL" = "xno"
  2382. then
  2383. ENABLED_CRL="yes"
  2384. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  2385. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  2386. fi
  2387. if test "x$ENABLED_OCSP" = "xno"
  2388. then
  2389. ENABLED_OCSP="yes"
  2390. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  2391. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  2392. fi
  2393. if test "x$ENABLED_CRL_MONITOR" = "xno" && test "x$ENABLED_DISTRO" = "xno"
  2394. then
  2395. ENABLED_CRL_MONITOR="yes"
  2396. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR"
  2397. fi
  2398. if test "x$ENABLED_SAVESESSION" = "xno"
  2399. then
  2400. ENABLED_SAVESESSION="yes"
  2401. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  2402. fi
  2403. if test "x$ENABLED_SAVECERT" = "xno"
  2404. then
  2405. ENABLED_SAVECERT="yes"
  2406. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  2407. fi
  2408. if test "x$ENABLED_ATOMICUSER" = "xno"
  2409. then
  2410. ENABLED_ATOMICUSER="yes"
  2411. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  2412. fi
  2413. if test "x$ENABLED_ECC" = "xno"
  2414. then
  2415. ENABLED_ECC="yes"
  2416. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  2417. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  2418. if test "$ENABLED_ECC_SHAMIR" = "yes"
  2419. then
  2420. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  2421. fi
  2422. fi
  2423. if test "x$ENABLED_PKCALLBACKS" = "xno"
  2424. then
  2425. ENABLED_PKCALLBACKS="yes"
  2426. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  2427. fi
  2428. if test "x$ENABLED_DH" = "xno"
  2429. then
  2430. ENABLED_DH="yes"
  2431. AM_CFLAGS="$AM_CFLAGS -DHAVE_DH"
  2432. fi
  2433. if test "x$ENABLED_PSK" = "xno"
  2434. then
  2435. ENABLED_PSK="yes"
  2436. fi
  2437. fi
  2438. # lighty Support
  2439. AC_ARG_ENABLE([lighty],
  2440. [AS_HELP_STRING([--enable-lighty],[Enable lighttpd/lighty (default: disabled)])],
  2441. [ ENABLED_LIGHTY=$enableval ],
  2442. [ ENABLED_LIGHTY=no ]
  2443. )
  2444. if test "$ENABLED_LIGHTY" = "yes"
  2445. then
  2446. # Requires opensslextra make sure on
  2447. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  2448. then
  2449. ENABLED_OPENSSLEXTRA="yes"
  2450. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  2451. fi
  2452. AM_CFLAGS="$AM_CFLAGS -DHAVE_LIGHTY -DHAVE_WOLFSSL_SSL_H=1"
  2453. fi
  2454. if test "$ENABLED_NGINX" = "yes"
  2455. then
  2456. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NGINX"
  2457. fi
  2458. if test "$ENABLED_HAPROXY" = "yes"
  2459. then
  2460. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAPROXY"
  2461. # Requires opensslextra make sure on
  2462. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  2463. then
  2464. ENABLED_OPENSSLEXTRA="yes"
  2465. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  2466. fi
  2467. fi
  2468. if test "$ENABLED_SIGNAL" = "yes"
  2469. then
  2470. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SIGNAL"
  2471. # Requires opensslextra make sure on
  2472. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  2473. then
  2474. ENABLED_OPENSSLEXTRA="yes"
  2475. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  2476. fi
  2477. fi
  2478. if test "$ENABLED_NGINX" = "yes"|| test "x$ENABLED_HAPROXY" = "xyes"
  2479. then
  2480. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_VERIFY_CB"
  2481. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  2482. AM_CFLAGS="$AM_CFLAGS -DKEEP_OUR_CERT -DKEEP_PEER_CERT"
  2483. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE -DHAVE_EX_DATA"
  2484. fi
  2485. # stunnel Support
  2486. AC_ARG_ENABLE([stunnel],
  2487. [AS_HELP_STRING([--enable-stunnel],[Enable stunnel (default: disabled)])],
  2488. [ ENABLED_STUNNEL=$enableval ],
  2489. [ ENABLED_STUNNEL=no ]
  2490. )
  2491. if test "$ENABLED_WPAS" = "yes"
  2492. then
  2493. ENABLED_STUNNEL="yes"
  2494. fi
  2495. if test "$ENABLED_STUNNEL" = "yes"
  2496. then
  2497. # Requires opensslextra make sure on
  2498. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  2499. then
  2500. ENABLED_OPENSSLEXTRA="yes"
  2501. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  2502. fi
  2503. # Requires OCSP make sure on
  2504. if test "x$ENABLED_OCSP" = "xno"
  2505. then
  2506. ENABLED_OCSP="yes"
  2507. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  2508. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  2509. fi
  2510. # Requires coding make sure on
  2511. if test "x$ENABLED_CODING" = "xno"
  2512. then
  2513. ENABLED_CODING="yes"
  2514. fi
  2515. # Requires sessioncerts make sure on
  2516. if test "x$ENABLED_SESSIONCERTS" = "xno"
  2517. then
  2518. ENABLED_SESSIONCERTS="yes"
  2519. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  2520. fi
  2521. # Requires crls, make sure on
  2522. if test "x$ENABLED_CRL" = "xno"
  2523. then
  2524. ENABLED_CRL="yes"
  2525. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  2526. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  2527. fi
  2528. # Requires DES3, make sure on
  2529. if test "x$ENABLED_DES3" = "xno"
  2530. then
  2531. ENABLED_DES3="yes"
  2532. fi
  2533. # Requires tlsx, make sure on
  2534. if test "x$ENABLED_TLSX" = "xno"
  2535. then
  2536. ENABLED_TLSX="yes"
  2537. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC"
  2538. # Check the ECC supported curves prereq
  2539. AS_IF([test "x$ENABLED_ECC" = "xyes"],
  2540. [ENABLED_SUPPORTED_CURVES=yes
  2541. AM_CFLAGS="$AM_CFLAGS -DHAVE_SUPPORTED_CURVES"])
  2542. fi
  2543. # Requires ecc make sure on
  2544. if test "x$ENABLED_ECC" = "xno"
  2545. then
  2546. ENABLED_OPENSSLEXTRA="yes"
  2547. ENABLED_ECC="yes"
  2548. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  2549. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  2550. if test "$ENABLED_ECC_SHAMIR" = "yes"
  2551. then
  2552. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  2553. fi
  2554. fi
  2555. AM_CFLAGS="$AM_CFLAGS -DHAVE_STUNNEL -DWOLFSSL_ALWAYS_VERIFY_CB"
  2556. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI -DHAVE_EX_DATA"
  2557. fi
  2558. if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no" \
  2559. && test "x$ENABLED_STUNNEL" = "xno"
  2560. then
  2561. AM_CFLAGS="$AM_CFLAGS -DNO_PSK"
  2562. fi
  2563. if test "$ENABLED_PSK" = "no" && \
  2564. (test "$ENABLED_LEANPSK" = "yes" || test "x$ENABLED_STUNNEL" = "xyes")
  2565. then
  2566. ENABLED_PSK=yes
  2567. fi
  2568. # MD4
  2569. AC_ARG_ENABLE([md4],
  2570. [AS_HELP_STRING([--enable-md4],[Enable MD4 (default: disabled)])],
  2571. [ ENABLED_MD4=$enableval ],
  2572. [ ENABLED_MD4=no ]
  2573. )
  2574. if test "$ENABLED_MD4" = "no"
  2575. then
  2576. #turn on MD4 if using stunnel
  2577. if test "x$ENABLED_STUNNEL" = "xyes"
  2578. then
  2579. ENABLED_MD4="yes"
  2580. else
  2581. AM_CFLAGS="$AM_CFLAGS -DNO_MD4"
  2582. fi
  2583. fi
  2584. AM_CONDITIONAL([BUILD_MD4], [test "x$ENABLED_MD4" = "xyes"])
  2585. # Encrypted keys
  2586. AC_ARG_ENABLE([enckeys],
  2587. [AS_HELP_STRING([--enable-enckeys],[Enable PEM encrypted private key support (default: disabled)])],
  2588. [ ENABLED_ENCKEYS=$enableval ],
  2589. [ ENABLED_ENCKEYS=no ]
  2590. )
  2591. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_WEBSERVER" = "yes"
  2592. then
  2593. ENABLED_ENCKEYS=yes
  2594. fi
  2595. if test "$ENABLED_ENCKEYS" = "yes"
  2596. then
  2597. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ENCRYPTED_KEYS"
  2598. fi
  2599. # PWDBASED has to come after certservice since we want it on w/o explicit on
  2600. # PWDBASED
  2601. AC_ARG_ENABLE([pwdbased],
  2602. [AS_HELP_STRING([--enable-pwdbased],[Enable PWDBASED (default: disabled)])],
  2603. [ ENABLED_PWDBASED=$enableval ],
  2604. [ ENABLED_PWDBASED=no ]
  2605. )
  2606. if test "$ENABLED_PWDBASED" = "no"
  2607. then
  2608. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_WEBSERVER" = "yes" || test "$ENABLED_ENCKEYS" = "yes"
  2609. then
  2610. # opensslextra, webserver and enckeys needs pwdbased
  2611. ENABLED_PWDBASED=yes
  2612. else
  2613. AM_CFLAGS="$AM_CFLAGS -DNO_PWDBASED"
  2614. fi
  2615. fi
  2616. AM_CONDITIONAL([BUILD_PWDBASED], [test "x$ENABLED_PWDBASED" = "xyes"])
  2617. AC_ARG_ENABLE([scrypt],
  2618. [AS_HELP_STRING([--enable-scrypt],[Enable SCRYPT (default: disabled)])],
  2619. [ ENABLED_SCRYPT=$enableval ],
  2620. [ ENABLED_SCRYPT=no ]
  2621. )
  2622. if test "$ENABLED_SCRYPT" = "yes"
  2623. then
  2624. if test "$ENABLED_PWDBASED" = "no"
  2625. then
  2626. AC_MSG_ERROR([cannot enable scrypt without enabling pwdbased.])
  2627. fi
  2628. AM_CFLAGS="$AM_CFLAGS -DHAVE_SCRYPT"
  2629. fi
  2630. AM_CONDITIONAL([BUILD_SCRYPT], [test "x$ENABLED_SCRYPT" = "xyes"])
  2631. # wolfCrypt Only Build
  2632. AC_ARG_ENABLE([cryptonly],
  2633. [AS_HELP_STRING([--enable-cryptonly],[Enable wolfCrypt Only build (default: disabled)])],
  2634. [ENABLED_CRYPTONLY=$enableval],
  2635. [ENABLED_CRYPTONLY=no])
  2636. if test "$ENABLED_CRYPTONLY" = "yes"
  2637. then
  2638. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_ONLY"
  2639. fi
  2640. AM_CONDITIONAL([BUILD_CRYPTONLY], [test "x$ENABLED_CRYPTONLY" = "xyes"])
  2641. if test "x$ENABLED_CRYPTONLY" = "xno"
  2642. then
  2643. if test "x$ENABLED_PSK" = "xno" && test "x$ENABLED_ASN" = "xno"
  2644. then
  2645. AC_MSG_ERROR([please enable psk if disabling asn.])
  2646. fi
  2647. if test "x$ENABLED_ECC" = "xyes" && test "x$ENABLED_ASN" = "xno"
  2648. then
  2649. AC_MSG_ERROR([please disable ecc if disabling asn.])
  2650. fi
  2651. fi
  2652. # set fastmath default
  2653. FASTMATH_DEFAULT=no
  2654. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64"
  2655. then
  2656. FASTMATH_DEFAULT=yes
  2657. fi
  2658. # fastmath
  2659. AC_ARG_ENABLE([fastmath],
  2660. [AS_HELP_STRING([--enable-fastmath],[Enable fast math ops (default: enabled on x86_64/aarch64)])],
  2661. [ ENABLED_FASTMATH=$enableval ],
  2662. [ ENABLED_FASTMATH=$FASTMATH_DEFAULT]
  2663. )
  2664. if test "x$ENABLED_FASTMATH" = "xyes"
  2665. then
  2666. # turn off fastmth if leanpsk on or asn off (w/o DH and ECC)
  2667. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no"
  2668. then
  2669. if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no"
  2670. then
  2671. ENABLED_FASTMATH=no
  2672. else
  2673. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  2674. ENABLED_SLOWMATH="no"
  2675. fi
  2676. else
  2677. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  2678. ENABLED_SLOWMATH="no"
  2679. fi
  2680. if test "$host_cpu" = "x86_64"
  2681. then
  2682. # Have settings.h set FP_MAX_BITS higher if user didn't set directly
  2683. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_64_BUILD"
  2684. fi
  2685. fi
  2686. # fast HUGE math
  2687. AC_ARG_ENABLE([fasthugemath],
  2688. [AS_HELP_STRING([--enable-fasthugemath],[Enable fast math + huge code (default: disabled)])],
  2689. [ ENABLED_FASTHUGEMATH=$enableval ],
  2690. [ ENABLED_FASTHUGEMATH=no ]
  2691. )
  2692. if test "$ENABLED_BUMP" = "yes"
  2693. then
  2694. ENABLED_FASTHUGEMATH="yes"
  2695. fi
  2696. if test "$ENABLED_FASTHUGEMATH" = "yes"
  2697. then
  2698. ENABLED_FASTMATH="yes"
  2699. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  2700. ENABLED_SLOWMATH="no"
  2701. fi
  2702. AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"])
  2703. AM_CONDITIONAL([BUILD_SLOWMATH], [test "x$ENABLED_SLOWMATH" = "xyes"])
  2704. # Enable Examples, used to disable examples
  2705. AC_ARG_ENABLE([examples],
  2706. [AS_HELP_STRING([--enable-examples],[Enable Examples (default: enabled)])],
  2707. [ ENABLED_EXAMPLES=$enableval ],
  2708. [ ENABLED_EXAMPLES=yes ]
  2709. )
  2710. AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
  2711. AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"])
  2712. AS_IF([test "x$ENABLED_CRYPTONLY" = "xyes"], [ENABLED_EXAMPLES="no"])
  2713. AM_CONDITIONAL([BUILD_EXAMPLE_SERVERS], [test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  2714. AM_CONDITIONAL([BUILD_EXAMPLE_CLIENTS], [test "x$ENABLED_EXAMPLES" = "xyes"])
  2715. AM_CONDITIONAL([BUILD_TESTS], [test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  2716. AM_CONDITIONAL([BUILD_THREADED_EXAMPLES], [test "x$ENABLED_SINGLETHREADED" = "xno" && test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  2717. # Enable wolfCrypt test and benchmark
  2718. AC_ARG_ENABLE([crypttests],
  2719. [AS_HELP_STRING([--enable-crypttests],[Enable Crypt Bench/Test (default: enabled)])],
  2720. [ ENABLED_CRYPT_TESTS=$enableval ],
  2721. [ ENABLED_CRYPT_TESTS=yes ]
  2722. )
  2723. AM_CONDITIONAL([BUILD_WOLFCRYPT_TESTS], [test "x$ENABLED_CRYPT_TESTS" = "xyes"])
  2724. # LIBZ
  2725. ENABLED_LIBZ="no"
  2726. trylibzdir=""
  2727. AC_ARG_WITH([libz],
  2728. [ --with-libz=PATH PATH to libz install (default /usr/) ],
  2729. [
  2730. AC_MSG_CHECKING([for libz])
  2731. CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
  2732. LIBS="$LIBS -lz"
  2733. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  2734. if test "x$libz_linked" == "xno" ; then
  2735. if test "x$withval" != "xno" ; then
  2736. trylibzdir=$withval
  2737. fi
  2738. if test "x$withval" == "xyes" ; then
  2739. trylibzdir="/usr"
  2740. fi
  2741. AM_LDFLAGS="$AM_LDFLAGS -L$trylibzdir/lib"
  2742. CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
  2743. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  2744. if test "x$libz_linked" == "xno" ; then
  2745. AC_MSG_ERROR([libz isn't found.
  2746. If it's already installed, specify its path using --with-libz=/dir/])
  2747. fi
  2748. AC_MSG_RESULT([yes])
  2749. else
  2750. AC_MSG_RESULT([yes])
  2751. fi
  2752. ENABLED_LIBZ="yes"
  2753. ]
  2754. )
  2755. AM_CONDITIONAL([BUILD_LIBZ], [test "x$ENABLED_LIBZ" = "xyes"])
  2756. # cavium
  2757. trycaviumdir=""
  2758. AC_ARG_WITH([cavium],
  2759. [ --with-cavium=PATH PATH to cavium/software dir ],
  2760. [
  2761. AC_MSG_CHECKING([for cavium])
  2762. CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
  2763. LIB_ADD="-lrt $LIB_ADD"
  2764. if test "x$withval" == "xyes" ; then
  2765. AC_MSG_ERROR([need a PATH for --with-cavium])
  2766. fi
  2767. if test "x$withval" != "xno" ; then
  2768. trycaviumdir=$withval
  2769. fi
  2770. LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
  2771. CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
  2772. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
  2773. if test "x$cavium_linked" == "xno" ; then
  2774. AC_MSG_ERROR([cavium isn't found.
  2775. If it's already installed, specify its path using --with-cavium=/dir/])
  2776. else
  2777. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM"
  2778. fi
  2779. AC_MSG_RESULT([yes])
  2780. enable_shared=no
  2781. enable_static=yes
  2782. ENABLED_CAVIUM=yes
  2783. ],
  2784. [ ENABLED_CAVIUM=no ]
  2785. )
  2786. # cavium V
  2787. trycaviumdir=""
  2788. AC_ARG_WITH([cavium-v],
  2789. [ --with-cavium-v=PATH PATH to Cavium V/software dir ],
  2790. [
  2791. AC_MSG_CHECKING([for cavium])
  2792. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM -DHAVE_CAVIUM_V"
  2793. LIB_ADD="-lrt -lcrypto $LIB_ADD"
  2794. if test "x$withval" == "xyes" ; then
  2795. AC_MSG_ERROR([need a PATH for --with-cavium])
  2796. fi
  2797. if test "x$withval" != "xno" ; then
  2798. trycaviumdir=$withval
  2799. fi
  2800. AC_CHECK_FILES([$trycaviumdir/lib/libnitrox.a], [AM_CPPFLAGS="-I$trycaviumdir/include $AM_CPPFLAGS"], [ENABLED_CAVIUM_V=no])
  2801. LIB_STATIC_ADD="$trycaviumdir/lib/libnitrox.a $LIB_STATIC_ADD"
  2802. if test "$ENABLED_CAVIUM_V" = "no"; then
  2803. AC_MSG_ERROR([Could not find Nitrox library])
  2804. fi
  2805. enable_shared=no
  2806. enable_static=yes
  2807. enable_opensslextra=yes
  2808. ENABLED_CAVIUM=yes
  2809. ENABLED_CAVIUM_V=yes
  2810. ],
  2811. [
  2812. ENABLED_CAVIUM_=no
  2813. ENABLED_CAVIUM_V=no
  2814. ]
  2815. )
  2816. AM_CONDITIONAL([BUILD_CAVIUM], [test "x$ENABLED_CAVIUM" = "xyes"])
  2817. AM_CONDITIONAL([BUILD_CAVIUM_V], [test "x$ENABLED_CAVIUM_V" = "xyes"])
  2818. # Intel Quick Assist
  2819. tryqatdir=""
  2820. AC_ARG_WITH([intelqa],
  2821. [ --with-intelqa=PATH PATH to Intel QuickAssit (QAT) driver dir ],
  2822. [
  2823. AC_MSG_CHECKING([for intelqa])
  2824. CPPFLAGS="$CPPFLAGS -DHAVE_INTEL_QA -DDO_CRYPTO -DUSER_SPACE"
  2825. if test "x$withval" == "xyes" ; then
  2826. AC_MSG_ERROR([need a PATH for --with-intelqa])
  2827. fi
  2828. if test "x$withval" != "xno" ; then
  2829. tryqatdir=$withval
  2830. fi
  2831. CPPFLAGS="$CPPFLAGS -I$tryqatdir/quickassist/include -I$tryqatdir/quickassist/include/lac -I$tryqatdir/quickassist/utilities/osal/include -I$tryqatdir/quickassist/utilities/osal/src/linux/user_space/include -I$tryqatdir/quickassist/lookaside/access_layer/include -I$tryqatdir/quickassist/lookaside/access_layer/src/common/include -I$srcdir/wolfssl -I$srcdir/wolfssl/wolfcrypt/port/intel"
  2832. LDFLAGS="$LDFLAGS -L$tryqatdir/build -Wl,-Map=output.map"
  2833. LIBS="$LIBS -licp_qa_al_s"
  2834. LIB_ADD="-ladf_proxy -losal -lrt $LIB_ADD"
  2835. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]], [[ Cpa16U count = 0; cpaCyGetNumInstances(&count); ]])],[ intelqa_linked=yes ],[ intelqa_linked=no ])
  2836. if test "x$intelqa_linked" == "xno" ; then
  2837. AC_MSG_ERROR([Intel QuickAssist not found.
  2838. If it's already installed, specify its path using --with-intelqa=/dir/])
  2839. else
  2840. AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_QA -DDO_CRYPTO -DUSER_SPACE"
  2841. fi
  2842. AC_MSG_RESULT([yes])
  2843. ENABLED_INTEL_QA=yes
  2844. ],
  2845. [
  2846. ENABLED_INTEL_QA=no
  2847. ]
  2848. )
  2849. AM_CONDITIONAL([BUILD_INTEL_QA], [test "x$ENABLED_INTEL_QA" = "xyes"])
  2850. # Single Precision maths implementation
  2851. AC_ARG_ENABLE([sp],
  2852. [AS_HELP_STRING([--enable-sp],[Enable Single Precision maths implementation (default: disabled)])],
  2853. [ ENABLED_SP=$enableval ],
  2854. [ ENABLED_SP=no ],
  2855. )
  2856. ENABLED_SP_RSA=no
  2857. ENABLED_SP_DH=no
  2858. ENABLED_SP_ECC=no
  2859. for v in `echo $ENABLED_SP | tr "," " "`
  2860. do
  2861. case $v in
  2862. small)
  2863. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  2864. ENABLED_SP_RSA=yes
  2865. ENABLED_SP_DH=yes
  2866. ENABLED_SP_ECC=yes
  2867. ;;
  2868. yes)
  2869. ENABLED_SP_RSA=yes
  2870. ENABLED_SP_DH=yes
  2871. ENABLED_SP_ECC=yes
  2872. ;;
  2873. no)
  2874. ;;
  2875. smallec256 | smallp256 | small256)
  2876. ENABLED_SP_ECC=yes
  2877. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  2878. ;;
  2879. ec256 | p256 | 256)
  2880. ENABLED_SP_ECC=yes
  2881. ;;
  2882. small2048)
  2883. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  2884. ENABLED_SP_RSA=yes
  2885. ENABLED_SP_DH=yes
  2886. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_3072"
  2887. ;;
  2888. 2048)
  2889. ENABLED_SP_RSA=yes
  2890. ENABLED_SP_DH=yes
  2891. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_3072"
  2892. ;;
  2893. smallrsa2048)
  2894. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  2895. ENABLED_SP_RSA=yes
  2896. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_3072"
  2897. ;;
  2898. rsa2048)
  2899. ENABLED_SP_RSA=yes
  2900. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_3072"
  2901. ;;
  2902. small3072)
  2903. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  2904. ENABLED_SP_RSA=yes
  2905. ENABLED_SP_DH=yes
  2906. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_2048"
  2907. ;;
  2908. 3072)
  2909. ENABLED_SP_RSA=yes
  2910. ENABLED_SP_DH=yes
  2911. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_2048"
  2912. ;;
  2913. smallrsa3072)
  2914. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  2915. ENABLED_SP_RSA=yes
  2916. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_2048"
  2917. ;;
  2918. rsa3072)
  2919. ENABLED_SP_RSA=yes
  2920. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_2048"
  2921. ;;
  2922. *)
  2923. AC_MSG_ERROR([Invalid choice of Single Precision length in bits [256, 2048, 3072]: $ENABLED_SP.])
  2924. break;;
  2925. esac
  2926. done
  2927. ENABLED_SP=no
  2928. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_SP_RSA" = "yes"; then
  2929. ENABLED_SP=yes
  2930. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_RSA"
  2931. fi
  2932. if test "$ENABLED_DH" = "yes" && test "$ENABLED_SP_DH" = "yes"; then
  2933. ENABLED_SP=yes
  2934. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_DH"
  2935. fi
  2936. if test "$ENABLED_ECC" = "yes" && test "$ENABLED_SP_ECC" = "yes"; then
  2937. ENABLED_SP=yes
  2938. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_ECC"
  2939. fi
  2940. AC_ARG_ENABLE([sp-asm],
  2941. [AS_HELP_STRING([--enable-sp-asm],[Enable Single Precision assembly implementation (default: disabled)])],
  2942. [ ENABLED_SP_ASM=$enableval ],
  2943. [ ENABLED_SP_ASM=no ],
  2944. )
  2945. if test "$ENABLED_SP_ASM" = "yes"; then
  2946. if test "$ENABLED_SP" = "no"; then
  2947. AC_MSG_ERROR([Must have SP enabled: --enable-sp])
  2948. fi
  2949. if test "$ENABLED_ASM" = "no"; then
  2950. AC_MSG_ERROR([Assembly code turned off])
  2951. fi
  2952. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ASM"
  2953. case $host_cpu in
  2954. *aarch64*)
  2955. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM64_ASM"
  2956. ENABLED_SP_ARM64_ASM=yes
  2957. ;;
  2958. *arm*)
  2959. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM32_ASM"
  2960. ENABLED_SP_ARM32_ASM=yes
  2961. ;;
  2962. *x86_64*)
  2963. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_X86_64_ASM"
  2964. ENABLED_SP_X86_64_ASM=yes
  2965. ;;
  2966. *)
  2967. AC_MSG_ERROR([ASM not available for CPU. Supported CPUs: x86_64, aarch64, arm])
  2968. ;;
  2969. esac
  2970. fi
  2971. AC_ARG_ENABLE([sp-math],
  2972. [AS_HELP_STRING([--enable-sp-math],[Enable Single Precision math implementation only (default: disabled)])],
  2973. [ ENABLED_SP_MATH=$enableval ],
  2974. [ ENABLED_SP_MATH=no ],
  2975. )
  2976. if test "$ENABLED_SP_MATH" = "yes"; then
  2977. if test "$ENABLED_SP" = "no"; then
  2978. AC_MSG_ERROR([Must have SP enabled: --enable-sp])
  2979. fi
  2980. if test "$ENABLED_ECCCUSTCURVES" = "yes"; then
  2981. AC_MSG_ERROR([Cannot use single precision math and custom curves])
  2982. fi
  2983. if test "$ENABLED_OPENSSLEXTRA" = "yes"; then
  2984. AC_MSG_ERROR([Cannot use single precision math and OpenSSL extra])
  2985. fi
  2986. if test "$ENABLED_DSA" = "yes"; then
  2987. AC_MSG_ERROR([Cannot use single precision math and DSA])
  2988. fi
  2989. if test "$ENABLED_SRP" = "yes"; then
  2990. AC_MSG_ERROR([Cannot use single precision math and SRP])
  2991. fi
  2992. if test "$ENABLED_SP_RSA" = "no" && test "$ENABLED_RSA" = "yes"; then
  2993. AC_MSG_ERROR([Cannot use P256 single precision only math and RSA])
  2994. fi
  2995. if test "$ENABLED_SP_DH" = "no" && test "$ENABLED_DH" = "yes"; then
  2996. AC_MSG_ERROR([Cannot use P256 single precision only math and DH])
  2997. fi
  2998. fi
  2999. if test "$ENABLED_SP_MATH" = "yes"; then
  3000. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MATH"
  3001. fi
  3002. AM_CONDITIONAL([BUILD_SP], [test "x$ENABLED_SP" = "xyes"])
  3003. AM_CONDITIONAL([BUILD_SP_C], [test "x$ENABLED_SP" = "xyes" && test "x$ENABLED_SP_ASM" = "xno" ])
  3004. AM_CONDITIONAL([BUILD_SP_ARM64], [test "x$ENABLED_SP_ARM64_ASM" = "xyes" ])
  3005. AM_CONDITIONAL([BUILD_SP_ARM32], [test "x$ENABLED_SP_ARM32_ASM" = "xyes" ])
  3006. AM_CONDITIONAL([BUILD_SP_X86_64], [test "x$ENABLED_SP_X86_64_ASM" = "xyes" ])
  3007. AM_CONDITIONAL([BUILD_SP_INT], [test "x$ENABLED_SP_MATH" = "xyes" ])
  3008. # Fast RSA using Intel IPP
  3009. ippdir="${srcdir}/IPP"
  3010. ipplib="lib" # if autoconf guesses 32bit system changes lib directory
  3011. fastRSA_found=no
  3012. abs_path=`pwd`
  3013. # set up variables used
  3014. IPPLIBS=
  3015. IPPHEADERS=
  3016. IPPLINK=
  3017. AC_ARG_ENABLE([fast-rsa],
  3018. [AS_HELP_STRING([--enable-fast-rsa],[Enable RSA using Intel IPP (default: disabled)])],
  3019. [ ENABLED_FAST_RSA=$enableval ],
  3020. [ ENABLED_FAST_RSA=no ],
  3021. )
  3022. if test "$ENABLED_USER_RSA" = "no" && test "$ENABLED_FIPS" = "no"; then
  3023. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  3024. ipplib="lib_32" # 32 bit OS detected
  3025. fi
  3026. # Use static IPP Libraries
  3027. if test "$enable_shared" = "no" && test "$ENABLED_FAST_RSA" = "yes"; then
  3028. case $host_os in
  3029. *darwin*)
  3030. ipplib="$ipplib/mac_static"
  3031. AC_MSG_ERROR([Issue with static linking to libippcp.a on Mac.
  3032. Dynamic IPP libraries supported on Mac])
  3033. break;;
  3034. *linux*)
  3035. ipplib="$ipplib/linux_static"
  3036. break;;
  3037. *)
  3038. ENABLED_FAST_RSA=no
  3039. esac
  3040. AC_CHECK_FILES([$srcdir/IPP/$ipplib/libippcore.a $srcdir/IPP/$ipplib/libippcp.a], [], [ENABLED_FAST_RSA=no])
  3041. AC_CHECK_FILES([$srcdir/IPP/include/ipp.h $srcdir/IPP/include/ippcp.h], [AM_CPPFLAGS="-I$srcdir/IPP/include $AM_CPPFLAGS"], [ENABLED_FAST_RSA=no])
  3042. LIB_STATIC_ADD="$srcdir/IPP/$ipplib/libippcp.a $srcdir/IPP/$ipplib/libippcore.a $LIB_STATIC_ADD"
  3043. if test "$ENABLED_FAST_RSA" = "no"; then
  3044. AC_MSG_ERROR([Could not find fast rsa libraries])
  3045. fi
  3046. else
  3047. # Check for and use bundled IPP libraries
  3048. if test "$ENABLED_FAST_RSA" = "yes"; then
  3049. AC_MSG_NOTICE([Using local IPP crypto library])
  3050. AC_CHECK_FILES([$abs_path/IPP/include/ippcp.h],
  3051. [
  3052. # build and default locations on linux and mac
  3053. STORE_LDFLAGS=${LDFLAGS}
  3054. STORE_CPPFLAGS=${CPPFLAGS}
  3055. # using LDFLAGS instead of AM_ temporarily to test link to library
  3056. LDFLAGS="-L$ippdir/$ipplib -lippcp -lippcore"
  3057. CPPFLAGS="-I$ippdir/include"
  3058. AC_CHECK_HEADERS([ippcp.h], [AC_CHECK_LIB([ippcp], [ippsRSAEncrypt_PKCSv15], [fastRSA_found=yes], [fastRSA_found=no])], [fastRSA_found=no])
  3059. name="$ippdir/$ipplib/libippcp"
  3060. case $host_os in
  3061. *darwin*)
  3062. # check file existence and conditionally set variables
  3063. AC_CHECK_FILES([$abs_path/IPP/$ipplib/libippcp.dylib], [
  3064. IPPLIBS="${name}.dylib ${name}-9.0.dylib ${name}e9-9.0.dylib ${name}g9-9.0.dylib ${name}h9-9.0.dylib ${name}k0-9.0.dylib ${name}l9-9.0.dylib ${name}n8-9.0.dylib ${name}p8-9.0.dylib ${name}s8-9.0.dylib ${name}y8-9.0.dylib IPP/lib/libippcore.dylib IPP/lib/libippcore-9.0.dylib"
  3065. IPPLINK="mkdir -p src/.libs && ln -f ${name}.dylib src/.libs/libippcp.dylib && ln -f ${srcdir}/${name}-9.0.dylib src/.libs/libippcp-9.0.dylib && ln -f ${srcdir}/${name}e9-9.0.dylib src/.libs/libippcpe9-9.0.dylib && ln -f ${srcdir}/${name}g9-9.0.dylib src/.libs/libippcpg9-9.0.dylib && ln -f ${srcdir}/${name}h9-9.0.dylib src/.libs/libippcph9-9.0.dylib && ln -f ${srcdir}/${name}k0-9.0.dylib src/.libs/libippcpk0-9.0.dylib && ln -f ${srcdir}/${name}l9-9.0.dylib src/.libs/libippcpl9-9.0.dylib && ln -f ${srcdir}/${name}n8-9.0.dylib src/.libs/libippcpn8-9.0.dylib && ln -f ${srcdir}/${name}p8-9.0.dylib src/.libs/libippcpp8-9.0.dylib && ln -f ${srcdir}/${name}s8-9.0.dylib src/.libs/libippcps8-9.0.dylib && ln -f ${srcdir}/${name}y8-9.0.dylib src/.libs/libippcpy8-9.0.dylib && ln -f ${srcdir}/IPP/lib/libippcore.dylib src/.libs/libippcore.dylib && ln -f ${srcdir}/IPP/lib/libippcore-9.0.dylib src/.libs/libippcore-9.0.dylib"
  3066. ], [fastRSA_found=no])
  3067. break;;
  3068. *linux*)
  3069. # check file existence and conditionally set variables
  3070. AC_CHECK_FILES([$abs_path/IPP/$ipplib/libippcp.so.9.0], [
  3071. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  3072. IPPLIBS="${name}.so.9.0 ${name}g9.so.9.0 ${name}h9.so.9.0 ${name}p8.so.9.0 ${name}px.so.9.0 ${name}s8.so.9.0 ${name}.so ${name}w7.so.9.0 IPP/$ipplib/libippcore.so IPP/$ipplib/libippcore.so.9.0"
  3073. IPPLINK="mkdir -p src/.libs && ln -f ${name}.so.9.0 src/.libs/libippcp.so.9.0 && ln -f ${name}g9.so.9.0 src/.libs/libippcpg9.so.9.0 && ln -f ${name}h9.so.9.0 src/.libs/libippcph9.so.9.0 && ln -f ${name}p8.so.9.0 src/.libs/libippcpp8.so.9.0 && ln -f ${name}px.so.9.0 src/.libs/libippcppx.so.9.0 && ln -f ${name}s8.so.9.0 src/.libs/libippcps8.so.9.0 && ln -f ${name}.so src/.libs/libippcp.so && ln -f ${name}w7.so.9.0 src/.libs/libippcpw7.so.9.0 && ln -f IPP/$ipplib/libippcore.so src/.libs/libippcore.so && ln -f IPP/$ipplib/libippcore.so.9.0 src/.libs/libippcore.so.9.0"
  3074. else
  3075. IPPLIBS="${name}.so.9.0 ${name}e9.so.9.0 ${name}k0.so.9.0 ${name}l9.so.9.0 ${name}m7.so.9.0 ${name}mx.so.9.0 ${name}.so ${name}n8.so.9.0 ${name}y8.so.9.0 IPP/lib/libippcore.so IPP/lib/libippcore.so.9.0"
  3076. IPPLINK="mkdir -p src/.libs && ln -f ${name}.so.9.0 src/.libs/libippcp.so.9.0 && ln -f ${name}e9.so.9.0 src/.libs/libippcpe9.so.9.0 && ln -f ${name}k0.so.9.0 src/.libs/libippcpk0.so.9.0 && ln -f ${name}l9.so.9.0 src/.libs/libippcpl9.so.9.0 && ln -f ${name}m7.so.9.0 src/.libs/libippcpm7.so.9.0 && ln -f ${name}mx.so.9.0 src/.libs/libippcpmx.so.9.0 && ln -f ${name}.so src/.libs/libippcp.so && ln -f ${name}n8.so.9.0 src/.libs/libippcpn8.so.9.0 && ln -f ${name}y8.so.9.0 src/.libs/libippcpy8.so.9.0 && ln -f IPP/lib/libippcore.so src/.libs/libippcore.so && ln -f IPP/lib/libippcore.so.9.0 src/.libs/libippcore.so.9.0"
  3077. fi
  3078. ], [fastRSA_found=no])
  3079. break;;
  3080. *)
  3081. fastRSA_found=no
  3082. esac
  3083. if test "$fastRSA_found" = "yes"; then
  3084. # was succesfull so add tested LDFLAGS to AM_ flags
  3085. AM_LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}"
  3086. AM_CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}"
  3087. IPPHEADERS="${srcdir}/IPP/include/*.h"
  3088. fi
  3089. # restore LDFLAGS to user set
  3090. LDFLAGS=${STORE_LDFLAGS}
  3091. CPPFLAGS=${STORE_CPPFLAGS}
  3092. ], [fastRSA_found=no])
  3093. fi
  3094. # Don't cache the result so it can be checked
  3095. AS_UNSET([ac_cv_header_ippcp_h])
  3096. AS_UNSET([ac_cv_header_ipp_h])
  3097. AS_UNSET([ac_cv_lib_ippcp_ippsRSAEncrypt_PKCSv15]);
  3098. # Check link and see if user has pre-existing IPP Libraries if not using local
  3099. if test "$ENABLED_FAST_RSA" = "yes" && test "$fastRSA_found" = "no"; then
  3100. AC_MSG_NOTICE([Checking if IPP crypto library installed])
  3101. AC_CHECK_HEADER([ippcp.h], [AC_CHECK_LIB([ippcp], [ippsRSAEncrypt_PKCSv15],
  3102. [
  3103. fastRSA_found=yes
  3104. AM_LDFLAGS="${AM_LDFLAGS} -lippcore -lippcp"
  3105. ], [ fastRSA_found=no])
  3106. ], [fastRSA_found=no])
  3107. # Error out on not finding libraries
  3108. if test "$fastRSA_found" = "no"; then
  3109. AC_MSG_ERROR([Could not find fast rsa libraries])
  3110. fi
  3111. fi
  3112. fi # end of if for shared library
  3113. else # if user rsa is set than do not use fast rsa option
  3114. if test "$ENABLED_FAST_RSA" = "yes"; then
  3115. AC_MSG_ERROR([Could not use fast rsa libraries with user crypto or fips])
  3116. fi
  3117. fi # end of if for user rsa crypto or fips
  3118. # End result of checking for IPP Libraries
  3119. AC_MSG_CHECKING([for fast RSA])
  3120. if test "$ENABLED_FAST_RSA" = "yes"; then
  3121. AM_CFLAGS="$AM_CFLAGS -DHAVE_FAST_RSA -DHAVE_USER_RSA"
  3122. # add in user crypto header that uses Intel IPP
  3123. AM_CPPFLAGS="$AM_CPPFLAGS -I$srcdir/wolfcrypt/user-crypto/include"
  3124. if test "$enable_shared" = "yes"; then
  3125. LIBS="$LIBS -lippcore -lippcp"
  3126. LIB_ADD="-lippcp -lippcore $LIB_ADD"
  3127. else
  3128. LIB_ADD="$srcdir/IPP/$ipplib/libippcp.a $srcdir/IPP/$ipplib/libippcore.a $LIB_ADD"
  3129. fi
  3130. AC_MSG_RESULT([yes])
  3131. else
  3132. AC_MSG_RESULT([no])
  3133. fi
  3134. AC_SUBST([IPPLIBS])
  3135. AC_SUBST([IPPHEADERS])
  3136. AC_SUBST([IPPLINK])
  3137. AM_CONDITIONAL([BUILD_FAST_RSA], [test "x$ENABLED_FAST_RSA" = "xyes"])
  3138. # static memory use
  3139. AC_ARG_ENABLE([staticmemory],
  3140. [AS_HELP_STRING([--enable-staticmemory],[Enable static memory use (default: disabled)])],
  3141. [ ENABLED_STATICMEMORY=$enableval ],
  3142. [ ENABLED_STATICMEMORY=no ]
  3143. )
  3144. if test "x$ENABLED_STATICMEMORY" = "xyes"
  3145. then
  3146. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY"
  3147. if test "x$ENABLED_FASTMATH" = "xno"
  3148. then
  3149. AC_MSG_ERROR([please use --enable-fastmath if enabling staticmemory.])
  3150. fi
  3151. fi
  3152. # microchip api
  3153. AC_ARG_ENABLE([mcapi],
  3154. [AS_HELP_STRING([--enable-mcapi],[Enable Microchip API (default: disabled)])],
  3155. [ ENABLED_MCAPI=$enableval ],
  3156. [ ENABLED_MCAPI=no ]
  3157. )
  3158. if test "$ENABLED_MCAPI" = "yes"
  3159. then
  3160. AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI"
  3161. if test "x$ENABLED_AESCTR" != "xyes"
  3162. then
  3163. # These flags are already implied by --enable-aesctr
  3164. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  3165. fi
  3166. fi
  3167. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
  3168. then
  3169. AC_MSG_ERROR([please enable sha512 if enabling mcapi.])
  3170. fi
  3171. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_ECC" = "no"
  3172. then
  3173. AC_MSG_ERROR([please enable ecc if enabling mcapi.])
  3174. fi
  3175. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_LIBZ" = "no"
  3176. then
  3177. AC_MSG_ERROR([please use --with-libz if enabling mcapi.])
  3178. fi
  3179. AM_CONDITIONAL([BUILD_MCAPI], [test "x$ENABLED_MCAPI" = "xyes"])
  3180. # Asynchronous Crypto
  3181. AC_ARG_ENABLE([asynccrypt],
  3182. [AS_HELP_STRING([--enable-asynccrypt],[Enable Asynchronous Crypto (default: disabled)])],
  3183. [ ENABLED_ASYNCCRYPT=$enableval ],
  3184. [ ENABLED_ASYNCCRYPT=no ]
  3185. )
  3186. if test "$ENABLED_ASYNCCRYPT" = "yes"
  3187. then
  3188. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT -DHAVE_WOLF_EVENT -DHAVE_WOLF_BIGINT"
  3189. # if no async hardware then use simulator for testing
  3190. if test "x$ENABLED_CAVIUM" = "xno" && test "x$ENABLED_INTEL_QA" = "xno"
  3191. then
  3192. # Async threading is Linux specific
  3193. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT_TEST"
  3194. fi
  3195. fi
  3196. AM_CONDITIONAL([BUILD_ASYNCCRYPT], [test "x$ENABLED_ASYNCCRYPT" = "xyes"])
  3197. AM_CONDITIONAL([BUILD_WOLFEVENT], [test "x$ENABLED_ASYNCCRYPT" = "xyes"])
  3198. # check for async if using Intel QuckAssist or Cavium
  3199. if test "x$ENABLED_INTEL_QA" = "xyes" || test "x$ENABLED_CAVIUM" = "xyes" ; then
  3200. if test "x$ENABLED_ASYNCCRYPT" = "xno" ; then
  3201. AC_MSG_ERROR([Please enable enable asynchronous support using --enable-asynccrypt])
  3202. fi
  3203. fi
  3204. # Asynchronous threading
  3205. AC_ARG_ENABLE([asyncthreads],
  3206. [AS_HELP_STRING([--enable-asyncthreads],[Enable Asynchronous Threading (default: enabled)])],
  3207. [ ENABLED_ASYNCTHREADS=$enableval ],
  3208. [ ENABLED_ASYNCTHREADS=yes ]
  3209. )
  3210. if test "$ENABLED_ASYNCCRYPT" = "yes" && test "$ENABLED_ASYNCTHREADS" = "yes"
  3211. then
  3212. AX_PTHREAD([ENABLED_ASYNCTHREADS=yes],[ENABLED_ASYNCTHREADS=no])
  3213. else
  3214. ENABLED_ASYNCTHREADS=no
  3215. fi
  3216. if test "$ENABLED_ASYNCTHREADS" = "yes"
  3217. then
  3218. LIB_ADD="-lpthread $LIB_ADD"
  3219. AM_CFLAGS="$AM_CFLAGS -D_GNU_SOURCE"
  3220. else
  3221. AM_CFLAGS="$AM_CFLAGS -DWC_NO_ASYNC_THREADING"
  3222. fi
  3223. # Session Export
  3224. AC_ARG_ENABLE([sessionexport],
  3225. [AS_HELP_STRING([--enable-sessionexport],[Enable export and import of sessions (default: disabled)])],
  3226. [ ENABLED_SESSIONEXPORT=$enableval ],
  3227. [ ENABLED_SESSIONEXPORT=no ]
  3228. )
  3229. if test "$ENABLED_SESSIONEXPORT" = "yes"
  3230. then
  3231. if test "$ENABLED_DTLS" = "no"
  3232. then
  3233. AC_MSG_ERROR([Only DTLS supported with session export])
  3234. fi
  3235. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SESSION_EXPORT"
  3236. fi
  3237. # AES key wrap
  3238. AC_ARG_ENABLE([aeskeywrap],
  3239. [AS_HELP_STRING([--enable-aeskeywrap],[Enable AES key wrap support (default: disabled)])],
  3240. [ ENABLED_AESKEYWRAP=$enableval ],
  3241. [ ENABLED_AESKEYWRAP=no ]
  3242. )
  3243. if test "$ENABLED_WPAS" = "yes" && test "$ENABLED_FIPS" = "no"
  3244. then
  3245. ENABLED_AESKEYWRAP="yes"
  3246. fi
  3247. if test "$ENABLED_AESKEYWRAP" = "yes"
  3248. then
  3249. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_KEYWRAP -DWOLFSSL_AES_DIRECT"
  3250. fi
  3251. # Old name support for backwards compatibility
  3252. AC_ARG_ENABLE([oldnames],
  3253. [AS_HELP_STRING([--enable-oldnames],[Keep backwards compat with old names (default: enabled)])],
  3254. [ ENABLED_OLDNAMES=$enableval ],
  3255. [ ENABLED_OLDNAMES=yes ]
  3256. )
  3257. if test "x$ENABLED_OLDNAMES" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3258. then
  3259. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_RNGNAME -DNO_OLD_WC_NAMES -DNO_OLD_SSL_NAMES"
  3260. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_SHA256_NAMES"
  3261. fi
  3262. # Default optimization CFLAGS enable
  3263. AC_ARG_ENABLE([optflags],
  3264. [AS_HELP_STRING([--enable-optflags],[Enable default optimization CFLAGS for the compiler (default: enabled)])],
  3265. [ ENABLED_OPTFLAGS=$enableval ],
  3266. [ ENABLED_OPTFLAGS=yes ]
  3267. )
  3268. # check if PSK was enabled for conditionally running psk.test script
  3269. AM_CONDITIONAL([BUILD_PSK], [test "x$ENABLED_PSK" = "xyes"])
  3270. # check if should run the trusted peer certs test
  3271. # (for now checking both C_FLAGS and C_EXTRA_FLAGS)
  3272. case $C_EXTRA_FLAGS in
  3273. *WOLFSSL_TRUST_PEER_CERT*)
  3274. have_tp=yes
  3275. break;;
  3276. *)
  3277. have_tp=no ;;
  3278. esac
  3279. if test "$have_tp" = "no"; then
  3280. case $C_FLAGS in
  3281. *WOLFSSL_TRUST_PEER_CERT*)
  3282. have_tp=yes
  3283. break;;
  3284. *)
  3285. have_tp=no ;;
  3286. esac
  3287. fi
  3288. AM_CONDITIONAL([BUILD_TRUST_PEER_CERT], [test "x$have_tp" = "xyes"])
  3289. # dertermine if we have key validation mechanism
  3290. if test "x$ENABLED_ECC" = "xyes" || test "x$ENABLED_RSA" = "xyes"
  3291. then
  3292. if test "x$ENABLED_ASN" = "xyes"
  3293. then
  3294. ENABLED_PKI="yes"
  3295. fi
  3296. fi
  3297. AM_CONDITIONAL([BUILD_PKI], [test "x$ENABLED_PKI" = "xyes"])
  3298. ################################################################################
  3299. # Check for build-type conflicts #
  3300. ################################################################################
  3301. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  3302. test "x$ENABLED_LEANPSK" = "xyes"],
  3303. [AC_MSG_ERROR([Cannot use Max Strength and Lean PSK at the same time.])])
  3304. AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
  3305. test "x$ENABLED_ASN" = "xno"],
  3306. [AC_MSG_ERROR([please enable asn if enabling ocsp.])])
  3307. AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
  3308. test "x$ENABLED_RSA" = "xno" && \
  3309. test "x$ENABLED_ECC" = "xno"],
  3310. [AC_MSG_ERROR([please enable rsa or ecc if enabling ocsp.])])
  3311. # checks for pkcs7 needed enables
  3312. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  3313. test "x$ENABLED_RSA" = "xno" && \
  3314. test "x$ENABLED_ECC" = "xno"],
  3315. [AC_MSG_ERROR([please enable ecc or rsa if enabling pkcs7.])])
  3316. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  3317. test "x$ENABLED_SHA" = "xno"],
  3318. [AC_MSG_ERROR([please enable sha if enabling pkcs7.])])
  3319. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  3320. test "x$ENABLED_AES" = "xno" && \
  3321. test "x$ENABLED_DES3" = "xno"],
  3322. [AC_MSG_ERROR([please enable either AES or 3DES if enabling pkcs7.])])
  3323. AS_IF([test "x$ENABLED_WOLFSCEP" = "xyes" && \
  3324. test "x$ENABLED_AES" = "xno" && \
  3325. test "x$ENABLED_DES3" = "xno"],
  3326. [AC_MSG_ERROR([please enable either AES or 3DES if enabling scep.])])
  3327. AS_IF([test "x$ENABLED_LEANTLS" = "xyes" && \
  3328. test "x$ENABLED_ECC" = "xno"],
  3329. [AC_MSG_ERROR([please enable ecc if enabling leantls.])])
  3330. AS_IF([test "x$ENABLED_SNIFFER" = "xyes" && \
  3331. test "x$ENABLED_RSA" = "xno"],
  3332. [AC_MSG_ERROR([please enable rsa if enabling sniffer.])])
  3333. # Lean TLS forces off prereqs of SCEP.
  3334. AS_IF([test "x$ENABLED_SCEP" = "xyes" && \
  3335. test "x$ENABLED_LEANTLS" = "xyes"],
  3336. [AC_MSG_ERROR([Cannot use SCEP and Lean TLS at the same time.])])
  3337. # CMAC currently requires AES.
  3338. AS_IF([test "x$ENABLED_CMAC" = "xyes" && \
  3339. test "x$ENABLED_AES" = "xno"],
  3340. [AC_MSG_ERROR([cannot use CMAC without AES.])])
  3341. ################################################################################
  3342. # Update CFLAGS based on options #
  3343. ################################################################################
  3344. AS_IF([test "x$ENABLED_MCAPI" = "xyes"],
  3345. [AS_IF([test "x$ENABLED_DES3" = "xno"],[ENABLED_DES3="yes"])])
  3346. if test "$ENABLED_WOLFSCEP" = "yes"
  3347. then
  3348. # Enable prereqs if not already enabled
  3349. if test "x$ENABLED_KEYGEN" = "xno"
  3350. then
  3351. ENABLED_KEYGEN="yes"
  3352. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  3353. fi
  3354. if test "x$ENABLED_CERTGEN" = "xno"
  3355. then
  3356. ENABLED_CERTGEN="yes"
  3357. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3358. fi
  3359. if test "x$ENABLED_CERTREQ" = "xno"
  3360. then
  3361. ENABLED_CERTREQ="yes"
  3362. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  3363. fi
  3364. if test "x$ENABLED_CERTEXT" = "xno"
  3365. then
  3366. ENABLED_CERTEXT="yes"
  3367. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  3368. fi
  3369. if test "x$ENABLED_PKCS7" = "xno"
  3370. then
  3371. ENABLED_PKCS7="yes"
  3372. fi
  3373. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_WOLFSCEP"
  3374. fi
  3375. if test "$ENABLED_SP_MATH" = "yes" && test "$ENABLED_KEYGEN" = "yes"; then
  3376. AC_MSG_ERROR([Cannot use single precision math and key generation])
  3377. fi
  3378. if test "x$ENABLED_PKCS7" = "xyes"
  3379. then
  3380. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  3381. # Enable prereqs if not already enabled
  3382. if test "x$ENABLED_AESKEYWRAP" = "xno"
  3383. then
  3384. ENABLED_AESKEYWRAP="yes"
  3385. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_KEYWRAP -DWOLFSSL_AES_DIRECT"
  3386. fi
  3387. if test "x$ENABLED_X963KDF" = "xno" && test "$ENABLED_ECC" = "yes"
  3388. then
  3389. ENABLED_X963KDF="yes"
  3390. AM_CFLAGS="$AM_CFLAGS -DHAVE_X963_KDF"
  3391. fi
  3392. fi
  3393. if test "x$ENABLED_DES3" = "xno"
  3394. then
  3395. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  3396. else
  3397. # turn off DES3 if leanpsk or leantls on
  3398. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  3399. then
  3400. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  3401. ENABLED_DES3=no
  3402. fi
  3403. fi
  3404. AM_CONDITIONAL([BUILD_DES3], [test "x$ENABLED_DES3" = "xyes"])
  3405. AM_CONDITIONAL([BUILD_PKCS7], [test "x$ENABLED_PKCS7" = "xyes"])
  3406. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes"],
  3407. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MAX_STRENGTH"])
  3408. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  3409. test "x$ENABLED_OLD_TLS" = "xyes"],
  3410. [AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  3411. ENABLED_OLD_TLS=no])
  3412. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  3413. test "x$ENABLED_SSLV3" = "xyes"],
  3414. [AC_MSG_ERROR([Cannot use Max Strength and SSLv3 at the same time.])])
  3415. AS_IF([test "x$ENABLED_SCTP" = "xyes"],
  3416. [AM_CFLAGS="-DWOLFSSL_SCTP $AM_CFLAGS"])
  3417. AS_IF([test "x$ENABLED_MCAST" = "xyes"],
  3418. [AM_CFLAGS="-DWOLFSSL_MULTICAST $AM_CFLAGS"])
  3419. # SCTP and Multicast require DTLS
  3420. AS_IF([(test "x$ENABLED_DTLS" = "xno") && \
  3421. (test "x$ENABLED_SCTP" = "xyes" || test "x$ENABLED_MCAST" = "xyes")],
  3422. [AM_CFLAGS="-DWOLFSSL_DTLS $AM_CFLAGS"
  3423. ENABLED_DTLS=yes])
  3424. # Multicast requires the null cipher
  3425. AS_IF([test "x$ENABLED_NULL_CIPHER" = "xno" && \
  3426. test "x$ENABLED_MCAST" = "xyes"],
  3427. [AM_CFLAGS="-DHAVE_NULL_CIPHER $AM_CFLAGS"
  3428. ENABLED_NULL_CIPHER=yes])
  3429. # wolfSSH and WPA Supplicant both need Public MP, only enable once.
  3430. # This will let you know if you enabled wolfSSH but have any of the prereqs
  3431. # disabled. Some of these options, disabling them adds things to the FLAGS and
  3432. # you need to check and add items in two places depending on the option.
  3433. AS_IF([test "x$ENABLED_WOLFSSH" = "xyes"],
  3434. [AS_IF([test "x$ENABLED_WPAS" = "xno"],[AM_CFLAGS="-DWOLFSSL_PUBLIC_MP $AM_CFLAGS"])
  3435. AS_IF([test "x$ENABLED_AESGCM" = "xno"],[AC_MSG_ERROR([cannot enable wolfSSH with AES-GCM disabled])])
  3436. AS_IF([test "x$ENABLED_ECC" = "xno"],[AC_MSG_ERROR([cannot enable wolfSSH with ECC disabled])])
  3437. AS_IF([test "x$ENABLED_SHA" = "xno"],[AC_MSG_ERROR([cannot enable wolfSSH with SHA-1 disabled])])
  3438. AS_IF([test "x$ENABLED_SHA512" = "xno"],[AC_MSG_ERROR([cannot enable wolfSSH with SHA-512/384 disabled])])
  3439. ])
  3440. ################################################################################
  3441. # OPTIMIZE FLAGS
  3442. # For distro disable custom build options that interfere with symbol generation
  3443. if test "$GCC" = "yes" && test "$ENABLED_DISTRO" = "no"
  3444. then
  3445. AM_CFLAGS="$AM_CFLAGS -Wall -Wno-unused"
  3446. if test "$ax_enable_debug" = "no"
  3447. then
  3448. AS_IF([test "x$ENABLED_OPTFLAGS" = "xyes"], [
  3449. if test "$ENABLED_FASTMATH" = "yes"
  3450. then
  3451. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  3452. if test "$ENABLED_FASTHUGEMATH" = "yes"
  3453. then
  3454. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  3455. fi
  3456. else
  3457. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_CFLAGS"
  3458. fi
  3459. ])
  3460. fi
  3461. fi
  3462. # ICC command line warning for non supported warning flags
  3463. if test "$CC" = "icc"
  3464. then
  3465. AM_CFLAGS="$AM_CFLAGS -wd10006"
  3466. fi
  3467. # Expose HAVE___UINT128_T to options flags"
  3468. if test "$ac_cv_type___uint128_t" = "yes"
  3469. then
  3470. AM_CFLAGS="$AM_CFLAGS -DHAVE___UINT128_T"
  3471. fi
  3472. LIB_SOCKET_NSL
  3473. AX_HARDEN_CC_COMPILER_FLAGS
  3474. # if mingw then link to ws2_32 for sockets
  3475. case $host_os in
  3476. mingw*)
  3477. LDFLAGS="$LDFLAGS -lws2_32"
  3478. if test "$enable_shared" = "yes"
  3479. then
  3480. AC_DEFINE([WOLFSSL_DLL], [1], [Use __declspec(dllexport) when building library])
  3481. if test "$enable_static" = "yes"
  3482. then
  3483. MINGW_LIB_WARNING="yes"
  3484. fi
  3485. fi ;;
  3486. esac
  3487. # add user C_EXTRA_FLAGS back
  3488. # For distro disable custom build options that interfere with symbol generation
  3489. if test "$ENABLED_DISTRO" = "no"
  3490. then
  3491. CFLAGS="$CFLAGS $USER_C_EXTRA_FLAGS"
  3492. fi
  3493. OPTION_FLAGS="$USER_CFLAGS $USER_C_EXTRA_FLAGS $CPPFLAGS $AM_CFLAGS"
  3494. CREATE_HEX_VERSION
  3495. AC_SUBST([AM_CPPFLAGS])
  3496. AC_SUBST([AM_CFLAGS])
  3497. AC_SUBST([AM_LDFLAGS])
  3498. AC_SUBST([AM_CCASFLAGS])
  3499. AC_SUBST([LIB_ADD])
  3500. AC_SUBST([LIB_STATIC_ADD])
  3501. # FINAL
  3502. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  3503. AC_CONFIG_FILES([Makefile])
  3504. AC_CONFIG_FILES([wolfssl/version.h])
  3505. AC_CONFIG_FILES([wolfssl/options.h])
  3506. #have options.h and version.h for autoconf fips tag and build
  3507. #if test "x$ENABLED_FIPS" = "xyes"
  3508. #then
  3509. # AC_CONFIG_FILES([cyassl/version.h])
  3510. # AC_CONFIG_FILES([cyassl/options.h])
  3511. #fi
  3512. AC_CONFIG_FILES([support/wolfssl.pc])
  3513. AC_CONFIG_FILES([rpm/spec])
  3514. AX_CREATE_GENERIC_CONFIG
  3515. AX_AM_JOBSERVER([yes])
  3516. AC_OUTPUT
  3517. # force make clean
  3518. echo "---"
  3519. echo "Running make clean..."
  3520. make clean >/dev/null 2>&1
  3521. # generate user options header
  3522. echo "---"
  3523. echo "Generating user options header..."
  3524. OPTION_FILE="wolfssl/options.h"
  3525. #if
  3526. #OPTION_FILE+="cyassl/options.h"
  3527. #fi
  3528. rm -f $OPTION_FILE
  3529. echo "/* wolfssl options.h" > $OPTION_FILE
  3530. echo " * generated from configure options" >> $OPTION_FILE
  3531. echo " *" >> $OPTION_FILE
  3532. echo " * Copyright (C) 2006-2015 wolfSSL Inc." >> $OPTION_FILE
  3533. echo " *" >> $OPTION_FILE
  3534. echo " * This file is part of wolfSSL. (formerly known as CyaSSL)" >> $OPTION_FILE
  3535. echo " *" >> $OPTION_FILE
  3536. echo " */" >> $OPTION_FILE
  3537. echo "" >> $OPTION_FILE
  3538. echo "#ifndef WOLFSSL_OPTIONS_H" >> $OPTION_FILE
  3539. echo "#define WOLFSSL_OPTIONS_H" >> $OPTION_FILE
  3540. echo "" >> $OPTION_FILE
  3541. echo "" >> $OPTION_FILE
  3542. echo "#ifdef __cplusplus" >> $OPTION_FILE
  3543. echo "extern \"C\" {" >> $OPTION_FILE
  3544. echo "#endif" >> $OPTION_FILE
  3545. echo "" >> $OPTION_FILE
  3546. for option in $OPTION_FLAGS; do
  3547. defonly=`echo $option | sed 's/-D//'`
  3548. if test "$defonly" != "$option"
  3549. then
  3550. noequalsign=`echo $defonly | sed 's/=/ /'`
  3551. if test "$noequalsign" = "NDEBUG" || test "$noequalsign" = "DEBUG"
  3552. then
  3553. echo "not outputting (N)DEBUG to $OPTION_FILE"
  3554. continue
  3555. fi
  3556. # allow user to igonore system options
  3557. ignoresys=no
  3558. if [[[ $noequalsign == _* ]]] ;
  3559. then
  3560. ignoresys=yes
  3561. echo "#ifndef WOLFSSL_OPTIONS_IGNORE_SYS" >> $OPTION_FILE
  3562. fi
  3563. noarg=`echo $defonly | sed 's/=.*//'`
  3564. echo "#undef $noarg" >> $OPTION_FILE
  3565. echo "#define $noequalsign" >> $OPTION_FILE
  3566. if test "$ignoresys" = "yes"
  3567. then
  3568. echo "#endif" >> $OPTION_FILE
  3569. fi
  3570. echo "" >> $OPTION_FILE
  3571. else
  3572. echo "option w/o begin -D is $option, not saving to $OPTION_FILE"
  3573. fi
  3574. done
  3575. echo "" >> $OPTION_FILE
  3576. echo "#ifdef __cplusplus" >> $OPTION_FILE
  3577. echo "}" >> $OPTION_FILE
  3578. echo "#endif" >> $OPTION_FILE
  3579. echo "" >> $OPTION_FILE
  3580. echo "" >> $OPTION_FILE
  3581. echo "#endif /* WOLFSSL_OPTIONS_H */" >> $OPTION_FILE
  3582. echo "" >> $OPTION_FILE
  3583. echo
  3584. #backwards compatibility for those who have included options or version
  3585. touch cyassl/options.h
  3586. echo "/* cyassl options.h" > cyassl/options.h
  3587. echo " * generated from wolfssl/options.h" >> cyassl/options.h
  3588. echo " */" >> cyassl/options.h
  3589. echo ""
  3590. while read -r line
  3591. do
  3592. echo "$line" >> cyassl/options.h
  3593. done < $OPTION_FILE
  3594. # switch ifdef protection in cyassl/option.h to CYASSL_OPTONS_H, remove bak
  3595. sed -i.bak 's/WOLFSSL_OPTIONS_H/CYASSL_OPTIONS_H/g' cyassl/options.h
  3596. # workaround for mingw sed that may get "Permission denied" trying to preserver permissions
  3597. case $host_os in
  3598. mingw*)
  3599. chmod u+w cyassl/options.h ;;
  3600. esac
  3601. rm cyassl/options.h.bak
  3602. # output config summary
  3603. echo "---"
  3604. echo "Configuration summary for $PACKAGE_NAME version $VERSION"
  3605. echo ""
  3606. echo " * Installation prefix: $prefix"
  3607. echo " * System type: $host_vendor-$host_os"
  3608. echo " * Host CPU: $host_cpu"
  3609. echo " * C Compiler: $CC"
  3610. echo " * C Flags: $CFLAGS"
  3611. echo " * C++ Compiler: $CXX"
  3612. echo " * C++ Flags: $CXXFLAGS"
  3613. echo " * CPP Flags: $CPPFLAGS"
  3614. echo " * CCAS Flags: $CCASFLAGS"
  3615. echo " * LIB Flags: $LIB"
  3616. echo " * Debug enabled: $ax_enable_debug"
  3617. echo " * Coverage enabled: $ax_enable_coverage"
  3618. echo " * Warnings as failure: $ac_cv_warnings_as_errors"
  3619. echo " * make -j: $enable_jobserver"
  3620. echo " * VCS checkout: $ac_cv_vcs_checkout"
  3621. echo
  3622. echo " Features "
  3623. echo " * Single threaded: $ENABLED_SINGLETHREADED"
  3624. echo " * Filesystem: $ENABLED_FILESYSTEM"
  3625. echo " * OpenSSH Build: $ENABLED_OPENSSH"
  3626. echo " * OpenSSL Extra API: $ENABLED_OPENSSLEXTRA"
  3627. echo " * OpenSSL Coexist: $ENABLED_OPENSSLCOEXIST"
  3628. echo " * Old Names: $ENABLED_OLDNAMES"
  3629. echo " * Max Strength Build: $ENABLED_MAXSTRENGTH"
  3630. echo " * Distro Build: $ENABLED_DISTRO"
  3631. echo " * fastmath: $ENABLED_FASTMATH"
  3632. echo " * Assembly Allowed: $ENABLED_ASM"
  3633. echo " * sniffer: $ENABLED_SNIFFER"
  3634. echo " * snifftest: $ENABLED_SNIFFTEST"
  3635. echo " * ARC4: $ENABLED_ARC4"
  3636. echo " * AES: $ENABLED_AES"
  3637. echo " * AES-NI: $ENABLED_AESNI"
  3638. echo " * AES-GCM: $ENABLED_AESGCM"
  3639. echo " * AES-CCM: $ENABLED_AESCCM"
  3640. echo " * AES-CTR: $ENABLED_AESCTR"
  3641. echo " * DES3: $ENABLED_DES3"
  3642. echo " * IDEA: $ENABLED_IDEA"
  3643. echo " * Camellia: $ENABLED_CAMELLIA"
  3644. echo " * NULL Cipher: $ENABLED_NULL_CIPHER"
  3645. echo " * MD5: $ENABLED_MD5"
  3646. echo " * RIPEMD: $ENABLED_RIPEMD"
  3647. echo " * SHA: $ENABLED_SHA"
  3648. echo " * SHA-224: $ENABLED_SHA224"
  3649. echo " * SHA-512: $ENABLED_SHA512"
  3650. echo " * SHA3: $ENABLED_SHA3"
  3651. echo " * BLAKE2: $ENABLED_BLAKE2"
  3652. echo " * CMAC: $ENABLED_CMAC"
  3653. echo " * keygen: $ENABLED_KEYGEN"
  3654. echo " * certgen: $ENABLED_CERTGEN"
  3655. echo " * certreq: $ENABLED_CERTREQ"
  3656. echo " * certext: $ENABLED_CERTEXT"
  3657. echo " * HC-128: $ENABLED_HC128"
  3658. echo " * RABBIT: $ENABLED_RABBIT"
  3659. echo " * CHACHA: $ENABLED_CHACHA"
  3660. echo " * Hash DRBG: $ENABLED_HASHDRBG"
  3661. echo " * PWDBASED: $ENABLED_PWDBASED"
  3662. echo " * scrypt: $ENABLED_SCRYPT"
  3663. echo " * wolfCrypt Only: $ENABLED_CRYPTONLY"
  3664. echo " * HKDF: $ENABLED_HKDF"
  3665. echo " * X9.63 KDF: $ENABLED_X963KDF"
  3666. echo " * MD4: $ENABLED_MD4"
  3667. echo " * PSK: $ENABLED_PSK"
  3668. echo " * Poly1305: $ENABLED_POLY1305"
  3669. echo " * LEANPSK: $ENABLED_LEANPSK"
  3670. echo " * LEANTLS: $ENABLED_LEANTLS"
  3671. echo " * RSA: $ENABLED_RSA"
  3672. echo " * RSA-PSS: $ENABLED_RSAPSS"
  3673. echo " * DSA: $ENABLED_DSA"
  3674. echo " * DH: $ENABLED_DH"
  3675. echo " * ECC: $ENABLED_ECC"
  3676. echo " * CURVE25519: $ENABLED_CURVE25519"
  3677. echo " * ED25519: $ENABLED_ED25519"
  3678. echo " * FPECC: $ENABLED_FPECC"
  3679. echo " * ECC_ENCRYPT: $ENABLED_ECC_ENCRYPT"
  3680. echo " * ASN: $ENABLED_ASN"
  3681. echo " * Anonymous cipher: $ENABLED_ANON"
  3682. echo " * CODING: $ENABLED_CODING"
  3683. echo " * MEMORY: $ENABLED_MEMORY"
  3684. echo " * I/O POOL: $ENABLED_IOPOOL"
  3685. echo " * LIGHTY: $ENABLED_LIGHTY"
  3686. echo " * HAPROXY: $ENABLED_HAPROXY"
  3687. echo " * STUNNEL: $ENABLED_STUNNEL"
  3688. echo " * NGINX: $ENABLED_NGINX"
  3689. echo " * SIGNAL: $ENABLED_SIGNAL"
  3690. echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
  3691. echo " * DTLS: $ENABLED_DTLS"
  3692. echo " * SCTP: $ENABLED_SCTP"
  3693. echo " * Indefinite Length: $ENABLED_BER_INDEF"
  3694. echo " * Multicast: $ENABLED_MCAST"
  3695. echo " * Old TLS Versions: $ENABLED_OLD_TLS"
  3696. echo " * SSL version 3.0: $ENABLED_SSLV3"
  3697. echo " * TLS v1.0: $ENABLED_TLSV10"
  3698. echo " * TLS v1.3: $ENABLED_TLS13"
  3699. echo " * TLS v1.3 Draft 18: $ENABLED_TLS13_DRAFT18"
  3700. echo " * TLS v1.3 Draft 22: $ENABLED_TLS13_DRAFT22"
  3701. echo " * TLS v1.3 Draft 23: $ENABLED_TLS13_DRAFT23"
  3702. echo " * TLS v1.3 Draft 26: $ENABLED_TLS13_DRAFT26"
  3703. echo " * Post-handshake Auth: $ENABLED_TLS13_POST_AUTH"
  3704. echo " * Early Data: $ENABLED_TLS13_EARLY_DATA"
  3705. echo " * Send State in HRR Cookie: $ENABLED_SEND_HRR_COOKIE"
  3706. echo " * OCSP: $ENABLED_OCSP"
  3707. echo " * OCSP Stapling: $ENABLED_CERTIFICATE_STATUS_REQUEST"
  3708. echo " * OCSP Stapling v2: $ENABLED_CERTIFICATE_STATUS_REQUEST_V2"
  3709. echo " * CRL: $ENABLED_CRL"
  3710. echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
  3711. echo " * Persistent session cache: $ENABLED_SAVESESSION"
  3712. echo " * Persistent cert cache: $ENABLED_SAVECERT"
  3713. echo " * Atomic User Record Layer: $ENABLED_ATOMICUSER"
  3714. echo " * Public Key Callbacks: $ENABLED_PKCALLBACKS"
  3715. echo " * NTRU: $ENABLED_NTRU"
  3716. echo " * QSH: $ENABLED_QSH"
  3717. echo " * Whitewood netRandom: $ENABLED_WNR"
  3718. echo " * Server Name Indication: $ENABLED_SNI"
  3719. echo " * ALPN: $ENABLED_ALPN"
  3720. echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
  3721. echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
  3722. echo " * Supported Elliptic Curves: $ENABLED_SUPPORTED_CURVES"
  3723. echo " * Session Ticket: $ENABLED_SESSION_TICKET"
  3724. echo " * Extended Master Secret: $ENABLED_EXTENDED_MASTER"
  3725. echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
  3726. echo " * Secure Renegotiation: $ENABLED_SECURE_RENEGOTIATION"
  3727. echo " * All TLS Extensions: $ENABLED_TLSX"
  3728. echo " * PKCS#7 $ENABLED_PKCS7"
  3729. echo " * wolfSSH $ENABLED_WOLFSSH"
  3730. echo " * wolfSCEP $ENABLED_WOLFSCEP"
  3731. echo " * Secure Remote Password $ENABLED_SRP"
  3732. echo " * Small Stack: $ENABLED_SMALL_STACK"
  3733. echo " * valgrind unit tests: $ENABLED_VALGRIND"
  3734. echo " * LIBZ: $ENABLED_LIBZ"
  3735. echo " * Examples: $ENABLED_EXAMPLES"
  3736. echo " * User Crypto: $ENABLED_USER_CRYPTO"
  3737. echo " * Fast RSA: $ENABLED_FAST_RSA"
  3738. echo " * Single Precision: $ENABLED_SP"
  3739. echo " * Async Crypto: $ENABLED_ASYNCCRYPT"
  3740. echo " * Cavium: $ENABLED_CAVIUM"
  3741. echo " * ARM ASM: $ENABLED_ARMASM"
  3742. echo " * AES Key Wrap: $ENABLED_AESKEYWRAP"
  3743. echo " * Write duplicate: $ENABLED_WRITEDUP"
  3744. echo " * Intel Quick Assist: $ENABLED_INTEL_QA"
  3745. echo " * Xilinx Hardware Acc.: $ENABLED_XILINX"
  3746. echo " * Inline Code: $ENABLED_INLINE"
  3747. echo ""
  3748. echo "---"
  3749. ################################################################################
  3750. # Show warnings at bottom so they are noticed
  3751. ################################################################################
  3752. if test "$ENABLED_ASYNCCRYPT" = "yes"
  3753. then
  3754. AC_MSG_WARN([Make sure real async files are loaded. Contact wolfSSL for details on using the asynccrypt option.])
  3755. fi
  3756. # MinGW static vs shared library
  3757. # Reference URL from libtool for MinGW is located at
  3758. # http://www.gnu.org/software/libtool/manual/libtool.html#Cygwin-to-MinGW-Cross
  3759. # this allows for not even having dllimport/dllexport on functions
  3760. # with recent libtools, only requiring it with global variables.
  3761. #
  3762. # The following warning is displayed here because if not using "contemporary GNU
  3763. # tools" there is the possibility of export/import issues.
  3764. # wolfSSL uses __declspec(dllexport) and "contemporary GNU tools" handle the
  3765. # case where both static and shared libraries are built.
  3766. #
  3767. # More can be found about the MinGW linker at
  3768. # https://sourceware.org/binutils/docs/ld/WIN32.html
  3769. if test "$MINGW_LIB_WARNING" = "yes"
  3770. then
  3771. AC_MSG_WARN([Building with shared and static library at the same time on this system may cause export/import problems when using non contemporary GNU tools.])
  3772. fi