configure.ac 301 KB

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