configure.ac 302 KB

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