configure.ac 328 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191
  1. # configure.ac
  2. #
  3. # Copyright (C) 2006-2024 wolfSSL Inc.
  4. #
  5. # This file is part of wolfSSL. (formerly known as CyaSSL)
  6. #
  7. #
  8. AC_COPYRIGHT([Copyright (C) 2006-2024 wolfSSL Inc.])
  9. AC_PREREQ([2.69])
  10. AC_INIT([wolfssl],[5.7.0],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[https://www.wolfssl.com])
  11. AC_CONFIG_AUX_DIR([build-aux])
  12. # The following sets CFLAGS to empty if unset on command line. We do not
  13. # want the default "-g -O2" that AC_PROG_CC sets automatically.
  14. : ${CFLAGS=""}
  15. # 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_CPPFLAGS, [Extra CPPFLAGS to add to end of autoconf-computed arg list. Can also supply directly to make.])
  31. AC_ARG_VAR(EXTRA_CFLAGS, [Extra CFLAGS to add to end of autoconf-computed arg list. Can also supply directly to make.])
  32. AC_ARG_VAR(EXTRA_CCASFLAGS, [Extra CCASFLAGS to add to end of autoconf-computed arg list. Can also supply directly to make.])
  33. AC_ARG_VAR(EXTRA_LDFLAGS, [Extra LDFLAGS to add to end of autoconf-computed arg list. Can also supply directly to make.])
  34. WOLFSSL_CONFIG_ARGS=$ac_configure_args
  35. AC_SUBST([WOLFSSL_CONFIG_ARGS])
  36. # shared library versioning
  37. # The three numbers in the libwolfssl.so.*.*.* file name. Unfortunately
  38. # increment if interfaces have been removed or changed
  39. WOLFSSL_LIBRARY_VERSION_FIRST=42
  40. # increment if interfaces have been added
  41. # set to zero if WOLFSSL_LIBRARY_VERSION_FIRST is incremented
  42. WOLFSSL_LIBRARY_VERSION_SECOND=1
  43. # increment if source code has changed
  44. # set to zero if WOLFSSL_LIBRARY_VERSION_FIRST is incremented or
  45. # WOLFSSL_LIBRARY_VERSION_SECOND is incremented
  46. WOLFSSL_LIBRARY_VERSION_THIRD=0
  47. WOLFSSL_LIBRARY_VERSION=${WOLFSSL_LIBRARY_VERSION_FIRST}:${WOLFSSL_LIBRARY_VERSION_SECOND}:${WOLFSSL_LIBRARY_VERSION_THIRD}
  48. AC_SUBST([WOLFSSL_LIBRARY_VERSION_FIRST])
  49. AC_SUBST([WOLFSSL_LIBRARY_VERSION_SECOND])
  50. AC_SUBST([WOLFSSL_LIBRARY_VERSION_THIRD])
  51. AC_SUBST([WOLFSSL_LIBRARY_VERSION])
  52. gl_VISIBILITY
  53. AS_IF([ test -n "$CFLAG_VISIBILITY" ], [
  54. AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
  55. ])
  56. WOLFSSL_BUILD_DATE=$(date -R)
  57. AC_SUBST([WOLFSSL_BUILD_DATE])
  58. # Moved these size of and type checks before the library checks.
  59. # The library checks add the library to subsequent test compiles
  60. # and in some rare cases, the networking check causes these sizeof
  61. # checks to fail.
  62. AC_CHECK_SIZEOF([long long])
  63. AC_CHECK_SIZEOF([long])
  64. AC_CHECK_SIZEOF([time_t])
  65. AC_CHECK_TYPES([__uint128_t])
  66. # Distro build feature subset (Debian, Ubuntu, etc.)
  67. AC_ARG_ENABLE([distro],
  68. [AS_HELP_STRING([--enable-distro],[Enable wolfSSL distro build (default: disabled)])],
  69. [ ENABLED_DISTRO=$enableval ],
  70. [ ENABLED_DISTRO=no ]
  71. )
  72. if test "$ENABLED_DISTRO" = "yes"
  73. then
  74. enable_shared=yes
  75. enable_static=yes
  76. enable_all=yes
  77. enable_earlydata=no
  78. REPRODUCIBLE_BUILD_DEFAULT=yes
  79. else
  80. REPRODUCIBLE_BUILD_DEFAULT=no
  81. fi
  82. # Fail when an option is passed that is not recognized
  83. m4_divert_once([DEFAULTS], [enable_option_checking=fatal])
  84. # Allow experimental settings
  85. AC_ARG_ENABLE([experimental],
  86. [AS_HELP_STRING([--enable-experimental],[Allow experimental settings in the configuration (default: disabled)])],
  87. [ ENABLED_EXPERIMENTAL=$enableval ],
  88. [ ENABLED_EXPERIMENTAL=no ]
  89. )
  90. if test "$ENABLED_EXPERIMENTAL" = "yes"
  91. then
  92. AS_IF([ test "$ENABLED_DISTRO" = "yes" && test "$ENABLED_EXPERIMENTAL" = "yes" ],[ AC_MSG_ERROR([--enable-distro and --enable-experimental are mutually exclusive.]) ])
  93. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_EXPERIMENTAL_SETTINGS"
  94. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_EXPERIMENTAL_SETTINGS"
  95. fi
  96. 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 sys/un.h])
  97. AC_CHECK_LIB([network],[socket])
  98. AC_C_BIGENDIAN
  99. AC_C___ATOMIC
  100. AC_CHECK_HEADER(stdatomic.h, [AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSL_HAVE_ATOMIC_H"],[])
  101. # check if functions of interest are linkable, but also check if
  102. # they're declared by the expected headers, and if not, supersede the
  103. # unusable positive from AC_CHECK_FUNCS().
  104. AC_CHECK_FUNCS([gethostbyname getaddrinfo gettimeofday gmtime_r gmtime_s inet_ntoa memset socket strftime atexit])
  105. AC_CHECK_DECLS([gethostbyname, getaddrinfo, gettimeofday, gmtime_r, gmtime_s, inet_ntoa, memset, socket, strftime, atexit], [], [
  106. if test "$(eval echo \$"$(eval 'echo ac_cv_func_${as_decl_name}')")" = "yes"
  107. then
  108. AC_MSG_NOTICE([ note: earlier check for $(eval 'echo ${as_decl_name}') superseded.])
  109. eval "ac_cv_func_${as_decl_name}=no"
  110. _mask_varname=HAVE_`eval "echo '${as_decl_name}'" | tr 'a-z' 'A-Z'`
  111. sed --in-place "s~^#define ${_mask_varname} 1$~~" confdefs.h
  112. fi
  113. ], [[
  114. #ifdef HAVE_SYS_SOCKET_H
  115. #include <sys/socket.h>
  116. #endif
  117. #ifdef HAVE_STRING_H
  118. #include <string.h>
  119. #endif
  120. #ifdef HAVE_NETDB_H
  121. #include <netdb.h>
  122. #endif
  123. #ifdef HAVE_ARPA_INET_H
  124. #include <arpa/inet.h>
  125. #endif
  126. #ifdef HAVE_SYS_TIME_H
  127. #include <sys/time.h>
  128. #endif
  129. #ifdef HAVE_TIME_H
  130. #include <time.h>
  131. #endif
  132. #ifdef HAVE_STDLIB_H
  133. #include <stdlib.h>
  134. #endif
  135. ]])
  136. AC_PROG_INSTALL
  137. AC_TYPE_SIZE_T
  138. AC_TYPE_UINT8_T
  139. AC_TYPE_UINTPTR_T
  140. AM_PROG_AS
  141. OPTIMIZE_CFLAGS="-Os"
  142. OPTIMIZE_FAST_CFLAGS="-O2"
  143. OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET"
  144. DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_WOLFSSL"
  145. LIB_ADD=
  146. LIB_STATIC_ADD=
  147. if test "$output_objdir" = ""
  148. then
  149. output_objdir=.
  150. fi
  151. # Thread local storage
  152. thread_ls_on="no"
  153. AC_ARG_ENABLE([threadlocal],
  154. [AS_HELP_STRING([--enable-threadlocal],[Enable thread local support (default: enabled)])],
  155. [ ENABLED_THREADLOCAL=$enableval ],
  156. [ ENABLED_THREADLOCAL=yes ]
  157. )
  158. if test "$ENABLED_THREADLOCAL" = "yes"
  159. then
  160. AX_TLS([thread_ls_on=yes],[thread_ls_on=no])
  161. AS_IF([test "x$thread_ls_on" = "xyes"],[AM_CFLAGS="$AM_CFLAGS -DHAVE_THREAD_LS"])
  162. fi
  163. # DEBUG
  164. AX_DEBUG
  165. AS_IF([test "$ax_enable_debug" = "yes"],
  166. [AM_CFLAGS="$AM_CFLAGS $DEBUG_CFLAGS"],
  167. [AM_CFLAGS="$AM_CFLAGS -DNDEBUG"])
  168. AS_IF([test "$ax_enable_debug" = "yes"],
  169. [AM_CCASFLAGS="$DEBUG_CFLAGS $AM_CCASFLAGS"],
  170. [AM_CCASFLAGS="$AM_CCASFLAGS -DNDEBUG"])
  171. AC_ARG_ENABLE([debug-trace-errcodes],
  172. [ AS_HELP_STRING([--enable-debug-trace-errcodes],[Print trace messages when library errors are thrown.]) ],
  173. [ ENABLED_DEBUG_TRACE_ERRCODES=$enableval ],
  174. [ ENABLED_DEBUG_TRACE_ERRCODES=no ]
  175. )
  176. if test "$ENABLED_DEBUG_TRACE_ERRCODES" = "yes"
  177. then
  178. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEBUG_TRACE_ERROR_CODES"
  179. fi
  180. # Start without certificates enabled and enable if a certificate algorithm is
  181. # enabled
  182. ENABLED_CERTS="no"
  183. # Implements requirements from RFC9325
  184. AC_ARG_ENABLE([harden-tls],
  185. [AS_HELP_STRING([--enable-harden-tls],[Enable requirements from RFC9325. Possible values are <yes>, <112>, or <128>. <yes> is equivalent to <112>. (default: disabled)])],
  186. [ ENABLED_HARDEN_TLS=$enableval ],
  187. [ ENABLED_HARDEN_TLS=no ]
  188. )
  189. if test "x$ENABLED_HARDEN_TLS" != "xno"
  190. then
  191. if test "x$ENABLED_HARDEN_TLS" = "xyes" || test "x$ENABLED_HARDEN_TLS" = "x112"
  192. then
  193. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HARDEN_TLS=112"
  194. elif test "x$ENABLED_HARDEN_TLS" = "x128"
  195. then
  196. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HARDEN_TLS=128"
  197. else
  198. AC_MSG_ERROR([Invalid value for --enable-harden-tls])
  199. fi
  200. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_EXTRA_ALERTS -DWOLFSSL_CHECK_ALERT_ON_ERR"
  201. fi
  202. # Support for forcing 32-bit mode
  203. # To force 32-bit instructions use:
  204. # ./configure CFLAGS="-m32" LDFLAGS="-m32" && make
  205. # 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.
  206. AC_ARG_ENABLE([32bit],
  207. [AS_HELP_STRING([--enable-32bit],[Enables 32-bit support (default: disabled)])],
  208. [ ENABLED_32BIT=$enableval ],
  209. [ ENABLED_32BIT=no ]
  210. )
  211. # 16-bit compiler support
  212. AC_ARG_ENABLE([16bit],
  213. [AS_HELP_STRING([--enable-16bit],[Enables 16-bit support (default: disabled)])],
  214. [ ENABLED_16BIT=$enableval ],
  215. [ ENABLED_16BIT=no ]
  216. )
  217. if test "$ENABLED_16BIT" = "yes"
  218. then
  219. AM_CFLAGS="$AM_CFLAGS -DWC_16BIT_CPU"
  220. fi
  221. AC_ARG_ENABLE([64bit],
  222. [AS_HELP_STRING([--enable-64bit],[Enables 64-bit support (default: disabled)])],
  223. [ ENABLED_64BIT=$enableval ],
  224. [ ENABLED_64BIT=no ]
  225. )
  226. AC_ARG_ENABLE([kdf],
  227. [AS_HELP_STRING([--enable-kdf],[Enables kdf support (default: enabled)])],
  228. [ ENABLED_KDF=$enableval ],
  229. [ ENABLED_KDF=yes ]
  230. )
  231. AC_ARG_ENABLE([hmac],
  232. [AS_HELP_STRING([--enable-hmac],[Enables HMAC support (default: enabled)])],
  233. [ ENABLED_HMAC=$enableval ],
  234. [ ENABLED_HMAC=yes ]
  235. )
  236. AC_ARG_ENABLE([do178],
  237. [AS_HELP_STRING([--enable-do178],[Enable DO-178, Will NOT work w/o DO178 license (default: disabled)])],
  238. [ENABLED_DO178=$enableval],
  239. [ENABLED_DO178="no"])
  240. if test "$ENABLED_DO178" = "no"
  241. then
  242. AM_CFLAGS="$AM_CFLAGS -DNO_DO178"
  243. else
  244. AM_CFLAGS="$AM_CFLAGS -DHAVE_DO178"
  245. fi
  246. # Support for disabling all ASM
  247. AC_ARG_ENABLE([asm],
  248. [AS_HELP_STRING([--enable-asm],[Enables option for assembly (default: enabled)])],
  249. [ ENABLED_ASM=$enableval ],
  250. [ ENABLED_ASM=yes ]
  251. )
  252. if test "$ENABLED_ASM" = "no"
  253. then
  254. AM_CFLAGS="$AM_CFLAGS -DTFM_NO_ASM -DWOLFSSL_NO_ASM"
  255. fi
  256. AC_SUBST([ENABLED_ASM])
  257. # Default math is SP Math all and not fast math
  258. # FIPS v1 and v2 must use fast math
  259. DEF_SP_MATH="yes"
  260. DEF_FAST_MATH="no"
  261. # FIPS 140
  262. AC_ARG_ENABLE([fips],
  263. [AS_HELP_STRING([--enable-fips],[Enable FIPS 140-2, Will NOT work w/o FIPS license (default: disabled)])],
  264. [ENABLED_FIPS=$enableval],
  265. [ENABLED_FIPS="no"])
  266. # wolfEngine Options
  267. AC_ARG_ENABLE([engine],
  268. [AS_HELP_STRING([--enable-engine],[Enable wolfEngine options (default: disabled)])],
  269. [ ENABLED_WOLFENGINE=$enableval ],
  270. [ ENABLED_WOLFENGINE=no ]
  271. )
  272. AS_CASE([$ENABLED_WOLFENGINE],
  273. [no],[
  274. ENABLED_WOLFENGINE="no"
  275. ],
  276. [disabled],[
  277. ENABLED_WOLFENGINE="no"
  278. ],
  279. [yes|fips-v2|cert3389],[
  280. ENABLED_WOLFENGINE="yes"
  281. ENABLED_FIPS="v2"
  282. ],
  283. [fips-v5],[
  284. ENABLED_WOLFENGINE="yes"
  285. ENABLED_FIPS="v5"
  286. ],
  287. [fips-v6],[
  288. ENABLED_WOLFENGINE="yes"
  289. ENABLED_FIPS="v6"
  290. ],
  291. [fips-ready],[
  292. ENABLED_WOLFENGINE="yes"
  293. ENABLED_FIPS="ready"
  294. ],
  295. [no-fips],[
  296. ENABLED_WOLFENGINE="yes"
  297. ENABLED_FIPS="no"
  298. ],
  299. [
  300. AC_MSG_ERROR([Invalid value for --enable-engine "$ENABLED_WOLFENGINE" (options: fips-v2, fips-ready, no-fips, no, disabled)])
  301. ])
  302. # The FIPS options are:
  303. # no - FIPS build disabled, FIPS sources forbidden in build tree
  304. # disabled - FIPS build disabled, FIPS sources ignored in build tree
  305. # v1 - FIPS 140-2 Cert 2425
  306. # default - same as v1
  307. # v2 - FIPS 140-2 Cert 3389
  308. # cert3389 - alias for v2
  309. # rand - wolfRand
  310. # v5-RC12 - FIPS 140-3, wolfCrypt/fips WCv5.0-RC12
  311. # v5 - currently, alias for v5-RC12
  312. # ready - FIPS 140-3 settings with in-tree wolfcrypt sources, feature locked
  313. # dev - FIPS 140-3 settings with in-tree wolfcrypt sources, features freely adjustable
  314. # v5-ready - Alias for ready.
  315. # v5-dev - Alias for dev.
  316. # v6 - The SRTP-KDF-full-submission
  317. #
  318. # These options have been retired, but are listed here for historical reference:
  319. # v5-RC8 - historical FIPS 140-3 (wolfCrypt WCv5.0-RC8).
  320. # HAVE_FIPS_VERSION = 5, HAVE_FIPS_VERSION_MINOR = 0.
  321. # v5-RC9 - historical FIPS 140-3 (wolfCrypt WCv5.0-RC9)
  322. # HAVE_FIPS_VERSION = 5, HAVE_FIPS_VERSION_MINOR = 1.
  323. # v5-RC10 - historical FIPS 140-3, wolfCrypt/fips WCv5.0-RC10
  324. # HAVE_FIPS_VERSION = 5, HAVE_FIPS_VERSION_MINOR = 2.
  325. # v5-RC11 - historical FIPS 140-3, wolfCrypt/fips WCv5.0-RC11
  326. # HAVE_FIPS_VERSION = 5, HAVE_FIPS_VERSION_MINOR = 2.
  327. AS_CASE([$ENABLED_FIPS],
  328. [no],[
  329. FIPS_VERSION="none"
  330. ],
  331. [disabled],[
  332. FIPS_VERSION="disabled"
  333. ENABLED_FIPS="no"
  334. ],
  335. [v1|yes|cert2425],[
  336. FIPS_VERSION="v1"
  337. HAVE_FIPS_VERSION_MAJOR=1
  338. ENABLED_FIPS="yes"
  339. DEF_SP_MATH="no"
  340. DEF_FAST_MATH="yes"
  341. ],
  342. [v2|cert3389],[
  343. FIPS_VERSION="v2"
  344. HAVE_FIPS_VERSION_MAJOR=2
  345. HAVE_FIPS_VERSION_MINOR=0
  346. ENABLED_FIPS="yes"
  347. DEF_SP_MATH="no"
  348. DEF_FAST_MATH="yes"
  349. ],
  350. [rand],[
  351. FIPS_VERSION="rand"
  352. HAVE_FIPS_VERSION_MAJOR=2
  353. HAVE_FIPS_VERSION_MINOR=1
  354. ENABLED_FIPS="yes"
  355. DEF_SP_MATH="no"
  356. DEF_FAST_MATH="no"
  357. ],
  358. [v5|v5-RC12],[
  359. FIPS_VERSION="v5-RC12"
  360. HAVE_FIPS_VERSION_MAJOR=5
  361. HAVE_FIPS_VERSION_MINOR=2
  362. ENABLED_FIPS="yes"
  363. DEF_SP_MATH="no"
  364. DEF_FAST_MATH="yes"
  365. ],
  366. [v5-ready],[
  367. FIPS_VERSION="v5-ready"
  368. HAVE_FIPS_VERSION_MAJOR=5
  369. HAVE_FIPS_VERSION_MINOR=3
  370. ENABLED_FIPS="yes"
  371. DEF_SP_MATH="no"
  372. DEF_FAST_MATH="yes"
  373. ],
  374. [v5-dev],[
  375. FIPS_VERSION="v5-dev"
  376. HAVE_FIPS_VERSION_MAJOR=5
  377. HAVE_FIPS_VERSION_MINOR=3
  378. ENABLED_FIPS="yes"
  379. # for dev, DEF_SP_MATH and DEF_FAST_MATH follow non-FIPS defaults (currently sp-math-all)
  380. ],
  381. [v6],[
  382. FIPS_VERSION="v6"
  383. HAVE_FIPS_VERSION=6
  384. HAVE_FIPS_VERSION_MAJOR=6
  385. HAVE_FIPS_VERSION_MINOR=0
  386. HAVE_FIPS_VERSION_PATCH=0
  387. ENABLED_FIPS="yes"
  388. DEF_SP_MATH="yes"
  389. DEF_FAST_MATH="no"
  390. ],
  391. # Should always remain one ahead of the latest so as not to be confused with
  392. # the latest
  393. [ready|v6-ready],[
  394. FIPS_VERSION="ready"
  395. HAVE_FIPS_VERSION=7
  396. HAVE_FIPS_VERSION_MAJOR=7
  397. HAVE_FIPS_VERSION_MINOR=0
  398. HAVE_FIPS_VERSION_PATCH=0
  399. ENABLED_FIPS="yes"
  400. DEF_SP_MATH="yes"
  401. DEF_FAST_MATH="no"
  402. ],
  403. [dev|v6-dev],[
  404. FIPS_VERSION="dev"
  405. HAVE_FIPS_VERSION_MAJOR=7
  406. HAVE_FIPS_VERSION_MINOR=0
  407. HAVE_FIPS_VERSION_PATCH=0
  408. ENABLED_FIPS="yes"
  409. # for dev, DEF_SP_MATH and DEF_FAST_MATH follow non-FIPS defaults (currently sp-math-all)
  410. ],
  411. [
  412. AC_MSG_ERROR([Invalid value for --enable-fips "$ENABLED_FIPS" (main options: v1, v2, v5, v6, ready, dev, rand, no, disabled)])
  413. ])
  414. if test -z "$HAVE_FIPS_VERSION_MAJOR"
  415. then
  416. HAVE_FIPS_VERSION_MAJOR=0
  417. fi
  418. if test -z "$HAVE_FIPS_VERSION_MINOR"
  419. then
  420. HAVE_FIPS_VERSION_MINOR=0
  421. fi
  422. if test -z "$HAVE_FIPS_VERSION_PATCH"
  423. then
  424. HAVE_FIPS_VERSION_PATCH=0
  425. fi
  426. if test -z "$HAVE_FIPS_VERSION"
  427. then
  428. HAVE_FIPS_VERSION="$HAVE_FIPS_VERSION_MAJOR"
  429. fi
  430. if test "$ENABLED_FIPS" != "no"
  431. then
  432. REPRODUCIBLE_BUILD_DEFAULT=yes
  433. fi
  434. AS_CASE([$FIPS_VERSION],
  435. [none],
  436. [
  437. AS_IF([ test -s $srcdir/wolfcrypt/src/fips.c ],
  438. [AC_MSG_ERROR([FIPS source tree is incompatible with non-FIPS build (requires --enable-fips)])])
  439. ],
  440. [disabled],
  441. [],
  442. [
  443. AS_IF([ ! test -s $srcdir/wolfcrypt/src/fips.c],
  444. [AC_MSG_ERROR([non-FIPS source tree is incompatible with --enable-fips=$enableval])])
  445. ]
  446. )
  447. # For reproducible build, gate out from the build anything that might
  448. # introduce semantically frivolous jitter, maximizing chance of
  449. # identical object files.
  450. AC_ARG_ENABLE([reproducible-build],
  451. [AS_HELP_STRING([--enable-reproducible-build],[Enable maximally reproducible build (default: disabled)])],
  452. [ ENABLED_REPRODUCIBLE_BUILD=$enableval ],
  453. [ ENABLED_REPRODUCIBLE_BUILD=$REPRODUCIBLE_BUILD_DEFAULT ]
  454. )
  455. if test "$ENABLED_REPRODUCIBLE_BUILD" = "yes"
  456. then
  457. # Test ar for the "D" option. Should be checked before the libtool macros.
  458. if test -z "$AR"; then
  459. AR=ar
  460. fi
  461. xxx_ar_flags=$(${AR} --help 2>&1)
  462. if test -z "$RANLIB"; then
  463. RANLIB=ranlib
  464. fi
  465. xxx_ranlib_flags=$(${RANLIB} --help 2>&1)
  466. AS_CASE([$xxx_ar_flags],[*'use zero for timestamps and uids/gids'*],[AR_FLAGS="Dcr" lt_ar_flags="Dcr"])
  467. AS_CASE([$xxx_ranlib_flags],[*'Use zero for symbol map timestamp'*],[RANLIB="${RANLIB} -D"])
  468. AM_CFLAGS="$AM_CFLAGS -DHAVE_REPRODUCIBLE_BUILD -g0"
  469. # opportunistically use -ffile-prefix-map (added in GCC8 and LLVM10)
  470. if "$CC" -ffile-prefix-map=/tmp=. -x c - -o /dev/null >/dev/null 2>&1 <<' EOF'
  471. #include <stdlib.h>
  472. int main(int argc, char **argv) {
  473. (void)argc; (void)argv; return 0;
  474. }
  475. EOF
  476. then
  477. AM_CFLAGS="$AM_CFLAGS -ffile-prefix-map=\$(abs_top_srcdir)/= -ffile-prefix-map=\$(top_srcdir)/="
  478. fi
  479. # opportunistically use linker option --build-id=none
  480. if "$CC" -Wl,--build-id=none -x c - -o /dev/null >/dev/null 2>&1 <<' EOF'
  481. #include <stdlib.h>
  482. int main(int argc, char **argv) {
  483. (void)argc; (void)argv; return 0;
  484. }
  485. EOF
  486. then
  487. AM_LDFLAGS="$AM_LDFLAGS -Wl,--build-id=none"
  488. fi
  489. fi
  490. AC_ARG_ENABLE([benchmark],
  491. [AS_HELP_STRING([--enable-benchmark],[Build benchmark when building crypttests (default: enabled)])],
  492. [ENABLED_BENCHMARK=$enableval],
  493. [ENABLED_BENCHMARK=yes]
  494. )
  495. # Linux Kernel Module
  496. AC_ARG_ENABLE([linuxkm],
  497. [AS_HELP_STRING([--enable-linuxkm],[Enable Linux Kernel Module (default: disabled)])],
  498. [ENABLED_LINUXKM=$enableval],
  499. [ENABLED_LINUXKM=no]
  500. )
  501. AC_ARG_ENABLE([linuxkm-defaults],
  502. [AS_HELP_STRING([--enable-linuxkm-defaults],[Enable feature defaults for Linux Kernel Module (default: disabled)])],
  503. [ENABLED_LINUXKM_DEFAULTS=$enableval],
  504. [ENABLED_LINUXKM_DEFAULTS=$ENABLED_LINUXKM]
  505. )
  506. AC_ARG_ENABLE([linuxkm-pie],
  507. [AS_HELP_STRING([--enable-linuxkm-pie],[Enable relocatable object build of Linux kernel module (default: disabled)])],
  508. [ENABLED_LINUXKM_PIE=$enableval],
  509. [ENABLED_LINUXKM_PIE=$ENABLED_FIPS]
  510. )
  511. if test "$ENABLED_LINUXKM_PIE" = "yes"
  512. then
  513. AM_CFLAGS="$AM_CFLAGS -DHAVE_LINUXKM_PIE_SUPPORT"
  514. elif test "$ENABLED_FIPS" = yes && test "$ENABLED_LINUXKM" = yes
  515. then
  516. AC_MSG_ERROR([FIPS linuxkm requires linuxkm-pie.])
  517. fi
  518. AC_SUBST([ENABLED_LINUXKM_PIE])
  519. AC_ARG_ENABLE([linuxkm-benchmarks],
  520. [AS_HELP_STRING([--enable-linuxkm-benchmarks],[Enable crypto benchmarking autorun at module load time for Linux kernel module (default: disabled)])],
  521. [ENABLED_LINUXKM_BENCHMARKS=$enableval],
  522. [ENABLED_LINUXKM_BENCHMARKS=no]
  523. )
  524. if test "$ENABLED_LINUXKM_BENCHMARKS" = "yes"
  525. then
  526. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LINUXKM_BENCHMARKS"
  527. fi
  528. AC_SUBST([ENABLED_LINUXKM_BENCHMARKS])
  529. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  530. then
  531. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_CONST -DWOLFSSL_SP_MOD_WORD_RP -DWOLFSSL_SP_DIV_64 -DWOLFSSL_SP_DIV_WORD_HALF -DWOLFSSL_SMALL_STACK_STATIC -DWOLFSSL_TEST_SUBROUTINE=static"
  532. if test "$ENABLED_LINUXKM_PIE" = "yes"; then
  533. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_OCSP_ISSUER_CHECK"
  534. fi
  535. if test "$ENABLED_FIPS" = "no"; then
  536. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_OLD_PRIME_CHECK"
  537. fi
  538. DEF_SP_MATH="yes"
  539. DEF_FAST_MATH="no"
  540. fi
  541. AC_ARG_WITH([linux-source],
  542. [AS_HELP_STRING([--with-linux-source=PATH],[PATH to root of Linux kernel build tree])],
  543. [KERNEL_ROOT=$withval],
  544. [KERNEL_ROOT=""])
  545. AC_ARG_WITH([linux-arch],
  546. [AS_HELP_STRING([--with-linux-arch=arch],[built arch (SRCARCH) of Linux kernel build tree])],
  547. [KERNEL_ARCH=$withval],
  548. [KERNEL_ARCH=""])
  549. if test "x$ENABLED_LINUXKM" = "xyes"
  550. then
  551. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LINUXKM"
  552. ENABLED_NO_LIBRARY=yes
  553. ENABLED_BENCHMARK=no
  554. output_objdir="$(realpath "$output_objdir")/linuxkm"
  555. if test "$KERNEL_ROOT" = ""; then
  556. AC_PATH_DEFAULT_KERNEL_SOURCE
  557. KERNEL_ROOT="$DEFAULT_KERNEL_ROOT"
  558. fi
  559. AC_SUBST([KERNEL_ROOT])
  560. if test "$KERNEL_ARCH" = ""; then
  561. AC_DEFAULT_KERNEL_ARCH
  562. KERNEL_ARCH="$DEFAULT_KERNEL_ARCH"
  563. fi
  564. AC_SUBST([KERNEL_ARCH])
  565. if test "${KERNEL_ROOT}" = ""; then
  566. AC_MSG_ERROR([Linux kernel source root not found -- supply with --with-linux-source=PATH.])
  567. fi
  568. if test "${KERNEL_ARCH}" = ""; then
  569. AC_MSG_ERROR([Linux kernel target architecture for build tree ${KERNEL_ROOT} could not be determined. Is target kernel configured?])
  570. fi
  571. AM_CFLAGS="$AM_CFLAGS -DNO_DEV_RANDOM -DNO_WRITEV -DNO_STDIO_FILESYSTEM -DWOLFSSL_NO_SOCK -DWOLFSSL_USER_IO"
  572. fi
  573. # MATH LIBRARY SELECTION
  574. # Single Precision maths implementation
  575. AC_ARG_ENABLE([sp],
  576. [AS_HELP_STRING([--enable-sp],[Enable Single Precision maths implementation (default: disabled)])],
  577. [ ENABLED_SP=$enableval ],
  578. [ ENABLED_SP=$ENABLED_SP_DEFAULT ],
  579. )
  580. AC_ARG_ENABLE([sp-math-all],
  581. [AS_HELP_STRING([--enable-sp-math-all],[Enable Single Precision math implementation for full algorithm suite (default: enabled)])],
  582. [ ENABLED_SP_MATH_ALL=$enableval ],
  583. [ ENABLED_SP_MATH_ALL=$DEF_SP_MATH ],
  584. )
  585. # Single Precision maths (acceleration for common key sizes and curves)
  586. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes" && test "$ENABLED_SP" != "no" && test "$ENABLED_SP_MATH_ALL" = "no"
  587. then
  588. ENABLED_SP_MATH_DEFAULT=yes
  589. else
  590. ENABLED_SP_MATH_DEFAULT=no
  591. fi
  592. AC_ARG_ENABLE([sp-math],
  593. [AS_HELP_STRING([--enable-sp-math],[Enable Single Precision math implementation with restricted algorithm suite (default: disabled)])],
  594. [ ENABLED_SP_MATH=$enableval ],
  595. [ ENABLED_SP_MATH=$ENABLED_SP_MATH_DEFAULT ],
  596. )
  597. if test "$enable_sp_math" != ""
  598. then
  599. # When the restricted SP Math is selected and not SP Math ALL, then disable
  600. # SP Math ALL.
  601. if test "$enable_sp_math" != "no" && test "$enable_sp_math_all" = ""
  602. then
  603. ENABLED_SP_MATH_ALL="no"
  604. else
  605. # Can't choose restricted and unrestricted SP Math
  606. if test "$enable_sp_math" != "no" && test "$enable_sp_math_all" != "no"
  607. then
  608. AC_MSG_ERROR([--enable-sp-math and --enable-sp-math-all are incompatible. Use --enable-sp-math-all only when all key sizes need to be supported.])
  609. fi
  610. fi
  611. fi
  612. # enable SP math assembly support automatically for x86_64 and aarch64 (except Linux kernel module)
  613. SP_ASM_DEFAULT=no
  614. if test "$ENABLED_SP_MATH" = "yes" && test "$ENABLED_LINUXKM_DEFAULTS" = "no"
  615. then
  616. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64" || test "$host_cpu" = "amd64"
  617. then
  618. SP_ASM_DEFAULT=yes
  619. fi
  620. fi
  621. AC_ARG_ENABLE([sp-asm],
  622. [AS_HELP_STRING([--enable-sp-asm],[Enable Single Precision assembly implementation (default: enabled on x86_64/aarch64/amd64)])],
  623. [ ENABLED_SP_ASM=$enableval ],
  624. [ ENABLED_SP_ASM=$SP_ASM_DEFAULT ],
  625. )
  626. if test "$ENABLED_SP_ASM" != "no"
  627. then
  628. if test "$ENABLED_SP" = "no"
  629. then
  630. AC_MSG_ERROR([--enable-sp-asm requires SP to be enabled.])
  631. fi
  632. if test "$ENABLED_SP" = ""
  633. then
  634. ENABLED_SP=yes
  635. fi
  636. fi
  637. # fastmath
  638. AC_ARG_ENABLE([fastmath],
  639. [AS_HELP_STRING([--enable-fastmath],[Enable fast math ops (default: disabled)])],
  640. [ ENABLED_FASTMATH=$enableval ],
  641. [ ENABLED_FASTMATH=$DEF_FAST_MATH ]
  642. )
  643. # fast HUGE math
  644. AC_ARG_ENABLE([fasthugemath],
  645. [AS_HELP_STRING([--enable-fasthugemath],[Enable fast math + huge code (default: disabled)])],
  646. [ ENABLED_FASTHUGEMATH=$enableval ],
  647. [ ENABLED_FASTHUGEMATH=no ]
  648. )
  649. if test "$ENABLED_BUMP" = "yes"
  650. then
  651. ENABLED_FASTHUGEMATH="yes"
  652. fi
  653. if test "$ENABLED_FASTHUGEMATH" = "yes"
  654. then
  655. ENABLED_FASTMATH="yes"
  656. fi
  657. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "amd64"
  658. then
  659. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_64_BUILD"
  660. fi
  661. if test "$host_cpu" = "x86"
  662. then
  663. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_BUILD"
  664. fi
  665. # if sp-math-all is not set, then enable fast math
  666. if test "x$ENABLED_FASTMATH" = "xyes" && test "$enable_sp_math_all" = "" && test "$enable_sp_math" = ""
  667. then
  668. # turn off fastmath if leanpsk on or asn off (w/o DH and ECC)
  669. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no"
  670. then
  671. if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no" && test "$ENABLED_RSA" = "no"
  672. then
  673. ENABLED_FASTMATH="no"
  674. else
  675. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  676. ENABLED_HEAPMATH="no"
  677. fi
  678. else
  679. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  680. ENABLED_HEAPMATH="no"
  681. ENABLED_SP_MATH_ALL="no"
  682. fi
  683. AS_IF([test "x$host_cpu" = "xaarch64"],[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AARCH64_BUILD"])
  684. if test "$ENABLED_SAKKE" = "yes" && test "$ENABLED_SAKKE_SMALL" != "yes"
  685. then
  686. AM_CFLAGS="$AM_CFLAGS -funroll-loops -DTFM_SMALL_SET"
  687. fi
  688. fi
  689. # heap based integer.c math (not timing resistant)
  690. AC_ARG_ENABLE([heapmath],
  691. [AS_HELP_STRING([--enable-heapmath],[Enable heap based integer.c math ops (default: disabled)])],
  692. [ ENABLED_HEAPMATH=$enableval ],
  693. [ ENABLED_HEAPMATH=no]
  694. )
  695. if test "x$ENABLED_HEAPMATH" = "xyes"
  696. then
  697. AM_CFLAGS="$AM_CFLAGS -DUSE_INTEGER_HEAP_MATH"
  698. ENABLED_HEAPMATH="yes"
  699. ENABLED_SP="no"
  700. ENABLED_SP_MATH_ALL="no"
  701. fi
  702. # ALL FEATURES
  703. AC_ARG_ENABLE([all],
  704. [AS_HELP_STRING([--enable-all],[Enable all wolfSSL features, except SSLv3 (default: disabled)])],
  705. [ ENABLED_ALL=$enableval ],
  706. [ ENABLED_ALL=no ]
  707. )
  708. if test "$ENABLED_ALL" = "yes"
  709. then
  710. test "$enable_dtls" = "" && enable_dtls=yes
  711. if test "x$FIPS_VERSION" != "xv1"
  712. then
  713. test "$enable_tls13" = "" && enable_tls13=yes
  714. test "$enable_rsapss" = "" && enable_rsapss=yes
  715. fi
  716. # this set is also enabled by enable-all-crypto:
  717. test "$enable_atomicuser" = "" && enable_atomicuser=yes
  718. test "$enable_aesgcm" = "" && enable_aesgcm=yes
  719. test "$enable_aesgcm_stream" = "" && test "$enable_aesgcm" = "yes" && enable_aesgcm_stream=yes
  720. test "$enable_aesccm" = "" && enable_aesccm=yes
  721. test "$enable_aesctr" = "" && enable_aesctr=yes
  722. test "$enable_aeseax" = "" && enable_aeseax=yes
  723. test "$enable_aesofb" = "" && enable_aesofb=yes
  724. test "$enable_aescfb" = "" && enable_aescfb=yes
  725. test "$enable_aescbc_length_checks" = "" && enable_aescbc_length_checks=yes
  726. test "$enable_camellia" = "" && enable_camellia=yes
  727. test "$enable_ripemd" = "" && enable_ripemd=yes
  728. test "$enable_sha224" = "" && enable_sha224=yes
  729. test "$enable_sha512" = "" && enable_sha512=yes
  730. test "$enable_sha3" = "" && enable_sha3=yes
  731. test "$enable_shake128" = "" && enable_shake128=yes
  732. test "$enable_shake256" = "" && enable_shake256=yes
  733. test "$enable_sessioncerts" = "" && enable_sessioncerts=yes
  734. test "$enable_keygen" = "" && enable_keygen=yes
  735. test "$enable_certgen" = "" && enable_certgen=yes
  736. test "$enable_certreq" = "" && enable_certreq=yes
  737. test "$enable_certext" = "" && enable_certext=yes
  738. test "$enable_sep" = "" && enable_sep=yes
  739. test "$enable_hkdf" = "" && enable_hkdf=yes
  740. test "$enable_curve25519" = "" && enable_curve25519=yes
  741. test "$enable_curve448" = "" && enable_curve448=yes
  742. test "$enable_fpecc" = "" && test "$enable_ecc" != "no" && enable_fpecc=yes
  743. test "$enable_eccencrypt" = "" && test "$enable_ecc" != "no" && enable_eccencrypt=yes
  744. test "$enable_psk" = "" && enable_psk=yes
  745. test "$enable_cmac" = "" && enable_cmac=yes
  746. test "$enable_siphash" = "" && enable_siphash=yes
  747. test "$enable_ocsp" = "" && enable_ocsp=yes
  748. test "$enable_ocspstapling" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling=yes
  749. test "$enable_ocspstapling2" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling2=yes
  750. test "$enable_crl" = "" && enable_crl=yes
  751. test "$enable_supportedcurves" = "" && enable_supportedcurves=yes
  752. test "$enable_tlsx" = "" && enable_tlsx=yes
  753. test "$enable_pwdbased" = "" && enable_pwdbased=yes
  754. test "$enable_aeskeywrap" = "" && enable_aeskeywrap=yes
  755. test "$enable_x963kdf" = "" && enable_x963kdf=yes
  756. test "$enable_scrypt" = "" && test "$enable_hmac" != "no" && enable_scrypt=yes
  757. test "$enable_indef" = "" && enable_indef=yes
  758. test "$enable_enckeys" = "" && enable_enckeys=yes
  759. test "$enable_hashflags" = "" && enable_hashflags=yes
  760. test "$enable_defaultdhparams" = "" && enable_defaultdhparams=yes
  761. test "$enable_base64encode" = "" && enable_base64encode=yes
  762. test "$enable_base16" = "" && enable_base16=yes
  763. test "$enable_arc4" = "" && enable_arc4=yes
  764. test "$enable_blake2" = "" && enable_blake2=yes
  765. test "$enable_blake2s" = "" && enable_blake2s=yes
  766. test "$enable_md2" = "" && enable_md2=yes
  767. test "$enable_md4" = "" && enable_md4=yes
  768. test "$enable_cryptocb" = "" && enable_cryptocb=yes
  769. test "$enable_anon" = "" && enable_anon=yes
  770. test "$enable_ssh" = "" && test "$enable_hmac" != "no" && enable_ssh=yes
  771. test "$enable_savesession" = "" && enable_savesession=yes
  772. test "$enable_savecert" = "" && enable_savecert=yes
  773. test "$enable_postauth" = "" && enable_postauth=yes
  774. test "$enable_hrrcookie" = "" && enable_hrrcookie=yes
  775. test "$enable_fallback_scsv" = "" && enable_fallback_scsv=yes
  776. test "$enable_webserver" = "" && enable_webserver=yes
  777. test "$enable_crl_monitor" = "" && enable_crl_monitor=yes
  778. test "$enable_sni" = "" && enable_sni=yes
  779. test "$enable_maxfragment" = "" && enable_maxfragment=yes
  780. test "$enable_alpn" = "" && enable_alpn=yes
  781. test "$enable_truncatedhmac" = "" && enable_truncatedhmac=yes
  782. test "$enable_trusted_ca" = "" && enable_trusted_ca=yes
  783. test "$enable_session_ticket" = "" && enable_session_ticket=yes
  784. test "$enable_earlydata" = "" && enable_earlydata=yes
  785. test "$enable_ech" = "" && enable_ech=yes
  786. test "$enable_srtp" = "" && enable_srtp=yes
  787. test "$enable_rpk" = "" && enable_rpk=yes
  788. if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
  789. then
  790. test "$enable_compkey" = "" && enable_compkey=yes
  791. test "$enable_quic" = "" && test "$enable_cryptonly" != "yes" && enable_quic=yes
  792. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_IO -DHAVE_IO_TIMEOUT"
  793. fi
  794. # sp-math is incompatible with opensslextra, ECC custom curves, and DSA.
  795. if test "$ENABLED_SP_MATH" = "no"
  796. then
  797. test "$enable_dsa" = "" && test "$enable_sha" != "no" && enable_dsa=yes
  798. if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -le 5; then
  799. test "$enable_ecccustcurves" = "" && enable_ecccustcurves=yes
  800. test "$enable_brainpool" = "" && enable_brainpool=yes
  801. fi
  802. test "$enable_srp" = "" && enable_srp=yes
  803. # linuxkm is incompatible with opensslextra and its dependents.
  804. if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
  805. then
  806. if test "$ENABLED_FIPS" = "no"
  807. then
  808. if test "$ENABLED_32BIT" != "yes"
  809. then
  810. test "$enable_openssh" = "" && enable_openssh=yes
  811. fi
  812. # S/MIME support requires PKCS7, which requires no FIPS.
  813. test "$enable_smime" = "" && enable_smime=yes
  814. fi
  815. test "$enable_opensslextra" = "" && enable_opensslextra=yes
  816. test "$enable_opensslall" = "" && enable_opensslall=yes
  817. test "$enable_certservice" = "" && enable_certservice=yes
  818. test "$enable_lighty" = "" && enable_lighty=yes
  819. test "$enable_nginx" = "" && enable_nginx=yes
  820. test "$enable_openvpn" = "" && enable_openvpn=yes
  821. test "$enable_asio" = "" && enable_asio=yes
  822. test "$enable_libwebsockets" = "" && enable_libwebsockets=yes
  823. if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -le 5; then
  824. test "$enable_qt" = "" && enable_qt=yes
  825. fi
  826. fi
  827. fi
  828. if test "$ENABLED_FIPS" = "no"
  829. then
  830. test "$enable_pkcallbacks" = "" && enable_pkcallbacks=yes
  831. test "$enable_xchacha" = "" && test "$enable_chacha" != "no" && enable_xchacha=yes
  832. test "$enable_scep" = "" && enable_scep=yes
  833. test "$enable_pkcs7" = "" && enable_pkcs7=yes
  834. test "$enable_nullcipher" = "" && enable_nullcipher=yes
  835. test "$enable_mcast" = "" && enable_mcast=yes
  836. test "$enable_ed25519" = "" && enable_ed25519=yes
  837. test "$enable_ed25519_stream" = "" && test "$enable_ed25519" != "no" && enable_ed25519_stream=yes
  838. test "$enable_ed448" = "" && enable_ed448=yes
  839. test "$enable_ed448_stream" = "" && test "$enable_ed448" != "no" && enable_ed448_stream=yes
  840. if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
  841. then
  842. # these use DES3:
  843. test "$enable_stunnel" = "" && enable_stunnel=yes
  844. test "$enable_curl" = "" && enable_curl=yes
  845. test "$enable_tcpdump" = "" && enable_tcpdump=yes
  846. test "$enable_eccsi" = "" && test "$enable_ecc" != "no" && enable_eccsi=yes
  847. test "$enable_sakke" = "" && test "$enable_ecc" != "no" && enable_sakke=yes
  848. fi
  849. fi
  850. if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -ge 6 || test "$FIPS_VERSION" = "v5-dev"; then
  851. test "$enable_aesxts" = "" && enable_aesxts=yes
  852. test "$enable_aesxts_stream" = "" && test "$enable_aesxts" = "yes" && (test "$enable_armasm" = "" || test "$enable_armasm" = "no") && enable_aesxts_stream=yes
  853. test "$enable_aessiv" = "" && enable_aessiv=yes
  854. fi
  855. if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -le 5; then
  856. test "$enable_des3" = "" && enable_des3=yes
  857. fi
  858. # Enable DH const table speedups (eliminates `-lm` math lib dependency)
  859. AM_CFLAGS="$AM_CFLAGS -DHAVE_FFDHE_2048 -DHAVE_FFDHE_3072"
  860. DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS=4096
  861. # Enable multiple attribute additions such as DC
  862. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MULTI_ATTRIB"
  863. # Enable AES Decrypt, AES ECB
  864. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_DECRYPT -DHAVE_AES_ECB"
  865. # Enable Alt Names, DER Load, Keep Certs, CRL IO with Timeout
  866. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALT_NAMES -DWOLFSSL_DER_LOAD -DKEEP_OUR_CERT -DKEEP_PEER_CERT"
  867. # Enable DH Extra
  868. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_EXTRA"
  869. # Enable deterministic ECC signing API with variant
  870. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ECDSA_DETERMINISTIC_K_VARIANT"
  871. # Store issuer name components when parsing certificates.
  872. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_ISSUER_NAMES"
  873. # Certificate extensions and alt. names for FPKI use
  874. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SUBJ_DIR_ATTR -DWOLFSSL_FPKI -DWOLFSSL_SUBJ_INFO_ACC"
  875. # Handle as many subject/issuer name OIDs as possible
  876. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_NAME_ALL"
  877. # More thorough error queue usage.
  878. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VERBOSE_ERRORS"
  879. fi
  880. # ALL CRYPTO FEATURES
  881. AC_ARG_ENABLE([all-crypto],
  882. [AS_HELP_STRING([--enable-all-crypto],[Enable all wolfcrypt algorithms (default: disabled)])],
  883. [ ENABLED_ALL_CRYPT=$enableval ],
  884. [ ENABLED_ALL_CRYPT=no ]
  885. )
  886. if test "$ENABLED_ALL_CRYPT" = "yes"
  887. then
  888. test "$enable_atomicuser" = "" && enable_atomicuser=yes
  889. test "$enable_aesgcm" = "" && enable_aesgcm=yes
  890. test "$enable_aesgcm_stream" = "" && test "$enable_aesgcm" = "yes" && enable_aesgcm_stream=yes
  891. test "$enable_aesccm" = "" && enable_aesccm=yes
  892. test "$enable_aesctr" = "" && enable_aesctr=yes
  893. test "$enable_aeseax" = "" && enable_aeseax=yes
  894. test "$enable_aesofb" = "" && enable_aesofb=yes
  895. test "$enable_aescfb" = "" && enable_aescfb=yes
  896. test "$enable_aescbc_length_checks" = "" && enable_aescbc_length_checks=yes
  897. test "$enable_camellia" = "" && enable_camellia=yes
  898. test "$enable_ripemd" = "" && enable_ripemd=yes
  899. test "$enable_sha224" = "" && enable_sha224=yes
  900. test "$enable_sha512" = "" && enable_sha512=yes
  901. test "$enable_sha3" = "" && enable_sha3=yes
  902. test "$enable_shake128" = "" && enable_shake128=yes
  903. test "$enable_shake256" = "" && enable_shake256=yes
  904. test "$enable_sessioncerts" = "" && enable_sessioncerts=yes
  905. test "$enable_keygen" = "" && enable_keygen=yes
  906. test "$enable_certgen" = "" && enable_certgen=yes
  907. test "$enable_certreq" = "" && enable_certreq=yes
  908. test "$enable_certext" = "" && enable_certext=yes
  909. test "$enable_sep" = "" && enable_sep=yes
  910. test "$enable_hkdf" = "" && enable_hkdf=yes
  911. test "$enable_curve25519" = "" && enable_curve25519=yes
  912. test "$enable_curve448" = "" && enable_curve448=yes
  913. test "$enable_fpecc" = "" && test "$enable_ecc" != "no" && enable_fpecc=yes
  914. test "$enable_eccencrypt" = "" && test "$enable_ecc" != "no" && enable_eccencrypt=yes
  915. test "$enable_psk" = "" && enable_psk=yes
  916. test "$enable_cmac" = "" && enable_cmac=yes
  917. test "$enable_siphash" = "" && enable_siphash=yes
  918. test "$enable_ocsp" = "" && enable_ocsp=yes
  919. test "$enable_ocspstapling" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling=yes
  920. test "$enable_ocspstapling2" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling2=yes
  921. test "$enable_crl" = "" && enable_crl=yes
  922. test "$enable_supportedcurves" = "" && enable_supportedcurves=yes
  923. test "$enable_tlsx" = "" && enable_tlsx=yes
  924. test "$enable_pwdbased" = "" && enable_pwdbased=yes
  925. test "$enable_aeskeywrap" = "" && enable_aeskeywrap=yes
  926. test "$enable_x963kdf" = "" && enable_x963kdf=yes
  927. test "$enable_scrypt" = "" && test "$enable_hmac" != "no" && enable_scrypt=yes
  928. test "$enable_indef" = "" && enable_indef=yes
  929. test "$enable_enckeys" = "" && enable_enckeys=yes
  930. test "$enable_hashflags" = "" && enable_hashflags=yes
  931. test "$enable_defaultdhparams" = "" && enable_defaultdhparams=yes
  932. test "$enable_base64encode" = "" && enable_base64encode=yes
  933. test "$enable_base16" = "" && enable_base16=yes
  934. test "$enable_arc4" = "" && enable_arc4=yes
  935. test "$enable_blake2" = "" && enable_blake2=yes
  936. test "$enable_blake2s" = "" && enable_blake2s=yes
  937. test "$enable_md2" = "" && enable_md2=yes
  938. test "$enable_md4" = "" && enable_md4=yes
  939. test "$enable_cryptocb" = "" && enable_cryptocb=yes
  940. test "$enable_anon" = "" && enable_anon=yes
  941. test "$enable_ssh" = "" && test "$enable_hmac" != "no" && enable_ssh=yes
  942. test "$enable_srtp_kdf" = "" && enable_srtp_kdf=yes
  943. if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
  944. then
  945. test "$enable_compkey" = "" && enable_compkey=yes
  946. fi
  947. if test "$ENABLED_SP_MATH" = "no"
  948. then
  949. test "$enable_dsa" = "" && test "$enable_sha" != "no" && enable_dsa=yes
  950. if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -le 5; then
  951. test "$enable_ecccustcurves" = "" && enable_ecccustcurves=yes
  952. test "$enable_brainpool" = "" && enable_brainpool=yes
  953. fi
  954. test "$enable_srp" = "" && enable_srp=yes
  955. fi
  956. if test "$ENABLED_FIPS" = "no"
  957. then
  958. test "$enable_pkcallbacks" = "" && enable_pkcallbacks=yes
  959. test "$enable_xchacha" = "" && test "$enable_chacha" != "no" && enable_xchacha=yes
  960. test "$enable_pkcs7" = "" && enable_pkcs7=yes
  961. test "$enable_nullcipher" = "" && enable_nullcipher=yes
  962. test "$enable_ed25519" = "" && enable_ed25519=yes
  963. test "$enable_ed25519_stream" = "" && test "$enable_ed25519" != "no" && enable_ed25519_stream=yes
  964. test "$enable_ed448" = "" && enable_ed448=yes
  965. test "$enable_ed448_stream" = "" && test "$enable_ed448" != "no" && enable_ed448_stream=yes
  966. if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
  967. then
  968. test "$enable_eccsi" = "" && test "$enable_ecc" != "no" && enable_eccsi=yes
  969. test "$enable_sakke" = "" && test "$enable_ecc" != "no" && enable_sakke=yes
  970. fi
  971. fi
  972. if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -ge 6 || test "$FIPS_VERSION" = "v5-dev"; then
  973. test "$enable_aesxts" = "" && enable_aesxts=yes
  974. test "$enable_aesxts_stream" = "" && test "$enable_aesxts" = "yes" && (test "$enable_armasm" = "" || test "$enable_armasm" = "no") && enable_aesxts_stream=yes
  975. test "$enable_aessiv" = "" && enable_aessiv=yes
  976. fi
  977. if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -le 5; then
  978. test "$enable_des3" = "" && enable_des3=yes
  979. fi
  980. # Enable AES Decrypt, AES ECB, Alt Names, DER Load
  981. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_DECRYPT -DHAVE_AES_ECB -DWOLFSSL_ALT_NAMES -DWOLFSSL_DER_LOAD"
  982. # Enable DH const table speedups (eliminates `-lm` math lib dependency)
  983. AM_CFLAGS="$AM_CFLAGS -DHAVE_FFDHE_2048 -DHAVE_FFDHE_3072"
  984. DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS=4096
  985. # Enable multiple attribute additions such as DC
  986. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MULTI_ATTRIB"
  987. # Enable DH Extra
  988. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_EXTRA"
  989. # Enable deterministic ECC signing API with variant
  990. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ECDSA_DETERMINISTIC_K_VARIANT"
  991. # Store issuer name components when parsing certificates.
  992. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_ISSUER_NAMES"
  993. fi
  994. # liboqs
  995. ENABLED_LIBOQS="no"
  996. tryliboqsdir=""
  997. AC_ARG_WITH([liboqs],
  998. [AS_HELP_STRING([--with-liboqs=PATH],[Path to liboqs install (default /usr/local) (requires --enable-experimental)])],
  999. [
  1000. AS_IF([ test "$ENABLED_EXPERIMENTAL" != "yes" ],[ AC_MSG_ERROR([LIBOQS requires --enable-experimental.]) ])
  1001. AC_MSG_CHECKING([for liboqs])
  1002. LIBS="$LIBS -loqs"
  1003. AM_CFLAGS="$AM_CFLAGS -pthread"
  1004. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <oqs/common.h>]], [[ OQS_init(); ]])], [ liboqs_linked=yes ],[ liboqs_linked=no ])
  1005. if test "x$liboqs_linked" = "xno" ; then
  1006. if test "x$withval" != "xno" ; then
  1007. tryliboqsdir=$withval
  1008. fi
  1009. if test "x$withval" = "xyes" ; then
  1010. tryliboqsdir="/usr/local"
  1011. fi
  1012. CPPFLAGS="$AM_CPPFLAGS -DHAVE_LIBOQS -DHAVE_TLS_EXTENSIONS -I$tryliboqsdir/include"
  1013. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$tryliboqsdir/lib"
  1014. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <oqs/common.h>]], [[ OQS_init(); ]])], [ liboqs_linked=yes ],[ liboqs_linked=no ])
  1015. if test "x$liboqs_linked" = "xno" ; then
  1016. AC_MSG_ERROR([liboqs isn't found.
  1017. If it's already installed, specify its path using --with-liboqs=/dir/])
  1018. fi
  1019. AC_MSG_RESULT([yes])
  1020. AM_CPPFLAGS="$CPPFLAGS"
  1021. AM_LDFLAGS="$AM_LDFLAGS -L$tryliboqsdir/lib"
  1022. else
  1023. AC_MSG_RESULT([yes])
  1024. fi
  1025. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  1026. then
  1027. ENABLED_OPENSSLEXTRA="yes"
  1028. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  1029. fi
  1030. AM_CFLAGS="$AM_CFLAGS -DHAVE_LIBOQS -DHAVE_TLS_EXTENSIONS"
  1031. ENABLED_LIBOQS="yes"
  1032. ]
  1033. )
  1034. # KYBER
  1035. # Used:
  1036. # - SHA3, Shake128 and Shake256, or
  1037. # - SHA256, SHA512, AES-CTR
  1038. AC_ARG_ENABLE([kyber],
  1039. [AS_HELP_STRING([--enable-kyber],[Enable KYBER (requires --enable-experimental) (default: disabled)])],
  1040. [ ENABLED_KYBER=$enableval ],
  1041. [ ENABLED_KYBER=no ]
  1042. )
  1043. ENABLED_WC_KYBER=no
  1044. for v in `echo $ENABLED_KYBER | tr "," " "`
  1045. do
  1046. case $v in
  1047. yes | all)
  1048. ENABLED_KYBER512=yes
  1049. ENABLED_KYBER768=yes
  1050. ENABLED_KYBER1024=yes
  1051. ;;
  1052. no)
  1053. ;;
  1054. small)
  1055. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KYBER_SMALL"
  1056. ;;
  1057. 512)
  1058. ENABLED_KYBER512=yes
  1059. ;;
  1060. 768)
  1061. ENABLED_KYBER768=yes
  1062. ;;
  1063. 1024)
  1064. ENABLED_KYBER1024=yes
  1065. ;;
  1066. *)
  1067. AC_MSG_ERROR([Invalid choice for KYBER []: $ENABLED_KYBER.])
  1068. break;;
  1069. esac
  1070. done
  1071. if test "$ENABLED_KYBER" != "no"
  1072. then
  1073. AS_IF([ test "$ENABLED_EXPERIMENTAL" != "yes" ],[ AC_MSG_ERROR([KYBER requires --enable-experimental.]) ])
  1074. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_KYBER"
  1075. # Use liboqs if specified.
  1076. if test "$ENABLED_LIBOQS" = "no"; then
  1077. ENABLED_WC_KYBER=yes
  1078. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WC_KYBER"
  1079. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_WC_KYBER"
  1080. fi
  1081. if test "$ENABLED_KYBER512" = ""; then
  1082. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_KYBER512"
  1083. fi
  1084. if test "$ENABLED_KYBER768" = ""; then
  1085. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_KYBER768"
  1086. fi
  1087. if test "$ENABLED_KYBER1024" = ""; then
  1088. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_KYBER1024"
  1089. fi
  1090. if test "$ENABLED_WC_KYBER" = "yes"
  1091. then
  1092. test "$enable_sha3" = "" && enable_sha3=yes
  1093. test "$enable_shake128" = "" && enable_shake128=yes
  1094. test "$enable_shake256" = "" && enable_shake256=yes
  1095. fi
  1096. fi
  1097. # XMSS
  1098. AC_ARG_ENABLE([xmss],
  1099. [AS_HELP_STRING([--enable-xmss],[Enable stateful XMSS/XMSS^MT signatures (default: disabled)])],
  1100. [ ENABLED_XMSS=$enableval ],
  1101. [ ENABLED_XMSS=no ]
  1102. )
  1103. for v in `echo $ENABLED_XMSS | tr "," " "`
  1104. do
  1105. case $v in
  1106. yes)
  1107. ;;
  1108. no)
  1109. ;;
  1110. verify-only)
  1111. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_XMSS_VERIFY_ONLY -DXMSS_VERIFY_ONLY"
  1112. ;;
  1113. small)
  1114. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WC_XMSS_SMALL"
  1115. ;;
  1116. *)
  1117. AC_MSG_ERROR([Invalid choice for XMSS []: $ENABLED_XMSS.])
  1118. break;;
  1119. esac
  1120. done
  1121. # libxmss
  1122. # Get the path to xmss-reference.
  1123. ENABLED_LIBXMSS="no"
  1124. trylibxmssdir=""
  1125. AC_ARG_WITH([libxmss],
  1126. [AS_HELP_STRING([--with-libxmss=PATH],[PATH to xmss-reference root dir. (requires --enable-experimental)!])],
  1127. [
  1128. AS_IF([ test "$ENABLED_EXPERIMENTAL" != "yes" ],[ AC_MSG_ERROR([libxmss requires --enable-experimental.]) ])
  1129. AC_MSG_CHECKING([for libxmss])
  1130. trylibxmssdir=$withval
  1131. if test -e $trylibxmssdir; then
  1132. libxmss_linked=yes
  1133. else
  1134. AC_MSG_ERROR([libxmss isn't found.
  1135. If it's already installed, specify its path using --with-libxmss=/dir/])
  1136. fi
  1137. if test "$XMSS_VERIFY_ONLY" = "yes"; then
  1138. if test -e $trylibxmssdir/xmss_verify_lib.a; then
  1139. CPPFLAGS="$AM_CPPFLAGS -DHAVE_LIBXMSS -I$trylibxmssdir"
  1140. LIB_STATIC_ADD="$LIB_STATIC_ADD $trylibxmssdir/xmss_verify_lib.a"
  1141. enable_shared=no
  1142. enable_static=yes
  1143. libxmss_linked=yes
  1144. else
  1145. AC_MSG_ERROR([xmss_verify_lib.a isn't found.
  1146. If it's already installed, specify its path using --with-libxmss=/dir/])
  1147. fi
  1148. elif test -e $trylibxmssdir/xmss_lib.a; then
  1149. CPPFLAGS="$AM_CPPFLAGS -DHAVE_LIBXMSS -I$trylibxmssdir"
  1150. LIB_STATIC_ADD="$LIB_STATIC_ADD $trylibxmssdir/xmss_lib.a"
  1151. enable_shared=no
  1152. enable_static=yes
  1153. libxmss_linked=yes
  1154. else
  1155. AC_MSG_ERROR([libxmss isn't found.
  1156. If it's already installed, specify its path using --with-libxmss=/dir/])
  1157. fi
  1158. XMSS_ROOT=$trylibxmssdir
  1159. AC_MSG_RESULT([yes])
  1160. AM_CPPFLAGS="$CPPFLAGS"
  1161. AM_CFLAGS="$AM_CFLAGS -DHAVE_LIBXMSS -I$trylibxmssdir"
  1162. ENABLED_LIBXMSS="yes"
  1163. AC_SUBST([XMSS_ROOT])
  1164. ],
  1165. [XMSS_ROOT=""]
  1166. )
  1167. if test "$ENABLED_XMSS" != "no"
  1168. then
  1169. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_XMSS"
  1170. # Use hash-sigs XMSS lib if enabled.
  1171. if test "$ENABLED_LIBXMSS" = "yes"; then
  1172. ENABLED_WC_XMSS=no
  1173. else
  1174. ENABLED_WC_XMSS=yes
  1175. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WC_XMSS"
  1176. fi
  1177. fi
  1178. # LMS
  1179. AC_ARG_ENABLE([lms],
  1180. [AS_HELP_STRING([--enable-lms],[Enable stateful LMS/HSS signatures (default: disabled)])],
  1181. [ ENABLED_LMS=$enableval ],
  1182. [ ENABLED_LMS=no ]
  1183. )
  1184. for v in `echo $ENABLED_LMS | tr "," " "`
  1185. do
  1186. case $v in
  1187. yes)
  1188. ;;
  1189. no)
  1190. ;;
  1191. verify-only)
  1192. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LMS_VERIFY_ONLY"
  1193. ;;
  1194. small)
  1195. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WC_LMS_SMALL"
  1196. ;;
  1197. *)
  1198. AC_MSG_ERROR([Invalid choice for LMS []: $ENABLED_LMS.])
  1199. break;;
  1200. esac
  1201. done
  1202. # liblms
  1203. # Get the path to the hash-sigs LMS HSS lib.
  1204. ENABLED_LIBLMS="no"
  1205. tryliblmsdir=""
  1206. AC_ARG_WITH([liblms],
  1207. [AS_HELP_STRING([--with-liblms=PATH],[PATH to hash-sigs LMS/HSS install (default /usr/local) (requires --enable-experimental)!])],
  1208. [
  1209. AS_IF([ test "$ENABLED_EXPERIMENTAL" != "yes" ],[ AC_MSG_ERROR([liblms requires --enable-experimental.]) ])
  1210. AC_MSG_CHECKING([for liblms])
  1211. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <hss.h>]], [[ param_set_t lm_type; param_set_t lm_ots_type; hss_get_public_key_len(4, &lm_type, &lm_ots_type); ]])], [ liblms_linked=yes ],[ liblms_linked=no ])
  1212. if test "x$liblms_linked" = "xno" ; then
  1213. if test "x$withval" != "xno" ; then
  1214. tryliblmsdir=$withval
  1215. fi
  1216. if test "x$withval" = "xyes" ; then
  1217. tryliblmsdir="/usr/local"
  1218. fi
  1219. # 1. If verify only build, use hss_verify.a
  1220. # 2. If normal build, by default use single-threaded hss_lib.a
  1221. # 3. If 2 not found, then use the multi-threaded hss_lib_thread.a
  1222. if test "$LMS_VERIFY_ONLY" = "yes"; then
  1223. if test -e $tryliblmsdir/hss_verify.a; then
  1224. CPPFLAGS="$AM_CPPFLAGS -DHAVE_LIBLMS -I$tryliblmsdir"
  1225. LIB_STATIC_ADD="$LIB_STATIC_ADD $tryliblmsdir/hss_verify.a"
  1226. enable_shared=no
  1227. enable_static=yes
  1228. liblms_linked=yes
  1229. else
  1230. AC_MSG_ERROR([hss_verify.a isn't found.
  1231. If it's already installed, specify its path using --with-liblms=/dir/])
  1232. fi
  1233. elif test -e $tryliblmsdir/hss_lib.a; then
  1234. CPPFLAGS="$AM_CPPFLAGS -DHAVE_LIBLMS -I$tryliblmsdir"
  1235. LIB_STATIC_ADD="$LIB_STATIC_ADD $tryliblmsdir/hss_lib.a"
  1236. enable_shared=no
  1237. enable_static=yes
  1238. liblms_linked=yes
  1239. elif test -e $tryliblmsdir/hss_lib_thread.a; then
  1240. CPPFLAGS="$AM_CPPFLAGS -DHAVE_LIBLMS -I$tryliblmsdir"
  1241. LIB_STATIC_ADD="$LIB_STATIC_ADD $tryliblmsdir/hss_lib_thread.a"
  1242. enable_shared=no
  1243. enable_static=yes
  1244. liblms_linked=yes
  1245. else
  1246. AC_MSG_ERROR([liblms isn't found.
  1247. If it's already installed, specify its path using --with-liblms=/dir/])
  1248. fi
  1249. if test "x$liblms_linked" = "xno" ; then
  1250. AC_MSG_ERROR([liblms isn't found.
  1251. If it's already installed, specify its path using --with-liblms=/dir/])
  1252. fi
  1253. AC_MSG_RESULT([yes])
  1254. AM_CPPFLAGS="$CPPFLAGS"
  1255. AM_LDFLAGS="$LDFLAGS"
  1256. else
  1257. AC_MSG_RESULT([yes])
  1258. fi
  1259. AM_CFLAGS="$AM_CFLAGS -DHAVE_LIBLMS"
  1260. ENABLED_LIBLMS="yes"
  1261. ]
  1262. )
  1263. if test "$ENABLED_LMS" != "no"
  1264. then
  1265. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_LMS"
  1266. # Use hash-sigs LMS lib if enabled.
  1267. if test "$ENABLED_LIBLMS" = "yes"; then
  1268. ENABLED_WC_LMS=no
  1269. else
  1270. ENABLED_WC_LMS=yes
  1271. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WC_LMS"
  1272. fi
  1273. fi
  1274. # SINGLE THREADED
  1275. AC_ARG_ENABLE([singlethreaded],
  1276. [AS_HELP_STRING([--enable-singlethreaded],[Enable wolfSSL single threaded (default: disabled)])],
  1277. [ ENABLED_SINGLETHREADED=$enableval ],
  1278. [ ENABLED_SINGLETHREADED=no ])
  1279. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xno" ],[
  1280. AX_PTHREAD([
  1281. AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
  1282. # If AX_PTHREAD is adding -Qunused-arguments, need to prepend with -Xcompiler libtool will use it. Newer
  1283. # versions of clang don't need the -Q flag when using pthreads.
  1284. AS_CASE([$PTHREAD_CFLAGS],[-Qunused-arguments*],[PTHREAD_CFLAGS="-Xcompiler $PTHREAD_CFLAGS"])
  1285. AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
  1286. LIBS="$LIBS $PTHREAD_LIBS"
  1287. ],[
  1288. ENABLED_SINGLETHREADED=yes
  1289. ])
  1290. ])
  1291. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xyes" ],[ AM_CFLAGS="$AM_CFLAGS -DSINGLE_THREADED" ])
  1292. # Enable rwlock
  1293. AC_ARG_ENABLE([rwlock],
  1294. [AS_HELP_STRING([--enable-rwlock],[Enable use of rwlock (default: disabled)])],
  1295. [ENABLED_RWLOCK=$enableval],
  1296. [ENABLED_RWLOCK=no])
  1297. if test "$ENABLED_RWLOCK" = "yes"
  1298. then
  1299. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_USE_RWLOCK"
  1300. fi
  1301. # wolfCrypt Only Build
  1302. AC_ARG_ENABLE([cryptonly],
  1303. [AS_HELP_STRING([--enable-cryptonly],[Enable wolfCrypt Only build (default: disabled)])],
  1304. [ENABLED_CRYPTONLY=$enableval],
  1305. [ENABLED_CRYPTONLY=no])
  1306. AS_IF([test "x$FIPS_VERSION" = "xrand"],[ENABLED_CRYPTONLY="yes"])
  1307. # ECH
  1308. AC_ARG_ENABLE([ech],
  1309. [AS_HELP_STRING([--enable-ech],[Enable ECH (default: disabled)])],
  1310. [ ENABLED_ECH=$enableval ],
  1311. [ ENABLED_ECH=no ]
  1312. )
  1313. if test "$ENABLED_ECH" = "yes"
  1314. then
  1315. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECH"
  1316. test "$enable_hpke" = "" && enable_hpke=yes
  1317. test "$enable_ecc" = "" && enable_ecc=yes
  1318. test "$enable_curve25519" = "" && enable_curve25519=yes
  1319. test "$enable_sha256" = "" && enable_sha256=yes
  1320. test "$enable_tlsx" = "" && enable_tlsx=yes
  1321. test "$enable_sni" = "" && enable_sni=yes
  1322. test "$enable_tls13" = "" && enable_tls13=yes
  1323. fi
  1324. # DTLS
  1325. # DTLS is a prereq for the options mcast, sctp, and jni. Enabling any of those
  1326. # without DTLS will also enable DTLS.
  1327. AC_ARG_ENABLE([dtls],
  1328. [AS_HELP_STRING([--enable-dtls],[Enable wolfSSL DTLS (default: disabled)])],
  1329. [ ENABLED_DTLS=$enableval ],
  1330. [ ENABLED_DTLS=no ]
  1331. )
  1332. if test "$ENABLED_DTLS" = "yes"
  1333. then
  1334. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS"
  1335. fi
  1336. # DTLS change MTU
  1337. AC_ARG_ENABLE([dtls-mtu],
  1338. [AS_HELP_STRING([--enable-dtls-mtu],[Enable setting the MTU size for wolfSSL DTLS (default: disabled)])],
  1339. [ ENABLED_DTLS_MTU=$enableval ],
  1340. [ ENABLED_DTLS_MTU=no ]
  1341. )
  1342. if test "$ENABLED_DTLS_MTU" = "yes"
  1343. then
  1344. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS_MTU"
  1345. fi
  1346. # KeyLog file export
  1347. AC_ARG_ENABLE([keylog-export],
  1348. [AS_HELP_STRING([--enable-keylog-export],[Enable insecure export of TLS secrets to an NSS keylog file (default: disabled)])],
  1349. [ ENABLED_KEYLOG_EXPORT=$enableval ],
  1350. [ ENABLED_KEYLOG_EXPORT=no ]
  1351. )
  1352. if test "$ENABLED_KEYLOG_EXPORT" = "yes"
  1353. then
  1354. AC_MSG_WARN([Keylog export enabled -- Sensitive key data will be stored insecurely.])
  1355. AM_CFLAGS="$AM_CFLAGS -DSHOW_SECRETS -DHAVE_SECRET_CALLBACK -DWOLFSSL_SSLKEYLOGFILE -DWOLFSSL_KEYLOG_EXPORT_WARNED"
  1356. fi
  1357. # TLS v1.3 Draft 18 (Note: only final TLS v1.3 supported, here for backwards build compatibility)
  1358. AC_ARG_ENABLE([tls13-draft18],
  1359. [AS_HELP_STRING([--enable-tls13-draft18],[Enable wolfSSL TLS v1.3 Draft 18 (default: disabled)])],
  1360. [ ENABLED_TLS13_DRAFT18=$enableval ],
  1361. [ ENABLED_TLS13_DRAFT18=no ]
  1362. )
  1363. # TLS v1.3
  1364. AC_ARG_ENABLE([tls13],
  1365. [AS_HELP_STRING([--enable-tls13],[Enable wolfSSL TLS v1.3 (default: enabled)])],
  1366. [ ENABLED_TLS13=$enableval ],
  1367. [ ENABLED_TLS13=yes ]
  1368. )
  1369. if test "x$FIPS_VERSION" = "xv1" ||
  1370. ( test "$HAVE_FIPS_VERSION" = 2 && test "$HAVE_FIPS_VERSION_MINOR" = 1 ) ||
  1371. test "$ENABLED_CRYPTONLY" = "yes"
  1372. then
  1373. ENABLED_TLS13="no"
  1374. fi
  1375. # QUIC support
  1376. AC_ARG_ENABLE([quic],
  1377. [AS_HELP_STRING([--enable-quic],[Enable QUIC API with wolfSSL TLS v1.3 (default: disabled)])],
  1378. [ ENABLED_QUIC=$enableval ],
  1379. [ ENABLED_QUIC=no ]
  1380. )
  1381. if test "$ENABLED_QUIC" = "yes"
  1382. then
  1383. if test "x$ENABLED_TLS13" = "xno"
  1384. then
  1385. AC_MSG_ERROR([TLS 1.3 is disabled - necessary for QUIC])
  1386. fi
  1387. if test "$enable_aesgcm" = "no"
  1388. then
  1389. AC_MSG_ERROR([AES-GCM is disabled - necessary for QUIC])
  1390. fi
  1391. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_QUIC"
  1392. # QUIC proto handlers need app_data at WOLFSSL*
  1393. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
  1394. fi
  1395. # Post-handshake Authentication
  1396. AC_ARG_ENABLE([postauth],
  1397. [AS_HELP_STRING([--enable-postauth],[Enable wolfSSL Post-handshake Authentication (default: disabled)])],
  1398. [ ENABLED_TLS13_POST_AUTH=$enableval ],
  1399. [ ENABLED_TLS13_POST_AUTH=no ]
  1400. )
  1401. if test "$ENABLED_TLS13_POST_AUTH" = "yes"
  1402. then
  1403. if test "x$ENABLED_TLS13" = "xno"
  1404. then
  1405. AC_MSG_NOTICE([TLS 1.3 is disabled - disabling Post-handshake Authentication])
  1406. ENABLED_TLS13_POST_AUTH="no"
  1407. else
  1408. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_POST_HANDSHAKE_AUTH"
  1409. fi
  1410. fi
  1411. # Hello Retry Request Cookie
  1412. AC_ARG_ENABLE([hrrcookie],
  1413. [AS_HELP_STRING([--enable-hrrcookie],[Enable the server to send Cookie Extension in HRR with state (default: disabled)])],
  1414. [ ENABLED_SEND_HRR_COOKIE=$enableval ],
  1415. [ ENABLED_SEND_HRR_COOKIE=undefined ]
  1416. )
  1417. if test "$ENABLED_SEND_HRR_COOKIE" = "yes"
  1418. then
  1419. if test "x$ENABLED_TLS13" = "xno"
  1420. then
  1421. AC_MSG_NOTICE([TLS 1.3 is disabled - disabling HRR Cookie])
  1422. ENABLED_SEND_HRR_COOKIE="no"
  1423. else
  1424. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SEND_HRR_COOKIE"
  1425. fi
  1426. fi
  1427. # RNG
  1428. AC_ARG_ENABLE([rng],
  1429. [AS_HELP_STRING([--enable-rng],[Enable compiling and using RNG (default: enabled)])],
  1430. [ ENABLED_RNG=$enableval ],
  1431. [ ENABLED_RNG=yes ]
  1432. )
  1433. if test "$ENABLED_RNG" = "no"
  1434. then
  1435. AM_CFLAGS="$AM_CFLAGS -DWC_NO_RNG"
  1436. fi
  1437. # DTLS-SCTP
  1438. AC_ARG_ENABLE([sctp],
  1439. [AS_HELP_STRING([--enable-sctp],[Enable wolfSSL DTLS-SCTP support (default: disabled)])],
  1440. [ENABLED_SCTP=$enableval],
  1441. [ENABLED_SCTP=no])
  1442. AS_IF([test "x$ENABLED_SCTP" = "xyes"],
  1443. [AC_MSG_CHECKING([for SCTP])
  1444. AC_RUN_IFELSE(
  1445. [AC_LANG_PROGRAM(
  1446. [[
  1447. #include <sys/socket.h>
  1448. #include <arpa/inet.h>
  1449. ]],
  1450. [[int s = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); if (s == -1) return 1;]])],
  1451. [AC_MSG_RESULT(yes)],
  1452. [AC_MSG_RESULT(no)
  1453. AC_MSG_ERROR([SCTP not available, remove enable-sctp from configure])],
  1454. : ,
  1455. : ,
  1456. : )])
  1457. # DTLS-SRTP
  1458. AC_ARG_ENABLE([srtp],
  1459. [AS_HELP_STRING([--enable-srtp],[Enable wolfSSL DTLS-SRTP support (default: disabled)])],
  1460. [ENABLED_SRTP=$enableval],
  1461. [ENABLED_SRTP=no])
  1462. # DTLS-MULTICAST
  1463. AC_ARG_ENABLE([mcast],
  1464. [AS_HELP_STRING([--enable-mcast],[Enable wolfSSL DTLS multicast support (default: disabled)])],
  1465. [ENABLED_MCAST=$enableval],
  1466. [ENABLED_MCAST=no])
  1467. # List of open source project defines using our openssl compatibility layer:
  1468. # bind dns (--enable-bind) WOLFSSL_BIND
  1469. # libssh2 (--enable-libssh2)
  1470. # openssh (--enable-openssh) WOLFSSL_OPENSSH
  1471. # openvpn (--enable-openvpn) WOLFSSL_OPENVPN
  1472. # nginx (--enable-nginx) WOLFSSL_NGINX
  1473. # ntp (--enable-ntp)
  1474. # openresty (--enable-openresty)
  1475. # haproxy (--enable-haproxy) WOLFSSL_HAPROXY
  1476. # wpa_supplicant (--enable-wpas) WOLFSSL_WPAS
  1477. # ssl fortress (--enable-fortress) FORTRESS
  1478. # ssl bump (--enable-bump)
  1479. # signal (--enable-signal)
  1480. # lighty (--enable-lighty) HAVE_LIGHTY
  1481. # rsyslog (--enable-rsyslog)
  1482. # stunnel (--enable-stunnel) HAVE_STUNNEL
  1483. # curl (--enable-curl) HAVE_CURL
  1484. # libest (--enable-libest) HAVE_LIBEST
  1485. # asio (--enable-asio) WOLFSSL_ASIO
  1486. # libwebsockets (--enable-libwebsockets) WOLFSSL_LIBWEBSOCKETS
  1487. # qt (--enable-qt) WOLFSSL_QT
  1488. # qt test (--enable-qt-test) WOLFSSL_QT_TEST
  1489. # HAVE_POCO_LIB
  1490. # WOLFSSL_MYSQL_COMPATIBLE
  1491. # web server (--enable-webserver) HAVE_WEBSERVER
  1492. # net-snmp (--enable-net-snmp)
  1493. # krb (--enable-krb) WOLFSSL_KRB
  1494. # FFmpeg (--enable-ffmpeg) WOLFSSL_FFMPEG
  1495. # strongSwan (--enable-strongswan)
  1496. # OpenLDAP (--enable-openldap)
  1497. # hitch (--enable-hitch)
  1498. # memcached (--enable-memcached)
  1499. # Bind DNS compatibility Build
  1500. AC_ARG_ENABLE([bind],
  1501. [AS_HELP_STRING([--enable-bind],[Enable Bind DNS compatibility build (default: disabled)])],
  1502. [ENABLED_BIND=$enableval],
  1503. [ENABLED_BIND=no])
  1504. AC_ARG_ENABLE([libssh2],
  1505. [AS_HELP_STRING([--enable-libssh2],[Enable libssh2 compatibility build (default: disabled)])],
  1506. [ENABLED_LIBSSH2=$enableval],
  1507. [ENABLED_LIBSSH2=no])
  1508. # OpenSSH compatibility Build
  1509. AC_ARG_ENABLE([openssh],
  1510. [AS_HELP_STRING([--enable-openssh],[Enable OpenSSH compatibility build (default: disabled)])],
  1511. [ENABLED_OPENSSH=$enableval],
  1512. [ENABLED_OPENSSH=no])
  1513. # OpenVPN compatibility Build
  1514. AC_ARG_ENABLE([openvpn],
  1515. [AS_HELP_STRING([--enable-openvpn],[Enable OpenVPN compatibility build (default: disabled)])],
  1516. [ENABLED_OPENVPN=$enableval],
  1517. [ENABLED_OPENVPN=no])
  1518. # openresty compatibility build
  1519. AC_ARG_ENABLE([openresty],
  1520. [AS_HELP_STRING([--enable-openresty],[Enable openresty (default: disabled)])],
  1521. [ ENABLED_OPENRESTY=$enableval ],
  1522. [ ENABLED_OPENRESTY=no ]
  1523. )
  1524. # nginx compatibility build
  1525. AC_ARG_ENABLE([nginx],
  1526. [AS_HELP_STRING([--enable-nginx],[Enable nginx (default: disabled)])],
  1527. [ ENABLED_NGINX=$enableval ],
  1528. [ ENABLED_NGINX=no ]
  1529. )
  1530. # chrony support. Needs the compatibility layer for SNI callback functionality,
  1531. # but otherwise uses pure wolfCrypt.
  1532. AC_ARG_ENABLE([chrony],
  1533. [AS_HELP_STRING([--enable-chrony],[Enable chrony support (default: disabled)])],
  1534. [ ENABLED_CHRONY=$enableval ],
  1535. [ ENABLED_CHRONY=no ]
  1536. )
  1537. if test "$ENABLED_CHRONY" = "yes"
  1538. then
  1539. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  1540. fi
  1541. if test "$ENABLED_OPENRESTY" = "yes"
  1542. then
  1543. ENABLED_NGINX="yes"
  1544. fi
  1545. # OpenLDAP support
  1546. AC_ARG_ENABLE([openldap],
  1547. [AS_HELP_STRING([--enable-openldap],[Enable OpenLDAP support (default: disabled)])],
  1548. [ ENABLED_OPENLDAP=$enableval ],
  1549. [ ENABLED_OPENLDAP=no ]
  1550. )
  1551. # lighty Support
  1552. AC_ARG_ENABLE([lighty],
  1553. [AS_HELP_STRING([--enable-lighty],[Enable lighttpd/lighty (default: disabled)])],
  1554. [ ENABLED_LIGHTY=$enableval ],
  1555. [ ENABLED_LIGHTY=no ]
  1556. )
  1557. # rsyslog Support
  1558. AC_ARG_ENABLE([rsyslog],
  1559. [AS_HELP_STRING([--enable-rsyslog],[Enable rsyslog (default: disabled)])],
  1560. [ ENABLED_RSYSLOG=$enableval ],
  1561. [ ENABLED_RSYSLOG=no ]
  1562. )
  1563. # haproxy compatibility build
  1564. AC_ARG_ENABLE([haproxy],
  1565. [AS_HELP_STRING([--enable-haproxy],[Enable haproxy (default: disabled)])],
  1566. [ ENABLED_HAPROXY=$enableval ],
  1567. [ ENABLED_HAPROXY=no ]
  1568. )
  1569. # wpa_supplicant support
  1570. AC_ARG_ENABLE([wpas],
  1571. [AS_HELP_STRING([--enable-wpas],[Enable wpa_supplicant support (default: disabled)])],
  1572. [ ENABLED_WPAS=$enableval ],
  1573. [ ENABLED_WPAS=no ]
  1574. )
  1575. # wpa_supplicant support
  1576. AC_ARG_ENABLE([wpas-dpp],
  1577. [AS_HELP_STRING([--enable-wpas-dpp],[Enable wpa_supplicant support with dpp (default: disabled)])],
  1578. [ ENABLED_WPAS_DPP=$enableval ],
  1579. [ ENABLED_WPAS_DPP=no ]
  1580. )
  1581. if test "$ENABLED_WPAS_DPP" = "yes"
  1582. then
  1583. ENABLED_WPAS="yes"
  1584. fi
  1585. # ntp support
  1586. AC_ARG_ENABLE([ntp],
  1587. [AS_HELP_STRING([--enable-ntp],[Enable ntp support (default: disabled)])],
  1588. [ ENABLED_NTP=$enableval ],
  1589. [ ENABLED_NTP=no ]
  1590. )
  1591. # Fortress build
  1592. AC_ARG_ENABLE([fortress],
  1593. [AS_HELP_STRING([--enable-fortress],[Enable SSL fortress build (default: disabled)])],
  1594. [ ENABLED_FORTRESS=$enableval ],
  1595. [ ENABLED_FORTRESS=no ]
  1596. )
  1597. # libwebsockets Support
  1598. AC_ARG_ENABLE([libwebsockets],
  1599. [AS_HELP_STRING([--enable-libwebsockets],[Enable libwebsockets (default: disabled)])],
  1600. [ ENABLED_LIBWEBSOCKETS=$enableval ],
  1601. [ ENABLED_LIBWEBSOCKETS=no ]
  1602. )
  1603. if test "$ENABLED_LIBWEBSOCKETS" = "yes"
  1604. then
  1605. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LIBWEBSOCKETS -DHAVE_EX_DATA -DOPENSSL_NO_EC"
  1606. fi
  1607. if test "$ENABLED_OPENSSH" = "yes"
  1608. then
  1609. ENABLED_FORTRESS="yes"
  1610. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_OPENSSH -DHAVE_EX_DATA -DWOLFSSL_BASE16"
  1611. fi
  1612. # net-snmp Build
  1613. AC_ARG_ENABLE([net-snmp],
  1614. [AS_HELP_STRING([--enable-net-snmp],[Enable net-snmp (default: disabled)])],
  1615. [ ENABLED_NETSNMP=$enableval ],
  1616. [ ENABLED_NETSNMP=no ]
  1617. )
  1618. # kerberos 5 Build
  1619. AC_ARG_ENABLE([krb],
  1620. [AS_HELP_STRING([--enable-krb],[Enable kerberos 5 support (default: disabled)])],
  1621. [ ENABLED_KRB=$enableval ],
  1622. [ ENABLED_KRB=no ]
  1623. )
  1624. # FFmpeg Build
  1625. AC_ARG_ENABLE([ffmpeg],
  1626. [AS_HELP_STRING([--enable-ffmpeg],[Enable FFmpeg support (default: disabled)])],
  1627. [ ENABLED_FFMPEG=$enableval ],
  1628. [ ENABLED_FFMPEG=no ]
  1629. )
  1630. #IP alternative name Support
  1631. AC_ARG_ENABLE([ip-alt-name],
  1632. [AS_HELP_STRING([--enable-ip-alt-name],[Enable IP subject alternative name (default: disabled)])],
  1633. [ ENABLE_IP_ALT_NAME=$enableval ],
  1634. [ ENABLE_IP_ALT_NAME=no ]
  1635. )
  1636. if test "$ENABLE_IP_ALT_NAME" = "yes"
  1637. then
  1638. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_IP_ALT_NAME"
  1639. fi
  1640. #Qt Support
  1641. AC_ARG_ENABLE([qt],
  1642. [AS_HELP_STRING([--enable-qt],[Enable qt (default: disabled)])],
  1643. [ ENABLED_QT=$enableval ],
  1644. [ ENABLED_QT=no ]
  1645. )
  1646. # ssl bump build
  1647. AC_ARG_ENABLE([bump],
  1648. [AS_HELP_STRING([--enable-bump],[Enable SSL Bump build (default: disabled)])],
  1649. [ ENABLED_BUMP=$enableval ],
  1650. [ ENABLED_BUMP=no ]
  1651. )
  1652. # SNIFFER
  1653. AC_ARG_ENABLE([sniffer],
  1654. [AS_HELP_STRING([--enable-sniffer],[Enable wolfSSL sniffer support (default: disabled)])],
  1655. [ ENABLED_SNIFFER=$enableval ],
  1656. [ ENABLED_SNIFFER=no ]
  1657. )
  1658. # signal compatibility build
  1659. AC_ARG_ENABLE([signal],
  1660. [AS_HELP_STRING([--enable-signal],[Enable signal (default: disabled)])],
  1661. [ ENABLED_SIGNAL=$enableval ],
  1662. [ ENABLED_SIGNAL=no ]
  1663. )
  1664. # strongSwan support
  1665. AC_ARG_ENABLE([strongswan],
  1666. [AS_HELP_STRING([--enable-strongswan],[Enable strongSwan support (default: disabled)])],
  1667. [ ENABLED_STRONGSWAN=$enableval ],
  1668. [ ENABLED_STRONGSWAN=no ]
  1669. )
  1670. # hitch support
  1671. AC_ARG_ENABLE([hitch],
  1672. [AS_HELP_STRING([--enable-hitch],[Enable hitch support (default: disabled)])],
  1673. [ ENABLED_HITCH=$enableval ],
  1674. [ ENABLED_HITCH=no ]
  1675. )
  1676. # memcached support
  1677. AC_ARG_ENABLE([memcached],
  1678. [AS_HELP_STRING([--enable-memcached],[Enable memcached support (default: disabled)])],
  1679. [ ENABLED_MEMCACHED=$enableval ],
  1680. [ ENABLED_MEMCACHED=no ]
  1681. )
  1682. # OpenSSL Coexist
  1683. AC_ARG_ENABLE([opensslcoexist],
  1684. [AS_HELP_STRING([--enable-opensslcoexist],[Enable coexistence of wolfssl/openssl (default: disabled)])],
  1685. [ ENABLED_OPENSSLCOEXIST=$enableval ],
  1686. [ ENABLED_OPENSSLCOEXIST=no ]
  1687. )
  1688. if test "x$ENABLED_OPENSSLCOEXIST" = "xyes" || test "$ENABLED_WOLFENGINE" = "yes"
  1689. then
  1690. # make sure old names are disabled (except RNG)
  1691. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_WC_NAMES -DNO_OLD_SSL_NAMES"
  1692. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_SHA_NAMES -DNO_OLD_MD5_NAME"
  1693. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_COEXIST"
  1694. fi
  1695. # S/MIME
  1696. AC_ARG_ENABLE([smime],
  1697. [AS_HELP_STRING([--enable-smime],[Enable S/MIME (default: disabled)])],
  1698. [ ENABLED_SMIME=$enableval ],
  1699. [ ENABLED_SMIME=no ]
  1700. )
  1701. # Platform Security Architecture (PSA)
  1702. AC_ARG_ENABLE([psa],
  1703. [AS_HELP_STRING([--enable-psa],[use Platform Security Architecture (PSA) interface (default: disabled)])],
  1704. [ ENABLED_PSA=$enableval ],
  1705. [ ENABLED_PSA=no ]
  1706. )
  1707. AC_ARG_WITH([psa-include],
  1708. [AS_HELP_STRING([--with-psa-include=PATH],
  1709. [PATH to directory with PSA header files])],
  1710. [PSA_INCLUDE=$withval],
  1711. [PSA_INCLUDE=""])
  1712. AC_ARG_WITH([psa-lib],
  1713. [AS_HELP_STRING([--with-psa-lib=PATH],[PATH to directory with the PSA library])],
  1714. [PSA_LIB=$withval],
  1715. [PSA_LIB=""])
  1716. AC_ARG_WITH([psa-lib-name],
  1717. [AS_HELP_STRING([--with-psa-lib-name=NAME],[NAME of PSA library])],
  1718. [PSA_LIB_NAME=$withval],
  1719. [PSA_LIB_NAME=""])
  1720. AC_ARG_ENABLE([psa-lib-static],
  1721. [AS_HELP_STRING([--enable-psa-lib-static],[Link PSA as static library (default: disable)])],
  1722. [ ENABLED_PSA_STATIC=$enableval ],
  1723. [ ENABLED_PSA_STATIC=no ]
  1724. )
  1725. if test "x$ENABLED_PSA" = "xyes"
  1726. then
  1727. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_PSA"
  1728. fi
  1729. if test "x$ENABLED_PSA" != "xyes" && \
  1730. (test "x$PSA_LIB" != "x" || test "x$PSA_INCLUDE" != "x" || test "x$PSA_LIB_NAME" != "x" )
  1731. then
  1732. AC_MSG_ERROR([to use PSA you need to enable it with --enable-psa])
  1733. fi
  1734. if test -n "$PSA_LIB"
  1735. then
  1736. AC_MSG_CHECKING([for $PSA_LIB])
  1737. if ! test -d "$PSA_LIB"
  1738. then
  1739. AC_MSG_ERROR([PSA lib dir $PSA_LIB not found.])
  1740. fi
  1741. AC_MSG_RESULT([yes])
  1742. AM_LDFLAGS="$AM_LDFLAGS -L$PSA_LIB"
  1743. fi
  1744. if test -n "$PSA_LIB_NAME"
  1745. then
  1746. if test "x$ENABLED_PSA_STATIC" = "xyes"
  1747. then
  1748. LIB_STATIC_ADD="$LIB_STATIC_ADD $PSA_LIB/$PSA_LIB_NAME"
  1749. else
  1750. LIB_ADD="$LIB_ADD -l$PSA_LIB_NAME"
  1751. fi
  1752. fi
  1753. if test -n "$PSA_INCLUDE"
  1754. then
  1755. AC_MSG_CHECKING([for $PSA_INCLUDE])
  1756. if ! test -d "$PSA_INCLUDE"
  1757. then
  1758. AC_MSG_ERROR([psa include dir $PSA_INCLUDE not found.])
  1759. fi
  1760. AC_MSG_RESULT([yes])
  1761. AM_CFLAGS="$AM_CFLAGS -I$PSA_INCLUDE"
  1762. fi
  1763. AC_SUBST([PSA_LIB])
  1764. AC_SUBST([PSA_LIB_NAME])
  1765. AC_SUBST([PSA_INCLUDE])
  1766. # OPENSSL Compatibility ALL
  1767. AC_ARG_ENABLE([opensslall],
  1768. [AS_HELP_STRING([--enable-opensslall],[Enable all OpenSSL API, size++ (default: disabled)])],
  1769. [ ENABLED_OPENSSLALL=$enableval ],
  1770. [ ENABLED_OPENSSLALL=no ]
  1771. )
  1772. if test "$ENABLED_LIBWEBSOCKETS" = "yes" || test "$ENABLED_OPENVPN" = "yes" || \
  1773. test "$ENABLED_WPAS_DPP" = "yes" || test "$ENABLED_SMIME" = "yes" || \
  1774. test "$ENABLED_HAPROXY" = "yes" || test "$ENABLED_BIND" = "yes" || \
  1775. test "$ENABLED_NTP" = "yes" || test "$ENABLED_NETSNMP" = "yes" || \
  1776. test "$ENABLED_OPENRESTY" = "yes" || test "$ENABLED_RSYSLOG" = "yes" || \
  1777. test "$ENABLED_KRB" = "yes" || test "$ENABLED_CHRONY" = "yes" || \
  1778. test "$ENABLED_FFMPEG" = "yes" || test "$ENABLED_STRONGSWAN" = "yes" || \
  1779. test "$ENABLED_OPENLDAP" = "yes" || test "$ENABLED_HITCH" = "yes"
  1780. then
  1781. ENABLED_OPENSSLALL="yes"
  1782. fi
  1783. # OPENSSL Extra Compatibility
  1784. AC_ARG_ENABLE([opensslextra],
  1785. [AS_HELP_STRING([--enable-opensslextra],[Enable extra OpenSSL API, size+ (default: disabled)])],
  1786. [ ENABLED_OPENSSLEXTRA=$enableval ],
  1787. [ ENABLED_OPENSSLEXTRA=no ]
  1788. )
  1789. if test "$ENABLED_QUIC" = "yes"
  1790. then
  1791. ENABLED_OPENSSLEXTRA="yes"
  1792. fi
  1793. # One Error Queue per Thread
  1794. AC_ARG_ENABLE([error-queue-per-thread],
  1795. [AS_HELP_STRING([--enable-error-queue-per-thread],[Enable one error queue per thread. Requires thread local storage. (default: disabled)])],
  1796. [ ENABLED_ERRORQUEUEPERTHREAD=$enableval ],
  1797. [ ENABLED_ERRORQUEUEPERTHREAD=check ]
  1798. )
  1799. if test "$ENABLED_ERRORQUEUEPERTHREAD" = "check"
  1800. then
  1801. AS_IF([test "$thread_ls_on" = "no" ||
  1802. test "$ENABLED_SINGLETHREADED" = "yes"],
  1803. [ENABLED_ERRORQUEUEPERTHREAD=no],
  1804. [ENABLED_ERRORQUEUEPERTHREAD=yes])
  1805. fi
  1806. if test "$ENABLED_ERRORQUEUEPERTHREAD" = "yes"
  1807. then
  1808. if test "$thread_ls_on" != "yes"
  1809. then
  1810. AC_MSG_ERROR(error-queue-per-thread needs thread-local storage.)
  1811. fi
  1812. AM_CFLAGS="$AM_CFLAGS -DERROR_QUEUE_PER_THREAD"
  1813. fi
  1814. # High Strength Build
  1815. AC_ARG_ENABLE([maxstrength],
  1816. [AS_HELP_STRING([--enable-maxstrength],[Enable Max Strength build, allows TLSv1.2-AEAD-PFS ciphers only (default: disabled)])],
  1817. [ENABLED_MAXSTRENGTH=$enableval],
  1818. [ENABLED_MAXSTRENGTH=no])
  1819. # Harden, enable Timing Resistance and Blinding by default
  1820. AC_ARG_ENABLE([harden],
  1821. [AS_HELP_STRING([--enable-harden],[Enable Hardened build, Enables Timing Resistance and Blinding (default: enabled)])],
  1822. [ENABLED_HARDEN=$enableval],
  1823. [ENABLED_HARDEN=yes])
  1824. if test "$ENABLED_HARDEN" = "yes"
  1825. then
  1826. AM_CFLAGS="$AM_CFLAGS -DTFM_TIMING_RESISTANT -DECC_TIMING_RESISTANT"
  1827. if test "$ENABLED_RNG" = "yes"
  1828. then
  1829. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_BLINDING"
  1830. fi
  1831. else
  1832. AM_CFLAGS="$AM_CFLAGS -DWC_NO_HARDEN -DWC_NO_CACHE_RESISTANT"
  1833. fi
  1834. # IPv6 Test Apps
  1835. AC_ARG_ENABLE([ipv6],
  1836. [AS_HELP_STRING([--enable-ipv6],[Enable testing of IPV6 (default: disabled)])],
  1837. [ ENABLED_IPV6=$enableval ],
  1838. [ ENABLED_IPV6=no ]
  1839. )
  1840. if test "$ENABLED_IPV6" = "yes"
  1841. then
  1842. AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6 -DWOLFSSL_IPV6"
  1843. fi
  1844. if test "$ENABLED_WPAS" = "small"
  1845. then
  1846. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WPAS_SMALL"
  1847. fi
  1848. if test "$ENABLED_WPAS" = "yes"
  1849. then
  1850. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WPAS"
  1851. AM_CFLAGS="$AM_CFLAGS -DHAVE_SECRET_CALLBACK"
  1852. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PUBLIC_ECC_ADD_DBL"
  1853. fi
  1854. if test "$ENABLED_WPAS" != "no"
  1855. then
  1856. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_VERIFY_CB"
  1857. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  1858. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
  1859. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE"
  1860. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_EITHER_SIDE"
  1861. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA_X509_SMALL"
  1862. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PUBLIC_MP"
  1863. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DER_LOAD"
  1864. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  1865. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  1866. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB"
  1867. AM_CFLAGS="$AM_CFLAGS -DKEEP_OUR_CERT"
  1868. AM_CFLAGS="$AM_CFLAGS -DKEEP_PEER_CERT"
  1869. AM_CFLAGS="$AM_CFLAGS -DHAVE_KEYING_MATERIAL"
  1870. AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE_REF"
  1871. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_IMPORT"
  1872. AM_CFLAGS="$AM_CFLAGS -DWC_CTC_NAME_SIZE=128"
  1873. if test "$ENABLED_OPENSSLEXTRA" = "no"
  1874. then
  1875. ENABLED_OPENSSLEXTRA="yes"
  1876. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  1877. fi
  1878. fi
  1879. if test "$ENABLED_FORTRESS" = "yes"
  1880. then
  1881. AM_CFLAGS="$AM_CFLAGS -DFORTRESS -DWOLFSSL_ALWAYS_VERIFY_CB -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT -DWOLFSSL_DER_LOAD -DWOLFSSL_KEY_GEN"
  1882. fi
  1883. if test "$ENABLED_BUMP" = "yes"
  1884. then
  1885. 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"
  1886. DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS=4096
  1887. fi
  1888. # lean psk build
  1889. AC_ARG_ENABLE([leanpsk],
  1890. [AS_HELP_STRING([--enable-leanpsk],[Enable Lean PSK build (default: disabled)])],
  1891. [ ENABLED_LEANPSK=$enableval ],
  1892. [ ENABLED_LEANPSK=no ]
  1893. )
  1894. if test "$ENABLED_LEANPSK" = "yes"
  1895. then
  1896. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LEANPSK -DWOLFSSL_STATIC_PSK -DHAVE_NULL_CIPHER -DSINGLE_THREADED -DNO_AES -DNO_FILESYSTEM -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"
  1897. ENABLED_SLOWMATH="no"
  1898. ENABLED_SINGLETHREADED="yes"
  1899. enable_lowresource=yes
  1900. fi
  1901. # lean TLS build (TLS 1.2 client only (no client auth), ECC256, AES128 and SHA256 w/o Shamir)
  1902. AC_ARG_ENABLE([leantls],
  1903. [AS_HELP_STRING([--enable-leantls],[Enable Lean TLS build (default: disabled)])],
  1904. [ ENABLED_LEANTLS=$enableval ],
  1905. [ ENABLED_LEANTLS=no ]
  1906. )
  1907. if test "$ENABLED_LEANTLS" = "yes"
  1908. then
  1909. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LEANTLS -DNO_WRITEV -DHAVE_ECC -DTFM_ECC256 -DECC_USER_CURVES -DNO_WOLFSSL_SERVER -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"
  1910. enable_lowresource=yes
  1911. fi
  1912. # low resource options to reduce flash and memory use
  1913. AC_ARG_ENABLE([lowresource],
  1914. [AS_HELP_STRING([--enable-lowresource],[Enable low resource options for memory/flash (default: disabled)])],
  1915. [ ENABLED_LOWRESOURCE=$enableval ],
  1916. [ ENABLED_LOWRESOURCE=no ]
  1917. )
  1918. if test "$ENABLED_LOWRESOURCE" = "yes"
  1919. then
  1920. # low memory / flash flags
  1921. AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE -DRSA_LOW_MEM -DCURVE25519_SMALL -DED25519_SMALL -DWOLFSSL_SMALL_CERT_VERIFY -DWOLFSSL_NO_ASYNC_IO"
  1922. # low flash flags
  1923. AM_CFLAGS="$AM_CFLAGS -DUSE_SLOW_SHA -DUSE_SLOW_SHA256 -DUSE_SLOW_SHA512"
  1924. # AES small
  1925. AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL -DWOLFSSL_AES_NO_UNROLL -DWOLFSSL_AES_SMALL_TABLES"
  1926. fi
  1927. # TITAN cache
  1928. AC_ARG_ENABLE([titancache],
  1929. [AS_HELP_STRING([--enable-titancache],[Enable titan session cache (default: disabled)])],
  1930. [ ENABLED_TITANCACHE=$enableval ],
  1931. [ ENABLED_TITANCACHE=no ]
  1932. )
  1933. if test "$ENABLED_TITANCACHE" = "yes"
  1934. then
  1935. AM_CFLAGS="$AM_CFLAGS -DTITAN_SESSION_CACHE"
  1936. fi
  1937. # HUGE cache
  1938. AC_ARG_ENABLE([hugecache],
  1939. [AS_HELP_STRING([--enable-hugecache],[Enable huge session cache (default: disabled)])],
  1940. [ ENABLED_HUGECACHE=$enableval ],
  1941. [ ENABLED_HUGECACHE=no ]
  1942. )
  1943. if test "$ENABLED_HUGECACHE" = "yes"
  1944. then
  1945. AM_CFLAGS="$AM_CFLAGS -DHUGE_SESSION_CACHE"
  1946. fi
  1947. # big cache
  1948. AC_ARG_ENABLE([bigcache],
  1949. [AS_HELP_STRING([--enable-bigcache],[Enable big session cache (default: disabled)])],
  1950. [ ENABLED_BIGCACHE=$enableval ],
  1951. [ ENABLED_BIGCACHE=no ]
  1952. )
  1953. if test "$ENABLED_BIGCACHE" = "yes"
  1954. then
  1955. AM_CFLAGS="$AM_CFLAGS -DBIG_SESSION_CACHE"
  1956. fi
  1957. # SMALL cache
  1958. AC_ARG_ENABLE([smallcache],
  1959. [AS_HELP_STRING([--enable-smallcache],[Enable small session cache (default: disabled)])],
  1960. [ ENABLED_SMALLCACHE=$enableval ],
  1961. [ ENABLED_SMALLCACHE=no ]
  1962. )
  1963. if test "$ENABLED_SMALLCACHE" = "yes"
  1964. then
  1965. AM_CFLAGS="$AM_CFLAGS -DSMALL_SESSION_CACHE"
  1966. fi
  1967. # Persistent session cache
  1968. AC_ARG_ENABLE([savesession],
  1969. [AS_HELP_STRING([--enable-savesession],[Enable persistent session cache (default: disabled)])],
  1970. [ ENABLED_SAVESESSION=$enableval ],
  1971. [ ENABLED_SAVESESSION=no ]
  1972. )
  1973. if test "$ENABLED_SAVESESSION" = "yes"
  1974. then
  1975. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  1976. fi
  1977. # Persistent cert cache
  1978. AC_ARG_ENABLE([savecert],
  1979. [AS_HELP_STRING([--enable-savecert],[Enable persistent cert cache (default: disabled)])],
  1980. [ ENABLED_SAVECERT=$enableval ],
  1981. [ ENABLED_SAVECERT=no ]
  1982. )
  1983. if test "$ENABLED_SAVECERT" = "yes"
  1984. then
  1985. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  1986. fi
  1987. # Write duplicate WOLFSSL object
  1988. AC_ARG_ENABLE([writedup],
  1989. [AS_HELP_STRING([--enable-writedup],[Enable write duplication of WOLFSSL objects (default: disabled)])],
  1990. [ ENABLED_WRITEDUP=$enableval ],
  1991. [ ENABLED_WRITEDUP=no ]
  1992. )
  1993. if test "$ENABLED_WRITEDUP" = "yes"
  1994. then
  1995. AM_CFLAGS="$AM_CFLAGS -DHAVE_WRITE_DUP"
  1996. fi
  1997. # Atomic User Record Layer
  1998. AC_ARG_ENABLE([atomicuser],
  1999. [AS_HELP_STRING([--enable-atomicuser],[Enable Atomic User Record Layer (default: disabled)])],
  2000. [ ENABLED_ATOMICUSER=$enableval ],
  2001. [ ENABLED_ATOMICUSER=no ]
  2002. )
  2003. if test "$ENABLED_ATOMICUSER" = "yes"
  2004. then
  2005. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  2006. fi
  2007. # Public Key Callbacks
  2008. AC_ARG_ENABLE([pkcallbacks],
  2009. [AS_HELP_STRING([--enable-pkcallbacks],[Enable Public Key Callbacks (default: disabled)])],
  2010. [ ENABLED_PKCALLBACKS=$enableval ],
  2011. [ ENABLED_PKCALLBACKS=no ]
  2012. )
  2013. if test "$ENABLED_PKCALLBACKS" = "yes"
  2014. then
  2015. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  2016. fi
  2017. # Maxim Integrated MAXQ10XX
  2018. ENABLED_MAXQ10XX="no"
  2019. maxqpartnumber=""
  2020. AC_ARG_WITH([maxq10xx],
  2021. [AS_HELP_STRING([--with-maxq10xx=PART],[MAXQ10XX PART Number])],
  2022. [
  2023. AC_MSG_CHECKING([for maxq10xx])
  2024. # Read the part number
  2025. maxqpartnumber=$withval
  2026. if test "$maxqpartnumber" = "MAXQ1065"; then
  2027. LIB_STATIC_ADD="$LIB_STATIC_ADD lib/libmaxq1065_api.a"
  2028. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MAXQ1065"
  2029. ENABLED_MAXQ10XX="yes"
  2030. AC_CHECK_LIB([rt], [clock_gettime])
  2031. elif test "$maxqpartnumber" = "MAXQ108x"; then
  2032. LIB_STATIC_ADD="$LIB_STATIC_ADD lib/libmaxq108x_api.a"
  2033. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MAXQ108X"
  2034. ENABLED_MAXQ10XX="yes"
  2035. AC_CHECK_LIB([rt], [clock_gettime])
  2036. else
  2037. AC_MSG_ERROR([need a valid MAXQ part number])
  2038. fi
  2039. AC_MSG_RESULT([yes])
  2040. ]
  2041. )
  2042. # Microchip/Atmel CryptoAuthLib
  2043. ENABLED_CRYPTOAUTHLIB="no"
  2044. trylibatcadir=""
  2045. AC_ARG_WITH([cryptoauthlib],
  2046. [AS_HELP_STRING([--with-cryptoauthlib=PATH],[PATH to CryptoAuthLib install (default /usr/)])],
  2047. [
  2048. AC_MSG_CHECKING([for cryptoauthlib])
  2049. CPPFLAGS="$CPPFLAGS -DWOLFSSL_ATECC508A"
  2050. LIBS="$LIBS -lcryptoauth"
  2051. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cryptoauthlib.h>]], [[ atcab_init(0); ]])],[ libatca_linked=yes ],[ libatca_linked=no ])
  2052. if test "x$libatca_linked" = "xno" ; then
  2053. if test "x$withval" != "xno" ; then
  2054. trylibatcadir=$withval
  2055. fi
  2056. if test "x$withval" = "xyes" ; then
  2057. trylibatcadir="/usr"
  2058. fi
  2059. LDFLAGS="$LDFLAGS -L$trylibatcadir/lib"
  2060. CPPFLAGS="$CPPFLAGS -I$trylibatcadir/lib"
  2061. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cryptoauthlib.h>]], [[ atcab_init(0); ]])],[ libatca_linked=yes ],[ libatca_linked=no ])
  2062. if test "x$libatca_linked" = "xno" ; then
  2063. AC_MSG_ERROR([cryptoauthlib isn't found.
  2064. If it's already installed, specify its path using --with-cryptoauthlib=/dir/])
  2065. fi
  2066. AM_LDFLAGS="$AM_LDFLAGS -L$trylibatcadir/lib"
  2067. AM_CFLAGS="$AM_CFLAGS -I$trylibatcadir/lib"
  2068. AC_MSG_RESULT([yes])
  2069. else
  2070. AC_MSG_RESULT([yes])
  2071. fi
  2072. ENABLED_CRYPTOAUTHLIB="yes"
  2073. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ATECC508A"
  2074. ]
  2075. )
  2076. # NXP SE050
  2077. # Example: "./configure --with-se050=/home/pi/simw_top"
  2078. ENABLED_SE050="no"
  2079. trylibse050dir=""
  2080. AC_ARG_WITH([se050],
  2081. [AS_HELP_STRING([--with-se050=PATH],[PATH to SE050 install (default /usr/local)])],
  2082. [
  2083. AC_MSG_CHECKING([for SE050])
  2084. LIBS="$LIBS -lSSS_APIs"
  2085. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <fsl_sss_api.h>]], [[ sss_mac_init(0);]])],[ libse050_linked=yes ],[ libse050_linked=no ])
  2086. if test "x$libse050_linked" = "xno" ; then
  2087. if test "x$withval" != "xno" ; then
  2088. trylibse050dir=$withval
  2089. fi
  2090. if test "x$withval" = "xyes" ; then
  2091. trylibse050dir="/usr/local"
  2092. fi
  2093. LDFLAGS="$LDFLAGS -L$trylibse050dir/lib"
  2094. LDFLAGS="$LDFLAGS -L$trylibse050dir/build/sss"
  2095. CPPFLAGS="$CPPFLAGS -I$trylibse050dir/include/se05x"
  2096. CPPFLAGS="$CPPFLAGS -I$trylibse050dir/build"
  2097. CPPFLAGS="$CPPFLAGS -I$trylibse050dir/sss/inc"
  2098. CPPFLAGS="$CPPFLAGS -I$trylibse050dir/sss/ex/inc"
  2099. CPPFLAGS="$CPPFLAGS -I$trylibse050dir/sss/port/default"
  2100. CPPFLAGS="$CPPFLAGS -I$trylibse050dir/hostlib/hostLib/inc"
  2101. CPPFLAGS="$CPPFLAGS -I$trylibse050dir/hostlib/hostLib/libCommon/log"
  2102. CPPFLAGS="$CPPFLAGS -I$trylibse050dir/hostlib/hostLib/libCommon/infra"
  2103. CPPFLAGS="$CPPFLAGS -I$trylibse050dir/hostlib/hostLib/se05x_03_xx_xx"
  2104. if test -e "$trylibse050dir/build/sss/libSSS_APIs.a"; then
  2105. SE050_STATIC=yes
  2106. else
  2107. SE050_STATIC=no
  2108. fi
  2109. if test "x$SE050_STATIC" = "xyes"; then
  2110. LIB_STATIC_ADD="$trylibse050dir/build/sss/ex/src/libex_common.a \
  2111. $trylibse050dir/build/sss/libSSS_APIs.a \
  2112. $trylibse050dir/build/hostlib/hostLib/se05x/libse05x.a \
  2113. $trylibse050dir/build/hostlib/hostLib/liba7x_utils.a \
  2114. $trylibse050dir/build/hostlib/hostLib/libCommon/log/libmwlog.a \
  2115. $trylibse050dir/build/hostlib/hostLib/libCommon/libsmCom.a $LIB_STATIC_ADD"
  2116. else
  2117. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <fsl_sss_api.h>]], [[ sss_mac_init(0); ]])],[ libse050_linked=yes ],[ libse050_linked=no ])
  2118. if test "x$libse050_linked" = "xno" ; then
  2119. AC_MSG_ERROR([SE050 isn't found.
  2120. If it's already installed, specify its path using --with-se050=/dir/])
  2121. fi
  2122. fi
  2123. # Requires AES direct
  2124. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT -DHAVE_AES_ECB"
  2125. # Does not support SHA2-512 224/256
  2126. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA512_224 -DWOLFSSL_NOSHA512_256"
  2127. AC_MSG_RESULT([yes])
  2128. else
  2129. AC_MSG_RESULT([yes])
  2130. fi
  2131. ENABLED_SE050="yes"
  2132. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SE050 -DSSS_USE_FTR_FILE"
  2133. ]
  2134. )
  2135. ENABLED_SNIFFTEST=no
  2136. AS_IF([ test "x$ENABLED_SNIFFER" = "xyes" ],
  2137. [
  2138. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SNIFFER -DWOLFSSL_STATIC_EPHEMERAL"
  2139. AC_CHECK_HEADERS([pcap/pcap.h],
  2140. [ ENABLED_SNIFFTEST=yes ],
  2141. [ AC_MSG_WARN([cannot enable sniffer test without having libpcap available.]) ]
  2142. )
  2143. ])
  2144. # AES-CBC
  2145. AC_ARG_ENABLE([aescbc],
  2146. [AS_HELP_STRING([--enable-aescbc],[Enable wolfSSL AES-CBC support (default: enabled)])],
  2147. [ ENABLED_AESCBC=$enableval ],
  2148. [ ENABLED_AESCBC=yes ]
  2149. )
  2150. if test "$ENABLED_AESCBC" = "no"
  2151. then
  2152. AM_CFLAGS="$AM_CFLAGS -DNO_AES_CBC"
  2153. AM_CCASFLAGS="$AM_CCASFLAGS -DNO_AES_CBC"
  2154. fi
  2155. # AES-CBC length checks (checks that input lengths are multiples of block size)
  2156. AC_ARG_ENABLE([aescbc_length_checks],
  2157. [AS_HELP_STRING([--enable-aescbc-length-checks],[Enable AES-CBC length validity checks (default: disabled)])],
  2158. [ ENABLED_AESCBC_LENGTH_CHECKS=$enableval ],
  2159. [ ENABLED_AESCBC_LENGTH_CHECKS=no ]
  2160. )
  2161. if test "$ENABLED_AESCBC_LENGTH_CHECKS" = "yes"
  2162. then
  2163. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_CBC_LENGTH_CHECKS"
  2164. fi
  2165. # leanpsk and leantls don't need gcm
  2166. # AES-GCM
  2167. AC_ARG_ENABLE([aesgcm],
  2168. [AS_HELP_STRING([--enable-aesgcm],[Enable wolfSSL AES-GCM support (default: enabled)])],
  2169. [ ENABLED_AESGCM=$enableval ],
  2170. [ ENABLED_AESGCM=yes ]
  2171. )
  2172. AC_ARG_ENABLE([aesgcm-stream],
  2173. [AS_HELP_STRING([--enable-aesgcm-stream],[Enable wolfSSL AES-GCM support with streaming APIs (default: disabled)])],
  2174. [ ENABLED_AESGCM_STREAM=$enableval ],
  2175. [ ENABLED_AESGCM_STREAM=no ]
  2176. )
  2177. # leanpsk and leantls don't need gcm
  2178. if test "$FIPS_VERSION" = "rand" || test "$ENABLED_LEANPSK" = "yes" ||
  2179. (test "$ENABLED_LEANTLS" = "yes" && test "$ENABLED_TLS13" = "no")
  2180. then
  2181. ENABLED_AESGCM=no
  2182. fi
  2183. if test "$ENABLED_AESGCM" = "yes" && test "$ac_cv_c_bigendian" != "yes"
  2184. then
  2185. ENABLED_AESGCM="4bit"
  2186. fi
  2187. # AES-CCM
  2188. AC_ARG_ENABLE([aesccm],
  2189. [AS_HELP_STRING([--enable-aesccm],[Enable wolfSSL AES-CCM support (default: disabled)])],
  2190. [ ENABLED_AESCCM=$enableval ],
  2191. [ ENABLED_AESCCM=no ]
  2192. )
  2193. if test "$ENABLED_AESCCM" = "yes" || test "$ENABLED_WOLFENGINE" = "yes"
  2194. then
  2195. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"
  2196. AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESCCM"
  2197. fi
  2198. # AES-EAX
  2199. AC_ARG_ENABLE([aeseax],
  2200. [AS_HELP_STRING([--enable-aeseax],[Enable wolfSSL AES-EAX support (default: disabled)])],
  2201. [ ENABLED_AESEAX=$enableval ],
  2202. [ ENABLED_AESEAX=no ]
  2203. )
  2204. if test "$ENABLED_AESEAX" = "yes"
  2205. then
  2206. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_EAX"
  2207. fi
  2208. # AES-SIV (RFC 5297)
  2209. AC_ARG_ENABLE([aessiv],
  2210. [AS_HELP_STRING([--enable-aessiv],[Enable AES-SIV (RFC 5297) (default: disabled)])],
  2211. [ ENABLED_AESSIV=$enableval ],
  2212. [ ENABLED_AESSIV=no ]
  2213. )
  2214. if test "$ENABLED_CHRONY" = "yes"
  2215. then
  2216. ENABLED_AESSIV=yes
  2217. fi
  2218. # AES-CTR
  2219. AC_ARG_ENABLE([aesctr],
  2220. [AS_HELP_STRING([--enable-aesctr],[Enable wolfSSL AES-CTR support (default: disabled)])],
  2221. [ ENABLED_AESCTR=$enableval ],
  2222. [ ENABLED_AESCTR=no ]
  2223. )
  2224. if test "$ENABLED_OPENVPN" = "yes" || test "$ENABLED_LIBSSH2" = "yes" || test "$ENABLED_AESSIV" = "yes" || test "$ENABLED_WOLFENGINE" = "yes" || test "$ENABLED_AESEAX" = "yes"
  2225. then
  2226. ENABLED_AESCTR=yes
  2227. fi
  2228. if test "$ENABLED_QUIC" = "yes"
  2229. then
  2230. ENABLED_AESCTR=yes
  2231. fi
  2232. # AES-OFB
  2233. AC_ARG_ENABLE([aesofb],
  2234. [AS_HELP_STRING([--enable-aesofb],[Enable wolfSSL AES-OFB support (default: disabled)])],
  2235. [ ENABLED_AESOFB=$enableval ],
  2236. [ ENABLED_AESOFB=no ]
  2237. )
  2238. if test "$ENABLED_AESOFB" = "yes"
  2239. then
  2240. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_OFB -DWOLFSSL_AES_DIRECT"
  2241. fi
  2242. # AES-CFB
  2243. AC_ARG_ENABLE([aescfb],
  2244. [AS_HELP_STRING([--enable-aescfb],[Enable wolfSSL AES-CFB support (default: disabled)])],
  2245. [ ENABLED_AESCFB=$enableval ],
  2246. [ ENABLED_AESCFB=no ]
  2247. )
  2248. if test "$ENABLED_AESCFB" = "yes"
  2249. then
  2250. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_CFB"
  2251. fi
  2252. AC_ARG_ENABLE([aes-bitsliced],
  2253. [AS_HELP_STRING([--enable-aes-bitsliced],[Enable bitsliced implementation of AES (default: disabled)])],
  2254. [ ENABLED_AESBS=$enableval ],
  2255. [ ENABLED_AESBS=no ]
  2256. )
  2257. if test "$ENABLED_AESBS" = "yes"
  2258. then
  2259. AM_CFLAGS="$AM_CFLAGS -DWC_AES_BITSLICED -DHAVE_AES_ECB -DWOLFSSL_AES_DIRECT"
  2260. fi
  2261. # SM4
  2262. ENABLED_SM4="no"
  2263. AC_ARG_ENABLE([sm4-ecb],
  2264. [AS_HELP_STRING([--enable-sm4-ecb],[Enable wolfSSL SM4-ECB support (default: disabled)])],
  2265. [ ENABLED_SM4_ECB=$enableval ],
  2266. [ ENABLED_SM4_ECB=no ]
  2267. )
  2268. if test "$ENABLED_SM4_ECB" = "small"
  2269. then
  2270. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4_SMALL"
  2271. fi
  2272. if test "$ENABLED_SM4_ECB" != "no"
  2273. then
  2274. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4_ECB"
  2275. ENABLED_SM4="yes"
  2276. fi
  2277. AC_ARG_ENABLE([sm4-cbc],
  2278. [AS_HELP_STRING([--enable-sm4-cbc],[Enable wolfSSL SM4-CBC support (default: disabled)])],
  2279. [ ENABLED_SM4_CBC=$enableval ],
  2280. [ ENABLED_SM4_CBC=no ]
  2281. )
  2282. if test "$ENABLED_SM4_CBC" = "small"
  2283. then
  2284. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4_SMALL"
  2285. fi
  2286. if test "$ENABLED_SM4_CBC" != "no"
  2287. then
  2288. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4_CBC"
  2289. ENABLED_SM4="yes"
  2290. fi
  2291. AC_ARG_ENABLE([sm4-ctr],
  2292. [AS_HELP_STRING([--enable-sm4-ctr],[Enable wolfSSL SM4-CTR support (default: disabled)])],
  2293. [ ENABLED_SM4_CTR=$enableval ],
  2294. [ ENABLED_SM4_CTR=no ]
  2295. )
  2296. if test "$ENABLED_SM4_CTR" = "small"
  2297. then
  2298. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4_SMALL"
  2299. fi
  2300. if test "$ENABLED_SM4_CTR" != "no"
  2301. then
  2302. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4_CTR"
  2303. ENABLED_SM4="yes"
  2304. fi
  2305. AC_ARG_ENABLE([sm4-gcm],
  2306. [AS_HELP_STRING([--enable-sm4-gcm],[Enable wolfSSL SM4-GCM support (default: disabled)])],
  2307. [ ENABLED_SM4_GCM=$enableval ],
  2308. [ ENABLED_SM4_GCM=no ]
  2309. )
  2310. if test "$ENABLED_SM4_GCM" = "small"
  2311. then
  2312. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4_SMALL"
  2313. fi
  2314. if test "$ENABLED_SM4_GCM" != "no"
  2315. then
  2316. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4_GCM"
  2317. ENABLED_SM4="yes"
  2318. fi
  2319. AC_ARG_ENABLE([sm4-ccm],
  2320. [AS_HELP_STRING([--enable-sm4-ccm],[Enable wolfSSL SM4-CCM support (default: disabled)])],
  2321. [ ENABLED_SM4_CCM=$enableval ],
  2322. [ ENABLED_SM4_CCM=no ]
  2323. )
  2324. if test "$ENABLED_SM4_CCM" = "small"
  2325. then
  2326. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4_SMALL"
  2327. fi
  2328. if test "$ENABLED_SM4_CCM" != "no"
  2329. then
  2330. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4_CCM"
  2331. ENABLED_SM4="yes"
  2332. fi
  2333. if test "$ENABLED_SM4" = "yes"
  2334. then
  2335. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM4"
  2336. fi
  2337. ENABLED_ARMASM_INLINE="no"
  2338. ENABLED_ARMASM_SHA3="no"
  2339. ENABLED_ARMASM_CRYPTO_SM4="no"
  2340. # ARM Assembly
  2341. # Both SHA3 and SHA512 instructions available with ARMV8.2-a
  2342. AC_ARG_ENABLE([armasm],
  2343. [AS_HELP_STRING([--enable-armasm],[Enable wolfSSL ARMv8 ASM support (default: disabled). Set to sha512-crypto or sha3-crypto to use SHA512 and SHA3 instructions with Aarch64 CPU.])],
  2344. [ ENABLED_ARMASM=$enableval ],
  2345. [ ENABLED_ARMASM=no ]
  2346. )
  2347. if test "$ENABLED_ARMASM" != "no" && test "$ENABLED_ASM" = "yes"
  2348. then
  2349. for v in `echo $ENABLED_ARMASM | tr "," " "`
  2350. do
  2351. case $v in
  2352. yes)
  2353. ;;
  2354. inline)
  2355. ENABLED_ARMASM_INLINE=yes
  2356. ;;
  2357. sha512-crypto | sha3-crypto)
  2358. case $host_cpu in
  2359. *aarch64*)
  2360. ;;
  2361. *)
  2362. AC_MSG_ERROR([SHA512/SHA3 instructions only available on Aarch64 CPU.])
  2363. break;;
  2364. esac
  2365. ENABLED_ARMASM_SHA3=yes
  2366. ENABLED_ARMASM_PLUS=yes
  2367. ;;
  2368. sm4)
  2369. case $host_cpu in
  2370. *aarch64*)
  2371. ;;
  2372. *)
  2373. AC_MSG_ERROR([SM4 instructions only available on Aarch64 CPU.])
  2374. break;;
  2375. esac
  2376. ENABLED_ARMASM_SM4=yes
  2377. # gcc requires -march=...+sm4 to enable SM4 instructions
  2378. ENABLED_ARMASM_CRYPTO_SM4=yes
  2379. ENABLED_ARMASM_PLUS=yes
  2380. ;;
  2381. sm3)
  2382. case $host_cpu in
  2383. *aarch64*)
  2384. ;;
  2385. *)
  2386. AC_MSG_ERROR([SM3 instructions only available on Aarch64 CPU.])
  2387. break;;
  2388. esac
  2389. ENABLED_ARMASM_SM3=yes
  2390. # gcc requires -march=...+sm4 to enable SM3 instructions
  2391. ENABLED_ARMASM_CRYPTO_SM4=yes
  2392. ENABLED_ARMASM_PLUS=yes
  2393. ;;
  2394. *)
  2395. AC_MSG_ERROR([Invalid choice of ARM asm inclusions (yes, sha512-crypto, sha3-crypto): $ENABLED_ARMASM.])
  2396. break;;
  2397. esac
  2398. done
  2399. ENABLED_ARMASM="yes"
  2400. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_ARMASM"
  2401. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM -DWOLFSSL_NO_HASH_RAW"
  2402. #Check if mcpu and mfpu values already set if not use default
  2403. case $CPPFLAGS in
  2404. *mcpu* | *mfpu*)
  2405. break;; #Do not override user set values
  2406. *)
  2407. case $host_cpu in
  2408. *aarch64*)
  2409. case $host_os in
  2410. *darwin*)
  2411. # All known Aarch64 Mac computers support SHA-512 instructions
  2412. ENABLED_ARMASM_SHA3=yes
  2413. ;;
  2414. *)
  2415. # +crypto needed for hardware acceleration
  2416. if test "$ENABLED_ARMASM_PLUS" = "yes"; then
  2417. AM_CPPFLAGS="$AM_CPPFLAGS -march=armv8.2-a+crypto"
  2418. if test "$ENABLED_ARMASM_SHA3" = "yes"; then
  2419. AM_CPPFLAGS="$AM_CPPFLAGS+sha3"
  2420. fi
  2421. if test "$ENABLED_ARMASM_CRYPTO_SM4" = "yes"; then
  2422. AM_CPPFLAGS="$AM_CPPFLAGS+sm4"
  2423. fi
  2424. else
  2425. AM_CPPFLAGS="$AM_CPPFLAGS -mcpu=generic+crypto"
  2426. fi
  2427. ;;
  2428. esac
  2429. # Include options.h
  2430. AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
  2431. ENABLED_ARMASM_CRYPTO=yes
  2432. ENABLED_ARMASM_NEON=yes
  2433. # Check for and set -mstrict-align compiler flag
  2434. # Used to set assumption that Aarch64 systems will not handle
  2435. # unaligned memory references. The flag -mstrict-align is needed
  2436. # on some compiler versions to avoid an invalid addressing mode
  2437. # error with "m" constraint variables in the inline assembly AES
  2438. # code. Even though unaligned load/store access is permitted on
  2439. # normal memory with Cortex-A series boards with the exception
  2440. # being exclusive and ordered access.
  2441. case $CPPFLAGS in
  2442. *mstrict-align*)
  2443. break;; # already set by user
  2444. *)
  2445. AM_CPPFLAGS="$AM_CPPFLAGS -mstrict-align"
  2446. AC_MSG_NOTICE([64bit ARMv8, setting -mstrict-align]);;
  2447. esac
  2448. AC_MSG_NOTICE([64bit ARMv8 found, setting mcpu to generic+crypto])
  2449. ;;
  2450. armv7a* | armv7l*)
  2451. AM_CPPFLAGS="$AM_CPPFLAGS -march=armv7-a -mfpu=neon -DWOLFSSL_ARM_ARCH=7 -marm"
  2452. # Include options.h
  2453. AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
  2454. ENABLED_ARMASM_CRYPTO=no
  2455. ENABLED_AESGCM_STREAM=no # not yet implemented
  2456. ENABLED_ARMASM_NEON=yes
  2457. AC_MSG_NOTICE([32bit ARMv7-a found, setting mfpu to neon])
  2458. if test "$ENABLED_FIPS" != "no" ||
  2459. test "$HAVE_FIPS_VERSION_MAJOR" -ge 5;
  2460. then
  2461. # Use inline ASM with FIPS because of known "issue" with the
  2462. # assembly code
  2463. ENABLED_ARMASM_INLINE=yes
  2464. AC_MSG_NOTICE([32bit ARMv7-a found, setting inline for FIPS])
  2465. fi
  2466. ;;
  2467. armv7m*)
  2468. # QEMU doesn't work with armv7-m
  2469. AM_CPPFLAGS="$AM_CPPFLAGS -march=armv7-r -D__thumb__ -fomit-frame-pointer -DWOLFSSL_ARMASM_NO_HW_CRYPTO -DWOLFSSL_ARM_ARCH=7"
  2470. # Include options.h
  2471. AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
  2472. ENABLED_ARMASM_CRYPTO=no
  2473. ENABLED_AESGCM_STREAM=no # not yet implemented
  2474. ENABLED_ARMASM_NEON=no
  2475. AC_MSG_NOTICE([32bit ARMv7-m found])
  2476. if test "$ENABLED_FIPS" != "no" ||
  2477. test "$HAVE_FIPS_VERSION_MAJOR" -ge 5;
  2478. then
  2479. # Use inline ASM with FIPS because of known "issue" with the
  2480. # assembly code
  2481. ENABLED_ARMASM_INLINE=yes
  2482. AC_MSG_NOTICE([32bit ARMv7-m found, setting inline for FIPS])
  2483. fi
  2484. ;;
  2485. armv6*)
  2486. AM_CPPFLAGS="$AM_CPPFLAGS -march=armv6 -fomit-frame-pointer -DWOLFSSL_ARMASM_NO_HW_CRYPTO -DWOLFSSL_ARM_ARCH=6"
  2487. AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
  2488. ENABLED_ARMASM_CRYPTO=no
  2489. ENABLED_AESGCM_STREAM=no # not yet implemented
  2490. ENABLED_ARMASM_NEON=no
  2491. AC_MSG_NOTICE([32bit ARMv6 found])
  2492. ;;
  2493. armv4*)
  2494. AM_CPPFLAGS="$AM_CPPFLAGS -march=armv4 -fomit-frame-pointer -DWOLFSSL_ARMASM_NO_HW_CRYPTO -DWOLFSSL_ARM_ARCH=4"
  2495. AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
  2496. ENABLED_ARMASM_CRYPTO=no
  2497. ENABLED_AESGCM_STREAM=no # not yet implemented
  2498. ENABLED_ARMASM_NEON=no
  2499. AC_MSG_NOTICE([32bit ARMv4 found])
  2500. ;;
  2501. *)
  2502. AM_CPPFLAGS="$AM_CPPFLAGS -mfpu=crypto-neon-fp-armv8 -marm"
  2503. # Include options.h
  2504. AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
  2505. ENABLED_ARMASM_CRYPTO=yes
  2506. ENABLED_ARMASM_NEON=yes
  2507. AC_MSG_NOTICE([32bit ARMv8 found, setting mfpu to crypto-neon-fp-armv8])
  2508. ;;
  2509. esac
  2510. esac
  2511. fi
  2512. if test "$ENABLED_ARMASM_SHA3" = "yes"; then
  2513. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM_CRYPTO_SHA512 -DWOLFSSL_ARMASM_CRYPTO_SHA3"
  2514. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_ARMASM_CRYPTO_SHA512 -DWOLFSSL_ARMASM_CRYPTO_SHA3"
  2515. fi
  2516. if test "$ENABLED_ARMASM_SM3" = "yes"; then
  2517. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM_CRYPTO_SM3"
  2518. fi
  2519. if test "$ENABLED_ARMASM_SM4" = "yes"; then
  2520. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM_CRYPTO_SM4"
  2521. fi
  2522. if test "$ENABLED_ARMASM_CRYPTO" = "no"; then
  2523. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM_NO_HW_CRYPTO"
  2524. fi
  2525. if test "$ENABLED_ARMASM_NEON" = "no"; then
  2526. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM_NO_NEON"
  2527. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_ARMASM_NO_NEON"
  2528. fi
  2529. if test "$ENABLED_ARMASM_INLINE" = "yes"; then
  2530. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM_INLINE"
  2531. fi
  2532. # RISC-V Assembly
  2533. AC_ARG_ENABLE([riscv-asm],
  2534. [AS_HELP_STRING([--enable-riscv-asm],[Enable wolfSSL RISC-V ASM support (default: disabled).])],
  2535. [ ENABLED_RISCV_ASM=$enableval ],
  2536. [ ENABLED_RISCV_ASM=no ]
  2537. )
  2538. if test "$ENABLED_RISCV_ASM" != "no" && test "$ENABLED_ASM" = "yes"
  2539. then
  2540. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RISCV_ASM"
  2541. ENABLED_AESGCM_STREAM=no # not yet implemented
  2542. AC_MSG_NOTICE([64bit RISC-V assembly for AES])
  2543. fi
  2544. ENABLED_RISCV_ASM_OPTS=$ENABLED_RISCV_ASM
  2545. for v in `echo $ENABLED_RISCV_ASM_OPTS | tr "," " "`
  2546. do
  2547. case $v in
  2548. yes)
  2549. ;;
  2550. no)
  2551. ;;
  2552. zbkb)
  2553. # PACK, REV8
  2554. ENABLED_RISCV_ASM=yes
  2555. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RISCV_BIT_MANIPULATION"
  2556. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RISCV_BASE_BIT_MANIPULATION"
  2557. ;;
  2558. zbb)
  2559. # REV8
  2560. ENABLED_RISCV_ASM=yes
  2561. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RISCV_BASE_BIT_MANIPULATION"
  2562. ;;
  2563. zbc|zbkc)
  2564. # CLMUL, CLMULH
  2565. ENABLED_RISCV_ASM=yes
  2566. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RISCV_CARRYLESS"
  2567. ;;
  2568. zkn|zkned)
  2569. # AES encrypt/decrpyt
  2570. ENABLED_RISCV_ASM=yes
  2571. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RISCV_SCALAR_CRYPTO_ASM"
  2572. ;;
  2573. zvkg)
  2574. # VGMUL, VHHSH
  2575. ENABLED_RISCV_ASM=yes
  2576. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RISCV_VECTOR_GCM"
  2577. ;;
  2578. zvbc)
  2579. # VCLMUL, VCLMULH
  2580. ENABLED_RISCV_ASM=yes
  2581. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RISCV_VECTOR_CARRYLESS"
  2582. ;;
  2583. zvbb|zvkb)
  2584. # VBREV8
  2585. ENABLED_RISCV_ASM=yes
  2586. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RISCV_VECTOR_BASE_BIT_MANIPULATION"
  2587. ;;
  2588. zvkned)
  2589. # Vector AES
  2590. ENABLED_RISCV_ASM=yes
  2591. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RISCV_VECTOR_CRYPTO_ASM"
  2592. ;;
  2593. *)
  2594. AC_MSG_ERROR([Invalid RISC-V option [yes,zbkb,zbb,zbc,zbkc,zkn,zkned,zvkg,zvbc,zvbb,zvkb,zvkned]: $ENABLED_RISCV_ASM.])
  2595. break
  2596. ;;
  2597. esac
  2598. done
  2599. # Xilinx hardened crypto
  2600. AC_ARG_ENABLE([xilinx],
  2601. [AS_HELP_STRING([--enable-xilinx],[Enable wolfSSL support for Xilinx hardened crypto(default: disabled)])],
  2602. [ ENABLED_XILINX=$enableval ],
  2603. [ ENABLED_XILINX=no ]
  2604. )
  2605. if test "$ENABLED_XILINX" = "yes"
  2606. then
  2607. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_XILINX -DWOLFSSL_XILINX_CRYPT"
  2608. fi
  2609. # CAAM build
  2610. trylibsecodir="/usr"
  2611. AC_ARG_WITH([seco],
  2612. [AS_HELP_STRING([--with-seco=PATH],[PATH to SECO install (default /usr/lib/)])],
  2613. [
  2614. AC_MSG_CHECKING([for SECO])
  2615. if test "x$withval" != "xno" ; then
  2616. trylibsecodir=$withval
  2617. fi
  2618. ]
  2619. )
  2620. AC_ARG_ENABLE([aria],
  2621. [AS_HELP_STRING([--enable-aria],[Enable wolfSSL support for ARIA (default: disabled)])],
  2622. [ ENABLED_ARIA=$enableval ],
  2623. [ ENABLED_ARIA=no ]
  2624. )
  2625. if test "$ENABLED_ARIA" = "yes"
  2626. then
  2627. ARIA_DIR=MagicCrypto
  2628. # Enable dependency
  2629. CFLAGS="$CFLAGS -I$ARIA_DIR/include"
  2630. AM_CFLAGS="$AM_CFLAGS -DHAVE_ARIA"
  2631. AM_LDFLAGS="$AM_LDFLAGS -L$ARIA_DIR/lib -lMagicCrypto"
  2632. build_pwd="$(pwd)"
  2633. headers="mcapi_error.h mcapi_type.h mcapi.h"
  2634. for header in $headers
  2635. do
  2636. AC_CHECK_HEADER([$header], [], [
  2637. AC_MSG_ERROR([Error including $header. Please put the MagicCrypto library in $build_pwd.])
  2638. ], [
  2639. extern int dummy_int_to_make_compiler_happy;
  2640. ])
  2641. done
  2642. fi
  2643. AC_ARG_ENABLE([caam],
  2644. [AS_HELP_STRING([--enable-caam],[Enable wolfSSL support for CAAM (default: disabled)])],
  2645. [ ENABLED_CAAM=$enableval ],
  2646. [ ENABLED_CAAM=no ]
  2647. )
  2648. if test "$ENABLED_CAAM" != "no"
  2649. then
  2650. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CAAM"
  2651. for v in `echo $ENABLED_CAAM | tr "," " "`
  2652. do
  2653. case $v in
  2654. qnx)
  2655. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_QNX_CAAM"
  2656. ENABLED_CAAM_QNX="yes"
  2657. ;;
  2658. imx6q)
  2659. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_IMX6Q_CAAM"
  2660. ;;
  2661. imx6ul)
  2662. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_IMX6UL_CAAM"
  2663. ;;
  2664. seco)
  2665. SECO_DIR=$trylibsecodir
  2666. AM_CPPFLAGS="$AM_CPPFLAGS -I$SECO_DIR/include"
  2667. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CAAM -DWOLFSSL_SECO_CAAM"
  2668. AC_CHECK_LIB([hsm_lib],[hsm_open_session])
  2669. AC_CHECK_LIB([seco_nvm_manager],[seco_nvm_manager])
  2670. LIB_STATIC_ADD="$LIB_STATIC_ADD $SECO_DIR/lib/hsm_lib.a $SECO_DIR/lib/seco_nvm_manager.a"
  2671. LIB_ADD="$LIB_ADD -lz"
  2672. ;;
  2673. esac
  2674. done
  2675. fi
  2676. # INTEL AES-NI
  2677. AC_ARG_ENABLE([aesni],
  2678. [AS_HELP_STRING([--enable-aesni],[Enable wolfSSL AES-NI support (default: disabled)])],
  2679. [ ENABLED_AESNI=$enableval ],
  2680. [ ENABLED_AESNI=no ]
  2681. )
  2682. # INTEL ASM
  2683. AC_ARG_ENABLE([intelasm],
  2684. [AS_HELP_STRING([--enable-intelasm],[Enable All Intel ASM speedups (default: disabled)])],
  2685. [ ENABLED_INTELASM=$enableval ],
  2686. [ ENABLED_INTELASM=no ]
  2687. )
  2688. if test "$ENABLED_ASM" = "yes"
  2689. then
  2690. if test "$ENABLED_AESNI" = "small"
  2691. then
  2692. AM_CFLAGS="$AM_CFLAGS -DAES_GCM_AESNI_NO_UNROLL"
  2693. ENABLED_AESNI=yes
  2694. fi
  2695. if test "$ENABLED_AESNI" = "yes" || test "$ENABLED_INTELASM" = "yes"
  2696. then
  2697. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI"
  2698. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  2699. then
  2700. AM_CFLAGS="$AM_CFLAGS -DWC_C_DYNAMIC_FALLBACK"
  2701. fi
  2702. if test "$CC" != "icc"
  2703. then
  2704. case $host_os in
  2705. mingw*)
  2706. # Windows uses intrinsics for GCM which uses SSE4 instructions.
  2707. # MSVC has own build files.
  2708. AM_CFLAGS="$AM_CFLAGS -maes -msse4 -mpclmul"
  2709. ;;
  2710. *)
  2711. # Intrinsics used in AES_set_decrypt_key (TODO: rework)
  2712. AM_CFLAGS="$AM_CFLAGS -maes"
  2713. ;;
  2714. esac
  2715. fi
  2716. AS_IF([test "x$ENABLED_AESGCM" != "xno"],[AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"])
  2717. AS_IF([test "x$ENABLED_SM3" != "xno"],[AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SM3"])
  2718. fi
  2719. if test "$ENABLED_INTELASM" = "yes"
  2720. then
  2721. AM_CFLAGS="$AM_CFLAGS -DUSE_INTEL_SPEEDUP"
  2722. ENABLED_AESNI=yes
  2723. fi
  2724. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "amd64"
  2725. then
  2726. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_X86_64_BUILD"
  2727. fi
  2728. if test "$host_cpu" = "x86"
  2729. then
  2730. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_X86_BUILD"
  2731. ENABLED_X86_ASM=yes
  2732. fi
  2733. fi
  2734. AC_ARG_ENABLE([aligndata],
  2735. [AS_HELP_STRING([--enable-aligndata],[align data for ciphers (default: enabled)])],
  2736. [ ENABLED_ALIGN_DATA=$enableval ],
  2737. [ ENABLED_ALIGN_DATA=yes ]
  2738. )
  2739. if test "$ENABLED_ALIGN_DATA" = "yes"
  2740. then
  2741. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_USE_ALIGN"
  2742. fi
  2743. # INTEL RDRAND
  2744. AC_ARG_ENABLE([intelrand],
  2745. [AS_HELP_STRING([--enable-intelrand],[Enable Intel rdrand as preferred RNG source (default: disabled)])],
  2746. [ ENABLED_INTELRDRAND=$enableval ],
  2747. [ ENABLED_INTELRDRAND=no ]
  2748. )
  2749. if test "$ENABLED_INTELRDRAND" = "yes"
  2750. then
  2751. AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDRAND"
  2752. fi
  2753. # AMD RDSEED
  2754. AC_ARG_ENABLE([amdrand],
  2755. [AS_HELP_STRING([--enable-amdrand],[Enable AMD rdseed as preferred RNG seeding source (default: disabled)])],
  2756. [ ENABLED_AMDRDSEED=$enableval ],
  2757. [ ENABLED_AMDRDSEED=no ]
  2758. )
  2759. if test "$ENABLED_AMDRDSEED" = "yes"
  2760. then
  2761. AM_CFLAGS="$AM_CFLAGS -DHAVE_AMD_RDSEED"
  2762. fi
  2763. # Linux af_alg
  2764. AC_ARG_ENABLE([afalg],
  2765. [AS_HELP_STRING([--enable-afalg],[Enable Linux af_alg use for crypto (default: disabled)])],
  2766. [ ENABLED_AFALG=$enableval ],
  2767. [ ENABLED_AFALG=no ]
  2768. )
  2769. if test "$ENABLED_AFALG" = "yes"
  2770. then
  2771. if test "$ENABLED_AESCCM" = "yes"
  2772. then
  2773. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  2774. fi
  2775. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG"
  2776. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_HASH"
  2777. fi
  2778. if test "$ENABLED_AFALG" = "xilinx"
  2779. then
  2780. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX -DWOLFSSL_AFALG_XILINX_AES"
  2781. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX_SHA3 -DWOLFSSL_AFALG_XILINX_RSA"
  2782. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA3_224 -DWOLFSSL_NOSHA3_256 -DWOLFSSL_NOSHA3_512"
  2783. ENABLED_AFALG="yes"
  2784. ENABLED_XILINX="yes"
  2785. fi
  2786. if test "$ENABLED_AFALG" = "xilinx-aes"
  2787. then
  2788. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX -DWOLFSSL_AFALG_XILINX_AES"
  2789. ENABLED_AFALG="yes"
  2790. ENABLED_XILINX="yes"
  2791. fi
  2792. if test "$ENABLED_AFALG" = "xilinx-sha3"
  2793. then
  2794. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX"
  2795. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX_SHA3"
  2796. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA3_224 -DWOLFSSL_NOSHA3_256 -DWOLFSSL_NOSHA3_512"
  2797. ENABLED_AFALG="yes"
  2798. ENABLED_XILINX="yes"
  2799. fi
  2800. if test "$ENABLED_AFALG" = "xilinx-rsa"
  2801. then
  2802. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX"
  2803. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX_RSA"
  2804. ENABLED_AFALG="yes"
  2805. ENABLED_XILINX="yes"
  2806. fi
  2807. # libkcapi
  2808. AC_ARG_ENABLE([kcapi-hash],
  2809. [AS_HELP_STRING([--enable-kcapi-hash],[Enable libkcapi use for hashing (default: disabled)])],
  2810. [ ENABLED_KCAPI_HASH=$enableval ],
  2811. [ ENABLED_KCAPI_HASH=no ]
  2812. )
  2813. AC_ARG_ENABLE([kcapi-hmac],
  2814. [AS_HELP_STRING([--enable-kcapi-hmac],[Enable libkcapi use for HMAC (default: disabled)])],
  2815. [ ENABLED_KCAPI_HMAC=$enableval ],
  2816. [ ENABLED_KCAPI_HMAC=no ]
  2817. )
  2818. AC_ARG_ENABLE([kcapi-aes],
  2819. [AS_HELP_STRING([--enable-kcapi-aes],[Enable libkcapi use for AES (default: disabled)])],
  2820. [ ENABLED_KCAPI_AES=$enableval ],
  2821. [ ENABLED_KCAPI_AES=no ]
  2822. )
  2823. AC_ARG_ENABLE([kcapi-rsa],
  2824. [AS_HELP_STRING([--enable-kcapi-rsa],[Enable libkcapi use for RSA (default: disabled)])],
  2825. [ ENABLED_KCAPI_RSA=$enableval ],
  2826. [ ENABLED_KCAPI_RSA=no ]
  2827. )
  2828. AC_ARG_ENABLE([kcapi-dh],
  2829. [AS_HELP_STRING([--enable-kcapi-dh],[Enable libkcapi use for DH (default: disabled)])],
  2830. [ ENABLED_KCAPI_DH=$enableval ],
  2831. [ ENABLED_KCAPI_DH=no ]
  2832. )
  2833. AC_ARG_ENABLE([kcapi-ecc],
  2834. [AS_HELP_STRING([--enable-kcapi-ecc],[Enable libkcapi use for ECC (default: disabled)])],
  2835. [ ENABLED_KCAPI_ECC=$enableval ],
  2836. [ ENABLED_KCAPI_ECC=no ]
  2837. )
  2838. AC_ARG_ENABLE([kcapi],
  2839. [AS_HELP_STRING([--enable-kcapi],[Enable libkcapi use for crypto (default: disabled)])],
  2840. [ ENABLED_KCAPI=$enableval ],
  2841. [ ENABLED_KCAPI=no ]
  2842. )
  2843. if test "$ENABLED_KCAPI" = "yes"
  2844. then
  2845. AS_IF([test "$enable_kcapi_hash" != "no"], [ENABLED_KCAPI_HASH=yes])
  2846. AS_IF([test "$enable_kcapi_hmac" != "no"], [ENABLED_KCAPI_HMAC=yes])
  2847. AS_IF([test "$enable_kcapi_aes" != "no"], [ENABLED_KCAPI_AES=yes])
  2848. AS_IF([test "$enable_kcapi_rsa" != "no"], [ENABLED_KCAPI_RSA=yes])
  2849. AS_IF([test "$enable_kcapi_dh" != "no"], [ENABLED_KCAPI_DH=yes])
  2850. AS_IF([test "$enable_kcapi_ecc" != "no"], [ENABLED_KCAPI_ECC=yes])
  2851. fi
  2852. if test "$ENABLED_KCAPI_HASH" != "no" ||
  2853. test "$ENABLED_KCAPI_HMAC" != "no" ||
  2854. test "$ENABLED_KCAPI_AES" != "no" ||
  2855. test "$ENABLED_KCAPI_RSA" != "no" ||
  2856. test "$ENABLED_KCAPI_DH" != "no" ||
  2857. test "$ENABLED_KCAPI_ECC" != "no"
  2858. then
  2859. LIBS="$LIBS -lkcapi"
  2860. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KCAPI"
  2861. fi
  2862. if test "$ENABLED_KCAPI_HASH" = "yes"
  2863. then
  2864. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KCAPI_HASH -DWOLFSSL_KCAPI_HASH_KEEP"
  2865. # Linux Kernel doesn't support truncated SHA512 algorithms
  2866. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA512_224 -DWOLFSSL_NOSHA512_256"
  2867. fi
  2868. if test "$ENABLED_KCAPI_HMAC" = "yes"
  2869. then
  2870. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KCAPI_HMAC"
  2871. fi
  2872. if test "$ENABLED_KCAPI_AES" = "yes"
  2873. then
  2874. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KCAPI_AES"
  2875. HAVE_AESGCM_PORT=yes
  2876. if test "$ENABLED_AESCCM" = "yes"
  2877. then
  2878. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  2879. fi
  2880. if test "$ENABLED_AESGCM_STREAM" = "yes"
  2881. then
  2882. AC_MSG_ERROR([--enable-aesgcm-stream is incompatible with --enable-kcapi.])
  2883. fi
  2884. fi
  2885. if test "$ENABLED_KCAPI_RSA" = "yes"
  2886. then
  2887. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KCAPI_RSA"
  2888. fi
  2889. if test "$ENABLED_KCAPI_DH" = "yes"
  2890. then
  2891. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KCAPI_DH -DWOLFSSL_DH_EXTRA"
  2892. fi
  2893. if test "$ENABLED_KCAPI_ECC" = "yes"
  2894. then
  2895. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KCAPI_ECC"
  2896. fi
  2897. # Support for Linux dev/crypto calls
  2898. AC_ARG_ENABLE([devcrypto],
  2899. [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)])],
  2900. [ ENABLED_DEVCRYPTO=$enableval ],
  2901. [ ENABLED_DEVCRYPTO=no ]
  2902. )
  2903. if test "$ENABLED_DEVCRYPTO" = "yes" || test "$ENABLED_DEVCRYPTO" = "all"
  2904. then
  2905. #enable all devcrypto supported algorithms
  2906. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  2907. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
  2908. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_AES"
  2909. if test "$ENABLED_AESCCM" = "yes"
  2910. then
  2911. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  2912. fi
  2913. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HASH"
  2914. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_HASH_RAW"
  2915. ENABLED_DEVCRYPTO=yes
  2916. fi
  2917. if test "$ENABLED_DEVCRYPTO" = "aes"
  2918. then
  2919. #enable only AES-CBC algorithm support
  2920. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  2921. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_AES"
  2922. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
  2923. if test "$ENABLED_AESCCM" = "yes"
  2924. then
  2925. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  2926. fi
  2927. ENABLED_DEVCRYPTO=yes
  2928. fi
  2929. if test "$ENABLED_DEVCRYPTO" = "cbc"
  2930. then
  2931. #enable only AES-CBC algorithm support
  2932. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  2933. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
  2934. ENABLED_DEVCRYPTO=yes
  2935. fi
  2936. if test "$ENABLED_DEVCRYPTO" = "hash"
  2937. then
  2938. #enable only hash algorithm support
  2939. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  2940. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HASH"
  2941. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_HASH_RAW"
  2942. ENABLED_DEVCRYPTO=yes
  2943. fi
  2944. if test "$ENABLED_DEVCRYPTO" = "hmac"
  2945. then
  2946. #enable only hmac algorithm support
  2947. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  2948. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HMAC"
  2949. ENABLED_DEVCRYPTO=yes
  2950. fi
  2951. if test "$ENABLED_DEVCRYPTO" = "rsa"
  2952. then
  2953. #enable only rsa algorithm support
  2954. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  2955. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_RSA"
  2956. ENABLED_DEVCRYPTO=yes
  2957. fi
  2958. if test "$ENABLED_DEVCRYPTO" = "seco"
  2959. then
  2960. #enable support of devcrypto for algos not supported with seco
  2961. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  2962. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HMAC"
  2963. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_RSA"
  2964. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CURVE25519"
  2965. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_ECDSA"
  2966. ENABLED_DEVCRYPTO=yes
  2967. fi
  2968. # Camellia
  2969. AC_ARG_ENABLE([camellia],
  2970. [AS_HELP_STRING([--enable-camellia],[Enable wolfSSL Camellia support (default: disabled)])],
  2971. [ ENABLED_CAMELLIA=$enableval ],
  2972. [ ENABLED_CAMELLIA=no ]
  2973. )
  2974. if test "$ENABLED_CAMELLIA" = "yes"
  2975. then
  2976. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAMELLIA"
  2977. fi
  2978. # MD2
  2979. AC_ARG_ENABLE([md2],
  2980. [AS_HELP_STRING([--enable-md2],[Enable wolfSSL MD2 support (default: disabled)])],
  2981. [ ENABLED_MD2=$enableval ],
  2982. [ ENABLED_MD2=no ]
  2983. )
  2984. if test "$ENABLED_BUMP" = "yes"
  2985. then
  2986. ENABLED_MD2="yes"
  2987. fi
  2988. if test "$ENABLED_MD2" = "yes"
  2989. then
  2990. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MD2"
  2991. fi
  2992. # NULL CIPHER
  2993. AC_ARG_ENABLE([nullcipher],
  2994. [AS_HELP_STRING([--enable-nullcipher],[Enable wolfSSL NULL cipher support (default: disabled)])],
  2995. [ ENABLED_NULL_CIPHER=$enableval ],
  2996. [ ENABLED_NULL_CIPHER=no ]
  2997. )
  2998. if test "$ENABLED_OPENSSH" = "yes"
  2999. then
  3000. ENABLED_NULL_CIPHER="yes"
  3001. fi
  3002. if test "$ENABLED_NULL_CIPHER" = "yes"
  3003. then
  3004. AM_CFLAGS="$AM_CFLAGS -DHAVE_NULL_CIPHER"
  3005. fi
  3006. # RIPEMD
  3007. AC_ARG_ENABLE([ripemd],
  3008. [AS_HELP_STRING([--enable-ripemd],[Enable wolfSSL RIPEMD-160 support (default: disabled)])],
  3009. [ ENABLED_RIPEMD=$enableval ],
  3010. [ ENABLED_RIPEMD=no ]
  3011. )
  3012. if test "$ENABLED_OPENSSH" = "yes" && test "x$ENABLED_FIPS" = "xno"
  3013. then
  3014. ENABLED_RIPEMD="yes"
  3015. fi
  3016. if test "$ENABLED_RIPEMD" = "yes"
  3017. then
  3018. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RIPEMD"
  3019. fi
  3020. # BLAKE2
  3021. AC_ARG_ENABLE([blake2],
  3022. [AS_HELP_STRING([--enable-blake2],[Enable wolfSSL BLAKE2b support (default: disabled)])],
  3023. [ ENABLED_BLAKE2=$enableval ],
  3024. [ ENABLED_BLAKE2=no ]
  3025. )
  3026. if test "$ENABLED_BLAKE2" = "yes"
  3027. then
  3028. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2 -DHAVE_BLAKE2B"
  3029. fi
  3030. AC_ARG_ENABLE([blake2s],
  3031. [AS_HELP_STRING([--enable-blake2s],[Enable wolfSSL BLAKE2s support (default: disabled)])],
  3032. [ ENABLED_BLAKE2S=$enableval ],
  3033. [ ENABLED_BLAKE2S=no ]
  3034. )
  3035. if test "$ENABLED_BLAKE2S" = "yes"
  3036. then
  3037. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2S"
  3038. ENABLED_BLAKE2="yes"
  3039. fi
  3040. # set sha224 default
  3041. SHA224_DEFAULT=no
  3042. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64" || test "$host_cpu" = "amd64"
  3043. then
  3044. if test "x$ENABLED_AFALG" = "xno" && test "x$ENABLED_DEVCRYPTO" = "xno" &&
  3045. ( test "x$ENABLED_FIPS" = "xno" ||
  3046. ( test "$HAVE_FIPS_VERSION" = 2 && test "$HAVE_FIPS_VERSION_MINOR" != 1 ) )
  3047. then
  3048. SHA224_DEFAULT=yes
  3049. fi
  3050. fi
  3051. # SHA224
  3052. AC_ARG_ENABLE([sha224],
  3053. [AS_HELP_STRING([--enable-sha224],[Enable wolfSSL SHA-224 support (default: enabled on x86_64/amd64/aarch64)])],
  3054. [ ENABLED_SHA224=$enableval ],
  3055. [ ENABLED_SHA224=$SHA224_DEFAULT ]
  3056. )
  3057. if test "$ENABLED_SHA224" = "yes"
  3058. then
  3059. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA224"
  3060. fi
  3061. # set sha3 default
  3062. SHA3_DEFAULT=no
  3063. if (test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64" ||
  3064. test "$host_cpu" = "amd64")
  3065. then
  3066. if test "x$ENABLED_FIPS" = "xno" || test "$HAVE_FIPS_VERSION" -ge 2
  3067. then
  3068. SHA3_DEFAULT=yes
  3069. fi
  3070. fi
  3071. # SHA3
  3072. AC_ARG_ENABLE([sha3],
  3073. [AS_HELP_STRING([--enable-sha3],[Enable wolfSSL SHA-3 support (default: enabled on x86_64/amd64/aarch64)])],
  3074. [ ENABLED_SHA3=$enableval ],
  3075. [ ENABLED_SHA3=$SHA3_DEFAULT ]
  3076. )
  3077. if test "$ENABLED_SHA3" = "small"
  3078. then
  3079. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3_SMALL"
  3080. fi
  3081. # SHAKE128
  3082. AC_ARG_ENABLE([shake128],
  3083. [AS_HELP_STRING([--enable-shake128],[Enable wolfSSL SHAKE128 support (default: disabled)])],
  3084. [ ENABLED_SHAKE128=$enableval ],
  3085. [ ENABLED_SHAKE128=no ]
  3086. )
  3087. # SHAKE256
  3088. AC_ARG_ENABLE([shake256],
  3089. [AS_HELP_STRING([--enable-shake256],[Enable wolfSSL SHAKE256 support (default: disabled)])],
  3090. [ ENABLED_SHAKE256=$enableval ],
  3091. [ ENABLED_SHAKE256=no ]
  3092. )
  3093. # SHA512
  3094. AC_ARG_ENABLE([sha512],
  3095. [AS_HELP_STRING([--enable-sha512],[Enable wolfSSL SHA-512 support (default: enabled)])],
  3096. [ ENABLED_SHA512=$enableval ],
  3097. [ ENABLED_SHA512=yes ]
  3098. )
  3099. # options that don't require sha512
  3100. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes" || test "$ENABLED_16BIT" = "yes"
  3101. then
  3102. ENABLED_SHA512="no"
  3103. fi
  3104. # options that require sha512
  3105. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_FORTRESS" = "yes"
  3106. then
  3107. ENABLED_SHA512="yes"
  3108. ENABLED_SHA384="yes"
  3109. fi
  3110. if test "$ENABLED_SHA512" = "yes"
  3111. then
  3112. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512"
  3113. fi
  3114. # SHA384
  3115. AC_ARG_ENABLE([sha384],
  3116. [AS_HELP_STRING([--enable-sha384],[Enable wolfSSL SHA-384 support (default: enabled)])],
  3117. [ ENABLED_SHA384=$enableval ],
  3118. [ ENABLED_SHA384=yes ]
  3119. )
  3120. # options that don't require sha384
  3121. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes" || test "$ENABLED_16BIT" = "yes"
  3122. then
  3123. ENABLED_SHA384="no"
  3124. fi
  3125. # options that require sha384
  3126. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_FORTRESS" = "yes"
  3127. then
  3128. ENABLED_SHA384="yes"
  3129. fi
  3130. if test "$ENABLED_SHA384" = "yes"
  3131. then
  3132. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA384"
  3133. fi
  3134. # SM3
  3135. AC_ARG_ENABLE([sm3],
  3136. [AS_HELP_STRING([--enable-sm3],[Enable wolfSSL SM3 support (default: disabled)])],
  3137. [ ENABLED_SM3=$enableval ],
  3138. [ ENABLED_SM3=no ]
  3139. )
  3140. if test "$ENABLED_SM3" = "small"
  3141. then
  3142. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM3_SMALL"
  3143. fi
  3144. if test "$ENABLED_SM3" != "no"
  3145. then
  3146. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM3"
  3147. fi
  3148. # SESSION CERTS
  3149. AC_ARG_ENABLE([sessioncerts],
  3150. [AS_HELP_STRING([--enable-sessioncerts],[Enable session cert storing (default: disabled)])],
  3151. [ ENABLED_SESSIONCERTS=$enableval ],
  3152. [ ENABLED_SESSIONCERTS=no ]
  3153. )
  3154. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_OPENVPN" = "xyes" || \
  3155. test "x$ENABLED_LIGHTY" = "xyes" || test "x$ENABLED_NETSNMP" = "xyes" || \
  3156. test "x$ENABLED_STRONGSWAN" = "xyes" || test "x$ENABLED_HITCH" = "xyes"
  3157. then
  3158. ENABLED_SESSIONCERTS=yes
  3159. fi
  3160. if test "$ENABLED_TLS13" = "yes" && test "$ENABLED_PSK" = "yes"
  3161. then
  3162. ENABLED_SESSIONCERTS=yes
  3163. fi
  3164. if test "$ENABLED_SESSIONCERTS" = "yes"
  3165. then
  3166. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  3167. fi
  3168. # KEY GENERATION
  3169. AC_ARG_ENABLE([keygen],
  3170. [AS_HELP_STRING([--enable-keygen],[Enable key generation (only applies to RSA key generation) (default: disabled)])],
  3171. [ ENABLED_KEYGEN=$enableval ],
  3172. [ ENABLED_KEYGEN=no ]
  3173. )
  3174. if test "$ENABLED_BIND" = "yes" || test "$ENABLED_NTP" = "yes" || \
  3175. test "$ENABLED_LIBSSH2" = "yes" || test "$ENABLED_OPENRESTY" = "yes" || \
  3176. test "$ENABLED_NGINX" = "yes" || test "$ENABLED_WOLFENGINE" = "yes" || \
  3177. test "$ENABLED_STRONGSWAN" = "yes" || test "$ENABLED_SE050" = "yes"
  3178. then
  3179. ENABLED_KEYGEN=yes
  3180. fi
  3181. # CERT GENERATION
  3182. AC_ARG_ENABLE([certgen],
  3183. [AS_HELP_STRING([--enable-certgen],[Enable cert generation (default: disabled)])],
  3184. [ ENABLED_CERTGEN=$enableval ],
  3185. [ ENABLED_CERTGEN=no ]
  3186. )
  3187. if test "$ENABLED_OPENVPN" = "yes" || test "$ENABLED_OPENSSH" = "yes" || \
  3188. test "$ENABLED_BIND" = "yes" || test "$ENABLED_NTP" = "yes" || \
  3189. test "$ENABLED_CHRONY" = "yes" || test "$ENABLED_STRONGSWAN" = "yes" || \
  3190. test "$ENABLED_OPENLDAP" = "yes" || test "$ENABLED_HITCH" = "yes"
  3191. then
  3192. ENABLED_CERTGEN=yes
  3193. fi
  3194. # CERT REQUEST GENERATION
  3195. AC_ARG_ENABLE([certreq],
  3196. [AS_HELP_STRING([--enable-certreq],[Enable cert request generation (default: disabled)])],
  3197. [ ENABLED_CERTREQ=$enableval ],
  3198. [ ENABLED_CERTREQ=no ]
  3199. )
  3200. if test "$ENABLED_WPAS_DPP" = "yes"
  3201. then
  3202. ENABLED_CERTREQ="yes"
  3203. fi
  3204. # CERT REQUEST EXTENSION
  3205. AC_ARG_ENABLE([certext],
  3206. [AS_HELP_STRING([--enable-certext],[Enable cert request extensions (default: disabled)])],
  3207. [ ENABLED_CERTEXT=$enableval ],
  3208. [ ENABLED_CERTEXT=no ]
  3209. )
  3210. if test "$ENABLED_OPENVPN" = "yes" || test "$ENABLED_STRONGSWAN" = "yes"
  3211. then
  3212. ENABLED_CERTEXT=yes
  3213. fi
  3214. # DECODED CERT CACHE
  3215. AC_ARG_ENABLE([certgencache],
  3216. [AS_HELP_STRING([--enable-certgencache],[Enable decoded cert caching (default: disabled)])],
  3217. [ ENABLED_certgencache=$enableval ],
  3218. [ ENABLED_certgencache=no ]
  3219. )
  3220. if test "$ENABLED_certgencache" = "yes"
  3221. then
  3222. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN_CACHE"
  3223. fi
  3224. # SEP
  3225. AC_ARG_ENABLE([sep],
  3226. [AS_HELP_STRING([--enable-sep],[Enable sep extensions (default: disabled)])],
  3227. [ ENABLED_SEP=$enableval ],
  3228. [ ENABLED_SEP=no ]
  3229. )
  3230. if test "$ENABLED_SEP" = "yes"
  3231. then
  3232. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SEP -DKEEP_PEER_CERT"
  3233. fi
  3234. # HKDF
  3235. AC_ARG_ENABLE([hkdf],
  3236. [AS_HELP_STRING([--enable-hkdf],[Enable HKDF (HMAC-KDF) support (default: disabled)])],
  3237. [ ENABLED_HKDF=$enableval ],
  3238. [ ENABLED_HKDF=no ]
  3239. )
  3240. if test "$ENABLED_TLS13" = "yes"
  3241. then
  3242. ENABLED_HKDF="yes"
  3243. fi
  3244. if test "$ENABLED_HKDF" = "yes"
  3245. then
  3246. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"
  3247. fi
  3248. # HPKE
  3249. AC_ARG_ENABLE([hpke],
  3250. [AS_HELP_STRING([--enable-hpke],[Enable HKPE support (default: disabled)])],
  3251. [ ENABLED_HPKE=$enableval ],
  3252. [ ENABLED_HPKE=no ]
  3253. )
  3254. if test "$ENABLED_HPKE" = "yes"
  3255. then
  3256. AM_CFLAGS="$AM_CFLAGS -DHAVE_HPKE"
  3257. test "$enable_hkdf" = "" && enable_hkdf=yes
  3258. fi
  3259. # X9.63 KDF
  3260. AC_ARG_ENABLE([x963kdf],
  3261. [AS_HELP_STRING([--enable-x963kdf],[Enable X9.63 KDF support (default: disabled)])],
  3262. [ ENABLED_X963KDF=$enableval ],
  3263. [ ENABLED_X963KDF=no ]
  3264. )
  3265. if test "$ENABLED_X963KDF" = "yes" || test "$ENABLED_WOLFENGINE" = "yes"
  3266. then
  3267. AM_CFLAGS="$AM_CFLAGS -DHAVE_X963_KDF"
  3268. fi
  3269. # SRTP-KDF
  3270. AC_ARG_ENABLE([srtp-kdf],
  3271. [AS_HELP_STRING([--enable-srtp-kdf],[Enable SRTP-KDF support (default: disabled)])],
  3272. [ ENABLED_SRTP_KDF=$enableval ],
  3273. [ ENABLED_SRTP_KDF=no ]
  3274. )
  3275. # DSA
  3276. AC_ARG_ENABLE([dsa],
  3277. [AS_HELP_STRING([--enable-dsa],[Enable DSA (default: disabled)])],
  3278. [ ENABLED_DSA=$enableval ],
  3279. [ ENABLED_DSA=no ]
  3280. )
  3281. if test "$enable_dsa" = "" && test "$enable_sha" != "no"
  3282. then
  3283. if (test "$ENABLED_OPENSSH" = "yes" && test "x$ENABLED_FIPS" = "xno") || 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"
  3284. then
  3285. ENABLED_DSA="yes"
  3286. fi
  3287. fi
  3288. if test "$ENABLED_DSA" = "no"
  3289. then
  3290. AM_CFLAGS="$AM_CFLAGS -DNO_DSA"
  3291. else
  3292. ENABLED_CERTS=yes
  3293. fi
  3294. # ECC Shamir
  3295. AC_ARG_ENABLE([eccshamir],
  3296. [AS_HELP_STRING([--enable-eccshamir],[Enable ECC Shamir (default: enabled)])],
  3297. [ ENABLED_ECC_SHAMIR=$enableval ],
  3298. [ ENABLED_ECC_SHAMIR=yes ]
  3299. )
  3300. # ECC
  3301. AC_ARG_ENABLE([ecc],
  3302. [AS_HELP_STRING([--enable-ecc],[Enable ECC (default: enabled)])],
  3303. [ ENABLED_ECC=$enableval ],
  3304. [ ENABLED_ECC=yes ]
  3305. )
  3306. # lean psk doesn't need ecc
  3307. if test "$ENABLED_LEANPSK" = "yes"
  3308. then
  3309. ENABLED_ECC=no
  3310. fi
  3311. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$ENABLED_SIGNAL" = "yes"
  3312. then
  3313. ENABLED_ECC="yes"
  3314. fi
  3315. if test "$ENABLED_ECC" != "no"
  3316. then
  3317. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  3318. if test "$ENABLED_ECC_SHAMIR" = "yes" && test "$ENABLED_LOWRESOURCE" = "no"
  3319. then
  3320. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  3321. fi
  3322. if test "$ENABLED_ECC" = "nonblock"
  3323. then
  3324. AM_CFLAGS="$AM_CFLAGS -DWC_ECC_NONBLOCK"
  3325. fi
  3326. if test "$ENABLED_LOWRESOURCE" = "yes" && test "$ENABLED_FASTMATH" = "yes"
  3327. then
  3328. AM_CFLAGS="$AM_CFLAGS -DALT_ECC_SIZE"
  3329. fi
  3330. ENABLED_CERTS=yes
  3331. fi
  3332. # SM2
  3333. AC_ARG_ENABLE([sm2],
  3334. [AS_HELP_STRING([--enable-sm2],[Enable wolfSSL SM2 support (default: disabled)])],
  3335. [ ENABLED_SM2=$enableval ],
  3336. [ ENABLED_SM2=no ]
  3337. )
  3338. if test "$ENABLED_SM2" = "yes"
  3339. then
  3340. if test "$ENABLED_ECC" = "no"
  3341. then
  3342. AC_MSG_ERROR([Cannot enable SM2 without enabling ecc.])
  3343. fi
  3344. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SM2 -DWOLFSSL_BASE16"
  3345. fi
  3346. # ECC Custom Curves
  3347. AC_ARG_ENABLE([ecccustcurves],
  3348. [AS_HELP_STRING([--enable-ecccustcurves],[Enable ECC custom curves (default: disabled)])],
  3349. [ ENABLED_ECCCUSTCURVES=$enableval ],
  3350. [ ENABLED_ECCCUSTCURVES=no ]
  3351. )
  3352. if test "$ENABLED_WPAS_DPP" = "yes"
  3353. then
  3354. ENABLED_ECCCUSTCURVES="all"
  3355. fi
  3356. # ECC Minimum Key Size
  3357. AC_ARG_WITH([eccminsz],
  3358. [AS_HELP_STRING([--with-eccminsz=BITS],[Sets the ECC minimum key size (default: 224 bits)])],
  3359. [
  3360. ENABLED_ECCMINSZ=$withval
  3361. AM_CFLAGS="$AM_CFLAGS -DECC_MIN_KEY_SZ=$withval"
  3362. ],
  3363. [ ENABLED_ECCMINSZ=224 ]
  3364. )
  3365. # Compressed Key
  3366. AC_ARG_ENABLE([compkey],
  3367. [AS_HELP_STRING([--enable-compkey],[Enable compressed keys support (default: disabled)])],
  3368. [ ENABLED_COMPKEY=$enableval ],
  3369. [ ENABLED_COMPKEY=no ]
  3370. )
  3371. if test "$ENABLED_WPAS" = "yes" || test "$ENABLED_OPENSSLALL" = "yes"
  3372. then
  3373. ENABLED_COMPKEY=yes
  3374. fi
  3375. # Brainpool (depends on _ECCCUSTCURVES)
  3376. if test "$ENABLED_ECCCUSTCURVES" != "no"
  3377. then
  3378. BRAINPOOL_DEFAULT=yes
  3379. else
  3380. BRAINPOOL_DEFAULT=no
  3381. fi
  3382. AC_ARG_ENABLE([brainpool],
  3383. [AS_HELP_STRING([--enable-brainpool],[Enable Brainpool ECC curves (default: enabled with ECC custom curves)])],
  3384. [ ENABLED_BRAINPOOL=$enableval ],
  3385. [ ENABLED_BRAINPOOL="$BRAINPOOL_DEFAULT" ]
  3386. )
  3387. if test "$ENABLED_BRAINPOOL" != "no"
  3388. then
  3389. if test "$ENABLED_ECCCUSTCURVES" = "no"
  3390. then
  3391. AC_MSG_ERROR([cannot enable Brainpool without enabling ecccustcurves.])
  3392. fi
  3393. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_BRAINPOOL"
  3394. fi
  3395. # for using memory optimization setting on both curve25519 and ed25519
  3396. ENABLED_CURVE25519_SMALL=no
  3397. ENABLED_ED25519_SMALL=no
  3398. # CURVE25519
  3399. AC_ARG_ENABLE([curve25519],
  3400. [AS_HELP_STRING([--enable-curve25519],[Enable Curve25519 (default: disabled)])],
  3401. [ ENABLED_CURVE25519=$enableval ],
  3402. [ ENABLED_CURVE25519=no ]
  3403. )
  3404. if test "$ENABLED_QUIC" = "yes" && test "$ENABLED_CURVE25519" = "no"
  3405. then
  3406. ENABLED_CURVE25519=yes
  3407. fi
  3408. if test "$ENABLED_OPENSSH" = "yes" && test "x$ENABLED_FIPS" = "xno"
  3409. then
  3410. ENABLED_CURVE25519="yes"
  3411. fi
  3412. if test "$ENABLED_CURVE25519" != "no"
  3413. then
  3414. if test "$ENABLED_CURVE25519" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  3415. then
  3416. AM_CFLAGS="$AM_CFLAGS -DCURVE25519_SMALL"
  3417. ENABLED_CURVE25519_SMALL=yes
  3418. ENABLED_CURVE25519=yes
  3419. fi
  3420. if test "$ENABLED_CURVE25519" = "no128bit" || test "$ENABLED_32BIT" = "yes"
  3421. then
  3422. AM_CFLAGS="$AM_CFLAGS -DNO_CURVED25519_128BIT"
  3423. ENABLED_CURVE25519=yes
  3424. fi
  3425. if test "$ENABLED_CURVE25519" = "noasm"
  3426. then
  3427. AM_CFLAGS="$AM_CFLAGS -DNO_CURVED25519_X64"
  3428. fi
  3429. if test "$ENABLED_CURVE25519" = "yes" && test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  3430. then
  3431. ENABLED_CURVE25519=noasm
  3432. AM_CFLAGS="$AM_CFLAGS -DNO_CURVED25519_X64"
  3433. fi
  3434. AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE25519"
  3435. AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_CURVE25519"
  3436. ENABLED_FEMATH=yes
  3437. fi
  3438. # ED25519
  3439. AC_ARG_ENABLE([ed25519],
  3440. [AS_HELP_STRING([--enable-ed25519],[Enable ED25519 (default: disabled)])],
  3441. [ ENABLED_ED25519=$enableval ],
  3442. [ ENABLED_ED25519=no ]
  3443. )
  3444. AC_ARG_ENABLE([ed25519-stream],
  3445. [AS_HELP_STRING([--enable-ed25519-stream],[Enable wolfSSL ED25519 support with streaming verify APIs (default: disabled)])],
  3446. [ ENABLED_ED25519_STREAM=$enableval ],
  3447. [ ENABLED_ED25519_STREAM=no ]
  3448. )
  3449. if (test "$ENABLED_OPENSSH" = "yes" && test "x$ENABLED_FIPS" = "xno") || \
  3450. test "$ENABLED_CHRONY" = "yes"
  3451. then
  3452. ENABLED_ED25519="yes"
  3453. fi
  3454. # for using memory optimization setting on both curve448 and ed448
  3455. ENABLED_CURVE448_SMALL=no
  3456. ENABLED_ED448_SMALL=no
  3457. # CURVE448
  3458. AC_ARG_ENABLE([curve448],
  3459. [AS_HELP_STRING([--enable-curve448],[Enable Curve448 (default: disabled)])],
  3460. [ ENABLED_CURVE448=$enableval ],
  3461. [ ENABLED_CURVE448=no ]
  3462. )
  3463. # ED448
  3464. AC_ARG_ENABLE([ed448],
  3465. [AS_HELP_STRING([--enable-ed448],[Enable ED448 (default: disabled)])],
  3466. [ ENABLED_ED448=$enableval ],
  3467. [ ENABLED_ED448=no ]
  3468. )
  3469. AC_ARG_ENABLE([ed448-stream],
  3470. [AS_HELP_STRING([--enable-ed448-stream],[Enable wolfSSL ED448 support with streaming verify APIs (default: disabled)])],
  3471. [ ENABLED_ED448_STREAM=$enableval ],
  3472. [ ENABLED_ED448_STREAM=no ]
  3473. )
  3474. if test "$ENABLED_ED448_STREAM" != "no"
  3475. then
  3476. if test "$ENABLED_ED448" = "no"
  3477. then
  3478. AC_MSG_ERROR([ED448 verify streaming enabled but ED448 is disabled])
  3479. else
  3480. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ED448_STREAMING_VERIFY"
  3481. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_ED448_STREAMING_VERIFY"
  3482. fi
  3483. fi
  3484. # FP ECC, Fixed Point cache ECC
  3485. AC_ARG_ENABLE([fpecc],
  3486. [AS_HELP_STRING([--enable-fpecc],[Enable Fixed Point cache ECC (default: disabled)])],
  3487. [ ENABLED_FPECC=$enableval ],
  3488. [ ENABLED_FPECC=no ]
  3489. )
  3490. if test "$ENABLED_FPECC" = "yes"
  3491. then
  3492. if test "$ENABLED_ECC" = "no"
  3493. then
  3494. AC_MSG_ERROR([cannot enable fpecc without enabling ecc.])
  3495. fi
  3496. AM_CFLAGS="$AM_CFLAGS -DFP_ECC"
  3497. fi
  3498. # ECC encrypt
  3499. AC_ARG_ENABLE([eccencrypt],
  3500. [AS_HELP_STRING([--enable-eccencrypt],[Enable ECC encrypt (default: disabled). yes = SEC1 standard, geniv = Generate IV, iso18033 = ISO 18033 standard, old = original wolfSSL algorithm])],
  3501. [ ENABLED_ECC_ENCRYPT=$enableval ],
  3502. [ ENABLED_ECC_ENCRYPT=no ]
  3503. )
  3504. if test "$ENABLED_ECC_ENCRYPT" != "no"
  3505. then
  3506. if test "$ENABLED_ECC" = "no"
  3507. then
  3508. AC_MSG_ERROR([cannot enable eccencrypt without enabling ecc.])
  3509. fi
  3510. if test "$ENABLED_HKDF" = "no"
  3511. then
  3512. AC_MSG_ERROR([cannot enable eccencrypt without enabling hkdf.])
  3513. fi
  3514. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_ENCRYPT"
  3515. if test "$ENABLED_ECC_ENCRYPT" = "old"
  3516. then
  3517. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ECIES_OLD"
  3518. fi
  3519. if test "$ENABLED_ECC_ENCRYPT" = "iso18033"
  3520. then
  3521. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ECIES_ISO18033"
  3522. fi
  3523. if test "$ENABLED_ECC_ENCRYPT" = "geniv"
  3524. then
  3525. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ECIES_GEN_IV"
  3526. fi
  3527. fi
  3528. # Elliptic Curve-Based Certificateless Signatures for Identity-Based Encryption (ECCSI)
  3529. AC_ARG_ENABLE([eccsi],
  3530. [AS_HELP_STRING([--enable-eccsi],[Enable ECCSI (default: disabled)])],
  3531. [ ENABLED_ECCSI=$enableval ],
  3532. [ ENABLED_ECCSI=no ]
  3533. )
  3534. if test "x$ENABLED_ECCSI" = "xyes"
  3535. then
  3536. if test "$ENABLED_ECC" = "no"
  3537. then
  3538. AC_MSG_ERROR([ECCSI requires ECC.])
  3539. fi
  3540. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_ECCSI -DWOLFSSL_PUBLIC_MP"
  3541. fi
  3542. # Sakai-Kasahara Key Encryption (SAKKE) - pairing based crypto
  3543. AC_ARG_ENABLE([sakke],
  3544. [AS_HELP_STRING([--enable-sakke],[Enable SAKKE - paring based crypto (default: disabled)])],
  3545. [ ENABLED_SAKKE=$enableval ],
  3546. [ ENABLED_SAKKE=no ]
  3547. )
  3548. if test "$ENABLED_SAKKE" != "no" && test "$ENABLED_ECC" = "no"
  3549. then
  3550. AC_MSG_ERROR([SAKKE requires ECC.])
  3551. fi
  3552. if test "x$ENABLED_SAKKE" = "xsmall"
  3553. then
  3554. ENABLED_SAKKE="yes"
  3555. ENABLED_SAKKE_SMALL="yes"
  3556. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_SAKKE_SMALL"
  3557. fi
  3558. if test "x$ENABLED_SAKKE" = "xyes"
  3559. then
  3560. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_SAKKE"
  3561. fi
  3562. # PSK
  3563. AC_ARG_ENABLE([psk],
  3564. [AS_HELP_STRING([--enable-psk],[Enable PSK (default: disabled)])],
  3565. [ ENABLED_PSK=$enableval ],
  3566. [ ENABLED_PSK=no ]
  3567. )
  3568. # Single PSK identity
  3569. AC_ARG_ENABLE([psk-one-id],
  3570. [AS_HELP_STRING([--enable-psk-one-id],[Enable PSK (default: disabled)])],
  3571. [ ENABLED_PSK_ONE_ID=$enableval ],
  3572. [ ENABLED_PSK_ONE_ID=no ]
  3573. )
  3574. if test "$ENABLED_PSK_ONE_ID" = "yes"
  3575. then
  3576. if test "$ENABLED_PSK" = "no"
  3577. then
  3578. ENABLED_PSK="yes"
  3579. fi
  3580. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PSK_ONE_ID"
  3581. fi
  3582. # ERROR STRINGS
  3583. AC_ARG_ENABLE([errorstrings],
  3584. [AS_HELP_STRING([--enable-errorstrings],[Enable error strings table (default: enabled)])],
  3585. [ ENABLED_ERROR_STRINGS=$enableval ],
  3586. [ ENABLED_ERROR_STRINGS=yes ]
  3587. )
  3588. if test "$ENABLED_ERROR_STRINGS" = "no"
  3589. then
  3590. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  3591. else
  3592. # turn off error strings if leanpsk or leantls on
  3593. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  3594. then
  3595. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  3596. ENABLED_ERROR_STRINGS=no
  3597. fi
  3598. fi
  3599. # ERROR QUEUE
  3600. AC_ARG_ENABLE([errorqueue],
  3601. [AS_HELP_STRING([--enable-errorqueue],[Disables adding nodes to error queue when compiled with OPENSSL_EXTRA (default: enabled)])],
  3602. [ ENABLED_ERROR_QUEUE=$enableval ],
  3603. [ ENABLED_ERROR_QUEUE=yes ]
  3604. )
  3605. # SSLv3
  3606. AC_ARG_ENABLE([sslv3],
  3607. [AS_HELP_STRING([--enable-sslv3],[Enable SSL version 3.0 (default: disabled)])],
  3608. [ ENABLED_SSLV3=$enableval ],
  3609. [ ENABLED_SSLV3=no]
  3610. )
  3611. if test "x$ENABLED_HAPROXY" = "xyes" && test "x$ENABLED_ALL" = "xno"
  3612. then
  3613. ENABLED_SSLV3="yes"
  3614. fi
  3615. if test "$ENABLED_CRYPTONLY" = "yes"
  3616. then
  3617. ENABLED_SSLV3=no
  3618. fi
  3619. if test "$ENABLED_SSLV3" = "yes"
  3620. then
  3621. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_SSLV3"
  3622. fi
  3623. # TLSv1.0
  3624. AC_ARG_ENABLE([tlsv10],
  3625. [AS_HELP_STRING([--enable-tlsv10],[Enable old TLS versions 1.0 (default: disabled)])],
  3626. [ ENABLED_TLSV10=$enableval ],
  3627. [ ENABLED_TLSV10=no ]
  3628. )
  3629. if test "$ENABLED_CRYPTONLY" = "yes"
  3630. then
  3631. ENABLED_TLSV12=no
  3632. fi
  3633. if test "$ENABLED_TLSV10" = "yes"
  3634. then
  3635. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_TLSV10"
  3636. fi
  3637. # OLD TLS
  3638. AC_ARG_ENABLE([oldtls],
  3639. [AS_HELP_STRING([--enable-oldtls],[Enable old TLS versions < 1.2 (default: disabled)])],
  3640. [ ENABLED_OLD_TLS=$enableval ],
  3641. [ ENABLED_OLD_TLS=no ]
  3642. )
  3643. if test "$ENABLED_CRYPTONLY" = "yes" || test "x$ENABLED_HARDEN_TLS" != "xno" || \
  3644. test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  3645. then
  3646. ENABLED_OLD_TLS=no
  3647. fi
  3648. # if SSL v3.0 or TLS v1.0 enabled, then allow "old tls". QT also requires it apparently
  3649. if test "$ENABLED_TLSV10" = "yes" || test "$ENABLED_SSLV3" = "yes" || \
  3650. (test "$ENABLED_QT" = "yes" && test "x$ENABLED_ALL" = "xno")
  3651. then
  3652. ENABLED_OLD_TLS=yes
  3653. fi
  3654. if test "$ENABLED_OLD_TLS" = "no"
  3655. then
  3656. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  3657. fi
  3658. # TLSv1.2
  3659. AC_ARG_ENABLE([tlsv12],
  3660. [AS_HELP_STRING([--enable-tlsv12],[Enable TLS versions 1.2 (default: enabled)])],
  3661. [ ENABLED_TLSV12=$enableval ],
  3662. [ ENABLED_TLSV12=yes ]
  3663. )
  3664. if test "$ENABLED_CRYPTONLY" = "yes"
  3665. then
  3666. ENABLED_TLSV12=no
  3667. fi
  3668. if test "$ENABLED_TLSV12" = "no"
  3669. then
  3670. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_TLS12 -DNO_OLD_TLS"
  3671. fi
  3672. # STACK SIZE info for testwolfcrypt and examples
  3673. AC_ARG_ENABLE([stacksize],
  3674. [AS_HELP_STRING([--enable-stacksize],[Enable stack size info on examples (default: disabled)])],
  3675. [ ENABLED_STACKSIZE=$enableval ],
  3676. [ ENABLED_STACKSIZE=no ]
  3677. )
  3678. if test "$ENABLED_STACKSIZE" != "no"
  3679. then
  3680. AC_CHECK_FUNC([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  3681. AC_CHECK_DECL([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  3682. AC_CHECK_FUNC([pthread_attr_setstack], [], AC_CHECK_LIB([pthread],[pthread_attr_setstack]))
  3683. AC_CHECK_DECL([pthread_attr_setstack], [], [AC_MSG_ERROR(stacksize needs pthread_attr_setstack)], [[#include <pthread.h>]])
  3684. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE"
  3685. fi
  3686. if test "$ENABLED_STACKSIZE" = "verbose"
  3687. then
  3688. if test "$thread_ls_on" != "yes"
  3689. then
  3690. AC_MSG_ERROR(stacksize-verbose needs thread-local storage.)
  3691. fi
  3692. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE_VERBOSE"
  3693. fi
  3694. # MEMORY
  3695. AC_ARG_ENABLE([memory],
  3696. [AS_HELP_STRING([--enable-memory],[Enable memory callbacks (default: enabled)])],
  3697. [ ENABLED_MEMORY=$enableval ],
  3698. [ ENABLED_MEMORY=yes ]
  3699. )
  3700. if test "$ENABLED_MEMORY" = "no"
  3701. then
  3702. AM_CFLAGS="$AM_CFLAGS -DNO_WOLFSSL_MEMORY"
  3703. else
  3704. # turn off memory cb if leanpsk or leantls on
  3705. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  3706. then
  3707. # but don't turn on NO_WOLFSSL_MEMORY because using own
  3708. ENABLED_MEMORY=no
  3709. fi
  3710. fi
  3711. # MEMORY SIZE info
  3712. AC_ARG_ENABLE([trackmemory],
  3713. [AS_HELP_STRING([--enable-trackmemory],[Enable memory use info on wolfCrypt and wolfSSL cleanup (default: disabled)])],
  3714. [ ENABLED_TRACKMEMORY=$enableval ],
  3715. [ ENABLED_TRACKMEMORY=no ]
  3716. )
  3717. if test "$ENABLED_TRACKMEMORY" != "no"
  3718. then
  3719. if test "$ENABLED_MEMORY" = "yes"
  3720. then
  3721. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY"
  3722. else
  3723. AC_MSG_ERROR([trackmemory requires using wolfSSL memory (--enable-memory).])
  3724. fi
  3725. if test "$ENABLED_TRACKMEMORY" = "verbose"
  3726. then
  3727. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY_VERBOSE"
  3728. fi
  3729. fi
  3730. # MEMORY usage logging
  3731. AC_ARG_ENABLE([memorylog],
  3732. [AS_HELP_STRING([--enable-memorylog],[Enable dynamic memory logging (default: disabled)])],
  3733. [ ENABLED_MEMORYLOG=$enableval ],
  3734. [ ENABLED_MEMORYLOG=no ]
  3735. )
  3736. if test "$ENABLED_MEMORYLOG" = "yes"
  3737. then
  3738. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MEMORY_LOG"
  3739. fi
  3740. # STACK usage logging
  3741. AC_ARG_ENABLE([stacklog],
  3742. [AS_HELP_STRING([--enable-stacklog],[Enable stack logging (default: disabled)])],
  3743. [ ENABLED_STACKLOG=$enableval ],
  3744. [ ENABLED_STACKLOG=no ]
  3745. )
  3746. if test "$ENABLED_STACKLOG" = "yes"
  3747. then
  3748. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STACK_LOG -finstrument-functions"
  3749. fi
  3750. ENABLED_WOLFSENTRY=no
  3751. AC_ARG_WITH([wolfsentry],
  3752. [AS_HELP_STRING([--with-wolfsentry=PATH],[PATH to directory with wolfSentry installation])],
  3753. [WOLFSENTRY_INSTALLDIR=$withval],
  3754. [WOLFSENTRY_INSTALLDIR=""])
  3755. AC_ARG_WITH([wolfsentry-lib],
  3756. [AS_HELP_STRING([--with-wolfsentry-lib=PATH],[PATH to directory with wolfSentry library])],
  3757. [WOLFSENTRY_LIB=$withval],
  3758. [WOLFSENTRY_LIB=""])
  3759. AC_ARG_WITH([wolfsentry-include],
  3760. [AS_HELP_STRING([--with-wolfsentry-include=PATH],[PATH to directory with wolfSentry header files])],
  3761. [WOLFSENTRY_INCLUDE=$withval],
  3762. [WOLFSENTRY_INCLUDE=""])
  3763. if test -n "$WOLFSENTRY_INSTALLDIR" || test -n "$WOLFSENTRY_LIB" || test -n "$WOLFSENTRY_INCLUDE"
  3764. then
  3765. ENABLED_WOLFSENTRY=yes
  3766. fi
  3767. AC_ARG_ENABLE([wolfsentry],
  3768. [AS_HELP_STRING([--enable-wolfsentry],[Enable wolfSentry hooks and plugins (default: disabled)])],
  3769. [ ENABLED_WOLFSENTRY=$enableval ],
  3770. [ ]
  3771. )
  3772. if test "$WOLFSENTRY_LIB" = "" && test -n "$WOLFSENTRY_INSTALLDIR"
  3773. then
  3774. WOLFSENTRY_LIB="${WOLFSENTRY_INSTALLDIR}/lib"
  3775. fi
  3776. if test "$WOLFSENTRY_INCLUDE" = "" && test -n "$WOLFSENTRY_INSTALLDIR"
  3777. then
  3778. WOLFSENTRY_INCLUDE="${WOLFSENTRY_INSTALLDIR}/include"
  3779. fi
  3780. if test -n "$WOLFSENTRY_LIB"
  3781. then
  3782. AC_MSG_CHECKING([for $WOLFSENTRY_LIB])
  3783. if ! test -d "$WOLFSENTRY_LIB"
  3784. then
  3785. AC_MSG_ERROR([wolfSentry lib dir $WOLFSENTRY_LIB not found.])
  3786. fi
  3787. AC_MSG_RESULT([yes])
  3788. WOLFSENTRY_LIB="-L$WOLFSENTRY_LIB"
  3789. fi
  3790. if test -n "$WOLFSENTRY_INCLUDE"
  3791. then
  3792. AC_MSG_CHECKING([for $WOLFSENTRY_INCLUDE])
  3793. if ! test -d "$WOLFSENTRY_INCLUDE"
  3794. then
  3795. AC_MSG_ERROR([wolfSentry include dir $WOLFSENTRY_INCLUDE not found.])
  3796. fi
  3797. AC_MSG_RESULT([yes])
  3798. WOLFSENTRY_INCLUDE="-I$WOLFSENTRY_INCLUDE"
  3799. fi
  3800. if test "$ENABLED_WOLFSENTRY" = "yes"
  3801. then
  3802. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WOLFSENTRY_HOOKS -DHAVE_EX_DATA -DHAVE_EX_DATA_CLEANUP_HOOKS"
  3803. WOLFSENTRY_LIB="$WOLFSENTRY_LIB -lwolfsentry"
  3804. fi
  3805. AC_SUBST([WOLFSENTRY_LIB])
  3806. AC_SUBST([WOLFSENTRY_INCLUDE])
  3807. if test "$ENABLED_QT" = "yes"
  3808. then
  3809. # Requires opensslextra and opensslall
  3810. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3811. then
  3812. ENABLED_OPENSSLALL="yes"
  3813. ENABLED_OPENSSLEXTRA="yes"
  3814. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA -DOPENSSL_ALL -DHAVE_EX_DATA"
  3815. fi
  3816. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_QT -DSESSION_CERTS -DOPENSSL_NO_SSL2"
  3817. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN -DHAVE_EX_DATA"
  3818. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ"
  3819. if test "x$ENABLED_ALL" = "xno"; then
  3820. # Don't enable old SSL/TLS for --enable-all, which is used by distro
  3821. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_SSLV3 -DWOLFSSL_ALLOW_TLSV10"
  3822. fi
  3823. # Requires OCSP make sure on
  3824. if test "x$ENABLED_OCSP" = "xno"
  3825. then
  3826. ENABLED_OCSP="yes"
  3827. fi
  3828. # Requires PSK make sure on
  3829. if test "x$ENABLED_PSK" = "xno"
  3830. then
  3831. ENABLED_PSK="yes"
  3832. fi
  3833. # Requires RC4 make sure on (if not forcefully disabled with --disable-arc4)
  3834. test "$enable_arc4" = "" && enable_arc4=yes
  3835. if test "x$ENABLED_CERTEXT" = "xno"
  3836. then
  3837. ENABLED_CERTEXT="yes"
  3838. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  3839. fi
  3840. if test "x$ENABLED_CERTGEN" = "xno"
  3841. then
  3842. ENABLED_CERTGEN="yes"
  3843. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3844. fi
  3845. # requires oldnames disabled
  3846. enable_oldnames=no
  3847. fi
  3848. AC_ARG_ENABLE([qt-test],
  3849. [AS_HELP_STRING([--enable-qt-test],[Enable qt tests (default: disabled)])],
  3850. [ ENABLED_QT_TEST=$enableval ],
  3851. [ ENABLED_QT_TEST=no ]
  3852. )
  3853. if test "$ENABLED_QT_TEST" = "yes"
  3854. then
  3855. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL3 -DWOLFSSL_STATIC_RSA"
  3856. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_PSK"
  3857. fi
  3858. # RSA
  3859. AC_ARG_ENABLE([rsa],
  3860. [AS_HELP_STRING([--enable-rsa],[Enable RSA (default: enabled)])],
  3861. [ ENABLED_RSA=$enableval ],
  3862. [ ENABLED_RSA=yes ]
  3863. )
  3864. if test "$ENABLED_RSA" = "no"
  3865. then
  3866. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  3867. else
  3868. # turn off RSA if leanpsk or leantls on
  3869. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  3870. then
  3871. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  3872. ENABLED_RSA=no
  3873. else
  3874. ENABLED_CERTS=yes
  3875. fi
  3876. fi
  3877. AC_ARG_ENABLE([oaep],
  3878. [AS_HELP_STRING([--enable-oaep],[Enable RSA OAEP (default: enabled)])],
  3879. [ ENABLED_OAEP=$enableval ],
  3880. [ ENABLED_OAEP=yes ]
  3881. )
  3882. if test "$ENABLED_OAEP" = "no"
  3883. then
  3884. AM_CFLAGS="$AM_CFLAGS -DWC_NO_RSA_OAEP"
  3885. fi
  3886. AC_ARG_ENABLE([rsapub],
  3887. [AS_HELP_STRING([--enable-rsapub],[Enable RSA Public Only (default: disabled)])],
  3888. [ ENABLED_RSAPUB=$enableval ],
  3889. [ ENABLED_RSAPUB=no ]
  3890. )
  3891. if test "$ENABLED_RSAPUB" = "yes"
  3892. then
  3893. if test "$ENABLED_RSA" = "no"
  3894. then
  3895. ENABLED_RSA="yes"
  3896. fi
  3897. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RSA_PUBLIC_ONLY"
  3898. fi
  3899. AC_ARG_ENABLE([rsavfy],
  3900. [AS_HELP_STRING([--enable-rsavfy],[Enable RSA Verify Inline Only (default: disabled)])],
  3901. [ ENABLED_RSAVFY=$enableval ],
  3902. [ ENABLED_RSAVFY=no ]
  3903. )
  3904. if test "$ENABLED_RSAVFY" = "yes"
  3905. then
  3906. if test "$ENABLED_RSA" = "no"
  3907. then
  3908. ENABLED_RSA="yes"
  3909. fi
  3910. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RSA_PUBLIC_ONLY -DWOLFSSL_RSA_VERIFY_ONLY"
  3911. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RSA_VERIFY_INLINE -DNO_SIG_WRAPPER"
  3912. AM_CFLAGS="$AM_CFLAGS -DNO_CHECK_PRIVATE_KEY"
  3913. fi
  3914. # RSA-PSS
  3915. AC_ARG_ENABLE([rsapss],
  3916. [ --enable-rsapss Enable RSA-PSS (default: disabled)],
  3917. [ ENABLED_RSAPSS=$enableval ],
  3918. [ ENABLED_RSAPSS=no ]
  3919. )
  3920. if test "$ENABLED_RSA" = "no"
  3921. then
  3922. ENABLED_RSAPSS="no"
  3923. else
  3924. if test "$ENABLED_TLS13" = "yes"
  3925. then
  3926. ENABLED_RSAPSS="yes"
  3927. fi
  3928. fi
  3929. if test "$ENABLED_RSAPSS" = "yes"
  3930. then
  3931. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS -DWOLFSSL_PSS_LONG_SALT"
  3932. fi
  3933. # DH
  3934. AC_ARG_ENABLE([dh],
  3935. [AS_HELP_STRING([--enable-dh],[Enable DH (default: enabled)])],
  3936. [ ENABLED_DH=$enableval ],
  3937. [ ENABLED_DH=yes ]
  3938. )
  3939. if test "$ENABLED_OPENSSH" = "yes" && test "$ENABLED_DH" = "no"
  3940. then
  3941. ENABLED_DH="yes"
  3942. fi
  3943. if test "$ENABLED_DH" = "no"
  3944. then
  3945. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  3946. else
  3947. # turn off DH if leanpsk or leantls on
  3948. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  3949. then
  3950. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  3951. ENABLED_DH=no
  3952. fi
  3953. fi
  3954. if test "$ENABLED_DH" = "const"
  3955. then
  3956. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_CONST"
  3957. fi
  3958. if test "$ENABLED_SNIFFER" = "yes" && test "$ENABLED_DH" != "no"
  3959. then
  3960. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_EXTRA"
  3961. fi
  3962. # Anonymous
  3963. AC_ARG_ENABLE([anon],
  3964. [AS_HELP_STRING([--enable-anon],[Enable Anonymous (default: disabled)])],
  3965. [ ENABLED_ANON=$enableval ],
  3966. [ ENABLED_ANON=no ]
  3967. )
  3968. if test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_NGINX" = "xyes" || \
  3969. test "x$ENABLED_HAPROXY" = "xyes" || test "$ENABLED_RSYSLOG" = "yes"
  3970. then
  3971. ENABLED_ANON=yes
  3972. fi
  3973. if test "x$ENABLED_ANON" = "xyes"
  3974. then
  3975. if test "$ENABLED_DH" = "no"
  3976. then
  3977. AC_MSG_ERROR([Anonymous suite requires DH.])
  3978. fi
  3979. AM_CFLAGS="$AM_CFLAGS -DHAVE_ANON"
  3980. fi
  3981. # ASN
  3982. # turn off asn, which means no certs, no rsa, no dsa, no ecc,
  3983. # and no big int (unless dh is on)
  3984. AC_ARG_ENABLE([asn],
  3985. [AS_HELP_STRING([--enable-asn],[Enable ASN (default: enabled)])],
  3986. [ ENABLED_ASN=$enableval ],
  3987. [ ENABLED_ASN=yes ]
  3988. )
  3989. if test "$ENABLED_ASN" = "no"
  3990. then
  3991. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_ASN_CRYPT"
  3992. enable_pwdbased=no
  3993. else
  3994. if test "$ENABLED_ASN" = "template"; then
  3995. ENABLED_ASN="yes"
  3996. fi
  3997. if test "$ENABLED_ASN" = "yes"; then
  3998. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASN_TEMPLATE"
  3999. else
  4000. if test "$ENABLED_ASN" != "original"; then
  4001. AC_MSG_ERROR([Invalid asn option. Valid are: template or original. Seen: $ENABLED_ASN.])
  4002. fi
  4003. fi
  4004. # turn off ASN if leanpsk on
  4005. if test "$ENABLED_LEANPSK" = "yes"
  4006. then
  4007. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_BIG_INT"
  4008. ENABLED_ASN=no
  4009. else
  4010. if test "$ENABLED_ASN" = "nocrypt"
  4011. then
  4012. AM_CFLAGS="$AM_CFLAGS -DNO_ASN_CRYPT"
  4013. enable_pwdbased=no
  4014. fi
  4015. fi
  4016. fi
  4017. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_RSAVFY" = "no" && \
  4018. test "$ENABLED_ASN" = "no" && test "$ENABLED_LOWRESOURCE" = "no"
  4019. then
  4020. AC_MSG_ERROR([please disable rsa if disabling asn.])
  4021. fi
  4022. if test "$ENABLED_DSA" = "yes" && test "$ENABLED_ASN" = "no"
  4023. then
  4024. AC_MSG_ERROR([please disable dsa if disabling asn.])
  4025. fi
  4026. if test "x$ENABLED_ECC" != "xno" && test "x$ENABLED_ASN" = "xno"
  4027. then
  4028. AC_MSG_ERROR([please disable ecc if disabling asn.])
  4029. fi
  4030. # No Big Int (ASN, DSA, RSA, DH, ECC and compatibility layer need bigint)
  4031. if test "$ENABLED_ASN" = "no" && test "$ENABLED_DSA" = "no" && \
  4032. test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no" && \
  4033. test "$ENABLED_RSA" = "no" && test "$ENABLED_OPENSSLEXTRA" = "no" && \
  4034. test "$ENABLED_OPENSSLALL" = "yes"
  4035. then
  4036. ENABLED_SP_MATH_ALL="no"
  4037. ENABLED_FASTMATH="no"
  4038. ENABLED_HEAPMATH="no"
  4039. ENABLED_BIGNUM="no"
  4040. else
  4041. ENABLED_BIGNUM="yes"
  4042. fi
  4043. case $host_os in
  4044. *linux* | *darwin* | *freebsd*)
  4045. DEF_ASN_PRINT="yes"
  4046. ;;
  4047. *)
  4048. DEF_ASN_PRINT="no"
  4049. ;;
  4050. esac
  4051. AC_ARG_ENABLE([asn-print],
  4052. [AS_HELP_STRING([--enable-asn-print],[Enable ASN Print API (default: enabled)])],
  4053. [ ENABLED_ASN_PRINT=$enableval ],
  4054. [ ENABLED_ASN_PRINT=$DEF_ASN_PRINT ]
  4055. )
  4056. if test "$ENABLED_ASN_PRINT" = "yes"
  4057. then
  4058. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASN_PRINT"
  4059. fi
  4060. # AES
  4061. AC_ARG_ENABLE([aes],
  4062. [AS_HELP_STRING([--enable-aes],[Enable AES (default: enabled)])],
  4063. [ ENABLED_AES=$enableval ],
  4064. [ ENABLED_AES=yes ]
  4065. )
  4066. if test "$ENABLED_AES" = "no"
  4067. then
  4068. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  4069. if test "$ENABLED_FORTRESS" = "yes"
  4070. then
  4071. AC_MSG_ERROR([fortress requires aes])
  4072. fi
  4073. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  4074. then
  4075. AC_MSG_ERROR([cannot enable eccencrypt and hkdf without aes.])
  4076. fi
  4077. if test "$ENABLED_AESGCM" != "no"
  4078. then
  4079. AC_MSG_ERROR([AESGCM requires AES.])
  4080. fi
  4081. if test "$ENABLED_AESCCM" = "yes"
  4082. then
  4083. AC_MSG_ERROR([AESCCM requires AES.])
  4084. fi
  4085. if test "$ENABLED_AESCTR" = "yes"
  4086. then
  4087. AC_MSG_ERROR([AESCTR requires AES.])
  4088. fi
  4089. else
  4090. # turn off AES if leanpsk on
  4091. if test "$ENABLED_LEANPSK" = "yes"
  4092. then
  4093. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  4094. ENABLED_AES=no
  4095. fi
  4096. fi
  4097. # DTLSv1.3
  4098. AC_ARG_ENABLE([dtls13],
  4099. [AS_HELP_STRING([--enable-dtls13],[Enable wolfSSL DTLS v1.3 (default: disabled)])],
  4100. [ ENABLED_DTLS13=$enableval ],
  4101. [ ENABLED_DTLS13=no ]
  4102. )
  4103. if test "x$ENABLED_DTLS13" = "xyes"
  4104. then
  4105. if test "x$ENABLED_DTLS" != "xyes" || test "x$ENABLED_TLS13" != "xyes"
  4106. then
  4107. AC_MSG_ERROR([You need to enable both DTLS and TLSv1.3 to use DTLSv1.3])
  4108. fi
  4109. if test "x$ENABLED_SEND_HRR_COOKIE" = "xundefined"
  4110. then
  4111. AC_MSG_NOTICE([DTLSv1.3 is enabled, enabling HRR cookie])
  4112. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SEND_HRR_COOKIE"
  4113. ENABLED_SEND_HRR_COOKIE="yes"
  4114. fi
  4115. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS13 -DWOLFSSL_W64_WRAPPER"
  4116. if test "x$ENABLED_AES" = "xyes"
  4117. then
  4118. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  4119. fi
  4120. fi
  4121. # DTLS CID support
  4122. AC_ARG_ENABLE([dtlscid],
  4123. [AS_HELP_STRING([--enable-dtlscid],[Enable wolfSSL DTLS ConnectionID (default: disabled)])],
  4124. [ ENABLED_DTLS_CID=$enableval ],
  4125. [ ENABLED_DTLS_CID=no ]
  4126. )
  4127. if test "x$ENABLED_DTLS_CID" = "xyes"
  4128. then
  4129. if test "x$ENABLED_DTLS13" != "xyes"
  4130. then
  4131. AC_MSG_ERROR([You need to enable DTLSv1.3 to use DTLS ConnectionID])
  4132. fi
  4133. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS_CID"
  4134. fi
  4135. # DTLS 1.3 Fragment Second ClientHello
  4136. AC_ARG_ENABLE([dtls-frag-ch],
  4137. [AS_HELP_STRING([--enable-dtls-frag-ch],[Enable wolfSSL DTLS 1.3 ClientHello fragmenting (default: disabled)])],
  4138. [ ENABLED_DTLS_CH_FRAG=$enableval ],
  4139. [ ENABLED_DTLS_CH_FRAG=no ]
  4140. )
  4141. if test "x$ENABLED_DTLS_CH_FRAG" = "xyes"
  4142. then
  4143. if test "x$ENABLED_DTLS13" != "xyes"
  4144. then
  4145. AC_MSG_ERROR([You need to enable DTLSv1.3 to use DTLS ClientHello fragmenting])
  4146. fi
  4147. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS_CH_FRAG"
  4148. fi
  4149. # CODING
  4150. AC_ARG_ENABLE([coding],
  4151. [AS_HELP_STRING([--enable-coding],[Enable Coding base 16/64 (default: enabled)])],
  4152. [ ENABLED_CODING=$enableval ],
  4153. [ ENABLED_CODING=yes ]
  4154. )
  4155. if test "$ENABLED_CODING" = "no"
  4156. then
  4157. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  4158. else
  4159. # turn off CODING if leanpsk on
  4160. if test "$ENABLED_LEANPSK" = "yes"
  4161. then
  4162. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  4163. ENABLED_CODING=no
  4164. fi
  4165. fi
  4166. # Base64 Encode
  4167. BASE64ENCODE_DEFAULT=no
  4168. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "amd64"
  4169. then
  4170. BASE64ENCODE_DEFAULT=yes
  4171. fi
  4172. AC_ARG_ENABLE([base64encode],
  4173. [AS_HELP_STRING([--enable-base64encode],[Enable Base64 encoding (default: enabled on x86_64/amd64)])],
  4174. [ ENABLED_BASE64ENCODE=$enableval ],
  4175. [ ENABLED_BASE64ENCODE=$BASE64ENCODE_DEFAULT ]
  4176. )
  4177. if test "$ENABLED_BASE64ENCODE" = "yes"
  4178. then
  4179. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BASE64_ENCODE"
  4180. fi
  4181. # Base16
  4182. AC_ARG_ENABLE([base16],
  4183. [AS_HELP_STRING([--enable-base16],[Enable Base16 encoding/decoding (default: disabled)])],
  4184. [ ENABLED_BASE16=$enableval ],
  4185. [ ENABLED_BASE16=no ]
  4186. )
  4187. if test "$ENABLED_CAAM" = "qnx"
  4188. then
  4189. ENABLED_BASE16=yes
  4190. fi
  4191. if test "$ENABLED_BASE16" = "yes"
  4192. then
  4193. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BASE16"
  4194. fi
  4195. # MD4
  4196. AC_ARG_ENABLE([md4],
  4197. [AS_HELP_STRING([--enable-md4],[Enable MD4 (default: disabled)])],
  4198. [ ENABLED_MD4=$enableval ],
  4199. [ ENABLED_MD4=no ]
  4200. )
  4201. # DES3
  4202. AC_ARG_ENABLE([des3],
  4203. [AS_HELP_STRING([--enable-des3],[Enable DES3 (default: disabled)])],
  4204. [ ENABLED_DES3=$enableval ],
  4205. [ ENABLED_DES3=no ]
  4206. )
  4207. # Enable 3DES with OpenSSH and FIPS 140-2 but not 140-3
  4208. if (test "$ENABLED_OPENSSH" = "yes" && \
  4209. (test "x$ENABLED_FIPS" = "xno" || test "$HAVE_FIPS_VERSION" -le 2)) || \
  4210. test "$ENABLED_QT" = "yes" || test "$ENABLED_OPENVPN" = "yes" || \
  4211. test "x$ENABLED_WPAS" != "xno" || test "$ENABLED_NETSNMP" = "yes" || \
  4212. test "$ENABLED_LIBSSH2" = "yes" || test "$ENABLED_KRB" = "yes" || \
  4213. test "$ENABLED_WOLFENGINE" = "yes" || test "$ENABLED_STRONGSWAN" = "yes"
  4214. then
  4215. ENABLED_DES3="yes"
  4216. fi
  4217. # DES3 TLS suites
  4218. AC_ARG_ENABLE([des3-tls-suites],
  4219. [AS_HELP_STRING([--enable-des3-tls-suites],[Enable DES3 TLS cipher suites (default: disabled)])],
  4220. [ ENABLED_DES3_TLS_SUITES=$enableval ],
  4221. [ ENABLED_DES3_TLS_SUITES=no ]
  4222. )
  4223. # ARC4
  4224. if (test "$ENABLED_OPENSSH" = "yes" && test "x$ENABLED_FIPS" = "xno") || \
  4225. test "$ENABLED_WPAS" = "yes" || test "$ENABLED_KRB" = "yes"
  4226. then
  4227. # Requires RC4 make sure on (if not forcefully disabled with --disable-arc4)
  4228. test "$enable_arc4" = "" && enable_arc4=yes
  4229. fi
  4230. AC_ARG_ENABLE([arc4],
  4231. [AS_HELP_STRING([--enable-arc4],[Enable ARC4 (default: disabled)])],
  4232. [ ENABLED_ARC4=$enableval ],
  4233. [ ENABLED_ARC4=no ]
  4234. )
  4235. # MD5
  4236. AC_ARG_ENABLE([md5],
  4237. [AS_HELP_STRING([--enable-md5],[Enable MD5 (default: enabled)])],
  4238. [ ENABLED_MD5=$enableval ],
  4239. [ ENABLED_MD5=yes ]
  4240. )
  4241. # SHA
  4242. AC_ARG_ENABLE([sha],
  4243. [AS_HELP_STRING([--enable-sha],[Enable SHA (default: enabled)])],
  4244. [ ENABLED_SHA=$enableval ],
  4245. [ ENABLED_SHA=yes ]
  4246. )
  4247. if test "$ENABLED_SHA" = "no"
  4248. then
  4249. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  4250. else
  4251. # turn off SHA if leanpsk or leantls on
  4252. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  4253. then
  4254. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  4255. ENABLED_SHA=no
  4256. fi
  4257. fi
  4258. if test "$ENABLED_SHA" = "no" && test "$ENABLED_DSA" != "no"
  4259. then
  4260. AC_MSG_ERROR([please disable DSA if disabling SHA-1.])
  4261. fi
  4262. # SipHash
  4263. AC_ARG_ENABLE([siphash],
  4264. [AS_HELP_STRING([--enable-siphash],[Enable SipHash (default: disabled)])],
  4265. [ ENABLED_SIPHASH=$enableval ],
  4266. [ ENABLED_SIPHASH=no ]
  4267. )
  4268. AS_IF([test "x$ENABLED_SIPHASH" = "xyes"],
  4269. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SIPHASH"])
  4270. # CMAC
  4271. AC_ARG_ENABLE([cmac],
  4272. [AS_HELP_STRING([--enable-cmac],[Enable CMAC (default: disabled)])],
  4273. [ ENABLED_CMAC=$enableval ],
  4274. [ ENABLED_CMAC=no ]
  4275. )
  4276. if test "$ENABLED_WPAS" != "no" || test "$ENABLED_NTP" = "yes" || test "$ENABLED_AESSIV" = "yes" || test "$ENABLED_WOLFENGINE" = "yes" || test "$ENABLED_AESEAX" = "yes"
  4277. then
  4278. ENABLED_CMAC=yes
  4279. fi
  4280. AS_IF([test "x$ENABLED_CMAC" = "xyes"],
  4281. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC -DWOLFSSL_AES_DIRECT"])
  4282. # AES-XTS
  4283. AC_ARG_ENABLE([aesxts],
  4284. [AS_HELP_STRING([--enable-aesxts],[Enable AES XTS (default: disabled)])],
  4285. [ ENABLED_AESXTS=$enableval ],
  4286. [ ENABLED_AESXTS=no ]
  4287. )
  4288. AS_IF([test "$ENABLED_AESXTS" = "yes" && test "$ENABLED_ARMASM" = "no"],
  4289. [ ENABLED_AESXTS_STREAM_DEFAULT=yes ],
  4290. [ ENABLED_AESXTS_STREAM_DEFAULT=no ]
  4291. )
  4292. AC_ARG_ENABLE([aesxts-stream],
  4293. [AS_HELP_STRING([--enable-aesxts-stream],[Enable wolfSSL AES-XTS support with streaming APIs (default: disabled)])],
  4294. [ ENABLED_AESXTS_STREAM=$enableval ],
  4295. [ ENABLED_AESXTS_STREAM=$ENABLED_AESXTS_STREAM_DEFAULT ]
  4296. )
  4297. # legacy old option name, for compatibility:
  4298. AC_ARG_ENABLE([xts],
  4299. [AS_HELP_STRING([--enable-xts],[Please use --enable-aesxts])],
  4300. [ ENABLED_AESXTS=$enableval ]
  4301. )
  4302. # Web Server Build
  4303. AC_ARG_ENABLE([webserver],
  4304. [AS_HELP_STRING([--enable-webserver],[Enable Web Server (default: disabled)])],
  4305. [ ENABLED_WEBSERVER=$enableval ],
  4306. [ ENABLED_WEBSERVER=no ]
  4307. )
  4308. if test "$ENABLED_WEBSERVER" = "yes"
  4309. then
  4310. AM_CFLAGS="$AM_CFLAGS -DHAVE_WEBSERVER"
  4311. fi
  4312. # Web Client Build (HTTP Client)
  4313. AC_ARG_ENABLE([webclient],
  4314. [AS_HELP_STRING([--enable-webclient],[Enable Web Client (HTTP) (default: disabled)])],
  4315. [ ENABLED_WEBCLIENT=$enableval ],
  4316. [ ENABLED_WEBCLIENT=no ]
  4317. )
  4318. if test "$ENABLED_WEBCLIENT" = "yes"
  4319. then
  4320. AM_CFLAGS="$AM_CFLAGS -DHAVE_HTTP_CLIENT"
  4321. fi
  4322. # RC2
  4323. AC_ARG_ENABLE([rc2],
  4324. [AS_HELP_STRING([--enable-rc2],[Enable RC2 encryption (default: disabled)])],
  4325. [ ENABLED_RC2=$enableval ],
  4326. [ ENABLED_RC2=no ]
  4327. )
  4328. if test "$ENABLED_RC2" = "yes"
  4329. then
  4330. AM_CFLAGS="$AM_CFLAGS -DWC_RC2"
  4331. fi
  4332. # CUDA
  4333. AC_ARG_ENABLE([cuda],
  4334. [AS_HELP_STRING([--enable-cuda],[Enable NVidia CUDA support (default: disabled)])],
  4335. [ ENABLED_CUDA=$enableval ],
  4336. [ ENABLED_CUDA=no ]
  4337. )
  4338. if test "$ENABLED_CUDA" = "yes"
  4339. then
  4340. CC=nvcc
  4341. AM_CFLAGS="$AM_CFLAGS -DWC_CUDA -DHAVE_CUDA"
  4342. fi
  4343. # Certificate Service Support (CFLAG sections later) keep above FIPS section
  4344. AC_ARG_ENABLE([certservice],
  4345. [AS_HELP_STRING([--enable-certservice],[Enable cert service (default: disabled)])],
  4346. [ ENABLED_CERT_SERVICE=$enableval ],
  4347. [ ENABLED_CERT_SERVICE=no ]
  4348. )
  4349. # PWDBASED (CFLAG sections later) keep above FIPS section
  4350. AC_ARG_ENABLE([pwdbased],
  4351. [AS_HELP_STRING([--enable-pwdbased],[Enable PWDBASED (default: disabled)])],
  4352. [ ENABLED_PWDBASED=$enableval ],
  4353. [ ENABLED_PWDBASED=no ]
  4354. )
  4355. # MemUse Entropy
  4356. # wolfEntropy Software Jitter SP800-90B certifiable entropy source
  4357. AC_ARG_ENABLE([wolfEntropy],
  4358. [AS_HELP_STRING([--enable-wolfEntropy],[Enable memuse entropy support (default: disabled)])],
  4359. [ ENABLED_ENTROPY_MEMUSE=$enableval ],
  4360. [ ENABLED_ENTROPY_MEMUSE=no ]
  4361. )
  4362. AC_ARG_ENABLE([entropy-memuse],
  4363. [AS_HELP_STRING([--enable-entropy-memuse],[Enable memuse entropy support (default: disabled)])],
  4364. [ ENABLED_ENTROPY_MEMUSE=$enableval ],
  4365. [ ENABLED_ENTROPY_MEMUSE=no ]
  4366. )
  4367. # AES key wrap
  4368. AC_ARG_ENABLE([aeskeywrap],
  4369. [AS_HELP_STRING([--enable-aeskeywrap],[Enable AES key wrap support (default: disabled)])],
  4370. [ ENABLED_AESKEYWRAP=$enableval ],
  4371. [ ENABLED_AESKEYWRAP=no ]
  4372. )
  4373. # FIPS feature and macro setup
  4374. AS_CASE([$FIPS_VERSION],
  4375. [v6|ready|dev],[ # FIPS 140-3 SRTP-KDF
  4376. AM_CFLAGS="$AM_CFLAGS \
  4377. -DHAVE_FIPS \
  4378. -DHAVE_FIPS_VERSION=$HAVE_FIPS_VERSION \
  4379. -DHAVE_FIPS_VERSION_MAJOR=$HAVE_FIPS_VERSION_MAJOR \
  4380. -DHAVE_FIPS_VERSION_MINOR=$HAVE_FIPS_VERSION_MINOR \
  4381. -DHAVE_FIPS_VERSION_PATCH=$HAVE_FIPS_VERSION_PATCH \
  4382. -DHAVE_ECC_CDH \
  4383. -DWC_RSA_NO_PADDING \
  4384. -DECC_USER_CURVES \
  4385. -DHAVE_ECC384 \
  4386. -DHAVE_ECC521 \
  4387. -DWOLFSSL_VALIDATE_FFC_IMPORT \
  4388. -DHAVE_FFDHE_Q \
  4389. -DHAVE_FFDHE_3072 \
  4390. -DHAVE_FFDHE_4096 \
  4391. -DHAVE_FFDHE_6144 \
  4392. -DHAVE_FFDHE_8192"
  4393. # KCAPI API does not support custom k for sign, don't force enable ECC key sizes and do not use seed callback
  4394. AS_IF([test "x$ENABLED_KCAPI_ECC" = "xno"],
  4395. [AM_CFLAGS="$AM_CFLAGS \
  4396. -DWC_RNG_SEED_CB \
  4397. -DWOLFSSL_ECDSA_SET_K \
  4398. -DWOLFSSL_VALIDATE_ECC_IMPORT \
  4399. -DWOLFSSL_VALIDATE_ECC_KEYGEN \
  4400. -DHAVE_ECC192 \
  4401. -DHAVE_ECC224 \
  4402. -DHAVE_ECC256"])
  4403. DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS=8192
  4404. # optimizations section
  4405. # protocol section
  4406. AS_IF([test "$ENABLED_WOLFSSH" != "yes" && (test "$FIPS_VERSION" != "dev" || test "$enable_ssh" != "no")],
  4407. [enable_ssh="yes"])
  4408. AS_IF([test "$ENABLED_HKDF" != "yes"],
  4409. [ENABLED_HKDF="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"])
  4410. AS_IF([test "x$ENABLED_PWDBASED" = "xno"],
  4411. [ENABLED_PWDBASED="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_PBKDF2 -DHAVE_AESGCM"])
  4412. AS_IF([test "x$ENABLED_SRTP" = "xno"],
  4413. [ENABLED_SRTP="yes"])
  4414. AS_IF([test "x$ENABLED_SRTP_KDF" = "xno"],
  4415. [ENABLED_SRTP_KDF="yes"])
  4416. # public key section
  4417. AS_IF([test "$ENABLED_KEYGEN" != "yes" && (test "$FIPS_VERSION" != "dev" || test "$enable_keygen" != "no")],
  4418. [ENABLED_KEYGEN="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"])
  4419. # AS_IF([test "$ENABLED_COMPKEY" = "yes" && (test "$FIPS_VERSION" != "dev" || test "$enable_compkey" != "yes")],
  4420. # [ENABLED_COMPKEY="yes"])
  4421. AS_IF([test "$ENABLED_RSAPSS" != "yes"],
  4422. [ENABLED_RSAPSS="yes"; AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS"])
  4423. AS_IF([test "$ENABLED_ECC" != "yes"],
  4424. [ENABLED_ECC="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  4425. AS_IF([test "$ENABLED_ECC_SHAMIR" = "yes"],
  4426. [AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"])])
  4427. AS_IF([test "x$ENABLED_ED25519" != "xyes"],
  4428. [ENABLED_ED25519="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_ED25519 -DHAVE_ED25519_KEY_IMPORT"])
  4429. AS_IF([test "$ENABLED_CURVE25519" = "no"],
  4430. [ENABLED_CURVE25519="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE25519"])
  4431. AS_IF([test "x$ENABLED_ED448" != "xyes"],
  4432. [ENABLED_ED448="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_ED448 -DHAVE_ED448_KEY_IMPORT"])
  4433. AS_IF([test "x$ENABLED_CURVE448" != "xyes"],
  4434. [ENABLED_CURVE448="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE448"])
  4435. AS_IF([test "x$ENABLED_ED25519_STREAM" != "xyes"],
  4436. [ENABLED_ED25519_STREAM="yes"])
  4437. AS_IF([test "x$ENABLED_ED448_STREAM" != "xyes"],
  4438. [ENABLED_ED448_STREAM="yes"])
  4439. AS_IF([test "x$ENABLED_ECCCUSTCURVES" != "xno" && test "$FIPS_VERSION" != "dev"],
  4440. [ENABLED_ECCCUSTCURVES="no"])
  4441. # Hashing section
  4442. AS_IF([test "x$ENABLED_SHA3" != "xyes"],
  4443. [ENABLED_SHA3="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3"])
  4444. AS_IF([test "$ENABLED_SHA224" != "yes" && (test "$FIPS_VERSION" != "dev" || test "$enable_sha224" != "no")],
  4445. [ENABLED_SHA224="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA224"])
  4446. AS_IF([test "$ENABLED_SHA512" = "no"],
  4447. [ENABLED_SHA512="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"])
  4448. # SHA512-224 and SHA512-256 are SHA-2 algorithms not in our FIPS algorithm list
  4449. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA512_224 -DWOLFSSL_NOSHA512_256"
  4450. # Shake128 because we're testing SHAKE256
  4451. AS_IF([test "x$ENABLED_SHAKE128" = "xno"],
  4452. [ENABLED_SHAKE128="yes"])
  4453. # Shake256 mandated for ED448
  4454. AS_IF([test "x$ENABLED_SHAKE256" = "xno"],
  4455. [ENABLED_SHAKE256="yes"])
  4456. # Aes section
  4457. AS_IF([test "$ENABLED_AESCCM" != "yes"],
  4458. [ENABLED_AESCCM="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"])
  4459. AS_IF([test "$ENABLED_AESCTR" != "yes"],
  4460. [ENABLED_AESCTR="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER"])
  4461. AS_IF([test "$ENABLED_CMAC" != "yes"],
  4462. [ENABLED_CMAC="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC"])
  4463. AS_IF([test "$ENABLED_AESGCM" = "no"],
  4464. [ENABLED_AESGCM="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"; AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"])
  4465. # AES-GCM streaming is part of the v6 FIPS suite, but isn't implemented
  4466. # for armasm on arm-v7 or earlier (see armasm setup above).
  4467. AS_IF([test "$ENABLED_AESGCM_STREAM" != "yes" && ! (test "$ENABLED_ARMASM" = "yes" && test "$ENABLED_ARMASM_CRYPTO" = "no")],
  4468. [ENABLED_AESGCM_STREAM="yes"])
  4469. AS_IF([test "x$ENABLED_AESOFB" = "xno"],
  4470. [ENABLED_AESOFB="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_OFB"])
  4471. AS_IF([test "x$ENABLED_AESCFB" = "xno"],
  4472. [ENABLED_AESCFB="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_CFB"])
  4473. AS_IF([test "x$ENABLED_AESXTS" = "xno"],
  4474. [ENABLED_AESXTS="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_XTS"])
  4475. AS_IF([test "x$ENABLED_AESXTS" = "xyes" && test "x$ENABLED_AESNI" = "xyes"],
  4476. [AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_AES_XTS"])
  4477. AS_IF([test "x$ENABLED_AESXTS_STREAM" = "xno" && ! (test "$ENABLED_ARMASM" = "yes" || test "$ENABLED_ARMASM_CRYPTO" = "no")],
  4478. [ENABLED_AESXTS_STREAM="yes"])
  4479. AS_IF([(test "$ENABLED_AESCCM" = "yes" && test "$HAVE_AESCCM_PORT" != "yes") ||
  4480. (test "$ENABLED_AESCTR" = "yes" && test "$HAVE_AESCTR_PORT" != "yes") ||
  4481. (test "$ENABLED_AESGCM" = "yes" && test "$HAVE_AESGCM_PORT" != "yes") ||
  4482. (test "$ENABLED_AESOFB" = "yes" && test "$HAVE_AESOFB_PORT" != "yes")],
  4483. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT -DHAVE_AES_ECB"])
  4484. AS_IF([test "x$ENABLED_AESKEYWRAP" != "xyes"],
  4485. [ENABLED_AESKEYWRAP="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_KEYWRAP"])
  4486. # Old TLS requires MD5 + HMAC, which is not allowed under FIPS 140-3
  4487. AS_IF([test "$ENABLED_OLD_TLS" != "no"],
  4488. [ENABLED_OLD_TLS="no"; AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"])
  4489. ],
  4490. [v5*], [ # FIPS 140-3
  4491. AM_CFLAGS="$AM_CFLAGS \
  4492. -DHAVE_FIPS \
  4493. -DHAVE_FIPS_VERSION=$HAVE_FIPS_VERSION \
  4494. -DHAVE_FIPS_VERSION_MAJOR=$HAVE_FIPS_VERSION_MAJOR \
  4495. -DHAVE_FIPS_VERSION_MINOR=$HAVE_FIPS_VERSION_MINOR \
  4496. -DHAVE_FIPS_VERSION_PATCH=$HAVE_FIPS_VERSION_PATCH \
  4497. -DHAVE_ECC_CDH \
  4498. -DWC_RSA_NO_PADDING \
  4499. -DECC_USER_CURVES \
  4500. -DHAVE_ECC384 \
  4501. -DHAVE_ECC521 \
  4502. -DWOLFSSL_VALIDATE_FFC_IMPORT \
  4503. -DHAVE_FFDHE_Q \
  4504. -DHAVE_FFDHE_3072 \
  4505. -DHAVE_FFDHE_4096 \
  4506. -DHAVE_FFDHE_6144 \
  4507. -DHAVE_FFDHE_8192"
  4508. # KCAPI API does not support custom k for sign, don't force enable ECC key sizes and do not use seed callback
  4509. AS_IF([test "x$ENABLED_KCAPI_ECC" = "xno"],
  4510. [AM_CFLAGS="$AM_CFLAGS \
  4511. -DWC_RNG_SEED_CB \
  4512. -DWOLFSSL_ECDSA_SET_K \
  4513. -DWOLFSSL_VALIDATE_ECC_IMPORT \
  4514. -DWOLFSSL_VALIDATE_ECC_KEYGEN \
  4515. -DHAVE_ECC192 \
  4516. -DHAVE_ECC224 \
  4517. -DHAVE_ECC256"])
  4518. DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS=8192
  4519. # force various features to FIPS 140-3 defaults, unless overridden with dev:
  4520. AS_IF([test "$ENABLED_KEYGEN" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_keygen" != "no")],
  4521. [ENABLED_KEYGEN="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"])
  4522. AS_IF([test "$ENABLED_COMPKEY" = "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_compkey" != "yes")],
  4523. [ENABLED_COMPKEY="no"])
  4524. AS_IF([test "$ENABLED_SHA224" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_sha224" != "no")],
  4525. [ENABLED_SHA224="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA224"])
  4526. AS_IF([test "$ENABLED_SHA3" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_sha3" != "no")],
  4527. [ENABLED_SHA3="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3"])
  4528. AS_IF([test "$ENABLED_WOLFSSH" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_ssh" != "no")],
  4529. [enable_ssh="yes"])
  4530. # Shake128 is a SHA-3 algorithm outside the v5 FIPS algorithm list
  4531. AS_IF([test "$ENABLED_SHAKE128" != "no" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_shake128" != "yes")],
  4532. [ENABLED_SHAKE128=no; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_SHAKE128"])
  4533. # Shake256 is a SHA-3 algorithm outside the v5 FIPS algorithm list
  4534. AS_IF([test "$ENABLED_SHAKE256" != "no" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_shake256" != "yes")],
  4535. [ENABLED_SHAKE256=no; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_SHAKE256"])
  4536. # SHA512-224 and SHA512-256 are SHA-2 algorithms outside the v5 FIPS algorithm list
  4537. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA512_224 -DWOLFSSL_NOSHA512_256"
  4538. AS_IF([test "$ENABLED_AESCCM" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_aesccm" != "no")],
  4539. [ENABLED_AESCCM="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"])
  4540. AS_IF([test "$ENABLED_AESXTS" = "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_aesxts" != "yes")],
  4541. [ENABLED_AESXTS="no"])
  4542. AS_IF([test "$ENABLED_RSAPSS" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_rsapss" != "no")],
  4543. [ENABLED_RSAPSS="yes"; AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS"])
  4544. AS_IF([test "$ENABLED_ECC" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_ecc" != "no")],
  4545. [ENABLED_ECC="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  4546. AS_IF([test "$ENABLED_ECC_SHAMIR" = "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_eccshamir" != "no")],
  4547. [AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"])])
  4548. AS_IF([test "$ENABLED_AESCTR" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_aesctr" != "no")],
  4549. [ENABLED_AESCTR="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER"])
  4550. AS_IF([test "$ENABLED_CMAC" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_cmac" != "no")],
  4551. [ENABLED_CMAC="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC"])
  4552. AS_IF([test "$ENABLED_HKDF" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_hkdf" != "no")],
  4553. [ENABLED_HKDF="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"])
  4554. AS_IF([test "$ENABLED_INTELASM" = "yes"],
  4555. [AM_CFLAGS="$AM_CFLAGS -DFORCE_FAILURE_RDSEED"])
  4556. AS_IF([test "$ENABLED_SHA512" = "no" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_sha512" != "no")],
  4557. [ENABLED_SHA512="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"])
  4558. AS_IF([test "$ENABLED_AESGCM" = "no" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_aesgcm" != "no")],
  4559. [ENABLED_AESGCM="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"; AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"])
  4560. # AES-GCM streaming isn't part of the v5 FIPS suite.
  4561. AS_IF([test "$ENABLED_AESGCM_STREAM" = "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_aesgcm_stream" != "yes")],
  4562. [ENABLED_AESGCM_STREAM="no"])
  4563. # Old TLS requires MD5 + HMAC, which is not allowed under FIPS 140-3
  4564. AS_IF([test "$ENABLED_OLD_TLS" != "no"],
  4565. [ENABLED_OLD_TLS="no"; AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"])
  4566. AS_IF([test $HAVE_FIPS_VERSION_MINOR -ge 2],
  4567. [AS_IF([test "x$ENABLED_AESOFB" = "xno" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_aesofb" != "no")],
  4568. [ENABLED_AESOFB="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_OFB"])])
  4569. AS_IF([(test "$ENABLED_AESCCM" = "yes" && test "$HAVE_AESCCM_PORT" != "yes") ||
  4570. (test "$ENABLED_AESCTR" = "yes" && test "$HAVE_AESCTR_PORT" != "yes") ||
  4571. (test "$ENABLED_AESGCM" = "yes" && test "$HAVE_AESGCM_PORT" != "yes") ||
  4572. (test "$ENABLED_AESOFB" = "yes" && test "$HAVE_AESOFB_PORT" != "yes") ||
  4573. (test "$ENABLED_AESXTS" = "yes" && test "$HAVE_AESXTS_PORT" != "yes")],
  4574. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT -DHAVE_AES_ECB"])
  4575. ],
  4576. [v2],[ # FIPS 140-2, Cert 3389
  4577. AM_CFLAGS="$AM_CFLAGS \
  4578. -DHAVE_FIPS \
  4579. -DHAVE_FIPS_VERSION=$HAVE_FIPS_VERSION \
  4580. -DHAVE_FIPS_VERSION_MAJOR=$HAVE_FIPS_VERSION_MAJOR \
  4581. -DHAVE_FIPS_VERSION_MINOR=$HAVE_FIPS_VERSION_MINOR \
  4582. -DHAVE_FIPS_VERSION_PATCH=$HAVE_FIPS_VERSION_PATCH \
  4583. -DWOLFSSL_KEY_GEN \
  4584. -DWOLFSSL_SHA224 \
  4585. -DWOLFSSL_AES_DIRECT \
  4586. -DHAVE_AES_ECB \
  4587. -DHAVE_ECC_CDH \
  4588. -DWC_RSA_NO_PADDING \
  4589. -DWOLFSSL_VALIDATE_FFC_IMPORT \
  4590. -DHAVE_FFDHE_Q \
  4591. -DHAVE_PUBLIC_FFDHE"
  4592. ENABLED_KEYGEN="yes"
  4593. ENABLED_SHA224="yes"
  4594. ENABLED_DES3="yes"
  4595. # Shake256 is a SHA-3 algorithm not in our FIPS algorithm list
  4596. ENABLED_SHAKE256=no
  4597. # SHA512-224 and SHA512-256 are SHA-2 algorithms not in our FIPS algorithm list
  4598. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA512_224 -DWOLFSSL_NOSHA512_256"
  4599. AS_IF([test "x$ENABLED_AESCCM" != "xyes"],
  4600. [ENABLED_AESCCM="yes"
  4601. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"])
  4602. AS_IF([test "x$ENABLED_RSAPSS" != "xyes"],
  4603. [ENABLED_RSAPSS="yes"
  4604. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS"])
  4605. AS_IF([test "x$ENABLED_ECC" != "xyes"],
  4606. [ENABLED_ECC="yes"
  4607. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DWOLFSSL_VALIDATE_ECC_IMPORT"
  4608. AS_IF([test "x$ENABLED_ECC_SHAMIR" = "xyes"],
  4609. [AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"])],
  4610. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_IMPORT"])
  4611. AS_IF([test "x$ENABLED_AESCTR" != "xyes"],
  4612. [ENABLED_AESCTR="yes"
  4613. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER"])
  4614. AS_IF([test "x$ENABLED_AESCTR" != "xyes"],
  4615. [ENABLED_AESCTR="yes"
  4616. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_AES_COUNTER"])
  4617. AS_IF([test "x$ENABLED_CMAC" != "xyes"],
  4618. [ENABLED_CMAC="yes"
  4619. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC"])
  4620. AS_IF([test "x$ENABLED_HKDF" != "xyes"],
  4621. [ENABLED_HKDF="yes"
  4622. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"])
  4623. AS_IF([test "x$ENABLED_INTELASM" = "xyes"],
  4624. [AM_CFLAGS="$AM_CFLAGS -DFORCE_FAILURE_RDSEED"])
  4625. AS_IF([test "x$ENABLED_SHA512" = "xno"],
  4626. [ENABLED_SHA512="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"])
  4627. AS_IF([test "x$ENABLED_AESGCM" = "xno"],
  4628. [ENABLED_AESGCM="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"])
  4629. ],
  4630. ["rand"],[
  4631. AM_CFLAGS="$AM_CFLAGS \
  4632. -DWOLFCRYPT_FIPS_RAND \
  4633. -DHAVE_FIPS \
  4634. -DHAVE_FIPS_VERSION=$HAVE_FIPS_VERSION \
  4635. -DHAVE_FIPS_VERSION_MAJOR=$HAVE_FIPS_VERSION_MAJOR \
  4636. -DHAVE_FIPS_VERSION_MINOR=$HAVE_FIPS_VERSION_MINOR \
  4637. -DHAVE_FIPS_VERSION_PATCH=$HAVE_FIPS_VERSION_PATCH"
  4638. ],
  4639. ["v1"],[ # FIPS 140-2, Cert 2425
  4640. AM_CFLAGS="$AM_CFLAGS \
  4641. -DHAVE_FIPS \
  4642. -DHAVE_FIPS_VERSION=$HAVE_FIPS_VERSION \
  4643. -DHAVE_FIPS_VERSION_MAJOR=$HAVE_FIPS_VERSION_MAJOR \
  4644. -DHAVE_FIPS_VERSION_MINOR=$HAVE_FIPS_VERSION_MINOR \
  4645. -DHAVE_FIPS_VERSION_PATCH=$HAVE_FIPS_VERSION_PATCH"
  4646. AS_IF([test "x$ENABLED_SHA512" = "xno"],
  4647. [ENABLED_SHA512="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"])
  4648. AS_IF([test "x$ENABLED_AESGCM" = "xno"],
  4649. [ENABLED_AESGCM="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"])
  4650. AS_IF([test "x$ENABLED_DES3" = "xno"],[ENABLED_DES3="yes"])
  4651. ])
  4652. AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$thread_ls_on" = "xno" && test "$ENABLE_LINUXKM" = "no"],
  4653. [AC_MSG_ERROR([FIPS requires Thread Local Storage])])
  4654. AS_IF([(test "$ENABLED_NULL_CIPHER" = "yes" || test "$ENABLED_LEANPSK" = "yes") && test "$ENABLED_FIPS" != "no" && test "$FIPS_VERSION" != "dev" && test "$FIPS_VERSION" != "v5-dev"],
  4655. [AC_MSG_ERROR([FIPS is incompatible with nullcipher])])
  4656. # SELFTEST
  4657. AC_ARG_ENABLE([selftest],
  4658. [AS_HELP_STRING([--enable-selftest],[Enable selftest, Will NOT work w/o CAVP selftest license (default: disabled)])],
  4659. [ ENABLED_SELFTEST=$enableval ],
  4660. [ ENABLED_SELFTEST="no" ]
  4661. )
  4662. AS_CASE([$ENABLED_SELFTEST],
  4663. ["v2"],[
  4664. # selftest v2 (wolfCrypt 4.1.0)
  4665. ENABLED_SELFTEST="yes"
  4666. SELFTEST_VERSION="v2"
  4667. ],
  4668. ["no"],[SELFTEST_VERSION="none"],
  4669. [
  4670. # selftest v1 (wolfCrypt 3.14.2)
  4671. ENABLED_SELFTEST="yes"
  4672. SELFTEST_VERSION="v1"
  4673. ])
  4674. AS_CASE([$SELFTEST_VERSION],
  4675. ["v2"],[
  4676. AM_CFLAGS="$AM_CFLAGS -DHAVE_SELFTEST -DHAVE_SELFTEST_VERSION=2 -DHAVE_PUBLIC_FFDHE"
  4677. ],
  4678. ["v1"],[
  4679. AM_CFLAGS="$AM_CFLAGS -DHAVE_SELFTEST -DHAVE_PUBLIC_FFDHE"
  4680. ])
  4681. AS_IF([test "x$ENABLED_AESXTS" = "xyes"],
  4682. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_XTS -DWOLFSSL_AES_DIRECT"])
  4683. AS_IF([test "x$ENABLED_AESXTS" = "xyes" && test "x$ENABLED_INTELASM" = "xyes"],
  4684. [AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_AES_XTS"])
  4685. AS_IF([test "x$ENABLED_AESXTS" = "xyes" && test "x$ENABLED_AESNI" = "xyes"],
  4686. [AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_AES_XTS"])
  4687. # ECC Custom Curves
  4688. if test "$ENABLED_ECCCUSTCURVES" != "no"
  4689. then
  4690. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES"
  4691. # For distro, all or ecccustcurves=all builds, enable all curve types
  4692. if test "$ENABLED_DISTRO" = "yes" || test "$ENABLED_ALL" = "yes" || test "$ENABLED_ECCCUSTCURVES" = "all"
  4693. then
  4694. # Enable ECC SECPR2, SECPR3, BRAINPOOL and KOBLITZ curves
  4695. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ"
  4696. # Enable ECC Cofactor support
  4697. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_CDH"
  4698. # If fastmath enabled and on x86 use speedups
  4699. if test "x$ENABLED_FASTMATH" = "xyes" && test "$host_cpu" = "x86_64" -o "$host_cpu" = "amd64"
  4700. then
  4701. AM_CFLAGS="$AM_CFLAGS -DTFM_ECC192 -DTFM_ECC224 -DTFM_ECC256 -DTFM_ECC384 -DTFM_ECC521"
  4702. fi
  4703. fi
  4704. fi
  4705. # Curve448
  4706. if test "$ENABLED_CURVE448" != "no"
  4707. then
  4708. if test "$ENABLED_CURVE448" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  4709. then
  4710. AM_CFLAGS="$AM_CFLAGS -DCURVE448_SMALL"
  4711. ENABLED_CURVE448_SMALL=yes
  4712. ENABLED_CURVE448=yes
  4713. fi
  4714. if test "$ENABLED_CURVE448" = "no128bit" || test "$ENABLED_32BIT" = "yes"
  4715. then
  4716. AM_CFLAGS="$AM_CFLAGS -DNO_CURVED448_128BIT"
  4717. ENABLED_CURVE448=yes
  4718. fi
  4719. AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE448"
  4720. ENABLED_FE448=yes
  4721. fi
  4722. # Ed448
  4723. if test "$ENABLED_ED448" != "no"
  4724. then
  4725. if test "$ENABLED_ED448" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  4726. then
  4727. AM_CFLAGS="$AM_CFLAGS -DED448_SMALL"
  4728. ENABLED_ED448_SMALL=yes
  4729. ENABLED_CURVE448_SMALL=yes
  4730. ENABLED_ED448=yes
  4731. fi
  4732. if test "$ENABLED_SHA512" = "no"
  4733. then
  4734. AC_MSG_ERROR([cannot enable ed448 without enabling sha512.])
  4735. fi
  4736. if test "x$HAVE_FIPS_VERSION" = "x2"
  4737. then
  4738. AC_MSG_ERROR([cannot enable ed448 w/ dependency shake256 in FIPSv2 mode])
  4739. fi
  4740. ENABLED_FE448=yes
  4741. ENABLED_GE448=yes
  4742. AM_CFLAGS="$AM_CFLAGS -DHAVE_ED448"
  4743. # EdDSA448 requires SHAKE256 which requires SHA-3
  4744. if test "$ENABLED_SHA3" = "no"
  4745. then
  4746. ENABLED_SHA3=yes
  4747. fi
  4748. ENABLED_SHAKE256=yes
  4749. ENABLED_CERTS=yes
  4750. fi
  4751. # SRTP-KDF
  4752. if test "$ENABLED_SRTP" = "yes"
  4753. then
  4754. ENABLED_SRTP_KDF="yes"
  4755. fi
  4756. if test "$ENABLED_SRTP_KDF" = "yes"
  4757. then
  4758. AM_CFLAGS="$AM_CFLAGS -DWC_SRTP_KDF -DHAVE_AES_ECB -DWOLFSSL_AES_DIRECT"
  4759. fi
  4760. # Set SHA-3 flags
  4761. if test "$ENABLED_SHA3" != "no"
  4762. then
  4763. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3"
  4764. fi
  4765. # Set SHAKE128 flags
  4766. # FIPS traditionally does not support SHAKE 128, v6 does
  4767. AS_IF([test "x$ENABLED_FIPS" = "xyes" && test $HAVE_FIPS_VERSION -lt 6],
  4768. [ENABLED_SHAKE128="no"])
  4769. if test "$ENABLED_SHAKE128" != "no"
  4770. then
  4771. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHAKE128"
  4772. if test "$ENABLED_SHA3" = "no"
  4773. then
  4774. AC_MSG_ERROR([Must have SHA-3 enabled: --enable-sha3])
  4775. fi
  4776. else
  4777. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_SHAKE128"
  4778. fi
  4779. # Set SHAKE256 flags
  4780. # FIPS traditionally does not support SHAKE 256, v6 does
  4781. AS_IF([test "x$ENABLED_FIPS" = "xyes" && test $HAVE_FIPS_VERSION -lt 6],
  4782. [ENABLED_SHAKE256="no"])
  4783. if test "$ENABLED_SHAKE256" != "no"
  4784. then
  4785. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHAKE256"
  4786. if test "$ENABLED_SHA3" = "no"
  4787. then
  4788. AC_MSG_ERROR([Must have SHA-3 enabled: --enable-sha3])
  4789. fi
  4790. else
  4791. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_SHAKE256"
  4792. fi
  4793. # set POLY1305 default
  4794. POLY1305_DEFAULT=yes
  4795. if test "x$ENABLED_FIPS" = "xyes"
  4796. then
  4797. POLY1305_DEFAULT=no
  4798. fi
  4799. # POLY1305
  4800. AC_ARG_ENABLE([poly1305],
  4801. [AS_HELP_STRING([--enable-poly1305],[Enable wolfSSL POLY1305 support (default: enabled)])],
  4802. [ ENABLED_POLY1305=$enableval ],
  4803. [ ENABLED_POLY1305=$POLY1305_DEFAULT]
  4804. )
  4805. # leanpsk and leantls don't need poly1305
  4806. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  4807. then
  4808. ENABLED_POLY1305=no
  4809. fi
  4810. if test "$ENABLED_POLY1305" = "yes"
  4811. then
  4812. AM_CFLAGS="$AM_CFLAGS -DHAVE_POLY1305"
  4813. fi
  4814. # set CHACHA default
  4815. CHACHA_DEFAULT=yes
  4816. if test "x$ENABLED_FIPS" = "xyes"
  4817. then
  4818. CHACHA_DEFAULT=no
  4819. fi
  4820. # CHACHA
  4821. AC_ARG_ENABLE([chacha],
  4822. [AS_HELP_STRING([--enable-chacha],[Enable CHACHA (default: enabled). Use `=noasm` to disable ASM AVX/AVX2 speedups])],
  4823. [ ENABLED_CHACHA=$enableval ],
  4824. [ ENABLED_CHACHA=$CHACHA_DEFAULT]
  4825. )
  4826. # leanpsk and leantls don't need chacha
  4827. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  4828. then
  4829. ENABLED_CHACHA=no
  4830. fi
  4831. if test "$ENABLED_CHACHA" = "noasm" || test "$ENABLED_ASM" = "no"
  4832. then
  4833. AM_CFLAGS="$AM_CFLAGS -DNO_CHACHA_ASM"
  4834. fi
  4835. if test "$ENABLED_CHACHA" != "no"
  4836. then
  4837. AM_CFLAGS="$AM_CFLAGS -DHAVE_CHACHA"
  4838. fi
  4839. # XCHACHA
  4840. AC_ARG_ENABLE([xchacha],
  4841. [AS_HELP_STRING([--enable-xchacha],[Enable XCHACHA (default: disabled).])],
  4842. [ ENABLED_XCHACHA=$enableval ],
  4843. [ ENABLED_XCHACHA=no]
  4844. )
  4845. if test "$ENABLED_XCHACHA" = "yes"
  4846. then
  4847. if test "$ENABLED_CHACHA" = "no"
  4848. then
  4849. AC_MSG_ERROR([XChaCha (--enable-xchacha) depends on ChaCha (--enable-chacha)])
  4850. fi
  4851. AM_CFLAGS="$AM_CFLAGS -DHAVE_XCHACHA"
  4852. fi
  4853. # Hash DRBG
  4854. AC_ARG_ENABLE([hashdrbg],
  4855. [AS_HELP_STRING([--enable-hashdrbg],[Enable Hash DRBG support (default: enabled)])],
  4856. [ ENABLED_HASHDRBG=$enableval ],
  4857. [ ENABLED_HASHDRBG=yes ]
  4858. )
  4859. if test "x$ENABLED_HASHDRBG" = "xyes"
  4860. then
  4861. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  4862. else
  4863. # turn on Hash DRBG if FIPS is on (don't force on for KCAPI)
  4864. if test "x$ENABLED_FIPS" = "xyes" && test "x$ENABLED_KCAPI" = "xno"
  4865. then
  4866. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  4867. ENABLED_HASHDRBG=yes
  4868. else
  4869. AM_CFLAGS="$AM_CFLAGS -DWC_NO_HASHDRBG"
  4870. fi
  4871. fi
  4872. # MemUse Entropy (AKA wolfEntropy)
  4873. if test "x$ENABLED_ENTROPY_MEMUSE" != "xno"
  4874. then
  4875. AM_CFLAGS="$AM_CFLAGS -DHAVE_ENTROPY_MEMUSE"
  4876. enable_sha3=yes
  4877. for v in `echo $ENABLED_ENTROPY_MEMUSE | tr "," " "`
  4878. do
  4879. case $v in
  4880. yes)
  4881. ;;
  4882. thread)
  4883. AM_CFLAGS="$AM_CFLAGS -DENTROPY_MEMUSE_THREAD"
  4884. ;;
  4885. nofallback)
  4886. AM_CFLAGS="$AM_CFLAGS -DENTROPY_MEMUSE_FORCE_FAILURE"
  4887. ;;
  4888. *)
  4889. AC_MSG_ERROR([Invalid MemUse Entropy option. Valid are: thread, nofallback. Seen: $ENABLED_ENTROPY_MEMUSE.])
  4890. break;;
  4891. esac
  4892. done
  4893. fi
  4894. # Filesystem Build
  4895. if test "$ENABLED_LINUXKM" = "yes"
  4896. then
  4897. ENABLED_FILESYSTEM_DEFAULT=no
  4898. else
  4899. ENABLED_FILESYSTEM_DEFAULT=yes
  4900. fi
  4901. AC_ARG_ENABLE([filesystem],
  4902. [AS_HELP_STRING([--enable-filesystem],[Enable Filesystem support (default: enabled)])],
  4903. [ ENABLED_FILESYSTEM=$enableval ],
  4904. [ ENABLED_FILESYSTEM=$ENABLED_FILESYSTEM_DEFAULT ]
  4905. )
  4906. if test "$ENABLED_FILESYSTEM" = "no"
  4907. then
  4908. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  4909. else
  4910. # turn off filesystem if leanpsk on
  4911. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LINUXKM" = "yes"
  4912. then
  4913. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  4914. ENABLED_FILESYSTEM=no
  4915. fi
  4916. fi
  4917. # inline Build
  4918. AC_ARG_ENABLE([inline],
  4919. [AS_HELP_STRING([--enable-inline],[Enable inline functions (default: enabled)])],
  4920. [ ENABLED_INLINE=$enableval ],
  4921. [ ENABLED_INLINE=yes ]
  4922. )
  4923. if test "$ENABLED_INLINE" = "no"
  4924. then
  4925. AM_CFLAGS="$AM_CFLAGS -DNO_INLINE"
  4926. fi
  4927. # OCSP
  4928. if test "x$ENABLED_OPENSSLALL" = "xyes" || test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  4929. then
  4930. test "$enable_ocsp" = "" && enable_ocsp=yes
  4931. fi
  4932. AC_ARG_ENABLE([ocsp],
  4933. [AS_HELP_STRING([--enable-ocsp],[Enable OCSP (default: disabled)])],
  4934. [ ENABLED_OCSP=$enableval ],
  4935. [ ENABLED_OCSP=no ]
  4936. )
  4937. if test "$ENABLED_OCSP" = "yes"
  4938. then
  4939. # check openssl command tool for testing ocsp
  4940. AC_CHECK_PROG([HAVE_OPENSSL_CMD],[openssl],[yes],[no])
  4941. if test "$HAVE_OPENSSL_CMD" = "yes"
  4942. then
  4943. AM_CFLAGS="$AM_CFLAGS -DHAVE_OPENSSL_CMD"
  4944. else
  4945. AC_MSG_WARN([openssl command line tool not available for testing ocsp])
  4946. fi
  4947. fi
  4948. # Certificate Status Request : a.k.a. OCSP Stapling
  4949. AC_ARG_ENABLE([ocspstapling],
  4950. [AS_HELP_STRING([--enable-ocspstapling],[Enable OCSP Stapling (default: disabled)])],
  4951. [ ENABLED_CERTIFICATE_STATUS_REQUEST=$enableval ],
  4952. [ ENABLED_CERTIFICATE_STATUS_REQUEST=no ]
  4953. )
  4954. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  4955. then
  4956. ENABLED_CERTIFICATE_STATUS_REQUEST="yes"
  4957. fi
  4958. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"
  4959. then
  4960. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST"
  4961. # Requires OCSP make sure on
  4962. if test "x$ENABLED_OCSP" = "xno"
  4963. then
  4964. ENABLED_OCSP="yes"
  4965. fi
  4966. fi
  4967. # Certificate Status Request v2 : a.k.a. OCSP stapling v2
  4968. AC_ARG_ENABLE([ocspstapling2],
  4969. [AS_HELP_STRING([--enable-ocspstapling2],[Enable OCSP Stapling v2 (default: disabled)])],
  4970. [ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=$enableval ],
  4971. [ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=no ]
  4972. )
  4973. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  4974. then
  4975. ENABLED_CERTIFICATE_STATUS_REQUEST_V2=yes
  4976. fi
  4977. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"
  4978. then
  4979. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST_V2"
  4980. # Requires OCSP make sure on
  4981. if test "x$ENABLED_OCSP" = "xno"
  4982. then
  4983. ENABLED_OCSP="yes"
  4984. fi
  4985. fi
  4986. # CRL
  4987. AC_ARG_ENABLE([crl],
  4988. [AS_HELP_STRING([--enable-crl],[Enable CRL (Use =io for inline CRL HTTP GET) (default: disabled)])],
  4989. [ ENABLED_CRL=$enableval ],
  4990. [ ENABLED_CRL=no ]
  4991. )
  4992. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_OPENVPN" = "xyes" || \
  4993. test "x$ENABLED_WPAS" != "xno" || test "x$ENABLED_LIGHTY" = "xyes" || test "x$ENABLED_NETSNMP" = "xyes" || \
  4994. test "x$ENABLED_KRB" = "xyes" || test "x$ENABLED_STRONGSWAN" = "xyes"
  4995. then
  4996. ENABLED_CRL=yes
  4997. fi
  4998. if test "$ENABLED_CRL" != "no"
  4999. then
  5000. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  5001. fi
  5002. if test "$ENABLED_CRL" = "io"
  5003. then
  5004. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_IO"
  5005. fi
  5006. # CRL Monitor
  5007. AC_ARG_ENABLE([crl-monitor],
  5008. [AS_HELP_STRING([--enable-crl-monitor],[Enable CRL Monitor (default: disabled)])],
  5009. [ ENABLED_CRL_MONITOR=$enableval ],
  5010. [ ENABLED_CRL_MONITOR=no ]
  5011. )
  5012. if test "$ENABLED_CRL_MONITOR" = "yes"
  5013. then
  5014. case $host_os in
  5015. *linux* | *darwin* | *freebsd*)
  5016. if test "x$ENABLED_SINGLETHREADED" = "xno"; then
  5017. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR"
  5018. else
  5019. ENABLED_CRL_MONITOR="no"
  5020. AC_MSG_ERROR([crl monitor requires threading / pthread])
  5021. fi
  5022. ;;
  5023. *)
  5024. if test "x$ENABLED_DISTRO" = "xyes" ; then
  5025. ENABLED_CRL_MONITOR="no"
  5026. else
  5027. AC_MSG_ERROR( [crl monitor only allowed on linux, OS X, or freebsd])
  5028. fi
  5029. break;;
  5030. esac
  5031. fi
  5032. # Whitewood netRandom client library
  5033. ENABLED_WNR="no"
  5034. trywnrdir=""
  5035. AC_ARG_WITH([wnr],
  5036. [AS_HELP_STRING([--with-wnr=PATH],[Path to Whitewood netRandom install (default /usr/local)])],
  5037. [
  5038. AC_MSG_CHECKING([for Whitewood netRandom])
  5039. LIBS="$LIBS -lwnr"
  5040. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wnr.h>]], [[ wnr_setup(0, 0); ]])], [ wnr_linked=yes ],[ wnr_linked=no ])
  5041. if test "x$wnr_linked" = "xno" ; then
  5042. if test "x$withval" != "xno" ; then
  5043. trywnrdir=$withval
  5044. fi
  5045. if test "x$withval" = "xyes" ; then
  5046. trywnrdir="/usr/local"
  5047. fi
  5048. CPPFLAGS="$AM_CPPFLAGS -DHAVE_WNR -I$trywnrdir/include"
  5049. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$trywnrdir/lib"
  5050. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wnr.h>]], [[ wnr_setup(0, 0); ]])], [ wnr_linked=yes ],[ wnr_linked=no ])
  5051. if test "x$wnr_linked" = "xno" ; then
  5052. AC_MSG_ERROR([Whitewood netRandom isn't found.
  5053. If it's already installed, specify its path using --with-wnr=/dir/])
  5054. fi
  5055. AC_MSG_RESULT([yes])
  5056. AM_CPPFLAGS="$CPPFLAGS"
  5057. AM_LDFLAGS="$AM_LDFLAGS -L$trywnrdir/lib"
  5058. else
  5059. AC_MSG_RESULT([yes])
  5060. fi
  5061. AM_CFLAGS="$AM_CFLAGS -DHAVE_WNR"
  5062. ENABLED_WNR="yes"
  5063. ]
  5064. )
  5065. # SNI
  5066. # enable SNI automatically for x86_64/x86/aarch64/amd64
  5067. SNI_DEFAULT=no
  5068. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "x86" || test "$host_cpu" = "aarch64" || test "$host_cpu" = "amd64"
  5069. then
  5070. SNI_DEFAULT=yes
  5071. fi
  5072. AC_ARG_ENABLE([sni],
  5073. [AS_HELP_STRING([--enable-sni],[Enable SNI (default: enabled on x86_64/x86/aarch64/amd64)])],
  5074. [ ENABLED_SNI=$enableval ],
  5075. [ ENABLED_SNI=$SNI_DEFAULT ]
  5076. )
  5077. if test "x$ENABLED_QT" = "xyes" || test "$ENABLED_QUIC" = "yes"
  5078. then
  5079. ENABLED_SNI="yes"
  5080. fi
  5081. if test "x$ENABLED_SNI" = "xyes"
  5082. then
  5083. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  5084. fi
  5085. # Maximum Fragment Length
  5086. AC_ARG_ENABLE([maxfragment],
  5087. [AS_HELP_STRING([--enable-maxfragment],[Enable Maximum Fragment Length (default: disabled)])],
  5088. [ ENABLED_MAX_FRAGMENT=$enableval ],
  5089. [ ENABLED_MAX_FRAGMENT=no ]
  5090. )
  5091. # ALPN
  5092. AC_ARG_ENABLE([alpn],
  5093. [AS_HELP_STRING([--enable-alpn],[Enable ALPN (default: disabled)])],
  5094. [ ENABLED_ALPN=$enableval ],
  5095. [ ENABLED_ALPN=no ]
  5096. )
  5097. if test "$ENABLED_BIND" = "yes"
  5098. then
  5099. ENABLED_ALPN=yes
  5100. fi
  5101. if test "$ENABLED_QUIC" = "yes"
  5102. then
  5103. ENABLED_ALPN=yes
  5104. fi
  5105. if test "x$ENABLED_ALPN" = "xyes"
  5106. then
  5107. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
  5108. fi
  5109. # Maximum Fragment Length
  5110. if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
  5111. then
  5112. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
  5113. fi
  5114. # Trusted CA Indication Extension
  5115. AC_ARG_ENABLE([trustedca],
  5116. [AS_HELP_STRING([--enable-trustedca],[Enable Trusted CA Indication (default: disabled)])],
  5117. [ ENABLED_TRUSTED_CA=$enableval ],[ ENABLED_TRUSTED_CA=no ])
  5118. AS_IF([test "x$ENABLED_TRUSTED_CA" = "xyes"],
  5119. [AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUSTED_CA"])
  5120. # Truncated HMAC
  5121. AC_ARG_ENABLE([truncatedhmac],
  5122. [AS_HELP_STRING([--enable-truncatedhmac],[Enable Truncated HMAC (default: disabled)])],
  5123. [ ENABLED_TRUNCATED_HMAC=$enableval ],
  5124. [ ENABLED_TRUNCATED_HMAC=no ]
  5125. )
  5126. if test "x$ENABLED_TRUNCATED_HMAC" = "xyes"
  5127. then
  5128. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUNCATED_HMAC"
  5129. fi
  5130. # Renegotiation Indication - (FAKE Secure Renegotiation)
  5131. # Client will send TLS_EMPTY_RENEGOTIATION_INFO_SCSV, not supported
  5132. # with enabling secure renegotiation
  5133. AC_ARG_ENABLE([renegotiation-indication],
  5134. [AS_HELP_STRING([--enable-renegotiation-indication],[Enable Renegotiation Indication for client via empty cipher (default: disabled)])],
  5135. [ ENABLED_RENEGOTIATION_INDICATION=$enableval ],
  5136. [ ENABLED_RENEGOTIATION_INDICATION=no ]
  5137. )
  5138. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  5139. then
  5140. AM_CFLAGS="$AM_CFLAGS -DHAVE_RENEGOTIATION_INDICATION"
  5141. fi
  5142. # Secure Renegotiation
  5143. AC_ARG_ENABLE([secure-renegotiation],
  5144. [AS_HELP_STRING([--enable-secure-renegotiation],[Enable Secure Renegotiation (default: disabled)])],
  5145. [ ENABLED_SECURE_RENEGOTIATION=$enableval ],
  5146. [ ENABLED_SECURE_RENEGOTIATION=no ]
  5147. )
  5148. if test "x$ENABLED_HAPROXY" = "xyes"
  5149. then
  5150. ENABLED_SECURE_RENEGOTIATION=yes
  5151. fi
  5152. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xyes"
  5153. then
  5154. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  5155. then
  5156. AC_MSG_ERROR([cannot enable renegotiation-indication and secure-renegotiation.])
  5157. fi
  5158. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION -DHAVE_SERVER_RENEGOTIATION_INFO"
  5159. fi
  5160. # Secure Renegotiation Info
  5161. AC_ARG_ENABLE([secure-renegotiation-info],
  5162. [AS_HELP_STRING([--enable-secure-renegotiation-info],[Enable Secure Renegotiation info extension (default: enabled)])],
  5163. [ ENABLED_SECURE_RENEGOTIATION_INFO=$enableval ],
  5164. [ ENABLED_SECURE_RENEGOTIATION_INFO=yes ]
  5165. )
  5166. # Fallback SCSV
  5167. AC_ARG_ENABLE([fallback-scsv],
  5168. [AS_HELP_STRING([--enable-fallback-scsv],[Enable Fallback SCSV (default: disabled)])],
  5169. [ ENABLED_FALLBACK_SCSV=$enableval ],
  5170. [ ENABLED_FALLBACK_SCSV=no ]
  5171. )
  5172. if test "x$ENABLED_FALLBACK_SCSV" = "xyes"
  5173. then
  5174. AM_CFLAGS="$AM_CFLAGS -DHAVE_FALLBACK_SCSV"
  5175. fi
  5176. # Exporting Keying Material
  5177. AC_ARG_ENABLE([keying-material],
  5178. [AS_HELP_STRING([--enable-keying-material],[Enable Keying Material Exporters (default: disabled)])],
  5179. [ ENABLED_KEYING_MATERIAL=$enableval ],
  5180. [ ENABLED_KEYING_MATERIAL=no ]
  5181. )
  5182. if test "$ENABLED_CHRONY" = "yes" || test "$ENABLED_SRTP" = "yes"
  5183. then
  5184. ENABLED_KEYING_MATERIAL=yes
  5185. fi
  5186. if test "x$ENABLED_KEYING_MATERIAL" = "xyes"
  5187. then
  5188. AM_CFLAGS="$AM_CFLAGS -DHAVE_KEYING_MATERIAL"
  5189. fi
  5190. # Supported Elliptic Curves Extensions
  5191. AC_ARG_ENABLE([supportedcurves],
  5192. [AS_HELP_STRING([--enable-supportedcurves],[Enable Supported Elliptic Curves (default: enabled)])],
  5193. [ENABLED_SUPPORTED_CURVES=$enableval],
  5194. [ENABLED_SUPPORTED_CURVES=yes])
  5195. if test "x$ENABLED_SUPPORTED_CURVES" = "xyes"
  5196. then
  5197. AS_IF([test "x$ENABLED_ECC" = "xno" && test "x$ENABLED_CURVE25519" = "xno" && test "x$ENABLED_CURVE448" = "xno"],
  5198. [ENABLED_SUPPORTED_CURVES=no],
  5199. [AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES"])
  5200. fi
  5201. # Diffie-Hellman
  5202. if test "$ENABLED_DH" != "no"
  5203. then
  5204. if test "$ENABLED_TLS13" = "yes" || test "$ENABLED_SUPPORTED_CURVES" = "yes"
  5205. then
  5206. AM_CFLAGS="$AM_CFLAGS -DHAVE_FFDHE_2048"
  5207. fi
  5208. fi
  5209. # FFDHE parameters only
  5210. AC_ARG_ENABLE([ffdhe-only],
  5211. [AS_HELP_STRING([--enable-ffdhe-only],[Enable using only FFDHE in client (default: disabled)])],
  5212. [ ENABLED_FFDHE_ONLY=$enableval ],
  5213. [ ENABLED_FFDHE_ONLY=no ]
  5214. )
  5215. if test "x$ENABLED_FFDHE_ONLY" = "xyes"
  5216. then
  5217. if test "$ENABLED_DH" = "no"
  5218. then
  5219. AC_MSG_ERROR([FFDHE only support requires DH support])
  5220. fi
  5221. if test "$ENABLED_SUPPORTED_CURVES" = "no"
  5222. then
  5223. AC_MSG_ERROR([FFDHE only support requires Supported Curves extension])
  5224. fi
  5225. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_REQUIRE_FFDHE"
  5226. fi
  5227. # TLS 1.3 Requires either ECC or (RSA/DH), or CURVE25519/ED25519 or CURVE448/ED448 or libOQS
  5228. if test "x$ENABLED_PSK" = "xno" && test "x$ENABLED_ECC" = "xno" && \
  5229. (test "x$ENABLED_RSA" = "xno" || test "x$ENABLED_DH" = "xno") && \
  5230. (test "x$ENABLED_CURVE25519" = "xno" || test "x$ENABLED_ED25519" = "xno") && \
  5231. (test "x$ENABLED_CURVE448" = "xno" || test "x$ENABLED_ED448" = "xno") && \
  5232. test "x$ENABLED_LIBOQS" = "xno"
  5233. then
  5234. # disable TLS 1.3
  5235. ENABLED_TLS13=no
  5236. fi
  5237. if test "$ENABLED_TLS13" = "yes" && (test "x$ENABLED_ECC" = "xyes" || \
  5238. test "$ENABLED_DH" != "no")
  5239. then
  5240. AM_CFLAGS="$AM_CFLAGS -DHAVE_SUPPORTED_CURVES"
  5241. fi
  5242. if test "$ENABLED_TLS13" = "yes"
  5243. then
  5244. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TLS13 -DHAVE_TLS_EXTENSIONS"
  5245. fi
  5246. # Session Ticket Extension
  5247. AC_ARG_ENABLE([session-ticket],
  5248. [AS_HELP_STRING([--enable-session-ticket],[Enable Session Ticket (default: disabled)])],
  5249. [ ENABLED_SESSION_TICKET=$enableval ],
  5250. [ ENABLED_SESSION_TICKET=no ]
  5251. )
  5252. if test "x$ENABLED_NGINX" = "xyes" || test "$ENABLED_WPAS" = "yes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  5253. then
  5254. ENABLED_SESSION_TICKET=yes
  5255. fi
  5256. if test "x$ENABLED_SESSION_TICKET" = "xyes"
  5257. then
  5258. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
  5259. fi
  5260. AC_ARG_ENABLE([ticket-nonce-malloc],
  5261. [AS_HELP_STRING([--enable-ticket-nonce-malloc], [Enable dynamic allocation of ticket nonces (default: disabled)])],
  5262. [ ENABLED_TICKET_NONCE_MALLOC=$enableval ],
  5263. [ ENABLED_TICKET_NONCE_MALLOC=no_implicit ]
  5264. )
  5265. if test "$ENABLED_TICKET_NONCE_MALLOC" = "yes"
  5266. then
  5267. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TICKET_NONCE_MALLOC"
  5268. fi
  5269. # Extended Master Secret Extension
  5270. AC_ARG_ENABLE([extended-master],
  5271. [AS_HELP_STRING([--enable-extended-master],[Enable Extended Master Secret (default: enabled)])],
  5272. [ ENABLED_EXTENDED_MASTER=$enableval ],
  5273. [ ENABLED_EXTENDED_MASTER=yes ]
  5274. )
  5275. if test "$ENABLED_CRYPTONLY" = "yes"
  5276. then
  5277. ENABLED_EXTENDED_MASTER=no
  5278. fi
  5279. if test "x$ENABLED_EXTENDED_MASTER" = "xyes"
  5280. then
  5281. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXTENDED_MASTER"
  5282. fi
  5283. # TLS Extensions
  5284. AC_ARG_ENABLE([tlsx],
  5285. [AS_HELP_STRING([--enable-tlsx],[Enable all TLS Extensions (default: disabled)])],
  5286. [ ENABLED_TLSX=$enableval ],
  5287. [ ENABLED_TLSX=no ]
  5288. )
  5289. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_SIGNAL" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes" || test "$ENABLED_CHRONY" = "yes"
  5290. then
  5291. ENABLED_TLSX=yes
  5292. fi
  5293. if test "x$ENABLED_TLSX" = "xyes"
  5294. then
  5295. ENABLED_SNI=yes
  5296. ENABLED_MAX_FRAGMENT=yes
  5297. ENABLED_TRUNCATED_HMAC=yes
  5298. ENABLED_ALPN=yes
  5299. ENABLED_TRUSTED_CA=yes
  5300. ENABLED_ENCRYPT_THEN_MAC=yes
  5301. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_ALPN -DHAVE_TRUSTED_CA"
  5302. # Check the ECC supported curves prereq
  5303. AS_IF([test "x$ENABLED_ECC" != "xno" || test "$ENABLED_CURVE25519" != "no" || test "x$ENABLED_CURVE448" = "xyes" || test "x$ENABLED_TLS13" = "xyes"],
  5304. [ENABLED_SUPPORTED_CURVES=yes
  5305. AM_CFLAGS="$AM_CFLAGS -DHAVE_SUPPORTED_CURVES"])
  5306. fi
  5307. # Early Data handshake in TLS v1.3 and above
  5308. AC_ARG_ENABLE([earlydata],
  5309. [AS_HELP_STRING([--enable-earlydata],[Enable Early Data handshake with wolfSSL TLS v1.3 (default: disabled)])],
  5310. [ ENABLED_TLS13_EARLY_DATA=$enableval ],
  5311. [ ENABLED_TLS13_EARLY_DATA=no ]
  5312. )
  5313. if test "$ENABLED_TLS13_EARLY_DATA" = "group"
  5314. then
  5315. ENABLED_TLS13_EARLY_DATA="yes"
  5316. # Group EarlyData with ClientHello
  5317. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_EARLY_DATA_GROUP"
  5318. fi
  5319. if test "$ENABLED_TLS13_EARLY_DATA" = "yes"
  5320. then
  5321. if test "x$ENABLED_TLS13" = "xno" && test "x$ENABLED_ALL" = "xno"
  5322. then
  5323. AC_MSG_ERROR([cannot enable earlydata without enabling tls13.])
  5324. fi
  5325. if test "x$ENABLED_SESSION_TICKET" = "xno" && test "x$ENABLED_PSK" = "xno"
  5326. then
  5327. AC_MSG_ERROR([cannot enable earlydata without enabling session tickets and/or PSK.])
  5328. fi
  5329. if test "x$ENABLED_TLS13" = "xyes"
  5330. then
  5331. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_EARLY_DATA"
  5332. fi
  5333. fi
  5334. if test "$ENABLED_TLSV12" = "no" && test "$ENABLED_TLS13" = "yes" && test "x$ENABLED_SESSION_TICKET" = "xno"
  5335. then
  5336. AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE"
  5337. fi
  5338. # PKCS7
  5339. AC_ARG_ENABLE([pkcs7],
  5340. [AS_HELP_STRING([--enable-pkcs7],[Enable PKCS7 (default: disabled)])],
  5341. [ ENABLED_PKCS7=$enableval ],
  5342. [ ENABLED_PKCS7=no ]
  5343. )
  5344. if test "x$ENABLED_WPAS_DPP" = "xyes"
  5345. then
  5346. ENABLED_PKCS7=yes
  5347. fi
  5348. # wolfSSH Options
  5349. AC_ARG_ENABLE([wolfssh],
  5350. [AS_HELP_STRING([--enable-wolfssh],[Enable wolfSSH options (default: disabled)])],
  5351. [ ENABLED_WOLFSSH=$enableval ],
  5352. [ ENABLED_WOLFSSH=no ]
  5353. )
  5354. AC_ARG_ENABLE([ssh],
  5355. [AS_HELP_STRING([--enable-ssh],[Enable wolfSSH options (default: disabled)])],
  5356. [ ENABLED_SSH=$enableval ],
  5357. [ ENABLED_SSH=no ]
  5358. )
  5359. if test "x$ENABLED_SSH" = "xyes"
  5360. then
  5361. ENABLED_WOLFSSH="yes"
  5362. fi
  5363. # wolfTPM Options
  5364. AC_ARG_ENABLE([wolftpm],
  5365. [AS_HELP_STRING([--enable-wolftpm],[Enable wolfTPM options (default: disabled)])],
  5366. [ ENABLED_WOLFTPM=$enableval ],
  5367. [ ENABLED_WOLFTPM=no ]
  5368. )
  5369. # wolfCLU Options
  5370. AC_ARG_ENABLE([wolfclu],
  5371. [AS_HELP_STRING([--enable-wolfclu],[Enable wolfCLU options (default: disabled)])],
  5372. [ ENABLED_WOLFCLU=$enableval ],
  5373. [ ENABLED_WOLFCLU=no ]
  5374. )
  5375. if test "x$ENABLED_WOLFTPM" = "xyes"
  5376. then
  5377. # Requires cryptocb (set in its enable section)
  5378. # Requires certgen, certreq, certext
  5379. if test "x$ENABLED_CERTGEN" = "xno"
  5380. then
  5381. ENABLED_CERTGEN="yes"
  5382. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  5383. fi
  5384. if test "x$ENABLED_CERTREQ" = "xno"
  5385. then
  5386. ENABLED_CERTREQ="yes"
  5387. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  5388. fi
  5389. if test "x$ENABLED_CERTEXT" = "xno"
  5390. then
  5391. ENABLED_CERTEXT="yes"
  5392. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  5393. fi
  5394. # Requires PKCS7
  5395. if test "x$ENABLED_PKCS7" = "xno"
  5396. then
  5397. ENABLED_PKCS7="yes"
  5398. fi
  5399. # Requires aescfb
  5400. if test "x$ENABLED_AESCFB" = "xno"
  5401. then
  5402. ENABLED_AESCFB="yes"
  5403. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_CFB"
  5404. fi
  5405. # Requires public mp_
  5406. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PUBLIC_MP"
  5407. fi
  5408. if test "x$ENABLED_SMIME" = "xyes"
  5409. then
  5410. AM_CFLAGS="$AM_CFLAGS -DHAVE_SMIME"
  5411. # Requires PKCS7
  5412. if test "x$ENABLED_PKCS7" = "xno"
  5413. then
  5414. ENABLED_PKCS7="yes"
  5415. fi
  5416. fi
  5417. # Simple Certificate Enrollment Protocol (SCEP)
  5418. AC_ARG_ENABLE([scep],
  5419. [AS_HELP_STRING([--enable-scep],[Enable wolfSCEP (default: disabled)])],
  5420. [ ENABLED_WOLFSCEP=$enableval ],
  5421. [ ENABLED_WOLFSCEP=no ]
  5422. )
  5423. # Secure Remote Password
  5424. AC_ARG_ENABLE([srp],
  5425. [AS_HELP_STRING([--enable-srp],[Enable Secure Remote Password (default: disabled)])],
  5426. [ ENABLED_SRP=$enableval ],
  5427. [ ENABLED_SRP=no ]
  5428. )
  5429. if test "x$ENABLED_SRP" = "xyes"
  5430. then
  5431. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_SRP"
  5432. fi
  5433. # Indefinite length encoded BER message support
  5434. AC_ARG_ENABLE([indef],
  5435. [AS_HELP_STRING([--enable-indef],[Enable parsing of indefinite length encoded msgs (default: disabled)])],
  5436. [ ENABLED_BER_INDEF=$enableval ],
  5437. [ ENABLED_BER_INDEF=no ]
  5438. )
  5439. if test "x$ENABLED_BER_INDEF" = "xyes"
  5440. then
  5441. AM_CFLAGS="$AM_CFLAGS -DASN_BER_TO_DER"
  5442. fi
  5443. # Alternate certification chains, as opposed to requiring full chain validation.
  5444. # Certificate validation behavior is relaxed, similar to openssl and
  5445. # browsers. Only the peer certificate must validate to a trusted
  5446. # certificate. Without this, all certificates sent by a peer must be
  5447. # used in the trust chain or the connection will be rejected.
  5448. AC_ARG_ENABLE([altcertchains],
  5449. [AS_HELP_STRING([--enable-altcertchains],[Enable using alternative certificate chains, only require leaf certificate to validate to trust root (default: disabled)])],
  5450. [ ENABLED_ALT_CERT_CHAINS=$enableval ],
  5451. [ ENABLED_ALT_CERT_CHAINS=no ]
  5452. )
  5453. if test "x$ENABLED_ALT_CERT_CHAINS" = "xyes"
  5454. then
  5455. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALT_CERT_CHAINS"
  5456. fi
  5457. # Small Stack - Cache on object
  5458. AC_ARG_ENABLE([smallstackcache],
  5459. [AS_HELP_STRING([--enable-smallstackcache],[Enable Small Stack Usage Caching (default: disabled)])],
  5460. [ ENABLED_SMALL_STACK_CACHE=$enableval ],
  5461. [ ENABLED_SMALL_STACK_CACHE=no ]
  5462. )
  5463. if test "x$ENABLED_SMALL_STACK_CACHE" = "xyes"
  5464. then
  5465. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SMALL_STACK_CACHE"
  5466. fi
  5467. # Small Stack
  5468. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  5469. then
  5470. ENABLED_SMALL_STACK_DEFAULT=yes
  5471. else
  5472. ENABLED_SMALL_STACK_DEFAULT=no
  5473. fi
  5474. AC_ARG_ENABLE([smallstack],
  5475. [AS_HELP_STRING([--enable-smallstack],[Enable Small Stack Usage (default: disabled)])],
  5476. [ ENABLED_SMALL_STACK=$enableval ],
  5477. [ ENABLED_SMALL_STACK=$ENABLED_SMALL_STACK_DEFAULT ]
  5478. )
  5479. if test "x$ENABLED_SMALL_STACK_CACHE" = "xyes"
  5480. then
  5481. ENABLED_SMALL_STACK=yes
  5482. fi
  5483. if test "x$ENABLED_SMALL_STACK" = "xyes"
  5484. then
  5485. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SMALL_STACK"
  5486. fi
  5487. #valgrind
  5488. AC_ARG_ENABLE([valgrind],
  5489. [AS_HELP_STRING([--enable-valgrind],[Enable valgrind for unit tests (default: disabled)])],
  5490. [ ENABLED_VALGRIND=$enableval ],
  5491. [ ENABLED_VALGRIND=no ]
  5492. )
  5493. if test "$ENABLED_VALGRIND" = "yes"
  5494. then
  5495. AC_CHECK_PROG([HAVE_VALGRIND],[valgrind],[yes],[no])
  5496. if test "$HAVE_VALGRIND" = "no"
  5497. then
  5498. AC_MSG_ERROR([Valgrind not found.])
  5499. fi
  5500. enable_shared=no
  5501. enable_static=yes
  5502. AM_CFLAGS="$AM_CFLAGS -DHAVE_VALGRIND"
  5503. fi
  5504. # Test certs, use internal cert functions for extra testing
  5505. AC_ARG_ENABLE([testcert],
  5506. [AS_HELP_STRING([--enable-testcert],[Enable Test Cert (default: disabled)])],
  5507. [ ENABLED_TESTCERT=$enableval ],
  5508. [ ENABLED_TESTCERT=no ]
  5509. )
  5510. if test "$ENABLED_TESTCERT" = "yes"
  5511. then
  5512. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TEST_CERT"
  5513. fi
  5514. # I/O Pool, an example to show user how to override memory handler and use
  5515. # a pool for the input/output buffer requests
  5516. AC_ARG_ENABLE([iopool],
  5517. [AS_HELP_STRING([--enable-iopool],[Enable I/O Pool example (default: disabled)])],
  5518. [ ENABLED_IOPOOL=$enableval ],
  5519. [ ENABLED_IOPOOL=no ]
  5520. )
  5521. if test "$ENABLED_IOPOOL" = "yes"
  5522. then
  5523. if test "$thread_ls_on" = "no"
  5524. then
  5525. AC_MSG_ERROR([I/O Pool example requires Thread Local Storage])
  5526. fi
  5527. AM_CFLAGS="$AM_CFLAGS -DHAVE_IO_POOL -DXMALLOC_USER"
  5528. fi
  5529. # Certificate Service Support
  5530. if test "$ENABLED_CERT_SERVICE" = "yes"
  5531. then
  5532. # Requires ecc,certgen, and opensslextra make sure on
  5533. if test "x$ENABLED_CERTGEN" = "xno"
  5534. then
  5535. ENABLED_CERTGEN="yes"
  5536. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  5537. fi
  5538. if test "x$ENABLED_ECC" = "xno"
  5539. then
  5540. ENABLED_ECC="yes"
  5541. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  5542. if test "$ENABLED_ECC_SHAMIR" = "yes"
  5543. then
  5544. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  5545. fi
  5546. fi
  5547. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  5548. then
  5549. ENABLED_OPENSSLEXTRA="yes"
  5550. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  5551. fi
  5552. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_CERT_SERVICE"
  5553. fi
  5554. # wolfSSL JNI
  5555. AC_ARG_ENABLE([jni],
  5556. [AS_HELP_STRING([--enable-jni],[Enable wolfSSL JNI (default: disabled)])],
  5557. [ ENABLED_JNI=$enableval ],
  5558. [ ENABLED_JNI=no ]
  5559. )
  5560. if test "$ENABLED_JNI" = "yes"
  5561. then
  5562. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_JNI"
  5563. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
  5564. AM_CFLAGS="$AM_CFLAGS -DKEEP_PEER_CERT"
  5565. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_VERIFY_CB"
  5566. # Enable prereqs if not already enabled
  5567. if test "x$ENABLED_DTLS" = "xno"
  5568. then
  5569. ENABLED_DTLS="yes"
  5570. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS"
  5571. fi
  5572. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  5573. then
  5574. ENABLED_OPENSSLEXTRA="yes"
  5575. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  5576. fi
  5577. if test "x$ENABLED_OPENSSLALL" = "xno"
  5578. then
  5579. ENABLED_OPENSSLALL="yes"
  5580. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_ALL"
  5581. fi
  5582. if test "x$ENABLED_CRL" = "xno"
  5583. then
  5584. ENABLED_CRL="yes"
  5585. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  5586. fi
  5587. if test "x$ENABLED_OCSP" = "xno"
  5588. then
  5589. ENABLED_OCSP="yes"
  5590. fi
  5591. if test "x$ENABLED_CRL_MONITOR" = "xno" && test "x$ENABLED_DISTRO" = "xno"
  5592. then
  5593. ENABLED_CRL_MONITOR="yes"
  5594. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR"
  5595. fi
  5596. if test "x$ENABLED_SAVESESSION" = "xno"
  5597. then
  5598. ENABLED_SAVESESSION="yes"
  5599. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  5600. fi
  5601. if test "x$ENABLED_SAVECERT" = "xno"
  5602. then
  5603. ENABLED_SAVECERT="yes"
  5604. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  5605. fi
  5606. if test "x$ENABLED_ATOMICUSER" = "xno"
  5607. then
  5608. ENABLED_ATOMICUSER="yes"
  5609. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  5610. fi
  5611. if test "x$ENABLED_ECC" = "xno"
  5612. then
  5613. ENABLED_ECC="yes"
  5614. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  5615. if test "$ENABLED_ECC_SHAMIR" = "yes"
  5616. then
  5617. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  5618. fi
  5619. fi
  5620. # Do not enable PK Callbacks in FIPS mode with JNI
  5621. if test "x$ENABLED_PKCALLBACKS" = "xno" && test "$ENABLED_FIPS" = "no"
  5622. then
  5623. ENABLED_PKCALLBACKS="yes"
  5624. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  5625. fi
  5626. if test "x$ENABLED_DH" = "xno"
  5627. then
  5628. ENABLED_DH="yes"
  5629. AM_CFLAGS="$AM_CFLAGS -DHAVE_DH"
  5630. fi
  5631. if test "x$ENABLED_PSK" = "xno"
  5632. then
  5633. ENABLED_PSK="yes"
  5634. fi
  5635. if test "x$ENABLED_CERTEXT" = "xno"
  5636. then
  5637. ENABLED_CERTEXT="yes"
  5638. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  5639. fi
  5640. if test "x$ENABLED_CERTGEN" = "xno"
  5641. then
  5642. ENABLED_CERTGEN="yes"
  5643. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  5644. fi
  5645. # wolfCrypt JNI/JCE uses keygen, enable by default here so
  5646. # both JCE and JSSE builds can use --enable-jni
  5647. if test "x$ENABLED_KEYGEN" = "xno"
  5648. then
  5649. ENABLED_KEYGEN="yes"
  5650. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  5651. fi
  5652. if test "x$ENABLED_CERTREQ" = "xno"
  5653. then
  5654. ENABLED_CERTREQ="yes"
  5655. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  5656. fi
  5657. if test "x$ENABLED_SNI" = "xno"
  5658. then
  5659. ENABLED_SNI="yes"
  5660. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  5661. fi
  5662. if test "x$ENABLED_ALPN" = "xno"
  5663. then
  5664. ENABLED_ALPN="yes"
  5665. AM_CFLAGS="$AM_CFLAGS -DHAVE_ALPN"
  5666. fi
  5667. if test "x$ENABLED_ALT_CERT_CHAINS" = "xno"
  5668. then
  5669. ENABLED_ALT_CERT_CHAINS="yes"
  5670. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALT_CERT_CHAINS"
  5671. fi
  5672. if test "x$ENABLED_SESSIONCERTS" = "xno"
  5673. then
  5674. ENABLED_SESSIONCERTS="yes"
  5675. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  5676. fi
  5677. # cert gen requires alt names
  5678. ENABLED_ALTNAMES="yes"
  5679. fi
  5680. if test "$ENABLED_LIGHTY" = "yes"
  5681. then
  5682. # Requires opensslextra make sure on
  5683. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  5684. then
  5685. ENABLED_OPENSSLEXTRA="yes"
  5686. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  5687. fi
  5688. AM_CFLAGS="$AM_CFLAGS -DHAVE_LIGHTY -DHAVE_WOLFSSL_SSL_H=1"
  5689. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
  5690. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_ALL"
  5691. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  5692. # recommended if building wolfSSL specifically for use by lighttpd
  5693. if test "x$ENABLED_ALL" = "xno"; then
  5694. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL2 -DOPENSSL_NO_COMP"
  5695. if test "x$ENABLED_SSLV3" = "xno"; then
  5696. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL3"
  5697. if test "x$ENABLED_TLSV10" = "xno"; then
  5698. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  5699. ENABLED_OLD_TLS=no
  5700. fi
  5701. fi
  5702. if test "x$ENABLED_CRL_MONITOR" = "xno"; then
  5703. AM_CFLAGS="$AM_CFLAGS -DSINGLE_THREADED"
  5704. ENABLED_SINGLETHREADED="yes"
  5705. fi
  5706. # w/ lighttpd 1.4.56 once wolfSSL updated to expose non-filesystem funcs
  5707. #AM_CFLAGS="$AM_CFLAGS -DNO_BIO"
  5708. #AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  5709. #ENABLED_FILESYSTEM=no
  5710. fi
  5711. fi
  5712. if test "$ENABLED_NGINX" = "yes"
  5713. then
  5714. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NGINX -DWOLFSSL_SIGNER_DER_CERT"
  5715. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_COMPATIBLE_DEFAULTS"
  5716. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ERROR_CODE_OPENSSL"
  5717. fi
  5718. if test "$ENABLED_HAPROXY" = "yes"
  5719. then
  5720. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAPROXY -DOPENSSL_COMPATIBLE_DEFAULTS"
  5721. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SIGNER_DER_CERT"
  5722. # --enable-all defines its own DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS
  5723. if test -z "$DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS"
  5724. then
  5725. DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS=8192
  5726. fi
  5727. # Requires opensslextra and opensslall
  5728. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  5729. then
  5730. ENABLED_OPENSSLALL="yes"
  5731. ENABLED_OPENSSLEXTRA="yes"
  5732. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA -DOPENSSL_ALL"
  5733. fi
  5734. if test "x$ENABLED_CERTGEN" = "xno"
  5735. then
  5736. ENABLED_CERTGEN="yes"
  5737. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  5738. fi
  5739. if test "x$ENABLED_CERTREQ" = "xno"
  5740. then
  5741. ENABLED_CERTREQ="yes"
  5742. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  5743. fi
  5744. # Requires sessioncerts make sure on
  5745. if test "x$ENABLED_SESSIONCERTS" = "xno"
  5746. then
  5747. ENABLED_SESSIONCERTS="yes"
  5748. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  5749. fi
  5750. # Requires key gen make sure on
  5751. if test "x$ENABLED_KEYGEN" = "xno"
  5752. then
  5753. ENABLED_KEYGEN="yes"
  5754. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  5755. fi
  5756. fi
  5757. if test "$ENABLED_NETSNMP" = "yes"
  5758. then
  5759. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
  5760. if test "x$ENABLED_AESCFB" = "xno"
  5761. then
  5762. ENABLED_AESCFB="yes"
  5763. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_CFB"
  5764. fi
  5765. if test "x$ENABLED_DTLS" = "xno"
  5766. then
  5767. ENABLED_DTLS="yes"
  5768. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS"
  5769. fi
  5770. fi
  5771. if test "$ENABLED_KRB" = "yes"
  5772. then
  5773. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KRB -DWOLFSSL_AES_DIRECT -DWOLFSSL_DES_ECB"
  5774. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
  5775. # Requires PKCS7
  5776. if test "x$ENABLED_PKCS7" = "xno"
  5777. then
  5778. ENABLED_PKCS7="yes"
  5779. fi
  5780. fi
  5781. if test "$ENABLED_FFMPEG" = "yes"
  5782. then
  5783. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_FFMPEG -DOPENSSL_COMPATIBLE_DEFAULTS"
  5784. fi
  5785. if test "$ENABLED_SIGNAL" = "yes"
  5786. then
  5787. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SIGNAL -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  5788. # Requires opensslextra make sure on
  5789. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  5790. then
  5791. ENABLED_OPENSSLEXTRA="yes"
  5792. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  5793. fi
  5794. fi
  5795. if test "$ENABLED_BIND" = "yes"
  5796. then
  5797. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BIND -DWOLFSSL_DSA_768_MODULUS"
  5798. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT -DHAVE_AES_ECB -DWOLFSSL_DES_ECB"
  5799. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA224 -DWOLFSSL_SHA384 -DWOLFSSL_SHA512"
  5800. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_COMPATIBLE_DEFAULTS"
  5801. ENABLED_SHA224="yes"
  5802. ENABLED_SHA384="yes"
  5803. ENABLED_SHA512="yes"
  5804. fi
  5805. if test "$ENABLED_RSYSLOG" = "yes"
  5806. then
  5807. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RSYSLOG -DWOLFSSL_ERROR_CODE_OPENSSL"
  5808. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA -DOPENSSL_COMPATIBLE_DEFAULTS"
  5809. fi
  5810. if test "$ENABLED_OPENVPN" = "yes"
  5811. then
  5812. ENABLED_SUPPORTED_CURVES="yes"
  5813. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_OPENVPN -DHAVE_KEYING_MATERIAL"
  5814. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB -DHAVE_EX_DATA -DWOLFSSL_KEY_GEN"
  5815. fi
  5816. if test "$ENABLED_HITCH" = "yes"
  5817. then
  5818. # Requires opensslextra make sure on
  5819. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  5820. then
  5821. ENABLED_OPENSSLEXTRA="yes"
  5822. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  5823. fi
  5824. # Requires OCSP make sure on
  5825. if test "x$ENABLED_OCSP" = "xno"
  5826. then
  5827. ENABLED_OCSP="yes"
  5828. fi
  5829. # Requires ALPN
  5830. if test "x$ENABLED_ALPN" = "xno"
  5831. then
  5832. ENABLED_ALPN="yes"
  5833. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
  5834. fi
  5835. if test "x$ENABLED_KEYGEN" = "xno"
  5836. then
  5837. ENABLED_KEYGEN="yes"
  5838. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  5839. fi
  5840. # Requires sessioncerts make sure on
  5841. if test "x$ENABLED_SESSIONCERTS" = "xno"
  5842. then
  5843. ENABLED_SESSIONCERTS="yes"
  5844. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  5845. fi
  5846. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HITCH -DHAVE_EX_DATA -DWOLFSSL_SIGNER_DER_CERT"
  5847. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_COMPATIBLE_DEFAULTS -DWOLFSSL_CIPHER_INTERNALNAME"
  5848. fi
  5849. if test "$ENABLED_MEMCACHED" = "yes"
  5850. then
  5851. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SESSION_ID_CTX"
  5852. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE -DHAVE_MEMCACHED"
  5853. fi
  5854. if test "$ENABLED_NGINX" = "yes"|| test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  5855. then
  5856. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_VERIFY_CB"
  5857. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  5858. AM_CFLAGS="$AM_CFLAGS -DKEEP_OUR_CERT -DKEEP_PEER_CERT"
  5859. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE -DHAVE_EX_DATA"
  5860. ENABLED_CERTGEN="yes"
  5861. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  5862. fi
  5863. if (test "$ENABLED_OPENSSH" = "yes" && test "x$ENABLED_FIPS" = "xno") || \
  5864. test "$ENABLED_WPAS" = "yes" || test "$ENABLED_QT" = "yes"
  5865. then
  5866. test "$enable_arc4" = "" && enable_arc4=yes
  5867. fi
  5868. if test "$ENABLED_ARC4" = "no"
  5869. then
  5870. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  5871. else
  5872. # turn off ARC4 if leanpsk or leantls on
  5873. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  5874. then
  5875. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  5876. ENABLED_ARC4=no
  5877. fi
  5878. fi
  5879. # Asio Support
  5880. AC_ARG_ENABLE([asio],
  5881. [AS_HELP_STRING([--enable-asio],[Enable asio (default: disabled)])],
  5882. [ ENABLED_ASIO=$enableval ],
  5883. [ ENABLED_ASIO=no ]
  5884. )
  5885. if test "$ENABLED_ASIO" = "yes"
  5886. then
  5887. # Requires opensslextra and opensslall
  5888. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  5889. then
  5890. ENABLED_OPENSSLALL="yes"
  5891. ENABLED_OPENSSLEXTRA="yes"
  5892. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA -DOPENSSL_ALL"
  5893. fi
  5894. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASIO -DASIO_USE_WOLFSSL -DWOLFSSL_KEY_GEN"
  5895. AM_CFLAGS="$AM_CFLAGS -DBOOST_ASIO_USE_WOLFSSL -DHAVE_EX_DATA"
  5896. AM_CFLAGS="$AM_CFLAGS -DSSL_TXT_TLSV1_2"
  5897. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL2 -DOPENSSL_NO_SSL3"
  5898. if test "$ENABLED_TLSV10" = "yes"
  5899. then
  5900. AM_CFLAGS="$AM_CFLAGS -DSSL_TXT_TLSV1"
  5901. fi
  5902. if test "$ENABLED_OLD_TLS" = "yes"
  5903. then
  5904. AM_CFLAGS="$AM_CFLAGS -DSSL_TXT_TLSV1_1"
  5905. fi
  5906. # Requires OCSP make sure on
  5907. if test "x$ENABLED_OCSP" = "xno"
  5908. then
  5909. ENABLED_OCSP="yes"
  5910. fi
  5911. fi
  5912. # Apache HTTPD
  5913. AC_ARG_ENABLE([apachehttpd],
  5914. [AS_HELP_STRING([--enable-apachehttpd],[Enable Apache httpd (default: disabled)])],
  5915. [ ENABLED_APACHE_HTTPD=$enableval ],
  5916. [ ENABLED_APACHE_HTTPD=no ]
  5917. )
  5918. if test "$ENABLED_APACHE_HTTPD" = "yes"
  5919. then
  5920. # Requires opensslextra and opensslall
  5921. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  5922. then
  5923. ENABLED_OPENSSLALL="yes"
  5924. ENABLED_OPENSSLEXTRA="yes"
  5925. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA -DOPENSSL_ALL"
  5926. fi
  5927. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_APACHE_HTTPD"
  5928. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL2 -DOPENSSL_NO_SSL3 -DOPENSSL_NO_COMP"
  5929. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA -DWOLFSSL_SIGNER_DER_CERT"
  5930. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT -DWOLFSSL_CERT_GEN"
  5931. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  5932. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_COMPATIBLE_DEFAULTS"
  5933. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_OCSP_ISSUER_CHECK"
  5934. # Requires OCSP make sure on
  5935. if test "x$ENABLED_OCSP" = "xno"
  5936. then
  5937. ENABLED_OCSP="yes"
  5938. fi
  5939. # Requires sessioncerts make sure on
  5940. if test "x$ENABLED_SESSIONCERTS" = "xno"
  5941. then
  5942. ENABLED_SESSIONCERTS="yes"
  5943. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  5944. fi
  5945. # Requires ALPN
  5946. if test "x$ENABLED_ALPN" = "xno"
  5947. then
  5948. ENABLED_ALPN="yes"
  5949. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
  5950. fi
  5951. # Requires CRL
  5952. if test "x$ENABLED_CRL" = "xno"
  5953. then
  5954. ENABLED_CRL="yes"
  5955. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  5956. fi
  5957. # Requires Certificate Generation, Request and Extensions
  5958. if test "x$ENABLED_CERTGEN" = "xno"
  5959. then
  5960. ENABLED_CERTGEN="yes"
  5961. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  5962. fi
  5963. if test "x$ENABLED_CERTREQ" = "xno"
  5964. then
  5965. ENABLED_CERTREQ="yes"
  5966. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  5967. fi
  5968. if test "x$ENABLED_CERTEXT" = "xno"
  5969. then
  5970. ENABLED_CERTEXT="yes"
  5971. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  5972. fi
  5973. # Requires Secure Renegotiation
  5974. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xno"
  5975. then
  5976. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION -DHAVE_SERVER_RENEGOTIATION_INFO"
  5977. fi
  5978. fi
  5979. # Encrypt-Then-Mac
  5980. AC_ARG_ENABLE([enc-then-mac],
  5981. [AS_HELP_STRING([--enable-enc-then-mac],[Enable Encrypt-Then-Mac extension (default: enabled)])],
  5982. [ ENABLED_ENCRYPT_THEN_MAC=$enableval ],
  5983. [ ENABLED_ENCRYPT_THEN_MAC=yes ]
  5984. )
  5985. if test "x$ENABLED_TLSX" = "xyes"
  5986. then
  5987. ENABLED_ENCRYPT_THEN_MAC=yes
  5988. fi
  5989. if test "x$ENABLED_ENCRYPT_THEN_MAC" = "xyes"
  5990. then
  5991. AM_CFLAGS="$AM_CFLAGS -DHAVE_ENCRYPT_THEN_MAC"
  5992. fi
  5993. # stunnel Support
  5994. AC_ARG_ENABLE([stunnel],
  5995. [AS_HELP_STRING([--enable-stunnel],[Enable stunnel (default: disabled)])],
  5996. [ ENABLED_STUNNEL=$enableval ],
  5997. [ ENABLED_STUNNEL=no ]
  5998. )
  5999. if test "$ENABLED_WPAS" = "yes"
  6000. then
  6001. ENABLED_STUNNEL="yes"
  6002. fi
  6003. # stunnel support requires all the features enabled within this conditional.
  6004. if test "$ENABLED_STUNNEL" = "yes"
  6005. then
  6006. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  6007. then
  6008. ENABLED_OPENSSLEXTRA="yes"
  6009. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  6010. fi
  6011. if test "x$ENABLED_SESSION_TICKET" = "xno"
  6012. then
  6013. ENABLED_SESSION_TICKET="yes"
  6014. AM_CFLAGS="$AM_CFLAGS -DHAVE_SESSION_TICKET"
  6015. fi
  6016. if test "x$ENABLED_OCSP" = "xno"
  6017. then
  6018. ENABLED_OCSP="yes"
  6019. fi
  6020. if test "x$ENABLED_CODING" = "xno"
  6021. then
  6022. ENABLED_CODING="yes"
  6023. fi
  6024. if test "x$ENABLED_SESSIONCERTS" = "xno"
  6025. then
  6026. ENABLED_SESSIONCERTS="yes"
  6027. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  6028. fi
  6029. if test "x$ENABLED_CRL" = "xno"
  6030. then
  6031. ENABLED_CRL="yes"
  6032. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  6033. fi
  6034. if test "x$ENABLED_DES3" = "xno"
  6035. then
  6036. ENABLED_DES3="yes"
  6037. fi
  6038. if test "x$ENABLED_TLSX" = "xno"
  6039. then
  6040. ENABLED_TLSX="yes"
  6041. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC"
  6042. # Check the ECC supported curves prereq
  6043. AS_IF([test "x$ENABLED_ECC" != "xno" || test "$ENABLED_CURVE25519" != "no"],
  6044. [ENABLED_SUPPORTED_CURVES=yes
  6045. AM_CFLAGS="$AM_CFLAGS -DHAVE_SUPPORTED_CURVES"])
  6046. fi
  6047. if test "x$ENABLED_ECC" = "xno"
  6048. then
  6049. ENABLED_OPENSSLEXTRA="yes"
  6050. ENABLED_ECC="yes"
  6051. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  6052. if test "$ENABLED_ECC_SHAMIR" = "yes"
  6053. then
  6054. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  6055. fi
  6056. fi
  6057. if test "x$ENABLED_CERTEXT" = "xno"
  6058. then
  6059. ENABLED_CERTEXT="yes"
  6060. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  6061. fi
  6062. if test "x$ENABLED_CERTGEN" = "xno"
  6063. then
  6064. ENABLED_CERTGEN="yes"
  6065. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  6066. fi
  6067. if test "x$ENABLED_KEYGEN" = "xno"
  6068. then
  6069. ENABLED_KEYGEN="yes"
  6070. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  6071. fi
  6072. AM_CFLAGS="$AM_CFLAGS -DHAVE_STUNNEL -DWOLFSSL_ALWAYS_VERIFY_CB"
  6073. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI -DHAVE_EX_DATA"
  6074. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB -DWOLFSSL_SIGNER_DER_CERT"
  6075. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_COMPATIBLE_DEFAULTS -DWOLFSSL_TICKET_HAVE_ID"
  6076. fi
  6077. # curl Support
  6078. AC_ARG_ENABLE([curl],
  6079. [AS_HELP_STRING([--enable-curl],[Enable curl (default: disabled)])],
  6080. [ ENABLED_CURL=$enableval ],
  6081. [ ENABLED_CURL=no ]
  6082. )
  6083. # curl support requires all the features enabled within this conditional.
  6084. if test "$ENABLED_CURL" = "yes"
  6085. then
  6086. if test "$ENABLED_MD4" = "no"
  6087. then
  6088. ENABLED_MD4="yes"
  6089. fi
  6090. if test "x$ENABLED_DES3" = "xno"
  6091. then
  6092. ENABLED_DES3="yes"
  6093. fi
  6094. if test "x$ENABLED_ALPN" = "xno"
  6095. then
  6096. ENABLED_ALPN="yes"
  6097. fi
  6098. if test "x$ENABLED_WOLFSSH" = "xno"
  6099. then
  6100. ENABLED_WOLFSSH="yes"
  6101. fi
  6102. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  6103. then
  6104. ENABLED_OPENSSLEXTRA="yes"
  6105. fi
  6106. if test "x$ENABLED_CRL" = "xno"
  6107. then
  6108. ENABLED_CRL="yes"
  6109. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  6110. fi
  6111. if test "x$ENABLED_OCSP" = "xno"
  6112. then
  6113. ENABLED_OCSP="yes"
  6114. fi
  6115. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xno"
  6116. then
  6117. ENABLED_CERTIFICATE_STATUS_REQUEST="yes"
  6118. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST"
  6119. fi
  6120. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xno"
  6121. then
  6122. ENABLED_CERTIFICATE_STATUS_REQUEST_V2="yes"
  6123. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST_V2"
  6124. fi
  6125. if test "x$ENABLED_SNI" = "xno"
  6126. then
  6127. ENABLED_SNI="yes"
  6128. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  6129. fi
  6130. if test "x$ENABLED_ALT_CERT_CHAINS" = "xno"
  6131. then
  6132. ENABLED_ALT_CERT_CHAINS="yes"
  6133. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALT_CERT_CHAINS"
  6134. fi
  6135. if test "x$ENABLE_IP_ALT_NAME" = "xno"
  6136. then
  6137. ENABLE_IP_ALT_NAME="yes"
  6138. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_IP_ALT_NAME"
  6139. fi
  6140. if test "x$ENABLED_SESSION_TICKET" = "xno"
  6141. then
  6142. ENABLED_SESSION_TICKET="yes"
  6143. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
  6144. fi
  6145. # FTPS server requires pointer to session cache
  6146. AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE_REF"
  6147. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB"
  6148. # support longer session ticket nonce
  6149. if test "$ENABLED_TICKET_NONCE_MALLOC" = "no_implicit"
  6150. then
  6151. ENABLED_TICKET_NONCE_MALLOC="yes"
  6152. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TICKET_NONCE_MALLOC"
  6153. fi
  6154. fi
  6155. if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no" \
  6156. && test "x$ENABLED_STUNNEL" = "xno"
  6157. then
  6158. AM_CFLAGS="$AM_CFLAGS -DNO_PSK"
  6159. fi
  6160. if test "$ENABLED_PSK" = "no" && \
  6161. (test "$ENABLED_LEANPSK" = "yes" || test "x$ENABLED_STUNNEL" = "xyes")
  6162. then
  6163. ENABLED_PSK=yes
  6164. fi
  6165. # tcpdump support
  6166. AC_ARG_ENABLE([tcpdump],
  6167. [AS_HELP_STRING([--enable-tcpdump],[Enable tcpdump (default: disabled)])],
  6168. [ ENABLED_TCPDUMP=$enableval ],
  6169. [ ENABLED_TCPDUMP=no ]
  6170. )
  6171. # tcpdump support requires all the features enabled within this conditional.
  6172. if test "$ENABLED_TCPDUMP" = "yes"
  6173. then
  6174. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  6175. then
  6176. ENABLED_OPENSSLEXTRA="yes"
  6177. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  6178. fi
  6179. if test "x$ENABLED_DES3" = "xno"
  6180. then
  6181. ENABLED_DES3="yes"
  6182. fi
  6183. fi
  6184. # sblim-sfcb support
  6185. AC_ARG_ENABLE([sblim-sfcb],
  6186. [AS_HELP_STRING([--enable-sblim-sfcb],[Enable sblim-sfcb support (default: disabled)])],
  6187. [ ENABLED_SBLIM_SFCB=$enableval ],
  6188. [ ENABLED_SBLIM_SFCB=no ]
  6189. )
  6190. # sblim-sfcb support requires all the features enabled within this conditional.
  6191. if test "$ENABLED_SBLIM_SFCB" = "yes"
  6192. then
  6193. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  6194. then
  6195. ENABLED_OPENSSLEXTRA="yes"
  6196. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  6197. fi
  6198. if test "x$ENABLED_CERTGEN" = "xno"
  6199. then
  6200. ENABLED_CERTGEN="yes"
  6201. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  6202. fi
  6203. AM_CFLAGS="$AM_CFLAGS -DHAVE_SBLIM_SFCB -DWOLFSSL_SIGNER_DER_CERT"
  6204. fi
  6205. # libest Support
  6206. AC_ARG_ENABLE([libest],
  6207. [AS_HELP_STRING([--enable-libest],[Enable libest (default: disabled)])],
  6208. [ ENABLED_LIBEST=$enableval ],
  6209. [ ENABLED_LIBEST=no ]
  6210. )
  6211. if test "$ENABLED_LIBEST" = "yes"
  6212. then
  6213. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA -DHAVE_LIBEST -DWOLFSSL_ALT_NAMES"
  6214. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PSS_SALT_LEN_DISCOVER"
  6215. # Requires opensslextra and opensslall
  6216. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  6217. then
  6218. ENABLED_OPENSSLALL="yes"
  6219. ENABLED_OPENSSLEXTRA="yes"
  6220. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA -DOPENSSL_ALL"
  6221. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_EITHER_SIDE -DWC_RSA_NO_PADDING"
  6222. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS -DWOLFSSL_PSS_LONG_SALT"
  6223. fi
  6224. # Requires OCSP
  6225. if test "x$ENABLED_OCSP" = "xno"
  6226. then
  6227. ENABLED_OCSP="yes"
  6228. fi
  6229. # Requires PKCS7
  6230. if test "x$ENABLED_PKCS7" = "xno"
  6231. then
  6232. ENABLED_PKCS7="yes"
  6233. fi
  6234. # Requires Certificate Generation and Request
  6235. if test "x$ENABLED_CERTGEN" = "xno"
  6236. then
  6237. ENABLED_CERTGEN="yes"
  6238. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  6239. fi
  6240. if test "x$ENABLED_CERTREQ" = "xno"
  6241. then
  6242. ENABLED_CERTREQ="yes"
  6243. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  6244. fi
  6245. if test "x$ENABLED_CERTEXT" = "xno"
  6246. then
  6247. ENABLED_CERTEXT="yes"
  6248. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  6249. fi
  6250. # Requires CRL
  6251. if test "x$ENABLED_CRL" = "xno"
  6252. then
  6253. ENABLED_CRL="yes"
  6254. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  6255. fi
  6256. if test "x$ENABLED_SRP" = "xno"
  6257. then
  6258. ENABLED_SRP="yes"
  6259. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_SRP"
  6260. fi
  6261. # Enable prereqs if not already enabled
  6262. if test "x$ENABLED_KEYGEN" = "xno"
  6263. then
  6264. ENABLED_KEYGEN="yes"
  6265. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  6266. fi
  6267. # Requires sessioncerts make sure on
  6268. if test "x$ENABLED_SESSIONCERTS" = "xno"
  6269. then
  6270. ENABLED_SESSIONCERTS="yes"
  6271. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  6272. fi
  6273. if test "x$ENABLED_DSA" = "xno"
  6274. then
  6275. AC_MSG_WARN([Enabling DSA with --enable-dsa is recommended for libest])
  6276. fi
  6277. fi
  6278. if test "$ENABLED_MD4" = "no"
  6279. then
  6280. #turn on MD4 if using stunnel
  6281. if test "x$ENABLED_STUNNEL" = "xyes" || test "x$ENABLED_WPAS" != "xno" || test "x$ENABLED_KRB" = "xyes"
  6282. then
  6283. ENABLED_MD4="yes"
  6284. else
  6285. AM_CFLAGS="$AM_CFLAGS -DNO_MD4"
  6286. fi
  6287. fi
  6288. # Encrypted keys
  6289. AC_ARG_ENABLE([enckeys],
  6290. [AS_HELP_STRING([--enable-enckeys],[Enable PEM encrypted private key support (default: disabled)])],
  6291. [ ENABLED_ENCKEYS=$enableval ],
  6292. [ ENABLED_ENCKEYS=no ]
  6293. )
  6294. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_WEBSERVER" = "yes" || test "$ENABLED_WPAS" != "no"
  6295. then
  6296. ENABLED_ENCKEYS=yes
  6297. fi
  6298. if test "$ENABLED_ENCKEYS" = "yes"
  6299. then
  6300. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ENCRYPTED_KEYS"
  6301. fi
  6302. # PKCS#12
  6303. # set PKCS#12 default
  6304. PKCS12_DEFAULT=yes
  6305. if test "$ENABLED_ASN" = "no" || test "$FIPS_VERSION" = "rand"
  6306. then
  6307. PKCS12_DEFAULT=no
  6308. fi
  6309. AC_ARG_ENABLE([pkcs12],
  6310. [AS_HELP_STRING([--enable-pkcs12],[Enable pkcs12 (default: enabled)])],
  6311. [ ENABLED_PKCS12=$enableval ],
  6312. [ ENABLED_PKCS12=$PKCS12_DEFAULT ]
  6313. )
  6314. if test "x$ENABLED_PKCS12" = "xno"
  6315. then
  6316. AM_CFLAGS="$AM_CFLAGS -DNO_PKCS12"
  6317. fi
  6318. # PWDBASED has to come after certservice since we want it on w/o explicit on
  6319. if test "$ENABLED_PWDBASED" = "no"
  6320. then
  6321. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_OPENSSLALL" = "yes" || \
  6322. test "$ENABLED_WEBSERVER" = "yes" || test "$ENABLED_ENCKEYS" = "yes" || \
  6323. test "$ENABLED_PKCS12" = "yes"
  6324. then
  6325. # opensslextra, opensslall, webserver, enckeys and pkcs12 need pwdbased
  6326. ENABLED_PWDBASED=yes
  6327. else
  6328. AM_CFLAGS="$AM_CFLAGS -DNO_PWDBASED"
  6329. fi
  6330. fi
  6331. AC_ARG_ENABLE([scrypt],
  6332. [AS_HELP_STRING([--enable-scrypt],[Enable SCRYPT (default: disabled)])],
  6333. [ ENABLED_SCRYPT=$enableval ],
  6334. [ ENABLED_SCRYPT=no ]
  6335. )
  6336. if test "$ENABLED_SCRYPT" = "yes"
  6337. then
  6338. if test "$ENABLED_PWDBASED" = "no"
  6339. then
  6340. AC_MSG_ERROR([cannot enable scrypt without enabling pwdbased.])
  6341. fi
  6342. AM_CFLAGS="$AM_CFLAGS -DHAVE_SCRYPT"
  6343. fi
  6344. # wolfCrypt Only Build
  6345. if test "$ENABLED_CRYPTONLY" = "yes"
  6346. then
  6347. if test "$ENABLED_OPENSSLALL" = "yes"
  6348. then
  6349. AC_MSG_ERROR([cryptonly and opensslall are mutually incompatible.])
  6350. fi
  6351. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_ONLY"
  6352. fi
  6353. if test "x$ENABLED_CRYPTONLY" = "xno"
  6354. then
  6355. if test "x$ENABLED_PSK" = "xno" && test "x$ENABLED_ASN" = "xno"
  6356. then
  6357. AC_MSG_ERROR([please enable psk if disabling asn.])
  6358. fi
  6359. if test "$ENABLED_AFALG" = "yes"
  6360. then
  6361. # for TLS connections the intermediate hash needs to store buffer
  6362. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_HASH_KEEP"
  6363. fi
  6364. if test "$ENABLED_DEVCRYPTO" = "yes"
  6365. then
  6366. # for TLS connections the intermediate hash needs to store buffer
  6367. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HASH_KEEP"
  6368. fi
  6369. fi
  6370. # Enable Examples, used to disable examples
  6371. if test "$ENABLED_LINUXKM" = "yes"
  6372. then
  6373. ENABLED_EXAMPLES_DEFAULT=no
  6374. else
  6375. ENABLED_EXAMPLES_DEFAULT=yes
  6376. fi
  6377. AC_ARG_ENABLE([examples],
  6378. [AS_HELP_STRING([--enable-examples],[Enable Examples (default: enabled)])],
  6379. [ ENABLED_EXAMPLES=$enableval ],
  6380. [ ENABLED_EXAMPLES=$ENABLED_EXAMPLES_DEFAULT ]
  6381. )
  6382. AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
  6383. AS_IF([test "x$ENABLED_CRYPTONLY" = "xyes"], [ENABLED_EXAMPLES="no"])
  6384. # Enable wolfCrypt test and benchmark
  6385. if test "$ENABLED_LINUXKM" = "yes"
  6386. then
  6387. ENABLED_CRYPT_TESTS_DEFAULT=no
  6388. else
  6389. ENABLED_CRYPT_TESTS_DEFAULT=yes
  6390. fi
  6391. AC_ARG_ENABLE([crypttests],
  6392. [AS_HELP_STRING([--enable-crypttests],[Enable Crypt Bench/Test (default: enabled)])],
  6393. [ ENABLED_CRYPT_TESTS=$enableval ],
  6394. [ ENABLED_CRYPT_TESTS=$ENABLED_CRYPT_TESTS_DEFAULT ]
  6395. )
  6396. AC_SUBST([ENABLED_CRYPT_TESTS])
  6397. # Build wolfCrypt test and benchmark as libraries. This will compile test.c and
  6398. # benchmark.c and make their functions available via libraries, libwolfcrypttest
  6399. # and libwolfcryptbench, respectively. Note that this feature is not enabled by
  6400. # default, and the API of these libraries should NOT be treated as stable.
  6401. AC_ARG_ENABLE([crypttests-libs],
  6402. [AS_HELP_STRING([--enable-crypttests-libs],[Enable wolfcrypt test and benchmark libraries (default: disabled)])],
  6403. [ ENABLED_CRYPT_TESTS_LIBS=$enableval ],
  6404. [ ENABLED_CRYPT_TESTS_LIBS=no ]
  6405. )
  6406. # LIBZ
  6407. ENABLED_LIBZ="no"
  6408. trylibzdir=""
  6409. AC_ARG_WITH([libz],
  6410. [ --with-libz=PATH PATH to libz install (default /usr/) ],
  6411. [
  6412. AC_MSG_CHECKING([for libz])
  6413. CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
  6414. LIBS="$LIBS -lz"
  6415. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  6416. if test "x$libz_linked" = "xno" ; then
  6417. if test "x$withval" != "xno" ; then
  6418. trylibzdir=$withval
  6419. fi
  6420. if test "x$withval" = "xyes" ; then
  6421. trylibzdir="/usr"
  6422. fi
  6423. LDFLAGS="$LDFLAGS -L$trylibzdir/lib"
  6424. CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
  6425. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  6426. if test "x$libz_linked" = "xno" ; then
  6427. AC_MSG_ERROR([libz isn't found.
  6428. If it's already installed, specify its path using --with-libz=/dir/])
  6429. fi
  6430. AC_MSG_RESULT([yes])
  6431. else
  6432. AC_MSG_RESULT([yes])
  6433. fi
  6434. ENABLED_LIBZ="yes"
  6435. ]
  6436. )
  6437. # PKCS#11
  6438. AC_ARG_ENABLE([pkcs11],
  6439. [AS_HELP_STRING([--enable-pkcs11],[Enable pkcs11 access (default: disabled)])],
  6440. [ ENABLED_PKCS11=$enableval ],
  6441. [ ENABLED_PKCS11=no ]
  6442. )
  6443. if test "x$ENABLED_PKCS11" != "xno"
  6444. then
  6445. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS11 -DHAVE_WOLF_BIGINT"
  6446. if test "x$ENABLED_PKCS11" != "xstatic"
  6447. then
  6448. LIBS="$LIBS -ldl"
  6449. else
  6450. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS11_STATIC"
  6451. ENABLED_PKCS11="yes"
  6452. fi
  6453. fi
  6454. # PKCS#8
  6455. AC_ARG_ENABLE([pkcs8],
  6456. [AS_HELP_STRING([--enable-pkcs8],[Enable PKCS #8 key packages (default: enabled)])],
  6457. [ ENABLED_PKCS8=$enableval ],
  6458. [ ENABLED_PKCS8=yes ]
  6459. )
  6460. if test "x$ENABLED_PKCS8" = "xno"
  6461. then
  6462. AM_CFLAGS="$AM_CFLAGS -DNO_PKCS8"
  6463. fi
  6464. # cavium
  6465. trycaviumdir=""
  6466. AC_ARG_WITH([cavium],
  6467. [ --with-cavium=PATH PATH to cavium/software dir ],
  6468. [
  6469. AC_MSG_CHECKING([for cavium])
  6470. LIB_ADD="-lrt $LIB_ADD"
  6471. if test "x$withval" = "xyes" ; then
  6472. AC_MSG_ERROR([need a PATH for --with-cavium])
  6473. fi
  6474. if test "x$withval" != "xno" ; then
  6475. trycaviumdir=$withval
  6476. fi
  6477. CPPFLAGS="$AM_CPPFLAGS -DHAVE_CAVIUM -I$trycaviumdir/include"
  6478. LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
  6479. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
  6480. if test "x$cavium_linked" = "xno" ; then
  6481. AC_MSG_ERROR([cavium isn't found.
  6482. If it's already installed, specify its path using --with-cavium=/dir/])
  6483. else
  6484. AM_CPPFLAGS="$CPPFLAGS"
  6485. AM_LDFLAGS="$LDFLAGS"
  6486. fi
  6487. AC_MSG_RESULT([yes])
  6488. enable_shared=no
  6489. enable_static=yes
  6490. ENABLED_CAVIUM=yes
  6491. ],
  6492. [ ENABLED_CAVIUM=no ]
  6493. )
  6494. # cavium V
  6495. trycaviumdir=""
  6496. AC_ARG_WITH([cavium-v],
  6497. [ --with-cavium-v=PATH PATH to Cavium V/software dir ],
  6498. [
  6499. AC_MSG_CHECKING([for cavium])
  6500. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM -DHAVE_CAVIUM_V"
  6501. LIB_ADD="-lrt -lcrypto $LIB_ADD"
  6502. if test "x$withval" = "xyes" ; then
  6503. AC_MSG_ERROR([need a PATH for --with-cavium])
  6504. fi
  6505. if test "x$withval" != "xno" ; then
  6506. trycaviumdir=$withval
  6507. fi
  6508. if test -e $trycaviumdir/lib/libnitrox.a
  6509. then
  6510. AM_CPPFLAGS="-I$trycaviumdir/include $AM_CPPFLAGS"
  6511. else
  6512. ENABLED_CAVIUM_V=no
  6513. fi
  6514. LIB_STATIC_ADD="$trycaviumdir/lib/libnitrox.a $LIB_STATIC_ADD"
  6515. if test "$ENABLED_CAVIUM_V" = "no"; then
  6516. AC_MSG_ERROR([Could not find Nitrox library])
  6517. fi
  6518. enable_shared=no
  6519. enable_static=yes
  6520. enable_opensslextra=yes
  6521. ENABLED_CAVIUM=yes
  6522. ENABLED_CAVIUM_V=yes
  6523. ],
  6524. [
  6525. ENABLED_CAVIUM=no
  6526. ENABLED_CAVIUM_V=no
  6527. ]
  6528. )
  6529. # Cavium Octeon
  6530. OCTEON_ROOT=""
  6531. : ${OCTEON_OBJ="obj-octeon2"}
  6532. : ${OCTEON_HOST="standalone"}
  6533. AC_ARG_WITH([octeon-sync],
  6534. [AS_HELP_STRING([--with-octeon-sync=PATH],[PATH to Cavium Octeon SDK dir (sync)])],
  6535. [
  6536. AC_MSG_CHECKING([for octeon])
  6537. if test "x$withval" = "xyes" ; then
  6538. AC_MSG_ERROR([need a PATH for --with-octeon])
  6539. fi
  6540. if test "x$withval" != "xno" ; then
  6541. OCTEON_ROOT=$withval
  6542. fi
  6543. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM_OCTEON_SYNC"
  6544. AM_CFLAGS="$AM_CFLAGS -DOCTEON_MODEL=$OCTEON_MODEL"
  6545. AM_CFLAGS="$AM_CFLAGS -I$OCTEON_ROOT/executive"
  6546. AS_CASE([$OCTEON_HOST],['linux'],[AM_CFLAGS="$AM_CFLAGS -DCVMX_BUILD_FOR_LINUX_HOST"])
  6547. #-I$OCTEON_ROOT/target/include
  6548. AM_LDFLAGS="$AM_LDFLAGS -lrt -Xlinker -T -Xlinker $OCTEON_ROOT/executive/cvmx-shared-linux.ld"
  6549. AM_LDFLAGS="$AM_LDFLAGS -L$OCTEON_ROOT/executive/$OCTEON_OBJ -lcvmx -lfdt"
  6550. enable_shared=no
  6551. enable_static=yes
  6552. ENABLED_OCTEON_SYNC=yes
  6553. AC_MSG_RESULT([yes])
  6554. ],
  6555. [ENABLED_OCTEON_SYNC=no]
  6556. )
  6557. # Intel QuickAssist
  6558. QAT_DIR=""
  6559. BUILD_INTEL_QAT_VERSION=2
  6560. AC_ARG_WITH([intelqa],
  6561. [AS_HELP_STRING([--with-intelqa=PATH],[PATH to Intel QuickAssist (QAT) driver dir])],
  6562. [ENABLED_INTEL_QA=yes; QAT_DIR=$withval],
  6563. [ENABLED_INTEL_QA=no])
  6564. AC_ARG_WITH([intelqa-sync],
  6565. [AS_HELP_STRING([--with-intelqa-sync=PATH],[PATH to Intel QuickAssist (QAT) driver dir (sync)])],
  6566. [ENABLED_INTEL_QA_SYNC=yes; QAT_DIR=$withval],
  6567. [ENABLED_INTEL_QA_SYNC=no])
  6568. AS_IF([test "x$ENABLED_INTEL_QA" = "xyes" && test "x$ENABLED_INTEL_QA_SYNC" = "xyes"],
  6569. [AC_MSG_ERROR([Both Intel QA Async and Sync are selected, only select one.])])
  6570. AS_IF([test "x$ENABLED_INTEL_QA" = "xyes" || test "x$ENABLED_INTEL_QA_SYNC" = "xyes"],
  6571. [AC_MSG_CHECKING([for intelqa])
  6572. AS_IF([test "x$ENABLED_INTEL_QA" = "xyes"],
  6573. [AM_CPPFLAGS="$AM_CPPFLAGS -DHAVE_INTEL_QA -DDO_CRYPTO -DUSER_SPACE"; intelqa_opt=""],
  6574. [AM_CPPFLAGS="$AM_CPPFLAGS -DHAVE_INTEL_QA_SYNC -DQAT_USE_POLLING_THREAD -DO_CRYPTO -DUSER_SPACE"; intelqa_opt="-sync"])
  6575. OLD_LIBS="$LIBS"
  6576. OLD_CPPFLAGS="$CPPFLAGS"
  6577. AS_IF([test "x$QAT_DIR" = "xyes"],[AC_MSG_ERROR([need a PATH for --with-intelqa$intelqa_opt])])
  6578. QAT_FLAGS="-I$QAT_DIR/quickassist/include -I$QAT_DIR/quickassist/include/lac -I$QAT_DIR/quickassist/utilities/osal/include \
  6579. -I$QAT_DIR/quickassist/utilities/osal/src/linux/user_space/include -I$QAT_DIR/quickassist/lookaside/access_layer/include \
  6580. -I$QAT_DIR/quickassist/lookaside/access_layer/src/common/include -I$srcdir/wolfssl -I$srcdir/wolfssl/wolfcrypt/port/intel \
  6581. -I$QAT_DIR/quickassist/utilities/libusdm_drv"
  6582. AM_CPPFLAGS="$AM_CPPFLAGS $QAT_FLAGS"
  6583. CPPFLAGS="$AM_CPPFLAGS"
  6584. LDFLAGS="$LDFLAGS -L$QAT_DIR/build"
  6585. LIBS="$LIBS -lqat_s -lusdm_drv_s"
  6586. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]],[[Cpa16U count = 0; cpaCyGetNumInstances(&count);]])],[intelqa_linked=yes],[intelqa_linked=no])
  6587. AS_IF([test "x$intelqa_linked" = "xno"],
  6588. [# Try old QAT driver libraries
  6589. LIBS="$OLD_LIBS -licp_qa_al_s"
  6590. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]],[[Cpa16U count = 0; cpaCyGetNumInstances(&count);]])],[intelqa_linked=yes],[intelqa_linked=no])
  6591. AS_IF([test "x$intelqa_linked" = "xno"],
  6592. [AC_MSG_ERROR([Intel QuickAssist not found. If it's already installed, specify its path using --with-intelqa$intelqa_opt=/dir/])],
  6593. [BUILD_INTEL_QAT_VERSION=1])
  6594. ])
  6595. AC_MSG_RESULT([yes])
  6596. AS_IF([test "x$BUILD_INTEL_QAT_VERSION" = "x1"],
  6597. [LIB_ADD="-ladf_proxy -losal -lrt $LIB_ADD"],
  6598. [LIB_ADD="-losal -lrt $LIB_ADD"])
  6599. CPPFLAGS="$OLD_CPPFLAGS"
  6600. ])
  6601. ################################################################################
  6602. # Single Precision option handling #
  6603. ################################################################################
  6604. ENABLED_SP_RSA=no
  6605. ENABLED_SP_DH=no
  6606. ENABLED_SP_FF_2048=no
  6607. ENABLED_SP_FF_3072=no
  6608. ENABLED_SP_FF_4096=no
  6609. ENABLED_SP_ECC=no
  6610. ENABLED_SP_EC_256=no
  6611. ENABLED_SP_EC_384=no
  6612. ENABLED_SP_EC_521=no
  6613. ENABLED_SP_SM2=$ENABLED_SM2
  6614. ENABLED_SP_SAKKE_1024=$ENABLED_SAKKE
  6615. ENABLED_SP_NO_MALLOC=no
  6616. ENABLED_SP_NONBLOCK=no
  6617. ENABLED_SP_SMALL=no
  6618. for v in `echo $ENABLED_SP | tr "," " "`
  6619. do
  6620. case $v in
  6621. small)
  6622. ENABLED_SP_SMALL=yes
  6623. ENABLED_SP_RSA=yes
  6624. ENABLED_SP_DH=yes
  6625. ENABLED_SP_FF_2048=yes
  6626. ENABLED_SP_FF_3072=yes
  6627. ENABLED_SP_ECC=yes
  6628. ENABLED_SP_EC_256=yes
  6629. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64" || test "$host_cpu" = "amd64"; then
  6630. ENABLED_SP_FF_4096=yes
  6631. ENABLED_SP_EC_384=yes
  6632. ENABLED_SP_EC_521=yes
  6633. fi
  6634. ;;
  6635. smallfast)
  6636. ENABLED_SP_SMALL=yes
  6637. ENABLED_SP_RSA=yes
  6638. ENABLED_SP_DH=yes
  6639. ENABLED_SP_FF_2048=yes
  6640. ENABLED_SP_FF_3072=yes
  6641. ENABLED_SP_ECC=yes
  6642. ENABLED_SP_EC_256=yes
  6643. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64" || test "$host_cpu" = "amd64"; then
  6644. ENABLED_SP_FF_4096=yes
  6645. ENABLED_SP_EC_384=yes
  6646. ENABLED_SP_EC_521=yes
  6647. fi
  6648. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_FAST_MODEXP"
  6649. ;;
  6650. yes)
  6651. ENABLED_SP_RSA=yes
  6652. ENABLED_SP_DH=yes
  6653. ENABLED_SP_FF_2048=yes
  6654. ENABLED_SP_FF_3072=yes
  6655. ENABLED_SP_ECC=yes
  6656. ENABLED_SP_EC_256=yes
  6657. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64" || test "$host_cpu" = "amd64"; then
  6658. ENABLED_SP_FF_4096=yes
  6659. ENABLED_SP_EC_384=yes
  6660. ENABLED_SP_EC_521=yes
  6661. fi
  6662. ;;
  6663. no)
  6664. ;;
  6665. smallec256 | smallp256 | small256)
  6666. ENABLED_SP_SMALL=yes
  6667. ENABLED_SP_ECC=yes
  6668. ENABLED_SP_EC_256=yes
  6669. ;;
  6670. ec256 | p256 | 256)
  6671. ENABLED_SP_ECC=yes
  6672. ENABLED_SP_EC_256=yes
  6673. ;;
  6674. smallec384 | smallp384 | small384)
  6675. ENABLED_SP_SMALL=yes
  6676. ENABLED_SP_ECC=yes
  6677. ENABLED_SP_EC_384=yes
  6678. ;;
  6679. ec384 | p384 | 384)
  6680. ENABLED_SP_ECC=yes
  6681. ENABLED_SP_EC_384=yes
  6682. ;;
  6683. smallec521 | smallp521 | small521)
  6684. ENABLED_SP_SMALL=yes
  6685. ENABLED_SP_ECC=yes
  6686. ENABLED_SP_EC_521=yes
  6687. ;;
  6688. ec521 | p521 | 521)
  6689. ENABLED_SP_ECC=yes
  6690. ENABLED_SP_EC_521=yes
  6691. ;;
  6692. smallec1024 | smallp1024 | small1024)
  6693. ENABLED_SP_ECC=yes
  6694. ENABLED_SP_SMALL=yes
  6695. ENABLED_SP_SAKKE_1024=yes
  6696. ;;
  6697. ec1024 | p1024 | 1024)
  6698. ENABLED_SP_ECC=yes
  6699. ENABLED_SP_SAKKE_1024=yes
  6700. ;;
  6701. smallsm2)
  6702. ENABLED_SP_SMALL=yes
  6703. ENABLED_SP_ECC=yes
  6704. ENABLED_SP_SM2=yes
  6705. ;;
  6706. sm2)
  6707. ENABLED_SP_ECC=yes
  6708. ENABLED_SP_SM2=yes
  6709. ;;
  6710. small2048)
  6711. ENABLED_SP_SMALL=yes
  6712. ENABLED_SP_RSA=yes
  6713. ENABLED_SP_DH=yes
  6714. ENABLED_SP_FF_2048=yes
  6715. ;;
  6716. 2048)
  6717. ENABLED_SP_RSA=yes
  6718. ENABLED_SP_DH=yes
  6719. ENABLED_SP_FF_2048=yes
  6720. ;;
  6721. smallrsa2048)
  6722. ENABLED_SP_SMALL=yes
  6723. ENABLED_SP_RSA=yes
  6724. ENABLED_SP_FF_2048=yes
  6725. ;;
  6726. rsa2048)
  6727. ENABLED_SP_RSA=yes
  6728. ENABLED_SP_FF_2048=yes
  6729. ;;
  6730. small3072)
  6731. ENABLED_SP_SMALL=yes
  6732. ENABLED_SP_RSA=yes
  6733. ENABLED_SP_DH=yes
  6734. ENABLED_SP_FF_3072=yes
  6735. ;;
  6736. 3072)
  6737. ENABLED_SP_RSA=yes
  6738. ENABLED_SP_DH=yes
  6739. ENABLED_SP_FF_3072=yes
  6740. ;;
  6741. smallrsa3072)
  6742. ENABLED_SP_SMALL=yes
  6743. ENABLED_SP_RSA=yes
  6744. ENABLED_SP_FF_3072=yes
  6745. ;;
  6746. rsa3072)
  6747. ENABLED_SP_RSA=yes
  6748. ENABLED_SP_FF_3072=yes
  6749. ;;
  6750. small4096)
  6751. ENABLED_SP_SMALL=yes
  6752. ENABLED_SP_RSA=yes
  6753. ENABLED_SP_DH=yes
  6754. ENABLED_SP_FF_4096=yes
  6755. ;;
  6756. 4096 | +4096)
  6757. ENABLED_SP_RSA=yes
  6758. ENABLED_SP_DH=yes
  6759. ENABLED_SP_FF_4096=yes
  6760. ;;
  6761. smallrsa4096)
  6762. ENABLED_SP_SMALL=yes
  6763. ENABLED_SP_RSA=yes
  6764. ENABLED_SP_FF_4096=yes
  6765. ;;
  6766. rsa4096)
  6767. ENABLED_SP_RSA=yes
  6768. ENABLED_SP_FF_4096=yes
  6769. ;;
  6770. smallstack)
  6771. ENABLED_SP_SMALL_STACK=yes
  6772. ;;
  6773. nomalloc)
  6774. ENABLED_SP_NO_MALLOC=yes
  6775. ;;
  6776. nonblock)
  6777. # Requires small and no malloc
  6778. ENABLED_SP_NONBLOCK=yes
  6779. ENABLED_SP_NO_MALLOC=yes
  6780. ENABLED_SP_SMALL=yes
  6781. ;;
  6782. asm)
  6783. ENABLED_SP_ASM=yes
  6784. ;;
  6785. noasm)
  6786. ENABLED_SP_ASM=no
  6787. ;;
  6788. *)
  6789. AC_MSG_ERROR([Invalid choice of Single Precision length in bits [256, 384, 521, 1024, 2048, 3072, 4096]: $ENABLED_SP.])
  6790. break;;
  6791. esac
  6792. done
  6793. ENABLED_SP_LINE="$ENABLE_SP"
  6794. ENABLED_SP=no
  6795. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_SP_RSA" = "yes"; then
  6796. ENABLED_SP=yes
  6797. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_RSA"
  6798. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_HAVE_SP_RSA"
  6799. fi
  6800. if test "$ENABLED_DH" != "no" && test "$ENABLED_SP_DH" = "yes"; then
  6801. ENABLED_SP=yes
  6802. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_DH"
  6803. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_HAVE_SP_DH"
  6804. fi
  6805. if test "$ENABLED_SP_RSA" = "yes" || test "$ENABLED_SP_DH" = "yes"; then
  6806. if test "$ENABLED_SP_FF_2048" = "no"; then
  6807. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_2048"
  6808. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_2048"
  6809. fi
  6810. if test "$ENABLED_SP_FF_3072" = "no"; then
  6811. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_3072"
  6812. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_3072"
  6813. fi
  6814. if test "$ENABLED_SP_FF_4096" = "yes"; then
  6815. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_4096"
  6816. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_4096"
  6817. fi
  6818. case $host_cpu in
  6819. *x86_64* | *aarch64* | *amd64*)
  6820. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_LARGE_CODE"
  6821. ;;
  6822. *)
  6823. ;;
  6824. esac
  6825. fi
  6826. if test "$ENABLED_ECC" != "no" && test "$ENABLED_SP_ECC" = "yes"; then
  6827. ENABLED_SP=yes
  6828. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_ECC"
  6829. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_HAVE_SP_ECC"
  6830. if test "$ENABLED_SP_EC_256" = "no"; then
  6831. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_256"
  6832. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_256"
  6833. fi
  6834. if test "$ENABLED_SP_EC_384" = "yes"; then
  6835. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC384 -DWOLFSSL_SP_384"
  6836. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_384"
  6837. fi
  6838. if test "$ENABLED_SP_EC_521" = "yes"; then
  6839. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC521 -DWOLFSSL_SP_521"
  6840. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_521"
  6841. fi
  6842. if test "$ENABLED_SP_SAKKE_1024" = "yes"; then
  6843. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_1024"
  6844. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_1024"
  6845. fi
  6846. if test "$ENABLED_SP_SM2" = "yes"; then
  6847. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SM2"
  6848. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_SM2"
  6849. fi
  6850. fi
  6851. if test "$ENABLED_SP_SMALL" = "yes"; then
  6852. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  6853. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_SMALL"
  6854. fi
  6855. if test "$ENABLED_SP_SMALL_STACK" = "yes"; then
  6856. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL_STACK"
  6857. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_SMALL_STACK"
  6858. fi
  6859. if test "$ENABLED_SP_NO_MALLOC" = "yes"; then
  6860. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_MALLOC"
  6861. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_MALLOC"
  6862. fi
  6863. if test "$ENABLED_SP_NONBLOCK" = "yes"; then
  6864. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NONBLOCK"
  6865. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NONBLOCK"
  6866. fi
  6867. if test "$ENABLED_SP_MATH" = "yes"; then
  6868. if test "$ENABLED_SP" = "no"; then
  6869. if test "$ENABLED_RSA" != "no"; then
  6870. AC_MSG_ERROR([Must have SP enabled with SP math for RSA: --enable-sp])
  6871. fi
  6872. if test "$ENABLED_DH" != "no"; then
  6873. AC_MSG_ERROR([Must have SP enabled with SP math for DH: --enable-sp])
  6874. fi
  6875. if test "$ENABLED_ECC" != "no"; then
  6876. AC_MSG_ERROR([Must have SP enabled with SP math for ECC: --enable-sp])
  6877. fi
  6878. fi
  6879. if test "$ENABLED_ECCCUSTCURVES" != "no"; then
  6880. AC_MSG_ERROR([Cannot use single precision math and custom curves])
  6881. fi
  6882. if test "$ENABLED_DSA" = "yes"; then
  6883. AC_MSG_ERROR([Cannot use single precision math and DSA])
  6884. fi
  6885. if test "$ENABLED_SRP" = "yes"; then
  6886. AC_MSG_ERROR([Cannot use single precision math and SRP])
  6887. fi
  6888. if test "$ENABLED_SP_RSA" = "no" && test "$ENABLED_RSA" = "yes"; then
  6889. AC_MSG_ERROR([Cannot use RSA single precision only math and RSA])
  6890. fi
  6891. if test "$ENABLED_SP_DH" = "no" && test "$ENABLED_DH" != "no"; then
  6892. AC_MSG_ERROR([Cannot use DH single precision only math and DH])
  6893. fi
  6894. fi
  6895. for v in `echo $ENABLED_SP_MATH_ALL | tr "," " "`
  6896. do
  6897. case $v in
  6898. yes | no)
  6899. ;;
  6900. small)
  6901. ENABLED_SP_MATH_ALL="yes"
  6902. ENABLED_SP_SMALL="yes"
  6903. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  6904. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_SMALL"
  6905. ;;
  6906. huge)
  6907. ENABLED_SP_MATH_ALL="yes"
  6908. ENABLED_FASTHUGEMATH="yes"
  6909. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  6910. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_INT_LARGE_COMBA"
  6911. ;;
  6912. 256 | 384 | 521 | 1024 | 2048 | 3072 | 4096)
  6913. if test -z "$DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS" -o "$DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS" -lt "$v"
  6914. then
  6915. DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS="$v"
  6916. fi
  6917. ENABLED_SP_MATH_ALL="yes"
  6918. ;;
  6919. nomalloc)
  6920. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_MALLOC"
  6921. ENABLED_SP_MATH_ALL="yes"
  6922. ;;
  6923. neg)
  6924. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_INT_NEGATIVE"
  6925. ENABLED_SP_MATH_ALL="yes"
  6926. ;;
  6927. *)
  6928. AC_MSG_ERROR([Support SP int bit sizes: 256, 384, 521, 1024, 2048, 3072, 4096. $ENABLED_SP_MATH_ALL not supported])
  6929. ;;
  6930. esac
  6931. done
  6932. AC_ARG_WITH([arm-target],
  6933. [AS_HELP_STRING([--with-arm-target=x],[x can be "thumb" or "cortex"])],
  6934. [ARM_TARGET="$withval"],
  6935. [ARM_TARGET=''])
  6936. if test "$ENABLED_SP_MATH_ALL" = "yes" && test "$ENABLED_ASM" != "no"; then
  6937. ENABLED_FASTMATH="no"
  6938. ENABLED_SLOWMATH="no"
  6939. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MATH_ALL"
  6940. case $host_cpu in
  6941. *x86_64* | *amd64*)
  6942. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_X86_64"
  6943. ;;
  6944. *x86*)
  6945. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_X86"
  6946. ;;
  6947. *aarch64*)
  6948. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM64 -DWOLFSSL_AARCH64_BUILD"
  6949. ;;
  6950. *arm*)
  6951. if test "$host_alias" = "thumb" || test "$ARM_TARGET" = "thumb"; then
  6952. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM_THUMB"
  6953. else
  6954. if test "$host_alias" = "cortex" || test "$ARM_TARGET" = "cortex"; then
  6955. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM_CORTEX_M"
  6956. else
  6957. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM32"
  6958. fi
  6959. fi
  6960. ;;
  6961. *ppc64* | *powerpc64*)
  6962. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_PPC64"
  6963. ;;
  6964. *ppc* | *powerpc*)
  6965. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_PPC"
  6966. ;;
  6967. *mips64*)
  6968. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MIPS64"
  6969. ;;
  6970. *mips*)
  6971. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MIPS"
  6972. ;;
  6973. *riscv32*)
  6974. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_RISCV32"
  6975. ;;
  6976. *riscv64*)
  6977. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_RISCV64"
  6978. ;;
  6979. *s390x*)
  6980. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_S390X"
  6981. ;;
  6982. esac
  6983. if test "$ENABLED_FIPS" != "no" || test "$SELFTEST_VERSION" != "none"; then
  6984. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_INT_NEGATIVE"
  6985. fi
  6986. fi
  6987. if test "$ENABLED_SP_ASM" = "yes" && test "$ENABLED_SP" = "yes"; then
  6988. if test "$ENABLED_SP_NONBLOCK" = "yes"; then
  6989. AC_MSG_ERROR([SP non-blocking not supported with sp-asm])
  6990. fi
  6991. if test "$ENABLED_ASM" = "no"; then
  6992. AC_MSG_ERROR([Assembly code turned off])
  6993. fi
  6994. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ASM"
  6995. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ASM"
  6996. case $host_cpu in
  6997. *aarch64*)
  6998. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM64_ASM"
  6999. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM64_ASM"
  7000. ENABLED_SP_ARM64_ASM=yes
  7001. ;;
  7002. *armv7a* | *armv7l*)
  7003. if test "$ENABLED_ARMASM" = "no"; then
  7004. AM_CPPFLAGS="$AM_CPPFLAGS -march=armv7-a -mfpu=neon -DWOLFSSL_ARM_ARCH=7 -marm"
  7005. fi
  7006. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM32_ASM"
  7007. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM32_ASM"
  7008. ENABLED_SP_ARM32_ASM=yes
  7009. ;;
  7010. *cortex* | *armv7m*)
  7011. if test "$ENABLED_ARMASM" = "no"; then
  7012. AM_CPPFLAGS="$AM_CPPFLAGS -march=armv7-r -D__thumb__ -DWOLFSSL_ARM_ARCH=7"
  7013. fi
  7014. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM_CORTEX_M_ASM"
  7015. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM_CORTEX_M_ASM"
  7016. ENABLED_SP_ARM_CORTEX_ASM=yes
  7017. ;;
  7018. *armv6*)
  7019. if test "$ENABLED_ARMASM" = "no"; then
  7020. AM_CPPFLAGS="$AM_CPPFLAGS -march=armv6 -DWOLFSSL_ARM_ARCH=6"
  7021. fi
  7022. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM32_ASM"
  7023. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM32_ASM"
  7024. ENABLED_SP_ARM32_ASM=yes
  7025. ;;
  7026. *armv4*)
  7027. if test "$ENABLED_ARMASM" = "no"; then
  7028. AM_CPPFLAGS="$AM_CPPFLAGS -march=armv4 -DWOLFSSL_ARM_ARCH=4"
  7029. fi
  7030. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM32_ASM"
  7031. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM32_ASM"
  7032. ENABLED_SP_ARM32_ASM=yes
  7033. ;;
  7034. *arm*)
  7035. if test "$host_alias" = "thumb" || test "$ARM_TARGET" = "thumb"; then
  7036. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM_THUMB_ASM"
  7037. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM_THUMB_ASM"
  7038. ENABLED_SP_ARM_THUMB_ASM=yes
  7039. else
  7040. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM32_ASM"
  7041. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM32_ASM"
  7042. ENABLED_SP_ARM32_ASM=yes
  7043. fi
  7044. ;;
  7045. *x86_64* | *amd64*)
  7046. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_X86_64_ASM"
  7047. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_X86_64_ASM"
  7048. ENABLED_SP_X86_64_ASM=yes
  7049. ;;
  7050. *)
  7051. AC_MSG_ERROR([ASM not available for CPU. Supported CPUs: x86_64, aarch64, arm])
  7052. ;;
  7053. esac
  7054. fi
  7055. if test "$ENABLED_SP_MATH" = "yes"; then
  7056. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MATH"
  7057. fi
  7058. ################################################################################
  7059. # End - Single Precision option handling #
  7060. ################################################################################
  7061. # static memory use
  7062. AC_ARG_ENABLE([staticmemory],
  7063. [AS_HELP_STRING([--enable-staticmemory],[Enable static memory use (default: disabled)])],
  7064. [ ENABLED_STATICMEMORY=$enableval ],
  7065. [ ENABLED_STATICMEMORY=no ]
  7066. )
  7067. for v in `echo $ENABLED_STATICMEMORY | tr "," " "`
  7068. do
  7069. case $v in
  7070. yes)
  7071. ;;
  7072. no)
  7073. ;;
  7074. small|lean)
  7075. ENABLED_STATICMEMORY=yes
  7076. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY_LEAN"
  7077. ;;
  7078. debug)
  7079. ENABLED_STATICMEMORY=yes
  7080. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY_DEBUG_CALLBACK"
  7081. ;;
  7082. *)
  7083. AC_MSG_ERROR([Invalid choice for staticmemory.])
  7084. break;;
  7085. esac
  7086. done
  7087. if test "x$ENABLED_STATICMEMORY" = "xyes"
  7088. then
  7089. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY"
  7090. if test "x$ENABLED_HEAPMATH" = "xyes"
  7091. then
  7092. AC_MSG_ERROR([please use --enable-fastmath if enabling staticmemory.])
  7093. fi
  7094. if test "$ENABLED_LOWRESOURCE" = "yes" && test "$ENABLED_RSA" = "no"
  7095. then
  7096. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY_SMALL"
  7097. fi
  7098. fi
  7099. # microchip api
  7100. AC_ARG_ENABLE([mcapi],
  7101. [AS_HELP_STRING([--enable-mcapi],[Enable Microchip API (default: disabled)])],
  7102. [ ENABLED_MCAPI=$enableval ],
  7103. [ ENABLED_MCAPI=no ]
  7104. )
  7105. if test "$ENABLED_MCAPI" = "yes"
  7106. then
  7107. AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI"
  7108. if test "x$ENABLED_AESCTR" != "xyes"
  7109. then
  7110. # These flags are already implied by --enable-aesctr
  7111. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  7112. fi
  7113. if test "x$ENABLED_AESGCM" != "xyes" && test "x$ENABLED_AESGCM" != "xno"
  7114. then
  7115. # Use the smaller object size implementation
  7116. ENABLED_AESGCM=yes
  7117. fi
  7118. fi
  7119. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
  7120. then
  7121. AC_MSG_ERROR([please enable sha512 if enabling mcapi.])
  7122. fi
  7123. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_ECC" = "no"
  7124. then
  7125. AC_MSG_ERROR([please enable ecc if enabling mcapi.])
  7126. fi
  7127. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_LIBZ" = "no"
  7128. then
  7129. AC_MSG_ERROR([please use --with-libz if enabling mcapi.])
  7130. fi
  7131. # cryptodev is old name, replaced with cryptocb
  7132. AC_ARG_ENABLE([cryptodev],
  7133. [AS_HELP_STRING([--enable-cryptodev],[DEPRECATED, use cryptocb instead])],
  7134. [ ENABLED_CRYPTOCB=$enableval ],[ ENABLED_CRYPTOCB=no ])
  7135. # Support for crypto callbacks
  7136. AC_ARG_ENABLE([cryptocb],
  7137. [AS_HELP_STRING([--enable-cryptocb],[Enable crypto callbacks (default: disabled)])],
  7138. [ ENABLED_CRYPTOCB=$enableval ],
  7139. [ ENABLED_CRYPTOCB=no ]
  7140. )
  7141. if test "x$ENABLED_PKCS11" = "xyes" || test "x$ENABLED_WOLFTPM" = "xyes" || test "$ENABLED_CAAM" != "no"
  7142. then
  7143. ENABLED_CRYPTOCB=yes
  7144. fi
  7145. if test "$ENABLED_CRYPTOCB" = "yes"
  7146. then
  7147. AM_CFLAGS="$AM_CFLAGS -DWOLF_CRYPTO_CB"
  7148. fi
  7149. # Asynchronous Crypto
  7150. AC_ARG_ENABLE([asynccrypt],
  7151. [AS_HELP_STRING([--enable-asynccrypt],[Enable Asynchronous Crypto (default: disabled)])],
  7152. [ ENABLED_ASYNCCRYPT=$enableval ],
  7153. [ ENABLED_ASYNCCRYPT=no ]
  7154. )
  7155. # Asynchronous crypto using software (i.e. not hardware). Required for
  7156. # non-blocking crypto with TLS/DTLS.
  7157. AC_ARG_ENABLE([asynccrypt-sw],
  7158. [AS_HELP_STRING([--enable-asynccrypt-sw],[Enable asynchronous software-based crypto (default: disabled)])],
  7159. [ ENABLED_ASYNCCRYPT_SW=$enableval ],
  7160. [ ENABLED_ASYNCCRYPT_SW=no ]
  7161. )
  7162. if test "$ENABLED_ASYNCCRYPT_SW" = "yes"
  7163. then
  7164. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT_SW"
  7165. ENABLED_ASYNCCRYPT=yes
  7166. fi
  7167. if test "$ENABLED_ASYNCCRYPT" = "yes"
  7168. then
  7169. AC_MSG_NOTICE([Enabling asynchronous support])
  7170. if ! test -f ${srcdir}/wolfcrypt/src/async.c || ! test -f ${srcdir}/wolfssl/wolfcrypt/async.h
  7171. then
  7172. AC_MSG_ERROR([--enable-asynccrypt requested, but WOLFSSL_ASYNC_CRYPT source files are missing.])
  7173. fi
  7174. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT -DHAVE_WOLF_EVENT -DHAVE_WOLF_BIGINT -DWOLFSSL_NO_HASH_RAW"
  7175. # If no async backend (hardware or software) has been explicitly enabled,
  7176. # use the software backend for testing.
  7177. if test "x$ENABLED_CAVIUM" != "xyes" && test "x$ENABLED_INTEL_QA" != "xyes" && test "x$ENABLED_CRYPTOCB" != "xyes" && test "x$ENABLED_PKCALLBACKS" != "xyes" && test "x$ENABLED_ASYNCCRYPT_SW" != "xyes"
  7178. then
  7179. AC_MSG_NOTICE([Enabling asynchronous software simulator])
  7180. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT_SW"
  7181. ENABLED_ASYNCCRYPT_SW=yes
  7182. fi
  7183. fi
  7184. # check for async if using Intel QuckAssist or Cavium
  7185. if test "x$ENABLED_INTEL_QA" = "xyes" || test "x$ENABLED_CAVIUM" = "xyes" ; then
  7186. if test "x$ENABLED_ASYNCCRYPT" = "xno" ; then
  7187. AC_MSG_ERROR([Please enable asynchronous support using --enable-asynccrypt])
  7188. fi
  7189. fi
  7190. # Asynchronous threading (Linux specific)
  7191. AC_ARG_ENABLE([asyncthreads],
  7192. [AS_HELP_STRING([--enable-asyncthreads],[Enable Asynchronous Threading (default: enabled)])],
  7193. [ ENABLED_ASYNCTHREADS=$enableval ],
  7194. [ ENABLED_ASYNCTHREADS=yes ]
  7195. )
  7196. if test "$ENABLED_ASYNCCRYPT" = "yes" && test "$ENABLED_ASYNCTHREADS" = "yes"
  7197. then
  7198. AX_PTHREAD([ENABLED_ASYNCTHREADS=yes],[ENABLED_ASYNCTHREADS=no])
  7199. else
  7200. ENABLED_ASYNCTHREADS=no
  7201. fi
  7202. if test "$ENABLED_ASYNCTHREADS" = "yes"
  7203. then
  7204. LIB_ADD="-lpthread $LIB_ADD"
  7205. AM_CFLAGS="$AM_CFLAGS -D_GNU_SOURCE"
  7206. else
  7207. AM_CFLAGS="$AM_CFLAGS -DWC_NO_ASYNC_THREADING"
  7208. fi
  7209. # Support for autosar shim
  7210. AC_ARG_ENABLE([autosar],
  7211. [AS_HELP_STRING([--enable-autosar],[Enable AutoSAR support (default: disabled)])],
  7212. [ ENABLED_AUTOSAR=$enableval ],
  7213. [ ENABLED_AUTOSAR=no ]
  7214. )
  7215. if test "$ENABLED_AUTOSAR" = "yes"
  7216. then
  7217. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AUTOSAR"
  7218. fi
  7219. # Session Export
  7220. AC_ARG_ENABLE([sessionexport],
  7221. [AS_HELP_STRING([--enable-sessionexport],[Enable export and import of sessions (default: disabled)])],
  7222. [ ENABLED_SESSIONEXPORT=$enableval ],
  7223. [ ENABLED_SESSIONEXPORT=no ]
  7224. )
  7225. if test "$ENABLED_SESSIONEXPORT" = "yes" ||
  7226. test "$ENABLED_SESSIONEXPORT" = "nopeer"
  7227. then
  7228. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SESSION_EXPORT"
  7229. if test "$ENABLED_SESSIONEXPORT" = "nopeer"
  7230. then
  7231. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SESSION_EXPORT_NOPEER"
  7232. fi
  7233. fi
  7234. if test "$ENABLED_WPAS" != "no" &&
  7235. ( test "$ENABLED_FIPS" = "no" || test "x$FIPS_VERSION" = "xv6" )
  7236. then
  7237. ENABLED_AESKEYWRAP="yes"
  7238. fi
  7239. if test "$ENABLED_AESKEYWRAP" = "yes"
  7240. then
  7241. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_KEYWRAP -DWOLFSSL_AES_DIRECT"
  7242. fi
  7243. # Old name support for backwards compatibility
  7244. AC_ARG_ENABLE([oldnames],
  7245. [AS_HELP_STRING([--enable-oldnames],[Keep backwards compat with old names (default: enabled)])],
  7246. [ ENABLED_OLDNAMES=$enableval ],
  7247. [ ENABLED_OLDNAMES=yes ]
  7248. )
  7249. if test "x$ENABLED_OLDNAMES" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  7250. then
  7251. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_RNGNAME -DNO_OLD_WC_NAMES -DNO_OLD_SSL_NAMES"
  7252. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_SHA_NAMES -DNO_OLD_MD5_NAME"
  7253. fi
  7254. # Memory Tests
  7255. AC_ARG_ENABLE([memtest],
  7256. [AS_HELP_STRING([--enable-memtest],[Memory testing option, for internal use (default: disabled)])],
  7257. [ ENABLED_MEMTEST=$enableval ],
  7258. [ ENABLED_MEMTEST=no ]
  7259. )
  7260. if test "x$ENABLED_MEMTEST" != "xno"
  7261. then
  7262. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY -DWOLFSSL_DEBUG_MEMORY"
  7263. fi
  7264. if test "x$ENABLED_MEMTEST" = "xfail"
  7265. then
  7266. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_FORCE_MALLOC_FAIL_TEST"
  7267. fi
  7268. # Enable hash flags support
  7269. # Hash flags are useful for runtime options such as SHA3 KECCAK256 selection
  7270. AC_ARG_ENABLE([hashflags],
  7271. [AS_HELP_STRING([--enable-hashflags],[Enable support for hash flags (default: disabled)])],
  7272. [ ENABLED_HASHFLAGS=$enableval ],
  7273. [ ENABLED_HASHFLAGS=no ]
  7274. )
  7275. if test "x$ENABLED_HASHFLAGS" != "xno"
  7276. then
  7277. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HASH_FLAGS"
  7278. fi
  7279. # Support for enabling setting default DH parameters in TLS
  7280. AC_ARG_ENABLE([defaultdhparams],
  7281. [AS_HELP_STRING([--enable-defaultdhparams],[Enables option for default dh parameters (default: disabled)])],
  7282. [ ENABLED_DHDEFAULTPARAMS=$enableval ],
  7283. [ ENABLED_DHDEFAULTPARAMS=yes ]
  7284. )
  7285. if test "x$ENABLED_DH" = "xyes" && test "x$ENABLED_DHDEFAULTPARAMS" = "xyes" && test "x$ENABLED_QT" != "xyes"
  7286. then
  7287. ENABLED_DHDEFAULTPARAMS=yes
  7288. AM_CFLAGS="$AM_CFLAGS -DHAVE_DH_DEFAULT_PARAMS"
  7289. fi
  7290. AC_ARG_WITH([max-rsa-bits],
  7291. [AS_HELP_STRING([--with-max-rsa-bits=number],[number of bits to support for RSA, DH, and DSA keys])],
  7292. [WITH_MAX_CLASSIC_ASYM_KEY_BITS=$withval],
  7293. [WITH_MAX_CLASSIC_ASYM_KEY_BITS="$DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS"])
  7294. if test -n "$WITH_MAX_CLASSIC_ASYM_KEY_BITS"; then
  7295. if test "$WITH_MAX_CLASSIC_ASYM_KEY_BITS" -lt 1024 -o "$WITH_MAX_CLASSIC_ASYM_KEY_BITS" -gt 16384; then
  7296. AC_MSG_ERROR([--with-max-rsa-bits argument must be between 1024 and 16384 inclusive])
  7297. fi
  7298. if test "$ENABLED_FIPS" = "no"
  7299. then
  7300. AM_CFLAGS="$AM_CFLAGS -DRSA_MAX_SIZE=$WITH_MAX_CLASSIC_ASYM_KEY_BITS"
  7301. fi
  7302. MPI_MAX_KEY_BITS=$WITH_MAX_CLASSIC_ASYM_KEY_BITS
  7303. fi
  7304. AC_ARG_WITH([max-ecc-bits],
  7305. [AS_HELP_STRING([--with-max-ecc-bits=number],[number of bits to support for ECC algorithms])],
  7306. [WITH_MAX_ECC_BITS=$withval],
  7307. )
  7308. if test -n "$WITH_MAX_ECC_BITS"; then
  7309. if test "$WITH_MAX_ECC_BITS" -lt 112 -o "$WITH_MAX_ECC_BITS" -gt 1024; then
  7310. AC_MSG_ERROR([--with-max-ecc-bits argument must be between 112 and 1024 inclusive])
  7311. fi
  7312. AM_CFLAGS="$AM_CFLAGS -DMAX_ECC_BITS=$WITH_MAX_ECC_BITS"
  7313. fi
  7314. if test -n "$MPI_MAX_KEY_BITS" -o -n "$WITH_MAX_ECC_BITS"; then
  7315. if test -n "$MAX_MPI_KEY_BITS" -a -n "$WITH_MAX_ECC_BITS"; then
  7316. if test "$MAX_MPI_KEY_BITS" -lt "$WITH_MAX_ECC_BITS"; then
  7317. MPI_MAX_KEY_BITS="$WITH_MAX_ECC_BITS"
  7318. fi
  7319. elif test -n "$WITH_MAX_ECC_BITS"; then
  7320. MPI_MAX_KEY_BITS="$WITH_MAX_ECC_BITS"
  7321. fi
  7322. if test "$MPI_MAX_KEY_BITS" -gt 1024; then
  7323. AM_CFLAGS="$AM_CFLAGS -DFP_MAX_BITS=$((MPI_MAX_KEY_BITS * 2)) -DSP_INT_BITS=$MPI_MAX_KEY_BITS"
  7324. fi
  7325. fi
  7326. AC_ARG_ENABLE([linuxkm-lkcapi-register],
  7327. [AS_HELP_STRING([--enable-linuxkm-lkcapi-register],[Register wolfCrypt implementations with the Linux Kernel Crypto API backplane. Possible values are "none", "all", "cbc(aes)", "cfb(aes)", "gcm(aes)", and "xts(aes)", or a comma-separate combination. (default: none)])],
  7328. [ENABLED_LINUXKM_LKCAPI_REGISTER=$enableval],
  7329. [ENABLED_LINUXKM_LKCAPI_REGISTER=none]
  7330. )
  7331. if test "$ENABLED_LINUXKM_LKCAPI_REGISTER" != "none"
  7332. then
  7333. AM_CFLAGS="$AM_CFLAGS -DLINUXKM_LKCAPI_REGISTER"
  7334. if test "$ENABLED_AESGCM" != "no" && test "$ENABLED_AESGCM_STREAM" = "no" && test "$ENABLED_ARMASM" = "no" && test "$ENABLED_RISCV_ASM" = "no" && test "$ENABLED_FIPS" = "no"; then
  7335. ENABLED_AESGCM_STREAM=yes
  7336. fi
  7337. if test "$ENABLED_LINUXKM_LKCAPI_REGISTER" = "yes"
  7338. then
  7339. ENABLED_LINUXKM_LKCAPI_REGISTER=all
  7340. fi
  7341. for lkcapi_alg in $(echo "$ENABLED_LINUXKM_LKCAPI_REGISTER" | tr ',' ' ')
  7342. do
  7343. case "$lkcapi_alg" in
  7344. all) test "$ENABLED_EXPERIMENTAL" = "yes" || AC_MSG_ERROR([linuxkm-lkcapi-register ${lkcapi_alg}: requires --enable-experimental.])
  7345. AM_CFLAGS="$AM_CFLAGS -DLINUXKM_LKCAPI_REGISTER_ALL" ;;
  7346. 'cbc(aes)') test "$ENABLED_AESCBC" != "no" || AC_MSG_ERROR([linuxkm-lkcapi-register ${lkcapi_alg}: AES-CBC implementation not enabled.])
  7347. test "$ENABLED_EXPERIMENTAL" = "yes" || AC_MSG_ERROR([linuxkm-lkcapi-register ${lkcapi_alg}: requires --enable-experimental.])
  7348. AM_CFLAGS="$AM_CFLAGS -DLINUXKM_LKCAPI_REGISTER_AESCBC" ;;
  7349. 'cfb(aes)') test "$ENABLED_AESCFB" != "no" || AC_MSG_ERROR([linuxkm-lkcapi-register ${lkcapi_alg}: AES-CFB implementation not enabled.])
  7350. test "$ENABLED_EXPERIMENTAL" = "yes" || AC_MSG_ERROR([linuxkm-lkcapi-register ${lkcapi_alg}: requires --enable-experimental.])
  7351. AM_CFLAGS="$AM_CFLAGS -DLINUXKM_LKCAPI_REGISTER_AESCFB" ;;
  7352. 'gcm(aes)') test "$ENABLED_AESGCM" != "no" || AC_MSG_ERROR([linuxkm-lkcapi-register ${lkcapi_alg}: AES-GCM implementation not enabled.])
  7353. test "$ENABLED_AESGCM_STREAM" != "no" || AC_MSG_ERROR([linuxkm-lkcapi-register ${lkcapi_alg}: --enable-aesgcm-stream is required for LKCAPI.])
  7354. test "$ENABLED_EXPERIMENTAL" = "yes" || AC_MSG_ERROR([linuxkm-lkcapi-register ${lkcapi_alg}: requires --enable-experimental.])
  7355. AM_CFLAGS="$AM_CFLAGS -DLINUXKM_LKCAPI_REGISTER_AESGCM" ;;
  7356. 'xts(aes)') test "$ENABLED_AESXTS" != "no" || AC_MSG_ERROR([linuxkm-lkcapi-register ${lkcapi_alg}: AES-XTS implementation not enabled.])
  7357. test "$ENABLED_AESXTS_STREAM" != "no" || AC_MSG_ERROR([linuxkm-lkcapi-register ${lkcapi_alg}: --enable-aesxts-stream is required for LKCAPI.])
  7358. AM_CFLAGS="$AM_CFLAGS -DLINUXKM_LKCAPI_REGISTER_AESXTS" ;;
  7359. *) AC_MSG_ERROR([Unsupported LKCAPI algorithm "$lkcapi_alg".]) ;;
  7360. esac
  7361. done
  7362. fi
  7363. # Library Suffix
  7364. LIBSUFFIX=""
  7365. AC_ARG_WITH([libsuffix],
  7366. [AS_HELP_STRING([--with-libsuffix=SUFFIX],[Library artifact SUFFIX, ie libwolfsslSUFFIX.so])],
  7367. [
  7368. if test "x$withval" != "xno" ; then
  7369. LIBSUFFIX=$withval
  7370. fi
  7371. if test "x$withval" = "xyes" ; then
  7372. AC_MSG_ERROR([Invalid argument to --with-libsuffix, no suffix given])
  7373. fi
  7374. ]
  7375. )
  7376. AC_SUBST(LIBSUFFIX)
  7377. AC_ARG_ENABLE([context-extra-user-data],
  7378. [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)])],
  7379. [ ENABLED_EX_DATA=$enableval ],
  7380. [ ENABLED_EX_DATA=no ]
  7381. )
  7382. case "$ENABLED_EX_DATA" in
  7383. no) ;;
  7384. yes) AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
  7385. ;;
  7386. [[1-9]]|[[1-9]][[0-9]]) AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA -DMAX_EX_DATA=$ENABLED_EX_DATA"
  7387. ;;
  7388. *) AC_MSG_ERROR([Invalid argument to --enable-context-extra-user-data -- must be yes, no, or a number from 1 to 99])
  7389. ;;
  7390. esac
  7391. # IoT-Safe support
  7392. AC_ARG_ENABLE([iotsafe],
  7393. [AS_HELP_STRING([--enable-iotsafe],[Enables support for IoT-Safe secure applet (default: disabled)])],
  7394. [ ENABLED_IOTSAFE=$enableval ],
  7395. [ ENABLED_IOTSAFE=no ]
  7396. )
  7397. AC_ARG_ENABLE([iotsafe-hwrng],
  7398. [AS_HELP_STRING([--enable-iotsafe-hwrng],[Enables support for IoT-Safe RNG (default: disabled)])],
  7399. [ ENABLED_IOTSAFE_HWRNG=$enableval ],
  7400. [ ENABLED_IOTSAFE_HWRNG=no ]
  7401. )
  7402. # Make clean
  7403. AC_ARG_ENABLE([makeclean],
  7404. [AS_HELP_STRING([--enable-makeclean], [Enables forced "make clean" at the
  7405. end of configure (default: enabled)])],
  7406. [ ENABLED_MAKECLEAN=$enableval ],
  7407. [ ENABLED_MAKECLEAN=yes ]
  7408. )
  7409. # User Settings
  7410. AC_ARG_ENABLE([usersettings],
  7411. [AS_HELP_STRING([--enable-usersettings],[Use your own user_settings.h and do not add Makefile CFLAGS (default: disabled)])],
  7412. [ ENABLED_USERSETTINGS=$enableval ],
  7413. [ ENABLED_USERSETTINGS=no ]
  7414. )
  7415. # Default optimization CFLAGS enable
  7416. AC_ARG_ENABLE([optflags],
  7417. [AS_HELP_STRING([--enable-optflags],[Enable default optimization CFLAGS for the compiler (default: enabled)])],
  7418. [ ENABLED_OPTFLAGS=$enableval ],
  7419. [ ENABLED_OPTFLAGS=yes ]
  7420. )
  7421. # Adds functionality to load CA certificates from the operating system.
  7422. AC_ARG_ENABLE([sys-ca-certs],
  7423. [AS_HELP_STRING([--enable-sys-ca-certs],[Enable ability to load CA certs from OS (default: enabled)])],
  7424. [ ENABLED_SYS_CA_CERTS=$enableval ],
  7425. [ ENABLED_SYS_CA_CERTS=yes ]
  7426. )
  7427. AC_ARG_ENABLE([dual-alg-certs],
  7428. [AS_HELP_STRING([--enable-dual-alg-certs],[Enable support for dual key/signature certificates in TLS 1.3 as defined in X9.146 (requires --enable-experimental) (default: disabled)])],
  7429. [ ENABLED_DUAL_ALG_CERTS=$enableval ],
  7430. [ ENABLED_DUAL_ALG_CERTS=no ]
  7431. )
  7432. AS_IF([ test "$ENABLED_DUAL_ALG_CERTS" != "no" && test "$ENABLED_EXPERIMENTAL" != "yes" ],[ AC_MSG_ERROR([dual-alg-certs requires --enable-experimental.]) ])
  7433. # Adds functionality to support Raw Public Key (RPK) RFC7250
  7434. AC_ARG_ENABLE([rpk],
  7435. [AS_HELP_STRING([--enable-rpk],[Enable support for Raw Public Key (RPK) RFC7250 (default: disabled)])],
  7436. [ ENABLED_RPK=$enableval ],
  7437. [ ENABLED_RPK=no ]
  7438. )
  7439. # check if should run the trusted peer certs test
  7440. # (for now checking both C_FLAGS and C_EXTRA_FLAGS)
  7441. AS_CASE(["$CFLAGS $CPPFLAGS"],[*'WOLFSSL_TRUST_PEER_CERT'*],[ENABLED_TRUSTED_PEER_CERT=yes])
  7442. # Allows disabling the OPENSSL_COMPATIBLE_DEFAULTS macro
  7443. AC_ARG_ENABLE([openssl-compatible-defaults],
  7444. [AS_HELP_STRING([--disable-openssl-compatible-defaults],[Disable OpenSSL compatible defaults when enabled by other options (default: enabled)])],
  7445. [ ENABLED_OPENSSL_COMPATIBLE_DEFAULTS=$enableval ],
  7446. [ ENABLED_OPENSSL_COMPATIBLE_DEFAULTS=yes ]
  7447. )
  7448. AS_CASE(["$CFLAGS $CPPFLAGS $AM_CFLAGS"],[*'OPENSSL_COMPATIBLE_DEFAULTS'*],
  7449. [FOUND_OPENSSL_COMPATIBLE_DEFAULTS=yes])
  7450. if test "x$FOUND_OPENSSL_COMPATIBLE_DEFAULTS" = "xyes"
  7451. then
  7452. if test "x$ENABLED_OPENSSL_COMPATIBLE_DEFAULTS" = "xyes"
  7453. then
  7454. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRUST_PEER_CERT"
  7455. AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE_REF"
  7456. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TLS13_NO_PEEK_HANDSHAKE_DONE"
  7457. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALT_CERT_CHAINS"
  7458. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PRIORITIZE_PSK"
  7459. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CHECK_ALERT_ON_ERR"
  7460. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TICKET_HAVE_ID"
  7461. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_OCSP_ISSUER_CHECK"
  7462. ENABLED_TRUSTED_PEER_CERT=yes
  7463. else
  7464. CFLAGS=$(printf "%s" "$CFLAGS" | sed 's/-DOPENSSL_COMPATIBLE_DEFAULTS//g')
  7465. CPPFLAGS=$(printf "%s" "$CPPFLAGS" | sed 's/-DOPENSSL_COMPATIBLE_DEFAULTS//g')
  7466. AM_CFLAGS=$(printf "%s" "$AM_CFLAGS" | sed 's/-DOPENSSL_COMPATIBLE_DEFAULTS//g')
  7467. fi
  7468. fi
  7469. # determine if we have key validation mechanism
  7470. if test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_RSA" = "xyes"
  7471. then
  7472. if test "x$ENABLED_ASN" = "xyes"
  7473. then
  7474. ENABLED_PKI="yes"
  7475. fi
  7476. fi
  7477. # When building for wolfRand, strip out all options to disable everything.
  7478. AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$FIPS_VERSION" = "xrand"],
  7479. [NEW_AM_CFLAGS="-DNO_AES -DNO_DH -DNO_ASN -DNO_RSA -DNO_SHA -DNO_MD5 -DNO_BIG_INT"
  7480. for v in $AM_CFLAGS
  7481. do
  7482. case $v in
  7483. -DHAVE_FFDHE_2048 | -DTFM_TIMING_RESISTANT | -DECC_TIMING_RESISTANT | \
  7484. -DWC_RSA_BLINDING | -DHAVE_AESGCM | -DWOLFSSL_SHA512 | -DWOLFSSL_SHA384 | \
  7485. -DHAVE_ECC | -DTFM_ECC256 | -DECC_SHAMIR | -DHAVE_TLS_EXTENSIONS | \
  7486. -DHAVE_SUPPORTED_CURVES | -DHAVE_EXTENDED_MASTER | -DUSE_FAST_MATH | \
  7487. -DWOLFSSL_SHA3)
  7488. AS_ECHO(["ignoring $v"])
  7489. ;;
  7490. *)
  7491. NEW_AM_CFLAGS="$NEW_AM_CFLAGS $v"
  7492. ;;
  7493. esac
  7494. done
  7495. AM_CFLAGS=$NEW_AM_CFLAGS])
  7496. case $host_cpu in
  7497. *arm*)
  7498. if test "$host_alias" = "thumb" || test "$ARM_TARGET" = "thumb"; then
  7499. AM_CFLAGS="$AM_CFLAGS -mthumb -march=armv6"
  7500. else
  7501. if test "$host_alias" = "cortex" || test "$ARM_TARGET" = "cortex"; then
  7502. AM_CFLAGS="$AM_CFLAGS -mcpu=cortex-r5"
  7503. fi
  7504. fi
  7505. ;;
  7506. esac
  7507. if test "$ENABLED_LOWRESOURCE" = "yes" && test "$ENABLED_ECC" = "yes" && (test "$ENABLED_RSA" = "yes" || test "$ENABLED_DH" = "yes") && (test "$ENABLED_SP_MATH" = "yes" || test "$ENABLED_SP_MATH_ALL" = "yes")
  7508. then
  7509. AM_CFLAGS="$AM_CFLAGS -DALT_ECC_SIZE"
  7510. fi
  7511. ################################################################################
  7512. # Update ENABLE_* variables #
  7513. ################################################################################
  7514. if test "x$ENABLED_SYS_CA_CERTS" = "xyes"
  7515. then
  7516. if test "x$ENABLED_FILESYSTEM" = "xno"
  7517. then
  7518. ENABLED_SYS_CA_CERTS="no"
  7519. elif test "x$ENABLED_CERTS" = "xno"
  7520. then
  7521. ENABLED_SYS_CA_CERTS="no"
  7522. fi
  7523. case $host_os in
  7524. *darwin*)
  7525. # Headers used for MacOS default system CA certs behavior. Only MacOS SDK will have this header
  7526. AC_CHECK_HEADERS([Security/SecTrustSettings.h])
  7527. # Headers used for Apple native cert validation. All device SDKs should have these headers
  7528. AC_CHECK_HEADERS([Security/SecCertificate.h])
  7529. AC_CHECK_HEADERS([Security/SecTrust.h])
  7530. AC_CHECK_HEADERS([Security/SecPolicy.h])
  7531. # Either Security/SecTrustSettings (for MacOS cert loading), or the
  7532. # trio of Security/SecCertificate.h, Security/SecTrust.h, and
  7533. # Security/SecPolicy.h (for native trust APIs on other apple devices)
  7534. # must be present. Default to SecTrustSettings method on MacOS.
  7535. AS_IF([test "$ac_cv_header_Security_SecTrustSettings_h" = "yes" \
  7536. || (test "$ac_cv_header_Security_SecCertificate_h" = "yes" \
  7537. && test "$ac_cv_header_Security_SecTrust_h" = "yes" \
  7538. && test "$ac_cv_header_Security_SecPolicy_h" = "yes")],
  7539. [
  7540. LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
  7541. AS_IF([test "$ac_cv_header_Security_SecTrustSettings_h" != "yes"],
  7542. [
  7543. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_APPLE_NATIVE_CERT_VALIDATION"
  7544. ])
  7545. ],
  7546. [
  7547. AC_MSG_ERROR([Unable to find Apple Security.framework headers])
  7548. ])
  7549. ;;
  7550. esac
  7551. fi
  7552. if test "x$ENABLED_WOLFCLU" = "xyes"
  7553. then
  7554. if test "x$ENABLED_CERTGEN" = "xno"
  7555. then
  7556. ENABLED_CERTGEN="yes"
  7557. fi
  7558. if test "x$ENABLED_CERTREQ" = "xno"
  7559. then
  7560. ENABLED_CERTREQ="yes"
  7561. fi
  7562. if test "x$ENABLED_CERTEXT" = "xno"
  7563. then
  7564. ENABLED_CERTEXT="yes"
  7565. fi
  7566. # Requires md5
  7567. if test "$ENABLED_MD5" = "no"
  7568. then
  7569. ENABLED_MD5="yes"
  7570. fi
  7571. # Requires aesctr
  7572. if test "x$ENABLED_AESCTR" = "xno"
  7573. then
  7574. ENABLED_AESCTR="yes"
  7575. fi
  7576. # Uses key generation
  7577. if test "x$ENABLED_KEYGEN" = "xno"
  7578. then
  7579. ENABLED_KEYGEN="yes"
  7580. fi
  7581. # Uses functions guarded by opensslall
  7582. if test "$ENABLED_OPENSSLALL" = "no"
  7583. then
  7584. ENABLED_OPENSSLALL="yes"
  7585. fi
  7586. # Has option for signing with ED25519
  7587. if test "$ENABLED_ED25519" = "no"
  7588. then
  7589. ENABLED_ED25519=yes
  7590. ENABLED_FEMATH=yes
  7591. ENABLED_GEMATH=yes
  7592. ENABLED_CERTS=yes
  7593. fi
  7594. # Has sha512 hashing
  7595. if test "$ENABLED_SHA512" = "no"
  7596. then
  7597. ENABLED_SHA512="yes"
  7598. fi
  7599. # Has support for DES3 encrypt/decrypt
  7600. if test "$ENABLED_DES3" = "no"
  7601. then
  7602. ENABLED_DES3="yes"
  7603. fi
  7604. # Uses alt name
  7605. ENABLED_ALTNAMES="yes"
  7606. AM_CFLAGS="$AM_CFLAGS -DHAVE_OID_ENCODING -DWOLFSSL_NO_ASN_STRICT"
  7607. fi
  7608. if test "$ENABLED_STRONGSWAN" = "yes"; then
  7609. if test "$ENABLED_CERTREQ" = "no"; then
  7610. ENABLED_CERTREQ="yes"
  7611. fi
  7612. if test "$ENABLED_OCSP" = "no"; then
  7613. ENABLED_OCSP="yes"
  7614. fi
  7615. fi
  7616. AS_IF([test "x$ENABLED_MCAPI" = "xyes"],
  7617. [AS_IF([test "x$ENABLED_DES3" = "xno"],[ENABLED_DES3="yes"])])
  7618. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes" || \
  7619. test "$ENABLED_SIGNAL" = "yes" || test "$ENABLED_WPAS" = "yes" || \
  7620. test "$ENABLED_FORTRESS" = "yes" || test "$ENABLED_BUMP" = "yes" || \
  7621. test "$ENABLED_OPENSSLALL" = "yes" || \
  7622. test "$ENABLED_LIBWEBSOCKETS" = "yes" || \
  7623. test "x$ENABLED_LIGHTY" = "xyes" || test "$ENABLED_LIBSSH2" = "yes" || \
  7624. test "x$ENABLED_NTP" = "xyes" || test "$ENABLED_RSYSLOG" = "yes" || \
  7625. test "$ENABLED_OPENLDAP" = "yes" || test "$ENABLED_HITCH" = "yes"
  7626. then
  7627. ENABLED_OPENSSLEXTRA="yes"
  7628. fi
  7629. if test "$ENABLED_ED25519" != "no"
  7630. then
  7631. if test "$ENABLED_ED25519" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  7632. then
  7633. ENABLED_ED25519_SMALL=yes
  7634. ENABLED_CURVE25519_SMALL=yes
  7635. ENABLED_ED25519=yes
  7636. fi
  7637. ENABLED_FEMATH=yes
  7638. ENABLED_GEMATH=yes
  7639. ENABLED_CERTS=yes
  7640. fi
  7641. if test "$ENABLED_ED25519" != "no" || test "$ENABLED_ED448" != "no"
  7642. then
  7643. ENABLED_CERTS=yes
  7644. fi
  7645. if test "$ENABLED_MD5" = "yes"
  7646. then
  7647. # turn off MD5 if leanpsk or leantls on
  7648. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  7649. then
  7650. ENABLED_MD5=no
  7651. fi
  7652. fi
  7653. if test "x$ENABLED_LEANPSK" = "xyes" || test "x$ENABLED_CERTS" = "xno" || \
  7654. test "x$ENABLED_ASN" = "xno"
  7655. then
  7656. ENABLED_CERTS=no
  7657. ENABLED_ASN=no
  7658. fi
  7659. ################################################################################
  7660. # Check for build-type conflicts #
  7661. ################################################################################
  7662. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  7663. test "x$ENABLED_LEANPSK" = "xyes"],
  7664. [AC_MSG_ERROR([Cannot use Max Strength and Lean PSK at the same time.])])
  7665. AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
  7666. test "x$ENABLED_ASN" = "xno"],
  7667. [AC_MSG_ERROR([please enable asn if enabling ocsp.])])
  7668. AS_IF([test "x$ENABLED_SMIME" = "xyes" && \
  7669. test "x$ENABLED_ASN" = "xno"],
  7670. [AC_MSG_ERROR([please enable asn if enabling S/MIME.])])
  7671. AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
  7672. test "x$ENABLED_RSA" = "xno" && \
  7673. test "x$ENABLED_ECC" = "xno"],
  7674. [AC_MSG_ERROR([please enable rsa or ecc if enabling ocsp.])])
  7675. # Sync Intel QA and Sync Cavium Octeon require the crypto callback
  7676. AS_IF([test "x$ENABLED_INTEL_QA_SYNC" = "xyes" || test "x$ENABLED_OCTEON_SYNC" = "xyes"],
  7677. [AS_IF([test "x$ENABLED_CRYPTOCB" = "xno"],
  7678. [AC_MSG_ERROR([please enable the crypto callback support using --enable-cryptocb])])])
  7679. # checks for pkcs7 needed enables
  7680. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  7681. test "x$ENABLED_RSA" = "xno" && \
  7682. test "x$ENABLED_ECC" = "xno"],
  7683. [AC_MSG_ERROR([please enable ecc or rsa if enabling pkcs7.])])
  7684. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  7685. test "x$ENABLED_SHA" = "xno" && \
  7686. test "x$ENABLED_SHA256" = "xno"],
  7687. [AC_MSG_ERROR([please enable sha or sha256 if enabling pkcs7.])])
  7688. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  7689. test "x$ENABLED_AES" = "xno" && \
  7690. test "x$ENABLED_DES3" = "xno"],
  7691. [AC_MSG_ERROR([please enable either AES or 3DES if enabling pkcs7.])])
  7692. AS_IF([test "x$ENABLED_WOLFSCEP" = "xyes" && \
  7693. test "x$ENABLED_AES" = "xno" && \
  7694. test "x$ENABLED_DES3" = "xno"],
  7695. [AC_MSG_ERROR([please enable either AES or 3DES if enabling scep.])])
  7696. AS_IF([test "x$ENABLED_LEANTLS" = "xyes" && \
  7697. test "x$ENABLED_ECC" = "xno"],
  7698. [AC_MSG_ERROR([please enable ecc if enabling leantls.])])
  7699. AS_IF([test "x$ENABLED_SNIFFER" = "xyes" && \
  7700. test "x$ENABLED_RSA" = "xno" && \
  7701. test "x$ENABLED_ECC" = "xno" && \
  7702. test "x$ENABLED_CURVE25519" = "xno"],
  7703. [AC_MSG_ERROR([please enable ecc, rsa or curve25519 if enabling sniffer.])])
  7704. # Lean TLS forces off prereqs of SCEP.
  7705. AS_IF([test "x$ENABLED_SCEP" = "xyes" && \
  7706. test "x$ENABLED_LEANTLS" = "xyes"],
  7707. [AC_MSG_ERROR([Cannot use SCEP and Lean TLS at the same time.])])
  7708. # CMAC currently requires AES.
  7709. AS_IF([test "x$ENABLED_CMAC" = "xyes" && \
  7710. test "x$ENABLED_AES" = "xno"],
  7711. [AC_MSG_ERROR([cannot use CMAC without AES.])])
  7712. # certreq requires certgen
  7713. AS_IF([test "x$ENABLED_CERT_REQ" = "xyes" && \
  7714. test "x$ENABLED_CERT_GEN" = "xno"],
  7715. [AC_MSG_ERROR([cannot use certreq without certgen.])])
  7716. # ed25519 requires sha512
  7717. AS_IF([test "x$ENABLED_ED25519" = "xyes" && \
  7718. test "x$ENABLED_SHA512" = "xno" && \
  7719. test "x$ENABLED_32BIT" = "xno"],
  7720. [AC_MSG_ERROR([cannot enable ed25519 without enabling sha512.])])
  7721. # ed25519 stream requires ed25519
  7722. AS_IF([test "x$ENABLED_ED25519_STREAM" = "xyes" && \
  7723. test "x$ENABLED_ED25519" = "xno"],
  7724. [AC_MSG_ERROR([ED25519 verify streaming enabled but ED25519 is disabled])])
  7725. # Ensure only one size is enabled
  7726. AS_IF([test "x$ENABLED_64BIT" = "xyes" && \
  7727. test "x$ENABLED_32BIT" = "xyes"],
  7728. [AC_MSG_ERROR([cannot specify 64-bit build and 32-bit build.])])
  7729. AS_IF([test "x$ENABLED_64BIT" = "xyes" && \
  7730. test "x$ENABLED_16BIT" = "xyes"],
  7731. [AC_MSG_ERROR([cannot specify 64-bit build and 16-bit build.])])
  7732. AS_IF([test "x$ENABLED_32BIT" = "xyes" && \
  7733. test "x$ENABLED_16BIT" = "xyes"],
  7734. [AC_MSG_ERROR([cannot specify 32-bit build and 16-bit build.])])
  7735. # 16-bit build not supported with SP
  7736. AS_IF([test "x$ENABLED_16BIT" = "xyes" && \
  7737. test "x$ENABLED_SP" = "xyes"],
  7738. [AC_MSG_ERROR([16-bit build not available with SP.])])
  7739. ################################################################################
  7740. # Update CFLAGS based on options #
  7741. ################################################################################
  7742. AS_IF([test "x$ENABLED_SP_MATH_ALL" = "xno" && test "x$ENABLED_FASTMATH" = "xno" &&
  7743. test "x$ENABLED_HEAPMATH" = "xno"],
  7744. [AM_CFLAGS="$AM_CFLAGS -DNO_BIG_INT"])
  7745. AS_IF([test "x$ENABLED_CERTS" = "xno"],
  7746. [AM_CFLAGS="$AM_CFLAGS -DNO_CERTS"])
  7747. AS_IF([test "x$ENABLED_ASN" = "xno"],
  7748. [AM_CFLAGS="$AM_CFLAGS -DNO_ASN"])
  7749. AS_IF([test "x$ENABLED_SYS_CA_CERTS" = "xyes"],
  7750. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SYS_CA_CERTS"])
  7751. AS_IF([test "x$ENABLED_DUAL_ALG_CERTS" = "xyes"],
  7752. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DUAL_ALG_CERTS"])
  7753. AS_IF([test "x$ENABLED_RPK" = "xyes"],
  7754. [AM_CFLAGS="$AM_CFLAGS -DHAVE_RPK"])
  7755. AS_IF([test "x$ENABLED_ALTNAMES" = "xyes"],
  7756. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALT_NAMES"])
  7757. AS_IF([test "x$ENABLED_KEYGEN" = "xyes"],
  7758. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"])
  7759. AS_IF([test "x$ENABLED_CERTREQ" = "xyes"],
  7760. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"])
  7761. AS_IF([test "x$ENABLED_CERTGEN" = "xyes"],
  7762. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"])
  7763. AS_IF([test "x$ENABLED_CERTEXT" = "xyes"],
  7764. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"])
  7765. AS_IF([test "x$ENABLED_ED25519" = "xyes"],
  7766. [AM_CFLAGS="$AM_CFLAGS -DHAVE_ED25519"])
  7767. AS_IF([test "x$ENABLED_ED25519" = "xyes"],
  7768. [AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_ED25519"])
  7769. AS_IF([test "x$ENABLED_ED25519_SMALL" = "xyes"],
  7770. [AM_CFLAGS="$AM_CFLAGS -DED25519_SMALL"])
  7771. AS_IF([test "x$ENABLED_OCSP" = "xyes"],
  7772. [AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"])
  7773. AS_IF([test "x$ENABLED_STRONGSWAN" = "xyes"],
  7774. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB -DWOLFSSL_LOG_PRINTF -DWOLFSSL_PUBLIC_MP -DHAVE_EX_DATA"])
  7775. AS_IF([test "x$ENABLED_OPENLDAP" = "xyes"], [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SIGNER_DER_CERT"])
  7776. if test "$ENABLED_ED25519_STREAM" != "no" && test "$ENABLED_SE050" != "yes"
  7777. then
  7778. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ED25519_STREAMING_VERIFY"
  7779. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_ED25519_STREAMING_VERIFY"
  7780. fi
  7781. if test "$ENABLED_ERROR_QUEUE" = "no" || test "$ENABLED_JNI" = "yes"
  7782. then
  7783. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_QUEUE"
  7784. fi
  7785. AS_IF([test "x$ENABLED_OPENSSLALL" = "xyes"],
  7786. [AM_CFLAGS="$AM_CFLAGS -DOPENSSL_ALL -DWOLFSSL_EITHER_SIDE -DWC_RSA_NO_PADDING -DWC_RSA_PSS -DWOLFSSL_PSS_LONG_SALT -DWOLFSSL_TICKET_HAVE_ID -DWOLFSSL_ERROR_CODE_OPENSSL -DWOLFSSL_CERT_NAME_ALL"])
  7787. AS_IF([test "x$ENABLED_AESSIV" = "xyes"], [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_SIV"])
  7788. AS_IF([test "x$ENABLED_AESCTR" = "xyes" && test "x$ENABLED_FORTRESS" != "xyes"],
  7789. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"])
  7790. if test "$ENABLED_MD5" = "no"
  7791. then
  7792. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  7793. fi
  7794. AS_IF([test "x$ENABLED_AESBS" = "xyes" && test "x$ENABLED_ARMASM" = "xyes"],
  7795. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"])
  7796. if test "$ENABLED_HMAC" = "no"
  7797. then
  7798. AM_CFLAGS="$AM_CFLAGS -DNO_HMAC"
  7799. fi
  7800. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  7801. then
  7802. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  7803. fi
  7804. if test "$ENABLED_OPENSSLEXTRA" = "x509small"
  7805. then
  7806. AC_MSG_NOTICE([Enabling only a subset of X509 opensslextra])
  7807. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA_X509_SMALL"
  7808. fi
  7809. if test "$ENABLED_WOLFSCEP" = "yes"
  7810. then
  7811. # Enable prereqs if not already enabled
  7812. if test "x$ENABLED_KEYGEN" = "xno"
  7813. then
  7814. ENABLED_KEYGEN="yes"
  7815. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  7816. fi
  7817. if test "x$ENABLED_CERTGEN" = "xno"
  7818. then
  7819. ENABLED_CERTGEN="yes"
  7820. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  7821. fi
  7822. if test "x$ENABLED_CERTREQ" = "xno"
  7823. then
  7824. ENABLED_CERTREQ="yes"
  7825. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  7826. fi
  7827. if test "x$ENABLED_CERTEXT" = "xno"
  7828. then
  7829. ENABLED_CERTEXT="yes"
  7830. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  7831. fi
  7832. if test "x$ENABLED_PKCS7" = "xno"
  7833. then
  7834. ENABLED_PKCS7="yes"
  7835. fi
  7836. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_WOLFSCEP"
  7837. fi
  7838. if test "x$ENABLED_PKCS7" = "xyes"
  7839. then
  7840. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  7841. # Enable prereqs if not already enabled
  7842. if test "x$ENABLED_AESKEYWRAP" = "xno"
  7843. then
  7844. ENABLED_AESKEYWRAP="yes"
  7845. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_KEYWRAP -DWOLFSSL_AES_DIRECT"
  7846. fi
  7847. if test "x$ENABLED_X963KDF" = "xno" && test "$ENABLED_ECC" != "no"
  7848. then
  7849. ENABLED_X963KDF="yes"
  7850. AM_CFLAGS="$AM_CFLAGS -DHAVE_X963_KDF"
  7851. fi
  7852. fi
  7853. if test "x$ENABLED_DES3" = "xno"
  7854. then
  7855. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  7856. else
  7857. # turn off DES3 if leanpsk or leantls on
  7858. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  7859. then
  7860. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  7861. ENABLED_DES3=no
  7862. fi
  7863. fi
  7864. if test "x$ENABLED_DES3_TLS_SUITES" = "xno"
  7865. then
  7866. AM_CFLAGS="$AM_CFLAGS -DNO_DES3_TLS_SUITES"
  7867. else
  7868. AS_IF([test "x$ENABLED_DES3" = "xno"],
  7869. [AC_MSG_ERROR([DES3 TLS suites require DES3])])
  7870. fi
  7871. if test "$ENABLED_AESGCM" != "no"
  7872. then
  7873. if test "$ENABLED_AESGCM" = "word"
  7874. then
  7875. ENABLED_AESGCM=yes
  7876. fi
  7877. if test "$ENABLED_AESGCM" = "word32"
  7878. then
  7879. AM_CFLAGS="$AM_CFLAGS -DGCM_WORD32"
  7880. ENABLED_AESGCM=yes
  7881. fi
  7882. if test "$ENABLED_AESGCM" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  7883. then
  7884. AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL"
  7885. ENABLED_AESGCM=yes
  7886. fi
  7887. if test "$ENABLED_AESGCM" = "table"
  7888. then
  7889. AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE"
  7890. ENABLED_AESGCM=yes
  7891. fi
  7892. if test "$ENABLED_AESGCM" = "4bit"
  7893. then
  7894. AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE_4BIT"
  7895. ENABLED_AESGCM=yes
  7896. fi
  7897. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  7898. fi
  7899. if test "$ENABLED_AESGCM_STREAM" != "no"
  7900. then
  7901. if test "$ENABLED_AESGCM" = "no"
  7902. then
  7903. AC_MSG_ERROR([AES-GCM streaming enabled but AES-GCM is disabled])
  7904. else
  7905. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESGCM_STREAM"
  7906. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_AESGCM_STREAM"
  7907. fi
  7908. fi
  7909. if test "$ENABLED_AESXTS_STREAM" != "no"
  7910. then
  7911. if test "$ENABLED_AESXTS" = "no"
  7912. then
  7913. AC_MSG_ERROR([AES-XTS streaming enabled but AES-XTS is disabled])
  7914. else
  7915. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESXTS_STREAM"
  7916. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_AESXTS_STREAM"
  7917. fi
  7918. fi
  7919. if test "$ENABLED_IOTSAFE" != "no"
  7920. then
  7921. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_IOTSAFE"
  7922. ENABLED_IOTSAFE=yes
  7923. fi
  7924. if test "$ENABLED_IOTSAFE_HWRNG" != "no"
  7925. then
  7926. AM_CFLAGS="$AM_CFLAGS -DHAVE_IOTSAFE_HWRNG"
  7927. ENABLED_IOTSAFE_HWRNG=yes
  7928. fi
  7929. if test "x$ENABLED_WOLFENGINE" = "xyes"
  7930. then
  7931. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_ECB"
  7932. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  7933. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_NO_PADDING"
  7934. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PUBLIC_MP"
  7935. AM_CFLAGS="$AM_CFLAGS -DECC_MIN_KEY_SZ=192"
  7936. fi
  7937. if test "$ENABLED_WOLFENGINE" = "yes" && test "$ENABLED_FIPS" != "no"
  7938. then
  7939. AM_CFLAGS="$AM_CFLAGS -DSha3=wc_Sha3"
  7940. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_SHA256_NAMES"
  7941. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_MD5_NAME"
  7942. fi
  7943. if test "$ENABLED_WOLFENGINE" = "yes" && test "$FIPS_VERSION" != "v2"
  7944. then
  7945. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PSS_LONG_SALT"
  7946. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PSS_SALT_LEN_DISCOVER"
  7947. fi
  7948. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes"],
  7949. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MAX_STRENGTH -DWOLFSSL_CIPHER_TEXT_CHECK"])
  7950. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  7951. test "x$ENABLED_OLD_TLS" = "xyes"],
  7952. [AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  7953. ENABLED_OLD_TLS=no])
  7954. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  7955. test "x$ENABLED_SSLV3" = "xyes"],
  7956. [AC_MSG_ERROR([Cannot use Max Strength and SSLv3 at the same time.])])
  7957. AS_IF([test "x$ENABLED_SCTP" = "xyes"],
  7958. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SCTP"])
  7959. AS_IF([test "x$ENABLED_SRTP" = "xyes"],
  7960. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SRTP"])
  7961. AS_IF([test "x$ENABLED_MCAST" = "xyes"],
  7962. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MULTICAST"])
  7963. # WOLFSSL_AFALG does not support SHA224 yet
  7964. AS_IF([(test "x$ENABLED_AFALG" = "xyes") && (test "x$ENABLED_SHA224" = "xyes")],
  7965. [AC_MSG_ERROR([--enable-sha224 with --enable-afalg not yet supported])])
  7966. # WOLFSSL_DEVCRYPTO does not support SHA224 yet
  7967. AS_IF([(test "x$ENABLED_DEVCRYPTO" = "xyes") && \
  7968. (test "x$ENABLED_CAAM" = "xno") && \
  7969. (test "x$ENABLED_SHA224" = "xyes")],
  7970. [AC_MSG_ERROR([--enable-sha224 with --enable-devcrypto not yet supported])])
  7971. # SCTP, Multicast, SRTP, and strongSwan require DTLS
  7972. AS_IF([(test "x$ENABLED_DTLS" = "xno") && \
  7973. (test "x$ENABLED_SCTP" = "xyes" || test "x$ENABLED_MCAST" = "xyes" || \
  7974. test "x$ENABLED_SRTP" = "xyes" || \
  7975. test "x$ENABLED_STRONGSWAN" = "xyes")],
  7976. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS"
  7977. ENABLED_DTLS=yes])
  7978. # Multicast requires the null cipher
  7979. AS_IF([test "x$ENABLED_NULL_CIPHER" = "xno" && \
  7980. test "x$ENABLED_MCAST" = "xyes"],
  7981. [AM_CFLAGS="$AM_CFLAGS -DHAVE_NULL_CIPHER"
  7982. ENABLED_NULL_CIPHER=yes])
  7983. # wolfSSH and WPA Supplicant both need Public MP, only enable once.
  7984. # This will let you know if you enabled wolfSSH but have any of the prereqs
  7985. # disabled. Some of these options, disabling them adds things to the FLAGS and
  7986. # you need to check and add items in two places depending on the option.
  7987. AS_IF([test "x$ENABLED_WOLFSSH" = "xyes"],[AS_IF([test "x$ENABLED_WPAS" = "xno"],[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PUBLIC_MP"])])
  7988. if test "x$ENABLED_OPENSSLCOEXIST" = "xyes"; then
  7989. if test "x$ENABLED_OPENSSLALL" = "xyes"; then
  7990. AC_MSG_ERROR([Cannot use --enable-opensslcoexist with --enable-opensslall])
  7991. fi
  7992. if test "x$ENABLED_OPENSSLEXTRA" = "xyes"; then
  7993. AC_MSG_ERROR([Cannot use --enable-opensslcoexist with --enable-opensslextra])
  7994. fi
  7995. fi
  7996. if test "$ENABLED_WOLFSSH" = "yes" && test "$ENABLED_HMAC" = "no"
  7997. then
  7998. AC_MSG_ERROR([WOLFSSH requires HMAC.])
  7999. fi
  8000. AS_IF([test "x$ENABLED_WOLFSSH" = "xyes"],[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSL_WOLFSSH"])
  8001. # only allow secure renegotiation info with TLSV12 and ASN
  8002. if test "x$ENABLED_ASN" = "xno" || \
  8003. test "x$ENABLED_TLSV12" = "xno" || \
  8004. test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"; then
  8005. ENABLED_SECURE_RENEGOTIATION_INFO="no"
  8006. fi
  8007. if test "x$ENABLED_SECURE_RENEGOTIATION_INFO" = "xyes"; then
  8008. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SERVER_RENEGOTIATION_INFO"
  8009. fi
  8010. if test "$ENABLED_COMPKEY" = "yes"
  8011. then
  8012. AM_CFLAGS="$AM_CFLAGS -DHAVE_COMP_KEY"
  8013. fi
  8014. # Deprecated Algorithm Handling
  8015. if test "$ENABLED_ARC4" = "yes"
  8016. then
  8017. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_RC4"
  8018. fi
  8019. # Link with the math library iff needed.
  8020. if test "$ENABLED_DH" != "no" && test "$ENABLED_DH" != "const"; then
  8021. LT_LIB_M
  8022. fi
  8023. ################################################################################
  8024. # USER SETTINGS
  8025. if test "x$ENABLED_USERSETTINGS" = "xyes"
  8026. then
  8027. # Replace all options and just use WOLFSSL_USER_SETTINGS and
  8028. # WOLFSSL_USER_SETTINGS_ASM.
  8029. AM_CFLAGS="-DWOLFSSL_USER_SETTINGS -DWOLFSSL_USER_SETTINGS_ASM"
  8030. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_USER_SETTINGS -DWOLFSSL_USER_SETTINGS_ASM"
  8031. # Generate assembly-safe user_settings_asm.h (just preprocessor directives
  8032. # from user_settings.h).
  8033. $srcdir/scripts/user_settings_asm.sh "$CPPFLAGS $CFLAGS $CXXFLAGS"
  8034. if test $? -ne 0; then
  8035. AC_MSG_ERROR([$srcdir/scripts/user_settings_asm.sh failed.])
  8036. fi
  8037. fi
  8038. # OPTIMIZE FLAGS
  8039. # For distro disable custom build options that interfere with symbol generation
  8040. if test "$GCC" = "yes" && test "$ENABLED_DISTRO" = "no"
  8041. then
  8042. if test "$ENABLED_CUDA" != "yes"
  8043. then
  8044. AM_CFLAGS="$AM_CFLAGS -Wall -Wno-unused"
  8045. fi
  8046. if test "$ax_enable_debug" = "no"
  8047. then
  8048. AS_IF([test "x$ENABLED_OPTFLAGS" = "xyes"], [
  8049. if test "$ENABLED_FASTMATH" = "yes"
  8050. then
  8051. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  8052. if test "$ENABLED_FASTHUGEMATH" = "yes"
  8053. then
  8054. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  8055. fi
  8056. else
  8057. if (test "$ENABLED_SP" = "yes" || test "$ENABLED_SP_MATH_ALL" = "yes") && test "$ENABLED_SP_SMALL" = "no"
  8058. then
  8059. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  8060. if test "$ENABLED_FASTHUGEMATH" = "yes"
  8061. then
  8062. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  8063. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_INT_LARGE_COMBA"
  8064. fi
  8065. else
  8066. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_CFLAGS"
  8067. fi
  8068. fi
  8069. ])
  8070. fi
  8071. fi
  8072. # ICC command line warning for non supported warning flags
  8073. if test "$CC" = "icc"
  8074. then
  8075. AM_CFLAGS="$AM_CFLAGS -wd10006"
  8076. fi
  8077. # Expose HAVE___UINT128_T to options flags"
  8078. if test "$ac_cv_type___uint128_t" = "yes"
  8079. then
  8080. AM_CFLAGS="$AM_CFLAGS -DHAVE___UINT128_T=1"
  8081. fi
  8082. LIB_SOCKET_NSL
  8083. AX_HARDEN_CC_COMPILER_FLAGS
  8084. case $host_os in
  8085. mingw*)
  8086. # if mingw then link to ws2_32 for sockets, and crypt32
  8087. LDFLAGS="$LDFLAGS -lws2_32"
  8088. LIB_ADD="$LIB_ADD -lcrypt32"
  8089. if test "$enable_shared" = "yes"
  8090. then
  8091. AC_DEFINE([WOLFSSL_DLL], [1], [Use __declspec(dllexport) when building library])
  8092. if test "$enable_static" = "yes"
  8093. then
  8094. MINGW_LIB_WARNING="yes"
  8095. fi
  8096. fi ;;
  8097. esac
  8098. if test "$enable_shared" = "no"; then
  8099. if test "$enable_static" = "yes"; then
  8100. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TEST_STATIC_BUILD"
  8101. fi
  8102. fi
  8103. if test "x$ENABLED_LINUXKM" = "xyes"; then
  8104. AX_SIMD_CC_COMPILER_FLAGS
  8105. AC_SUBST([CFLAGS_FPU_DISABLE])
  8106. AC_SUBST([CFLAGS_FPU_ENABLE])
  8107. AC_SUBST([CFLAGS_SIMD_DISABLE])
  8108. AC_SUBST([CFLAGS_SIMD_ENABLE])
  8109. AC_SUBST([CFLAGS_AUTO_VECTORIZE_DISABLE])
  8110. AC_SUBST([CFLAGS_AUTO_VECTORIZE_ENABLE])
  8111. AC_SUBST([ASFLAGS_FPU_DISABLE_SIMD_ENABLE])
  8112. AC_SUBST([ASFLAGS_FPU_ENABLE_SIMD_DISABLE])
  8113. AC_SUBST([ASFLAGS_FPUSIMD_DISABLE])
  8114. AC_SUBST([ASFLAGS_FPUSIMD_ENABLE])
  8115. if test "$ENABLED_OPENSSLEXTRA" != "no" && test "$ENABLED_CRYPTONLY" = "no"; then
  8116. AC_MSG_ERROR([--enable-opensslextra without --enable-cryptonly is incompatible with --enable-linuxkm.])
  8117. fi
  8118. if test "$ENABLED_FILESYSTEM" = "yes"; then
  8119. AC_MSG_ERROR([--enable-filesystem is incompatible with --enable-linuxkm.])
  8120. fi
  8121. if test "$ENABLED_AFALG" = "yes"; then
  8122. AC_MSG_ERROR([--enable-afalg is incompatible with --enable-linuxkm.])
  8123. fi
  8124. if test "$ENABLED_DEVCRYPTO" = "yes"; then
  8125. AC_MSG_ERROR([--enable-devcrypto is incompatible with --enable-linuxkm.])
  8126. fi
  8127. if test "$ENABLED_PKCS11" = "yes"; then
  8128. AC_MSG_ERROR([--enable-pkcs11 is incompatible with --enable-linuxkm.])
  8129. fi
  8130. if test "$ENABLED_JNI" = "yes"; then
  8131. AC_MSG_ERROR([--enable-jni is incompatible with --enable-linuxkm.])
  8132. fi
  8133. if test "$ENABLED_16BIT" = "yes"; then
  8134. AC_MSG_ERROR([--enable-16bit is incompatible with --enable-linuxkm.])
  8135. fi
  8136. if test "$ENABLED_SINGLETHREADED" = "yes"; then
  8137. AC_MSG_ERROR([--enable-singlethreaded is incompatible with --enable-linuxkm.])
  8138. fi
  8139. if test "$ENABLED_VALGRIND" = "yes"; then
  8140. AC_MSG_ERROR([--enable-valgrind is incompatible with --enable-linuxkm.])
  8141. fi
  8142. if test "$ENABLED_FASTMATH" = "yes"; then
  8143. AC_MSG_ERROR([--enable-fastmath is incompatible with --enable-linuxkm (exceeds stack limit).])
  8144. fi
  8145. if test "$ENABLED_LIBZ_RSA" = "yes"; then
  8146. AC_MSG_ERROR([--with-libz is incompatible with --enable-linuxkm.])
  8147. fi
  8148. if test "$ENABLED_IOPOOL" = "yes"; then
  8149. AC_MSG_ERROR([--enable-iopool is incompatible with --enable-linuxkm.])
  8150. fi
  8151. if test "$ENABLED_EXAMPLES" = "yes"; then
  8152. AC_MSG_ERROR([--enable-examples is incompatible with --enable-linuxkm.])
  8153. fi
  8154. if test "$ENABLED_SMALL_STACK" != "yes"; then
  8155. AC_MSG_ERROR([--enable-smallstack is required for --enable-linuxkm.])
  8156. fi
  8157. if test "$ENABLED_SP_MATH" = "no" && test "$ENABLED_SP_MATH_ALL" = "no" && test "$ENABLED_BIGNUM" != "no"; then
  8158. AC_MSG_ERROR([--enable-sp-math or --enable-sp-math-all is required for --enable-linuxkm.])
  8159. fi
  8160. if test "$ENABLED_STACKSIZE" != "no"; then
  8161. AC_MSG_ERROR([--enable-stacksize is incompatible with --enable-linuxkm.])
  8162. fi
  8163. if test "$ENABLED_STACKLOG" = "yes"; then
  8164. AC_MSG_ERROR([--enable-stacklog is incompatible with --enable-linuxkm.])
  8165. fi
  8166. if test "$ENABLED_COMPKEY" = "yes"; then
  8167. AC_MSG_ERROR([--enable-compkey is incompatible with --enable-linuxkm.])
  8168. fi
  8169. fi
  8170. # The following AM_CONDITIONAL statements set flags for use in the Makefiles.
  8171. # Some of these affect build targets and objects, some trigger different
  8172. # test scripts for make check.
  8173. AM_CONDITIONAL([BUILD_DISTRO],[test "x$ENABLED_DISTRO" = "xyes"])
  8174. AM_CONDITIONAL([BUILD_ALL],[test "x$ENABLED_ALL" = "xyes"])
  8175. AM_CONDITIONAL([BUILD_TLS13],[test "x$ENABLED_TLS13" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8176. AM_CONDITIONAL([BUILD_RNG],[test "x$ENABLED_RNG" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8177. AM_CONDITIONAL([BUILD_SCTP],[test "x$ENABLED_SCTP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8178. AM_CONDITIONAL([BUILD_SRTP],[test "x$ENABLED_SRTP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8179. AM_CONDITIONAL([BUILD_MCAST],[test "x$ENABLED_MCAST" = "xyes"])
  8180. AM_CONDITIONAL([BUILD_IPV6],[test "x$ENABLED_IPV6" = "xyes"])
  8181. AM_CONDITIONAL([BUILD_LEANPSK],[test "x$ENABLED_LEANPSK" = "xyes"])
  8182. AM_CONDITIONAL([BUILD_LEANTLS],[test "x$ENABLED_LEANTLS" = "xyes"])
  8183. AM_CONDITIONAL([BUILD_LOWMEM],[test "x$ENABLED_LOWRESOURCE" = "xyes"])
  8184. AM_CONDITIONAL([BUILD_PKCALLBACKS], [ test "x$ENABLED_PKCALLBACKS" = "xyes"])
  8185. AM_CONDITIONAL([BUILD_CRYPTOAUTHLIB],[test "x$ENABLED_CRYPTOAUTHLIB" = "xyes"])
  8186. AM_CONDITIONAL([BUILD_SNIFFER], [ test "x$ENABLED_SNIFFER" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8187. AM_CONDITIONAL([BUILD_SNIFFTEST],[ test "x$ENABLED_SNIFFTEST" = "xyes"])
  8188. AM_CONDITIONAL([BUILD_AESGCM],[test "x$ENABLED_AESGCM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8189. AM_CONDITIONAL([BUILD_AESCCM],[test "x$ENABLED_AESCCM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8190. AM_CONDITIONAL([BUILD_AESXTS],[test "x$ENABLED_AESXTS" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8191. AM_CONDITIONAL([BUILD_ARMASM],[test "x$ENABLED_ARMASM" = "xyes"])
  8192. AM_CONDITIONAL([BUILD_ARMASM_INLINE],[test "x$ENABLED_ARMASM_INLINE" = "xyes"])
  8193. AM_CONDITIONAL([BUILD_ARMASM_CRYPTO],[test "x$ENABLED_ARMASM_CRYPTO" = "xyes"])
  8194. AM_CONDITIONAL([BUILD_ARMASM_NEON],[test "x$ENABLED_ARMASM_NEON" = "xyes"])
  8195. AM_CONDITIONAL([BUILD_RISCV_ASM],[test "x$ENABLED_RISCV_ASM" = "xyes"])
  8196. AM_CONDITIONAL([BUILD_XILINX],[test "x$ENABLED_XILINX" = "xyes"])
  8197. AM_CONDITIONAL([BUILD_AESNI],[test "x$ENABLED_AESNI" = "xyes"])
  8198. AM_CONDITIONAL([BUILD_INTELASM],[test "x$ENABLED_INTELASM" = "xyes"])
  8199. AM_CONDITIONAL([BUILD_X86_ASM],[test "x$ENABLED_X86_ASM" = "xyes"])
  8200. AM_CONDITIONAL([BUILD_AFALG],[test "x$ENABLED_AFALG" = "xyes"])
  8201. AM_CONDITIONAL([BUILD_KCAPI],[test "x$ENABLED_KCAPI" = "xyes"])
  8202. AM_CONDITIONAL([BUILD_DEVCRYPTO],[test "x$ENABLED_DEVCRYPTO" = "xyes"])
  8203. AM_CONDITIONAL([BUILD_CAMELLIA],[test "x$ENABLED_CAMELLIA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8204. AM_CONDITIONAL([BUILD_MD2],[test "x$ENABLED_MD2" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8205. AM_CONDITIONAL([BUILD_RIPEMD],[test "x$ENABLED_RIPEMD" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8206. AM_CONDITIONAL([BUILD_BLAKE2],[test "x$ENABLED_BLAKE2" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8207. AM_CONDITIONAL([BUILD_BLAKE2S],[test "x$ENABLED_BLAKE2S" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8208. AM_CONDITIONAL([BUILD_SHA512],[test "x$ENABLED_SHA512" = "xyes" || test "x$ENABLED_SHA384" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8209. AM_CONDITIONAL([BUILD_DSA],[test "x$ENABLED_DSA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8210. AM_CONDITIONAL([BUILD_ECC],[test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8211. AM_CONDITIONAL([BUILD_ED25519],[test "x$ENABLED_ED25519" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8212. AM_CONDITIONAL([BUILD_ED25519_SMALL],[test "x$ENABLED_ED25519_SMALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8213. AM_CONDITIONAL([BUILD_FEMATH], [test "x$ENABLED_FEMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8214. AM_CONDITIONAL([BUILD_GEMATH], [test "x$ENABLED_GEMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8215. AM_CONDITIONAL([BUILD_CURVE25519],[test "$ENABLED_CURVE25519" != "no" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8216. AM_CONDITIONAL([BUILD_CURVE25519_INTELASM],[test "$ENABLED_CURVE25519" != "noasm" && test "$ENABLED_INTELASM" = "yes"])
  8217. AM_CONDITIONAL([BUILD_CURVE25519_SMALL],[test "x$ENABLED_CURVE25519_SMALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8218. AM_CONDITIONAL([BUILD_ED448],[test "x$ENABLED_ED448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8219. AM_CONDITIONAL([BUILD_ED448_SMALL],[test "x$ENABLED_ED448_SMALL" = "xyes"])
  8220. AM_CONDITIONAL([BUILD_FE448], [test "x$ENABLED_FE448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8221. AM_CONDITIONAL([BUILD_GE448], [test "x$ENABLED_GE448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8222. AM_CONDITIONAL([BUILD_CURVE448],[test "x$ENABLED_CURVE448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8223. AM_CONDITIONAL([BUILD_CURVE448_SMALL],[test "x$ENABLED_CURVE448_SMALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8224. AM_CONDITIONAL([BUILD_WC_LMS],[test "x$ENABLED_WC_LMS" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8225. AM_CONDITIONAL([BUILD_WC_XMSS],[test "x$ENABLED_WC_XMSS" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8226. AM_CONDITIONAL([BUILD_WC_KYBER],[test "x$ENABLED_WC_KYBER" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8227. AM_CONDITIONAL([BUILD_ECCSI],[test "x$ENABLED_ECCSI" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8228. AM_CONDITIONAL([BUILD_SAKKE],[test "x$ENABLED_SAKKE" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8229. AM_CONDITIONAL([BUILD_MEMORY],[test "x$ENABLED_MEMORY" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8230. AM_CONDITIONAL([BUILD_RSA],[test "x$ENABLED_RSA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8231. AM_CONDITIONAL([BUILD_DH],[test "x$ENABLED_DH" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8232. AM_CONDITIONAL([BUILD_ASN],[test "x$ENABLED_ASN" != "xno" || test "x$ENABLED_RSA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8233. AM_CONDITIONAL([BUILD_AES],[test "x$ENABLED_AES" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8234. AM_CONDITIONAL([BUILD_CODING],[test "x$ENABLED_CODING" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8235. AM_CONDITIONAL([BUILD_RC4],[test "x$ENABLED_ARC4" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8236. AM_CONDITIONAL([BUILD_MD5],[test "x$ENABLED_MD5" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8237. AM_CONDITIONAL([BUILD_SHA],[test "x$ENABLED_SHA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8238. AM_CONDITIONAL([BUILD_FIPS],[test "x$ENABLED_FIPS" = "xyes"])
  8239. AC_SUBST([ENABLED_FIPS])
  8240. AM_CONDITIONAL([BUILD_FIPS_V1],[test "$HAVE_FIPS_VERSION" = 1])
  8241. AM_CONDITIONAL([BUILD_FIPS_V2],[test "$HAVE_FIPS_VERSION" = 2 && test "$HAVE_FIPS_VERSION_MINOR" = 0])
  8242. AM_CONDITIONAL([BUILD_FIPS_RAND],[test "$HAVE_FIPS_VERSION" = 2 && test "$HAVE_FIPS_VERSION_MINOR" = 1])
  8243. AM_CONDITIONAL([BUILD_FIPS_V5],[test "$HAVE_FIPS_VERSION" = 5])
  8244. AM_CONDITIONAL([BUILD_FIPS_V6],[test $HAVE_FIPS_VERSION -ge 6])
  8245. AM_CONDITIONAL([BUILD_FIPS_CURRENT],[test "$HAVE_FIPS_VERSION" -ge 2 ])
  8246. # BUILD_FIPS_CURRENT is for builds after cert 2425.
  8247. AM_CONDITIONAL([BUILD_SIPHASH],[test "x$ENABLED_SIPHASH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8248. AM_CONDITIONAL([BUILD_CMAC],[test "x$ENABLED_CMAC" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8249. AM_CONDITIONAL([BUILD_SELFTEST],[test "x$ENABLED_SELFTEST" = "xyes"])
  8250. AM_CONDITIONAL([BUILD_SHA224],[test "x$ENABLED_SHA224" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8251. AM_CONDITIONAL([BUILD_SHA3],[test "x$ENABLED_SHA3" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8252. AM_CONDITIONAL([BUILD_POLY1305],[test "x$ENABLED_POLY1305" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8253. AM_CONDITIONAL([BUILD_CHACHA],[test "x$ENABLED_CHACHA" = "xyes" || test "x$ENABLED_CHACHA" = "xnoasm" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8254. AM_CONDITIONAL([BUILD_XCHACHA],[test "x$ENABLED_XCHACHA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8255. AM_CONDITIONAL([BUILD_SM2],[test "x$ENABLED_SM2" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8256. AM_CONDITIONAL([BUILD_SM3],[test "x$ENABLED_SM3" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8257. AM_CONDITIONAL([BUILD_SM4],[test "x$ENABLED_SM4" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8258. AM_CONDITIONAL([BUILD_INLINE],[test "x$ENABLED_INLINE" = "xyes"])
  8259. AM_CONDITIONAL([BUILD_OCSP],[test "x$ENABLED_OCSP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8260. AM_CONDITIONAL([BUILD_OCSP_STAPLING],[test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"])
  8261. AM_CONDITIONAL([BUILD_OCSP_STAPLING_V2],[test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"])
  8262. AM_CONDITIONAL([BUILD_CRL],[test "x$ENABLED_CRL" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8263. AM_CONDITIONAL([BUILD_CRL_MONITOR],[test "x$ENABLED_CRL_MONITOR" = "xyes"])
  8264. AM_CONDITIONAL([BUILD_LIBLMS],[test "x$ENABLED_LIBLMS" = "xyes"])
  8265. AM_CONDITIONAL([BUILD_LIBXMSS],[test "x$ENABLED_LIBXMSS" = "xyes"])
  8266. AM_CONDITIONAL([BUILD_LIBOQS],[test "x$ENABLED_LIBOQS" = "xyes"])
  8267. AM_CONDITIONAL([BUILD_WNR],[test "x$ENABLED_WNR" = "xyes"])
  8268. AM_CONDITIONAL([BUILD_SRP],[test "x$ENABLED_SRP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8269. AM_CONDITIONAL([USE_VALGRIND],[test "x$ENABLED_VALGRIND" = "xyes"])
  8270. AM_CONDITIONAL([BUILD_MD4],[test "x$ENABLED_MD4" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8271. AM_CONDITIONAL([BUILD_PWDBASED],[test "x$ENABLED_PWDBASED" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8272. AM_CONDITIONAL([BUILD_SCRYPT],[test "x$ENABLED_SCRYPT" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8273. AM_CONDITIONAL([BUILD_CRYPTONLY],[test "x$ENABLED_CRYPTONLY" = "xyes" && test "x$ENABLED_OPENSSLEXTRA" = "xno"])
  8274. AM_CONDITIONAL([BUILD_FASTMATH],[test "x$ENABLED_FASTMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8275. AM_CONDITIONAL([BUILD_HEAPMATH],[test "x$ENABLED_HEAPMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8276. AM_CONDITIONAL([BUILD_EXAMPLE_SERVERS],[test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  8277. AM_CONDITIONAL([BUILD_EXAMPLE_CLIENTS],[test "x$ENABLED_EXAMPLES" = "xyes"])
  8278. AM_CONDITIONAL([BUILD_EXAMPLE_ASN1],[test "x$ENABLED_EXAMPLES" = "xyes"] && [test "x$ENABLED_ASN_PRINT" = "xyes"] && [test "x$ENABLED_ASN" = "xyes"])
  8279. AM_CONDITIONAL([BUILD_TESTS],[test "x$ENABLED_EXAMPLES" = "xyes"])
  8280. AM_CONDITIONAL([BUILD_THREADED_EXAMPLES],[test "x$ENABLED_SINGLETHREADED" = "xno" && test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  8281. AM_CONDITIONAL([BUILD_WOLFCRYPT_TESTS],[test "x$ENABLED_CRYPT_TESTS" = "xyes"])
  8282. AM_CONDITIONAL([BUILD_WOLFCRYPT_TESTS_LIBS],[test "x$ENABLED_CRYPT_TESTS_LIBS" = "xyes"])
  8283. AM_CONDITIONAL([BUILD_LIBZ],[test "x$ENABLED_LIBZ" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8284. AM_CONDITIONAL([BUILD_PKCS11],[test "x$ENABLED_PKCS11" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8285. AM_CONDITIONAL([BUILD_PKCS12],[test "x$ENABLED_PKCS12" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8286. AM_CONDITIONAL([BUILD_PKCS8],[test "x$ENABLED_PKCS8" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8287. AM_CONDITIONAL([BUILD_CAVIUM],[test "x$ENABLED_CAVIUM" = "xyes"])
  8288. AM_CONDITIONAL([BUILD_CAVIUM_V],[test "x$ENABLED_CAVIUM_V" = "xyes"])
  8289. AM_CONDITIONAL([BUILD_OCTEON_SYNC],[test "x$ENABLED_OCTEON_SYNC" = "xyes"])
  8290. AM_CONDITIONAL([BUILD_INTEL_QA],[test "x$ENABLED_INTEL_QA" = "xyes"])
  8291. AM_CONDITIONAL([BUILD_INTEL_QA_SYNC],[test "x$ENABLED_INTEL_QA_SYNC" = "xyes"])
  8292. INCLUDE_SP_INT="no"
  8293. AM_CONDITIONAL([BUILD_SP],[test "x$ENABLED_SP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8294. AM_CONDITIONAL([BUILD_SP_C32],[ ( ( (test "$ENABLED_SP_RSA" = "yes" || test "$ENABLED_SP_DH" = "yes" \
  8295. || test "$ENABLED_SP_ECC" = "yes") && test "x$ENABLED_SP_ASM" = "xno") \
  8296. || test "x$ENABLED_USERSETTINGS" = "xyes") && test "x$ENABLED_64BIT" != "xyes"])
  8297. AM_CONDITIONAL([BUILD_SP_C64],[ ( ( (test "$ENABLED_SP_RSA" = "yes" || test "$ENABLED_SP_DH" = "yes" \
  8298. || test "$ENABLED_SP_ECC" = "yes") && test "x$ENABLED_SP_ASM" = "xno") \
  8299. || test "x$ENABLED_USERSETTINGS" = "xyes") && test "x$ENABLED_32BIT" != "xyes"])
  8300. AM_CONDITIONAL([BUILD_SP_ARM64],[test "x$ENABLED_SP_ARM64_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8301. AM_CONDITIONAL([BUILD_SP_ARM32],[test "x$ENABLED_SP_ARM32_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8302. AM_CONDITIONAL([BUILD_SP_ARM_THUMB],[test "x$ENABLED_SP_ARM_THUMB_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8303. AM_CONDITIONAL([BUILD_SP_ARM_CORTEX],[test "x$ENABLED_SP_ARM_CORTEX_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8304. AM_CONDITIONAL([BUILD_SP_X86_64],[test "x$ENABLED_SP_X86_64_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8305. AM_CONDITIONAL([BUILD_SP_INT],[test "x$ENABLED_SP_MATH" = "xyes" || test "x$ENABLED_SP_MATH_ALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8306. AM_COND_IF([BUILD_SP], [INCLUDE_SP_INT="yes"])
  8307. AM_COND_IF([BUILD_SP_INT], [INCLUDE_SP_INT="yes"])
  8308. AC_SUBST([INCLUDE_SP_INT])
  8309. AM_CONDITIONAL([BUILD_MCAPI],[test "x$ENABLED_MCAPI" = "xyes"])
  8310. AM_CONDITIONAL([BUILD_ASYNCCRYPT],[test "x$ENABLED_ASYNCCRYPT" = "xyes"])
  8311. AM_CONDITIONAL([BUILD_WOLFEVENT],[test "x$ENABLED_ASYNCCRYPT" = "xyes"])
  8312. AM_CONDITIONAL([BUILD_CRYPTOCB],[test "x$ENABLED_CRYPTOCB" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8313. AM_CONDITIONAL([BUILD_PSK],[test "x$ENABLED_PSK" = "xyes"])
  8314. AM_CONDITIONAL([BUILD_TRUST_PEER_CERT],[test "x$ENABLED_TRUSTED_PEER_CERT" = "xyes"])
  8315. AM_CONDITIONAL([BUILD_PKI],[test "x$ENABLED_PKI" = "xyes"])
  8316. AM_CONDITIONAL([BUILD_DES3],[test "x$ENABLED_DES3" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8317. AM_CONDITIONAL([BUILD_PKCS7],[test "x$ENABLED_PKCS7" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8318. AM_CONDITIONAL([BUILD_SMIME],[test "x$ENABLED_SMIME" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8319. AM_CONDITIONAL([BUILD_HASHFLAGS],[test "x$ENABLED_HASHFLAGS" = "xyes"])
  8320. AM_CONDITIONAL([BUILD_LINUXKM],[test "$ENABLED_LINUXKM" = "yes"])
  8321. AM_CONDITIONAL([BUILD_NO_LIBRARY],[test "$ENABLED_NO_LIBRARY" = "yes"])
  8322. AM_CONDITIONAL([BUILD_BENCHMARK],[test "$ENABLED_BENCHMARK" = "yes"])
  8323. AM_CONDITIONAL([BUILD_RC2],[test "x$ENABLED_RC2" = "xyes"])
  8324. AM_CONDITIONAL([BUILD_CUDA],[test "x$ENABLED_CUDA" = "xyes"])
  8325. AM_CONDITIONAL([BUILD_CAAM],[test "x$ENABLED_CAAM" != "xno"])
  8326. AM_CONDITIONAL([BUILD_QNXCAAM],[test "x$ENABLED_CAAM_QNX" = "xyes"])
  8327. AM_CONDITIONAL([BUILD_IOTSAFE],[test "x$ENABLED_IOTSAFE" = "xyes"])
  8328. AM_CONDITIONAL([BUILD_IOTSAFE_HWRNG],[test "x$ENABLED_IOTSAFE_HWRNG" = "xyes"])
  8329. AM_CONDITIONAL([BUILD_SE050],[test "x$ENABLED_SE050" = "xyes"])
  8330. AM_CONDITIONAL([BUILD_KDF],[test "x$ENABLED_KDF" = "xyes"])
  8331. AM_CONDITIONAL([BUILD_HMAC],[test "x$ENABLED_HMAC" = "xyes"])
  8332. AM_CONDITIONAL([BUILD_ERROR_STRINGS],[test "x$ENABLED_ERROR_STRINGS" = "xyes"])
  8333. AM_CONDITIONAL([BUILD_DO178],[test "x$ENABLED_DO178" = "xyes"])
  8334. AM_CONDITIONAL([BUILD_PSA],[test "x$ENABLED_PSA" = "xyes"])
  8335. AM_CONDITIONAL([BUILD_DTLS13],[test "x$ENABLED_DTLS13" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8336. AM_CONDITIONAL([BUILD_QUIC],[test "x$ENABLED_QUIC" = "xyes"])
  8337. AM_CONDITIONAL([BUILD_DTLS_CID],[test "x$ENABLED_DTLS_CID" = "xyes"])
  8338. AM_CONDITIONAL([BUILD_HPKE],[test "x$ENABLED_HPKE" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8339. AM_CONDITIONAL([BUILD_DTLS],[test "x$ENABLED_DTLS" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  8340. AM_CONDITIONAL([BUILD_MAXQ10XX],[test "x$ENABLED_MAXQ10XX" = "xyes"])
  8341. AM_CONDITIONAL([BUILD_ARIA],[test "x$ENABLED_ARIA" = "xyes"])
  8342. AM_CONDITIONAL([BUILD_XILINX],[test "x$ENABLED_XILINX" = "xyes"])
  8343. AM_CONDITIONAL([BUILD_AUTOSAR],[test "x$ENABLED_AUTOSAR" = "xyes"])
  8344. if test "$ENABLED_REPRODUCIBLE_BUILD" != "yes" &&
  8345. (test "$ax_enable_debug" = "yes" ||
  8346. test "$ENABLED_STACKSIZE" != "no" ||
  8347. (test "$ENABLED_LEANTLS" = "no" &&
  8348. test "$ENABLED_LEANPSK" = "no" &&
  8349. test "$ENABLED_LOWRESOURCE" = "no"))
  8350. then
  8351. AM_CFLAGS="$AM_CFLAGS -DHAVE_WC_INTROSPECTION"
  8352. fi
  8353. if test "$ENABLED_REPRODUCIBLE_BUILD" != "yes"
  8354. then
  8355. AM_CFLAGS="$AM_CFLAGS -include ${output_objdir}/.build_params"
  8356. fi
  8357. AM_CPPFLAGS="$AM_CPPFLAGS $EXTRA_CPPFLAGS"
  8358. AM_CFLAGS="$AM_CFLAGS $EXTRA_CFLAGS"
  8359. AM_CCASFLAGS="$AM_CCASFLAGS $EXTRA_CCASFLAGS"
  8360. AM_LDFLAGS="$AM_LDFLAGS $EXTRA_LDFLAGS"
  8361. CREATE_HEX_VERSION
  8362. AC_SUBST([AM_CPPFLAGS])
  8363. AC_SUBST([AM_CFLAGS])
  8364. AC_SUBST([AM_LDFLAGS])
  8365. AC_SUBST([AM_CCASFLAGS])
  8366. AC_SUBST([LIB_ADD])
  8367. AC_SUBST([LIB_STATIC_ADD])
  8368. AC_SUBST([LIBM])
  8369. # FINAL
  8370. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  8371. AC_CONFIG_FILES([Makefile
  8372. wolfssl/version.h
  8373. wolfssl/options.h
  8374. support/wolfssl.pc
  8375. debian/control
  8376. debian/changelog
  8377. rpm/spec
  8378. wolfcrypt/test/test_paths.h
  8379. ])
  8380. AC_CONFIG_FILES([scripts/unit.test],[chmod +x scripts/unit.test])
  8381. AX_CREATE_GENERIC_CONFIG
  8382. AX_AM_JOBSERVER([yes])
  8383. # See Automake 9.4.1 Built Sources Example
  8384. AC_DEFUN([AX_OUT_OF_TREE_FILE],[
  8385. AC_CONFIG_COMMANDS([$1], [test ! -f $srcdir/$1 && >> $srcdir/$1])
  8386. ])
  8387. AX_OUT_OF_TREE_FILE([wolfssl/wolfcrypt/async.h])
  8388. AX_OUT_OF_TREE_FILE([wolfssl/wolfcrypt/fips.h])
  8389. AX_OUT_OF_TREE_FILE([wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h])
  8390. AX_OUT_OF_TREE_FILE([wolfssl/wolfcrypt/port/intel/quickassist.h])
  8391. AX_OUT_OF_TREE_FILE([wolfssl/wolfcrypt/port/intel/quickassist_mem.h])
  8392. AC_OUTPUT
  8393. if test "$ENABLED_MAKECLEAN" = "yes"
  8394. then
  8395. # force make clean
  8396. AC_MSG_NOTICE([---])
  8397. AC_MSG_NOTICE([Running make clean...])
  8398. if test -z "$MAKE"; then
  8399. MAKE="make"
  8400. fi
  8401. if test "$verbose" = "yes"; then
  8402. $MAKE clean
  8403. else
  8404. $MAKE clean >/dev/null
  8405. fi
  8406. fi
  8407. if test "$ENABLED_REPRODUCIBLE_BUILD" != "yes"
  8408. then
  8409. ESCAPED_ARGS=$(echo "$ac_configure_args" | sed 's/\\/\\\\/g;s/\"/\\\"/g')
  8410. ESCAPED_GLOBAL_CFLAGS=$(echo "$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS" | sed 's/\\/\\\\/g;s/\"/\\\"/g')
  8411. echo "#define LIBWOLFSSL_CONFIGURE_ARGS \"$ESCAPED_ARGS\"" > "${output_objdir}/.build_params" &&
  8412. echo "#define LIBWOLFSSL_GLOBAL_CFLAGS \"$ESCAPED_GLOBAL_CFLAGS\" LIBWOLFSSL_GLOBAL_EXTRA_CFLAGS" >> "${output_objdir}/.build_params" ||
  8413. AC_MSG_ERROR([Couldn't create ${output_objdir}/.build_params.])
  8414. else
  8415. rm -f "${output_objdir}/.build_params"
  8416. fi
  8417. # generate user options header
  8418. AC_MSG_NOTICE([---])
  8419. AC_MSG_NOTICE([Generating user options header...])
  8420. OPTION_FILE="wolfssl/options.h"
  8421. rm -f $OPTION_FILE
  8422. echo "/* wolfssl options.h" > $OPTION_FILE
  8423. echo " * generated from configure options" >> $OPTION_FILE
  8424. echo " *" >> $OPTION_FILE
  8425. echo " * Copyright (C) 2006-2024 wolfSSL Inc." >> $OPTION_FILE
  8426. echo " *" >> $OPTION_FILE
  8427. echo " * This file is part of wolfSSL. (formerly known as CyaSSL)" >> $OPTION_FILE
  8428. echo " *" >> $OPTION_FILE
  8429. echo " */" >> $OPTION_FILE
  8430. echo "" >> $OPTION_FILE
  8431. echo "#ifndef WOLFSSL_OPTIONS_H" >> $OPTION_FILE
  8432. echo "#define WOLFSSL_OPTIONS_H" >> $OPTION_FILE
  8433. echo "" >> $OPTION_FILE
  8434. echo "" >> $OPTION_FILE
  8435. echo "#ifdef __cplusplus" >> $OPTION_FILE
  8436. echo "extern \"C\" {" >> $OPTION_FILE
  8437. echo "#endif" >> $OPTION_FILE
  8438. echo "" >> $OPTION_FILE
  8439. # Check for supported command to trim option with.
  8440. # note: cut requires an argument to exit with success.
  8441. if colrm >/dev/null 2>&1 </dev/null; then
  8442. TRIM="colrm 3"
  8443. elif echo "" | cut -c1 >/dev/null 2>&1 </dev/null; then
  8444. TRIM="cut -c1-2"
  8445. else
  8446. AC_MSG_ERROR([Could not find colrm or cut to make options file])
  8447. fi
  8448. for option in $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS; do
  8449. opt_type=$(echo $option | $TRIM )
  8450. case "$opt_type" in
  8451. -D)
  8452. option=$(echo "$option" | tr -d '\\')
  8453. RHS_only=$(echo "$option" | sed 's/^-D//')
  8454. noequalsign=$(echo "$RHS_only" | tr '=' ' ')
  8455. if test "$noequalsign" = "NDEBUG" || test "$noequalsign" = "DEBUG"
  8456. then
  8457. if test "$verbose" = "yes"; then
  8458. AC_MSG_NOTICE([not outputting (N)DEBUG to $OPTION_FILE])
  8459. fi
  8460. continue
  8461. fi
  8462. # allow user to ignore system options
  8463. ignoresys=$(echo "$noequalsign" | grep '^_.*')
  8464. if test -n "$ignoresys"
  8465. then
  8466. echo "#ifndef WOLFSSL_OPTIONS_IGNORE_SYS" >> $OPTION_FILE
  8467. fi
  8468. # note need to use both autotools-style [] quoting and shell-style ''
  8469. # quoting for sed script with [] character set expression here.
  8470. noarg=$(echo "$RHS_only" | sed ['s/\(([^=)]*)\)\{0,1\}=.*//'])
  8471. echo "#undef $noarg" >> $OPTION_FILE
  8472. echo "#define $noequalsign" >> $OPTION_FILE
  8473. if test -n "$ignoresys"
  8474. then
  8475. echo "#endif" >> $OPTION_FILE
  8476. fi
  8477. echo "" >> $OPTION_FILE
  8478. ;;
  8479. -U)
  8480. RHS_only=$(echo $option | sed 's/^-U//')
  8481. echo "#undef $RHS_only" >> $OPTION_FILE
  8482. echo "" >> $OPTION_FILE
  8483. ;;
  8484. *)
  8485. if test "$verbose" = "yes"; then
  8486. AC_MSG_NOTICE([option "$option" is not a preprocessor directive -- not saving to $OPTION_FILE])
  8487. fi
  8488. ;;
  8489. esac
  8490. done
  8491. echo "" >> $OPTION_FILE
  8492. echo "#ifdef __cplusplus" >> $OPTION_FILE
  8493. echo "}" >> $OPTION_FILE
  8494. echo "#endif" >> $OPTION_FILE
  8495. echo "" >> $OPTION_FILE
  8496. echo "" >> $OPTION_FILE
  8497. echo "#endif /* WOLFSSL_OPTIONS_H */" >> $OPTION_FILE
  8498. echo "" >> $OPTION_FILE
  8499. if test "$ENABLED_DEBUG_TRACE_ERRCODES" = "yes"
  8500. then
  8501. support/gen-debug-trace-error-codes.sh || AC_MSG_ERROR([Header generation for debug-trace-errcodes failed.])
  8502. fi
  8503. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_LINUXKM" = "no"
  8504. then
  8505. SAVE_CFLAGS=$CFLAGS
  8506. CFLAGS="$CFLAGS $DEFS -I. -I$srcdir"
  8507. if test "$ENABLED_INTEL_QA" = "yes"
  8508. then
  8509. CFLAGS="$CFLAGS $QAT_FLAGS"
  8510. fi
  8511. build_pwd="$(pwd)"
  8512. cd "$srcdir"
  8513. openssl_headers=$(echo wolfssl/openssl/*.h)
  8514. cd "$build_pwd"
  8515. for header in $openssl_headers
  8516. do
  8517. AC_CHECK_HEADER([$header], [], [
  8518. AC_MSG_ERROR([Header file inconsistency detected -- error including ${header}.])
  8519. ], [
  8520. #include <${OPTION_FILE}>
  8521. extern int dummy_int_to_make_compiler_happy;
  8522. ])
  8523. done
  8524. CFLAGS=$SAVE_CFLAGS
  8525. fi
  8526. if test "$silent" != "yes"; then
  8527. # output config summary
  8528. echo "---"
  8529. echo "Configuration summary for $PACKAGE_NAME version $VERSION"
  8530. echo ""
  8531. echo " * Installation prefix: $prefix"
  8532. echo " * System type: $host_vendor-$host_os"
  8533. echo " * Host CPU: $host_cpu"
  8534. echo " * C Compiler: $CC"
  8535. echo " * C Flags: $CFLAGS"
  8536. echo " * C++ Compiler: $CXX"
  8537. echo " * C++ Flags: $CXXFLAGS"
  8538. echo " * CPP Flags: $CPPFLAGS"
  8539. echo " * CCAS Flags: $CCASFLAGS"
  8540. echo " * LD Flags: $LDFLAGS"
  8541. echo " * LIB Flags: $LIB"
  8542. echo " * Library Suffix: $LIBSUFFIX"
  8543. test "$ENABLED_LINUXKM" = "yes" && \
  8544. echo " * Linux Kernel Build Root: $KERNEL_ROOT" && \
  8545. echo " * Linux Kernel Build Arch: $KERNEL_ARCH" && \
  8546. echo " * fpu disable C flags: $CFLAGS_FPU_DISABLE" && \
  8547. echo " * fpu enable C flags: $CFLAGS_FPU_ENABLE" && \
  8548. echo " * SIMD disable C flags: $CFLAGS_SIMD_DISABLE" && \
  8549. echo " * SIMD enable C flags: $CFLAGS_SIMD_ENABLE" && \
  8550. echo " * No-auto-vectorize C flags: $CFLAGS_AUTO_VECTORIZE_DISABLE" && \
  8551. echo " * Auto-vectorize C flags: $CFLAGS_AUTO_VECTORIZE_ENABLE" && \
  8552. echo " * SIMD enable as flags: $ASFLAGS_FPU_DISABLE_SIMD_ENABLE" && \
  8553. echo " * FPU enable as flags: $ASFLAGS_FPU_ENABLE_SIMD_DISABLE" && \
  8554. echo " * SIMD+FPU disable as flags: $ASFLAGS_FPUSIMD_DISABLE" && \
  8555. echo " * SIMD+FPU enable as flags: $ASFLAGS_FPUSIMD_ENABLE" && \
  8556. echo " * Linux kernel module PIE: $ENABLED_LINUXKM_PIE"
  8557. echo " * Debug enabled: $ax_enable_debug"
  8558. echo " * Coverage enabled: $ax_enable_coverage"
  8559. echo " * Warnings as failure: $ac_cv_warnings_as_errors"
  8560. echo " * make -j: $enable_jobserver"
  8561. echo " * VCS checkout: $ac_cv_vcs_checkout"
  8562. echo
  8563. echo " Features "
  8564. if test "$ENABLED_EXPERIMENTAL" = "yes"
  8565. then
  8566. echo " * Experimental settings: Allowed"
  8567. else
  8568. echo " * Experimental settings: Forbidden"
  8569. fi
  8570. if test "$ENABLED_FIPS" = "yes"; then
  8571. echo " * FIPS: $FIPS_VERSION"
  8572. else
  8573. echo " * FIPS: $ENABLED_FIPS"
  8574. fi
  8575. echo " * Single threaded: $ENABLED_SINGLETHREADED"
  8576. echo " * Filesystem: $ENABLED_FILESYSTEM"
  8577. echo " * OpenSSH Build: $ENABLED_OPENSSH"
  8578. echo " * OpenSSL Extra API: $ENABLED_OPENSSLEXTRA"
  8579. echo " * OpenSSL Coexist: $ENABLED_OPENSSLCOEXIST"
  8580. echo " * Old Names: $ENABLED_OLDNAMES"
  8581. echo " * Max Strength Build: $ENABLED_MAXSTRENGTH"
  8582. echo " * Distro Build: $ENABLED_DISTRO"
  8583. echo " * Reproducible Build: $ENABLED_REPRODUCIBLE_BUILD"
  8584. echo " * Side-channel Hardening: $ENABLED_HARDEN"
  8585. echo " * Single Precision Math: $ENABLED_SP"
  8586. if test "$ENABLED_SP_MATH_ALL" != "no"
  8587. then
  8588. ENABLED_SP_MATH_DESC="all"
  8589. else
  8590. if test "$ENABLED_SP_MATH" != "no"
  8591. then
  8592. ENABLED_SP_MATH_DESC="restricted"
  8593. else
  8594. ENABLED_SP_MATH_DESC="no"
  8595. fi
  8596. fi
  8597. echo " * SP implementation: $ENABLED_SP_MATH_DESC"
  8598. echo " * Fast Math: $ENABLED_FASTMATH"
  8599. echo " * Heap Math: $ENABLED_HEAPMATH"
  8600. echo " * Assembly Allowed: $ENABLED_ASM"
  8601. echo " * sniffer: $ENABLED_SNIFFER"
  8602. echo " * snifftest: $ENABLED_SNIFFTEST"
  8603. echo " * ARC4: $ENABLED_ARC4"
  8604. echo " * AES: $ENABLED_AES"
  8605. echo " * AES-NI: $ENABLED_AESNI"
  8606. echo " * AES-CBC: $ENABLED_AESCBC"
  8607. echo " * AES-CBC length checks: $ENABLED_AESCBC_LENGTH_CHECKS"
  8608. echo " * AES-GCM: $ENABLED_AESGCM"
  8609. echo " * AES-GCM streaming: $ENABLED_AESGCM_STREAM"
  8610. echo " * AES-CCM: $ENABLED_AESCCM"
  8611. echo " * AES-CTR: $ENABLED_AESCTR"
  8612. echo " * AES-CFB: $ENABLED_AESCFB"
  8613. echo " * AES-OFB: $ENABLED_AESOFB"
  8614. echo " * AES-XTS: $ENABLED_AESXTS"
  8615. echo " * AES-XTS streaming: $ENABLED_AESXTS_STREAM"
  8616. echo " * AES-SIV: $ENABLED_AESSIV"
  8617. echo " * AES-EAX: $ENABLED_AESEAX"
  8618. echo " * AES Bitspliced: $ENABLED_AESBS"
  8619. echo " * AES Key Wrap: $ENABLED_AESKEYWRAP"
  8620. echo " * ARIA: $ENABLED_ARIA"
  8621. echo " * DES3: $ENABLED_DES3"
  8622. echo " * DES3 TLS Suites: $ENABLED_DES3_TLS_SUITES"
  8623. echo " * Camellia: $ENABLED_CAMELLIA"
  8624. echo " * CUDA: $ENABLED_CUDA"
  8625. echo " * SM4-ECB: $ENABLED_SM4_ECB"
  8626. echo " * SM4-CBC: $ENABLED_SM4_CBC"
  8627. echo " * SM4-CTR: $ENABLED_SM4_CTR"
  8628. echo " * SM4-GCM: $ENABLED_SM4_GCM"
  8629. echo " * SM4-CCM: $ENABLED_SM4_CCM"
  8630. echo " * NULL Cipher: $ENABLED_NULL_CIPHER"
  8631. echo " * MD2: $ENABLED_MD2"
  8632. echo " * MD4: $ENABLED_MD4"
  8633. echo " * MD5: $ENABLED_MD5"
  8634. echo " * RIPEMD: $ENABLED_RIPEMD"
  8635. echo " * SHA: $ENABLED_SHA"
  8636. echo " * SHA-224: $ENABLED_SHA224"
  8637. echo " * SHA-384: $ENABLED_SHA384"
  8638. echo " * SHA-512: $ENABLED_SHA512"
  8639. echo " * SHA3: $ENABLED_SHA3"
  8640. echo " * SHAKE128: $ENABLED_SHAKE128"
  8641. echo " * SHAKE256: $ENABLED_SHAKE256"
  8642. echo " * SM3: $ENABLED_SM3"
  8643. echo " * BLAKE2: $ENABLED_BLAKE2"
  8644. echo " * BLAKE2S: $ENABLED_BLAKE2S"
  8645. echo " * SipHash: $ENABLED_SIPHASH"
  8646. echo " * CMAC: $ENABLED_CMAC"
  8647. echo " * keygen: $ENABLED_KEYGEN"
  8648. echo " * certgen: $ENABLED_CERTGEN"
  8649. echo " * certreq: $ENABLED_CERTREQ"
  8650. echo " * certext: $ENABLED_CERTEXT"
  8651. echo " * certgencache: $ENABLED_certgencache"
  8652. echo " * CHACHA: $ENABLED_CHACHA"
  8653. echo " * XCHACHA: $ENABLED_XCHACHA"
  8654. echo " * Hash DRBG: $ENABLED_HASHDRBG"
  8655. echo " * MmemUse Entropy:"
  8656. echo " * (AKA: wolfEntropy): $ENABLED_ENTROPY_MEMUSE"
  8657. echo " * PWDBASED: $ENABLED_PWDBASED"
  8658. echo " * Encrypted keys: $ENABLED_ENCKEYS"
  8659. echo " * scrypt: $ENABLED_SCRYPT"
  8660. echo " * wolfCrypt Only: $ENABLED_CRYPTONLY"
  8661. echo " * HKDF: $ENABLED_HKDF"
  8662. echo " * HPKE: $ENABLED_HPKE"
  8663. echo " * X9.63 KDF: $ENABLED_X963KDF"
  8664. echo " * SRTP-KDF: $ENABLED_SRTP_KDF"
  8665. echo " * PSK: $ENABLED_PSK"
  8666. echo " * Poly1305: $ENABLED_POLY1305"
  8667. echo " * LEANPSK: $ENABLED_LEANPSK"
  8668. echo " * LEANTLS: $ENABLED_LEANTLS"
  8669. echo " * RSA: $ENABLED_RSA"
  8670. echo " * RSA-PSS: $ENABLED_RSAPSS"
  8671. echo " * DSA: $ENABLED_DSA"
  8672. echo " * DH: $ENABLED_DH"
  8673. echo " * DH Default Parameters: $ENABLED_DHDEFAULTPARAMS"
  8674. echo " * ECC: $ENABLED_ECC"
  8675. echo " * ECC Custom Curves: $ENABLED_ECCCUSTCURVES"
  8676. echo " * ECC Minimum Bits: $ENABLED_ECCMINSZ"
  8677. echo " * FPECC: $ENABLED_FPECC"
  8678. echo " * ECC_ENCRYPT: $ENABLED_ECC_ENCRYPT"
  8679. echo " * Brainpool: $ENABLED_BRAINPOOL"
  8680. echo " * SM2: $ENABLED_SM2"
  8681. echo " * CURVE25519: $ENABLED_CURVE25519"
  8682. echo " * ED25519: $ENABLED_ED25519"
  8683. echo " * ED25519 streaming: $ENABLED_ED25519_STREAM"
  8684. echo " * CURVE448: $ENABLED_CURVE448"
  8685. echo " * ED448: $ENABLED_ED448"
  8686. echo " * ED448 streaming: $ENABLED_ED448_STREAM"
  8687. echo " * LMS: $ENABLED_LMS"
  8688. echo " * LMS wolfSSL impl: $ENABLED_WC_LMS"
  8689. echo " * XMSS: $ENABLED_XMSS"
  8690. echo " * XMSS wolfSSL impl: $ENABLED_WC_XMSS"
  8691. if test "$ENABLED_LIBXMSS" = "yes"; then
  8692. echo " * XMSS_ROOT: $XMSS_ROOT"
  8693. fi
  8694. echo " * KYBER: $ENABLED_KYBER"
  8695. echo " * KYBER wolfSSL impl: $ENABLED_WC_KYBER"
  8696. echo " * ECCSI $ENABLED_ECCSI"
  8697. echo " * SAKKE $ENABLED_SAKKE"
  8698. echo " * ASN: $ENABLED_ASN"
  8699. echo " * Anonymous cipher: $ENABLED_ANON"
  8700. echo " * CODING: $ENABLED_CODING"
  8701. echo " * MEMORY: $ENABLED_MEMORY"
  8702. echo " * I/O POOL: $ENABLED_IOPOOL"
  8703. echo " * wolfSentry: $ENABLED_WOLFSENTRY"
  8704. echo " * LIGHTY: $ENABLED_LIGHTY"
  8705. echo " * WPA Supplicant: $ENABLED_WPAS"
  8706. echo " * HAPROXY: $ENABLED_HAPROXY"
  8707. echo " * STUNNEL: $ENABLED_STUNNEL"
  8708. echo " * tcpdump: $ENABLED_TCPDUMP"
  8709. echo " * libssh2: $ENABLED_LIBSSH2"
  8710. echo " * ntp: $ENABLED_NTP"
  8711. echo " * rsyslog: $ENABLED_RSYSLOG"
  8712. echo " * Apache httpd: $ENABLED_APACHE_HTTPD"
  8713. echo " * NGINX: $ENABLED_NGINX"
  8714. echo " * OpenResty: $ENABLED_OPENRESTY"
  8715. echo " * ASIO: $ENABLED_ASIO"
  8716. echo " * LIBWEBSOCKETS: $ENABLED_LIBWEBSOCKETS"
  8717. echo " * Qt: $ENABLED_QT"
  8718. echo " * Qt Unit Testing: $ENABLED_QT_TEST"
  8719. echo " * SIGNAL: $ENABLED_SIGNAL"
  8720. echo " * chrony: $ENABLED_CHRONY"
  8721. echo " * strongSwan: $ENABLED_STRONGSWAN"
  8722. echo " * OpenLDAP: $ENABLED_OPENLDAP"
  8723. echo " * hitch: $ENABLED_HITCH"
  8724. echo " * memcached: $ENABLED_MEMCACHED"
  8725. echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
  8726. echo " * DTLS: $ENABLED_DTLS"
  8727. echo " * DTLS v1.3: $ENABLED_DTLS13"
  8728. echo " * SCTP: $ENABLED_SCTP"
  8729. echo " * SRTP: $ENABLED_SRTP"
  8730. echo " * Indefinite Length: $ENABLED_BER_INDEF"
  8731. echo " * Multicast: $ENABLED_MCAST"
  8732. echo " * SSL v3.0 (Old): $ENABLED_SSLV3"
  8733. echo " * TLS v1.0 (Old): $ENABLED_TLSV10"
  8734. echo " * TLS v1.1 (Old): $ENABLED_OLD_TLS"
  8735. echo " * TLS v1.2: $ENABLED_TLSV12"
  8736. echo " * TLS v1.3: $ENABLED_TLS13"
  8737. echo " * RPK: $ENABLED_RPK"
  8738. echo " * Post-handshake Auth: $ENABLED_TLS13_POST_AUTH"
  8739. echo " * Early Data: $ENABLED_TLS13_EARLY_DATA"
  8740. echo " * QUIC: $ENABLED_QUIC"
  8741. echo " * Send State in HRR Cookie: $ENABLED_SEND_HRR_COOKIE"
  8742. echo " * OCSP: $ENABLED_OCSP"
  8743. echo " * OCSP Stapling: $ENABLED_CERTIFICATE_STATUS_REQUEST"
  8744. echo " * OCSP Stapling v2: $ENABLED_CERTIFICATE_STATUS_REQUEST_V2"
  8745. echo " * CRL: $ENABLED_CRL"
  8746. echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
  8747. echo " * Persistent session cache: $ENABLED_SAVESESSION"
  8748. echo " * Persistent cert cache: $ENABLED_SAVECERT"
  8749. echo " * Atomic User Record Layer: $ENABLED_ATOMICUSER"
  8750. echo " * Public Key Callbacks: $ENABLED_PKCALLBACKS"
  8751. echo " * libxmss: $ENABLED_LIBXMSS"
  8752. echo " * liblms: $ENABLED_LIBLMS"
  8753. echo " * liboqs: $ENABLED_LIBOQS"
  8754. echo " * Whitewood netRandom: $ENABLED_WNR"
  8755. echo " * Server Name Indication: $ENABLED_SNI"
  8756. echo " * ALPN: $ENABLED_ALPN"
  8757. echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
  8758. echo " * Trusted CA Indication: $ENABLED_TRUSTED_CA"
  8759. echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
  8760. echo " * Supported Elliptic Curves: $ENABLED_SUPPORTED_CURVES"
  8761. echo " * FFDHE only in client: $ENABLED_FFDHE_ONLY"
  8762. echo " * Session Ticket: $ENABLED_SESSION_TICKET"
  8763. echo " * Extended Master Secret: $ENABLED_EXTENDED_MASTER"
  8764. echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
  8765. echo " * Secure Renegotiation: $ENABLED_SECURE_RENEGOTIATION"
  8766. echo " * Fallback SCSV: $ENABLED_FALLBACK_SCSV"
  8767. echo " * Keying Material Exporter: $ENABLED_KEYING_MATERIAL"
  8768. echo " * All TLS Extensions: $ENABLED_TLSX"
  8769. echo " * S/MIME: $ENABLED_SMIME"
  8770. echo " * PKCS#7: $ENABLED_PKCS7"
  8771. echo " * PKCS#8: $ENABLED_PKCS8"
  8772. echo " * PKCS#11: $ENABLED_PKCS11"
  8773. echo " * PKCS#12: $ENABLED_PKCS12"
  8774. echo " * wolfSSH: $ENABLED_WOLFSSH"
  8775. echo " * wolfEngine: $ENABLED_WOLFENGINE"
  8776. echo " * wolfTPM: $ENABLED_WOLFTPM"
  8777. echo " * wolfCLU: $ENABLED_WOLFCLU"
  8778. echo " * wolfSCEP: $ENABLED_WOLFSCEP"
  8779. echo " * Secure Remote Password: $ENABLED_SRP"
  8780. echo " * Small Stack: $ENABLED_SMALL_STACK"
  8781. echo " * Linux Kernel Module: $ENABLED_LINUXKM"
  8782. test "$ENABLED_LINUXKM" = "yes" && \
  8783. echo " * Linux kernel module bench: $ENABLED_LINUXKM_BENCHMARKS" && \
  8784. echo " * Linux kernel alg register: $ENABLED_LINUXKM_LKCAPI_REGISTER"
  8785. echo " * valgrind unit tests: $ENABLED_VALGRIND"
  8786. echo " * LIBZ: $ENABLED_LIBZ"
  8787. echo " * Examples: $ENABLED_EXAMPLES"
  8788. echo " * Crypt tests: $ENABLED_CRYPT_TESTS"
  8789. echo " * Stack sizes in tests: $ENABLED_STACKSIZE"
  8790. echo " * Heap stats in tests: $ENABLED_TRACKMEMORY"
  8791. echo " * Asynchronous Crypto: $ENABLED_ASYNCCRYPT"
  8792. echo " * Asynchronous Crypto (sim): $ENABLED_ASYNCCRYPT_SW"
  8793. echo " * Cavium Nitrox: $ENABLED_CAVIUM"
  8794. echo " * Cavium Octeon (Sync): $ENABLED_OCTEON_SYNC"
  8795. echo " * Intel Quick Assist: $ENABLED_INTEL_QA"
  8796. if test "$ENABLED_ARMASM_INLINE" = "yes"
  8797. then
  8798. ENABLED_ARMASM="inline C"
  8799. fi
  8800. echo " * ARM ASM: $ENABLED_ARMASM"
  8801. echo " * ARM ASM SHA512/SHA3 Crypto $ENABLED_ARMASM_SHA3"
  8802. echo " * ARM ASM SM3/SM4 Crypto $ENABLED_ARMASM_CRYPTO_SM4"
  8803. echo " * RISC-V ASM $ENABLED_RISCV_ASM"
  8804. echo " * Write duplicate: $ENABLED_WRITEDUP"
  8805. echo " * Xilinx Hardware Acc.: $ENABLED_XILINX"
  8806. echo " * Inline Code: $ENABLED_INLINE"
  8807. echo " * Linux AF_ALG: $ENABLED_AFALG"
  8808. echo " * Linux KCAPI: $ENABLED_KCAPI"
  8809. echo " * Linux devcrypto: $ENABLED_DEVCRYPTO"
  8810. echo " * PK callbacks: $ENABLED_PKCALLBACKS"
  8811. echo " * Crypto callbacks: $ENABLED_CRYPTOCB"
  8812. echo " * i.MX CAAM: $ENABLED_CAAM"
  8813. echo " * IoT-Safe: $ENABLED_IOTSAFE"
  8814. echo " * IoT-Safe HWRNG: $ENABLED_IOTSAFE_HWRNG"
  8815. echo " * NXP SE050: $ENABLED_SE050"
  8816. echo " * Maxim Integrated MAXQ10XX: $ENABLED_MAXQ10XX"
  8817. echo " * PSA: $ENABLED_PSA"
  8818. echo " * System CA certs: $ENABLED_SYS_CA_CERTS"
  8819. echo " * Dual alg cert support: $ENABLED_DUAL_ALG_CERTS"
  8820. echo " * ERR Queues per Thread: $ENABLED_ERRORQUEUEPERTHREAD"
  8821. echo " * rwlock: $ENABLED_RWLOCK"
  8822. echo " * keylog export: $ENABLED_KEYLOG_EXPORT"
  8823. echo " * AutoSAR : $ENABLED_AUTOSAR"
  8824. echo ""
  8825. echo "---"
  8826. echo "./configure flags: $(./config.status --config)"
  8827. fi # $silent != yes
  8828. ################################################################################
  8829. # Show warnings at bottom so they are noticed
  8830. ################################################################################
  8831. if test "$ENABLED_ASYNCCRYPT" = "yes" && ! test -s $srcdir/wolfcrypt/src/async.c
  8832. then
  8833. AC_MSG_WARN([Make sure real async files are loaded. Contact wolfSSL for details on using the asynccrypt option.])
  8834. fi
  8835. # MinGW static vs shared library
  8836. # Reference URL from libtool for MinGW is located at
  8837. # http://www.gnu.org/software/libtool/manual/libtool.html#Cygwin-to-MinGW-Cross
  8838. # this allows for not even having dllimport/dllexport on functions
  8839. # with recent libtools, only requiring it with global variables.
  8840. #
  8841. # The following warning is displayed here because if not using "contemporary GNU
  8842. # tools" there is the possibility of export/import issues.
  8843. # wolfSSL uses __declspec(dllexport) and "contemporary GNU tools" handle the
  8844. # case where both static and shared libraries are built.
  8845. #
  8846. # More can be found about the MinGW linker at
  8847. # https://sourceware.org/binutils/docs/ld/WIN32.html
  8848. if test "$MINGW_LIB_WARNING" = "yes"
  8849. then
  8850. 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.])
  8851. fi
  8852. if test -n "$WITH_MAX_ECC_BITS"; then
  8853. if test "$WITH_MAX_ECC_BITS" -lt "$ENABLED_ECCMINSZ"; then
  8854. AC_MSG_ERROR([--with-max-ecc-bits argument ($WITH_MAX_ECC_BITS) must be greater than --with-eccminsz argument ($ENABLED_ECCMINSZ)])
  8855. fi
  8856. fi