configure.ac 288 KB

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