1
0

configure.ac 244 KB

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