configure.ac 335 KB

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