configure.ac 201 KB

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