configure.ac 187 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131
  1. # configure.ac
  2. #
  3. # Copyright (C) 2006-2020 wolfSSL Inc.
  4. #
  5. # This file is part of wolfSSL. (formerly known as CyaSSL)
  6. #
  7. #
  8. AC_COPYRIGHT([Copyright (C) 2006-2020 wolfSSL Inc.])
  9. AC_PREREQ([2.63])
  10. AC_INIT([wolfssl],[4.5.0],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[https://www.wolfssl.com])
  11. AC_CONFIG_AUX_DIR([build-aux])
  12. # The following sets CFLAGS to empty if unset on command line. We do not
  13. # 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=26:0:2
  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.
  43. # Use of C_EXTRA_FLAGS is deprecated because CFLAGS was fixed but someone
  44. # might still be using it.
  45. CFLAGS="$CFLAGS $C_EXTRA_FLAGS $C_FLAGS"
  46. gl_VISIBILITY
  47. AS_IF([ test -n "$CFLAG_VISIBILITY" ], [
  48. AM_CFLAGS="$AM_CPPFLAGS $CFLAG_VISIBILITY"
  49. ])
  50. # Moved these size of and type checks before the library checks.
  51. # The library checks add the library to subsequent test compiles
  52. # and in some rare cases, the networking check causes these sizeof
  53. # checks to fail.
  54. AC_CHECK_SIZEOF([long long])
  55. AC_CHECK_SIZEOF([long])
  56. AC_CHECK_SIZEOF([time_t])
  57. AC_CHECK_TYPES([__uint128_t])
  58. AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h time.h sys/ioctl.h sys/socket.h sys/time.h errno.h])
  59. AC_CHECK_LIB([network],[socket])
  60. AC_C_BIGENDIAN
  61. # check if functions of interest are linkable, but also check if
  62. # they're declared by the expected headers, and if not, supersede the
  63. # unusable positive from AC_CHECK_FUNCS().
  64. AC_CHECK_FUNCS([gethostbyname getaddrinfo gettimeofday gmtime_r inet_ntoa memset socket strftime])
  65. AC_CHECK_DECLS([gethostbyname, getaddrinfo, gettimeofday, gmtime_r, inet_ntoa, memset, socket, strftime], [], [
  66. if test "$(eval echo \$"$(eval 'echo ac_cv_func_${as_decl_name}')")" = "yes"
  67. then
  68. echo " note: earlier check for $(eval 'echo ${as_decl_name}') superseded."
  69. eval "$(eval 'echo ac_cv_func_${as_decl_name}=no')"
  70. _mask_varname=HAVE_`eval "echo '${as_decl_name}'" | tr 'a-z' 'A-Z'`
  71. echo "g/#define $_mask_varname 1/s//\/* #undef $_mask_varname *\//
  72. wq
  73. ." | ed -s confdefs.h
  74. fi
  75. ], [[
  76. #ifdef HAVE_SYS_SOCKET_H
  77. #include <sys/socket.h>
  78. #endif
  79. #ifdef HAVE_STRING_H
  80. #include <string.h>
  81. #endif
  82. #ifdef HAVE_NETDB_H
  83. #include <netdb.h>
  84. #endif
  85. #ifdef HAVE_ARPA_INET_H
  86. #include <arpa/inet.h>
  87. #endif
  88. #ifdef HAVE_SYS_TIME_H
  89. #include <sys/time.h>
  90. #endif
  91. #ifdef HAVE_TIME_H
  92. #include <time.h>
  93. #endif
  94. ]])
  95. AC_PROG_INSTALL
  96. AC_TYPE_SIZE_T
  97. AC_TYPE_UINT8_T
  98. AM_PROG_AS
  99. LT_LIB_M
  100. OPTIMIZE_CFLAGS="-Os"
  101. OPTIMIZE_FAST_CFLAGS="-O2"
  102. OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET"
  103. DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_WOLFSSL"
  104. LIB_ADD=
  105. LIB_STATIC_ADD=
  106. # Thread local storage
  107. AX_TLS([thread_ls_on=yes],[thread_ls_on=no])
  108. AS_IF([test "x$thread_ls_on" = "xyes"],[AM_CFLAGS="$AM_CFLAGS -DHAVE_THREAD_LS"])
  109. # DEBUG
  110. AX_DEBUG
  111. AS_IF([test "$ax_enable_debug" = "yes"],
  112. [AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"],
  113. [AM_CFLAGS="$AM_CFLAGS -DNDEBUG"])
  114. # FIPS
  115. AC_ARG_ENABLE([fips],
  116. [AS_HELP_STRING([--enable-fips],[Enable FIPS 140-2, Will NOT work w/o FIPS license (default: disabled)])],
  117. [ENABLED_FIPS=$enableval],
  118. [ENABLED_FIPS="no"])
  119. AS_CASE([$ENABLED_FIPS],
  120. ["ready"],[
  121. ENABLED_FIPS="yes"
  122. FIPS_VERSION="v2"
  123. FIPS_READY="yes"
  124. ],
  125. ["v2"],[
  126. # FIPS v2
  127. ENABLED_FIPS="yes"
  128. FIPS_VERSION="v2"
  129. ],
  130. ["rand"],[
  131. # FIPS Rand
  132. ENABLED_FIPS="yes"
  133. FIPS_VERSION="rand"
  134. ],
  135. ["no"],[FIPS_VERSION="none"],
  136. [
  137. # FIPS v1
  138. ENABLED_FIPS="yes"
  139. FIPS_VERSION="v1"
  140. ])
  141. # Distro build feature subset (Debian, Ubuntu, etc.)
  142. AC_ARG_ENABLE([distro],
  143. [AS_HELP_STRING([--enable-distro],[Enable wolfSSL distro build (default: disabled)])],
  144. [ ENABLED_DISTRO=$enableval ],
  145. [ ENABLED_DISTRO=no ]
  146. )
  147. if test "$ENABLED_DISTRO" = "yes"
  148. then
  149. enable_shared=yes
  150. enable_static=yes
  151. enable_all=yes
  152. fi
  153. # Linux Kernel Module
  154. AC_ARG_ENABLE([linuxkm],
  155. [AS_HELP_STRING([--enable-linuxkm],[Enable Linux Kernel Module (default: disabled)])],
  156. [ENABLED_LINUXKM=$enableval],
  157. [ENABLED_LINUXKM=no]
  158. )
  159. AC_ARG_ENABLE([linuxkm-defaults],
  160. [AS_HELP_STRING([--enable-linuxkm-defaults],[Enable feature defaults for Linux Kernel Module (default: disabled)])],
  161. [ENABLED_LINUXKM_DEFAULTS=$enableval],
  162. [ENABLED_LINUXKM_DEFAULTS=$ENABLED_LINUXKM]
  163. )
  164. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  165. then
  166. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_CONST -DWOLFSSL_SP_MOD_WORD_RP -DWOLFSSL_OLD_PRIME_CHECK -DWOLFSSL_SP_DIV_64 -DWOLFSSL_SP_DIV_WORD_HALF -DSP_HALF_SIZE=32 -DSP_HALF_MAX=4294967295U"
  167. fi
  168. AC_ARG_WITH([linux-source],
  169. [AS_HELP_STRING([--with-linux-source=PATH],[PATH to root of Linux kernel build tree])],
  170. [KERNEL_ROOT=$withval],
  171. [KERNEL_ROOT=""])
  172. AC_ARG_WITH([linux-arch],
  173. [AS_HELP_STRING([--with-linux-arch=arch],[built arch (SRCARCH) of Linux kernel build tree])],
  174. [KERNEL_ARCH=$withval],
  175. [KERNEL_ARCH=""])
  176. if test "x$ENABLED_LINUXKM" = "xyes"
  177. then
  178. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LINUXKM"
  179. ENABLED_NO_LIBRARY=yes
  180. if test "$KERNEL_ROOT" = ""; then
  181. AC_PATH_DEFAULT_KERNEL_SOURCE
  182. KERNEL_ROOT="$DEFAULT_KERNEL_ROOT"
  183. fi
  184. AC_SUBST([KERNEL_ROOT])
  185. if test "$KERNEL_ARCH" = ""; then
  186. AC_DEFAULT_KERNEL_ARCH
  187. KERNEL_ARCH="$DEFAULT_KERNEL_ARCH"
  188. fi
  189. AC_SUBST([KERNEL_ARCH])
  190. if test "${KERNEL_ROOT}" = ""; then
  191. AC_MSG_ERROR([Linux kernel source root not found -- supply with --with-linux-source=PATH.])
  192. fi
  193. if test "${KERNEL_ARCH}" = ""; then
  194. AC_MSG_ERROR([Linux kernel target architecture for build tree ${KERNEL_ROOT} could not be determined. Is target kernel configured?])
  195. fi
  196. AM_CFLAGS="$AM_CFLAGS -DNO_DEV_RANDOM -DNO_WRITEV -DNO_STDIO_FILESYSTEM -DWOLFSSL_NO_SOCK -DWOLFSSL_USER_IO"
  197. fi
  198. # Single Precision maths implementation
  199. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  200. then
  201. ENABLED_SP_DEFAULT=small
  202. else
  203. ENABLED_SP_DEFAULT=no
  204. fi
  205. AC_ARG_ENABLE([sp],
  206. [AS_HELP_STRING([--enable-sp],[Enable Single Precision maths implementation (default: disabled)])],
  207. [ ENABLED_SP=$enableval ],
  208. [ ENABLED_SP=$ENABLED_SP_DEFAULT ],
  209. )
  210. # Single Precision maths exclusively (no fastmath)
  211. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes" && test "$ENABLED_SP" != "no"
  212. then
  213. ENABLED_SP_MATH_DEFAULT=yes
  214. else
  215. ENABLED_SP_MATH_DEFAULT=no
  216. fi
  217. AC_ARG_ENABLE([sp-math],
  218. [AS_HELP_STRING([--enable-sp-math],[Enable Single Precision math implementation only (default: disabled)])],
  219. [ ENABLED_SP_MATH=$enableval ],
  220. [ ENABLED_SP_MATH=$ENABLED_SP_MATH_DEFAULT ],
  221. )
  222. # ALL FEATURES
  223. AC_ARG_ENABLE([all],
  224. [AS_HELP_STRING([--enable-all],[Enable all wolfSSL features, except SSLv3 (default: disabled)])],
  225. [ ENABLED_ALL=$enableval ],
  226. [ ENABLED_ALL=no ]
  227. )
  228. if test "$ENABLED_ALL" = "yes"
  229. then
  230. enable_dtls=yes
  231. if test "x$FIPS_VERSION" != "xv1"
  232. then
  233. enable_tls13=yes
  234. enable_rsapss=yes
  235. fi
  236. enable_openssh=yes
  237. enable_opensslextra=yes
  238. enable_opensslall=yes
  239. enable_savesession=yes
  240. enable_savecert=yes
  241. enable_atomicuser=yes
  242. enable_pkcallbacks=yes
  243. enable_aesgcm=yes
  244. enable_aesccm=yes
  245. enable_aesctr=yes
  246. enable_aesofb=yes
  247. enable_aescfb=yes
  248. enable_camellia=yes
  249. enable_ripemd=yes
  250. enable_sha512=yes
  251. enable_sha224=yes
  252. enable_sha3=yes
  253. enable_sessioncerts=yes
  254. enable_keygen=yes
  255. enable_certgen=yes
  256. enable_certreq=yes
  257. enable_certext=yes
  258. enable_sep=yes
  259. enable_hkdf=yes
  260. enable_dsa=yes
  261. enable_ecccustcurves=yes
  262. enable_compkey=yes
  263. enable_curve25519=yes
  264. enable_curve448=yes
  265. enable_ed448=yes
  266. enable_ed25519=yes
  267. enable_fpecc=yes
  268. enable_eccencrypt=yes
  269. enable_psk=yes
  270. enable_idea=yes
  271. enable_cmac=yes
  272. enable_xts=yes
  273. enable_webserver=yes
  274. enable_hc128=yes
  275. enable_rabbit=yes
  276. enable_xchacha=yes
  277. enable_ocsp=yes
  278. enable_ocspstapling=yes
  279. enable_ocspstapling2=yes
  280. enable_crl=yes
  281. enable_crl_monitor=yes
  282. enable_sni=yes
  283. enable_maxfragment=yes
  284. enable_alpn=yes
  285. enable_truncatedhmac=yes
  286. enable_trusted_ca=yes
  287. enable_supportedcurves=yes
  288. enable_session_ticket=yes
  289. enable_tlsx=yes
  290. enable_pkcs7=yes
  291. enable_ssh=yes
  292. enable_scep=yes
  293. enable_srp=yes
  294. enable_certservice=yes
  295. enable_jni=yes
  296. enable_lighty=yes
  297. enable_haproxy=yes
  298. enable_stunnel=yes
  299. enable_nginx=yes
  300. enable_openvpn=yes
  301. enable_asio=yes
  302. enable_libwebsockets=yes
  303. enable_qt=yes
  304. enable_pwdbased=yes
  305. enable_aeskeywrap=yes
  306. enable_x963kdf=yes
  307. enable_scrypt=yes
  308. enable_indef=yes
  309. enable_enckeys=yes
  310. enable_hashflags=yes
  311. enable_defaultdhparams=yes
  312. enable_arc4=yes
  313. enable_des3=yes
  314. enable_nullcipher=yes
  315. enable_blake2=yes
  316. enable_blake2s=yes
  317. enable_md2=yes
  318. enable_md4=yes
  319. enable_postauth=yes
  320. enable_hrrcookie=yes
  321. enable_cryptocb=yes
  322. enable_fallback_scsv=yes
  323. enable_anon=yes
  324. enable_mcast=yes
  325. # Enable DH const table speedups (eliminates `-lm` math lib dependency)
  326. AM_CFLAGS="$AM_CFLAGS -DHAVE_FFDHE_2048 -DHAVE_FFDHE_3072 -DFP_MAX_BITS=8192"
  327. # Enable multiple attribute additions such as DC
  328. AM_CFLAGS="-DWOLFSSL_MULTI_ATTRIB $AM_CFLAGS"
  329. # Enable AES Decrypt, AES ECB, Alt Names, DER Load, Keep Certs, CRL IO with Timeout
  330. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_DECRYPT -DHAVE_AES_ECB -DWOLFSSL_ALT_NAMES -DWOLFSSL_DER_LOAD -DKEEP_OUR_CERT -DKEEP_PEER_CERT"
  331. # Enable ECC Key Gen checks
  332. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_KEYGEN"
  333. if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
  334. then
  335. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_IO -DHAVE_IO_TIMEOUT"
  336. fi
  337. if test "$ENABLED_SP_MATH" = "no"
  338. then
  339. # Enable ECC Import checks
  340. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_IMPORT"
  341. else
  342. # sp-math is incompatible with opensslextra, ECC custom curves, and DSA:
  343. enable_openssh=no
  344. enable_opensslextra=no
  345. enable_opensslall=no
  346. enable_dsa=no
  347. enable_ecccustcurves=no
  348. enable_srp=no
  349. enable_certservice=no
  350. enable_jni=no
  351. enable_lighty=no
  352. enable_haproxy=no
  353. enable_stunnel=no
  354. enable_nginx=no
  355. enable_apachehttpd=no
  356. enable_openvpn=no
  357. enable_asio=no
  358. enable_libwebsockets=no
  359. enable_qt=no
  360. fi
  361. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  362. then
  363. enable_compkey=no
  364. fi
  365. fi
  366. # ALL CRYPTO FEATURES
  367. AC_ARG_ENABLE([all-crypto],
  368. [AS_HELP_STRING([--enable-all-crypto],[Enable all wolfcrypt algorithms (default: disabled)])],
  369. [ ENABLED_ALL_CRYPT=$enableval ],
  370. [ ENABLED_ALL_CRYPT=no ]
  371. )
  372. if test "$ENABLED_ALL_CRYPT" = "yes"
  373. then
  374. enable_atomicuser=yes
  375. enable_pkcallbacks=yes
  376. enable_aesgcm=yes
  377. enable_aesccm=yes
  378. enable_aesctr=yes
  379. enable_aesofb=yes
  380. enable_aescfb=yes
  381. enable_camellia=yes
  382. enable_ripemd=yes
  383. enable_sha512=yes
  384. enable_sha224=yes
  385. enable_sha3=yes
  386. enable_sessioncerts=yes
  387. enable_keygen=yes
  388. enable_certgen=yes
  389. enable_certreq=yes
  390. enable_certext=yes
  391. enable_sep=yes
  392. enable_hkdf=yes
  393. enable_curve25519=yes
  394. enable_curve448=yes
  395. enable_ed448=yes
  396. enable_ed25519=yes
  397. enable_fpecc=yes
  398. enable_eccencrypt=yes
  399. enable_psk=yes
  400. enable_idea=yes
  401. enable_cmac=yes
  402. enable_xts=yes
  403. enable_hc128=yes
  404. enable_rabbit=yes
  405. enable_xchacha=yes
  406. enable_ocsp=yes
  407. enable_ocspstapling=yes
  408. enable_ocspstapling2=yes
  409. enable_crl=yes
  410. enable_supportedcurves=yes
  411. enable_tlsx=yes
  412. enable_pkcs7=yes
  413. enable_pwdbased=yes
  414. enable_aeskeywrap=yes
  415. enable_x963kdf=yes
  416. enable_scrypt=yes
  417. enable_indef=yes
  418. enable_enckeys=yes
  419. enable_hashflags=yes
  420. enable_defaultdhparams=yes
  421. enable_arc4=yes
  422. enable_des3=yes
  423. enable_nullcipher=yes
  424. enable_blake2=yes
  425. enable_blake2s=yes
  426. enable_md2=yes
  427. enable_md4=yes
  428. enable_cryptocb=yes
  429. enable_anon=yes
  430. if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
  431. then
  432. enable_compkey=yes
  433. fi
  434. # Enable AES Decrypt, AES ECB, Alt Names, DER Load
  435. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_DECRYPT -DHAVE_AES_ECB -DWOLFSSL_ALT_NAMES -DWOLFSSL_DER_LOAD"
  436. # Enable DH const table speedups (eliminates `-lm` math lib dependency)
  437. AM_CFLAGS="$AM_CFLAGS -DHAVE_FFDHE_2048 -DHAVE_FFDHE_3072 -DFP_MAX_BITS=8192"
  438. # Enable multiple attribute additions such as DC
  439. AM_CFLAGS="-DWOLFSSL_MULTI_ATTRIB $AM_CFLAGS"
  440. # Enable ECC Key Gen checks
  441. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_KEYGEN"
  442. if test "$ENABLED_SP_MATH" = "no"
  443. then
  444. enable_dsa=yes
  445. enable_ecccustcurves=yes
  446. # Enable ECC Import checks
  447. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_IMPORT"
  448. fi
  449. fi
  450. # Support for forcing 32-bit mode
  451. # To force 32-bit instructions use:
  452. # ./configure CFLAGS="-m32" LDFLAGS="-m32" && make
  453. # The checks for sizeof long and long/long are run at the top of configure and require "-m32" to be set directly in the ./configure statement.
  454. AC_ARG_ENABLE([32bit],
  455. [AS_HELP_STRING([--enable-32bit],[Enables 32-bit support (default: disabled)])],
  456. [ ENABLED_32BIT=$enableval ],
  457. [ ENABLED_32BIT=no ]
  458. )
  459. # 16-bit compiler support
  460. AC_ARG_ENABLE([16bit],
  461. [AS_HELP_STRING([--enable-16bit],[Enables 16-bit support (default: disabled)])],
  462. [ ENABLED_16BIT=$enableval ],
  463. [ ENABLED_16BIT=no ]
  464. )
  465. if test "$ENABLED_16BIT" = "yes"
  466. then
  467. AM_CFLAGS="$AM_CFLAGS -DWC_16BIT_CPU"
  468. fi
  469. # Support for disabling all ASM
  470. AC_ARG_ENABLE([asm],
  471. [AS_HELP_STRING([--enable-asm],[Enables option for assembly (default: enabled)])],
  472. [ ENABLED_ASM=$enableval ],
  473. [ ENABLED_ASM=yes ]
  474. )
  475. if test "$ENABLED_ASM" = "no"
  476. then
  477. AM_CFLAGS="$AM_CFLAGS -DTFM_NO_ASM -DWOLFSSL_NO_ASM"
  478. fi
  479. AC_SUBST([ENABLED_ASM])
  480. # SINGLE THREADED
  481. AC_ARG_ENABLE([singlethreaded],
  482. [AS_HELP_STRING([--enable-singlethreaded],[Enable wolfSSL single threaded (default: disabled)])],
  483. [ ENABLED_SINGLETHREADED=$enableval ],
  484. [ ENABLED_SINGLETHREADED=no ])
  485. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xno" ],[
  486. AX_PTHREAD([
  487. AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
  488. # If AX_PTHREAD is adding -Qunused-arguments, need to prepend with -Xcompiler libtool will use it. Newer
  489. # versions of clang don't need the -Q flag when using pthreads.
  490. AS_CASE([$PTHREAD_CFLAGS],[-Qunused-arguments*],[PTHREAD_CFLAGS="-Xcompiler $PTHREAD_CFLAGS"])
  491. AM_CFLAGS="-D_POSIX_THREADS $AM_CFLAGS $PTHREAD_CFLAGS"
  492. LIBS="$LIBS $PTHREAD_LIBS"
  493. ],[
  494. ENABLED_SINGLETHREADED=yes
  495. ])
  496. ])
  497. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xyes" ],[ AM_CFLAGS="-DSINGLE_THREADED $AM_CFLAGS" ])
  498. # DTLS
  499. AC_ARG_ENABLE([dtls],
  500. [AS_HELP_STRING([--enable-dtls],[Enable wolfSSL DTLS (default: disabled)])],
  501. [ ENABLED_DTLS=$enableval ],
  502. [ ENABLED_DTLS=no ]
  503. )
  504. if test "$ENABLED_DTLS" = "yes"
  505. then
  506. AM_CFLAGS="-DWOLFSSL_DTLS $AM_CFLAGS"
  507. fi
  508. # DTLS change MTU
  509. AC_ARG_ENABLE([dtls-mtu],
  510. [AS_HELP_STRING([--enable-dtls-mtu],[Enable setting the MTU size for wolfSSL DTLS (default: disabled)])],
  511. [ ENABLED_DTLS_MTU=$enableval ],
  512. [ ENABLED_DTLS_MTU=no ]
  513. )
  514. if test "$ENABLED_DTLS_MTU" = "yes"
  515. then
  516. AM_CFLAGS="-DWOLFSSL_DTLS_MTU $AM_CFLAGS"
  517. fi
  518. # TLS v1.3 Draft 18 (Note: only final TLS v1.3 supported, here for backwards build compatibility)
  519. AC_ARG_ENABLE([tls13-draft18],
  520. [AS_HELP_STRING([--enable-tls13-draft18],[Enable wolfSSL TLS v1.3 Draft 18 (default: disabled)])],
  521. [ ENABLED_TLS13_DRAFT18=$enableval ],
  522. [ ENABLED_TLS13_DRAFT18=no ]
  523. )
  524. # TLS v1.3
  525. AC_ARG_ENABLE([tls13],
  526. [AS_HELP_STRING([--enable-tls13],[Enable wolfSSL TLS v1.3 (default: enabled)])],
  527. [ ENABLED_TLS13=$enableval ],
  528. [ ENABLED_TLS13=yes ]
  529. )
  530. if test "x$FIPS_VERSION" = "xv1"
  531. then
  532. ENABLED_TLS13="no"
  533. fi
  534. # Post-handshake Authentication
  535. AC_ARG_ENABLE([postauth],
  536. [AS_HELP_STRING([--enable-postauth],[Enable wolfSSL Post-handshake Authentication (default: disabled)])],
  537. [ ENABLED_TLS13_POST_AUTH=$enableval ],
  538. [ ENABLED_TLS13_POST_AUTH=no ]
  539. )
  540. if test "$ENABLED_TLS13_POST_AUTH" = "yes"
  541. then
  542. if test "x$ENABLED_TLS13" = "xno"
  543. then
  544. AC_MSG_ERROR([cannot enable postauth without enabling tls13.])
  545. fi
  546. AM_CFLAGS="-DWOLFSSL_POST_HANDSHAKE_AUTH $AM_CFLAGS"
  547. fi
  548. # Hello Retry Request Cookie
  549. AC_ARG_ENABLE([hrrcookie],
  550. [AS_HELP_STRING([--enable-hrrcookie],[Enable the server to send Cookie Extension in HRR with state (default: disabled)])],
  551. [ ENABLED_SEND_HRR_COOKIE=$enableval ],
  552. [ ENABLED_SEND_HRR_COOKIE=no ]
  553. )
  554. if test "$ENABLED_SEND_HRR_COOKIE" = "yes"
  555. then
  556. if test "x$ENABLED_TLS13" = "xno"
  557. then
  558. AC_MSG_ERROR([cannot enable hrrcookie without enabling tls13.])
  559. fi
  560. AM_CFLAGS="-DWOLFSSL_SEND_HRR_COOKIE $AM_CFLAGS"
  561. fi
  562. # RNG
  563. AC_ARG_ENABLE([rng],
  564. [AS_HELP_STRING([--enable-rng],[Enable compiling and using RNG (default: enabled)])],
  565. [ ENABLED_RNG=$enableval ],
  566. [ ENABLED_RNG=yes ]
  567. )
  568. if test "$ENABLED_RNG" = "no"
  569. then
  570. AM_CFLAGS="$AM_CFLAGS -DWC_NO_RNG"
  571. fi
  572. # DTLS-SCTP
  573. AC_ARG_ENABLE([sctp],
  574. [AS_HELP_STRING([--enable-sctp],[Enable wolfSSL DTLS-SCTP support (default: disabled)])],
  575. [ENABLED_SCTP=$enableval],
  576. [ENABLED_SCTP=no])
  577. AS_IF([test "x$ENABLED_SCTP" = "xyes"],
  578. [AC_MSG_CHECKING([for SCTP])
  579. AC_RUN_IFELSE(
  580. [AC_LANG_PROGRAM(
  581. [[
  582. #include <sys/socket.h>
  583. #include <arpa/inet.h>
  584. ]],
  585. [[int s = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); if (s == -1) return 1;]])],
  586. [AC_MSG_RESULT(yes)],
  587. [AC_MSG_RESULT(no)
  588. AC_MSG_ERROR([SCTP not available, remove enable-sctp from configure])])
  589. ])
  590. # DTLS-MULTICAST
  591. AC_ARG_ENABLE([mcast],
  592. [AS_HELP_STRING([--enable-mcast],[Enable wolfSSL DTLS multicast support (default: disabled)])],
  593. [ENABLED_MCAST=$enableval],
  594. [ENABLED_MCAST=no])
  595. # List of open source project defines using our openssl compatibility layer:
  596. # openssh (--enable-openssh) WOLFSSL_OPENSSH
  597. # openvpn (--enable-openvpn) WOLFSSL_OPENVPN
  598. # nginix (--enable-nginx) WOLFSSL_NGINX
  599. # haproxy (--enable-haproxy) WOLFSSL_HAPROXY
  600. # wpa_supplicant (--enable-wpas) WOLFSSL_WPAS
  601. # ssl fortress (--enable-fortress) FORTRESS
  602. # ssl bump (--enable-bump)
  603. # signal (--enable-signal)
  604. # lighty (--enable-lighty) HAVE_LIGHTY
  605. # stunnel (--enable-stunnel) HAVE_STUNNEL
  606. # asio (--enable-asio) WOLFSSL_ASIO
  607. # libwebsockets (--enable-libwebsockets) WOLFSSL_LIBWEBSOCKETS
  608. # qt (--enable-qt) WOLFSSL_QT
  609. # qt test (--enable-qt-test) WOLFSSL_QT_TEST
  610. # HAVE_POCO_LIB
  611. # WOLFSSL_MYSQL_COMPATIBLE
  612. # web server (--enable-webserver) HAVE_WEBSERVER
  613. # OpenSSH compatibility Build
  614. AC_ARG_ENABLE([openssh],
  615. [AS_HELP_STRING([--enable-openssh],[Enable OpenSSH compatibility build (default: disabled)])],
  616. [ENABLED_OPENSSH=$enableval],
  617. [ENABLED_OPENSSH=no])
  618. # OpenVPN compatibility Build
  619. AC_ARG_ENABLE([openvpn],
  620. [AS_HELP_STRING([--enable-openvpn],[Enable OpenVPN compatibility build (default: disabled)])],
  621. [ENABLED_OPENVPN=$enableval],
  622. [ENABLED_OPENVPN=no])
  623. # nginx compatibility build
  624. AC_ARG_ENABLE([nginx],
  625. [AS_HELP_STRING([--enable-nginx],[Enable nginx (default: disabled)])],
  626. [ ENABLED_NGINX=$enableval ],
  627. [ ENABLED_NGINX=no ]
  628. )
  629. # haproxy compatibility build
  630. AC_ARG_ENABLE([haproxy],
  631. [AS_HELP_STRING([--enable-haproxy],[Enable haproxy (default: disabled)])],
  632. [ ENABLED_HAPROXY=$enableval ],
  633. [ ENABLED_HAPROXY=no ]
  634. )
  635. # wpa_supplicant support
  636. AC_ARG_ENABLE([wpas],
  637. [AS_HELP_STRING([--enable-wpas],[Enable wpa_supplicant support (default: disabled)])],
  638. [ ENABLED_WPAS=$enableval ],
  639. [ ENABLED_WPAS=no ]
  640. )
  641. # wpa_supplicant support
  642. AC_ARG_ENABLE([wpas-dpp],
  643. [AS_HELP_STRING([--enable-wpas-dpp],[Enable wpa_supplicant support with dpp (default: disabled)])],
  644. [ ENABLED_WPAS_DPP=$enableval ],
  645. [ ENABLED_WPAS_DPP=no ]
  646. )
  647. if test "$ENABLED_WPAS_DPP" = "yes"
  648. then
  649. ENABLED_WPAS="yes"
  650. fi
  651. # Fortress build
  652. AC_ARG_ENABLE([fortress],
  653. [AS_HELP_STRING([--enable-fortress],[Enable SSL fortress build (default: disabled)])],
  654. [ ENABLED_FORTRESS=$enableval ],
  655. [ ENABLED_FORTRESS=no ]
  656. )
  657. # libwebsockets Support
  658. AC_ARG_ENABLE([libwebsockets],
  659. [AS_HELP_STRING([--enable-libwebsockets],[Enable libwebsockets (default: disabled)])],
  660. [ ENABLED_LIBWEBSOCKETS=$enableval ],
  661. [ ENABLED_LIBWEBSOCKETS=no ]
  662. )
  663. if test "$ENABLED_LIBWEBSOCKETS" = "yes"
  664. then
  665. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LIBWEBSOCKETS -DHAVE_EX_DATA -DOPENSSL_NO_EC"
  666. fi
  667. if test "$ENABLED_OPENSSH" = "yes"
  668. then
  669. ENABLED_FORTRESS="yes"
  670. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_OPENSSH -DHAVE_EX_DATA -DWOLFSSL_BASE16"
  671. fi
  672. #IP alternative name Support
  673. AC_ARG_ENABLE([ip-alt-name],
  674. [AS_HELP_STRING([--enable-ip-alt-name],[Enable IP subject alternative name (default: disabled)])],
  675. [ ENABLE_IP_ALT_NAME=$enableval ],
  676. [ ENABLE_IP_ALT_NAME=no ]
  677. )
  678. if test "$ENABLE_IP_ALT_NAME" = "yes"
  679. then
  680. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_IP_ALT_NAME"
  681. fi
  682. #Qt Support
  683. AC_ARG_ENABLE([qt],
  684. [AS_HELP_STRING([--enable-qt],[Enable qt (default: disabled)])],
  685. [ ENABLED_QT=$enableval ],
  686. [ ENABLED_QT=no ]
  687. )
  688. # ssl bump build
  689. AC_ARG_ENABLE([bump],
  690. [AS_HELP_STRING([--enable-bump],[Enable SSL Bump build (default: disabled)])],
  691. [ ENABLED_BUMP=$enableval ],
  692. [ ENABLED_BUMP=no ]
  693. )
  694. # SNIFFER
  695. AC_ARG_ENABLE([sniffer],
  696. [AS_HELP_STRING([--enable-sniffer],[Enable wolfSSL sniffer support (default: disabled)])],
  697. [ ENABLED_SNIFFER=$enableval ],
  698. [ ENABLED_SNIFFER=no ]
  699. )
  700. # signal compatibility build
  701. AC_ARG_ENABLE([signal],
  702. [AS_HELP_STRING([--enable-signal],[Enable signal (default: disabled)])],
  703. [ ENABLED_SIGNAL=$enableval ],
  704. [ ENABLED_SIGNAL=no ]
  705. )
  706. # OpenSSL Coexist
  707. AC_ARG_ENABLE([opensslcoexist],
  708. [AS_HELP_STRING([--enable-opensslcoexist],[Enable coexistence of wolfssl/openssl (default: disabled)])],
  709. [ ENABLED_OPENSSLCOEXIST=$enableval ],
  710. [ ENABLED_OPENSSLCOEXIST=no ]
  711. )
  712. if test "x$ENABLED_OPENSSLCOEXIST" = "xyes"
  713. then
  714. # make sure old names are disabled
  715. enable_oldnames=no
  716. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_COEXIST"
  717. fi
  718. # OPENSSL Compatibility ALL
  719. AC_ARG_ENABLE([opensslall],
  720. [AS_HELP_STRING([--enable-opensslall],[Enable all OpenSSL API, size++ (default: disabled)])],
  721. [ ENABLED_OPENSSLALL=$enableval ],
  722. [ ENABLED_OPENSSLALL=no ]
  723. )
  724. if test "$ENABLED_LIBWEBSOCKETS" = "yes" || test "$ENABLED_OPENVPN" = "yes" || test "$ENABLED_WPAS_DPP" = "yes"
  725. then
  726. ENABLED_OPENSSLALL="yes"
  727. fi
  728. if test "$ENABLED_OPENSSLALL" = "yes"
  729. then
  730. AM_CFLAGS="-DOPENSSL_ALL -DWOLFSSL_EITHER_SIDE -DWC_RSA_NO_PADDING -DWC_RSA_PSS $AM_CFLAGS"
  731. fi
  732. # OPENSSL Extra Compatibility
  733. AC_ARG_ENABLE([opensslextra],
  734. [AS_HELP_STRING([--enable-opensslextra],[Enable extra OpenSSL API, size+ (default: disabled)])],
  735. [ ENABLED_OPENSSLEXTRA=$enableval ],
  736. [ ENABLED_OPENSSLEXTRA=no ]
  737. )
  738. 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" || test "$ENABLED_LIBWEBSOCKETS" = "yes"
  739. then
  740. ENABLED_OPENSSLEXTRA="yes"
  741. fi
  742. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  743. then
  744. AM_CFLAGS="-DOPENSSL_EXTRA -DWOLFSSL_ALWAYS_VERIFY_CB $AM_CFLAGS"
  745. AM_CFLAGS="-DWOLFSSL_VERIFY_CB_ALL_CERTS -DWOLFSSL_EXTRA_ALERTS $AM_CFLAGS"
  746. AM_CFLAGS="-DHAVE_EXT_CACHE $AM_CFLAGS"
  747. fi
  748. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_SMALL" = "yes"
  749. then
  750. AC_MSG_ERROR([cannot enable small and opensslextra, only one or the other.])
  751. fi
  752. if test "$ENABLED_OPENSSLEXTRA" = "x509small"
  753. then
  754. AC_MSG_NOTICE([Enabling only a subset of X509 opensslextra])
  755. AM_CFLAGS="-DOPENSSL_EXTRA_X509_SMALL $AM_CFLAGS"
  756. AM_CFLAGS="-DWOLFSSL_EKU_OID -DWOLFSSL_MULTI_ATTRIB $AM_CFLAGS"
  757. fi
  758. # High Strength Build
  759. AC_ARG_ENABLE([maxstrength],
  760. [AS_HELP_STRING([--enable-maxstrength],[Enable Max Strength build, allows TLSv1.2-AEAD-PFS ciphers only (default: disabled)])],
  761. [ENABLED_MAXSTRENGTH=$enableval],
  762. [ENABLED_MAXSTRENGTH=no])
  763. # Harden, enable Timing Resistance and Blinding by default
  764. AC_ARG_ENABLE([harden],
  765. [AS_HELP_STRING([--enable-harden],[Enable Hardened build, Enables Timing Resistance and Blinding (default: enabled)])],
  766. [ENABLED_HARDEN=$enableval],
  767. [ENABLED_HARDEN=yes])
  768. if test "$ENABLED_HARDEN" = "yes"
  769. then
  770. AM_CFLAGS="$AM_CFLAGS -DTFM_TIMING_RESISTANT -DECC_TIMING_RESISTANT"
  771. if test "$ENABLED_RNG" = "yes"
  772. then
  773. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_BLINDING"
  774. fi
  775. else
  776. AM_CFLAGS="$AM_CFLAGS -DWC_NO_HARDEN"
  777. fi
  778. # IPv6 Test Apps
  779. AC_ARG_ENABLE([ipv6],
  780. [AS_HELP_STRING([--enable-ipv6],[Enable testing of IPV6 (default: disabled)])],
  781. [ ENABLED_IPV6=$enableval ],
  782. [ ENABLED_IPV6=no ]
  783. )
  784. if test "$ENABLED_IPV6" = "yes"
  785. then
  786. AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6 -DWOLFSSL_IPV6"
  787. fi
  788. if test "$ENABLED_WPAS" = "small"
  789. then
  790. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WPAS_SMALL"
  791. AM_CFLAGS="$AM_CFLAGS -DKEEP_OUR_CERT"
  792. AM_CFLAGS="$AM_CFLAGS -DKEEP_PEER_CERT"
  793. fi
  794. if test "$ENABLED_WPAS" = "yes"
  795. then
  796. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WPAS"
  797. fi
  798. if test "$ENABLED_WPAS" != "no"
  799. then
  800. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_VERIFY_CB"
  801. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  802. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
  803. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE"
  804. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_EITHER_SIDE"
  805. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA_X509_SMALL"
  806. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PUBLIC_MP"
  807. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DER_LOAD"
  808. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  809. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  810. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB"
  811. fi
  812. if test "$ENABLED_FORTRESS" = "yes"
  813. then
  814. AM_CFLAGS="$AM_CFLAGS -DFORTRESS -DWOLFSSL_ALWAYS_VERIFY_CB -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT -DWOLFSSL_DER_LOAD -DWOLFSSL_KEY_GEN"
  815. fi
  816. if test "$ENABLED_BUMP" = "yes"
  817. then
  818. 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"
  819. fi
  820. ENABLED_SLOWMATH="yes"
  821. # lean psk build
  822. AC_ARG_ENABLE([leanpsk],
  823. [AS_HELP_STRING([--enable-leanpsk],[Enable Lean PSK build (default: disabled)])],
  824. [ ENABLED_LEANPSK=$enableval ],
  825. [ ENABLED_LEANPSK=no ]
  826. )
  827. if test "$ENABLED_LEANPSK" = "yes"
  828. then
  829. 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"
  830. ENABLED_SLOWMATH="no"
  831. ENABLED_SINGLETHREADED="yes"
  832. enable_lowresource=yes
  833. fi
  834. # lean TLS build (TLS 1.2 client only (no client auth), ECC256, AES128 and SHA256 w/o Shamir)
  835. AC_ARG_ENABLE([leantls],
  836. [AS_HELP_STRING([--enable-leantls],[Enable Lean TLS build (default: disabled)])],
  837. [ ENABLED_LEANTLS=$enableval ],
  838. [ ENABLED_LEANTLS=no ]
  839. )
  840. if test "$ENABLED_LEANTLS" = "yes"
  841. then
  842. 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 -DNO_WOLFSSL_CM_VERIFY"
  843. enable_lowresource=yes
  844. fi
  845. # low resource options to reduce flash and memory use
  846. AC_ARG_ENABLE([lowresource],
  847. [AS_HELP_STRING([--enable-lowresource],[Enable low resource options for memory/flash (default: disabled)])],
  848. [ ENABLED_LOWRESOURCE=$enableval ],
  849. [ ENABLED_LOWRESOURCE=no ]
  850. )
  851. if test "$ENABLED_LOWRESOURCE" = "yes"
  852. then
  853. # low memory / flash flags
  854. AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE -DRSA_LOW_MEM -DALT_ECC_SIZE -DGCM_SMALL -DCURVE25519_SMALL -DED25519_SMALL -DWOLFSSL_SMALL_CERT_VERIFY"
  855. # low flash flags
  856. AM_CFLAGS="$AM_CFLAGS -DUSE_SLOW_SHA -DUSE_SLOW_SHA256 -DUSE_SLOW_SHA512"
  857. fi
  858. # TITAN cache
  859. AC_ARG_ENABLE([titancache],
  860. [AS_HELP_STRING([--enable-titancache],[Enable titan session cache (default: disabled)])],
  861. [ ENABLED_TITANCACHE=$enableval ],
  862. [ ENABLED_TITANCACHE=no ]
  863. )
  864. if test "$ENABLED_TITANCACHE" = "yes"
  865. then
  866. AM_CFLAGS="$AM_CFLAGS -DTITAN_SESSION_CACHE"
  867. fi
  868. # HUGE cache
  869. AC_ARG_ENABLE([hugecache],
  870. [AS_HELP_STRING([--enable-hugecache],[Enable huge session cache (default: disabled)])],
  871. [ ENABLED_HUGECACHE=$enableval ],
  872. [ ENABLED_HUGECACHE=no ]
  873. )
  874. if test "$ENABLED_HUGECACHE" = "yes"
  875. then
  876. AM_CFLAGS="$AM_CFLAGS -DHUGE_SESSION_CACHE"
  877. fi
  878. # big cache
  879. AC_ARG_ENABLE([bigcache],
  880. [AS_HELP_STRING([--enable-bigcache],[Enable big session cache (default: disabled)])],
  881. [ ENABLED_BIGCACHE=$enableval ],
  882. [ ENABLED_BIGCACHE=no ]
  883. )
  884. if test "$ENABLED_BIGCACHE" = "yes"
  885. then
  886. AM_CFLAGS="$AM_CFLAGS -DBIG_SESSION_CACHE"
  887. fi
  888. # SMALL cache
  889. AC_ARG_ENABLE([smallcache],
  890. [AS_HELP_STRING([--enable-smallcache],[Enable small session cache (default: disabled)])],
  891. [ ENABLED_SMALLCACHE=$enableval ],
  892. [ ENABLED_SMALLCACHE=no ]
  893. )
  894. if test "$ENABLED_SMALLCACHE" = "yes"
  895. then
  896. AM_CFLAGS="$AM_CFLAGS -DSMALL_SESSION_CACHE"
  897. fi
  898. # Persistent session cache
  899. AC_ARG_ENABLE([savesession],
  900. [AS_HELP_STRING([--enable-savesession],[Enable persistent session cache (default: disabled)])],
  901. [ ENABLED_SAVESESSION=$enableval ],
  902. [ ENABLED_SAVESESSION=no ]
  903. )
  904. if test "$ENABLED_SAVESESSION" = "yes"
  905. then
  906. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  907. fi
  908. # Persistent cert cache
  909. AC_ARG_ENABLE([savecert],
  910. [AS_HELP_STRING([--enable-savecert],[Enable persistent cert cache (default: disabled)])],
  911. [ ENABLED_SAVECERT=$enableval ],
  912. [ ENABLED_SAVECERT=no ]
  913. )
  914. if test "$ENABLED_SAVECERT" = "yes"
  915. then
  916. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  917. fi
  918. # Write duplicate WOLFSSL object
  919. AC_ARG_ENABLE([writedup],
  920. [AS_HELP_STRING([--enable-writedup],[Enable write duplication of WOLFSSL objects (default: disabled)])],
  921. [ ENABLED_WRITEDUP=$enableval ],
  922. [ ENABLED_WRITEDUP=no ]
  923. )
  924. if test "$ENABLED_WRITEDUP" = "yes"
  925. then
  926. AM_CFLAGS="$AM_CFLAGS -DHAVE_WRITE_DUP"
  927. fi
  928. # Atomic User Record Layer
  929. AC_ARG_ENABLE([atomicuser],
  930. [AS_HELP_STRING([--enable-atomicuser],[Enable Atomic User Record Layer (default: disabled)])],
  931. [ ENABLED_ATOMICUSER=$enableval ],
  932. [ ENABLED_ATOMICUSER=no ]
  933. )
  934. if test "$ENABLED_ATOMICUSER" = "yes"
  935. then
  936. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  937. fi
  938. # Public Key Callbacks
  939. AC_ARG_ENABLE([pkcallbacks],
  940. [AS_HELP_STRING([--enable-pkcallbacks],[Enable Public Key Callbacks (default: disabled)])],
  941. [ ENABLED_PKCALLBACKS=$enableval ],
  942. [ ENABLED_PKCALLBACKS=no ]
  943. )
  944. if test "$ENABLED_PKCALLBACKS" = "yes"
  945. then
  946. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  947. fi
  948. # Microchip/Atmel CryptoAuthLib
  949. ENABLED_CRYPTOAUTHLIB="no"
  950. trylibatcadir=""
  951. AC_ARG_WITH([cryptoauthlib],
  952. [AS_HELP_STRING([--with-cryptoauthlib=PATH],[PATH to CryptoAuthLib install (default /usr/)])],
  953. [
  954. AC_MSG_CHECKING([for cryptoauthlib])
  955. CPPFLAGS="$CPPFLAGS -DWOLFSSL_ATECC508A"
  956. LIBS="$LIBS -lcryptoauth"
  957. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cryptoauthlib.h>]], [[ atcab_init(0); ]])],[ libatca_linked=yes ],[ libatca_linked=no ])
  958. if test "x$libatca_linked" = "xno" ; then
  959. if test "x$withval" != "xno" ; then
  960. trylibatcadir=$withval
  961. fi
  962. if test "x$withval" = "xyes" ; then
  963. trylibatcadir="/usr"
  964. fi
  965. LDFLAGS="$LDFLAGS -L$trylibatcadir/lib"
  966. CPPFLAGS="$CPPFLAGS -I$trylibatcadir/lib"
  967. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cryptoauthlib.h>]], [[ atcab_init(0); ]])],[ libatca_linked=yes ],[ libatca_linked=no ])
  968. if test "x$libatca_linked" = "xno" ; then
  969. AC_MSG_ERROR([cryptoauthlib isn't found.
  970. If it's already installed, specify its path using --with-cryptoauthlib=/dir/])
  971. fi
  972. AM_LDFLAGS="$AM_LDFLAGS -L$trylibatcadir/lib"
  973. AM_CFLAGS="$AM_CFLAGS -I$trylibatcadir/lib"
  974. AC_MSG_RESULT([yes])
  975. else
  976. AC_MSG_RESULT([yes])
  977. fi
  978. ENABLED_CRYPTOAUTHLIB="yes"
  979. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ATECC508A"
  980. ]
  981. )
  982. # sniffer doesn't work in maxstrength mode
  983. if test "$ENABLED_SNIFFER" = "yes" && test "$ENABLED_MAXSTRENGTH" = "yes"
  984. then
  985. AC_MSG_ERROR([cannot enable maxstrength in sniffer mode.])
  986. fi
  987. ENABLED_SNIFFTEST=no
  988. AS_IF([ test "x$ENABLED_SNIFFER" = "xyes" ],
  989. [
  990. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SNIFFER -DWOLFSSL_STATIC_EPHEMERAL"
  991. AC_CHECK_HEADERS([pcap/pcap.h],
  992. [ ENABLED_SNIFFTEST=yes ],
  993. [ AC_MSG_WARN([cannot enable sniffer test without having libpcap available.]) ]
  994. )
  995. ])
  996. # AES-CBC
  997. AC_ARG_ENABLE([aescbc],
  998. [AS_HELP_STRING([--enable-aescbc],[Enable wolfSSL AES-CBC support (default: enabled)])],
  999. [ ENABLED_AESCBC=$enableval ],
  1000. [ ENABLED_AESCBC=yes ]
  1001. )
  1002. if test "$ENABLED_AESCBC" = "no"
  1003. then
  1004. AM_CFLAGS="$AM_CFLAGS -DNO_AES_CBC"
  1005. fi
  1006. # leanpsk and leantls don't need gcm
  1007. # AES-GCM
  1008. AC_ARG_ENABLE([aesgcm],
  1009. [AS_HELP_STRING([--enable-aesgcm],[Enable wolfSSL AES-GCM support (default: enabled)])],
  1010. [ ENABLED_AESGCM=$enableval ],
  1011. [ ENABLED_AESGCM=yes ]
  1012. )
  1013. # leanpsk and leantls don't need gcm
  1014. if test "$ENABLED_LEANPSK" = "yes" || ( test "$ENABLED_LEANTLS" = "yes" &&
  1015. test "$ENABLED_TLS13" = "no")
  1016. then
  1017. ENABLED_AESGCM=no
  1018. fi
  1019. if test "$ENABLED_AESGCM" != "no"
  1020. then
  1021. if test "$ENABLED_AESGCM" = "word32"
  1022. then
  1023. AM_CFLAGS="$AM_CFLAGS -DGCM_WORD32"
  1024. ENABLED_AESGCM=yes
  1025. fi
  1026. if test "$ENABLED_AESGCM" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1027. then
  1028. AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL"
  1029. ENABLED_AESGCM=yes
  1030. fi
  1031. if test "$ENABLED_AESGCM" = "table"
  1032. then
  1033. AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE"
  1034. ENABLED_AESGCM=yes
  1035. fi
  1036. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  1037. fi
  1038. # AES-CCM
  1039. AC_ARG_ENABLE([aesccm],
  1040. [AS_HELP_STRING([--enable-aesccm],[Enable wolfSSL AES-CCM support (default: disabled)])],
  1041. [ ENABLED_AESCCM=$enableval ],
  1042. [ ENABLED_AESCCM=no ]
  1043. )
  1044. if test "$ENABLED_AESCCM" = "yes"
  1045. then
  1046. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"
  1047. fi
  1048. # AES-CTR
  1049. AC_ARG_ENABLE([aesctr],
  1050. [AS_HELP_STRING([--enable-aesctr],[Enable wolfSSL AES-CTR support (default: disabled)])],
  1051. [ ENABLED_AESCTR=$enableval ],
  1052. [ ENABLED_AESCTR=no ]
  1053. )
  1054. if test "$ENABLED_OPENVPN" = "yes"
  1055. then
  1056. ENABLED_AESCTR=yes
  1057. fi
  1058. if test "$ENABLED_AESCTR" = "yes"
  1059. then
  1060. if test "x$ENABLED_FORTRESS" != "xyes"
  1061. then
  1062. # This is already implied by fortress build
  1063. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  1064. fi
  1065. fi
  1066. # AES-OFB
  1067. AC_ARG_ENABLE([aesofb],
  1068. [AS_HELP_STRING([--enable-aesofb],[Enable wolfSSL AES-OFB support (default: disabled)])],
  1069. [ ENABLED_AESOFB=$enableval ],
  1070. [ ENABLED_AESOFB=no ]
  1071. )
  1072. if test "$ENABLED_AESOFB" = "yes"
  1073. then
  1074. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_OFB -DWOLFSSL_AES_DIRECT"
  1075. fi
  1076. # AES-CFB
  1077. AC_ARG_ENABLE([aescfb],
  1078. [AS_HELP_STRING([--enable-aescfb],[Enable wolfSSL AES-CFB support (default: disabled)])],
  1079. [ ENABLED_AESCFB=$enableval ],
  1080. [ ENABLED_AESCFB=no ]
  1081. )
  1082. if test "$ENABLED_AESCFB" = "yes"
  1083. then
  1084. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_CFB"
  1085. fi
  1086. # AES-ARM
  1087. AC_ARG_ENABLE([armasm],
  1088. [AS_HELP_STRING([--enable-armasm],[Enable wolfSSL ARMv8 ASM support (default: disabled)])],
  1089. [ ENABLED_ARMASM=$enableval ],
  1090. [ ENABLED_ARMASM=no ]
  1091. )
  1092. if test "$ENABLED_ARMASM" = "yes" && test "$ENABLED_ASM" = "yes"
  1093. then
  1094. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_ARMASM"
  1095. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM -DWOLFSSL_NO_HASH_RAW"
  1096. #Check if mcpu and mfpu values already set if not use default
  1097. case $CPPFLAGS in
  1098. *mcpu* | *mfpu*)
  1099. break;; #Do not override user set values
  1100. *)
  1101. case $host_cpu in
  1102. *aarch64*)
  1103. case $host_os in
  1104. *darwin*)
  1105. ;;
  1106. *)
  1107. # +crypto needed for hardware acceleration
  1108. AM_CPPFLAGS="$AM_CPPFLAGS -mcpu=generic+crypto"
  1109. ;;
  1110. esac
  1111. # Include options.h
  1112. AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
  1113. # Check for and set -mstrict-align compiler flag
  1114. # Used to set assumption that Aarch64 systems will not handle
  1115. # unaligned memory references. The flag -mstrict-align is needed
  1116. # on some compiler versions to avoid an invalid addressing mode
  1117. # error with "m" constraint variables in the inline assembly AES
  1118. # code. Even though unaligned load/store access is permitted on
  1119. # normal memory with Cortex-A series boards with the exception
  1120. # being exclusive and ordered access.
  1121. case $CPPFLAGS in
  1122. *mstrict-align*)
  1123. break;; # already set by user
  1124. *)
  1125. AM_CPPFLAGS="$AM_CPPFLAGS -mstrict-align"
  1126. AC_MSG_NOTICE([64bit ARMv8, setting -mstrict-align]);;
  1127. esac
  1128. AC_MSG_NOTICE([64bit ARMv8 found, setting mcpu to generic+crypto]);;
  1129. *)
  1130. AM_CPPFLAGS="$AM_CPPFLAGS -mfpu=crypto-neon-fp-armv8"
  1131. # Include options.h
  1132. AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
  1133. AC_MSG_NOTICE([32bit ARMv8 found, setting mfpu to crypto-neon-fp-armv8]);;
  1134. esac
  1135. esac
  1136. fi
  1137. # Xilinx hardened crypto
  1138. AC_ARG_ENABLE([xilinx],
  1139. [AS_HELP_STRING([--enable-xilinx],[Enable wolfSSL support for Xilinx hardened crypto(default: disabled)])],
  1140. [ ENABLED_XILINX=$enableval ],
  1141. [ ENABLED_XILINX=no ]
  1142. )
  1143. if test "$ENABLED_XILINX" = "yes"
  1144. then
  1145. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_XILINX -DWOLFSSL_XILINX_CRYPT"
  1146. fi
  1147. # INTEL AES-NI
  1148. AC_ARG_ENABLE([aesni],
  1149. [AS_HELP_STRING([--enable-aesni],[Enable wolfSSL AES-NI support (default: disabled)])],
  1150. [ ENABLED_AESNI=$enableval ],
  1151. [ ENABLED_AESNI=no ]
  1152. )
  1153. # INTEL ASM
  1154. AC_ARG_ENABLE([intelasm],
  1155. [AS_HELP_STRING([--enable-intelasm],[Enable All Intel ASM speedups (default: disabled)])],
  1156. [ ENABLED_INTELASM=$enableval ],
  1157. [ ENABLED_INTELASM=no ]
  1158. )
  1159. if test "$ENABLED_ASM" = "yes"
  1160. then
  1161. if test "$ENABLED_AESNI" = "small"
  1162. then
  1163. AM_CFLAGS="$AM_CFLAGS -DAES_GCM_AESNI_NO_UNROLL"
  1164. ENABLED_AESNI=yes
  1165. fi
  1166. if test "$ENABLED_AESNI" = "yes" || test "$ENABLED_INTELASM" = "yes"
  1167. then
  1168. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI"
  1169. if test "$GCC" = "yes"
  1170. then
  1171. # GCC needs these flags, icc doesn't
  1172. # opt levels greater than 2 may cause problems on systems w/o aesni
  1173. if test "$CC" != "icc"
  1174. then
  1175. AM_CFLAGS="$AM_CFLAGS -maes -msse4 -mpclmul"
  1176. fi
  1177. fi
  1178. AS_IF([test "x$ENABLED_AESGCM" != "xno"],[AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"])
  1179. fi
  1180. if test "$ENABLED_INTELASM" = "yes"
  1181. then
  1182. AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDSEED -DUSE_INTEL_SPEEDUP"
  1183. ENABLED_AESNI=yes
  1184. fi
  1185. fi
  1186. # INTEL RDRAND
  1187. AC_ARG_ENABLE([intelrand],
  1188. [AS_HELP_STRING([--enable-intelrand],[Enable Intel rdrand as preferred RNG source (default: disabled)])],
  1189. [ ENABLED_INTELRDRAND=$enableval ],
  1190. [ ENABLED_INTELRDRAND=no ]
  1191. )
  1192. if test "$ENABLED_INTELRDRAND" = "yes"
  1193. then
  1194. AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDRAND"
  1195. fi
  1196. # Linux af_alg
  1197. AC_ARG_ENABLE([afalg],
  1198. [AS_HELP_STRING([--enable-afalg],[Enable Linux af_alg use for crypto (default: disabled)])],
  1199. [ ENABLED_AFALG=$enableval ],
  1200. [ ENABLED_AFALG=no ]
  1201. )
  1202. if test "$ENABLED_AFALG" = "yes"
  1203. then
  1204. if test "$ENABLED_AESCCM" = "yes"
  1205. then
  1206. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  1207. fi
  1208. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG"
  1209. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_HASH"
  1210. fi
  1211. if test "$ENABLED_AFALG" = "xilinx"
  1212. then
  1213. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX -DWOLFSSL_AFALG_XILINX_AES"
  1214. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX_SHA3 -DWOLFSSL_AFALG_XILINX_RSA"
  1215. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA3_224 -DWOLFSSL_NOSHA3_256 -DWOLFSSL_NOSHA3_512 -DWOLFSSL_NO_SHAKE256"
  1216. ENABLED_AFALG="yes"
  1217. ENABLED_XILINX="yes"
  1218. fi
  1219. if test "$ENABLED_AFALG" = "xilinx-aes"
  1220. then
  1221. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX -DWOLFSSL_AFALG_XILINX_AES"
  1222. ENABLED_AFALG="yes"
  1223. ENABLED_XILINX="yes"
  1224. fi
  1225. if test "$ENABLED_AFALG" = "xilinx-sha3"
  1226. then
  1227. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX"
  1228. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX_SHA3"
  1229. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA3_224 -DWOLFSSL_NOSHA3_256 -DWOLFSSL_NOSHA3_512 -DWOLFSSL_NO_SHAKE256"
  1230. ENABLED_AFALG="yes"
  1231. ENABLED_XILINX="yes"
  1232. fi
  1233. if test "$ENABLED_AFALG" = "xilinx-rsa"
  1234. then
  1235. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX"
  1236. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX_RSA"
  1237. ENABLED_AFALG="yes"
  1238. ENABLED_XILINX="yes"
  1239. fi
  1240. # Support for Linux dev/crypto calls
  1241. AC_ARG_ENABLE([devcrypto],
  1242. [AS_HELP_STRING([--enable-devcrypto],[Enable Linux dev crypto calls: all | aes (all aes support) | hash (all hash algos) | cbc (aes-cbc only) (default: disabled)])],
  1243. [ ENABLED_DEVCRYPTO=$enableval ],
  1244. [ ENABLED_DEVCRYPTO=no ]
  1245. )
  1246. if test "$ENABLED_DEVCRYPTO" = "yes" || test "$ENABLED_DEVCRYPTO" = "all"
  1247. then
  1248. #enable all devcrypto supported algorithms
  1249. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  1250. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
  1251. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_AES"
  1252. if test "$ENABLED_AESCCM" = "yes"
  1253. then
  1254. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  1255. fi
  1256. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HASH"
  1257. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_HASH_RAW"
  1258. ENABLED_DEVCRYPTO=yes
  1259. fi
  1260. if test "$ENABLED_DEVCRYPTO" = "aes"
  1261. then
  1262. #enable only AES-CBC algorithm support
  1263. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  1264. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_AES"
  1265. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
  1266. if test "$ENABLED_AESCCM" = "yes"
  1267. then
  1268. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  1269. fi
  1270. ENABLED_DEVCRYPTO=yes
  1271. fi
  1272. if test "$ENABLED_DEVCRYPTO" = "cbc"
  1273. then
  1274. #enable only AES-CBC algorithm support
  1275. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  1276. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
  1277. ENABLED_DEVCRYPTO=yes
  1278. fi
  1279. if test "$ENABLED_DEVCRYPTO" = "hash"
  1280. then
  1281. #enable only hash algorithm support
  1282. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  1283. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HASH"
  1284. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_HASH_RAW"
  1285. ENABLED_DEVCRYPTO=yes
  1286. fi
  1287. # Camellia
  1288. AC_ARG_ENABLE([camellia],
  1289. [AS_HELP_STRING([--enable-camellia],[Enable wolfSSL Camellia support (default: disabled)])],
  1290. [ ENABLED_CAMELLIA=$enableval ],
  1291. [ ENABLED_CAMELLIA=no ]
  1292. )
  1293. if test "$ENABLED_CAMELLIA" = "yes"
  1294. then
  1295. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAMELLIA"
  1296. fi
  1297. # MD2
  1298. AC_ARG_ENABLE([md2],
  1299. [AS_HELP_STRING([--enable-md2],[Enable wolfSSL MD2 support (default: disabled)])],
  1300. [ ENABLED_MD2=$enableval ],
  1301. [ ENABLED_MD2=no ]
  1302. )
  1303. if test "$ENABLED_BUMP" = "yes"
  1304. then
  1305. ENABLED_MD2="yes"
  1306. fi
  1307. if test "$ENABLED_MD2" = "yes"
  1308. then
  1309. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MD2"
  1310. fi
  1311. # NULL CIPHER
  1312. AC_ARG_ENABLE([nullcipher],
  1313. [AS_HELP_STRING([--enable-nullcipher],[Enable wolfSSL NULL cipher support (default: disabled)])],
  1314. [ ENABLED_NULL_CIPHER=$enableval ],
  1315. [ ENABLED_NULL_CIPHER=no ]
  1316. )
  1317. if test "$ENABLED_OPENSSH" = "yes"
  1318. then
  1319. ENABLED_NULL_CIPHER="yes"
  1320. fi
  1321. if test "$ENABLED_NULL_CIPHER" = "yes"
  1322. then
  1323. AM_CFLAGS="$AM_CFLAGS -DHAVE_NULL_CIPHER"
  1324. fi
  1325. # RIPEMD
  1326. AC_ARG_ENABLE([ripemd],
  1327. [AS_HELP_STRING([--enable-ripemd],[Enable wolfSSL RIPEMD-160 support (default: disabled)])],
  1328. [ ENABLED_RIPEMD=$enableval ],
  1329. [ ENABLED_RIPEMD=no ]
  1330. )
  1331. if test "$ENABLED_OPENSSH" = "yes"
  1332. then
  1333. ENABLED_RIPEMD="yes"
  1334. fi
  1335. if test "$ENABLED_RIPEMD" = "yes"
  1336. then
  1337. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RIPEMD"
  1338. fi
  1339. # BLAKE2
  1340. AC_ARG_ENABLE([blake2],
  1341. [AS_HELP_STRING([--enable-blake2],[Enable wolfSSL BLAKE2b support (default: disabled)])],
  1342. [ ENABLED_BLAKE2=$enableval ],
  1343. [ ENABLED_BLAKE2=no ]
  1344. )
  1345. if test "$ENABLED_BLAKE2" = "yes"
  1346. then
  1347. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2 -DHAVE_BLAKE2B"
  1348. fi
  1349. AC_ARG_ENABLE([blake2s],
  1350. [AS_HELP_STRING([--enable-blake2s],[Enable wolfSSL BLAKE2s support (default: disabled)])],
  1351. [ ENABLED_BLAKE2S=$enableval ],
  1352. [ ENABLED_BLAKE2S=no ]
  1353. )
  1354. if test "$ENABLED_BLAKE2S" = "yes"
  1355. then
  1356. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2S"
  1357. ENABLED_BLAKE2="yes"
  1358. fi
  1359. # SHA512
  1360. AC_ARG_ENABLE([sha512],
  1361. [AS_HELP_STRING([--enable-sha512],[Enable wolfSSL SHA-512 support (default: enabled)])],
  1362. [ ENABLED_SHA512=$enableval ],
  1363. [ ENABLED_SHA512=yes ]
  1364. )
  1365. # options that don't require sha512
  1366. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes" || test "$ENABLED_32BIT" = "yes" || test "$ENABLED_16BIT" = "yes"
  1367. then
  1368. ENABLED_SHA512="no"
  1369. fi
  1370. # options that require sha512
  1371. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_FORTRESS" = "yes"
  1372. then
  1373. ENABLED_SHA512="yes"
  1374. ENABLED_SHA384="yes"
  1375. fi
  1376. if test "$ENABLED_SHA512" = "yes"
  1377. then
  1378. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512"
  1379. fi
  1380. # SHA384
  1381. AC_ARG_ENABLE([sha384],
  1382. [AS_HELP_STRING([--enable-sha384],[Enable wolfSSL SHA-384 support (default: enabled)])],
  1383. [ ENABLED_SHA384=$enableval ],
  1384. [ ENABLED_SHA384=yes ]
  1385. )
  1386. # options that don't require sha384
  1387. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes" || test "$ENABLED_32BIT" = "yes" || test "$ENABLED_16BIT" = "yes"
  1388. then
  1389. ENABLED_SHA384="no"
  1390. fi
  1391. # options that require sha384
  1392. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_FORTRESS" = "yes"
  1393. then
  1394. ENABLED_SHA384="yes"
  1395. fi
  1396. if test "$ENABLED_SHA384" = "yes"
  1397. then
  1398. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA384"
  1399. fi
  1400. # SESSION CERTS
  1401. AC_ARG_ENABLE([sessioncerts],
  1402. [AS_HELP_STRING([--enable-sessioncerts],[Enable session cert storing (default: disabled)])],
  1403. [ ENABLED_SESSIONCERTS=$enableval ],
  1404. [ ENABLED_SESSIONCERTS=no ]
  1405. )
  1406. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_OPENVPN" = "xyes"
  1407. then
  1408. ENABLED_SESSIONCERTS=yes
  1409. fi
  1410. if test "$ENABLED_TLS13" = "yes" && test "$ENABLED_PSK" = "yes"
  1411. then
  1412. ENABLED_SESSIONCERTS=yes
  1413. fi
  1414. if test "$ENABLED_SESSIONCERTS" = "yes"
  1415. then
  1416. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  1417. fi
  1418. # KEY GENERATION
  1419. AC_ARG_ENABLE([keygen],
  1420. [AS_HELP_STRING([--enable-keygen],[Enable key generation (default: disabled)])],
  1421. [ ENABLED_KEYGEN=$enableval ],
  1422. [ ENABLED_KEYGEN=no ]
  1423. )
  1424. if test "$ENABLED_KEYGEN" = "yes"
  1425. then
  1426. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  1427. fi
  1428. # CERT GENERATION
  1429. AC_ARG_ENABLE([certgen],
  1430. [AS_HELP_STRING([--enable-certgen],[Enable cert generation (default: disabled)])],
  1431. [ ENABLED_CERTGEN=$enableval ],
  1432. [ ENABLED_CERTGEN=no ]
  1433. )
  1434. if test "$ENABLED_OPENVPN" = "yes" || test "$ENABLED_OPENSSH" = "yes"
  1435. then
  1436. ENABLED_CERTGEN=yes
  1437. fi
  1438. if test "$ENABLED_CERTGEN" = "yes"
  1439. then
  1440. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  1441. fi
  1442. # CERT REQUEST GENERATION
  1443. AC_ARG_ENABLE([certreq],
  1444. [AS_HELP_STRING([--enable-certreq],[Enable cert request generation (default: disabled)])],
  1445. [ ENABLED_CERTREQ=$enableval ],
  1446. [ ENABLED_CERTREQ=no ]
  1447. )
  1448. if test "$ENABLED_CERTREQ" = "yes"
  1449. then
  1450. if test "$ENABLED_CERTGEN" = "no"
  1451. then
  1452. AC_MSG_ERROR([cannot enable certreq without enabling certgen.])
  1453. fi
  1454. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  1455. fi
  1456. # CERT REQUEST EXTENSION
  1457. AC_ARG_ENABLE([certext],
  1458. [AS_HELP_STRING([--enable-certext],[Enable cert request extensions (default: disabled)])],
  1459. [ ENABLED_CERTEXT=$enableval ],
  1460. [ ENABLED_CERTEXT=no ]
  1461. )
  1462. if test "$ENABLED_OPENVPN" = "yes"
  1463. then
  1464. ENABLED_CERTEXT=yes
  1465. fi
  1466. if test "$ENABLED_CERTEXT" = "yes"
  1467. then
  1468. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  1469. fi
  1470. # DECODED CERT CACHE
  1471. AC_ARG_ENABLE([certgencache],
  1472. [AS_HELP_STRING([--enable-certgencache],[Enable decoded cert caching (default: disabled)])],
  1473. [ ENABLED_certgencache=$enableval ],
  1474. [ ENABLED_certgencache=no ]
  1475. )
  1476. if test "$ENABLED_certgencache" = "yes"
  1477. then
  1478. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN_CACHE"
  1479. fi
  1480. # SEP
  1481. AC_ARG_ENABLE([sep],
  1482. [AS_HELP_STRING([--enable-sep],[Enable sep extensions (default: disabled)])],
  1483. [ ENABLED_SEP=$enableval ],
  1484. [ ENABLED_SEP=no ]
  1485. )
  1486. if test "$ENABLED_SEP" = "yes"
  1487. then
  1488. AM_CFLAGS="-DWOLFSSL_SEP -DKEEP_PEER_CERT $AM_CFLAGS"
  1489. fi
  1490. # HKDF
  1491. AC_ARG_ENABLE([hkdf],
  1492. [AS_HELP_STRING([--enable-hkdf],[Enable HKDF (HMAC-KDF) support (default: disabled)])],
  1493. [ ENABLED_HKDF=$enableval ],
  1494. [ ENABLED_HKDF=no ]
  1495. )
  1496. if test "$ENABLED_TLS13" = "yes"
  1497. then
  1498. ENABLED_HKDF="yes"
  1499. fi
  1500. if test "$ENABLED_HKDF" = "yes"
  1501. then
  1502. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"
  1503. fi
  1504. # X9.63 KDF
  1505. AC_ARG_ENABLE([x963kdf],
  1506. [AS_HELP_STRING([--enable-x963kdf],[Enable X9.63 KDF support (default: disabled)])],
  1507. [ ENABLED_X963KDF=$enableval ],
  1508. [ ENABLED_X963KDF=no ]
  1509. )
  1510. if test "$ENABLED_X963KDF" = "yes"
  1511. then
  1512. AM_CFLAGS="$AM_CFLAGS -DHAVE_X963_KDF"
  1513. fi
  1514. # DSA
  1515. AC_ARG_ENABLE([dsa],
  1516. [AS_HELP_STRING([--enable-dsa],[Enable DSA (default: disabled)])],
  1517. [ ENABLED_DSA=$enableval ],
  1518. [ ENABLED_DSA=no ]
  1519. )
  1520. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_OPENVPN" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_QT" = "yes"
  1521. then
  1522. ENABLED_DSA="yes"
  1523. fi
  1524. if test "$ENABLED_DSA" = "no" && test "$ENABLED_OPENSSH" = "no"
  1525. then
  1526. AM_CFLAGS="$AM_CFLAGS -DNO_DSA"
  1527. fi
  1528. # ECC Shamir
  1529. AC_ARG_ENABLE([eccshamir],
  1530. [AS_HELP_STRING([--enable-eccshamir],[Enable ECC Shamir (default: enabled)])],
  1531. [ ENABLED_ECC_SHAMIR=$enableval ],
  1532. [ ENABLED_ECC_SHAMIR=yes ]
  1533. )
  1534. # ECC
  1535. AC_ARG_ENABLE([ecc],
  1536. [AS_HELP_STRING([--enable-ecc],[Enable ECC (default: enabled)])],
  1537. [ ENABLED_ECC=$enableval ],
  1538. [ ENABLED_ECC=yes ]
  1539. )
  1540. # lean psk doesn't need ecc
  1541. if test "$ENABLED_LEANPSK" = "yes"
  1542. then
  1543. ENABLED_ECC=no
  1544. fi
  1545. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$ENABLED_SIGNAL" = "yes"
  1546. then
  1547. ENABLED_ECC="yes"
  1548. fi
  1549. if test "$ENABLED_ECC" != "no"
  1550. then
  1551. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  1552. if test "$ENABLED_ECC_SHAMIR" = "yes" && test "$ENABLED_LOWRESOURCE" = "no"
  1553. then
  1554. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  1555. fi
  1556. if test "$ENABLED_ECC" = "nonblock"
  1557. then
  1558. AM_CFLAGS="$AM_CFLAGS -DWC_ECC_NONBLOCK"
  1559. fi
  1560. fi
  1561. # ECC Custom Curves
  1562. AC_ARG_ENABLE([ecccustcurves],
  1563. [AS_HELP_STRING([--enable-ecccustcurves],[Enable ECC custom curves (default: disabled)])],
  1564. [ ENABLED_ECCCUSTCURVES=$enableval ],
  1565. [ ENABLED_ECCCUSTCURVES=no ]
  1566. )
  1567. if test "$ENABLED_ECCCUSTCURVES" != "no"
  1568. then
  1569. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES"
  1570. # For distro, all or ecccustcurves=all builds, enable all curve types
  1571. if test "$ENABLED_DISTRO" = "yes" || test "$ENABLED_ALL" = "yes" || test "$ENABLED_ECCCUSTCURVES" = "all"
  1572. then
  1573. # Enable ECC SECPR2, SECPR3, BRAINPOOL and KOBLITZ curves
  1574. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ"
  1575. # Enable ECC Cofactor support
  1576. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_CDH"
  1577. # If fastmath enabled and on x86 use speedups
  1578. if test "x$ENABLED_FASTMATH" = "xyes" && test "$host_cpu" = "x86_64"
  1579. then
  1580. AM_CFLAGS="$AM_CFLAGS -DTFM_ECC192 -DTFM_ECC224 -DTFM_ECC256 -DTFM_ECC384 -DTFM_ECC521"
  1581. fi
  1582. fi
  1583. fi
  1584. # Compressed Key
  1585. AC_ARG_ENABLE([compkey],
  1586. [AS_HELP_STRING([--enable-compkey],[Enable compressed keys support (default: disabled)])],
  1587. [ ENABLED_COMPKEY=$enableval ],
  1588. [ ENABLED_COMPKEY=no ]
  1589. )
  1590. if test "$ENABLED_WPAS" = "yes"
  1591. then
  1592. ENABLED_COMPKEY=yes
  1593. fi
  1594. if test "$ENABLED_COMPKEY" = "yes"
  1595. then
  1596. AM_CFLAGS="$AM_CFLAGS -DHAVE_COMP_KEY"
  1597. fi
  1598. # for using memory optimization setting on both curve25519 and ed25519
  1599. ENABLED_CURVE25519_SMALL=no
  1600. ENABLED_ED25519_SMALL=no
  1601. # CURVE25519
  1602. AC_ARG_ENABLE([curve25519],
  1603. [AS_HELP_STRING([--enable-curve25519],[Enable Curve25519 (default: disabled)])],
  1604. [ ENABLED_CURVE25519=$enableval ],
  1605. [ ENABLED_CURVE25519=no ]
  1606. )
  1607. if test "$ENABLED_OPENSSH" = "yes"
  1608. then
  1609. ENABLED_CURVE25519="yes"
  1610. fi
  1611. if test "$ENABLED_CURVE25519" != "no"
  1612. then
  1613. if test "$ENABLED_CURVE25519" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1614. then
  1615. AM_CFLAGS="$AM_CFLAGS -DCURVE25519_SMALL"
  1616. ENABLED_CURVE25519_SMALL=yes
  1617. ENABLED_CURVE25519=yes
  1618. fi
  1619. if test "$ENABLED_CURVE25519" = "no128bit" || test "$ENABLED_32BIT" = "yes"
  1620. then
  1621. AM_CFLAGS="$AM_CFLAGS -DNO_CURVED25519_128BIT"
  1622. ENABLED_CURVE25519=yes
  1623. fi
  1624. AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE25519"
  1625. ENABLED_FEMATH=yes
  1626. fi
  1627. # ED25519
  1628. AC_ARG_ENABLE([ed25519],
  1629. [AS_HELP_STRING([--enable-ed25519],[Enable ED25519 (default: disabled)])],
  1630. [ ENABLED_ED25519=$enableval ],
  1631. [ ENABLED_ED25519=no ]
  1632. )
  1633. if test "$ENABLED_OPENSSH" = "yes"
  1634. then
  1635. ENABLED_ED25519="yes"
  1636. fi
  1637. if test "$ENABLED_ED25519" != "no" && test "$ENABLED_32BIT" = "no"
  1638. then
  1639. if test "$ENABLED_ED25519" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1640. then
  1641. AM_CFLAGS="$AM_CFLAGS -DED25519_SMALL"
  1642. ENABLED_ED25519_SMALL=yes
  1643. ENABLED_CURVE25519_SMALL=yes
  1644. ENABLED_ED25519=yes
  1645. fi
  1646. if test "$ENABLED_SHA512" = "no"
  1647. then
  1648. AC_MSG_ERROR([cannot enable ed25519 without enabling sha512.])
  1649. fi
  1650. ENABLED_FEMATH=yes
  1651. ENABLED_GEMATH=yes
  1652. AM_CFLAGS="$AM_CFLAGS -DHAVE_ED25519"
  1653. fi
  1654. # for using memory optimization setting on both curve448 and ed448
  1655. ENABLED_CURVE448_SMALL=no
  1656. ENABLED_ED448_SMALL=no
  1657. # CURVE448
  1658. AC_ARG_ENABLE([curve448],
  1659. [AS_HELP_STRING([--enable-curve448],[Enable Curve448 (default: disabled)])],
  1660. [ ENABLED_CURVE448=$enableval ],
  1661. [ ENABLED_CURVE448=no ]
  1662. )
  1663. if test "$ENABLED_CURVE448" != "no"
  1664. then
  1665. if test "$ENABLED_CURVE448" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1666. then
  1667. AM_CFLAGS="$AM_CFLAGS -DCURVE448_SMALL"
  1668. ENABLED_CURVE448_SMALL=yes
  1669. ENABLED_CURVE448=yes
  1670. fi
  1671. if test "$ENABLED_CURVE448" = "no128bit" || test "$ENABLED_32BIT" = "yes"
  1672. then
  1673. AM_CFLAGS="$AM_CFLAGS -DNO_CURVED448_128BIT"
  1674. ENABLED_CURVE448=yes
  1675. fi
  1676. AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE448"
  1677. ENABLED_FE448=yes
  1678. fi
  1679. # ED448
  1680. AC_ARG_ENABLE([ed448],
  1681. [AS_HELP_STRING([--enable-ed448],[Enable ED448 (default: disabled)])],
  1682. [ ENABLED_ED448=$enableval ],
  1683. [ ENABLED_ED448=no ]
  1684. )
  1685. if test "$ENABLED_ED448" != "no" && test "$ENABLED_32BIT" = "no"
  1686. then
  1687. if test "$ENABLED_ED448" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1688. then
  1689. AM_CFLAGS="$AM_CFLAGS -DED448_SMALL"
  1690. ENABLED_ED448_SMALL=yes
  1691. ENABLED_CURVE448_SMALL=yes
  1692. ENABLED_ED448=yes
  1693. fi
  1694. if test "$ENABLED_SHA512" = "no"
  1695. then
  1696. AC_MSG_ERROR([cannot enable ed448 without enabling sha512.])
  1697. fi
  1698. ENABLED_FE448=yes
  1699. ENABLED_GE448=yes
  1700. AM_CFLAGS="$AM_CFLAGS -DHAVE_ED448"
  1701. # EdDSA448 requires SHAKE256 which requires SHA-3
  1702. ENABLED_SHAKE3=yes
  1703. ENABLED_SHAKE256=yes
  1704. fi
  1705. # FP ECC, Fixed Point cache ECC
  1706. AC_ARG_ENABLE([fpecc],
  1707. [AS_HELP_STRING([--enable-fpecc],[Enable Fixed Point cache ECC (default: disabled)])],
  1708. [ ENABLED_FPECC=$enableval ],
  1709. [ ENABLED_FPECC=no ]
  1710. )
  1711. if test "$ENABLED_FPECC" = "yes"
  1712. then
  1713. if test "$ENABLED_ECC" = "no"
  1714. then
  1715. AC_MSG_ERROR([cannot enable fpecc without enabling ecc.])
  1716. fi
  1717. AM_CFLAGS="$AM_CFLAGS -DFP_ECC"
  1718. fi
  1719. # ECC encrypt
  1720. AC_ARG_ENABLE([eccencrypt],
  1721. [AS_HELP_STRING([--enable-eccencrypt],[Enable ECC encrypt (default: disabled)])],
  1722. [ ENABLED_ECC_ENCRYPT=$enableval ],
  1723. [ ENABLED_ECC_ENCRYPT=no ]
  1724. )
  1725. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  1726. then
  1727. if test "$ENABLED_ECC" = "no"
  1728. then
  1729. AC_MSG_ERROR([cannot enable eccencrypt without enabling ecc.])
  1730. fi
  1731. if test "$ENABLED_HKDF" = "no"
  1732. then
  1733. AC_MSG_ERROR([cannot enable eccencrypt without enabling hkdf.])
  1734. fi
  1735. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_ENCRYPT"
  1736. fi
  1737. # PSK
  1738. AC_ARG_ENABLE([psk],
  1739. [AS_HELP_STRING([--enable-psk],[Enable PSK (default: disabled)])],
  1740. [ ENABLED_PSK=$enableval ],
  1741. [ ENABLED_PSK=no ]
  1742. )
  1743. # Single PSK identity
  1744. AC_ARG_ENABLE([psk-one-id],
  1745. [AS_HELP_STRING([--enable-psk-one-id],[Enable PSK (default: disabled)])],
  1746. [ ENABLED_PSK_ONE_ID=$enableval ],
  1747. [ ENABLED_PSK_ONE_ID=no ]
  1748. )
  1749. if test "$ENABLED_PSK_ONE_ID" = "yes"
  1750. then
  1751. if test "$ENABLED_PSK" = "no"
  1752. then
  1753. ENABLED_PSK="yes"
  1754. fi
  1755. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PSK_ONE_ID"
  1756. fi
  1757. # ERROR STRINGS
  1758. AC_ARG_ENABLE([errorstrings],
  1759. [AS_HELP_STRING([--enable-errorstrings],[Enable error strings table (default: enabled)])],
  1760. [ ENABLED_ERROR_STRINGS=$enableval ],
  1761. [ ENABLED_ERROR_STRINGS=yes ]
  1762. )
  1763. if test "$ENABLED_ERROR_STRINGS" = "no"
  1764. then
  1765. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  1766. else
  1767. # turn off error strings if leanpsk or leantls on
  1768. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1769. then
  1770. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  1771. ENABLED_ERROR_STRINGS=no
  1772. fi
  1773. fi
  1774. # ERROR QUEUE
  1775. AC_ARG_ENABLE([errorqueue],
  1776. [AS_HELP_STRING([--disable-errorqueue],[Disables adding nodes to error queue when compiled with OPENSSL_EXTRA (default: enabled)])],
  1777. [ ENABLED_ERROR_QUEUE=$enableval ],
  1778. [ ENABLED_ERROR_QUEUE=yes ]
  1779. )
  1780. if test "$ENABLED_ERROR_QUEUE" = "no"
  1781. then
  1782. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_QUEUE"
  1783. fi
  1784. # OLD TLS
  1785. AC_ARG_ENABLE([oldtls],
  1786. [AS_HELP_STRING([--enable-oldtls],[Enable old TLS versions < 1.2 (default: enabled)])],
  1787. [ ENABLED_OLD_TLS=$enableval ],
  1788. [ ENABLED_OLD_TLS=yes ]
  1789. )
  1790. if test "$ENABLED_OLD_TLS" = "no"
  1791. then
  1792. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  1793. else
  1794. # turn off old if leanpsk or leantls on
  1795. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1796. then
  1797. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  1798. ENABLED_OLD_TLS=no
  1799. fi
  1800. fi
  1801. # TLSv1.2
  1802. AC_ARG_ENABLE([tlsv12],
  1803. [AS_HELP_STRING([--enable-tlsv12],[Enable TLS versions 1.2 (default: enabled)])],
  1804. [ ENABLED_TLSV12=$enableval ],
  1805. [ ENABLED_TLSV12=yes ]
  1806. )
  1807. if test "$ENABLED_TLSV12" = "no"
  1808. then
  1809. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_TLS12 -DNO_OLD_TLS"
  1810. fi
  1811. # TLSv1.0
  1812. AC_ARG_ENABLE([tlsv10],
  1813. [AS_HELP_STRING([--enable-tlsv10],[Enable old TLS versions 1.0 (default: disabled)])],
  1814. [ ENABLED_TLSV10=$enableval ],
  1815. [ ENABLED_TLSV10=no ]
  1816. )
  1817. if test "$ENABLED_TLSV10" = "yes"
  1818. then
  1819. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_TLSV10"
  1820. fi
  1821. # SSLv3
  1822. AC_ARG_ENABLE([sslv3],
  1823. [AS_HELP_STRING([--enable-sslv3],[Enable SSL version 3.0 (default: disabled)])],
  1824. [ ENABLED_SSLV3=$enableval ],
  1825. [ ENABLED_SSLV3=no]
  1826. )
  1827. if test "x$ENABLED_HAPROXY" = "xyes" && test "x$ENABLED_ALL" = "xno"
  1828. then
  1829. ENABLED_SSLV3="yes"
  1830. fi
  1831. if test "$ENABLED_SSLV3" = "yes"
  1832. then
  1833. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_SSLV3"
  1834. fi
  1835. # STACK SIZE info for examples
  1836. AC_ARG_ENABLE([stacksize],
  1837. [AS_HELP_STRING([--enable-stacksize],[Enable stack size info on examples (default: disabled)])],
  1838. [ ENABLED_STACKSIZE=$enableval ],
  1839. [ ENABLED_STACKSIZE=no ]
  1840. )
  1841. # verbose, per-test stack size info, currently only implemented in testwolfcrypt
  1842. AC_ARG_ENABLE([stacksize-verbose],
  1843. [AS_HELP_STRING([--enable-stacksize-verbose],[Enable verbose stack size info on testwolfcrypt (default: disabled)])],
  1844. [ ENABLED_STACKSIZE_VERBOSE=$enableval ],
  1845. [ ENABLED_STACKSIZE_VERBOSE=no ]
  1846. )
  1847. if test "$ENABLED_STACKSIZE_VERBOSE" = "yes"
  1848. then
  1849. ENABLED_STACKSIZE=yes
  1850. fi
  1851. if test "$ENABLED_STACKSIZE" = "yes"
  1852. then
  1853. AC_CHECK_FUNC([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  1854. AC_CHECK_DECL([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  1855. AC_CHECK_FUNC([pthread_attr_setstack], [], AC_CHECK_LIB([pthread],[pthread_attr_setstack]))
  1856. AC_CHECK_DECL([pthread_attr_setstack], [], [AC_MSG_ERROR(stacksize needs pthread_attr_setstack)], [[#include <pthread.h>]])
  1857. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE"
  1858. fi
  1859. if test "$ENABLED_STACKSIZE_VERBOSE" = "yes"
  1860. then
  1861. if test "$thread_ls_on" != "yes"
  1862. then
  1863. AC_MSG_ERROR(stacksize-verbose needs thread-local storage.)
  1864. fi
  1865. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE_VERBOSE"
  1866. fi
  1867. # MEMORY
  1868. AC_ARG_ENABLE([memory],
  1869. [AS_HELP_STRING([--enable-memory],[Enable memory callbacks (default: enabled)])],
  1870. [ ENABLED_MEMORY=$enableval ],
  1871. [ ENABLED_MEMORY=yes ]
  1872. )
  1873. if test "$ENABLED_MEMORY" = "no"
  1874. then
  1875. AM_CFLAGS="$AM_CFLAGS -DNO_WOLFSSL_MEMORY"
  1876. else
  1877. # turn off memory cb if leanpsk or leantls on
  1878. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1879. then
  1880. # but don't turn on NO_WOLFSSL_MEMORY because using own
  1881. ENABLED_MEMORY=no
  1882. fi
  1883. fi
  1884. # MEMORY SIZE info
  1885. AC_ARG_ENABLE([trackmemory],
  1886. [AS_HELP_STRING([--enable-trackmemory],[Enable memory use info on wolfCrypt and wolfSSL cleanup (default: disabled)])],
  1887. [ ENABLED_TRACKMEMORY=$enableval ],
  1888. [ ENABLED_TRACKMEMORY=no ]
  1889. )
  1890. if test "$ENABLED_TRACKMEMORY" = "yes"
  1891. then
  1892. if test "$ENABLED_MEMORY" = "yes"
  1893. then
  1894. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY"
  1895. else
  1896. AC_MSG_ERROR([trackmemory requires using wolfSSL memory (--enable-memory).])
  1897. fi
  1898. fi
  1899. # MEMORY usage logging
  1900. AC_ARG_ENABLE([memorylog],
  1901. [AS_HELP_STRING([--enable-memorylog],[Enable dynamic memory logging (default: disabled)])],
  1902. [ ENABLED_MEMORYLOG=$enableval ],
  1903. [ ENABLED_MEMORYLOG=no ]
  1904. )
  1905. if test "$ENABLED_MEMORYLOG" = "yes"
  1906. then
  1907. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MEMORY_LOG"
  1908. fi
  1909. # STACK usage logging
  1910. AC_ARG_ENABLE([stacklog],
  1911. [AS_HELP_STRING([--enable-stacklog],[Enable stack logging (default: disabled)])],
  1912. [ ENABLED_STACKLOG=$enableval ],
  1913. [ ENABLED_STACKLOG=no ]
  1914. )
  1915. if test "$ENABLED_STACKLOG" = "yes"
  1916. then
  1917. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STACK_LOG -finstrument-functions"
  1918. fi
  1919. if test "$ENABLED_QT" = "yes"
  1920. then
  1921. # Requires opensslextra and opensslall
  1922. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  1923. then
  1924. ENABLED_OPENSSLALL="yes"
  1925. ENABLED_OPENSSLEXTRA="yes"
  1926. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA -DOPENSSL_ALL -DHAVE_EX_DATA"
  1927. fi
  1928. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_QT -DSESSION_CERTS -DOPENSSL_NO_SSL2"
  1929. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN -DHAVE_EX_DATA"
  1930. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ"
  1931. if test "x$ENABLED_ALL" = "xno"; then
  1932. # Don't enable old SSL/TLS for --enable-all, which is used by distro
  1933. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_SSLV3 -DWOLFSSL_ALLOW_TLSV10"
  1934. fi
  1935. # Requires OCSP make sure on
  1936. if test "x$ENABLED_OCSP" = "xno"
  1937. then
  1938. ENABLED_OCSP="yes"
  1939. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1940. fi
  1941. # Requires PSK make sure on
  1942. if test "x$ENABLED_PSK" = "xno"
  1943. then
  1944. ENABLED_PSK="yes"
  1945. fi
  1946. # Requires RC4 make sure on
  1947. if test "x$ENABLED_ARC4" = "xno"
  1948. then
  1949. ENABLED_ARC4="yes"
  1950. fi
  1951. if test "x$ENABLED_CERTEXT" = "xno"
  1952. then
  1953. ENABLED_CERTEXT="yes"
  1954. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  1955. fi
  1956. if test "x$ENABLED_CERTGEN" = "xno"
  1957. then
  1958. ENABLED_CERTGEN="yes"
  1959. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  1960. fi
  1961. # requires oldnames disabled
  1962. enable_oldnames=no
  1963. fi
  1964. AC_ARG_ENABLE([qt-test],
  1965. [AS_HELP_STRING([--enable-qt-test],[Enable qt tests (default: disabled)])],
  1966. [ ENABLED_QT_TEST=$enableval ],
  1967. [ ENABLED_QT_TEST=no ]
  1968. )
  1969. if test "$ENABLED_QT_TEST" = "yes"
  1970. then
  1971. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL3 -DWOLFSSL_STATIC_RSA"
  1972. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_PSK"
  1973. fi
  1974. # RSA
  1975. AC_ARG_ENABLE([rsa],
  1976. [AS_HELP_STRING([--enable-rsa],[Enable RSA (default: enabled)])],
  1977. [ ENABLED_RSA=$enableval ],
  1978. [ ENABLED_RSA=yes ]
  1979. )
  1980. if test "$ENABLED_RSA" = "no"
  1981. then
  1982. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  1983. else
  1984. # turn off RSA if leanpsk or leantls on
  1985. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1986. then
  1987. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  1988. ENABLED_RSA=no
  1989. fi
  1990. fi
  1991. AC_ARG_ENABLE([oaep],
  1992. [AS_HELP_STRING([--enable-oaep],[Enable RSA OAEP (default: enabled)])],
  1993. [ ENABLED_OAEP=$enableval ],
  1994. [ ENABLED_OAEP=yes ]
  1995. )
  1996. if test "$ENABLED_OAEP" = "no"
  1997. then
  1998. AM_CFLAGS="$AM_CFLAGS -DWC_NO_RSA_OAEP"
  1999. fi
  2000. AC_ARG_ENABLE([rsapub],
  2001. [AS_HELP_STRING([--enable-rsapub],[Enable RSA Public Only (default: disabled)])],
  2002. [ ENABLED_RSAPUB=$enableval ],
  2003. [ ENABLED_RSAPUB=no ]
  2004. )
  2005. if test "$ENABLED_RSAPUB" = "yes"
  2006. then
  2007. if test "$ENABLED_RSA" = "no"
  2008. then
  2009. ENABLED_RSA="yes"
  2010. fi
  2011. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RSA_PUBLIC_ONLY"
  2012. fi
  2013. AC_ARG_ENABLE([rsavfy],
  2014. [AS_HELP_STRING([--enable-rsavfy],[Enable RSA Verify Inline Only (default: disabled)])],
  2015. [ ENABLED_RSAVFY=$enableval ],
  2016. [ ENABLED_RSAVFY=no ]
  2017. )
  2018. if test "$ENABLED_RSAVFY" = "yes"
  2019. then
  2020. if test "$ENABLED_RSA" = "no"
  2021. then
  2022. ENABLED_RSA="yes"
  2023. fi
  2024. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RSA_PUBLIC_ONLY -DWOLFSSL_RSA_VERIFY_ONLY"
  2025. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RSA_VERIFY_INLINE -DNO_SIG_WRAPPER"
  2026. fi
  2027. # RSA-PSS
  2028. AC_ARG_ENABLE([rsapss],
  2029. [ --enable-rsapss Enable RSA-PSS (default: disabled)],
  2030. [ ENABLED_RSAPSS=$enableval ],
  2031. [ ENABLED_RSAPSS=no ]
  2032. )
  2033. if test "$ENABLED_RSA" = "no"
  2034. then
  2035. ENABLED_RSAPSS="no"
  2036. else
  2037. if test "$ENABLED_TLS13" = "yes"
  2038. then
  2039. ENABLED_RSAPSS="yes"
  2040. fi
  2041. fi
  2042. if test "$ENABLED_RSAPSS" = "yes"
  2043. then
  2044. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS"
  2045. fi
  2046. # DH
  2047. AC_ARG_ENABLE([dh],
  2048. [AS_HELP_STRING([--enable-dh],[Enable DH (default: enabled)])],
  2049. [ ENABLED_DH=$enableval ],
  2050. [ ENABLED_DH=yes ]
  2051. )
  2052. if test "$ENABLED_OPENSSH" = "yes"
  2053. then
  2054. ENABLED_DH="yes"
  2055. fi
  2056. if test "$ENABLED_DH" = "no"
  2057. then
  2058. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  2059. else
  2060. # turn off DH if leanpsk or leantls on
  2061. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2062. then
  2063. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  2064. ENABLED_DH=no
  2065. fi
  2066. fi
  2067. # Anonymous
  2068. AC_ARG_ENABLE([anon],
  2069. [AS_HELP_STRING([--enable-anon],[Enable Anonymous (default: disabled)])],
  2070. [ ENABLED_ANON=$enableval ],
  2071. [ ENABLED_ANON=no ]
  2072. )
  2073. if test "x$ENABLED_WPAS" = "xyes"
  2074. then
  2075. ENABLED_ANON=yes
  2076. fi
  2077. if test "x$ENABLED_ANON" = "xyes"
  2078. then
  2079. if test "x$ENABLED_DH" != "xyes"
  2080. then
  2081. AC_MSG_ERROR([Anonymous suite requires DH.])
  2082. fi
  2083. AM_CFLAGS="$AM_CFLAGS -DHAVE_ANON"
  2084. fi
  2085. # ASN
  2086. # turn off asn, which means no certs, no rsa, no dsa, no ecc,
  2087. # and no big int (unless dh is on)
  2088. AC_ARG_ENABLE([asn],
  2089. [AS_HELP_STRING([--enable-asn],[Enable ASN (default: enabled)])],
  2090. [ ENABLED_ASN=$enableval ],
  2091. [ ENABLED_ASN=yes ]
  2092. )
  2093. if test "$ENABLED_ASN" = "no"
  2094. then
  2095. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS"
  2096. if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no"
  2097. then
  2098. # DH and ECC need bigint
  2099. AM_CFLAGS="$AM_CFLAGS -DNO_BIG_INT"
  2100. fi
  2101. else
  2102. # turn off ASN if leanpsk on
  2103. if test "$ENABLED_LEANPSK" = "yes"
  2104. then
  2105. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
  2106. ENABLED_ASN=no
  2107. else
  2108. if test "$ENABLED_ASN" = "nocrypt"
  2109. then
  2110. AM_CFLAGS="$AM_CFLAGS -DNO_ASN_CRYPT"
  2111. enable_pwdbased=no
  2112. fi
  2113. fi
  2114. fi
  2115. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_RSAVFY" = "no" && test "$ENABLED_ASN" = "no"
  2116. then
  2117. AC_MSG_ERROR([please disable rsa if disabling asn.])
  2118. fi
  2119. if test "$ENABLED_DSA" = "yes" && test "$ENABLED_ASN" = "no"
  2120. then
  2121. AC_MSG_ERROR([please disable dsa if disabling asn.])
  2122. fi
  2123. # DH and ECC need bigint
  2124. if test "$ENABLED_ASN" = "no" && test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no" && test "$ENABLED_RSA" = "no"
  2125. then
  2126. ENABLED_FASTMATH=no
  2127. ENABLED_SLOWMATH=no
  2128. fi
  2129. # AES
  2130. AC_ARG_ENABLE([aes],
  2131. [AS_HELP_STRING([--enable-aes],[Enable AES (default: enabled)])],
  2132. [ ENABLED_AES=$enableval ],
  2133. [ ENABLED_AES=yes ]
  2134. )
  2135. if test "$ENABLED_AES" = "no"
  2136. then
  2137. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  2138. if test "$ENABLED_FORTRESS" = "yes"
  2139. then
  2140. AC_MSG_ERROR([fortress requires aes])
  2141. fi
  2142. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  2143. then
  2144. AC_MSG_ERROR([cannot enable eccencrypt and hkdf without aes.])
  2145. fi
  2146. if test "$ENABLED_AESGCM" = "yes"
  2147. then
  2148. AC_MSG_ERROR([AESGCM requires AES.])
  2149. fi
  2150. if test "$ENABLED_AESCCM" = "yes"
  2151. then
  2152. AC_MSG_ERROR([AESCCM requires AES.])
  2153. fi
  2154. if test "$ENABLED_AESCTR" = "yes"
  2155. then
  2156. AC_MSG_ERROR([AESCTR requires AES.])
  2157. fi
  2158. else
  2159. # turn off AES if leanpsk on
  2160. if test "$ENABLED_LEANPSK" = "yes"
  2161. then
  2162. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  2163. ENABLED_AES=no
  2164. fi
  2165. fi
  2166. # CODING
  2167. AC_ARG_ENABLE([coding],
  2168. [AS_HELP_STRING([--enable-coding],[Enable Coding base 16/64 (default: enabled)])],
  2169. [ ENABLED_CODING=$enableval ],
  2170. [ ENABLED_CODING=yes ]
  2171. )
  2172. if test "$ENABLED_CODING" = "no"
  2173. then
  2174. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  2175. else
  2176. # turn off CODING if leanpsk on
  2177. if test "$ENABLED_LEANPSK" = "yes"
  2178. then
  2179. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  2180. ENABLED_CODING=no
  2181. fi
  2182. fi
  2183. # Base64 Encode
  2184. BASE64ENCODE_DEFAULT=no
  2185. if test "$host_cpu" = "x86_64"
  2186. then
  2187. BASE64ENCODE_DEFAULT=yes
  2188. fi
  2189. AC_ARG_ENABLE([base64encode],
  2190. [AS_HELP_STRING([--enable-base64encode],[Enable Base64 encoding (default: enabled on x86_64)])],
  2191. [ ENABLED_BASE64ENCODE=$enableval ],
  2192. [ ENABLED_BASE64ENCODE=$BASE64ENCODE_DEFAULT ]
  2193. )
  2194. if test "$ENABLED_BASE64ENCODE" = "yes"
  2195. then
  2196. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BASE64_ENCODE"
  2197. fi
  2198. # Base16
  2199. AC_ARG_ENABLE([base16],
  2200. [AS_HELP_STRING([--enable-base16],[Enable Base16 encoding/decoding (default: disabled)])],
  2201. [ ENABLED_BASE16=$enableval ],
  2202. [ ENABLED_BASE16=no ]
  2203. )
  2204. if test "$ENABLED_BASE16" = "yes"
  2205. then
  2206. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BASE16"
  2207. fi
  2208. # DES3
  2209. AC_ARG_ENABLE([des3],
  2210. [AS_HELP_STRING([--enable-des3],[Enable DES3 (default: disabled)])],
  2211. [ ENABLED_DES3=$enableval ],
  2212. [ ENABLED_DES3=no ]
  2213. )
  2214. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_QT" = "yes" || test "$ENABLED_OPENVPN" = "yes" || test "x$ENABLED_WPAS" != "xno"
  2215. then
  2216. ENABLED_DES3="yes"
  2217. fi
  2218. # IDEA
  2219. AC_ARG_ENABLE([idea],
  2220. [AS_HELP_STRING([--enable-idea],[Enable IDEA Cipher (default: disabled)])],
  2221. [ ENABLED_IDEA=$enableval ],
  2222. [ ENABLED_IDEA=no ]
  2223. )
  2224. if test "x$ENABLED_IDEA" = "xyes"
  2225. then
  2226. AM_CFLAGS="$AM_CFLAGS -DHAVE_IDEA"
  2227. fi
  2228. # ARC4
  2229. AC_ARG_ENABLE([arc4],
  2230. [AS_HELP_STRING([--enable-arc4],[Enable ARC4 (default: disabled)])],
  2231. [ ENABLED_ARC4=$enableval ],
  2232. [ ENABLED_ARC4=no ]
  2233. )
  2234. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes"
  2235. then
  2236. ENABLED_ARC4="yes"
  2237. fi
  2238. if test "$ENABLED_ARC4" = "no"
  2239. then
  2240. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  2241. else
  2242. # turn off ARC4 if leanpsk or leantls on
  2243. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2244. then
  2245. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  2246. ENABLED_ARC4=no
  2247. fi
  2248. fi
  2249. # MD5
  2250. AC_ARG_ENABLE([md5],
  2251. [AS_HELP_STRING([--enable-md5],[Enable MD5 (default: enabled)])],
  2252. [ ENABLED_MD5=$enableval ],
  2253. [ ENABLED_MD5=yes ]
  2254. )
  2255. if test "$ENABLED_MD5" = "no"
  2256. then
  2257. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  2258. else
  2259. # turn off MD5 if leanpsk or leantls on
  2260. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2261. then
  2262. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  2263. ENABLED_MD5=no
  2264. fi
  2265. fi
  2266. # SHA
  2267. AC_ARG_ENABLE([sha],
  2268. [AS_HELP_STRING([--enable-sha],[Enable SHA (default: enabled)])],
  2269. [ ENABLED_SHA=$enableval ],
  2270. [ ENABLED_SHA=yes ]
  2271. )
  2272. if test "$ENABLED_SHA" = "no"
  2273. then
  2274. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  2275. else
  2276. # turn off SHA if leanpsk or leantls on
  2277. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2278. then
  2279. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  2280. ENABLED_SHA=no
  2281. fi
  2282. fi
  2283. # CMAC
  2284. AC_ARG_ENABLE([cmac],
  2285. [AS_HELP_STRING([--enable-cmac],[Enable CMAC (default: disabled)])],
  2286. [ ENABLED_CMAC=$enableval ],
  2287. [ ENABLED_CMAC=no ]
  2288. )
  2289. if test "$ENABLED_WPAS" != "no"
  2290. then
  2291. ENABLED_CMAC=yes
  2292. fi
  2293. AS_IF([test "x$ENABLED_CMAC" = "xyes"],
  2294. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC -DWOLFSSL_AES_DIRECT"])
  2295. # AES-XTS
  2296. AC_ARG_ENABLE([xts],
  2297. [AS_HELP_STRING([--enable-xts],[Enable XTS (default: disabled)])],
  2298. [ ENABLED_XTS=$enableval ],
  2299. [ ENABLED_XTS=no ]
  2300. )
  2301. AS_IF([test "x$ENABLED_XTS" = "xyes"],
  2302. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_XTS -DWOLFSSL_AES_DIRECT"])
  2303. # Web Server Build
  2304. AC_ARG_ENABLE([webserver],
  2305. [AS_HELP_STRING([--enable-webserver],[Enable Web Server (default: disabled)])],
  2306. [ ENABLED_WEBSERVER=$enableval ],
  2307. [ ENABLED_WEBSERVER=no ]
  2308. )
  2309. if test "$ENABLED_WEBSERVER" = "yes"
  2310. then
  2311. AM_CFLAGS="$AM_CFLAGS -DHAVE_WEBSERVER"
  2312. fi
  2313. # Web Client Build (HTTP Client)
  2314. AC_ARG_ENABLE([webclient],
  2315. [AS_HELP_STRING([--enable-webclient],[Enable Web Client (HTTP) (default: disabled)])],
  2316. [ ENABLED_WEBCLIENT=$enableval ],
  2317. [ ENABLED_WEBCLIENT=no ]
  2318. )
  2319. if test "$ENABLED_WEBCLIENT" = "yes"
  2320. then
  2321. AM_CFLAGS="$AM_CFLAGS -DHAVE_HTTP_CLIENT"
  2322. fi
  2323. # HC128
  2324. AC_ARG_ENABLE([hc128],
  2325. [AS_HELP_STRING([--enable-hc128],[Enable HC-128 (default: disabled)])],
  2326. [ ENABLED_HC128=$enableval ],
  2327. [ ENABLED_HC128=no ]
  2328. )
  2329. if test "$ENABLED_HC128" = "no"
  2330. then
  2331. AM_CFLAGS="$AM_CFLAGS -DNO_HC128"
  2332. else
  2333. AM_CFLAGS="$AM_CFLAGS -DHAVE_HC128"
  2334. fi
  2335. # RABBIT
  2336. AC_ARG_ENABLE([rabbit],
  2337. [AS_HELP_STRING([--enable-rabbit],[Enable RABBIT (default: disabled)])],
  2338. [ ENABLED_RABBIT=$enableval ],
  2339. [ ENABLED_RABBIT=no ]
  2340. )
  2341. if test "$ENABLED_RABBIT" = "no"
  2342. then
  2343. AM_CFLAGS="$AM_CFLAGS -DNO_RABBIT"
  2344. else
  2345. AM_CFLAGS="$AM_CFLAGS -DHAVE_RABBIT"
  2346. fi
  2347. # RC2
  2348. AC_ARG_ENABLE([rc2],
  2349. [AS_HELP_STRING([--enable-rc2],[Enable RC2 encryption (default: disabled)])],
  2350. [ ENABLED_RC2=$enableval ],
  2351. [ ENABLED_RC2=no ]
  2352. )
  2353. if test "$ENABLED_RC2" = "yes"
  2354. then
  2355. AM_CFLAGS="$AM_CFLAGS -DWC_RC2"
  2356. fi
  2357. # FIPS
  2358. AS_CASE([$FIPS_VERSION],
  2359. ["v2"],[
  2360. AS_IF([test "x$FIPS_READY" = "xyes"],
  2361. [AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS_VERSION=3"],
  2362. [AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS_VERSION=2"])
  2363. AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS -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"
  2364. ENABLED_KEYGEN="yes"
  2365. ENABLED_SHA224="yes"
  2366. # Shake256 is a SHA-3 algorithm not in our FIPS algorithm list
  2367. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_SHAKE256"
  2368. AS_IF([test "x$ENABLED_AESCCM" != "xyes"],
  2369. [ENABLED_AESCCM="yes"
  2370. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"])
  2371. AS_IF([test "x$ENABLED_RSAPSS" != "xyes"],
  2372. [ENABLED_RSAPSS="yes"
  2373. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS"])
  2374. AS_IF([test "x$ENABLED_ECC" != "xyes"],
  2375. [ENABLED_ECC="yes"
  2376. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DWOLFSSL_VALIDATE_ECC_IMPORT"
  2377. AS_IF([test "x$ENABLED_ECC_SHAMIR" = "xyes"],
  2378. [AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"])],
  2379. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_IMPORT"])
  2380. AS_IF([test "x$ENABLED_AESCTR" != "xyes"],
  2381. [ENABLED_AESCTR="yes"
  2382. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER"])
  2383. AS_IF([test "x$ENABLED_CMAC" != "xyes"],
  2384. [ENABLED_CMAC="yes"
  2385. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC"])
  2386. AS_IF([test "x$ENABLED_HKDF" != "xyes"],
  2387. [ENABLED_HKDF="yes"
  2388. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"])
  2389. AS_IF([test "x$ENABLED_INTELASM" = "xyes"],
  2390. [AM_CFLAGS="$AM_CFLAGS -DFORCE_FAILURE_RDSEED"])
  2391. ],
  2392. ["rand"],[
  2393. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_FIPS_RAND -DHAVE_FIPS -DHAVE_FIPS_VERSION=2"
  2394. ],
  2395. ["v1"],[
  2396. AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS"
  2397. ])
  2398. AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$thread_ls_on" = "xno"],
  2399. [AC_MSG_ERROR([FIPS requires Thread Local Storage])])
  2400. AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$FIPS_VERSION" != "xrand"],
  2401. [
  2402. # Force enable the prerequisites.
  2403. AS_IF([test "x$ENABLED_SHA512" = "xno"],
  2404. [ENABLED_SHA512="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"])
  2405. AS_IF([test "x$ENABLED_AESGCM" = "xno"],
  2406. [ENABLED_AESGCM="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"])
  2407. AS_IF([test "x$ENABLED_DES3" = "xno"],[ENABLED_DES3="yes"])
  2408. ],
  2409. [
  2410. AS_IF([test "x$ENABLED_FORTRESS" = "xyes"],[ENABLED_DES3="yes"])
  2411. ])
  2412. # SELFTEST
  2413. AC_ARG_ENABLE([selftest],
  2414. [AS_HELP_STRING([--enable-selftest],[Enable selftest, Will NOT work w/o CAVP selftest license (default: disabled)])],
  2415. [ ENABLED_SELFTEST=$enableval ],
  2416. [ ENABLED_SELFTEST="no" ]
  2417. )
  2418. AS_CASE([$ENABLED_SELFTEST],
  2419. ["v2"],[
  2420. # selftest v2 (wolfCrypt 4.1.0)
  2421. ENABLED_SELFTEST="yes"
  2422. SELFTEST_VERSION="v2"
  2423. ],
  2424. ["no"],[SELFTEST_VERSION="none"],
  2425. [
  2426. # selftest v1 (wolfCrypt 3.14.2)
  2427. ENABLED_SELFTEST="yes"
  2428. SELFTEST_VERSION="v1"
  2429. ])
  2430. AS_CASE([$SELFTEST_VERSION],
  2431. ["v2"],[
  2432. AM_CFLAGS="$AM_CFLAGS -DHAVE_SELFTEST -DHAVE_SELFTEST_VERSION=2"
  2433. ],
  2434. ["v1"],[
  2435. AM_CFLAGS="$AM_CFLAGS -DHAVE_SELFTEST"
  2436. ])
  2437. # set sha224 default
  2438. SHA224_DEFAULT=no
  2439. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64"
  2440. then
  2441. if test "x$ENABLED_AFALG" = "xno" && test "x$ENABLED_DEVCRYPTO" = "xno" && ( test "x$ENABLED_FIPS" = "xno" || test "x$FIPS_VERSION" = "xv2" )
  2442. then
  2443. SHA224_DEFAULT=yes
  2444. fi
  2445. fi
  2446. # SHA224
  2447. AC_ARG_ENABLE([sha224],
  2448. [AS_HELP_STRING([--enable-sha224],[Enable wolfSSL SHA-224 support (default: enabled on x86_64/aarch64)])],
  2449. [ ENABLED_SHA224=$enableval ],
  2450. [ ENABLED_SHA224=$SHA224_DEFAULT ]
  2451. )
  2452. if test "$ENABLED_SHA224" = "yes"
  2453. then
  2454. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA224"
  2455. fi
  2456. # set sha3 default
  2457. SHA3_DEFAULT=no
  2458. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64"
  2459. then
  2460. if test "x$ENABLED_FIPS" = "xno" || test "x$FIPS_VERSION" = "xv2"
  2461. then
  2462. SHA3_DEFAULT=yes
  2463. fi
  2464. fi
  2465. # SHA3
  2466. AC_ARG_ENABLE([sha3],
  2467. [AS_HELP_STRING([--enable-sha3],[Enable wolfSSL SHA-3 support (default: enabled on x86_64/aarch64)])],
  2468. [ ENABLED_SHA3=$enableval ],
  2469. [ ENABLED_SHA3=$SHA3_DEFAULT ]
  2470. )
  2471. if test "$ENABLED_SHA3" = "small"
  2472. then
  2473. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3_SMALL"
  2474. ENABLED_SHA3="yes"
  2475. fi
  2476. if test "$ENABLED_SHA3" = "yes" && test "$ENABLED_32BIT" = "no"
  2477. then
  2478. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3"
  2479. fi
  2480. # SHAKE256
  2481. AC_ARG_ENABLE([shake256],
  2482. [AS_HELP_STRING([--enable-shake256],[Enable wolfSSL SHAKE256 support (default: enabled on x86_64/aarch64)])],
  2483. [ ENABLED_SHAKE256=$enableval ],
  2484. [ ENABLED_SHAKE256=$ENABLED_SHA3 ]
  2485. )
  2486. if test "$ENABLED_SHAKE256" = "yes" || test "$ENABLED_SHAKE256" = "small"
  2487. then
  2488. if test "$ENABLED_32BIT" = "no"
  2489. then
  2490. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHAKE256"
  2491. if test "$ENABLED_SHA3" = "no"
  2492. then
  2493. AC_MSG_ERROR([Must have SHA-3 enabled: --enable-sha3])
  2494. fi
  2495. fi
  2496. fi
  2497. # set POLY1305 default
  2498. POLY1305_DEFAULT=yes
  2499. if test "x$ENABLED_FIPS" = "xyes"
  2500. then
  2501. POLY1305_DEFAULT=no
  2502. fi
  2503. # POLY1305
  2504. AC_ARG_ENABLE([poly1305],
  2505. [AS_HELP_STRING([--enable-poly1305],[Enable wolfSSL POLY1305 support (default: enabled)])],
  2506. [ ENABLED_POLY1305=$enableval ],
  2507. [ ENABLED_POLY1305=$POLY1305_DEFAULT]
  2508. )
  2509. # leanpsk and leantls don't need poly1305
  2510. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2511. then
  2512. ENABLED_POLY1305=no
  2513. fi
  2514. if test "$ENABLED_POLY1305" = "yes"
  2515. then
  2516. AM_CFLAGS="$AM_CFLAGS -DHAVE_POLY1305 -DHAVE_ONE_TIME_AUTH"
  2517. fi
  2518. # set CHACHA default
  2519. CHACHA_DEFAULT=yes
  2520. if test "x$ENABLED_FIPS" = "xyes"
  2521. then
  2522. CHACHA_DEFAULT=no
  2523. fi
  2524. # CHACHA
  2525. AC_ARG_ENABLE([chacha],
  2526. [AS_HELP_STRING([--enable-chacha],[Enable CHACHA (default: enabled). Use `=noasm` to disable ASM AVX/AVX2 speedups])],
  2527. [ ENABLED_CHACHA=$enableval ],
  2528. [ ENABLED_CHACHA=$CHACHA_DEFAULT]
  2529. )
  2530. # leanpsk and leantls don't need chacha
  2531. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2532. then
  2533. ENABLED_CHACHA=no
  2534. fi
  2535. if test "$ENABLED_CHACHA" = "noasm" || test "$ENABLED_ASM" = "no"
  2536. then
  2537. AM_CFLAGS="$AM_CFLAGS -DNO_CHACHA_ASM"
  2538. fi
  2539. if test "$ENABLED_CHACHA" = "yes"
  2540. then
  2541. AM_CFLAGS="$AM_CFLAGS -DHAVE_CHACHA"
  2542. fi
  2543. # XCHACHA
  2544. AC_ARG_ENABLE([xchacha],
  2545. [AS_HELP_STRING([--enable-xchacha],[Enable XCHACHA (default: disabled).])],
  2546. [ ENABLED_XCHACHA=$enableval ],
  2547. [ ENABLED_XCHACHA=no]
  2548. )
  2549. if test "$ENABLED_XCHACHA" = "yes"
  2550. then
  2551. if test "$ENABLED_CHACHA" = "no"
  2552. then
  2553. AC_MSG_ERROR([XChaCha (--enable-xchacha) depends on ChaCha (--enable-chacha)])
  2554. fi
  2555. AM_CFLAGS="$AM_CFLAGS -DHAVE_XCHACHA"
  2556. fi
  2557. # Hash DRBG
  2558. AC_ARG_ENABLE([hashdrbg],
  2559. [AS_HELP_STRING([--enable-hashdrbg],[Enable Hash DRBG support (default: enabled)])],
  2560. [ ENABLED_HASHDRBG=$enableval ],
  2561. [ ENABLED_HASHDRBG=yes ]
  2562. )
  2563. if test "x$ENABLED_HASHDRBG" = "xyes"
  2564. then
  2565. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  2566. else
  2567. # turn on Hash DRBG if FIPS is on
  2568. if test "x$ENABLED_FIPS" = "xyes"
  2569. then
  2570. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  2571. ENABLED_HASHDRBG=yes
  2572. else
  2573. AM_CFLAGS="$AM_CFLAGS -DWC_NO_HASHDRBG"
  2574. fi
  2575. fi
  2576. # Filesystem Build
  2577. if test "$ENABLED_LINUXKM" = "yes"
  2578. then
  2579. ENABLED_FILESYSTEM_DEFAULT=no
  2580. else
  2581. ENABLED_FILESYSTEM_DEFAULT=yes
  2582. fi
  2583. AC_ARG_ENABLE([filesystem],
  2584. [AS_HELP_STRING([--enable-filesystem],[Enable Filesystem support (default: enabled)])],
  2585. [ ENABLED_FILESYSTEM=$enableval ],
  2586. [ ENABLED_FILESYSTEM=$ENABLED_FILESYSTEM_DEFAULT ]
  2587. )
  2588. if test "$ENABLED_FILESYSTEM" = "no"
  2589. then
  2590. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  2591. else
  2592. # turn off filesystem if leanpsk on
  2593. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LINUXKM" = "yes"
  2594. then
  2595. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  2596. ENABLED_FILESYSTEM=no
  2597. fi
  2598. fi
  2599. # inline Build
  2600. AC_ARG_ENABLE([inline],
  2601. [AS_HELP_STRING([--enable-inline],[Enable inline functions (default: enabled)])],
  2602. [ ENABLED_INLINE=$enableval ],
  2603. [ ENABLED_INLINE=yes ]
  2604. )
  2605. if test "$ENABLED_INLINE" = "no"
  2606. then
  2607. AM_CFLAGS="$AM_CFLAGS -DNO_INLINE"
  2608. fi
  2609. # OCSP
  2610. AC_ARG_ENABLE([ocsp],
  2611. [AS_HELP_STRING([--enable-ocsp],[Enable OCSP (default: disabled)])],
  2612. [ ENABLED_OCSP=$enableval ],
  2613. [ ENABLED_OCSP=no ],
  2614. )
  2615. if test "x$ENABLED_OPENSSLALL" = "xyes" || test "x$ENABLED_NGINX" = "xyes"
  2616. then
  2617. ENABLED_OCSP=yes
  2618. fi
  2619. if test "$ENABLED_OCSP" = "yes"
  2620. then
  2621. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  2622. fi
  2623. if test "$ENABLED_OCSP" = "yes"
  2624. then
  2625. # check openssl command tool for testing ocsp
  2626. AC_CHECK_PROG([HAVE_OPENSSL_CMD],[openssl],[yes],[no])
  2627. if test "$HAVE_OPENSSL_CMD" = "yes"
  2628. then
  2629. AM_CFLAGS="$AM_CFLAGS -DHAVE_OPENSSL_CMD"
  2630. else
  2631. AC_MSG_WARN([openssl command line tool not available for testing ocsp])
  2632. fi
  2633. fi
  2634. # Certificate Status Request : a.k.a. OCSP Stapling
  2635. AC_ARG_ENABLE([ocspstapling],
  2636. [AS_HELP_STRING([--enable-ocspstapling],[Enable OCSP Stapling (default: disabled)])],
  2637. [ ENABLED_CERTIFICATE_STATUS_REQUEST=$enableval ],
  2638. [ ENABLED_CERTIFICATE_STATUS_REQUEST=no ]
  2639. )
  2640. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes"
  2641. then
  2642. ENABLED_CERTIFICATE_STATUS_REQUEST="yes"
  2643. fi
  2644. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"
  2645. then
  2646. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST"
  2647. # Requires OCSP make sure on
  2648. if test "x$ENABLED_OCSP" = "xno"
  2649. then
  2650. ENABLED_OCSP="yes"
  2651. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  2652. fi
  2653. fi
  2654. # Certificate Status Request v2 : a.k.a. OCSP stapling v2
  2655. AC_ARG_ENABLE([ocspstapling2],
  2656. [AS_HELP_STRING([--enable-ocspstapling2],[Enable OCSP Stapling v2 (default: disabled)])],
  2657. [ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=$enableval ],
  2658. [ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=no ]
  2659. )
  2660. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes"
  2661. then
  2662. ENABLED_CERTIFICATE_STATUS_REQUEST_V2=yes
  2663. fi
  2664. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"
  2665. then
  2666. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST_V2"
  2667. # Requires OCSP make sure on
  2668. if test "x$ENABLED_OCSP" = "xno"
  2669. then
  2670. ENABLED_OCSP="yes"
  2671. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  2672. fi
  2673. fi
  2674. # CRL
  2675. AC_ARG_ENABLE([crl],
  2676. [AS_HELP_STRING([--enable-crl],[Enable CRL (default: disabled)])],
  2677. [ ENABLED_CRL=$enableval ],
  2678. [ ENABLED_CRL=no ],
  2679. )
  2680. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_OPENVPN" = "xyes" || test "x$ENABLED_WPAS" != "xno"
  2681. then
  2682. ENABLED_CRL=yes
  2683. fi
  2684. if test "$ENABLED_CRL" = "yes"
  2685. then
  2686. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  2687. fi
  2688. # CRL Monitor
  2689. AC_ARG_ENABLE([crl-monitor],
  2690. [AS_HELP_STRING([--enable-crl-monitor],[Enable CRL Monitor (default: disabled)])],
  2691. [ ENABLED_CRL_MONITOR=$enableval ],
  2692. [ ENABLED_CRL_MONITOR=no ],
  2693. )
  2694. if test "$ENABLED_CRL_MONITOR" = "yes"
  2695. then
  2696. case $host_os in
  2697. *linux* | *darwin* | *freebsd*)
  2698. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;;
  2699. *)
  2700. if test "x$ENABLED_DISTRO" = "xyes" ; then
  2701. ENABLED_CRL_MONITOR="no"
  2702. else
  2703. AC_MSG_ERROR( [crl monitor only allowed on linux, OS X, or freebsd])
  2704. fi
  2705. break;;
  2706. esac
  2707. fi
  2708. # USER CRYPTO
  2709. ENABLED_USER_CRYPTO="no"
  2710. ENABLED_USER_RSA="no"
  2711. AC_DEFINE([BUILD_USER_RSA], [], [User RSA is being defined])
  2712. trycryptodir=""
  2713. AC_ARG_WITH([user-crypto],
  2714. [AS_HELP_STRING([--with-user-crypto=PATH],[Path to USER_CRYPTO install (default /usr/local)])],
  2715. [
  2716. CPPFLAGS="$CPPFLAGS -DHAVE_USER_CRYPTO"
  2717. LIBS="$LIBS -lusercrypto"
  2718. if test "x$withval" != "xno" ; then
  2719. trycryptodir=$withval
  2720. fi
  2721. if test "x$withval" = "xyes" ; then
  2722. trycryptodir="/usr/local"
  2723. fi
  2724. LDFLAGS="$LDFLAGS -L$trycryptodir/lib"
  2725. CPPFLAGS="$CPPFLAGS -I$trycryptodir/include"
  2726. #Look for RSA Init function in usercrypto lib
  2727. AC_CHECK_LIB([usercrypto], [wc_InitRsaKey], [user_rsa_linked=yes], [user_rsa_linked=no])
  2728. if test "x$user_rsa_linked" = "xyes" ; then
  2729. AC_MSG_NOTICE([User user_rsa.h being used])
  2730. AM_CFLAGS="$AM_CFLAGS -DHAVE_USER_RSA"
  2731. ENABLED_USER_RSA=yes
  2732. ENABLED_USER_CRYPTO=yes
  2733. fi
  2734. #Display check and find result of link attempts
  2735. AC_MSG_CHECKING([for USER_CRYPTO])
  2736. if test "x$ENABLED_USER_CRYPTO" = "xno" ; then
  2737. AC_MSG_RESULT([no])
  2738. AC_MSG_ERROR([USER_CRYPTO not found. Either move to /usr/include and /usr/lib or
  2739. Specify its path using --with-user-crypto=/dir/])
  2740. else
  2741. AC_MSG_RESULT([yes])
  2742. # Check if .la is available if not then rely on exported path
  2743. AC_CHECK_FILE($trycryptodir/lib/libusercrypto.la, [LIB_ADD="$trycryptodir/lib/libusercrypto.la $LIB_ADD"], [LIB_ADD="-lusercrypto $LIB_ADD"])
  2744. AM_LDFLAGS="$AM_LDFLAGS -L$trycryptodir/lib"
  2745. AM_CFLAGS="$AM_CFLAGS -DHAVE_USER_CRYPTO"
  2746. fi
  2747. ]
  2748. )
  2749. if test "$ENABLED_USER_CRYPTO" = "yes" && test "$ENABLED_FIPS" = "yes"
  2750. then
  2751. AC_MSG_ERROR([cannot enable user crypto and fips, user crypto posibility of using code in fips boundary.])
  2752. fi
  2753. # NTRU
  2754. ENABLED_NTRU="no"
  2755. tryntrudir=""
  2756. AC_ARG_WITH([ntru],
  2757. [AS_HELP_STRING([--with-ntru=PATH],[Path to NTRU install (default /usr/)])],
  2758. [
  2759. AC_MSG_CHECKING([for NTRU])
  2760. CPPFLAGS="$CPPFLAGS -DHAVE_NTRU -DHAVE_TLS_EXTENSIONS"
  2761. LIBS="$LIBS -lntruencrypt"
  2762. 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 ])
  2763. if test "x$ntru_linked" = "xno" ; then
  2764. if test "x$withval" != "xno" ; then
  2765. tryntrudir=$withval
  2766. fi
  2767. if test "x$withval" = "xyes" ; then
  2768. tryntrudir="/usr"
  2769. fi
  2770. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$tryntrudir/lib"
  2771. CPPFLAGS="$CPPFLAGS -I$tryntrudir/include"
  2772. 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 ])
  2773. if test "x$ntru_linked" = "xno" ; then
  2774. AC_MSG_ERROR([NTRU isn't found.
  2775. If it's already installed, specify its path using --with-ntru=/dir/])
  2776. fi
  2777. AC_MSG_RESULT([yes])
  2778. AM_LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
  2779. else
  2780. AC_MSG_RESULT([yes])
  2781. fi
  2782. AM_CFLAGS="$AM_CFLAGS -DHAVE_NTRU -DHAVE_TLS_EXTENSIONS -DWOLFSSL_STATIC_RSA"
  2783. ENABLED_NTRU="yes"
  2784. ]
  2785. )
  2786. # QSH
  2787. AC_ARG_ENABLE([qsh],
  2788. [AS_HELP_STRING([--enable-qsh],[Enable QSH (default: disabled)])],
  2789. [ ENABLED_QSH=$enableval ],
  2790. [ ENABLED_QSH=no ]
  2791. )
  2792. if test "x$ENABLED_QSH" = "xyes"
  2793. then
  2794. if test "x$ENABLED_NTRU" = "xno"
  2795. then
  2796. AC_MSG_ERROR([cannot enable qsh without NTRU])
  2797. fi
  2798. AM_CFLAGS="$AM_CFLAGS -DHAVE_QSH -DWOLFSSL_STATIC_DH -DWOLFSSL_STATIC_PSK"
  2799. fi
  2800. # Whitewood netRandom client library
  2801. ENABLED_WNR="no"
  2802. trywnrdir=""
  2803. AC_ARG_WITH([wnr],
  2804. [AS_HELP_STRING([--with-wnr=PATH],[Path to Whitewood netRandom install (default /usr/local)])],
  2805. [
  2806. AC_MSG_CHECKING([for Whitewood netRandom])
  2807. CPPFLAGS="$CPPFLAGS -DHAVE_WNR"
  2808. LIBS="$LIBS -lwnr"
  2809. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wnr.h>]], [[ wnr_setup(0, 0); ]])], [ wnr_linked=yes ],[ wnr_linked=no ])
  2810. if test "x$wnr_linked" = "xno" ; then
  2811. if test "x$withval" != "xno" ; then
  2812. trywnrdir=$withval
  2813. fi
  2814. if test "x$withval" = "xyes" ; then
  2815. trywnrdir="/usr/local"
  2816. fi
  2817. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$trywnrdir/lib"
  2818. CPPFLAGS="$CPPFLAGS -I$trywnrdir/include"
  2819. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wnr.h>]], [[ wnr_setup(0, 0); ]])], [ wnr_linked=yes ],[ wnr_linked=no ])
  2820. if test "x$wnr_linked" = "xno" ; then
  2821. AC_MSG_ERROR([Whitewood netRandom isn't found.
  2822. If it's already installed, specify its path using --with-wnr=/dir/])
  2823. fi
  2824. AC_MSG_RESULT([yes])
  2825. AM_LDFLAGS="$AM_LDFLAGS -L$trywnrdir/lib"
  2826. else
  2827. AC_MSG_RESULT([yes])
  2828. fi
  2829. AM_CFLAGS="$AM_CFLAGS -DHAVE_WNR"
  2830. ENABLED_WNR="yes"
  2831. ]
  2832. )
  2833. # SNI
  2834. AC_ARG_ENABLE([sni],
  2835. [AS_HELP_STRING([--enable-sni],[Enable SNI (default: disabled)])],
  2836. [ ENABLED_SNI=$enableval ],
  2837. [ ENABLED_SNI=no ]
  2838. )
  2839. if test "x$ENABLED_QT" = "xyes"
  2840. then
  2841. ENABLED_SNI="yes"
  2842. fi
  2843. if test "x$ENABLED_SNI" = "xyes"
  2844. then
  2845. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  2846. fi
  2847. # Maximum Fragment Length
  2848. AC_ARG_ENABLE([maxfragment],
  2849. [AS_HELP_STRING([--enable-maxfragment],[Enable Maximum Fragment Length (default: disabled)])],
  2850. [ ENABLED_MAX_FRAGMENT=$enableval ],
  2851. [ ENABLED_MAX_FRAGMENT=no ]
  2852. )
  2853. # ALPN
  2854. AC_ARG_ENABLE([alpn],
  2855. [AS_HELP_STRING([--enable-alpn],[Enable ALPN (default: disabled)])],
  2856. [ ENABLED_ALPN=$enableval ],
  2857. [ ENABLED_ALPN=no ]
  2858. )
  2859. if test "x$ENABLED_ALPN" = "xyes"
  2860. then
  2861. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
  2862. fi
  2863. # Maximum Fragment Length
  2864. if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
  2865. then
  2866. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
  2867. fi
  2868. # Trusted CA Indication Extension
  2869. AC_ARG_ENABLE([trustedca],
  2870. [AS_HELP_STRING([--enable-trustedca],[Enable Trusted CA Indication (default: disabled)])],
  2871. [ ENABLED_TRUSTED_CA=$enableval ],[ ENABLED_TRUSTED_CA=no ])
  2872. AS_IF([test "x$ENABLED_TRUSTED_CA" = "xyes"],
  2873. [AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUSTED_CA"])
  2874. # Truncated HMAC
  2875. AC_ARG_ENABLE([truncatedhmac],
  2876. [AS_HELP_STRING([--enable-truncatedhmac],[Enable Truncated HMAC (default: disabled)])],
  2877. [ ENABLED_TRUNCATED_HMAC=$enableval ],
  2878. [ ENABLED_TRUNCATED_HMAC=no ]
  2879. )
  2880. if test "x$ENABLED_TRUNCATED_HMAC" = "xyes"
  2881. then
  2882. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUNCATED_HMAC"
  2883. fi
  2884. # Renegotiation Indication - (FAKE Secure Renegotiation)
  2885. AC_ARG_ENABLE([renegotiation-indication],
  2886. [AS_HELP_STRING([--enable-renegotiation-indication],[Enable Renegotiation Indication (default: disabled)])],
  2887. [ ENABLED_RENEGOTIATION_INDICATION=$enableval ],
  2888. [ ENABLED_RENEGOTIATION_INDICATION=no ]
  2889. )
  2890. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  2891. then
  2892. AM_CFLAGS="$AM_CFLAGS -DHAVE_RENEGOTIATION_INDICATION"
  2893. fi
  2894. # Secure Renegotiation
  2895. AC_ARG_ENABLE([secure-renegotiation],
  2896. [AS_HELP_STRING([--enable-secure-renegotiation],[Enable Secure Renegotiation (default: disabled)])],
  2897. [ ENABLED_SECURE_RENEGOTIATION=$enableval ],
  2898. [ ENABLED_SECURE_RENEGOTIATION=no ]
  2899. )
  2900. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xyes"
  2901. then
  2902. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  2903. then
  2904. AC_MSG_ERROR([cannot enable renegotiation-indication and secure-renegotiation.])
  2905. fi
  2906. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION -DHAVE_SERVER_RENEGOTIATION_INFO"
  2907. fi
  2908. # Fallback SCSV
  2909. AC_ARG_ENABLE([fallback-scsv],
  2910. [AS_HELP_STRING([--enable-fallback-scsv],[Enable Fallback SCSV (default: disabled)])],
  2911. [ ENABLED_FALLBACK_SCSV=$enableval ],
  2912. [ ENABLED_FALLBACK_SCSV=no ]
  2913. )
  2914. if test "x$ENABLED_FALLBACK_SCSV" = "xyes"
  2915. then
  2916. AM_CFLAGS="$AM_CFLAGS -DHAVE_FALLBACK_SCSV"
  2917. fi
  2918. # Supported Elliptic Curves Extensions
  2919. AC_ARG_ENABLE([supportedcurves],
  2920. [AS_HELP_STRING([--enable-supportedcurves],[Enable Supported Elliptic Curves (default: enabled)])],
  2921. [ENABLED_SUPPORTED_CURVES=$enableval],
  2922. [ENABLED_SUPPORTED_CURVES=yes])
  2923. if test "x$ENABLED_SUPPORTED_CURVES" = "xyes"
  2924. then
  2925. AS_IF([test "x$ENABLED_ECC" = "xno" && test "x$ENABLED_CURVE25519" = "xno" && test "x$ENABLED_CURVE448" = "xno"],
  2926. [ENABLED_SUPPORTED_CURVES=no],
  2927. [AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES"])
  2928. fi
  2929. # Diffie-Hellman
  2930. if test "$ENABLED_DH" = "yes"
  2931. then
  2932. if test "$ENABLED_TLS13" = "yes" || test "$ENABLED_SUPPORTED_CURVES" = "yes"
  2933. then
  2934. AM_CFLAGS="-DHAVE_FFDHE_2048 $AM_CFLAGS"
  2935. fi
  2936. fi
  2937. # FFDHE parameters only
  2938. AC_ARG_ENABLE([ffdhe-only],
  2939. [AS_HELP_STRING([--enable-ffdhe-only],[Enable using only FFDHE in client (default: disabled)])],
  2940. [ ENABLED_FFDHE_ONLY=$enableval ],
  2941. [ ENABLED_FFDHE_ONLY=no ]
  2942. )
  2943. if test "x$ENABLED_FFDHE_ONLY" = "xyes"
  2944. then
  2945. if test "$ENABLED_DH" = "no"
  2946. then
  2947. AC_MSG_ERROR([FFDHE only support requires DH support])
  2948. fi
  2949. if test "$ENABLED_SUPPORTED_CURVES" = "no"
  2950. then
  2951. AC_MSG_ERROR([FFDHE only support requires Supported Curves extension])
  2952. fi
  2953. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_REQUIRE_FFDHE"
  2954. fi
  2955. # TLS 1.3 Requires either ECC or (RSA/DH), or CURVE25519/ED25519 or CURVE448/ED448
  2956. if test "x$ENABLED_ECC" = "xno" && \
  2957. (test "x$ENABLED_RSA" = "xno" || test "x$ENABLED_DH" = "xno") && \
  2958. (test "x$ENABLED_CURVE25519" = "xno" || test "x$ENABLED_ED25519" = "xno") && \
  2959. (test "x$ENABLED_CURVE448" = "xno" || test "x$ENABLED_ED448" = "xno")
  2960. then
  2961. # disable TLS 1.3
  2962. ENABLED_TLS13=no
  2963. fi
  2964. if test "$ENABLED_TLS13" = "yes"
  2965. then
  2966. AM_CFLAGS="-DWOLFSSL_TLS13 -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES $AM_CFLAGS"
  2967. fi
  2968. # Session Ticket Extension
  2969. AC_ARG_ENABLE([session-ticket],
  2970. [AS_HELP_STRING([--enable-session-ticket],[Enable Session Ticket (default: disabled)])],
  2971. [ ENABLED_SESSION_TICKET=$enableval ],
  2972. [ ENABLED_SESSION_TICKET=no ]
  2973. )
  2974. if test "x$ENABLED_NGINX" = "xyes" || test "$ENABLED_WPAS" = "yes" || test "x$ENABLED_HAPROXY" = "xyes"
  2975. then
  2976. ENABLED_SESSION_TICKET=yes
  2977. fi
  2978. if test "x$ENABLED_SESSION_TICKET" = "xyes"
  2979. then
  2980. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
  2981. fi
  2982. # Extended Master Secret Extension
  2983. AC_ARG_ENABLE([extended-master],
  2984. [AS_HELP_STRING([--enable-extended-master],[Enable Extended Master Secret (default: enabled)])],
  2985. [ ENABLED_EXTENDED_MASTER=$enableval ],
  2986. [ ENABLED_EXTENDED_MASTER=yes ]
  2987. )
  2988. if test "x$ENABLED_EXTENDED_MASTER" = "xyes"
  2989. then
  2990. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXTENDED_MASTER"
  2991. fi
  2992. # TLS Extensions
  2993. AC_ARG_ENABLE([tlsx],
  2994. [AS_HELP_STRING([--enable-tlsx],[Enable all TLS Extensions (default: disabled)])],
  2995. [ ENABLED_TLSX=$enableval ],
  2996. [ ENABLED_TLSX=no ]
  2997. )
  2998. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_SIGNAL" = "xyes"
  2999. then
  3000. ENABLED_TLSX=yes
  3001. fi
  3002. if test "x$ENABLED_TLSX" = "xyes"
  3003. then
  3004. ENABLED_SNI=yes
  3005. ENABLED_MAX_FRAGMENT=yes
  3006. ENABLED_TRUNCATED_HMAC=yes
  3007. ENABLED_ALPN=yes
  3008. ENABLED_TRUSTED_CA=yes
  3009. ENABLED_ENCRYPT_THEN_MAC=yes
  3010. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_ALPN -DHAVE_TRUSTED_CA"
  3011. # Check the ECC supported curves prereq
  3012. AS_IF([test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_CURVE25519" = "xyes" || test "x$ENABLED_CURVE448" = "xyes" || test "x$ENABLED_TLS13" = "xyes"],
  3013. [ENABLED_SUPPORTED_CURVES=yes
  3014. AM_CFLAGS="$AM_CFLAGS -DHAVE_SUPPORTED_CURVES"])
  3015. fi
  3016. # Early Data handshake in TLS v1.3 and above
  3017. AC_ARG_ENABLE([earlydata],
  3018. [AS_HELP_STRING([--enable-earlydata],[Enable Early Data handshake with wolfSSL TLS v1.3 (default: disabled)])],
  3019. [ ENABLED_TLS13_EARLY_DATA=$enableval ],
  3020. [ ENABLED_TLS13_EARLY_DATA=no ]
  3021. )
  3022. if test "$ENABLED_TLS13_EARLY_DATA" = "group"
  3023. then
  3024. ENABLED_TLS13_EARLY_DATA="yes"
  3025. # Group EarlyData with ClientHello
  3026. AM_CFLAGS="-DWOLFSSL_EARLY_DATA_GROUP $AM_CFLAGS"
  3027. fi
  3028. if test "$ENABLED_TLS13_EARLY_DATA" = "yes"
  3029. then
  3030. if test "x$ENABLED_TLS13" = "xno"
  3031. then
  3032. AC_MSG_ERROR([cannot enable earlydata without enabling tls13.])
  3033. fi
  3034. if test "x$ENABLED_SESSION_TICKET" = "xno" && test "x$ENABLED_PSK" = "xno"
  3035. then
  3036. AC_MSG_ERROR([cannot enable earlydata without enabling session tickets and/or PSK.])
  3037. fi
  3038. AM_CFLAGS="-DWOLFSSL_EARLY_DATA $AM_CFLAGS"
  3039. fi
  3040. if test "$ENABLED_TLSV12" = "no" && test "$ENABLED_TLS13" = "yes" && test "x$ENABLED_SESSION_TICKET" = "xno"
  3041. then
  3042. AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE"
  3043. fi
  3044. # PKCS7
  3045. AC_ARG_ENABLE([pkcs7],
  3046. [AS_HELP_STRING([--enable-pkcs7],[Enable PKCS7 (default: disabled)])],
  3047. [ ENABLED_PKCS7=$enableval ],
  3048. [ ENABLED_PKCS7=no ],
  3049. )
  3050. # wolfSSH Options
  3051. AC_ARG_ENABLE([ssh],
  3052. [AS_HELP_STRING([--enable-ssh],[Enable wolfSSH options (default: disabled)])],
  3053. [ ENABLED_WOLFSSH=$enableval ],
  3054. [ ENABLED_WOLFSSH=no ]
  3055. )
  3056. # Simple Certificate Enrollment Protocol (SCEP)
  3057. AC_ARG_ENABLE([scep],
  3058. [AS_HELP_STRING([--enable-scep],[Enable wolfSCEP (default: disabled)])],
  3059. [ ENABLED_WOLFSCEP=$enableval ],
  3060. [ ENABLED_WOLFSCEP=no ]
  3061. )
  3062. # Secure Remote Password
  3063. AC_ARG_ENABLE([srp],
  3064. [AS_HELP_STRING([--enable-srp],[Enable Secure Remote Password (default: disabled)])],
  3065. [ ENABLED_SRP=$enableval ],
  3066. [ ENABLED_SRP=no ]
  3067. )
  3068. if test "x$ENABLED_SRP" = "xyes"
  3069. then
  3070. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_SRP"
  3071. fi
  3072. # Indefinite length encoded BER message support
  3073. AC_ARG_ENABLE([indef],
  3074. [AS_HELP_STRING([--enable-indef],[Enable parsing of indefinite length encoded msgs (default: disabled)])],
  3075. [ ENABLED_BER_INDEF=$enableval ],
  3076. [ ENABLED_BER_INDEF=no ]
  3077. )
  3078. if test "x$ENABLED_BER_INDEF" = "xyes"
  3079. then
  3080. AM_CFLAGS="$AM_CFLAGS -DASN_BER_TO_DER"
  3081. fi
  3082. # Small Stack - Cache on object
  3083. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  3084. then
  3085. ENABLED_SMALL_STACK_CACHE_DEFAULT=yes
  3086. else
  3087. ENABLED_SMALL_STACK_CACHE_DEFAULT=no
  3088. fi
  3089. AC_ARG_ENABLE([smallstackcache],
  3090. [AS_HELP_STRING([--enable-smallstackcache],[Enable Small Stack Usage Caching (default: disabled)])],
  3091. [ ENABLED_SMALL_STACK_CACHE=$enableval ],
  3092. [ ENABLED_SMALL_STACK_CACHE=$ENABLED_SMALL_STACK_CACHE_DEFAULT ]
  3093. )
  3094. if test "x$ENABLED_SMALL_STACK_CACHE" = "xyes"
  3095. then
  3096. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SMALL_STACK_CACHE"
  3097. fi
  3098. # Small Stack
  3099. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  3100. then
  3101. ENABLED_SMALL_STACK_DEFAULT=yes
  3102. else
  3103. ENABLED_SMALL_STACK_DEFAULT=no
  3104. fi
  3105. AC_ARG_ENABLE([smallstack],
  3106. [AS_HELP_STRING([--enable-smallstack],[Enable Small Stack Usage (default: disabled)])],
  3107. [ ENABLED_SMALL_STACK=$enableval ],
  3108. [ ENABLED_SMALL_STACK=$ENABLED_SMALL_STACK_DEFAULT ]
  3109. )
  3110. if test "x$ENABLED_SMALL_STACK_CACHE" = "xyes"
  3111. then
  3112. ENABLED_SMALL_STACK=yes
  3113. fi
  3114. if test "x$ENABLED_SMALL_STACK" = "xyes"
  3115. then
  3116. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SMALL_STACK"
  3117. fi
  3118. #valgrind
  3119. AC_ARG_ENABLE([valgrind],
  3120. [AS_HELP_STRING([--enable-valgrind],[Enable valgrind for unit tests (default: disabled)])],
  3121. [ ENABLED_VALGRIND=$enableval ],
  3122. [ ENABLED_VALGRIND=no ]
  3123. )
  3124. if test "$ENABLED_VALGRIND" = "yes"
  3125. then
  3126. AC_CHECK_PROG([HAVE_VALGRIND],[valgrind],[yes],[no])
  3127. if test "$HAVE_VALGRIND" = "no"
  3128. then
  3129. AC_MSG_ERROR([Valgrind not found.])
  3130. fi
  3131. enable_shared=no
  3132. enable_static=yes
  3133. AM_CFLAGS="$AM_CFLAGS -DHAVE_VALGRIND"
  3134. fi
  3135. # Test certs, use internal cert functions for extra testing
  3136. AC_ARG_ENABLE([testcert],
  3137. [AS_HELP_STRING([--enable-testcert],[Enable Test Cert (default: disabled)])],
  3138. [ ENABLED_TESTCERT=$enableval ],
  3139. [ ENABLED_TESTCERT=no ]
  3140. )
  3141. if test "$ENABLED_TESTCERT" = "yes"
  3142. then
  3143. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TEST_CERT"
  3144. fi
  3145. # I/O Pool, an example to show user how to override memory handler and use
  3146. # a pool for the input/output buffer requests
  3147. AC_ARG_ENABLE([iopool],
  3148. [AS_HELP_STRING([--enable-iopool],[Enable I/O Pool example (default: disabled)])],
  3149. [ ENABLED_IOPOOL=$enableval ],
  3150. [ ENABLED_IOPOOL=no ]
  3151. )
  3152. if test "$ENABLED_IOPOOL" = "yes"
  3153. then
  3154. if test "$thread_ls_on" = "no"
  3155. then
  3156. AC_MSG_ERROR([I/O Pool example requires Thread Local Storage])
  3157. fi
  3158. AM_CFLAGS="$AM_CFLAGS -DHAVE_IO_POOL -DXMALLOC_USER"
  3159. fi
  3160. # Certificate Service Support
  3161. AC_ARG_ENABLE([certservice],
  3162. [AS_HELP_STRING([--enable-certservice],[Enable cert service (default: disabled)])],
  3163. [ ENABLED_CERT_SERVICE=$enableval ],
  3164. [ ENABLED_CERT_SERVICE=no ]
  3165. )
  3166. if test "$ENABLED_CERT_SERVICE" = "yes"
  3167. then
  3168. # Requires ecc,certgen, and opensslextra make sure on
  3169. if test "x$ENABLED_CERTGEN" = "xno"
  3170. then
  3171. ENABLED_CERTGEN="yes"
  3172. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3173. fi
  3174. if test "x$ENABLED_ECC" = "xno"
  3175. then
  3176. ENABLED_ECC="yes"
  3177. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  3178. if test "$ENABLED_ECC_SHAMIR" = "yes"
  3179. then
  3180. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  3181. fi
  3182. fi
  3183. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3184. then
  3185. ENABLED_OPENSSLEXTRA="yes"
  3186. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  3187. fi
  3188. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_CERT_SERVICE"
  3189. fi
  3190. # wolfSSL JNI
  3191. AC_ARG_ENABLE([jni],
  3192. [AS_HELP_STRING([--enable-jni],[Enable wolfSSL JNI (default: disabled)])],
  3193. [ ENABLED_JNI=$enableval ],
  3194. [ ENABLED_JNI=no ]
  3195. )
  3196. if test "$ENABLED_JNI" = "yes"
  3197. then
  3198. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_JNI -DHAVE_EX_DATA"
  3199. # Enable prereqs if not already enabled
  3200. if test "x$ENABLED_DTLS" = "xno"
  3201. then
  3202. ENABLED_DTLS="yes"
  3203. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS"
  3204. fi
  3205. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  3206. then
  3207. ENABLED_OPENSSLEXTRA="yes"
  3208. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  3209. fi
  3210. if test "x$ENABLED_OPENSSLALL" = "xno"
  3211. then
  3212. ENABLED_OPENSSLALL="yes"
  3213. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_ALL"
  3214. fi
  3215. if test "x$ENABLED_CRL" = "xno"
  3216. then
  3217. ENABLED_CRL="yes"
  3218. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  3219. fi
  3220. if test "x$ENABLED_OCSP" = "xno"
  3221. then
  3222. ENABLED_OCSP="yes"
  3223. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  3224. fi
  3225. if test "x$ENABLED_CRL_MONITOR" = "xno" && test "x$ENABLED_DISTRO" = "xno"
  3226. then
  3227. ENABLED_CRL_MONITOR="yes"
  3228. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR"
  3229. fi
  3230. if test "x$ENABLED_SAVESESSION" = "xno"
  3231. then
  3232. ENABLED_SAVESESSION="yes"
  3233. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  3234. fi
  3235. if test "x$ENABLED_SAVECERT" = "xno"
  3236. then
  3237. ENABLED_SAVECERT="yes"
  3238. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  3239. fi
  3240. if test "x$ENABLED_ATOMICUSER" = "xno"
  3241. then
  3242. ENABLED_ATOMICUSER="yes"
  3243. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  3244. fi
  3245. if test "x$ENABLED_ECC" = "xno"
  3246. then
  3247. ENABLED_ECC="yes"
  3248. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  3249. if test "$ENABLED_ECC_SHAMIR" = "yes"
  3250. then
  3251. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  3252. fi
  3253. fi
  3254. if test "x$ENABLED_PKCALLBACKS" = "xno"
  3255. then
  3256. ENABLED_PKCALLBACKS="yes"
  3257. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  3258. fi
  3259. if test "x$ENABLED_DH" = "xno"
  3260. then
  3261. ENABLED_DH="yes"
  3262. AM_CFLAGS="$AM_CFLAGS -DHAVE_DH"
  3263. fi
  3264. if test "x$ENABLED_PSK" = "xno"
  3265. then
  3266. ENABLED_PSK="yes"
  3267. fi
  3268. if test "x$ENABLED_CERTEXT" = "xno"
  3269. then
  3270. ENABLED_CERTEXT="yes"
  3271. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  3272. fi
  3273. if test "x$ENABLED_CERTGEN" = "xno"
  3274. then
  3275. ENABLED_CERTGEN="yes"
  3276. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3277. fi
  3278. if test "x$ENABLED_SNI" = "xno"
  3279. then
  3280. ENABLED_SNI="yes"
  3281. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  3282. fi
  3283. if test "x$ENABLED_ALPN" = "xno"
  3284. then
  3285. ENABLED_ALPN="yes"
  3286. AM_CFLAGS="$AM_CFLAGS -DHAVE_ALPN"
  3287. fi
  3288. fi
  3289. # lighty Support
  3290. AC_ARG_ENABLE([lighty],
  3291. [AS_HELP_STRING([--enable-lighty],[Enable lighttpd/lighty (default: disabled)])],
  3292. [ ENABLED_LIGHTY=$enableval ],
  3293. [ ENABLED_LIGHTY=no ]
  3294. )
  3295. if test "$ENABLED_LIGHTY" = "yes"
  3296. then
  3297. # Requires opensslextra make sure on
  3298. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3299. then
  3300. ENABLED_OPENSSLEXTRA="yes"
  3301. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  3302. fi
  3303. AM_CFLAGS="$AM_CFLAGS -DHAVE_LIGHTY -DHAVE_WOLFSSL_SSL_H=1"
  3304. fi
  3305. if test "$ENABLED_NGINX" = "yes"
  3306. then
  3307. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NGINX -DWOLFSSL_SIGNER_DER_CERT"
  3308. fi
  3309. if test "$ENABLED_HAPROXY" = "yes"
  3310. then
  3311. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAPROXY"
  3312. # Requires opensslextra make sure on
  3313. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3314. then
  3315. ENABLED_OPENSSLEXTRA="yes"
  3316. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  3317. fi
  3318. fi
  3319. if test "$ENABLED_SIGNAL" = "yes"
  3320. then
  3321. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SIGNAL"
  3322. # Requires opensslextra make sure on
  3323. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3324. then
  3325. ENABLED_OPENSSLEXTRA="yes"
  3326. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  3327. fi
  3328. fi
  3329. if test "$ENABLED_OPENVPN" = "yes"
  3330. then
  3331. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB -DHAVE_EX_DATA -DWOLFSSL_KEY_GEN -DWOLFSSL_OPENVPN"
  3332. fi
  3333. if test "$ENABLED_NGINX" = "yes"|| test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  3334. then
  3335. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_VERIFY_CB"
  3336. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  3337. AM_CFLAGS="$AM_CFLAGS -DKEEP_OUR_CERT -DKEEP_PEER_CERT"
  3338. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE -DHAVE_EX_DATA"
  3339. fi
  3340. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_QT" = "yes"
  3341. then
  3342. ENABLED_ARC4="yes"
  3343. fi
  3344. if test "$ENABLED_ARC4" = "no"
  3345. then
  3346. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  3347. else
  3348. # turn off ARC4 if leanpsk or leantls on
  3349. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  3350. then
  3351. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  3352. ENABLED_ARC4=no
  3353. fi
  3354. fi
  3355. # Asio Support
  3356. AC_ARG_ENABLE([asio],
  3357. [AS_HELP_STRING([--enable-asio],[Enable asio (default: disabled)])],
  3358. [ ENABLED_ASIO=$enableval ],
  3359. [ ENABLED_ASIO=no ]
  3360. )
  3361. if test "$ENABLED_ASIO" = "yes"
  3362. then
  3363. # Requires opensslextra and opensslall
  3364. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3365. then
  3366. ENABLED_OPENSSLALL="yes"
  3367. ENABLED_OPENSSLEXTRA="yes"
  3368. AM_CFLAGS="-DOPENSSL_EXTRA -DOPENSSL_ALL $AM_CFLAGS"
  3369. fi
  3370. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASIO -DASIO_USE_WOLFSSL -DWOLFSSL_KEY_GEN"
  3371. AM_CFLAGS="$AM_CFLAGS -DBOOST_ASIO_USE_WOLFSSL -DHAVE_EX_DATA"
  3372. AM_CFLAGS="$AM_CFLAGS -DSSL_TXT_TLSV1_2 -DSSL_TXT_TLSV1_1"
  3373. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL2 -DOPENSSL_NO_SSL3"
  3374. if test "$ENABLED_TLSV10" = "yes"
  3375. then
  3376. AM_CFLAGS="$AM_CFLAGS -DSSL_TXT_TLSV1"
  3377. fi
  3378. # Requires OCSP make sure on
  3379. if test "x$ENABLED_OCSP" = "xno"
  3380. then
  3381. ENABLED_OCSP="yes"
  3382. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  3383. fi
  3384. fi
  3385. # Apache HTTPD
  3386. AC_ARG_ENABLE([apachehttpd],
  3387. [AS_HELP_STRING([--enable-apachehttpd],[Enable Apache httpd (default: disabled)])],
  3388. [ ENABLED_APACHE_HTTPD=$enableval ],
  3389. [ ENABLED_APACHE_HTTPD=no ]
  3390. )
  3391. if test "$ENABLED_APACHE_HTTPD" = "yes"
  3392. then
  3393. # Requires opensslextra and opensslall
  3394. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3395. then
  3396. ENABLED_OPENSSLALL="yes"
  3397. ENABLED_OPENSSLEXTRA="yes"
  3398. AM_CFLAGS="-DOPENSSL_EXTRA -DOPENSSL_ALL $AM_CFLAGS"
  3399. fi
  3400. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_APACHE_HTTPD"
  3401. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL2 -DOPENSSL_NO_SSL3 -DOPENSSL_NO_COMP"
  3402. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA -DWOLFSSL_SIGNER_DER_CERT"
  3403. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT -DWOLFSSL_CERT_GEN"
  3404. # Requires OCSP make sure on
  3405. if test "x$ENABLED_OCSP" = "xno"
  3406. then
  3407. ENABLED_OCSP="yes"
  3408. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  3409. fi
  3410. # Requires sessioncerts make sure on
  3411. if test "x$ENABLED_SESSIONCERTS" = "xno"
  3412. then
  3413. ENABLED_SESSIONCERTS="yes"
  3414. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  3415. fi
  3416. # Requires ALPN
  3417. if test "x$ENABLED_ALPN" = "xno"
  3418. then
  3419. ENABLED_ALPN="yes"
  3420. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
  3421. fi
  3422. # Requires CRL
  3423. if test "x$ENABLED_CRL" = "xno"
  3424. then
  3425. ENABLED_CRL="yes"
  3426. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  3427. fi
  3428. # Requires Certificate Generation, Request and Extensions
  3429. if test "x$ENABLED_CERTGEN" = "xno"
  3430. then
  3431. ENABLED_CERTGEN="yes"
  3432. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3433. fi
  3434. if test "x$ENABLED_CERTREQ" = "xno"
  3435. then
  3436. ENABLED_CERTREQ="yes"
  3437. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  3438. fi
  3439. if test "x$ENABLED_CERTEXT" = "xno"
  3440. then
  3441. ENABLED_CERTEXT="yes"
  3442. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  3443. fi
  3444. # Requires Secure Renegotiation
  3445. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xno"
  3446. then
  3447. AM_CFLAGS="$AM_CFLAGS -DHAVE_SECURE_RENEGOTIATION -DHAVE_SERVER_RENEGOTIATION_INFO"
  3448. fi
  3449. fi
  3450. # Encrypt-Then-Mac
  3451. AC_ARG_ENABLE([enc-then-mac],
  3452. [AS_HELP_STRING([--enable-enc-then-mac],[Enable Encryptr-Then-Mac extension (default: enabled)])],
  3453. [ ENABLED_ENCRYPT_THEN_MAC=$enableval ],
  3454. [ ENABLED_ENCRYPT_THEN_MAC=yes ]
  3455. )
  3456. if test "x$ENABLED_APACHE_HTTPD" = "xyes"
  3457. then
  3458. ENABLED_ENCRYPT_THEN_MAC=no
  3459. fi
  3460. if test "x$ENABLED_TLSX" = "xyes"
  3461. then
  3462. ENABLED_ENCRYPT_THEN_MAC=yes
  3463. fi
  3464. AS_IF([test "x$ENABLED_SNIFFER" = "xyes"],[ENABLED_ENCRYPT_THEN_MAC="no"])
  3465. if test "x$ENABLED_ENCRYPT_THEN_MAC" = "xyes"
  3466. then
  3467. AM_CFLAGS="$AM_CFLAGS -DHAVE_ENCRYPT_THEN_MAC"
  3468. fi
  3469. # stunnel Support
  3470. AC_ARG_ENABLE([stunnel],
  3471. [AS_HELP_STRING([--enable-stunnel],[Enable stunnel (default: disabled)])],
  3472. [ ENABLED_STUNNEL=$enableval ],
  3473. [ ENABLED_STUNNEL=no ]
  3474. )
  3475. if test "$ENABLED_WPAS" = "yes"
  3476. then
  3477. ENABLED_STUNNEL="yes"
  3478. fi
  3479. if test "$ENABLED_STUNNEL" = "yes"
  3480. then
  3481. # Requires opensslextra make sure on
  3482. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3483. then
  3484. ENABLED_OPENSSLEXTRA="yes"
  3485. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  3486. fi
  3487. # Requires OCSP make sure on
  3488. if test "x$ENABLED_OCSP" = "xno"
  3489. then
  3490. ENABLED_OCSP="yes"
  3491. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  3492. fi
  3493. # Requires coding make sure on
  3494. if test "x$ENABLED_CODING" = "xno"
  3495. then
  3496. ENABLED_CODING="yes"
  3497. fi
  3498. # Requires sessioncerts make sure on
  3499. if test "x$ENABLED_SESSIONCERTS" = "xno"
  3500. then
  3501. ENABLED_SESSIONCERTS="yes"
  3502. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  3503. fi
  3504. # Requires crls, make sure on
  3505. if test "x$ENABLED_CRL" = "xno"
  3506. then
  3507. ENABLED_CRL="yes"
  3508. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  3509. fi
  3510. # Requires DES3, make sure on
  3511. if test "x$ENABLED_DES3" = "xno"
  3512. then
  3513. ENABLED_DES3="yes"
  3514. fi
  3515. # Requires tlsx, make sure on
  3516. if test "x$ENABLED_TLSX" = "xno"
  3517. then
  3518. ENABLED_TLSX="yes"
  3519. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC"
  3520. # Check the ECC supported curves prereq
  3521. AS_IF([test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_CURVE25519" = "xyes"],
  3522. [ENABLED_SUPPORTED_CURVES=yes
  3523. AM_CFLAGS="$AM_CFLAGS -DHAVE_SUPPORTED_CURVES"])
  3524. fi
  3525. # Requires ecc make sure on
  3526. if test "x$ENABLED_ECC" = "xno"
  3527. then
  3528. ENABLED_OPENSSLEXTRA="yes"
  3529. ENABLED_ECC="yes"
  3530. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  3531. if test "$ENABLED_ECC_SHAMIR" = "yes"
  3532. then
  3533. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  3534. fi
  3535. fi
  3536. # Requires wolfSSL_OBJ_txt2nid
  3537. if test "x$ENABLED_CERTEXT" = "xno"
  3538. then
  3539. ENABLED_CERTEXT="yes"
  3540. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  3541. fi
  3542. # Requires certgen
  3543. if test "x$ENABLED_CERTGEN" = "xno"
  3544. then
  3545. ENABLED_CERTGEN="yes"
  3546. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3547. fi
  3548. AM_CFLAGS="$AM_CFLAGS -DHAVE_STUNNEL -DWOLFSSL_ALWAYS_VERIFY_CB"
  3549. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI -DHAVE_EX_DATA"
  3550. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB"
  3551. fi
  3552. if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no" \
  3553. && test "x$ENABLED_STUNNEL" = "xno"
  3554. then
  3555. AM_CFLAGS="$AM_CFLAGS -DNO_PSK"
  3556. fi
  3557. if test "$ENABLED_PSK" = "no" && \
  3558. (test "$ENABLED_LEANPSK" = "yes" || test "x$ENABLED_STUNNEL" = "xyes")
  3559. then
  3560. ENABLED_PSK=yes
  3561. fi
  3562. # MD4
  3563. AC_ARG_ENABLE([md4],
  3564. [AS_HELP_STRING([--enable-md4],[Enable MD4 (default: disabled)])],
  3565. [ ENABLED_MD4=$enableval ],
  3566. [ ENABLED_MD4=no ]
  3567. )
  3568. if test "$ENABLED_MD4" = "no"
  3569. then
  3570. #turn on MD4 if using stunnel
  3571. if test "x$ENABLED_STUNNEL" = "xyes" || test "x$ENABLED_WPAS" != "xno"
  3572. then
  3573. ENABLED_MD4="yes"
  3574. else
  3575. AM_CFLAGS="$AM_CFLAGS -DNO_MD4"
  3576. fi
  3577. fi
  3578. # Encrypted keys
  3579. AC_ARG_ENABLE([enckeys],
  3580. [AS_HELP_STRING([--enable-enckeys],[Enable PEM encrypted private key support (default: disabled)])],
  3581. [ ENABLED_ENCKEYS=$enableval ],
  3582. [ ENABLED_ENCKEYS=no ]
  3583. )
  3584. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_WEBSERVER" = "yes" || test "$ENABLED_WPAS" != "no"
  3585. then
  3586. ENABLED_ENCKEYS=yes
  3587. fi
  3588. if test "$ENABLED_ENCKEYS" = "yes"
  3589. then
  3590. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ENCRYPTED_KEYS"
  3591. fi
  3592. # PWDBASED has to come after certservice since we want it on w/o explicit on
  3593. # PWDBASED
  3594. AC_ARG_ENABLE([pwdbased],
  3595. [AS_HELP_STRING([--enable-pwdbased],[Enable PWDBASED (default: disabled)])],
  3596. [ ENABLED_PWDBASED=$enableval ],
  3597. [ ENABLED_PWDBASED=no ]
  3598. )
  3599. if test "$ENABLED_PWDBASED" = "no"
  3600. then
  3601. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_OPENSSLALL" = "yes" || test "$ENABLED_WEBSERVER" = "yes" || test "$ENABLED_ENCKEYS" = "yes"
  3602. then
  3603. # opensslextra, opensslall, webserver, and enckeys needs pwdbased
  3604. ENABLED_PWDBASED=yes
  3605. else
  3606. AM_CFLAGS="$AM_CFLAGS -DNO_PWDBASED"
  3607. fi
  3608. fi
  3609. AC_ARG_ENABLE([scrypt],
  3610. [AS_HELP_STRING([--enable-scrypt],[Enable SCRYPT (default: disabled)])],
  3611. [ ENABLED_SCRYPT=$enableval ],
  3612. [ ENABLED_SCRYPT=no ]
  3613. )
  3614. if test "$ENABLED_SCRYPT" = "yes"
  3615. then
  3616. if test "$ENABLED_PWDBASED" = "no"
  3617. then
  3618. AC_MSG_ERROR([cannot enable scrypt without enabling pwdbased.])
  3619. fi
  3620. AM_CFLAGS="$AM_CFLAGS -DHAVE_SCRYPT"
  3621. fi
  3622. # wolfCrypt Only Build
  3623. AC_ARG_ENABLE([cryptonly],
  3624. [AS_HELP_STRING([--enable-cryptonly],[Enable wolfCrypt Only build (default: disabled)])],
  3625. [ENABLED_CRYPTONLY=$enableval],
  3626. [ENABLED_CRYPTONLY=no])
  3627. AS_IF([test "x$FIPS_VERSION" = "xrand"],[ENABLED_CRYPTONLY="yes"])
  3628. if test "$ENABLED_CRYPTONLY" = "yes"
  3629. then
  3630. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_ONLY"
  3631. fi
  3632. if test "x$ENABLED_CRYPTONLY" = "xno"
  3633. then
  3634. if test "x$ENABLED_PSK" = "xno" && test "x$ENABLED_ASN" = "xno"
  3635. then
  3636. AC_MSG_ERROR([please enable psk if disabling asn.])
  3637. fi
  3638. if test "x$ENABLED_ECC" != "xno" && test "x$ENABLED_ASN" = "xno"
  3639. then
  3640. AC_MSG_ERROR([please disable ecc if disabling asn.])
  3641. fi
  3642. if test "$ENABLED_AFALG" = "yes"
  3643. then
  3644. # for TLS connections the intermediate hash needs to store buffer
  3645. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_HASH_KEEP"
  3646. fi
  3647. if test "$ENABLED_DEVCRYPTO" = "yes"
  3648. then
  3649. # for TLS connections the intermediate hash needs to store buffer
  3650. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HASH_KEEP"
  3651. fi
  3652. fi
  3653. # set fastmath default
  3654. FASTMATH_DEFAULT=no
  3655. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64"
  3656. then
  3657. FASTMATH_DEFAULT=yes
  3658. fi
  3659. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  3660. then
  3661. FASTMATH_DEFAULT=no
  3662. fi
  3663. if test "$ENABLED_SP_MATH" = "yes"
  3664. then
  3665. FASTMATH_DEFAULT=no
  3666. fi
  3667. # fastmath
  3668. AC_ARG_ENABLE([fastmath],
  3669. [AS_HELP_STRING([--enable-fastmath],[Enable fast math ops (default: enabled on x86_64/aarch64)])],
  3670. [ ENABLED_FASTMATH=$enableval ],
  3671. [ ENABLED_FASTMATH=$FASTMATH_DEFAULT]
  3672. )
  3673. if test "x$ENABLED_FASTMATH" = "xyes"
  3674. then
  3675. # turn off fastmth if leanpsk on or asn off (w/o DH and ECC)
  3676. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no"
  3677. then
  3678. if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no" && test "$ENABLED_RSA" = "no"
  3679. then
  3680. ENABLED_FASTMATH=no
  3681. else
  3682. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  3683. ENABLED_SLOWMATH="no"
  3684. fi
  3685. else
  3686. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  3687. ENABLED_SLOWMATH="no"
  3688. fi
  3689. if test "$host_cpu" = "x86_64"
  3690. then
  3691. # Have settings.h set FP_MAX_BITS higher if user didn't set directly
  3692. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_64_BUILD"
  3693. fi
  3694. fi
  3695. # fast HUGE math
  3696. AC_ARG_ENABLE([fasthugemath],
  3697. [AS_HELP_STRING([--enable-fasthugemath],[Enable fast math + huge code (default: disabled)])],
  3698. [ ENABLED_FASTHUGEMATH=$enableval ],
  3699. [ ENABLED_FASTHUGEMATH=no ]
  3700. )
  3701. if test "$ENABLED_BUMP" = "yes"
  3702. then
  3703. ENABLED_FASTHUGEMATH="yes"
  3704. fi
  3705. if test "$ENABLED_FASTHUGEMATH" = "yes"
  3706. then
  3707. ENABLED_FASTMATH="yes"
  3708. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  3709. ENABLED_SLOWMATH="no"
  3710. fi
  3711. # Enable Examples, used to disable examples
  3712. if test "$ENABLED_LINUXKM" = "yes"
  3713. then
  3714. ENABLED_EXAMPLES_DEFAULT=no
  3715. else
  3716. ENABLED_EXAMPLES_DEFAULT=yes
  3717. fi
  3718. AC_ARG_ENABLE([examples],
  3719. [AS_HELP_STRING([--enable-examples],[Enable Examples (default: enabled)])],
  3720. [ ENABLED_EXAMPLES=$enableval ],
  3721. [ ENABLED_EXAMPLES=$ENABLED_EXAMPLES_DEFAULT ]
  3722. )
  3723. AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
  3724. AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"])
  3725. AS_IF([test "x$ENABLED_CRYPTONLY" = "xyes"], [ENABLED_EXAMPLES="no"])
  3726. # Enable wolfCrypt test and benchmark
  3727. if test "$ENABLED_LINUXKM" = "yes"
  3728. then
  3729. ENABLED_CRYPT_TESTS_DEFAULT=no
  3730. else
  3731. ENABLED_CRYPT_TESTS_DEFAULT=yes
  3732. fi
  3733. AC_ARG_ENABLE([crypttests],
  3734. [AS_HELP_STRING([--enable-crypttests],[Enable Crypt Bench/Test (default: enabled)])],
  3735. [ ENABLED_CRYPT_TESTS=$enableval ],
  3736. [ ENABLED_CRYPT_TESTS=$ENABLED_CRYPT_TESTS_DEFAULT ]
  3737. )
  3738. AC_SUBST([ENABLED_CRYPT_TESTS])
  3739. # LIBZ
  3740. ENABLED_LIBZ="no"
  3741. trylibzdir=""
  3742. AC_ARG_WITH([libz],
  3743. [ --with-libz=PATH PATH to libz install (default /usr/) ],
  3744. [
  3745. AC_MSG_CHECKING([for libz])
  3746. CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
  3747. LIBS="$LIBS -lz"
  3748. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  3749. if test "x$libz_linked" = "xno" ; then
  3750. if test "x$withval" != "xno" ; then
  3751. trylibzdir=$withval
  3752. fi
  3753. if test "x$withval" = "xyes" ; then
  3754. trylibzdir="/usr"
  3755. fi
  3756. LDFLAGS="$LDFLAGS -L$trylibzdir/lib"
  3757. CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
  3758. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  3759. if test "x$libz_linked" = "xno" ; then
  3760. AC_MSG_ERROR([libz isn't found.
  3761. If it's already installed, specify its path using --with-libz=/dir/])
  3762. fi
  3763. AC_MSG_RESULT([yes])
  3764. else
  3765. AC_MSG_RESULT([yes])
  3766. fi
  3767. ENABLED_LIBZ="yes"
  3768. ]
  3769. )
  3770. # PKCS#11
  3771. AC_ARG_ENABLE([pkcs11],
  3772. [AS_HELP_STRING([--enable-pkcs11],[Enable pkcs11 access (default: disabled)])],
  3773. [ ENABLED_PKCS11=$enableval ],
  3774. [ ENABLED_PKCS11=no ]
  3775. )
  3776. if test "x$ENABLED_PKCS11" = "xyes"
  3777. then
  3778. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS11 -DHAVE_WOLF_BIGINT"
  3779. LIBS="$LIBS -ldl"
  3780. fi
  3781. # PKCS#12
  3782. AC_ARG_ENABLE([pkcs12],
  3783. [AS_HELP_STRING([--enable-pkcs12],[Enable pkcs12 (default: enabled)])],
  3784. [ ENABLED_PKCS12=$enableval ],
  3785. [ ENABLED_PKCS12=yes ]
  3786. )
  3787. if test "x$ENABLED_PKCS12" = "xno"
  3788. then
  3789. AM_CFLAGS="$AM_CFLAGS -DNO_PKCS12"
  3790. fi
  3791. # cavium
  3792. trycaviumdir=""
  3793. AC_ARG_WITH([cavium],
  3794. [ --with-cavium=PATH PATH to cavium/software dir ],
  3795. [
  3796. AC_MSG_CHECKING([for cavium])
  3797. CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
  3798. LIB_ADD="-lrt $LIB_ADD"
  3799. if test "x$withval" = "xyes" ; then
  3800. AC_MSG_ERROR([need a PATH for --with-cavium])
  3801. fi
  3802. if test "x$withval" != "xno" ; then
  3803. trycaviumdir=$withval
  3804. fi
  3805. LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
  3806. CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
  3807. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
  3808. if test "x$cavium_linked" = "xno" ; then
  3809. AC_MSG_ERROR([cavium isn't found.
  3810. If it's already installed, specify its path using --with-cavium=/dir/])
  3811. else
  3812. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM"
  3813. fi
  3814. AC_MSG_RESULT([yes])
  3815. enable_shared=no
  3816. enable_static=yes
  3817. ENABLED_CAVIUM=yes
  3818. ],
  3819. [ ENABLED_CAVIUM=no ]
  3820. )
  3821. # cavium V
  3822. trycaviumdir=""
  3823. AC_ARG_WITH([cavium-v],
  3824. [ --with-cavium-v=PATH PATH to Cavium V/software dir ],
  3825. [
  3826. AC_MSG_CHECKING([for cavium])
  3827. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM -DHAVE_CAVIUM_V"
  3828. LIB_ADD="-lrt -lcrypto $LIB_ADD"
  3829. if test "x$withval" = "xyes" ; then
  3830. AC_MSG_ERROR([need a PATH for --with-cavium])
  3831. fi
  3832. if test "x$withval" != "xno" ; then
  3833. trycaviumdir=$withval
  3834. fi
  3835. AC_CHECK_FILES([$trycaviumdir/lib/libnitrox.a], [AM_CPPFLAGS="-I$trycaviumdir/include $AM_CPPFLAGS"], [ENABLED_CAVIUM_V=no])
  3836. LIB_STATIC_ADD="$trycaviumdir/lib/libnitrox.a $LIB_STATIC_ADD"
  3837. if test "$ENABLED_CAVIUM_V" = "no"; then
  3838. AC_MSG_ERROR([Could not find Nitrox library])
  3839. fi
  3840. enable_shared=no
  3841. enable_static=yes
  3842. enable_opensslextra=yes
  3843. ENABLED_CAVIUM=yes
  3844. ENABLED_CAVIUM_V=yes
  3845. ],
  3846. [
  3847. ENABLED_CAVIUM_=no
  3848. ENABLED_CAVIUM_V=no
  3849. ]
  3850. )
  3851. # Cavium Octeon
  3852. OCTEON_ROOT=""
  3853. : ${OCTEON_OBJ="obj-octeon2"}
  3854. : ${OCTEON_HOST="standalone"}
  3855. AC_ARG_WITH([octeon-sync],
  3856. [AS_HELP_STRING([--with-octeon-sync=PATH],[PATH to Cavium Octeon SDK dir (sync)])],
  3857. [
  3858. AC_MSG_CHECKING([for octeon])
  3859. if test "x$withval" = "xyes" ; then
  3860. AC_MSG_ERROR([need a PATH for --with-octeon])
  3861. fi
  3862. if test "x$withval" != "xno" ; then
  3863. OCTEON_ROOT=$withval
  3864. fi
  3865. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM_OCTEON_SYNC"
  3866. AM_CFLAGS="$AM_CFLAGS -DOCTEON_MODEL=$OCTEON_MODEL"
  3867. AM_CFLAGS="$AM_CFLAGS -I$OCTEON_ROOT/executive"
  3868. AS_CASE([$OCTEON_HOST],['linux'],[AM_CFLAGS="$AM_CFLAGS -DCVMX_BUILD_FOR_LINUX_HOST"])
  3869. #-I$OCTEON_ROOT/target/include
  3870. AM_LDFLAGS="$AM_LDFLAGS -lrt -Xlinker -T -Xlinker $OCTEON_ROOT/executive/cvmx-shared-linux.ld"
  3871. AM_LDFLAGS="$AM_LDFLAGS -L$OCTEON_ROOT/executive/$OCTEON_OBJ -lcvmx -lfdt"
  3872. enable_shared=no
  3873. enable_static=yes
  3874. ENABLED_OCTEON_SYNC=yes
  3875. AC_MSG_RESULT([yes])
  3876. ],
  3877. [ENABLED_OCTEON_SYNC=no]
  3878. )
  3879. # Intel QuickAssist
  3880. QAT_DIR=""
  3881. BUILD_INTEL_QAT_VERSION=2
  3882. AC_ARG_WITH([intelqa],
  3883. [AS_HELP_STRING([--with-intelqa=PATH],[PATH to Intel QuickAssist (QAT) driver dir])],
  3884. [ENABLED_INTEL_QA=yes; QAT_DIR=$withval],
  3885. [ENABLED_INTEL_QA=no])
  3886. AC_ARG_WITH([intelqa-sync],
  3887. [AS_HELP_STRING([--with-intelqa-sync=PATH],[PATH to Intel QuickAssist (QAT) driver dir (sync)])],
  3888. [ENABLED_INTEL_QA_SYNC=yes; QAT_DIR=$withval],
  3889. [ENABLED_INTEL_QA_SYNC=no])
  3890. AS_IF([test "x$ENABLED_INTEL_QA" = "xyes" && test "x$ENABLED_INTEL_QA_SYNC" = "xyes"],
  3891. [AC_MSG_ERROR([Both Intel QA Async and Sync are selected, only select one.])])
  3892. AS_IF([test "x$ENABLED_INTEL_QA" = "xyes" || test "x$ENABLED_INTEL_QA_SYNC" = "xyes"],
  3893. [AC_MSG_CHECKING([for intelqa])
  3894. AS_IF([test "x$ENABLED_INTEL_QA" = "xyes"],
  3895. [AM_CPPFLAGS="$AM_CPPFLAGS -DHAVE_INTEL_QA -DDO_CRYPTO -DUSER_SPACE"; intelqa_opt=""],
  3896. [AM_CPPFLAGS="$AM_CPPFLAGS -DHAVE_INTEL_QA_SYNC -DQAT_USE_POLLING_THREAD -DO_CRYPTO -DUSER_SPACE"; intelqa_opt="-sync"])
  3897. OLD_LIBS="$LIBS"
  3898. OLD_CPPFLAGS="$CPPFLAGS"
  3899. AS_IF([test "x$QAT_DIR" = "xyes"],[AC_MSG_ERROR([need a PATH for --with-intelqa$intelqa_opt])])
  3900. AM_CPPFLAGS="$AM_CPPFLAGS -I$QAT_DIR/quickassist/include -I$QAT_DIR/quickassist/include/lac -I$QAT_DIR/quickassist/utilities/osal/include \
  3901. -I$QAT_DIR/quickassist/utilities/osal/src/linux/user_space/include -I$QAT_DIR/quickassist/lookaside/access_layer/include \
  3902. -I$QAT_DIR/quickassist/lookaside/access_layer/src/common/include -I$srcdir/wolfssl -I$srcdir/wolfssl/wolfcrypt/port/intel \
  3903. -I$QAT_DIR/quickassist/utilities/libusdm_drv"
  3904. CPPFLAGS="$AM_CPPFLAGS"
  3905. LDFLAGS="$LDFLAGS -L$QAT_DIR/build"
  3906. LIBS="$LIBS -lqat_s -lusdm_drv_s"
  3907. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]],[[Cpa16U count = 0; cpaCyGetNumInstances(&count);]])],[intelqa_linked=yes],[intelqa_linked=no])
  3908. AS_IF([test "x$intelqa_linked" = "xno"],
  3909. [# Try old QAT driver libraries
  3910. LIBS="$OLD_LIBS -licp_qa_al_s"
  3911. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]],[[Cpa16U count = 0; cpaCyGetNumInstances(&count);]])],[intelqa_linked=yes],[intelqa_linked=no])
  3912. AS_IF([test "x$intelqa_linked" = "xno"],
  3913. [AC_MSG_ERROR([Intel QuickAssist not found. If it's already installed, specify its path using --with-intelqa$intelqa_opt=/dir/])],
  3914. [BUILD_INTEL_QAT_VERSION=1])
  3915. ])
  3916. AC_MSG_RESULT([yes])
  3917. AS_IF([test "x$BUILD_INTEL_QAT_VERSION" = "x1"],
  3918. [LIB_ADD="-ladf_proxy -losal -lrt $LIB_ADD"],
  3919. [LIB_ADD="-losal -lrt $LIB_ADD"])
  3920. CPPFLAGS="$OLD_CPPFLAGS"
  3921. ])
  3922. ENABLED_SP_RSA=no
  3923. ENABLED_SP_DH=no
  3924. ENABLED_SP_FF_2048=no
  3925. ENABLED_SP_FF_3072=no
  3926. ENABLED_SP_FF_4096=no
  3927. ENABLED_SP_ECC=no
  3928. ENABLED_SP_EC_256=no
  3929. ENABLED_SP_EC_384=no
  3930. ENABLED_SP_NO_MALLOC=no
  3931. ENABLED_SP_NONBLOCK=no
  3932. for v in `echo $ENABLED_SP | tr "," " "`
  3933. do
  3934. case $v in
  3935. small)
  3936. ENABLED_SP_RSA=yes
  3937. ENABLED_SP_DH=yes
  3938. ENABLED_SP_FF_2048=yes
  3939. ENABLED_SP_FF_3072=yes
  3940. ENABLED_SP_ECC=yes
  3941. ENABLED_SP_SMALL=yes
  3942. ENABLED_SP_EC_256=yes
  3943. if test "$host_cpu" = "x86_64"; then
  3944. ENABLED_SP_FF_4096=yes
  3945. ENABLED_SP_EC_384=yes
  3946. fi
  3947. ;;
  3948. yes)
  3949. ENABLED_SP_RSA=yes
  3950. ENABLED_SP_DH=yes
  3951. ENABLED_SP_FF_2048=yes
  3952. ENABLED_SP_FF_3072=yes
  3953. ENABLED_SP_ECC=yes
  3954. ENABLED_SP_EC_256=yes
  3955. if test "$host_cpu" = "x86_64"; then
  3956. ENABLED_SP_FF_4096=yes
  3957. ENABLED_SP_EC_384=yes
  3958. fi
  3959. ;;
  3960. no)
  3961. ;;
  3962. smallec256 | smallp256 | small256)
  3963. ENABLED_SP_ECC=yes
  3964. ENABLED_SP_SMALL=yes
  3965. ENABLED_SP_EC_256=yes
  3966. ;;
  3967. ec256 | p256 | 256)
  3968. ENABLED_SP_ECC=yes
  3969. ENABLED_SP_EC_256=yes
  3970. ;;
  3971. smallec384 | smallp384 | small384)
  3972. ENABLED_SP_ECC=yes
  3973. ENABLED_SP_SMALL=yes
  3974. ENABLED_SP_EC_384=yes
  3975. ;;
  3976. ec384 | p384 | 384)
  3977. ENABLED_SP_ECC=yes
  3978. ENABLED_SP_EC_384=yes
  3979. ;;
  3980. small2048)
  3981. ENABLED_SP_SMALL=yes
  3982. ENABLED_SP_RSA=yes
  3983. ENABLED_SP_DH=yes
  3984. ENABLED_SP_FF_2048=yes
  3985. ;;
  3986. 2048)
  3987. ENABLED_SP_RSA=yes
  3988. ENABLED_SP_DH=yes
  3989. ENABLED_SP_FF_2048=yes
  3990. ;;
  3991. smallrsa2048)
  3992. ENABLED_SP_SMALL=yes
  3993. ENABLED_SP_RSA=yes
  3994. ENABLED_SP_FF_2048=yes
  3995. ;;
  3996. rsa2048)
  3997. ENABLED_SP_RSA=yes
  3998. ENABLED_SP_FF_2048=yes
  3999. ;;
  4000. small3072)
  4001. ENABLED_SP_SMALL=yes
  4002. ENABLED_SP_RSA=yes
  4003. ENABLED_SP_DH=yes
  4004. ENABLED_SP_FF_3072=yes
  4005. ;;
  4006. 3072)
  4007. ENABLED_SP_RSA=yes
  4008. ENABLED_SP_DH=yes
  4009. ENABLED_SP_FF_3072=yes
  4010. ;;
  4011. smallrsa3072)
  4012. ENABLED_SP_SMALL=yes
  4013. ENABLED_SP_RSA=yes
  4014. ENABLED_SP_FF_3072=yes
  4015. ;;
  4016. rsa3072)
  4017. ENABLED_SP_RSA=yes
  4018. ENABLED_SP_FF_3072=yes
  4019. ;;
  4020. small4096)
  4021. ENABLED_SP_SMALL=yes
  4022. ENABLED_SP_RSA=yes
  4023. ENABLED_SP_DH=yes
  4024. ENABLED_SP_FF_4096=yes
  4025. ;;
  4026. 4096 | +4096)
  4027. ENABLED_SP_RSA=yes
  4028. ENABLED_SP_DH=yes
  4029. ENABLED_SP_FF_4096=yes
  4030. ;;
  4031. smallrsa4096)
  4032. ENABLED_SP_SMALL=yes
  4033. ENABLED_SP_RSA=yes
  4034. ENABLED_SP_FF_4096=yes
  4035. ;;
  4036. rsa4096)
  4037. ENABLED_SP_RSA=yes
  4038. ENABLED_SP_FF_4096=yes
  4039. ;;
  4040. nomalloc)
  4041. ENABLED_SP_NO_MALLOC=yes
  4042. ;;
  4043. nonblock)
  4044. # Requires small and no malloc
  4045. ENABLED_SP_NONBLOCK=yes
  4046. ENABLED_SP_NO_MALLOC=yes
  4047. ENABLED_SP_SMALL=yes
  4048. ;;
  4049. *)
  4050. AC_MSG_ERROR([Invalid choice of Single Precision length in bits [256, 2048, 3072]: $ENABLED_SP.])
  4051. break;;
  4052. esac
  4053. done
  4054. ENABLED_SP=no
  4055. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_SP_RSA" = "yes"; then
  4056. ENABLED_SP=yes
  4057. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_RSA"
  4058. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_HAVE_SP_RSA"
  4059. fi
  4060. if test "$ENABLED_DH" = "yes" && test "$ENABLED_SP_DH" = "yes"; then
  4061. ENABLED_SP=yes
  4062. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_DH"
  4063. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_HAVE_SP_DH"
  4064. fi
  4065. if test "$ENABLED_SP_RSA" = "yes" || test "$ENABLED_SP_DH" = "yes"; then
  4066. if test "$ENABLED_SP_FF_2048" = "no"; then
  4067. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_2048"
  4068. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_2048"
  4069. fi
  4070. if test "$ENABLED_SP_FF_3072" = "no"; then
  4071. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_3072"
  4072. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_3072"
  4073. fi
  4074. if test "$ENABLED_SP_FF_4096" = "yes"; then
  4075. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_4096"
  4076. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_4096"
  4077. fi
  4078. fi
  4079. if test "$ENABLED_ECC" != "no" && test "$ENABLED_SP_ECC" = "yes"; then
  4080. ENABLED_SP=yes
  4081. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_ECC"
  4082. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_HAVE_SP_ECC"
  4083. if test "$ENABLED_SP_EC_256" = "no"; then
  4084. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_256"
  4085. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_256"
  4086. fi
  4087. if test "$ENABLED_SP_EC_384" = "yes"; then
  4088. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC384 -DWOLFSSL_SP_384"
  4089. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_384"
  4090. fi
  4091. fi
  4092. if test "$ENABLED_SP_SMALL" = "yes"; then
  4093. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  4094. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_SMALL"
  4095. fi
  4096. if test "$ENABLED_SP_NO_MALLOC" = "yes"; then
  4097. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_MALLOC"
  4098. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_MALLOC"
  4099. fi
  4100. if test "$ENABLED_SP_NONBLOCK" = "yes"; then
  4101. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NONBLOCK"
  4102. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NONBLOCK"
  4103. fi
  4104. AC_ARG_ENABLE([sp-asm],
  4105. [AS_HELP_STRING([--enable-sp-asm],[Enable Single Precision assembly implementation (default: disabled)])],
  4106. [ ENABLED_SP_ASM=$enableval ],
  4107. [ ENABLED_SP_ASM=no ],
  4108. )
  4109. if test "$ENABLED_SP_ASM" = "yes"; then
  4110. if test "$ENABLED_SP" = "no"; then
  4111. AC_MSG_ERROR([Must have SP enabled: --enable-sp])
  4112. fi
  4113. if test "$ENABLED_SP_NONBLOCK" = "yes"; then
  4114. AC_MSG_ERROR([SP non-blocking not supported with sp-asm])
  4115. fi
  4116. if test "$ENABLED_ASM" = "no"; then
  4117. AC_MSG_ERROR([Assembly code turned off])
  4118. fi
  4119. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ASM"
  4120. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ASM"
  4121. case $host_cpu in
  4122. *aarch64*)
  4123. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM64_ASM"
  4124. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM64_ASM"
  4125. ENABLED_SP_ARM64_ASM=yes
  4126. ;;
  4127. *arm*)
  4128. if test $host_alias = "thumb"; then
  4129. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM_THUMB_ASM -mthumb -march=armv6"
  4130. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM_THUMB_ASM"
  4131. ENABLED_SP_ARM_THUMB_ASM=yes
  4132. else
  4133. if test $host_alias = "cortex"; then
  4134. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM_CORTEX_M_ASM -mcpu=cortex-r5"
  4135. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM_CORTEX_M_ASM"
  4136. ENABLED_SP_ARM_CORTEX_ASM=yes
  4137. else
  4138. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM32_ASM"
  4139. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM32_ASM"
  4140. ENABLED_SP_ARM32_ASM=yes
  4141. fi
  4142. fi
  4143. ;;
  4144. *x86_64*)
  4145. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_X86_64_ASM"
  4146. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_X86_64_ASM"
  4147. ENABLED_SP_X86_64_ASM=yes
  4148. ;;
  4149. *)
  4150. AC_MSG_ERROR([ASM not available for CPU. Supported CPUs: x86_64, aarch64, arm])
  4151. ;;
  4152. esac
  4153. fi
  4154. if test "$ENABLED_SP_MATH" = "yes"; then
  4155. if test "$ENABLED_SP" = "no"; then
  4156. AC_MSG_ERROR([Must have SP enabled: --enable-sp])
  4157. fi
  4158. if test "$ENABLED_ECCCUSTCURVES" = "yes"; then
  4159. AC_MSG_ERROR([Cannot use single precision math and custom curves])
  4160. fi
  4161. if test "$ENABLED_OPENSSLEXTRA" = "yes"; then
  4162. AC_MSG_ERROR([Cannot use single precision math and OpenSSL extra])
  4163. fi
  4164. if test "$ENABLED_DSA" = "yes"; then
  4165. AC_MSG_ERROR([Cannot use single precision math and DSA])
  4166. fi
  4167. if test "$ENABLED_SRP" = "yes"; then
  4168. AC_MSG_ERROR([Cannot use single precision math and SRP])
  4169. fi
  4170. if test "$ENABLED_SP_RSA" = "no" && test "$ENABLED_RSA" = "yes"; then
  4171. AC_MSG_ERROR([Cannot use RSA single precision only math and RSA])
  4172. fi
  4173. if test "$ENABLED_SP_DH" = "no" && test "$ENABLED_DH" = "yes"; then
  4174. AC_MSG_ERROR([Cannot use DH single precision only math and DH])
  4175. fi
  4176. ENABLED_FASTMATH="no"
  4177. ENABLED_SLOWMATH="no"
  4178. fi
  4179. if test "$ENABLED_SP_MATH" = "yes"; then
  4180. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MATH"
  4181. fi
  4182. # Fast RSA using Intel IPP
  4183. ippdir="${srcdir}/IPP"
  4184. ipplib="lib" # if autoconf guesses 32bit system changes lib directory
  4185. fastRSA_found=no
  4186. abs_path=`pwd`
  4187. # set up variables used
  4188. IPPLIBS=
  4189. IPPHEADERS=
  4190. IPPLINK=
  4191. AC_ARG_ENABLE([fast-rsa],
  4192. [AS_HELP_STRING([--enable-fast-rsa],[Enable RSA using Intel IPP (default: disabled)])],
  4193. [ ENABLED_FAST_RSA=$enableval ],
  4194. [ ENABLED_FAST_RSA=no ],
  4195. )
  4196. # Fast RSA does not support RSA-PSS
  4197. if test "$ENABLED_RSAPSS" = "yes"; then
  4198. ENABLED_FAST_RSA=no
  4199. fi
  4200. if test "$ENABLED_USER_RSA" = "no" && test "$ENABLED_FIPS" = "no"; then
  4201. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  4202. ipplib="lib_32" # 32 bit OS detected
  4203. fi
  4204. # Use static IPP Libraries
  4205. if test "$enable_shared" = "no" && test "$ENABLED_FAST_RSA" = "yes"; then
  4206. case $host_os in
  4207. *darwin*)
  4208. ipplib="$ipplib/mac_static"
  4209. AC_MSG_ERROR([Issue with static linking to libippcp.a on Mac.
  4210. Dynamic IPP libraries supported on Mac])
  4211. break;;
  4212. *linux*)
  4213. ipplib="$ipplib/linux_static"
  4214. break;;
  4215. *)
  4216. ENABLED_FAST_RSA=no
  4217. esac
  4218. AC_CHECK_FILES([$srcdir/IPP/$ipplib/libippcore.a $srcdir/IPP/$ipplib/libippcp.a], [], [ENABLED_FAST_RSA=no])
  4219. 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])
  4220. LIB_STATIC_ADD="$srcdir/IPP/$ipplib/libippcp.a $srcdir/IPP/$ipplib/libippcore.a $LIB_STATIC_ADD"
  4221. if test "$ENABLED_FAST_RSA" = "no"; then
  4222. AC_MSG_ERROR([Could not find fast rsa libraries])
  4223. fi
  4224. else
  4225. # Check for and use bundled IPP libraries
  4226. if test "$ENABLED_FAST_RSA" = "yes"; then
  4227. AC_MSG_NOTICE([Using local IPP crypto library])
  4228. AC_CHECK_FILES([$abs_path/IPP/include/ippcp.h],
  4229. [
  4230. # build and default locations on linux and mac
  4231. STORE_LDFLAGS=${LDFLAGS}
  4232. STORE_CPPFLAGS=${CPPFLAGS}
  4233. # using LDFLAGS instead of AM_ temporarily to test link to library
  4234. LDFLAGS="-L$ippdir/$ipplib -lippcp -lippcore"
  4235. CPPFLAGS="-I$ippdir/include"
  4236. AC_CHECK_HEADERS([ippcp.h], [AC_CHECK_LIB([ippcp], [ippsRSAEncrypt_PKCSv15], [fastRSA_found=yes], [fastRSA_found=no])], [fastRSA_found=no])
  4237. name="$ippdir/$ipplib/libippcp"
  4238. case $host_os in
  4239. *darwin*)
  4240. # check file existence and conditionally set variables
  4241. AC_CHECK_FILES([$abs_path/IPP/$ipplib/libippcp.dylib], [
  4242. 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"
  4243. 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"
  4244. ], [fastRSA_found=no])
  4245. break;;
  4246. *linux*)
  4247. # check file existence and conditionally set variables
  4248. AC_CHECK_FILES([$abs_path/IPP/$ipplib/libippcp.so.9.0], [
  4249. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  4250. 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"
  4251. 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"
  4252. else
  4253. 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"
  4254. 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"
  4255. fi
  4256. ], [fastRSA_found=no])
  4257. break;;
  4258. *)
  4259. fastRSA_found=no
  4260. esac
  4261. if test "$fastRSA_found" = "yes"; then
  4262. # was succesfull so add tested LDFLAGS to AM_ flags
  4263. AM_LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}"
  4264. AM_CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}"
  4265. IPPHEADERS="${srcdir}/IPP/include/*.h"
  4266. fi
  4267. # restore LDFLAGS to user set
  4268. LDFLAGS=${STORE_LDFLAGS}
  4269. CPPFLAGS=${STORE_CPPFLAGS}
  4270. ], [fastRSA_found=no])
  4271. fi
  4272. # Don't cache the result so it can be checked
  4273. AS_UNSET([ac_cv_header_ippcp_h])
  4274. AS_UNSET([ac_cv_header_ipp_h])
  4275. AS_UNSET([ac_cv_lib_ippcp_ippsRSAEncrypt_PKCSv15]);
  4276. # Check link and see if user has pre-existing IPP Libraries if not using local
  4277. if test "$ENABLED_FAST_RSA" = "yes" && test "$fastRSA_found" = "no"; then
  4278. AC_MSG_NOTICE([Checking if IPP crypto library installed])
  4279. AC_CHECK_HEADER([ippcp.h], [AC_CHECK_LIB([ippcp], [ippsRSAEncrypt_PKCSv15],
  4280. [
  4281. fastRSA_found=yes
  4282. AM_LDFLAGS="${AM_LDFLAGS} -lippcore -lippcp"
  4283. ], [ fastRSA_found=no])
  4284. ], [fastRSA_found=no])
  4285. # Error out on not finding libraries
  4286. if test "$fastRSA_found" = "no"; then
  4287. AC_MSG_ERROR([Could not find fast rsa libraries])
  4288. fi
  4289. fi
  4290. fi # end of if for shared library
  4291. else # if user rsa is set than do not use fast rsa option
  4292. if test "$ENABLED_FAST_RSA" = "yes"; then
  4293. AC_MSG_ERROR([Could not use fast rsa libraries with user crypto or fips])
  4294. fi
  4295. fi # end of if for user rsa crypto or fips
  4296. # End result of checking for IPP Libraries
  4297. AC_MSG_CHECKING([for fast RSA])
  4298. if test "$ENABLED_FAST_RSA" = "yes"; then
  4299. AM_CFLAGS="$AM_CFLAGS -DHAVE_FAST_RSA -DHAVE_USER_RSA"
  4300. # add in user crypto header that uses Intel IPP
  4301. AM_CPPFLAGS="$AM_CPPFLAGS -I$srcdir/wolfcrypt/user-crypto/include"
  4302. if test "$enable_shared" = "yes"; then
  4303. LIBS="$LIBS -lippcore -lippcp"
  4304. LIB_ADD="-lippcp -lippcore $LIB_ADD"
  4305. else
  4306. LIB_ADD="$srcdir/IPP/$ipplib/libippcp.a $srcdir/IPP/$ipplib/libippcore.a $LIB_ADD"
  4307. fi
  4308. AC_MSG_RESULT([yes])
  4309. else
  4310. AC_MSG_RESULT([no])
  4311. fi
  4312. AC_SUBST([IPPLIBS])
  4313. AC_SUBST([IPPHEADERS])
  4314. AC_SUBST([IPPLINK])
  4315. # static memory use
  4316. AC_ARG_ENABLE([staticmemory],
  4317. [AS_HELP_STRING([--enable-staticmemory],[Enable static memory use (default: disabled)])],
  4318. [ ENABLED_STATICMEMORY=$enableval ],
  4319. [ ENABLED_STATICMEMORY=no ]
  4320. )
  4321. if test "x$ENABLED_STATICMEMORY" = "xyes"
  4322. then
  4323. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY"
  4324. if test "x$ENABLED_FASTMATH" = "xno"
  4325. then
  4326. AC_MSG_ERROR([please use --enable-fastmath if enabling staticmemory.])
  4327. fi
  4328. if test "$ENABLED_LOWRESOURCE" = "yes" && test "$ENABLED_RSA" = "no"
  4329. then
  4330. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY_SMALL"
  4331. fi
  4332. fi
  4333. # microchip api
  4334. AC_ARG_ENABLE([mcapi],
  4335. [AS_HELP_STRING([--enable-mcapi],[Enable Microchip API (default: disabled)])],
  4336. [ ENABLED_MCAPI=$enableval ],
  4337. [ ENABLED_MCAPI=no ]
  4338. )
  4339. if test "$ENABLED_MCAPI" = "yes"
  4340. then
  4341. AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI"
  4342. if test "x$ENABLED_AESCTR" != "xyes"
  4343. then
  4344. # These flags are already implied by --enable-aesctr
  4345. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  4346. fi
  4347. fi
  4348. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
  4349. then
  4350. AC_MSG_ERROR([please enable sha512 if enabling mcapi.])
  4351. fi
  4352. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_ECC" = "no"
  4353. then
  4354. AC_MSG_ERROR([please enable ecc if enabling mcapi.])
  4355. fi
  4356. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_LIBZ" = "no"
  4357. then
  4358. AC_MSG_ERROR([please use --with-libz if enabling mcapi.])
  4359. fi
  4360. # Asynchronous Crypto
  4361. AC_ARG_ENABLE([asynccrypt],
  4362. [AS_HELP_STRING([--enable-asynccrypt],[Enable Asynchronous Crypto (default: disabled)])],
  4363. [ ENABLED_ASYNCCRYPT=$enableval ],
  4364. [ ENABLED_ASYNCCRYPT=no ]
  4365. )
  4366. if test "$ENABLED_ASYNCCRYPT" = "yes"
  4367. then
  4368. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT -DHAVE_WOLF_EVENT -DHAVE_WOLF_BIGINT -DWOLFSSL_NO_HASH_RAW"
  4369. # if no async hardware then use simulator for testing
  4370. if test "x$ENABLED_CAVIUM" = "xno" && test "x$ENABLED_INTEL_QA" = "xno"
  4371. then
  4372. # Async threading is Linux specific
  4373. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT_TEST"
  4374. fi
  4375. fi
  4376. # check for async if using Intel QuckAssist or Cavium
  4377. if test "x$ENABLED_INTEL_QA" = "xyes" || test "x$ENABLED_CAVIUM" = "xyes" ; then
  4378. if test "x$ENABLED_ASYNCCRYPT" = "xno" ; then
  4379. AC_MSG_ERROR([Please enable asynchronous support using --enable-asynccrypt])
  4380. fi
  4381. fi
  4382. # Asynchronous threading
  4383. AC_ARG_ENABLE([asyncthreads],
  4384. [AS_HELP_STRING([--enable-asyncthreads],[Enable Asynchronous Threading (default: enabled)])],
  4385. [ ENABLED_ASYNCTHREADS=$enableval ],
  4386. [ ENABLED_ASYNCTHREADS=yes ]
  4387. )
  4388. if test "$ENABLED_ASYNCCRYPT" = "yes" && test "$ENABLED_ASYNCTHREADS" = "yes"
  4389. then
  4390. AX_PTHREAD([ENABLED_ASYNCTHREADS=yes],[ENABLED_ASYNCTHREADS=no])
  4391. else
  4392. ENABLED_ASYNCTHREADS=no
  4393. fi
  4394. if test "$ENABLED_ASYNCTHREADS" = "yes"
  4395. then
  4396. LIB_ADD="-lpthread $LIB_ADD"
  4397. AM_CFLAGS="$AM_CFLAGS -D_GNU_SOURCE"
  4398. else
  4399. AM_CFLAGS="$AM_CFLAGS -DWC_NO_ASYNC_THREADING"
  4400. fi
  4401. # cryptodev is old name, replaced with cryptocb
  4402. AC_ARG_ENABLE([cryptodev],
  4403. [AS_HELP_STRING([--enable-cryptodev],[DEPRECATED, use cryptocb instead])],
  4404. [ ENABLED_CRYPTOCB=$enableval ],[ ENABLED_CRYPTOCB=no ])
  4405. # Support for crypto callbacks
  4406. AC_ARG_ENABLE([cryptocb],
  4407. [AS_HELP_STRING([--enable-cryptocb],[Enable crypto callbacks (default: disabled)])],
  4408. [ ENABLED_CRYPTOCB=$enableval ],
  4409. [ ENABLED_CRYPTOCB=no ]
  4410. )
  4411. if test "x$ENABLED_PKCS11" = "xyes"
  4412. then
  4413. ENABLED_CRYPTOCB=yes
  4414. fi
  4415. if test "$ENABLED_CRYPTOCB" = "yes"
  4416. then
  4417. AM_CFLAGS="$AM_CFLAGS -DWOLF_CRYPTO_CB"
  4418. fi
  4419. # Session Export
  4420. AC_ARG_ENABLE([sessionexport],
  4421. [AS_HELP_STRING([--enable-sessionexport],[Enable export and import of sessions (default: disabled)])],
  4422. [ ENABLED_SESSIONEXPORT=$enableval ],
  4423. [ ENABLED_SESSIONEXPORT=no ]
  4424. )
  4425. if test "$ENABLED_SESSIONEXPORT" = "yes" ||
  4426. test "$ENABLED_SESSIONEXPORT" = "nopeer"
  4427. then
  4428. if test "$ENABLED_DTLS" = "no"
  4429. then
  4430. AC_MSG_ERROR([Only DTLS supported with session export])
  4431. fi
  4432. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SESSION_EXPORT"
  4433. if test "$ENABLED_SESSIONEXPORT" = "nopeer"
  4434. then
  4435. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SESSION_EXPORT_NOPEER"
  4436. fi
  4437. fi
  4438. # AES key wrap
  4439. AC_ARG_ENABLE([aeskeywrap],
  4440. [AS_HELP_STRING([--enable-aeskeywrap],[Enable AES key wrap support (default: disabled)])],
  4441. [ ENABLED_AESKEYWRAP=$enableval ],
  4442. [ ENABLED_AESKEYWRAP=no ]
  4443. )
  4444. if test "$ENABLED_WPAS" != "no" && test "$ENABLED_FIPS" = "no"
  4445. then
  4446. ENABLED_AESKEYWRAP="yes"
  4447. fi
  4448. if test "$ENABLED_AESKEYWRAP" = "yes"
  4449. then
  4450. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_KEYWRAP -DWOLFSSL_AES_DIRECT"
  4451. fi
  4452. # Old name support for backwards compatibility
  4453. AC_ARG_ENABLE([oldnames],
  4454. [AS_HELP_STRING([--enable-oldnames],[Keep backwards compat with old names (default: enabled)])],
  4455. [ ENABLED_OLDNAMES=$enableval ],
  4456. [ ENABLED_OLDNAMES=yes ]
  4457. )
  4458. if test "x$ENABLED_OLDNAMES" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  4459. then
  4460. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_RNGNAME -DNO_OLD_WC_NAMES -DNO_OLD_SSL_NAMES"
  4461. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_SHA_NAMES"
  4462. fi
  4463. # Memory Tests
  4464. AC_ARG_ENABLE([memtest],
  4465. [AS_HELP_STRING([--enable-memtest],[Memory testing option, for internal use (default: disabled)])],
  4466. [ ENABLED_MEMTEST=$enableval ],
  4467. [ ENABLED_MEMTEST=no ]
  4468. )
  4469. if test "x$ENABLED_MEMTEST" != "xno"
  4470. then
  4471. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY -DWOLFSSL_DEBUG_MEMORY -DWOLFSSL_FORCE_MALLOC_FAIL_TEST"
  4472. fi
  4473. # Enable hash flags support
  4474. # Hash flags are useful for runtime options such as SHA3 KECCAK256 selection
  4475. AC_ARG_ENABLE([hashflags],
  4476. [AS_HELP_STRING([--enable-hashflags],[Enable support for hash flags (default: disabled)])],
  4477. [ ENABLED_HASHFLAGS=$enableval ],
  4478. [ ENABLED_HASHFLAGS=no ]
  4479. )
  4480. if test "x$ENABLED_HASHFLAGS" != "xno"
  4481. then
  4482. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HASH_FLAGS"
  4483. fi
  4484. # Support for enabling setting default DH parameters in
  4485. AC_ARG_ENABLE([defaultdhparams],
  4486. [AS_HELP_STRING([--enable-dhdefaultparams],[Enables option for default dh parameters (default: disabled)])],
  4487. [ ENABLED_DHDEFAULTPARAMS=$enableval ],
  4488. [ ENABLED_DHDEFAULTPARAMS=no ]
  4489. )
  4490. if test "$ENABLED_DHDEFAULTPARAMS" = "yes" || test "$ENABLED_QT" = "no"
  4491. then
  4492. ENABLED_DHDEFAULTPARAMS=yes
  4493. AM_CFLAGS="$AM_CFLAGS -DHAVE_DH_DEFAULT_PARAMS"
  4494. fi
  4495. # User Settings
  4496. AC_ARG_ENABLE([usersettings],
  4497. [AS_HELP_STRING([--enable-usersettings],[Use your own user_settings.h and do not add Makefile CFLAGS (default: disabled)])],
  4498. [ ENABLED_USERSETTINGS=$enableval ],
  4499. [ ENABLED_USERSETTINGS=no ]
  4500. )
  4501. # Default optimization CFLAGS enable
  4502. AC_ARG_ENABLE([optflags],
  4503. [AS_HELP_STRING([--enable-optflags],[Enable default optimization CFLAGS for the compiler (default: enabled)])],
  4504. [ ENABLED_OPTFLAGS=$enableval ],
  4505. [ ENABLED_OPTFLAGS=yes ]
  4506. )
  4507. # check if should run the trusted peer certs test
  4508. # (for now checking both C_FLAGS and C_EXTRA_FLAGS)
  4509. AS_CASE(["$CFLAGS $CPPFLAGS"],[*'WOLFSSL_TRUST_PEER_CERT'*],[ENABLED_TRUSTED_PEER_CERT=yes])
  4510. # dertermine if we have key validation mechanism
  4511. if test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_RSA" = "xyes"
  4512. then
  4513. if test "x$ENABLED_ASN" = "xyes"
  4514. then
  4515. ENABLED_PKI="yes"
  4516. fi
  4517. fi
  4518. # When building for wolfRand, strip out all options to disable everything.
  4519. AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$FIPS_VERSION" = "xrand"],
  4520. [NEW_AM_CFLAGS="-DNO_AES -DNO_DH -DNO_ASN -DNO_RSA -DNO_SHA -DNO_MD5 -DNO_BIG_INT"
  4521. for v in $AM_CFLAGS
  4522. do
  4523. case $v in
  4524. -DHAVE_FFDHE_2048 | -DTFM_TIMING_RESISTANT | -DECC_TIMING_RESISTANT | \
  4525. -DWC_RSA_BLINDING | -DHAVE_AESGCM | -DWOLFSSL_SHA512 | -DWOLFSSL_SHA384 | \
  4526. -DHAVE_ECC | -DTFM_ECC256 | -DECC_SHAMIR | -DHAVE_TLS_EXTENSIONS | \
  4527. -DHAVE_SUPPORTED_CURVES | -DHAVE_EXTENDED_MASTER | -DUSE_FAST_MATH)
  4528. AS_ECHO(["ignoring $v"])
  4529. ;;
  4530. *)
  4531. NEW_AM_CFLAGS="$NEW_AM_CFLAGS $v"
  4532. ;;
  4533. esac
  4534. done
  4535. AM_CFLAGS=$NEW_AM_CFLAGS])
  4536. ################################################################################
  4537. # Check for build-type conflicts #
  4538. ################################################################################
  4539. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  4540. test "x$ENABLED_LEANPSK" = "xyes"],
  4541. [AC_MSG_ERROR([Cannot use Max Strength and Lean PSK at the same time.])])
  4542. AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
  4543. test "x$ENABLED_ASN" = "xno"],
  4544. [AC_MSG_ERROR([please enable asn if enabling ocsp.])])
  4545. AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
  4546. test "x$ENABLED_RSA" = "xno" && \
  4547. test "x$ENABLED_ECC" = "xno"],
  4548. [AC_MSG_ERROR([please enable rsa or ecc if enabling ocsp.])])
  4549. # Sync Intel QA and Sync Cavium Octeon require the crypto callback
  4550. AS_IF([test "x$ENABLED_INTEL_QA_SYNC" = "xyes" || test "x$ENABLED_OCTEON_SYNC" = "xyes"],
  4551. [AS_IF([test "x$ENABLED_CRYPTOCB" = "xno"],
  4552. [AC_MSG_ERROR([please enable the crypto callback support using --enable-cryptocb])])])
  4553. # checks for pkcs7 needed enables
  4554. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  4555. test "x$ENABLED_RSA" = "xno" && \
  4556. test "x$ENABLED_ECC" = "xno"],
  4557. [AC_MSG_ERROR([please enable ecc or rsa if enabling pkcs7.])])
  4558. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  4559. test "x$ENABLED_SHA" = "xno"],
  4560. [AC_MSG_ERROR([please enable sha if enabling pkcs7.])])
  4561. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  4562. test "x$ENABLED_AES" = "xno" && \
  4563. test "x$ENABLED_DES3" = "xno"],
  4564. [AC_MSG_ERROR([please enable either AES or 3DES if enabling pkcs7.])])
  4565. AS_IF([test "x$ENABLED_WOLFSCEP" = "xyes" && \
  4566. test "x$ENABLED_AES" = "xno" && \
  4567. test "x$ENABLED_DES3" = "xno"],
  4568. [AC_MSG_ERROR([please enable either AES or 3DES if enabling scep.])])
  4569. AS_IF([test "x$ENABLED_LEANTLS" = "xyes" && \
  4570. test "x$ENABLED_ECC" = "xno"],
  4571. [AC_MSG_ERROR([please enable ecc if enabling leantls.])])
  4572. AS_IF([test "x$ENABLED_SNIFFER" = "xyes" && \
  4573. test "x$ENABLED_RSA" = "xno" && \
  4574. test "x$ENABLED_ECC" = "xno"],
  4575. [AC_MSG_ERROR([please enable ecc or rsa if enabling sniffer.])])
  4576. # Lean TLS forces off prereqs of SCEP.
  4577. AS_IF([test "x$ENABLED_SCEP" = "xyes" && \
  4578. test "x$ENABLED_LEANTLS" = "xyes"],
  4579. [AC_MSG_ERROR([Cannot use SCEP and Lean TLS at the same time.])])
  4580. # CMAC currently requires AES.
  4581. AS_IF([test "x$ENABLED_CMAC" = "xyes" && \
  4582. test "x$ENABLED_AES" = "xno"],
  4583. [AC_MSG_ERROR([cannot use CMAC without AES.])])
  4584. ################################################################################
  4585. # Update CFLAGS based on options #
  4586. ################################################################################
  4587. AS_IF([test "x$ENABLED_MCAPI" = "xyes"],
  4588. [AS_IF([test "x$ENABLED_DES3" = "xno"],[ENABLED_DES3="yes"])])
  4589. if test "$ENABLED_WOLFSCEP" = "yes"
  4590. then
  4591. # Enable prereqs if not already enabled
  4592. if test "x$ENABLED_KEYGEN" = "xno"
  4593. then
  4594. ENABLED_KEYGEN="yes"
  4595. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  4596. fi
  4597. if test "x$ENABLED_CERTGEN" = "xno"
  4598. then
  4599. ENABLED_CERTGEN="yes"
  4600. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  4601. fi
  4602. if test "x$ENABLED_CERTREQ" = "xno"
  4603. then
  4604. ENABLED_CERTREQ="yes"
  4605. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  4606. fi
  4607. if test "x$ENABLED_CERTEXT" = "xno"
  4608. then
  4609. ENABLED_CERTEXT="yes"
  4610. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  4611. fi
  4612. if test "x$ENABLED_PKCS7" = "xno"
  4613. then
  4614. ENABLED_PKCS7="yes"
  4615. fi
  4616. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_WOLFSCEP"
  4617. fi
  4618. #if test "$ENABLED_SP_MATH" = "yes" && test "$ENABLED_KEYGEN" = "yes"; then
  4619. # AC_MSG_ERROR([Cannot use single precision math and key generation])
  4620. #fi
  4621. if test "x$ENABLED_PKCS7" = "xyes"
  4622. then
  4623. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  4624. # Enable prereqs if not already enabled
  4625. if test "x$ENABLED_AESKEYWRAP" = "xno"
  4626. then
  4627. ENABLED_AESKEYWRAP="yes"
  4628. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_KEYWRAP -DWOLFSSL_AES_DIRECT"
  4629. fi
  4630. if test "x$ENABLED_X963KDF" = "xno" && test "$ENABLED_ECC" != "no"
  4631. then
  4632. ENABLED_X963KDF="yes"
  4633. AM_CFLAGS="$AM_CFLAGS -DHAVE_X963_KDF"
  4634. fi
  4635. fi
  4636. if test "x$ENABLED_DES3" = "xno"
  4637. then
  4638. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  4639. else
  4640. # turn off DES3 if leanpsk or leantls on
  4641. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  4642. then
  4643. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  4644. ENABLED_DES3=no
  4645. fi
  4646. fi
  4647. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes"],
  4648. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MAX_STRENGTH"])
  4649. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  4650. test "x$ENABLED_OLD_TLS" = "xyes"],
  4651. [AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  4652. ENABLED_OLD_TLS=no])
  4653. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  4654. test "x$ENABLED_SSLV3" = "xyes"],
  4655. [AC_MSG_ERROR([Cannot use Max Strength and SSLv3 at the same time.])])
  4656. AS_IF([test "x$ENABLED_SCTP" = "xyes"],
  4657. [AM_CFLAGS="-DWOLFSSL_SCTP $AM_CFLAGS"])
  4658. AS_IF([test "x$ENABLED_MCAST" = "xyes"],
  4659. [AM_CFLAGS="-DWOLFSSL_MULTICAST $AM_CFLAGS"])
  4660. # WOLFSSL_AFALG does not support SHA224 yet
  4661. AS_IF([(test "x$ENABLED_AFALG" = "xyes") && (test "x$ENABLED_SHA224" = "xyes")],
  4662. [AC_MSG_ERROR([--enable-sha224 with --enable-afalg not yet supported])])
  4663. # WOLFSSL_DEVCRYPTO does not support SHA224 yet
  4664. AS_IF([(test "x$ENABLED_DEVCRYPTO" = "xyes") && (test "x$ENABLED_SHA224" = "xyes")],
  4665. [AC_MSG_ERROR([--enable-sha224 with --enable-devcrypto not yet supported])])
  4666. # SCTP and Multicast require DTLS
  4667. AS_IF([(test "x$ENABLED_DTLS" = "xno") && \
  4668. (test "x$ENABLED_SCTP" = "xyes" || test "x$ENABLED_MCAST" = "xyes")],
  4669. [AM_CFLAGS="-DWOLFSSL_DTLS $AM_CFLAGS"
  4670. ENABLED_DTLS=yes])
  4671. # Multicast requires the null cipher
  4672. AS_IF([test "x$ENABLED_NULL_CIPHER" = "xno" && \
  4673. test "x$ENABLED_MCAST" = "xyes"],
  4674. [AM_CFLAGS="-DHAVE_NULL_CIPHER $AM_CFLAGS"
  4675. ENABLED_NULL_CIPHER=yes])
  4676. # wolfSSH and WPA Supplicant both need Public MP, only enable once.
  4677. # This will let you know if you enabled wolfSSH but have any of the prereqs
  4678. # disabled. Some of these options, disabling them adds things to the FLAGS and
  4679. # you need to check and add items in two places depending on the option.
  4680. AS_IF([test "x$ENABLED_WOLFSSH" = "xyes"],[AS_IF([test "x$ENABLED_WPAS" = "xno"],[AM_CFLAGS="-DWOLFSSL_PUBLIC_MP $AM_CFLAGS"])])
  4681. if test "x$ENABLED_OPENSSLCOEXIST" = "xyes"; then
  4682. if test "x$ENABLED_OPENSSLALL" = "xyes"; then
  4683. AC_MSG_ERROR([Cannot use --enable-opensslcoexist with --enable-opensslall])
  4684. fi
  4685. if test "x$ENABLED_OPENSSLEXTRA" = "xyes"; then
  4686. AC_MSG_ERROR([Cannot use --enable-opensslcoexist with --enable-opensslextra])
  4687. fi
  4688. fi
  4689. ################################################################################
  4690. # USER SETTINGS
  4691. if test "x$ENABLED_USERSETTINGS" = "xyes"
  4692. then
  4693. # Replace all options and just use WOLFSSL_USER_SETTINGS
  4694. AM_CFLAGS="-DWOLFSSL_USER_SETTINGS"
  4695. fi
  4696. # OPTIMIZE FLAGS
  4697. # For distro disable custom build options that interfere with symbol generation
  4698. if test "$GCC" = "yes" && test "$ENABLED_DISTRO" = "no"
  4699. then
  4700. AM_CFLAGS="$AM_CFLAGS -Wall -Wno-unused"
  4701. if test "$ax_enable_debug" = "no"
  4702. then
  4703. AS_IF([test "x$ENABLED_OPTFLAGS" = "xyes"], [
  4704. if test "$ENABLED_FASTMATH" = "yes"
  4705. then
  4706. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  4707. if test "$ENABLED_FASTHUGEMATH" = "yes"
  4708. then
  4709. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  4710. fi
  4711. else
  4712. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_CFLAGS"
  4713. fi
  4714. ])
  4715. fi
  4716. fi
  4717. # ICC command line warning for non supported warning flags
  4718. if test "$CC" = "icc"
  4719. then
  4720. AM_CFLAGS="$AM_CFLAGS -wd10006"
  4721. fi
  4722. # Expose HAVE___UINT128_T to options flags"
  4723. if test "$ac_cv_type___uint128_t" = "yes"
  4724. then
  4725. AM_CFLAGS="$AM_CFLAGS -DHAVE___UINT128_T=1"
  4726. fi
  4727. LIB_SOCKET_NSL
  4728. AX_HARDEN_CC_COMPILER_FLAGS
  4729. # if mingw then link to ws2_32 for sockets
  4730. case $host_os in
  4731. mingw*)
  4732. LDFLAGS="$LDFLAGS -lws2_32"
  4733. if test "$enable_shared" = "yes"
  4734. then
  4735. AC_DEFINE([WOLFSSL_DLL], [1], [Use __declspec(dllexport) when building library])
  4736. if test "$enable_static" = "yes"
  4737. then
  4738. MINGW_LIB_WARNING="yes"
  4739. fi
  4740. fi ;;
  4741. esac
  4742. if test "x$ENABLED_LINUXKM" = "xyes"; then
  4743. AX_SIMD_CC_COMPILER_FLAGS
  4744. AC_SUBST([CFLAGS_FPU_DISABLE])
  4745. AC_SUBST([CFLAGS_FPU_ENABLE])
  4746. AC_SUBST([CFLAGS_SIMD_DISABLE])
  4747. AC_SUBST([CFLAGS_SIMD_ENABLE])
  4748. AC_SUBST([CFLAGS_AUTO_VECTORIZE_DISABLE])
  4749. AC_SUBST([CFLAGS_AUTO_VECTORIZE_ENABLE])
  4750. AC_SUBST([ASFLAGS_FPU_DISABLE_SIMD_ENABLE])
  4751. AC_SUBST([ASFLAGS_FPU_ENABLE_SIMD_DISABLE])
  4752. AC_SUBST([ASFLAGS_FPUSIMD_DISABLE])
  4753. AC_SUBST([ASFLAGS_FPUSIMD_ENABLE])
  4754. if test "$ENABLED_FILESYSTEM" = "yes"; then
  4755. AC_MSG_ERROR([--enable-filesystem is incompatible with --enable-linuxkm.])
  4756. fi
  4757. if test "$ENABLED_AFALG" = "yes"; then
  4758. AC_MSG_ERROR([--enable-afalg is incompatible with --enable-linuxkm.])
  4759. fi
  4760. if test "$ENABLED_DEVCRYPTO" = "yes"; then
  4761. AC_MSG_ERROR([--enable-devcrypto is incompatible with --enable-linuxkm.])
  4762. fi
  4763. if test "$ENABLED_PKCS11" = "yes"; then
  4764. AC_MSG_ERROR([--enable-pkcs11 is incompatible with --enable-linuxkm.])
  4765. fi
  4766. if test "$ENABLED_JNI" = "yes"; then
  4767. AC_MSG_ERROR([--enable-jni is incompatible with --enable-linuxkm.])
  4768. fi
  4769. if test "$ENABLED_16BIT" = "yes"; then
  4770. AC_MSG_ERROR([--enable-16bit is incompatible with --enable-linuxkm.])
  4771. fi
  4772. if test "$ENABLED_SINGLETHREADED" = "yes"; then
  4773. AC_MSG_ERROR([--enable-singlethreaded is incompatible with --enable-linuxkm.])
  4774. fi
  4775. if test "$ENABLED_VALGRIND" = "yes"; then
  4776. AC_MSG_ERROR([--enable-valgrind is incompatible with --enable-linuxkm.])
  4777. fi
  4778. if test "$ENABLED_FASTMATH" = "yes"; then
  4779. AC_MSG_ERROR([--enable-fastmath is incompatible with --enable-linuxkm (exceeds stack limit).])
  4780. fi
  4781. if test "$ENABLED_FAST_RSA" = "yes"; then
  4782. AC_MSG_ERROR([--enable-fastrsa is incompatible with --enable-linuxkm.])
  4783. fi
  4784. if test "$ENABLED_LIBZ_RSA" = "yes"; then
  4785. AC_MSG_ERROR([--with-libz is incompatible with --enable-linuxkm.])
  4786. fi
  4787. if test "$ENABLED_IOPOOL" = "yes"; then
  4788. AC_MSG_ERROR([--enable-iopool is incompatible with --enable-linuxkm.])
  4789. fi
  4790. #FIPS currently depends on thread-local storage
  4791. if test "$ENABLED_FIPS" = "yes"; then
  4792. AC_MSG_ERROR([--enable-fips is incompatible with --enable-linuxkm.])
  4793. fi
  4794. if test "$ENABLED_EXAMPLES" = "yes"; then
  4795. AC_MSG_ERROR([--enable-examples is incompatible with --enable-linuxkm.])
  4796. fi
  4797. if test "$ENABLED_SMALL_STACK" != "yes"; then
  4798. AC_MSG_ERROR([--enable-smallstack is required for --enable-linuxkm.])
  4799. fi
  4800. if test "$ENABLED_SP_MATH" = "no"; then
  4801. AC_MSG_ERROR([--enable-sp-math is required for --enable-linuxkm.])
  4802. fi
  4803. if test "$ENABLED_STACKSIZE" = "yes"; then
  4804. AC_MSG_ERROR([--enable-stacksize is incompatible with --enable-linuxkm.])
  4805. fi
  4806. if test "$ENABLED_STACKLOG" = "yes"; then
  4807. AC_MSG_ERROR([--enable-stacklog is incompatible with --enable-linuxkm.])
  4808. fi
  4809. if test "$ENABLED_COMPKEY" = "yes"; then
  4810. AC_MSG_ERROR([--enable-compkey is incompatible with --enable-linuxkm.])
  4811. fi
  4812. fi
  4813. # The following AM_CONDITIONAL statements set flags for use in the Makefiles.
  4814. # Some of these affect build targets and objects, some trigger different
  4815. # test scripts for make check.
  4816. AM_CONDITIONAL([BUILD_DISTRO],[test "x$ENABLED_DISTRO" = "xyes"])
  4817. AM_CONDITIONAL([BUILD_ALL],[test "x$ENABLED_ALL" = "xyes"])
  4818. AM_CONDITIONAL([BUILD_TLS13],[test "x$ENABLED_TLS13" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4819. AM_CONDITIONAL([BUILD_RNG],[test "x$ENABLED_RNG" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4820. AM_CONDITIONAL([BUILD_SCTP],[test "x$ENABLED_SCTP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4821. AM_CONDITIONAL([BUILD_MCAST],[test "x$ENABLED_MCAST" = "xyes"])
  4822. AM_CONDITIONAL([BUILD_IPV6],[test "x$ENABLED_IPV6" = "xyes"])
  4823. AM_CONDITIONAL([BUILD_LEANPSK],[test "x$ENABLED_LEANPSK" = "xyes"])
  4824. AM_CONDITIONAL([BUILD_LEANTLS],[test "x$ENABLED_LEANTLS" = "xyes"])
  4825. AM_CONDITIONAL([BUILD_LOWMEM],[test "x$ENABLED_LOWRESOURCE" = "xyes"])
  4826. AM_CONDITIONAL([BUILD_PKCALLBACKS], [ test "x$ENABLED_PKCALLBACKS" = "xyes"])
  4827. AM_CONDITIONAL([BUILD_CRYPTOAUTHLIB],[test "x$ENABLED_CRYPTOAUTHLIB" = "xyes"])
  4828. AM_CONDITIONAL([BUILD_SNIFFER], [ test "x$ENABLED_SNIFFER" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4829. AM_CONDITIONAL([BUILD_SNIFFTEST],[ test "x$ENABLED_SNIFFTEST" = "xyes"])
  4830. AM_CONDITIONAL([BUILD_AESGCM],[test "x$ENABLED_AESGCM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4831. AM_CONDITIONAL([BUILD_AESCCM],[test "x$ENABLED_AESCCM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4832. AM_CONDITIONAL([BUILD_ARMASM],[test "x$ENABLED_ARMASM" = "xyes"])
  4833. AM_CONDITIONAL([BUILD_XILINX],[test "x$ENABLED_XILINX" = "xyes"])
  4834. AM_CONDITIONAL([BUILD_AESNI],[test "x$ENABLED_AESNI" = "xyes"])
  4835. AM_CONDITIONAL([BUILD_INTELASM],[test "x$ENABLED_INTELASM" = "xyes"])
  4836. AM_CONDITIONAL([BUILD_AFALG],[test "x$ENABLED_AFALG" = "xyes"])
  4837. AM_CONDITIONAL([BUILD_DEVCRYPTO],[test "x$ENABLED_DEVCRYPTO" = "xyes"])
  4838. AM_CONDITIONAL([BUILD_CAMELLIA],[test "x$ENABLED_CAMELLIA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4839. AM_CONDITIONAL([BUILD_MD2],[test "x$ENABLED_MD2" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4840. AM_CONDITIONAL([BUILD_RIPEMD],[test "x$ENABLED_RIPEMD" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4841. AM_CONDITIONAL([BUILD_BLAKE2],[test "x$ENABLED_BLAKE2" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4842. AM_CONDITIONAL([BUILD_BLAKE2S],[test "x$ENABLED_BLAKE2S" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4843. AM_CONDITIONAL([BUILD_SHA512],[test "x$ENABLED_SHA512" = "xyes" || test "x$ENABLED_SHA384" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4844. AM_CONDITIONAL([BUILD_DSA],[test "x$ENABLED_DSA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4845. AM_CONDITIONAL([BUILD_ECC],[test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4846. AM_CONDITIONAL([BUILD_ED25519],[test "x$ENABLED_ED25519" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4847. AM_CONDITIONAL([BUILD_ED25519_SMALL],[test "x$ENABLED_ED25519_SMALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4848. AM_CONDITIONAL([BUILD_FEMATH], [test "x$ENABLED_FEMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4849. AM_CONDITIONAL([BUILD_GEMATH], [test "x$ENABLED_GEMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4850. AM_CONDITIONAL([BUILD_CURVE25519],[test "x$ENABLED_CURVE25519" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4851. AM_CONDITIONAL([BUILD_CURVE25519_SMALL],[test "x$ENABLED_CURVE25519_SMALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4852. AM_CONDITIONAL([BUILD_ED448],[test "x$ENABLED_ED448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4853. AM_CONDITIONAL([BUILD_ED448_SMALL],[test "x$ENABLED_ED448_SMALL" = "xyes"])
  4854. AM_CONDITIONAL([BUILD_FE448], [test "x$ENABLED_FE448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4855. AM_CONDITIONAL([BUILD_GE448], [test "x$ENABLED_GE448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4856. AM_CONDITIONAL([BUILD_CURVE448],[test "x$ENABLED_CURVE448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4857. AM_CONDITIONAL([BUILD_CURVE448_SMALL],[test "x$ENABLED_CURVE448_SMALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4858. AM_CONDITIONAL([BUILD_MEMORY],[test "x$ENABLED_MEMORY" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4859. AM_CONDITIONAL([BUILD_RSA],[test "x$ENABLED_RSA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4860. AM_CONDITIONAL([BUILD_DH],[test "x$ENABLED_DH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4861. AM_CONDITIONAL([BUILD_ASN],[test "x$ENABLED_ASN" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4862. AM_CONDITIONAL([BUILD_AES],[test "x$ENABLED_AES" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4863. AM_CONDITIONAL([BUILD_CODING],[test "x$ENABLED_CODING" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4864. AM_CONDITIONAL([BUILD_IDEA],[test "x$ENABLED_IDEA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4865. AM_CONDITIONAL([BUILD_RC4],[test "x$ENABLED_ARC4" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4866. AM_CONDITIONAL([BUILD_MD5],[test "x$ENABLED_MD5" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4867. AM_CONDITIONAL([BUILD_SHA],[test "x$ENABLED_SHA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4868. AM_CONDITIONAL([BUILD_HC128],[test "x$ENABLED_HC128" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4869. AM_CONDITIONAL([BUILD_RABBIT],[test "x$ENABLED_RABBIT" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4870. AM_CONDITIONAL([BUILD_FIPS],[test "x$ENABLED_FIPS" = "xyes"])
  4871. AM_CONDITIONAL([BUILD_FIPS_V1],[test "x$FIPS_VERSION" = "xv1"])
  4872. AM_CONDITIONAL([BUILD_FIPS_V2],[test "x$FIPS_VERSION" = "xv2"])
  4873. AM_CONDITIONAL([BUILD_FIPS_RAND],[test "x$FIPS_VERSION" = "xrand"])
  4874. AM_CONDITIONAL([BUILD_FIPS_READY],[test "x$FIPS_READY" = "xyes"])
  4875. AM_CONDITIONAL([BUILD_CMAC],[test "x$ENABLED_CMAC" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4876. AM_CONDITIONAL([BUILD_SELFTEST],[test "x$ENABLED_SELFTEST" = "xyes"])
  4877. AM_CONDITIONAL([BUILD_SHA224],[test "x$ENABLED_SHA224" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4878. AM_CONDITIONAL([BUILD_SHA3],[test "x$ENABLED_SHA3" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4879. AM_CONDITIONAL([BUILD_POLY1305],[test "x$ENABLED_POLY1305" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4880. AM_CONDITIONAL([BUILD_CHACHA],[test "x$ENABLED_CHACHA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4881. AM_CONDITIONAL([BUILD_XCHACHA],[test "x$ENABLED_XCHACHA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4882. AM_CONDITIONAL([BUILD_INLINE],[test "x$ENABLED_INLINE" = "xyes"])
  4883. AM_CONDITIONAL([BUILD_OCSP],[test "x$ENABLED_OCSP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4884. AM_CONDITIONAL([BUILD_OCSP_STAPLING],[test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"])
  4885. AM_CONDITIONAL([BUILD_OCSP_STAPLING_V2],[test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"])
  4886. AM_CONDITIONAL([BUILD_CRL],[test "x$ENABLED_CRL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4887. AM_CONDITIONAL([BUILD_CRL_MONITOR],[test "x$ENABLED_CRL_MONITOR" = "xyes"])
  4888. AM_CONDITIONAL([BUILD_USER_RSA],[test "x$ENABLED_USER_RSA" = "xyes"] )
  4889. AM_CONDITIONAL([BUILD_USER_CRYPTO],[test "x$ENABLED_USER_CRYPTO" = "xyes"])
  4890. AM_CONDITIONAL([BUILD_NTRU],[test "x$ENABLED_NTRU" = "xyes"])
  4891. AM_CONDITIONAL([BUILD_WNR],[test "x$ENABLED_WNR" = "xyes"])
  4892. AM_CONDITIONAL([BUILD_SRP],[test "x$ENABLED_SRP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4893. AM_CONDITIONAL([USE_VALGRIND],[test "x$ENABLED_VALGRIND" = "xyes"])
  4894. AM_CONDITIONAL([BUILD_MD4],[test "x$ENABLED_MD4" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4895. AM_CONDITIONAL([BUILD_PWDBASED],[test "x$ENABLED_PWDBASED" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4896. AM_CONDITIONAL([BUILD_SCRYPT],[test "x$ENABLED_SCRYPT" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4897. AM_CONDITIONAL([BUILD_CRYPTONLY],[test "x$ENABLED_CRYPTONLY" = "xyes" && test "x$ENABLED_OPENSSLEXTRA" = "xno"])
  4898. AM_CONDITIONAL([BUILD_FASTMATH],[test "x$ENABLED_FASTMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4899. AM_CONDITIONAL([BUILD_SLOWMATH],[test "x$ENABLED_SLOWMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4900. AM_CONDITIONAL([BUILD_EXAMPLE_SERVERS],[test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  4901. AM_CONDITIONAL([BUILD_EXAMPLE_CLIENTS],[test "x$ENABLED_EXAMPLES" = "xyes"])
  4902. AM_CONDITIONAL([BUILD_TESTS],[test "x$ENABLED_EXAMPLES" = "xyes"])
  4903. AM_CONDITIONAL([BUILD_THREADED_EXAMPLES],[test "x$ENABLED_SINGLETHREADED" = "xno" && test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  4904. AM_CONDITIONAL([BUILD_WOLFCRYPT_TESTS],[test "x$ENABLED_CRYPT_TESTS" = "xyes"])
  4905. AM_CONDITIONAL([BUILD_LIBZ],[test "x$ENABLED_LIBZ" = "xyes"])
  4906. AM_CONDITIONAL([BUILD_PKCS11],[test "x$ENABLED_PKCS11" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4907. AM_CONDITIONAL([BUILD_PKCS12],[test "x$ENABLED_PKCS12" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4908. AM_CONDITIONAL([BUILD_CAVIUM],[test "x$ENABLED_CAVIUM" = "xyes"])
  4909. AM_CONDITIONAL([BUILD_CAVIUM_V],[test "x$ENABLED_CAVIUM_V" = "xyes"])
  4910. AM_CONDITIONAL([BUILD_OCTEON_SYNC],[test "x$ENABLED_OCTEON_SYNC" = "xyes"])
  4911. AM_CONDITIONAL([BUILD_INTEL_QA],[test "x$ENABLED_INTEL_QA" = "xyes"])
  4912. AM_CONDITIONAL([BUILD_INTEL_QA_SYNC],[test "x$ENABLED_INTEL_QA_SYNC" = "xyes"])
  4913. AM_CONDITIONAL([BUILD_SP],[test "x$ENABLED_SP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4914. AM_CONDITIONAL([BUILD_SP_C],[(test "x$ENABLED_SP" = "xyes" && test "x$ENABLED_SP_ASM" = "xno") || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4915. AM_CONDITIONAL([BUILD_SP_ARM64],[test "x$ENABLED_SP_ARM64_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4916. AM_CONDITIONAL([BUILD_SP_ARM32],[test "x$ENABLED_SP_ARM32_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4917. AM_CONDITIONAL([BUILD_SP_ARM_THUMB],[test "x$ENABLED_SP_ARM_THUMB_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4918. AM_CONDITIONAL([BUILD_SP_ARM_CORTEX],[test "x$ENABLED_SP_ARM_CORTEX_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4919. AM_CONDITIONAL([BUILD_SP_X86_64],[test "x$ENABLED_SP_X86_64_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4920. AM_CONDITIONAL([BUILD_SP_INT],[test "x$ENABLED_SP_MATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4921. AM_CONDITIONAL([BUILD_FAST_RSA],[test "x$ENABLED_FAST_RSA" = "xyes"])
  4922. AM_CONDITIONAL([BUILD_MCAPI],[test "x$ENABLED_MCAPI" = "xyes"])
  4923. AM_CONDITIONAL([BUILD_ASYNCCRYPT],[test "x$ENABLED_ASYNCCRYPT" = "xyes"])
  4924. AM_CONDITIONAL([BUILD_WOLFEVENT],[test "x$ENABLED_ASYNCCRYPT" = "xyes"])
  4925. AM_CONDITIONAL([BUILD_CRYPTOCB],[test "x$ENABLED_CRYPTOCB" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4926. AM_CONDITIONAL([BUILD_PSK],[test "x$ENABLED_PSK" = "xyes"])
  4927. AM_CONDITIONAL([BUILD_TRUST_PEER_CERT],[test "x$ENABLED_TRUSTED_PEER_CERT" = "xyes"])
  4928. AM_CONDITIONAL([BUILD_PKI],[test "x$ENABLED_PKI" = "xyes"])
  4929. AM_CONDITIONAL([BUILD_DES3],[test "x$ENABLED_DES3" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4930. AM_CONDITIONAL([BUILD_PKCS7],[test "x$ENABLED_PKCS7" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  4931. AM_CONDITIONAL([BUILD_HASHFLAGS],[test "x$ENABLED_HASHFLAGS" = "xyes"])
  4932. AM_CONDITIONAL([BUILD_LINUXKM],[test "$ENABLED_LINUXKM" = "yes"])
  4933. AM_CONDITIONAL([BUILD_NO_LIBRARY],[test "$ENABLED_NO_LIBRARY" = "yes"])
  4934. AM_CONDITIONAL([BUILD_RC2],[test "x$ENABLED_RC2" = "xyes"])
  4935. if test "$ax_enable_debug" = "yes" ||
  4936. test "$ENABLED_STACKSIZE" = "yes" ||
  4937. (test "$ENABLED_LEANTLS" = "no" &&
  4938. test "$ENABLED_LEANPSK" = "no" &&
  4939. test "$ENABLED_LOWRESOURCE" = "no")
  4940. then
  4941. AM_CFLAGS="$AM_CFLAGS -DHAVE_WC_INTROSPECTION"
  4942. fi
  4943. CREATE_HEX_VERSION
  4944. AC_SUBST([AM_CPPFLAGS])
  4945. AC_SUBST([AM_CFLAGS])
  4946. AC_SUBST([AM_LDFLAGS])
  4947. AC_SUBST([AM_CCASFLAGS])
  4948. AC_SUBST([LIB_ADD])
  4949. AC_SUBST([LIB_STATIC_ADD])
  4950. # FINAL
  4951. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  4952. AC_CONFIG_FILES([Makefile wolfssl/version.h wolfssl/options.h cyassl/options.h support/wolfssl.pc rpm/spec])
  4953. AX_CREATE_GENERIC_CONFIG
  4954. AX_AM_JOBSERVER([yes])
  4955. AC_OUTPUT
  4956. # force make clean
  4957. echo "---"
  4958. echo "Running make clean..."
  4959. make clean >/dev/null 2>&1
  4960. # generate user options header
  4961. echo "---"
  4962. echo "Generating user options header..."
  4963. OPTION_FILE="wolfssl/options.h"
  4964. rm -f $OPTION_FILE
  4965. echo "/* wolfssl options.h" > $OPTION_FILE
  4966. echo " * generated from configure options" >> $OPTION_FILE
  4967. echo " *" >> $OPTION_FILE
  4968. echo " * Copyright (C) 2006-2020 wolfSSL Inc." >> $OPTION_FILE
  4969. echo " *" >> $OPTION_FILE
  4970. echo " * This file is part of wolfSSL. (formerly known as CyaSSL)" >> $OPTION_FILE
  4971. echo " *" >> $OPTION_FILE
  4972. echo " */" >> $OPTION_FILE
  4973. echo "" >> $OPTION_FILE
  4974. echo "#ifndef WOLFSSL_OPTIONS_H" >> $OPTION_FILE
  4975. echo "#define WOLFSSL_OPTIONS_H" >> $OPTION_FILE
  4976. echo "" >> $OPTION_FILE
  4977. echo "" >> $OPTION_FILE
  4978. echo "#ifdef __cplusplus" >> $OPTION_FILE
  4979. echo "extern \"C\" {" >> $OPTION_FILE
  4980. echo "#endif" >> $OPTION_FILE
  4981. echo "" >> $OPTION_FILE
  4982. for option in $CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS; do
  4983. defonly=`echo $option | sed 's/^-D//'`
  4984. if test "$defonly" != "$option"
  4985. then
  4986. noequalsign=`echo $defonly | sed 's/=/ /'`
  4987. if test "$noequalsign" = "NDEBUG" || test "$noequalsign" = "DEBUG"
  4988. then
  4989. echo "not outputting (N)DEBUG to $OPTION_FILE"
  4990. continue
  4991. fi
  4992. # allow user to ignore system options
  4993. ignoresys=$(echo "$noequalsign" | grep '^_.*')
  4994. if test -n "$ignoresys"
  4995. then
  4996. echo "#ifndef WOLFSSL_OPTIONS_IGNORE_SYS" >> $OPTION_FILE
  4997. fi
  4998. noarg=`echo $defonly | sed 's/=.*//'`
  4999. echo "#undef $noarg" >> $OPTION_FILE
  5000. echo "#define $noequalsign" >> $OPTION_FILE
  5001. if test -n "$ignoresys"
  5002. then
  5003. echo "#endif" >> $OPTION_FILE
  5004. fi
  5005. echo "" >> $OPTION_FILE
  5006. else
  5007. echo "option w/o begin -D is $option, not saving to $OPTION_FILE"
  5008. fi
  5009. done
  5010. echo "" >> $OPTION_FILE
  5011. echo "#ifdef __cplusplus" >> $OPTION_FILE
  5012. echo "}" >> $OPTION_FILE
  5013. echo "#endif" >> $OPTION_FILE
  5014. echo "" >> $OPTION_FILE
  5015. echo "" >> $OPTION_FILE
  5016. echo "#endif /* WOLFSSL_OPTIONS_H */" >> $OPTION_FILE
  5017. echo "" >> $OPTION_FILE
  5018. echo
  5019. #backwards compatibility for those who have included options or version
  5020. touch cyassl/options.h
  5021. echo "/* cyassl options.h" > cyassl/options.h
  5022. echo " * generated from wolfssl/options.h" >> cyassl/options.h
  5023. echo " */" >> cyassl/options.h
  5024. echo ""
  5025. while read -r line
  5026. do
  5027. echo "$line" >> cyassl/options.h
  5028. done < $OPTION_FILE
  5029. # switch ifdef protection in cyassl/option.h to CYASSL_OPTONS_H, remove bak
  5030. sed -i.bak 's/WOLFSSL_OPTIONS_H/CYASSL_OPTIONS_H/g' cyassl/options.h
  5031. # workaround for mingw sed that may get "Permission denied" trying to preserver permissions
  5032. case $host_os in
  5033. mingw*)
  5034. chmod u+w cyassl/options.h ;;
  5035. esac
  5036. rm cyassl/options.h.bak
  5037. # output config summary
  5038. echo "---"
  5039. echo "Configuration summary for $PACKAGE_NAME version $VERSION"
  5040. echo ""
  5041. echo " * Installation prefix: $prefix"
  5042. echo " * System type: $host_vendor-$host_os"
  5043. echo " * Host CPU: $host_cpu"
  5044. echo " * C Compiler: $CC"
  5045. echo " * C Flags: $CFLAGS"
  5046. echo " * C++ Compiler: $CXX"
  5047. echo " * C++ Flags: $CXXFLAGS"
  5048. echo " * CPP Flags: $CPPFLAGS"
  5049. echo " * CCAS Flags: $CCASFLAGS"
  5050. echo " * LIB Flags: $LIB"
  5051. test "$ENABLED_LINUXKM" = "yes" && \
  5052. echo " * Linux Kernel Build Root: $KERNEL_ROOT" && \
  5053. echo " * Linux Kernel Build Arch: $KERNEL_ARCH" && \
  5054. echo " * fpu disable C flags: $CFLAGS_FPU_DISABLE" && \
  5055. echo " * fpu enable C flags: $CFLAGS_FPU_ENABLE" && \
  5056. echo " * SIMD disable C flags: $CFLAGS_SIMD_DISABLE" && \
  5057. echo " * SIMD enable C flags: $CFLAGS_SIMD_ENABLE" && \
  5058. echo " * No-auto-vectorize C flags: $CFLAGS_AUTO_VECTORIZE_DISABLE" && \
  5059. echo " * Auto-vectorize C flags: $CFLAGS_AUTO_VECTORIZE_ENABLE" && \
  5060. echo " * SIMD enable as flags: $ASFLAGS_FPU_DISABLE_SIMD_ENABLE" && \
  5061. echo " * FPU enable as flags: $ASFLAGS_FPU_ENABLE_SIMD_DISABLE" && \
  5062. echo " * SIMD+FPU disable as flags: $ASFLAGS_FPUSIMD_DISABLE" && \
  5063. echo " * SIMD+FPU enable as flags: $ASFLAGS_FPUSIMD_ENABLE"
  5064. echo " * Debug enabled: $ax_enable_debug"
  5065. echo " * Coverage enabled: $ax_enable_coverage"
  5066. echo " * Warnings as failure: $ac_cv_warnings_as_errors"
  5067. echo " * make -j: $enable_jobserver"
  5068. echo " * VCS checkout: $ac_cv_vcs_checkout"
  5069. echo
  5070. echo " Features "
  5071. echo " * Single threaded: $ENABLED_SINGLETHREADED"
  5072. echo " * Filesystem: $ENABLED_FILESYSTEM"
  5073. echo " * OpenSSH Build: $ENABLED_OPENSSH"
  5074. echo " * OpenSSL Extra API: $ENABLED_OPENSSLEXTRA"
  5075. echo " * OpenSSL Coexist: $ENABLED_OPENSSLCOEXIST"
  5076. echo " * Old Names: $ENABLED_OLDNAMES"
  5077. echo " * Max Strength Build: $ENABLED_MAXSTRENGTH"
  5078. echo " * Distro Build: $ENABLED_DISTRO"
  5079. echo " * fastmath: $ENABLED_FASTMATH"
  5080. echo " * Assembly Allowed: $ENABLED_ASM"
  5081. echo " * sniffer: $ENABLED_SNIFFER"
  5082. echo " * snifftest: $ENABLED_SNIFFTEST"
  5083. echo " * ARC4: $ENABLED_ARC4"
  5084. echo " * AES: $ENABLED_AES"
  5085. echo " * AES-NI: $ENABLED_AESNI"
  5086. echo " * AES-CBC: $ENABLED_AESCBC"
  5087. echo " * AES-GCM: $ENABLED_AESGCM"
  5088. echo " * AES-CCM: $ENABLED_AESCCM"
  5089. echo " * AES-CTR: $ENABLED_AESCTR"
  5090. echo " * DES3: $ENABLED_DES3"
  5091. echo " * IDEA: $ENABLED_IDEA"
  5092. echo " * Camellia: $ENABLED_CAMELLIA"
  5093. echo " * NULL Cipher: $ENABLED_NULL_CIPHER"
  5094. echo " * MD2: $ENABLED_MD2"
  5095. echo " * MD4: $ENABLED_MD4"
  5096. echo " * MD5: $ENABLED_MD5"
  5097. echo " * RIPEMD: $ENABLED_RIPEMD"
  5098. echo " * SHA: $ENABLED_SHA"
  5099. echo " * SHA-224: $ENABLED_SHA224"
  5100. echo " * SHA-384: $ENABLED_SHA384"
  5101. echo " * SHA-512: $ENABLED_SHA512"
  5102. echo " * SHA3: $ENABLED_SHA3"
  5103. echo " * SHAKE256: $ENABLED_SHAKE256"
  5104. echo " * BLAKE2: $ENABLED_BLAKE2"
  5105. echo " * BLAKE2S: $ENABLED_BLAKE2S"
  5106. echo " * CMAC: $ENABLED_CMAC"
  5107. echo " * keygen: $ENABLED_KEYGEN"
  5108. echo " * certgen: $ENABLED_CERTGEN"
  5109. echo " * certreq: $ENABLED_CERTREQ"
  5110. echo " * certext: $ENABLED_CERTEXT"
  5111. echo " * certgencache: $ENABLED_certgencache"
  5112. echo " * HC-128: $ENABLED_HC128"
  5113. echo " * RABBIT: $ENABLED_RABBIT"
  5114. echo " * CHACHA: $ENABLED_CHACHA"
  5115. echo " * XCHACHA: $ENABLED_XCHACHA"
  5116. echo " * Hash DRBG: $ENABLED_HASHDRBG"
  5117. echo " * PWDBASED: $ENABLED_PWDBASED"
  5118. echo " * scrypt: $ENABLED_SCRYPT"
  5119. echo " * wolfCrypt Only: $ENABLED_CRYPTONLY"
  5120. echo " * HKDF: $ENABLED_HKDF"
  5121. echo " * X9.63 KDF: $ENABLED_X963KDF"
  5122. echo " * MD4: $ENABLED_MD4"
  5123. echo " * PSK: $ENABLED_PSK"
  5124. echo " * Poly1305: $ENABLED_POLY1305"
  5125. echo " * LEANPSK: $ENABLED_LEANPSK"
  5126. echo " * LEANTLS: $ENABLED_LEANTLS"
  5127. echo " * RSA: $ENABLED_RSA"
  5128. echo " * RSA-PSS: $ENABLED_RSAPSS"
  5129. echo " * DSA: $ENABLED_DSA"
  5130. echo " * DH: $ENABLED_DH"
  5131. echo " * DH Default Parameters: $ENABLED_DHDEFAULTPARAMS"
  5132. echo " * ECC: $ENABLED_ECC"
  5133. echo " * ECC Custom Curves $ENABLED_ECCCUSTCURVES"
  5134. echo " * CURVE25519: $ENABLED_CURVE25519"
  5135. echo " * ED25519: $ENABLED_ED25519"
  5136. echo " * CURVE448: $ENABLED_CURVE448"
  5137. echo " * ED448: $ENABLED_ED448"
  5138. echo " * FPECC: $ENABLED_FPECC"
  5139. echo " * ECC_ENCRYPT: $ENABLED_ECC_ENCRYPT"
  5140. echo " * ASN: $ENABLED_ASN"
  5141. echo " * Anonymous cipher: $ENABLED_ANON"
  5142. echo " * CODING: $ENABLED_CODING"
  5143. echo " * MEMORY: $ENABLED_MEMORY"
  5144. echo " * I/O POOL: $ENABLED_IOPOOL"
  5145. echo " * LIGHTY: $ENABLED_LIGHTY"
  5146. echo " * HAPROXY: $ENABLED_HAPROXY"
  5147. echo " * STUNNEL: $ENABLED_STUNNEL"
  5148. echo " * Apache httpd: $ENABLED_APACHE_HTTPD"
  5149. echo " * NGINX: $ENABLED_NGINX"
  5150. echo " * ASIO: $ENABLED_ASIO"
  5151. echo " * LIBWEBSOCKETS: $ENABLED_LIBWEBSOCKETS"
  5152. echo " * Qt $ENABLED_QT"
  5153. echo " * Qt Unit Testing $ENABLED_QT_TEST"
  5154. echo " * SIGNAL: $ENABLED_SIGNAL"
  5155. echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
  5156. echo " * DTLS: $ENABLED_DTLS"
  5157. echo " * SCTP: $ENABLED_SCTP"
  5158. echo " * Indefinite Length: $ENABLED_BER_INDEF"
  5159. echo " * Multicast: $ENABLED_MCAST"
  5160. echo " * SSL v3.0 (Old): $ENABLED_SSLV3"
  5161. echo " * TLS v1.0 (Old): $ENABLED_TLSV10"
  5162. echo " * TLS v1.1 (Old): $ENABLED_OLD_TLS"
  5163. echo " * TLS v1.2: $ENABLED_TLSV12"
  5164. echo " * TLS v1.3: $ENABLED_TLS13"
  5165. echo " * Post-handshake Auth: $ENABLED_TLS13_POST_AUTH"
  5166. echo " * Early Data: $ENABLED_TLS13_EARLY_DATA"
  5167. echo " * Send State in HRR Cookie: $ENABLED_SEND_HRR_COOKIE"
  5168. echo " * OCSP: $ENABLED_OCSP"
  5169. echo " * OCSP Stapling: $ENABLED_CERTIFICATE_STATUS_REQUEST"
  5170. echo " * OCSP Stapling v2: $ENABLED_CERTIFICATE_STATUS_REQUEST_V2"
  5171. echo " * CRL: $ENABLED_CRL"
  5172. echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
  5173. echo " * Persistent session cache: $ENABLED_SAVESESSION"
  5174. echo " * Persistent cert cache: $ENABLED_SAVECERT"
  5175. echo " * Atomic User Record Layer: $ENABLED_ATOMICUSER"
  5176. echo " * Public Key Callbacks: $ENABLED_PKCALLBACKS"
  5177. echo " * NTRU: $ENABLED_NTRU"
  5178. echo " * QSH: $ENABLED_QSH"
  5179. echo " * Whitewood netRandom: $ENABLED_WNR"
  5180. echo " * Server Name Indication: $ENABLED_SNI"
  5181. echo " * ALPN: $ENABLED_ALPN"
  5182. echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
  5183. echo " * Trusted CA Indication: $ENABLED_TRUSTED_CA"
  5184. echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
  5185. echo " * Supported Elliptic Curves: $ENABLED_SUPPORTED_CURVES"
  5186. echo " * FFDHE only in client: $ENABLED_FFDHE_ONLY"
  5187. echo " * Session Ticket: $ENABLED_SESSION_TICKET"
  5188. echo " * Extended Master Secret: $ENABLED_EXTENDED_MASTER"
  5189. echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
  5190. echo " * Secure Renegotiation: $ENABLED_SECURE_RENEGOTIATION"
  5191. echo " * Fallback SCSV: $ENABLED_FALLBACK_SCSV"
  5192. echo " * All TLS Extensions: $ENABLED_TLSX"
  5193. echo " * PKCS#7 $ENABLED_PKCS7"
  5194. echo " * wolfSSH $ENABLED_WOLFSSH"
  5195. echo " * wolfSCEP $ENABLED_WOLFSCEP"
  5196. echo " * Secure Remote Password $ENABLED_SRP"
  5197. echo " * Small Stack: $ENABLED_SMALL_STACK"
  5198. echo " * Linux Kernel Module: $ENABLED_LINUXKM"
  5199. echo " * valgrind unit tests: $ENABLED_VALGRIND"
  5200. echo " * LIBZ: $ENABLED_LIBZ"
  5201. echo " * Examples: $ENABLED_EXAMPLES"
  5202. echo " * Crypt tests: $ENABLED_CRYPT_TESTS"
  5203. echo " * Stack sizes in tests: $ENABLED_STACKSIZE"
  5204. echo " * User Crypto: $ENABLED_USER_CRYPTO"
  5205. echo " * Fast RSA: $ENABLED_FAST_RSA"
  5206. echo " * Single Precision: $ENABLED_SP"
  5207. echo " * Async Crypto: $ENABLED_ASYNCCRYPT"
  5208. echo " * PKCS#11: $ENABLED_PKCS11"
  5209. echo " * PKCS#12: $ENABLED_PKCS12"
  5210. echo " * Cavium Nitox: $ENABLED_CAVIUM"
  5211. echo " * Cavium Octeon (Sync): $ENABLED_OCTEON_SYNC"
  5212. echo " * Intel Quick Assist: $ENABLED_INTEL_QA"
  5213. echo " * ARM ASM: $ENABLED_ARMASM"
  5214. echo " * AES Key Wrap: $ENABLED_AESKEYWRAP"
  5215. echo " * Write duplicate: $ENABLED_WRITEDUP"
  5216. echo " * Xilinx Hardware Acc.: $ENABLED_XILINX"
  5217. echo " * Inline Code: $ENABLED_INLINE"
  5218. echo " * Linux AF_ALG: $ENABLED_AFALG"
  5219. echo " * Linux devcrypto: $ENABLED_DEVCRYPTO"
  5220. echo " * Crypto callbacks: $ENABLED_CRYPTOCB"
  5221. echo ""
  5222. echo "---"
  5223. echo >> config.h
  5224. echo "#define LIBWOLFSSL_CONFIGURE_ARGS \"$ac_configure_args\"" >> config.h
  5225. echo >> config.h
  5226. echo "#define LIBWOLFSSL_GLOBAL_CFLAGS \"$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS\"" >> config.h
  5227. ################################################################################
  5228. # Show warnings at bottom so they are noticed
  5229. ################################################################################
  5230. if test "$ENABLED_ASYNCCRYPT" = "yes"
  5231. then
  5232. AC_MSG_WARN([Make sure real async files are loaded. Contact wolfSSL for details on using the asynccrypt option.])
  5233. fi
  5234. # MinGW static vs shared library
  5235. # Reference URL from libtool for MinGW is located at
  5236. # http://www.gnu.org/software/libtool/manual/libtool.html#Cygwin-to-MinGW-Cross
  5237. # this allows for not even having dllimport/dllexport on functions
  5238. # with recent libtools, only requiring it with global variables.
  5239. #
  5240. # The following warning is displayed here because if not using "contemporary GNU
  5241. # tools" there is the possibility of export/import issues.
  5242. # wolfSSL uses __declspec(dllexport) and "contemporary GNU tools" handle the
  5243. # case where both static and shared libraries are built.
  5244. #
  5245. # More can be found about the MinGW linker at
  5246. # https://sourceware.org/binutils/docs/ld/WIN32.html
  5247. if test "$MINGW_LIB_WARNING" = "yes"
  5248. then
  5249. 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.])
  5250. fi