configure.ac 132 KB

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