configure.ac 202 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499
  1. # configure.ac
  2. #
  3. # Copyright (C) 2006-2020 wolfSSL Inc.
  4. #
  5. # This file is part of wolfSSL. (formerly known as CyaSSL)
  6. #
  7. #
  8. AC_COPYRIGHT([Copyright (C) 2006-2020 wolfSSL Inc.])
  9. AC_PREREQ([2.63])
  10. AC_INIT([wolfssl],[4.6.0],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[https://www.wolfssl.com])
  11. AC_CONFIG_AUX_DIR([build-aux])
  12. # The following sets CFLAGS to empty if unset on command line. We do not
  13. # want the default "-g -O2" that AC_PROG_CC sets automatically.
  14. : ${CFLAGS=""}
  15. # Test ar for the "U" option. Should be checked before the libtool macros.
  16. xxx_ar_flags=$(ar --help 2>&1)
  17. AS_CASE([$xxx_ar_flags],[*'use actual timestamps and uids/gids'*],[: ${AR_FLAGS="Ucru"}])
  18. AC_PROG_CC
  19. AM_PROG_CC_C_O
  20. AC_CANONICAL_HOST
  21. AC_CONFIG_MACRO_DIR([m4])
  22. AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests])
  23. m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
  24. AC_ARG_PROGRAM
  25. AC_CONFIG_HEADERS([config.h:config.in])
  26. LT_PREREQ([2.2])
  27. LT_INIT([disable-static win32-dll])
  28. #shared library versioning
  29. WOLFSSL_LIBRARY_VERSION=27:0:3
  30. # | | |
  31. # +------+ | +---+
  32. # | | |
  33. # current:revision:age
  34. # | | |
  35. # | | +- increment if interfaces have been added
  36. # | | set to zero if interfaces have been removed
  37. # | | or changed
  38. # | +- increment if source code has changed
  39. # | set to zero if current is incremented
  40. # +- increment if interfaces have been added, removed or changed
  41. AC_SUBST([WOLFSSL_LIBRARY_VERSION])
  42. # Capture user C_EXTRA_FLAGS from configure line.
  43. # Use of C_EXTRA_FLAGS is deprecated because CFLAGS was fixed but someone
  44. # might still be using it.
  45. CFLAGS="$CFLAGS $C_EXTRA_FLAGS $C_FLAGS"
  46. gl_VISIBILITY
  47. AS_IF([ test -n "$CFLAG_VISIBILITY" ], [
  48. AM_CFLAGS="$AM_CPPFLAGS $CFLAG_VISIBILITY"
  49. ])
  50. # Moved these size of and type checks before the library checks.
  51. # The library checks add the library to subsequent test compiles
  52. # and in some rare cases, the networking check causes these sizeof
  53. # checks to fail.
  54. AC_CHECK_SIZEOF([long long])
  55. AC_CHECK_SIZEOF([long])
  56. AC_CHECK_SIZEOF([time_t])
  57. AC_CHECK_TYPES([__uint128_t])
  58. 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])
  59. AC_CHECK_LIB([network],[socket])
  60. AC_C_BIGENDIAN
  61. # check if functions of interest are linkable, but also check if
  62. # they're declared by the expected headers, and if not, supersede the
  63. # unusable positive from AC_CHECK_FUNCS().
  64. AC_CHECK_FUNCS([gethostbyname getaddrinfo gettimeofday gmtime_r inet_ntoa memset socket strftime])
  65. AC_CHECK_DECLS([gethostbyname, getaddrinfo, gettimeofday, gmtime_r, inet_ntoa, memset, socket, strftime], [], [
  66. if test "$(eval echo \$"$(eval 'echo ac_cv_func_${as_decl_name}')")" = "yes"
  67. then
  68. echo " note: earlier check for $(eval 'echo ${as_decl_name}') superseded."
  69. eval "$(eval 'echo ac_cv_func_${as_decl_name}=no')"
  70. _mask_varname=HAVE_`eval "echo '${as_decl_name}'" | tr 'a-z' 'A-Z'`
  71. echo "g/#define $_mask_varname 1/s//\/* #undef $_mask_varname *\//
  72. wq
  73. ." | ed -s confdefs.h
  74. fi
  75. ], [[
  76. #ifdef HAVE_SYS_SOCKET_H
  77. #include <sys/socket.h>
  78. #endif
  79. #ifdef HAVE_STRING_H
  80. #include <string.h>
  81. #endif
  82. #ifdef HAVE_NETDB_H
  83. #include <netdb.h>
  84. #endif
  85. #ifdef HAVE_ARPA_INET_H
  86. #include <arpa/inet.h>
  87. #endif
  88. #ifdef HAVE_SYS_TIME_H
  89. #include <sys/time.h>
  90. #endif
  91. #ifdef HAVE_TIME_H
  92. #include <time.h>
  93. #endif
  94. ]])
  95. AC_PROG_INSTALL
  96. AC_TYPE_SIZE_T
  97. AC_TYPE_UINT8_T
  98. AM_PROG_AS
  99. LT_LIB_M
  100. OPTIMIZE_CFLAGS="-Os"
  101. OPTIMIZE_FAST_CFLAGS="-O2"
  102. OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET"
  103. DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_WOLFSSL"
  104. LIB_ADD=
  105. LIB_STATIC_ADD=
  106. # Thread local storage
  107. AX_TLS([thread_ls_on=yes],[thread_ls_on=no])
  108. AS_IF([test "x$thread_ls_on" = "xyes"],[AM_CFLAGS="$AM_CFLAGS -DHAVE_THREAD_LS"])
  109. # DEBUG
  110. AX_DEBUG
  111. AS_IF([test "$ax_enable_debug" = "yes"],
  112. [AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"],
  113. [AM_CFLAGS="$AM_CFLAGS -DNDEBUG"])
  114. # Start without certificates enabled and enable if a certificate algorithm is
  115. # enabled
  116. ENABLED_CERTS="no"
  117. # FIPS
  118. AC_ARG_ENABLE([fips],
  119. [AS_HELP_STRING([--enable-fips],[Enable FIPS 140-2, Will NOT work w/o FIPS license (default: disabled)])],
  120. [ENABLED_FIPS=$enableval],
  121. [ENABLED_FIPS="no"])
  122. AS_CASE([$ENABLED_FIPS],
  123. ["ready"],[
  124. ENABLED_FIPS="yes"
  125. FIPS_VERSION="v2"
  126. FIPS_READY="yes"
  127. ],
  128. ["v2"],[
  129. # FIPS v2
  130. ENABLED_FIPS="yes"
  131. FIPS_VERSION="v2"
  132. ],
  133. ["rand"],[
  134. # FIPS Rand
  135. ENABLED_FIPS="yes"
  136. FIPS_VERSION="rand"
  137. ],
  138. ["no"],[FIPS_VERSION="none"],
  139. [
  140. # FIPS v1
  141. ENABLED_FIPS="yes"
  142. FIPS_VERSION="v1"
  143. ])
  144. case "$FIPS_VERSION" in
  145. none) if test -s wolfcrypt/src/fips.c || test -s ctaocrypt/src/fips.c; then
  146. AC_MSG_ERROR([FIPS source tree is incompatible with non-FIPS build (requires --enable-fips)])
  147. fi
  148. ;;
  149. v1) if ! test -s ctaocrypt/src/fips.c; then
  150. AC_MSG_ERROR([non-FIPS-v1 source tree is incompatible with --enable-fips=$enableval])
  151. fi
  152. ;;
  153. *) if ! test -s wolfcrypt/src/fips.c; then
  154. AC_MSG_ERROR([non-FIPS source tree is incompatible with --enable-fips=$enableval])
  155. fi
  156. ;;
  157. esac
  158. # Distro build feature subset (Debian, Ubuntu, etc.)
  159. AC_ARG_ENABLE([distro],
  160. [AS_HELP_STRING([--enable-distro],[Enable wolfSSL distro build (default: disabled)])],
  161. [ ENABLED_DISTRO=$enableval ],
  162. [ ENABLED_DISTRO=no ]
  163. )
  164. if test "$ENABLED_DISTRO" = "yes"
  165. then
  166. enable_shared=yes
  167. enable_static=yes
  168. enable_all=yes
  169. fi
  170. # Linux Kernel Module
  171. AC_ARG_ENABLE([linuxkm],
  172. [AS_HELP_STRING([--enable-linuxkm],[Enable Linux Kernel Module (default: disabled)])],
  173. [ENABLED_LINUXKM=$enableval],
  174. [ENABLED_LINUXKM=no]
  175. )
  176. AC_ARG_ENABLE([linuxkm-defaults],
  177. [AS_HELP_STRING([--enable-linuxkm-defaults],[Enable feature defaults for Linux Kernel Module (default: disabled)])],
  178. [ENABLED_LINUXKM_DEFAULTS=$enableval],
  179. [ENABLED_LINUXKM_DEFAULTS=$ENABLED_LINUXKM]
  180. )
  181. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  182. then
  183. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_CONST -DWOLFSSL_SP_MOD_WORD_RP -DWOLFSSL_OLD_PRIME_CHECK -DWOLFSSL_SP_DIV_64 -DWOLFSSL_SP_DIV_WORD_HALF -DWOLFSSL_SMALL_STACK_STATIC -DWOLFSSL_TEST_SUBROUTINE=static"
  184. fi
  185. AC_ARG_WITH([linux-source],
  186. [AS_HELP_STRING([--with-linux-source=PATH],[PATH to root of Linux kernel build tree])],
  187. [KERNEL_ROOT=$withval],
  188. [KERNEL_ROOT=""])
  189. AC_ARG_WITH([linux-arch],
  190. [AS_HELP_STRING([--with-linux-arch=arch],[built arch (SRCARCH) of Linux kernel build tree])],
  191. [KERNEL_ARCH=$withval],
  192. [KERNEL_ARCH=""])
  193. if test "x$ENABLED_LINUXKM" = "xyes"
  194. then
  195. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LINUXKM"
  196. ENABLED_NO_LIBRARY=yes
  197. if test "$KERNEL_ROOT" = ""; then
  198. AC_PATH_DEFAULT_KERNEL_SOURCE
  199. KERNEL_ROOT="$DEFAULT_KERNEL_ROOT"
  200. fi
  201. AC_SUBST([KERNEL_ROOT])
  202. if test "$KERNEL_ARCH" = ""; then
  203. AC_DEFAULT_KERNEL_ARCH
  204. KERNEL_ARCH="$DEFAULT_KERNEL_ARCH"
  205. fi
  206. AC_SUBST([KERNEL_ARCH])
  207. if test "${KERNEL_ROOT}" = ""; then
  208. AC_MSG_ERROR([Linux kernel source root not found -- supply with --with-linux-source=PATH.])
  209. fi
  210. if test "${KERNEL_ARCH}" = ""; then
  211. AC_MSG_ERROR([Linux kernel target architecture for build tree ${KERNEL_ROOT} could not be determined. Is target kernel configured?])
  212. fi
  213. AM_CFLAGS="$AM_CFLAGS -DNO_DEV_RANDOM -DNO_WRITEV -DNO_STDIO_FILESYSTEM -DWOLFSSL_NO_SOCK -DWOLFSSL_USER_IO"
  214. fi
  215. # Single Precision maths implementation
  216. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  217. then
  218. ENABLED_SP_DEFAULT=yes
  219. ENABLED_SP_MATH_ALL_DEFAULT=yes
  220. else
  221. ENABLED_SP_DEFAULT=no
  222. ENABLED_SP_MATH_ALL_DEFAULT=no
  223. fi
  224. AC_ARG_ENABLE([sp],
  225. [AS_HELP_STRING([--enable-sp],[Enable Single Precision maths implementation (default: disabled)])],
  226. [ ENABLED_SP=$enableval ],
  227. [ ENABLED_SP=$ENABLED_SP_DEFAULT ],
  228. )
  229. AC_ARG_ENABLE([sp-math-all],
  230. [AS_HELP_STRING([--enable-sp-math-all],[Enable Single Precision math implementation for full algorithm suite (default: disabled)])],
  231. [ ENABLED_SP_MATH_ALL=$enableval ],
  232. [ ENABLED_SP_MATH_ALL=$ENABLED_SP_MATH_ALL_DEFAULT ],
  233. )
  234. # Single Precision maths exclusively (no fastmath)
  235. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes" && test "$ENABLED_SP" != "no" && test "$ENABLED_SP_MATH_ALL" = "no"
  236. then
  237. ENABLED_SP_MATH_DEFAULT=yes
  238. else
  239. ENABLED_SP_MATH_DEFAULT=no
  240. fi
  241. AC_ARG_ENABLE([sp-math],
  242. [AS_HELP_STRING([--enable-sp-math],[Enable Single Precision math implementation with restricted algorithm suite (default: disabled)])],
  243. [ ENABLED_SP_MATH=$enableval ],
  244. [ ENABLED_SP_MATH=$ENABLED_SP_MATH_DEFAULT ],
  245. )
  246. if test "$ENABLED_SP_MATH" != "no" && test "$ENABLED_SP_MATH_ALL" != "no"
  247. then
  248. AC_MSG_ERROR([cannot enable sp-math and sp-math-all simultaneously.])
  249. fi
  250. # ALL FEATURES
  251. AC_ARG_ENABLE([all],
  252. [AS_HELP_STRING([--enable-all],[Enable all wolfSSL features, except SSLv3 (default: disabled)])],
  253. [ ENABLED_ALL=$enableval ],
  254. [ ENABLED_ALL=no ]
  255. )
  256. if test "$ENABLED_ALL" = "yes"
  257. then
  258. test "$enable_dtls" = "" && enable_dtls=yes
  259. if test "x$FIPS_VERSION" != "xv1"
  260. then
  261. test "$enable_tls13" = "" && enable_tls13=yes
  262. test "$enable_rsapss" = "" && enable_rsapss=yes
  263. fi
  264. test "$enable_savesession" = "" && enable_savesession=yes
  265. test "$enable_savecert" = "" && enable_savecert=yes
  266. test "$enable_atomicuser" = "" && enable_atomicuser=yes
  267. test "$enable_pkcallbacks" = "" && enable_pkcallbacks=yes
  268. test "$enable_aesgcm" = "" && enable_aesgcm=yes
  269. test "$enable_aesccm" = "" && enable_aesccm=yes
  270. test "$enable_aesctr" = "" && enable_aesctr=yes
  271. test "$enable_aesofb" = "" && enable_aesofb=yes
  272. test "$enable_aescfb" = "" && enable_aescfb=yes
  273. test "$enable_camellia" = "" && enable_camellia=yes
  274. test "$enable_ripemd" = "" && enable_ripemd=yes
  275. test "$enable_sha512" = "" && enable_sha512=yes
  276. test "$enable_sha224" = "" && enable_sha224=yes
  277. test "$enable_sha3" = "" && enable_sha3=yes
  278. test "$enable_sessioncerts" = "" && enable_sessioncerts=yes
  279. test "$enable_keygen" = "" && enable_keygen=yes
  280. test "$enable_certgen" = "" && enable_certgen=yes
  281. test "$enable_certreq" = "" && enable_certreq=yes
  282. test "$enable_certext" = "" && enable_certext=yes
  283. test "$enable_sep" = "" && enable_sep=yes
  284. test "$enable_hkdf" = "" && enable_hkdf=yes
  285. test "$enable_curve25519" = "" && enable_curve25519=yes
  286. test "$enable_curve448" = "" && enable_curve448=yes
  287. test "$enable_fpecc" = "" && enable_fpecc=yes
  288. test "$enable_eccencrypt" = "" && enable_eccencrypt=yes
  289. test "$enable_psk" = "" && enable_psk=yes
  290. test "$enable_idea" = "" && enable_idea=yes
  291. test "$enable_cmac" = "" && enable_cmac=yes
  292. test "$enable_xts" = "" && enable_xts=yes
  293. test "$enable_webserver" = "" && enable_webserver=yes
  294. test "$enable_hc128" = "" && enable_hc128=yes
  295. test "$enable_rabbit" = "" && enable_rabbit=yes
  296. test "$enable_ocsp" = "" && enable_ocsp=yes
  297. test "$enable_ocspstapling" = "" && enable_ocspstapling=yes
  298. test "$enable_ocspstapling2" = "" && enable_ocspstapling2=yes
  299. test "$enable_crl" = "" && enable_crl=yes
  300. test "$enable_crl_monitor" = "" && enable_crl_monitor=yes
  301. test "$enable_sni" = "" && enable_sni=yes
  302. test "$enable_maxfragment" = "" && enable_maxfragment=yes
  303. test "$enable_alpn" = "" && enable_alpn=yes
  304. test "$enable_truncatedhmac" = "" && enable_truncatedhmac=yes
  305. test "$enable_trusted_ca" = "" && enable_trusted_ca=yes
  306. test "$enable_supportedcurves" = "" && enable_supportedcurves=yes
  307. test "$enable_session_ticket" = "" && enable_session_ticket=yes
  308. test "$enable_tlsx" = "" && enable_tlsx=yes
  309. test "$enable_ssh" = "" && enable_ssh=yes
  310. test "$enable_pwdbased" = "" && enable_pwdbased=yes
  311. test "$enable_aeskeywrap" = "" && enable_aeskeywrap=yes
  312. test "$enable_x963kdf" = "" && enable_x963kdf=yes
  313. test "$enable_scrypt" = "" && enable_scrypt=yes
  314. test "$enable_indef" = "" && enable_indef=yes
  315. test "$enable_enckeys" = "" && enable_enckeys=yes
  316. test "$enable_hashflags" = "" && enable_hashflags=yes
  317. test "$enable_defaultdhparams" = "" && enable_defaultdhparams=yes
  318. test "$enable_arc4" = "" && enable_arc4=yes
  319. test "$enable_des3" = "" && enable_des3=yes
  320. test "$enable_nullcipher" = "" && enable_nullcipher=yes
  321. test "$enable_blake2" = "" && enable_blake2=yes
  322. test "$enable_blake2s" = "" && enable_blake2s=yes
  323. test "$enable_md2" = "" && enable_md2=yes
  324. test "$enable_md4" = "" && enable_md4=yes
  325. test "$enable_postauth" = "" && enable_postauth=yes
  326. test "$enable_hrrcookie" = "" && enable_hrrcookie=yes
  327. test "$enable_cryptocb" = "" && enable_cryptocb=yes
  328. test "$enable_fallback_scsv" = "" && enable_fallback_scsv=yes
  329. test "$enable_anon" = "" && enable_anon=yes
  330. test "$enable_mcast" = "" && enable_mcast=yes
  331. if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
  332. then
  333. test "$enable_compkey" = "" && enable_compkey=yes
  334. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_IO -DHAVE_IO_TIMEOUT"
  335. fi
  336. # sp-math is incompatible with opensslextra, ECC custom curves, and DSA.
  337. if test "$ENABLED_SP_MATH" = "no"
  338. then
  339. test "$enable_dsa" = "" && enable_dsa=yes
  340. test "$enable_ecccustcurves" = "" && enable_ecccustcurves=yes
  341. test "$enable_srp" = "" && enable_srp=yes
  342. # linuxkm is incompatible with opensslextra and its dependents.
  343. if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
  344. then
  345. if test "$ENABLED_FIPS" = "no"
  346. then
  347. test "$enable_openssh" = "" && enable_openssh=yes
  348. fi
  349. test "$enable_opensslextra" = "" && enable_opensslextra=yes
  350. test "$enable_opensslall" = "" && enable_opensslall=yes
  351. test "$enable_certservice" = "" && enable_certservice=yes
  352. test "$enable_jni" = "" && enable_jni=yes
  353. test "$enable_lighty" = "" && enable_lighty=yes
  354. test "$enable_haproxy" = "" && enable_haproxy=yes
  355. test "$enable_stunnel" = "" && enable_stunnel=yes
  356. test "$enable_nginx" = "" && enable_nginx=yes
  357. test "$enable_openvpn" = "" && enable_openvpn=yes
  358. test "$enable_asio" = "" && enable_asio=yes
  359. test "$enable_libwebsockets" = "" && enable_libwebsockets=yes
  360. test "$enable_qt" = "" && enable_qt=yes
  361. fi
  362. # Enable ECC Import checks
  363. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_IMPORT"
  364. fi
  365. if test "$ENABLED_FIPS" = "no"
  366. then
  367. test "$enable_xchacha" = "" && enable_xchacha=yes
  368. test "$enable_scep" = "" && enable_scep=yes
  369. test "$enable_pkcs7" = "" && enable_pkcs7=yes
  370. test "$enable_ed25519" = "" && enable_ed25519=yes
  371. test "$enable_ed448" = "" && enable_ed448=yes
  372. fi
  373. # Enable DH const table speedups (eliminates `-lm` math lib dependency)
  374. AM_CFLAGS="$AM_CFLAGS -DHAVE_FFDHE_2048 -DHAVE_FFDHE_3072 -DFP_MAX_BITS=8192"
  375. # Enable multiple attribute additions such as DC
  376. AM_CFLAGS="-DWOLFSSL_MULTI_ATTRIB $AM_CFLAGS"
  377. # Enable AES Decrypt, AES ECB, Alt Names, DER Load, Keep Certs, CRL IO with Timeout
  378. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_DECRYPT -DHAVE_AES_ECB -DWOLFSSL_ALT_NAMES -DWOLFSSL_DER_LOAD -DKEEP_OUR_CERT -DKEEP_PEER_CERT"
  379. # Enable ECC Key Gen checks
  380. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_KEYGEN"
  381. fi
  382. # ALL CRYPTO FEATURES
  383. AC_ARG_ENABLE([all-crypto],
  384. [AS_HELP_STRING([--enable-all-crypto],[Enable all wolfcrypt algorithms (default: disabled)])],
  385. [ ENABLED_ALL_CRYPT=$enableval ],
  386. [ ENABLED_ALL_CRYPT=no ]
  387. )
  388. if test "$ENABLED_ALL_CRYPT" = "yes"
  389. then
  390. test "$enable_atomicuser" = "" && enable_atomicuser=yes
  391. test "$enable_pkcallbacks" = "" && enable_pkcallbacks=yes
  392. test "$enable_aesgcm" = "" && enable_aesgcm=yes
  393. test "$enable_aesccm" = "" && enable_aesccm=yes
  394. test "$enable_aesctr" = "" && enable_aesctr=yes
  395. test "$enable_aesofb" = "" && enable_aesofb=yes
  396. test "$enable_aescfb" = "" && enable_aescfb=yes
  397. test "$enable_camellia" = "" && enable_camellia=yes
  398. test "$enable_ripemd" = "" && enable_ripemd=yes
  399. test "$enable_sha512" = "" && enable_sha512=yes
  400. test "$enable_sha224" = "" && enable_sha224=yes
  401. test "$enable_sha3" = "" && enable_sha3=yes
  402. test "$enable_sessioncerts" = "" && enable_sessioncerts=yes
  403. test "$enable_keygen" = "" && enable_keygen=yes
  404. test "$enable_certgen" = "" && enable_certgen=yes
  405. test "$enable_certreq" = "" && enable_certreq=yes
  406. test "$enable_certext" = "" && enable_certext=yes
  407. test "$enable_sep" = "" && enable_sep=yes
  408. test "$enable_hkdf" = "" && enable_hkdf=yes
  409. test "$enable_curve25519" = "" && enable_curve25519=yes
  410. test "$enable_curve448" = "" && enable_curve448=yes
  411. test "$enable_fpecc" = "" && enable_fpecc=yes
  412. test "$enable_eccencrypt" = "" && enable_eccencrypt=yes
  413. test "$enable_psk" = "" && enable_psk=yes
  414. test "$enable_idea" = "" && enable_idea=yes
  415. test "$enable_cmac" = "" && enable_cmac=yes
  416. test "$enable_xts" = "" && enable_xts=yes
  417. test "$enable_hc128" = "" && enable_hc128=yes
  418. test "$enable_rabbit" = "" && enable_rabbit=yes
  419. test "$enable_ocsp" = "" && enable_ocsp=yes
  420. test "$enable_ocspstapling" = "" && enable_ocspstapling=yes
  421. test "$enable_ocspstapling2" = "" && enable_ocspstapling2=yes
  422. test "$enable_crl" = "" && enable_crl=yes
  423. test "$enable_supportedcurves" = "" && enable_supportedcurves=yes
  424. test "$enable_tlsx" = "" && enable_tlsx=yes
  425. test "$enable_pwdbased" = "" && enable_pwdbased=yes
  426. test "$enable_aeskeywrap" = "" && enable_aeskeywrap=yes
  427. test "$enable_x963kdf" = "" && enable_x963kdf=yes
  428. test "$enable_scrypt" = "" && enable_scrypt=yes
  429. test "$enable_indef" = "" && enable_indef=yes
  430. test "$enable_enckeys" = "" && enable_enckeys=yes
  431. test "$enable_hashflags" = "" && enable_hashflags=yes
  432. test "$enable_defaultdhparams" = "" && enable_defaultdhparams=yes
  433. test "$enable_arc4" = "" && enable_arc4=yes
  434. test "$enable_des3" = "" && enable_des3=yes
  435. test "$enable_nullcipher" = "" && enable_nullcipher=yes
  436. test "$enable_blake2" = "" && enable_blake2=yes
  437. test "$enable_blake2s" = "" && enable_blake2s=yes
  438. test "$enable_md2" = "" && enable_md2=yes
  439. test "$enable_md4" = "" && enable_md4=yes
  440. test "$enable_cryptocb" = "" && enable_cryptocb=yes
  441. test "$enable_anon" = "" && enable_anon=yes
  442. if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
  443. then
  444. test "$enable_compkey" = "" && enable_compkey=yes
  445. fi
  446. if test "$ENABLED_SP_MATH" = "no"
  447. then
  448. test "$enable_dsa" = "" && enable_dsa=yes
  449. test "$enable_ecccustcurves" = "" && enable_ecccustcurves=yes
  450. # Enable ECC Import checks
  451. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_IMPORT"
  452. fi
  453. if test "$ENABLED_FIPS" != "yes"
  454. then
  455. test "$enable_xchacha" = "" && enable_xchacha=yes
  456. test "$enable_ed25519" = "" && enable_ed25519=yes
  457. test "$enable_ed448" = "" && enable_ed448=yes
  458. test "$enable_pkcs7" = "" && enable_pkcs7=yes
  459. fi
  460. # Enable AES Decrypt, AES ECB, Alt Names, DER Load
  461. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_DECRYPT -DHAVE_AES_ECB -DWOLFSSL_ALT_NAMES -DWOLFSSL_DER_LOAD"
  462. # Enable DH const table speedups (eliminates `-lm` math lib dependency)
  463. AM_CFLAGS="$AM_CFLAGS -DHAVE_FFDHE_2048 -DHAVE_FFDHE_3072 -DFP_MAX_BITS=8192"
  464. # Enable multiple attribute additions such as DC
  465. AM_CFLAGS="-DWOLFSSL_MULTI_ATTRIB $AM_CFLAGS"
  466. # Enable ECC Key Gen checks
  467. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_KEYGEN"
  468. fi
  469. # Support for forcing 32-bit mode
  470. # To force 32-bit instructions use:
  471. # ./configure CFLAGS="-m32" LDFLAGS="-m32" && make
  472. # 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.
  473. AC_ARG_ENABLE([32bit],
  474. [AS_HELP_STRING([--enable-32bit],[Enables 32-bit support (default: disabled)])],
  475. [ ENABLED_32BIT=$enableval ],
  476. [ ENABLED_32BIT=no ]
  477. )
  478. # 16-bit compiler support
  479. AC_ARG_ENABLE([16bit],
  480. [AS_HELP_STRING([--enable-16bit],[Enables 16-bit support (default: disabled)])],
  481. [ ENABLED_16BIT=$enableval ],
  482. [ ENABLED_16BIT=no ]
  483. )
  484. if test "$ENABLED_16BIT" = "yes"
  485. then
  486. AM_CFLAGS="$AM_CFLAGS -DWC_16BIT_CPU"
  487. fi
  488. # Support for disabling all ASM
  489. AC_ARG_ENABLE([asm],
  490. [AS_HELP_STRING([--enable-asm],[Enables option for assembly (default: enabled)])],
  491. [ ENABLED_ASM=$enableval ],
  492. [ ENABLED_ASM=yes ]
  493. )
  494. if test "$ENABLED_ASM" = "no"
  495. then
  496. AM_CFLAGS="$AM_CFLAGS -DTFM_NO_ASM -DWOLFSSL_NO_ASM"
  497. fi
  498. AC_SUBST([ENABLED_ASM])
  499. # SINGLE THREADED
  500. AC_ARG_ENABLE([singlethreaded],
  501. [AS_HELP_STRING([--enable-singlethreaded],[Enable wolfSSL single threaded (default: disabled)])],
  502. [ ENABLED_SINGLETHREADED=$enableval ],
  503. [ ENABLED_SINGLETHREADED=no ])
  504. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xno" ],[
  505. AX_PTHREAD([
  506. AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
  507. # If AX_PTHREAD is adding -Qunused-arguments, need to prepend with -Xcompiler libtool will use it. Newer
  508. # versions of clang don't need the -Q flag when using pthreads.
  509. AS_CASE([$PTHREAD_CFLAGS],[-Qunused-arguments*],[PTHREAD_CFLAGS="-Xcompiler $PTHREAD_CFLAGS"])
  510. AM_CFLAGS="-D_POSIX_THREADS $AM_CFLAGS $PTHREAD_CFLAGS"
  511. LIBS="$LIBS $PTHREAD_LIBS"
  512. ],[
  513. ENABLED_SINGLETHREADED=yes
  514. ])
  515. ])
  516. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xyes" ],[ AM_CFLAGS="-DSINGLE_THREADED $AM_CFLAGS" ])
  517. # DTLS
  518. AC_ARG_ENABLE([dtls],
  519. [AS_HELP_STRING([--enable-dtls],[Enable wolfSSL DTLS (default: disabled)])],
  520. [ ENABLED_DTLS=$enableval ],
  521. [ ENABLED_DTLS=no ]
  522. )
  523. if test "$ENABLED_DTLS" = "yes"
  524. then
  525. AM_CFLAGS="-DWOLFSSL_DTLS $AM_CFLAGS"
  526. fi
  527. # DTLS change MTU
  528. AC_ARG_ENABLE([dtls-mtu],
  529. [AS_HELP_STRING([--enable-dtls-mtu],[Enable setting the MTU size for wolfSSL DTLS (default: disabled)])],
  530. [ ENABLED_DTLS_MTU=$enableval ],
  531. [ ENABLED_DTLS_MTU=no ]
  532. )
  533. if test "$ENABLED_DTLS_MTU" = "yes"
  534. then
  535. AM_CFLAGS="-DWOLFSSL_DTLS_MTU $AM_CFLAGS"
  536. fi
  537. # TLS v1.3 Draft 18 (Note: only final TLS v1.3 supported, here for backwards build compatibility)
  538. AC_ARG_ENABLE([tls13-draft18],
  539. [AS_HELP_STRING([--enable-tls13-draft18],[Enable wolfSSL TLS v1.3 Draft 18 (default: disabled)])],
  540. [ ENABLED_TLS13_DRAFT18=$enableval ],
  541. [ ENABLED_TLS13_DRAFT18=no ]
  542. )
  543. # TLS v1.3
  544. AC_ARG_ENABLE([tls13],
  545. [AS_HELP_STRING([--enable-tls13],[Enable wolfSSL TLS v1.3 (default: enabled)])],
  546. [ ENABLED_TLS13=$enableval ],
  547. [ ENABLED_TLS13=yes ]
  548. )
  549. if test "x$FIPS_VERSION" = "xv1"
  550. then
  551. ENABLED_TLS13="no"
  552. fi
  553. # Post-handshake Authentication
  554. AC_ARG_ENABLE([postauth],
  555. [AS_HELP_STRING([--enable-postauth],[Enable wolfSSL Post-handshake Authentication (default: disabled)])],
  556. [ ENABLED_TLS13_POST_AUTH=$enableval ],
  557. [ ENABLED_TLS13_POST_AUTH=no ]
  558. )
  559. if test "$ENABLED_TLS13_POST_AUTH" = "yes"
  560. then
  561. if test "x$ENABLED_TLS13" = "xno"
  562. then
  563. AC_MSG_NOTICE([TLS 1.3 is disabled - disabling Post-handshake Authentication])
  564. ENABLED_TLS13_POST_AUTH="no"
  565. else
  566. AM_CFLAGS="-DWOLFSSL_POST_HANDSHAKE_AUTH $AM_CFLAGS"
  567. fi
  568. fi
  569. # Hello Retry Request Cookie
  570. AC_ARG_ENABLE([hrrcookie],
  571. [AS_HELP_STRING([--enable-hrrcookie],[Enable the server to send Cookie Extension in HRR with state (default: disabled)])],
  572. [ ENABLED_SEND_HRR_COOKIE=$enableval ],
  573. [ ENABLED_SEND_HRR_COOKIE=no ]
  574. )
  575. if test "$ENABLED_SEND_HRR_COOKIE" = "yes"
  576. then
  577. if test "x$ENABLED_TLS13" = "xno"
  578. then
  579. AC_MSG_NOTICE([TLS 1.3 is disabled - disabling HRR Cookie])
  580. ENABLED_SEND_HRR_COOKIE="no"
  581. else
  582. AM_CFLAGS="-DWOLFSSL_SEND_HRR_COOKIE $AM_CFLAGS"
  583. fi
  584. fi
  585. # RNG
  586. AC_ARG_ENABLE([rng],
  587. [AS_HELP_STRING([--enable-rng],[Enable compiling and using RNG (default: enabled)])],
  588. [ ENABLED_RNG=$enableval ],
  589. [ ENABLED_RNG=yes ]
  590. )
  591. if test "$ENABLED_RNG" = "no"
  592. then
  593. AM_CFLAGS="$AM_CFLAGS -DWC_NO_RNG"
  594. fi
  595. # DTLS-SCTP
  596. AC_ARG_ENABLE([sctp],
  597. [AS_HELP_STRING([--enable-sctp],[Enable wolfSSL DTLS-SCTP support (default: disabled)])],
  598. [ENABLED_SCTP=$enableval],
  599. [ENABLED_SCTP=no])
  600. AS_IF([test "x$ENABLED_SCTP" = "xyes"],
  601. [AC_MSG_CHECKING([for SCTP])
  602. AC_RUN_IFELSE(
  603. [AC_LANG_PROGRAM(
  604. [[
  605. #include <sys/socket.h>
  606. #include <arpa/inet.h>
  607. ]],
  608. [[int s = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); if (s == -1) return 1;]])],
  609. [AC_MSG_RESULT(yes)],
  610. [AC_MSG_RESULT(no)
  611. AC_MSG_ERROR([SCTP not available, remove enable-sctp from configure])])
  612. ])
  613. # DTLS-MULTICAST
  614. AC_ARG_ENABLE([mcast],
  615. [AS_HELP_STRING([--enable-mcast],[Enable wolfSSL DTLS multicast support (default: disabled)])],
  616. [ENABLED_MCAST=$enableval],
  617. [ENABLED_MCAST=no])
  618. # List of open source project defines using our openssl compatibility layer:
  619. # openssh (--enable-openssh) WOLFSSL_OPENSSH
  620. # openvpn (--enable-openvpn) WOLFSSL_OPENVPN
  621. # nginix (--enable-nginx) WOLFSSL_NGINX
  622. # haproxy (--enable-haproxy) WOLFSSL_HAPROXY
  623. # wpa_supplicant (--enable-wpas) WOLFSSL_WPAS
  624. # ssl fortress (--enable-fortress) FORTRESS
  625. # ssl bump (--enable-bump)
  626. # signal (--enable-signal)
  627. # lighty (--enable-lighty) HAVE_LIGHTY
  628. # stunnel (--enable-stunnel) HAVE_STUNNEL
  629. # libest (--enable-libest) HAVE_LIBEST
  630. # asio (--enable-asio) WOLFSSL_ASIO
  631. # libwebsockets (--enable-libwebsockets) WOLFSSL_LIBWEBSOCKETS
  632. # qt (--enable-qt) WOLFSSL_QT
  633. # qt test (--enable-qt-test) WOLFSSL_QT_TEST
  634. # HAVE_POCO_LIB
  635. # WOLFSSL_MYSQL_COMPATIBLE
  636. # web server (--enable-webserver) HAVE_WEBSERVER
  637. # OpenSSH compatibility Build
  638. AC_ARG_ENABLE([openssh],
  639. [AS_HELP_STRING([--enable-openssh],[Enable OpenSSH compatibility build (default: disabled)])],
  640. [ENABLED_OPENSSH=$enableval],
  641. [ENABLED_OPENSSH=no])
  642. # OpenVPN compatibility Build
  643. AC_ARG_ENABLE([openvpn],
  644. [AS_HELP_STRING([--enable-openvpn],[Enable OpenVPN compatibility build (default: disabled)])],
  645. [ENABLED_OPENVPN=$enableval],
  646. [ENABLED_OPENVPN=no])
  647. # nginx compatibility build
  648. AC_ARG_ENABLE([nginx],
  649. [AS_HELP_STRING([--enable-nginx],[Enable nginx (default: disabled)])],
  650. [ ENABLED_NGINX=$enableval ],
  651. [ ENABLED_NGINX=no ]
  652. )
  653. # lighty Support
  654. AC_ARG_ENABLE([lighty],
  655. [AS_HELP_STRING([--enable-lighty],[Enable lighttpd/lighty (default: disabled)])],
  656. [ ENABLED_LIGHTY=$enableval ],
  657. [ ENABLED_LIGHTY=no ]
  658. )
  659. # haproxy compatibility build
  660. AC_ARG_ENABLE([haproxy],
  661. [AS_HELP_STRING([--enable-haproxy],[Enable haproxy (default: disabled)])],
  662. [ ENABLED_HAPROXY=$enableval ],
  663. [ ENABLED_HAPROXY=no ]
  664. )
  665. # wpa_supplicant support
  666. AC_ARG_ENABLE([wpas],
  667. [AS_HELP_STRING([--enable-wpas],[Enable wpa_supplicant support (default: disabled)])],
  668. [ ENABLED_WPAS=$enableval ],
  669. [ ENABLED_WPAS=no ]
  670. )
  671. # wpa_supplicant support
  672. AC_ARG_ENABLE([wpas-dpp],
  673. [AS_HELP_STRING([--enable-wpas-dpp],[Enable wpa_supplicant support with dpp (default: disabled)])],
  674. [ ENABLED_WPAS_DPP=$enableval ],
  675. [ ENABLED_WPAS_DPP=no ]
  676. )
  677. if test "$ENABLED_WPAS_DPP" = "yes"
  678. then
  679. ENABLED_WPAS="yes"
  680. fi
  681. # Fortress build
  682. AC_ARG_ENABLE([fortress],
  683. [AS_HELP_STRING([--enable-fortress],[Enable SSL fortress build (default: disabled)])],
  684. [ ENABLED_FORTRESS=$enableval ],
  685. [ ENABLED_FORTRESS=no ]
  686. )
  687. # libwebsockets Support
  688. AC_ARG_ENABLE([libwebsockets],
  689. [AS_HELP_STRING([--enable-libwebsockets],[Enable libwebsockets (default: disabled)])],
  690. [ ENABLED_LIBWEBSOCKETS=$enableval ],
  691. [ ENABLED_LIBWEBSOCKETS=no ]
  692. )
  693. if test "$ENABLED_LIBWEBSOCKETS" = "yes"
  694. then
  695. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LIBWEBSOCKETS -DHAVE_EX_DATA -DOPENSSL_NO_EC"
  696. fi
  697. if test "$ENABLED_OPENSSH" = "yes"
  698. then
  699. ENABLED_FORTRESS="yes"
  700. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_OPENSSH -DHAVE_EX_DATA -DWOLFSSL_BASE16"
  701. fi
  702. #IP alternative name Support
  703. AC_ARG_ENABLE([ip-alt-name],
  704. [AS_HELP_STRING([--enable-ip-alt-name],[Enable IP subject alternative name (default: disabled)])],
  705. [ ENABLE_IP_ALT_NAME=$enableval ],
  706. [ ENABLE_IP_ALT_NAME=no ]
  707. )
  708. if test "$ENABLE_IP_ALT_NAME" = "yes"
  709. then
  710. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_IP_ALT_NAME"
  711. fi
  712. #Qt Support
  713. AC_ARG_ENABLE([qt],
  714. [AS_HELP_STRING([--enable-qt],[Enable qt (default: disabled)])],
  715. [ ENABLED_QT=$enableval ],
  716. [ ENABLED_QT=no ]
  717. )
  718. # ssl bump build
  719. AC_ARG_ENABLE([bump],
  720. [AS_HELP_STRING([--enable-bump],[Enable SSL Bump build (default: disabled)])],
  721. [ ENABLED_BUMP=$enableval ],
  722. [ ENABLED_BUMP=no ]
  723. )
  724. # SNIFFER
  725. AC_ARG_ENABLE([sniffer],
  726. [AS_HELP_STRING([--enable-sniffer],[Enable wolfSSL sniffer support (default: disabled)])],
  727. [ ENABLED_SNIFFER=$enableval ],
  728. [ ENABLED_SNIFFER=no ]
  729. )
  730. # signal compatibility build
  731. AC_ARG_ENABLE([signal],
  732. [AS_HELP_STRING([--enable-signal],[Enable signal (default: disabled)])],
  733. [ ENABLED_SIGNAL=$enableval ],
  734. [ ENABLED_SIGNAL=no ]
  735. )
  736. # OpenSSL Coexist
  737. AC_ARG_ENABLE([opensslcoexist],
  738. [AS_HELP_STRING([--enable-opensslcoexist],[Enable coexistence of wolfssl/openssl (default: disabled)])],
  739. [ ENABLED_OPENSSLCOEXIST=$enableval ],
  740. [ ENABLED_OPENSSLCOEXIST=no ]
  741. )
  742. if test "x$ENABLED_OPENSSLCOEXIST" = "xyes"
  743. then
  744. # make sure old names are disabled
  745. enable_oldnames=no
  746. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_COEXIST"
  747. fi
  748. # OPENSSL Compatibility ALL
  749. AC_ARG_ENABLE([opensslall],
  750. [AS_HELP_STRING([--enable-opensslall],[Enable all OpenSSL API, size++ (default: disabled)])],
  751. [ ENABLED_OPENSSLALL=$enableval ],
  752. [ ENABLED_OPENSSLALL=no ]
  753. )
  754. if test "$ENABLED_LIBWEBSOCKETS" = "yes" || test "$ENABLED_OPENVPN" = "yes" || test "$ENABLED_WPAS_DPP" = "yes"
  755. then
  756. ENABLED_OPENSSLALL="yes"
  757. fi
  758. if test "$ENABLED_OPENSSLALL" = "yes"
  759. then
  760. AM_CFLAGS="-DOPENSSL_ALL -DWOLFSSL_EITHER_SIDE -DWC_RSA_NO_PADDING -DWC_RSA_PSS -DWOLFSSL_PSS_LONG_SALT $AM_CFLAGS"
  761. fi
  762. # OPENSSL Extra Compatibility
  763. AC_ARG_ENABLE([opensslextra],
  764. [AS_HELP_STRING([--enable-opensslextra],[Enable extra OpenSSL API, size+ (default: disabled)])],
  765. [ ENABLED_OPENSSLEXTRA=$enableval ],
  766. [ ENABLED_OPENSSLEXTRA=no ]
  767. )
  768. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$ENABLED_SIGNAL" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_FORTRESS" = "yes" || test "$ENABLED_BUMP" = "yes" || test "$ENABLED_SNIFFER" = "yes" || test "$ENABLED_OPENSSLALL" = "yes" || test "$ENABLED_LIBWEBSOCKETS" = "yes" || test "x$ENABLED_LIGHTY" = "xyes"
  769. then
  770. ENABLED_OPENSSLEXTRA="yes"
  771. fi
  772. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  773. then
  774. AM_CFLAGS="-DOPENSSL_EXTRA -DWOLFSSL_ALWAYS_VERIFY_CB $AM_CFLAGS"
  775. AM_CFLAGS="-DWOLFSSL_VERIFY_CB_ALL_CERTS -DWOLFSSL_EXTRA_ALERTS $AM_CFLAGS"
  776. AM_CFLAGS="-DHAVE_EXT_CACHE $AM_CFLAGS"
  777. fi
  778. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_SMALL" = "yes"
  779. then
  780. AC_MSG_ERROR([cannot enable small and opensslextra, only one or the other.])
  781. fi
  782. if test "$ENABLED_OPENSSLEXTRA" = "x509small"
  783. then
  784. AC_MSG_NOTICE([Enabling only a subset of X509 opensslextra])
  785. AM_CFLAGS="-DOPENSSL_EXTRA_X509_SMALL $AM_CFLAGS"
  786. AM_CFLAGS="-DWOLFSSL_EKU_OID -DWOLFSSL_MULTI_ATTRIB $AM_CFLAGS"
  787. fi
  788. # High Strength Build
  789. AC_ARG_ENABLE([maxstrength],
  790. [AS_HELP_STRING([--enable-maxstrength],[Enable Max Strength build, allows TLSv1.2-AEAD-PFS ciphers only (default: disabled)])],
  791. [ENABLED_MAXSTRENGTH=$enableval],
  792. [ENABLED_MAXSTRENGTH=no])
  793. # Harden, enable Timing Resistance and Blinding by default
  794. AC_ARG_ENABLE([harden],
  795. [AS_HELP_STRING([--enable-harden],[Enable Hardened build, Enables Timing Resistance and Blinding (default: enabled)])],
  796. [ENABLED_HARDEN=$enableval],
  797. [ENABLED_HARDEN=yes])
  798. if test "$ENABLED_HARDEN" = "yes"
  799. then
  800. AM_CFLAGS="$AM_CFLAGS -DTFM_TIMING_RESISTANT -DECC_TIMING_RESISTANT"
  801. if test "$ENABLED_RNG" = "yes"
  802. then
  803. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_BLINDING"
  804. fi
  805. else
  806. AM_CFLAGS="$AM_CFLAGS -DWC_NO_HARDEN"
  807. fi
  808. # IPv6 Test Apps
  809. AC_ARG_ENABLE([ipv6],
  810. [AS_HELP_STRING([--enable-ipv6],[Enable testing of IPV6 (default: disabled)])],
  811. [ ENABLED_IPV6=$enableval ],
  812. [ ENABLED_IPV6=no ]
  813. )
  814. if test "$ENABLED_IPV6" = "yes"
  815. then
  816. AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6 -DWOLFSSL_IPV6"
  817. fi
  818. if test "$ENABLED_WPAS" = "small"
  819. then
  820. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WPAS_SMALL"
  821. AM_CFLAGS="$AM_CFLAGS -DKEEP_OUR_CERT"
  822. AM_CFLAGS="$AM_CFLAGS -DKEEP_PEER_CERT"
  823. fi
  824. if test "$ENABLED_WPAS" = "yes"
  825. then
  826. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WPAS"
  827. fi
  828. if test "$ENABLED_WPAS" != "no"
  829. then
  830. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_VERIFY_CB"
  831. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  832. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
  833. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE"
  834. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_EITHER_SIDE"
  835. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA_X509_SMALL"
  836. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PUBLIC_MP"
  837. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DER_LOAD"
  838. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  839. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  840. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB"
  841. fi
  842. if test "$ENABLED_FORTRESS" = "yes"
  843. then
  844. AM_CFLAGS="$AM_CFLAGS -DFORTRESS -DWOLFSSL_ALWAYS_VERIFY_CB -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT -DWOLFSSL_DER_LOAD -DWOLFSSL_KEY_GEN"
  845. fi
  846. if test "$ENABLED_BUMP" = "yes"
  847. then
  848. AM_CFLAGS="$AM_CFLAGS -DLARGE_STATIC_BUFFERS -DWOLFSSL_CERT_GEN -DWOLFSSL_KEY_GEN -DHUGE_SESSION_CACHE -DFP_MAX_BITS=8192 -DWOLFSSL_DER_LOAD -DWOLFSSL_ALT_NAMES -DWOLFSSL_TEST_CERT"
  849. fi
  850. ENABLED_SLOWMATH="yes"
  851. # lean psk build
  852. AC_ARG_ENABLE([leanpsk],
  853. [AS_HELP_STRING([--enable-leanpsk],[Enable Lean PSK build (default: disabled)])],
  854. [ ENABLED_LEANPSK=$enableval ],
  855. [ ENABLED_LEANPSK=no ]
  856. )
  857. if test "$ENABLED_LEANPSK" = "yes"
  858. then
  859. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LEANPSK -DWOLFSSL_STATIC_PSK -DHAVE_NULL_CIPHER -DSINGLE_THREADED -DNO_AES -DNO_FILESYSTEM -DNO_RABBIT -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"
  860. ENABLED_SLOWMATH="no"
  861. ENABLED_SINGLETHREADED="yes"
  862. enable_lowresource=yes
  863. fi
  864. # lean TLS build (TLS 1.2 client only (no client auth), ECC256, AES128 and SHA256 w/o Shamir)
  865. AC_ARG_ENABLE([leantls],
  866. [AS_HELP_STRING([--enable-leantls],[Enable Lean TLS build (default: disabled)])],
  867. [ ENABLED_LEANTLS=$enableval ],
  868. [ ENABLED_LEANTLS=no ]
  869. )
  870. if test "$ENABLED_LEANTLS" = "yes"
  871. then
  872. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LEANTLS -DNO_WRITEV -DHAVE_ECC -DTFM_ECC256 -DECC_USER_CURVES -DNO_WOLFSSL_SERVER -DNO_RABBIT -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"
  873. enable_lowresource=yes
  874. fi
  875. # low resource options to reduce flash and memory use
  876. AC_ARG_ENABLE([lowresource],
  877. [AS_HELP_STRING([--enable-lowresource],[Enable low resource options for memory/flash (default: disabled)])],
  878. [ ENABLED_LOWRESOURCE=$enableval ],
  879. [ ENABLED_LOWRESOURCE=no ]
  880. )
  881. if test "$ENABLED_LOWRESOURCE" = "yes"
  882. then
  883. # low memory / flash flags
  884. AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE -DRSA_LOW_MEM -DALT_ECC_SIZE -DGCM_SMALL -DCURVE25519_SMALL -DED25519_SMALL -DWOLFSSL_SMALL_CERT_VERIFY"
  885. # low flash flags
  886. AM_CFLAGS="$AM_CFLAGS -DUSE_SLOW_SHA -DUSE_SLOW_SHA256 -DUSE_SLOW_SHA512"
  887. fi
  888. # TITAN cache
  889. AC_ARG_ENABLE([titancache],
  890. [AS_HELP_STRING([--enable-titancache],[Enable titan session cache (default: disabled)])],
  891. [ ENABLED_TITANCACHE=$enableval ],
  892. [ ENABLED_TITANCACHE=no ]
  893. )
  894. if test "$ENABLED_TITANCACHE" = "yes"
  895. then
  896. AM_CFLAGS="$AM_CFLAGS -DTITAN_SESSION_CACHE"
  897. fi
  898. # HUGE cache
  899. AC_ARG_ENABLE([hugecache],
  900. [AS_HELP_STRING([--enable-hugecache],[Enable huge session cache (default: disabled)])],
  901. [ ENABLED_HUGECACHE=$enableval ],
  902. [ ENABLED_HUGECACHE=no ]
  903. )
  904. if test "$ENABLED_HUGECACHE" = "yes"
  905. then
  906. AM_CFLAGS="$AM_CFLAGS -DHUGE_SESSION_CACHE"
  907. fi
  908. # big cache
  909. AC_ARG_ENABLE([bigcache],
  910. [AS_HELP_STRING([--enable-bigcache],[Enable big session cache (default: disabled)])],
  911. [ ENABLED_BIGCACHE=$enableval ],
  912. [ ENABLED_BIGCACHE=no ]
  913. )
  914. if test "$ENABLED_BIGCACHE" = "yes"
  915. then
  916. AM_CFLAGS="$AM_CFLAGS -DBIG_SESSION_CACHE"
  917. fi
  918. # SMALL cache
  919. AC_ARG_ENABLE([smallcache],
  920. [AS_HELP_STRING([--enable-smallcache],[Enable small session cache (default: disabled)])],
  921. [ ENABLED_SMALLCACHE=$enableval ],
  922. [ ENABLED_SMALLCACHE=no ]
  923. )
  924. if test "$ENABLED_SMALLCACHE" = "yes"
  925. then
  926. AM_CFLAGS="$AM_CFLAGS -DSMALL_SESSION_CACHE"
  927. fi
  928. # Persistent session cache
  929. AC_ARG_ENABLE([savesession],
  930. [AS_HELP_STRING([--enable-savesession],[Enable persistent session cache (default: disabled)])],
  931. [ ENABLED_SAVESESSION=$enableval ],
  932. [ ENABLED_SAVESESSION=no ]
  933. )
  934. if test "$ENABLED_SAVESESSION" = "yes"
  935. then
  936. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  937. fi
  938. # Persistent cert cache
  939. AC_ARG_ENABLE([savecert],
  940. [AS_HELP_STRING([--enable-savecert],[Enable persistent cert cache (default: disabled)])],
  941. [ ENABLED_SAVECERT=$enableval ],
  942. [ ENABLED_SAVECERT=no ]
  943. )
  944. if test "$ENABLED_SAVECERT" = "yes"
  945. then
  946. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  947. fi
  948. # Write duplicate WOLFSSL object
  949. AC_ARG_ENABLE([writedup],
  950. [AS_HELP_STRING([--enable-writedup],[Enable write duplication of WOLFSSL objects (default: disabled)])],
  951. [ ENABLED_WRITEDUP=$enableval ],
  952. [ ENABLED_WRITEDUP=no ]
  953. )
  954. if test "$ENABLED_WRITEDUP" = "yes"
  955. then
  956. AM_CFLAGS="$AM_CFLAGS -DHAVE_WRITE_DUP"
  957. fi
  958. # Atomic User Record Layer
  959. AC_ARG_ENABLE([atomicuser],
  960. [AS_HELP_STRING([--enable-atomicuser],[Enable Atomic User Record Layer (default: disabled)])],
  961. [ ENABLED_ATOMICUSER=$enableval ],
  962. [ ENABLED_ATOMICUSER=no ]
  963. )
  964. if test "$ENABLED_ATOMICUSER" = "yes"
  965. then
  966. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  967. fi
  968. # Public Key Callbacks
  969. AC_ARG_ENABLE([pkcallbacks],
  970. [AS_HELP_STRING([--enable-pkcallbacks],[Enable Public Key Callbacks (default: disabled)])],
  971. [ ENABLED_PKCALLBACKS=$enableval ],
  972. [ ENABLED_PKCALLBACKS=no ]
  973. )
  974. if test "$ENABLED_PKCALLBACKS" = "yes"
  975. then
  976. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  977. fi
  978. # Microchip/Atmel CryptoAuthLib
  979. ENABLED_CRYPTOAUTHLIB="no"
  980. trylibatcadir=""
  981. AC_ARG_WITH([cryptoauthlib],
  982. [AS_HELP_STRING([--with-cryptoauthlib=PATH],[PATH to CryptoAuthLib install (default /usr/)])],
  983. [
  984. AC_MSG_CHECKING([for cryptoauthlib])
  985. CPPFLAGS="$CPPFLAGS -DWOLFSSL_ATECC508A"
  986. LIBS="$LIBS -lcryptoauth"
  987. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cryptoauthlib.h>]], [[ atcab_init(0); ]])],[ libatca_linked=yes ],[ libatca_linked=no ])
  988. if test "x$libatca_linked" = "xno" ; then
  989. if test "x$withval" != "xno" ; then
  990. trylibatcadir=$withval
  991. fi
  992. if test "x$withval" = "xyes" ; then
  993. trylibatcadir="/usr"
  994. fi
  995. LDFLAGS="$LDFLAGS -L$trylibatcadir/lib"
  996. CPPFLAGS="$CPPFLAGS -I$trylibatcadir/lib"
  997. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cryptoauthlib.h>]], [[ atcab_init(0); ]])],[ libatca_linked=yes ],[ libatca_linked=no ])
  998. if test "x$libatca_linked" = "xno" ; then
  999. AC_MSG_ERROR([cryptoauthlib isn't found.
  1000. If it's already installed, specify its path using --with-cryptoauthlib=/dir/])
  1001. fi
  1002. AM_LDFLAGS="$AM_LDFLAGS -L$trylibatcadir/lib"
  1003. AM_CFLAGS="$AM_CFLAGS -I$trylibatcadir/lib"
  1004. AC_MSG_RESULT([yes])
  1005. else
  1006. AC_MSG_RESULT([yes])
  1007. fi
  1008. ENABLED_CRYPTOAUTHLIB="yes"
  1009. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ATECC508A"
  1010. ]
  1011. )
  1012. # sniffer doesn't work in maxstrength mode
  1013. if test "$ENABLED_SNIFFER" = "yes" && test "$ENABLED_MAXSTRENGTH" = "yes"
  1014. then
  1015. AC_MSG_ERROR([cannot enable maxstrength in sniffer mode.])
  1016. fi
  1017. ENABLED_SNIFFTEST=no
  1018. AS_IF([ test "x$ENABLED_SNIFFER" = "xyes" ],
  1019. [
  1020. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SNIFFER -DWOLFSSL_STATIC_EPHEMERAL"
  1021. AC_CHECK_HEADERS([pcap/pcap.h],
  1022. [ ENABLED_SNIFFTEST=yes ],
  1023. [ AC_MSG_WARN([cannot enable sniffer test without having libpcap available.]) ]
  1024. )
  1025. ])
  1026. # AES-CBC
  1027. AC_ARG_ENABLE([aescbc],
  1028. [AS_HELP_STRING([--enable-aescbc],[Enable wolfSSL AES-CBC support (default: enabled)])],
  1029. [ ENABLED_AESCBC=$enableval ],
  1030. [ ENABLED_AESCBC=yes ]
  1031. )
  1032. if test "$ENABLED_AESCBC" = "no"
  1033. then
  1034. AM_CFLAGS="$AM_CFLAGS -DNO_AES_CBC"
  1035. fi
  1036. # leanpsk and leantls don't need gcm
  1037. # AES-GCM
  1038. AC_ARG_ENABLE([aesgcm],
  1039. [AS_HELP_STRING([--enable-aesgcm],[Enable wolfSSL AES-GCM support (default: enabled)])],
  1040. [ ENABLED_AESGCM=$enableval ],
  1041. [ ENABLED_AESGCM=yes ]
  1042. )
  1043. # leanpsk and leantls don't need gcm
  1044. if test "$ENABLED_LEANPSK" = "yes" || ( test "$ENABLED_LEANTLS" = "yes" &&
  1045. test "$ENABLED_TLS13" = "no")
  1046. then
  1047. ENABLED_AESGCM=no
  1048. fi
  1049. if test "$ENABLED_AESGCM" = "yes" && test "$ac_cv_c_bigendian" != "yes"
  1050. then
  1051. ENABLED_AESGCM="4bit"
  1052. fi
  1053. # AES-CCM
  1054. AC_ARG_ENABLE([aesccm],
  1055. [AS_HELP_STRING([--enable-aesccm],[Enable wolfSSL AES-CCM support (default: disabled)])],
  1056. [ ENABLED_AESCCM=$enableval ],
  1057. [ ENABLED_AESCCM=no ]
  1058. )
  1059. if test "$ENABLED_AESCCM" = "yes"
  1060. then
  1061. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"
  1062. fi
  1063. # AES-CTR
  1064. AC_ARG_ENABLE([aesctr],
  1065. [AS_HELP_STRING([--enable-aesctr],[Enable wolfSSL AES-CTR support (default: disabled)])],
  1066. [ ENABLED_AESCTR=$enableval ],
  1067. [ ENABLED_AESCTR=no ]
  1068. )
  1069. if test "$ENABLED_OPENVPN" = "yes"
  1070. then
  1071. ENABLED_AESCTR=yes
  1072. fi
  1073. if test "$ENABLED_AESCTR" = "yes"
  1074. then
  1075. if test "x$ENABLED_FORTRESS" != "xyes"
  1076. then
  1077. # This is already implied by fortress build
  1078. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  1079. fi
  1080. fi
  1081. # AES-OFB
  1082. AC_ARG_ENABLE([aesofb],
  1083. [AS_HELP_STRING([--enable-aesofb],[Enable wolfSSL AES-OFB support (default: disabled)])],
  1084. [ ENABLED_AESOFB=$enableval ],
  1085. [ ENABLED_AESOFB=no ]
  1086. )
  1087. if test "$ENABLED_AESOFB" = "yes"
  1088. then
  1089. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_OFB -DWOLFSSL_AES_DIRECT"
  1090. fi
  1091. # AES-CFB
  1092. AC_ARG_ENABLE([aescfb],
  1093. [AS_HELP_STRING([--enable-aescfb],[Enable wolfSSL AES-CFB support (default: disabled)])],
  1094. [ ENABLED_AESCFB=$enableval ],
  1095. [ ENABLED_AESCFB=no ]
  1096. )
  1097. if test "$ENABLED_AESCFB" = "yes"
  1098. then
  1099. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_CFB"
  1100. fi
  1101. # AES-ARM
  1102. AC_ARG_ENABLE([armasm],
  1103. [AS_HELP_STRING([--enable-armasm],[Enable wolfSSL ARMv8 ASM support (default: disabled)])],
  1104. [ ENABLED_ARMASM=$enableval ],
  1105. [ ENABLED_ARMASM=no ]
  1106. )
  1107. if test "$ENABLED_ARMASM" = "yes" && test "$ENABLED_ASM" = "yes"
  1108. then
  1109. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_ARMASM"
  1110. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM -DWOLFSSL_NO_HASH_RAW"
  1111. #Check if mcpu and mfpu values already set if not use default
  1112. case $CPPFLAGS in
  1113. *mcpu* | *mfpu*)
  1114. break;; #Do not override user set values
  1115. *)
  1116. case $host_cpu in
  1117. *aarch64*)
  1118. case $host_os in
  1119. *darwin*)
  1120. ;;
  1121. *)
  1122. # +crypto needed for hardware acceleration
  1123. AM_CPPFLAGS="$AM_CPPFLAGS -mcpu=generic+crypto"
  1124. ;;
  1125. esac
  1126. # Include options.h
  1127. AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
  1128. # Check for and set -mstrict-align compiler flag
  1129. # Used to set assumption that Aarch64 systems will not handle
  1130. # unaligned memory references. The flag -mstrict-align is needed
  1131. # on some compiler versions to avoid an invalid addressing mode
  1132. # error with "m" constraint variables in the inline assembly AES
  1133. # code. Even though unaligned load/store access is permitted on
  1134. # normal memory with Cortex-A series boards with the exception
  1135. # being exclusive and ordered access.
  1136. case $CPPFLAGS in
  1137. *mstrict-align*)
  1138. break;; # already set by user
  1139. *)
  1140. AM_CPPFLAGS="$AM_CPPFLAGS -mstrict-align"
  1141. AC_MSG_NOTICE([64bit ARMv8, setting -mstrict-align]);;
  1142. esac
  1143. AC_MSG_NOTICE([64bit ARMv8 found, setting mcpu to generic+crypto]);;
  1144. *)
  1145. AM_CPPFLAGS="$AM_CPPFLAGS -mfpu=crypto-neon-fp-armv8"
  1146. # Include options.h
  1147. AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
  1148. AC_MSG_NOTICE([32bit ARMv8 found, setting mfpu to crypto-neon-fp-armv8]);;
  1149. esac
  1150. esac
  1151. fi
  1152. # Xilinx hardened crypto
  1153. AC_ARG_ENABLE([xilinx],
  1154. [AS_HELP_STRING([--enable-xilinx],[Enable wolfSSL support for Xilinx hardened crypto(default: disabled)])],
  1155. [ ENABLED_XILINX=$enableval ],
  1156. [ ENABLED_XILINX=no ]
  1157. )
  1158. if test "$ENABLED_XILINX" = "yes"
  1159. then
  1160. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_XILINX -DWOLFSSL_XILINX_CRYPT"
  1161. fi
  1162. # INTEL AES-NI
  1163. AC_ARG_ENABLE([aesni],
  1164. [AS_HELP_STRING([--enable-aesni],[Enable wolfSSL AES-NI support (default: disabled)])],
  1165. [ ENABLED_AESNI=$enableval ],
  1166. [ ENABLED_AESNI=no ]
  1167. )
  1168. # INTEL ASM
  1169. AC_ARG_ENABLE([intelasm],
  1170. [AS_HELP_STRING([--enable-intelasm],[Enable All Intel ASM speedups (default: disabled)])],
  1171. [ ENABLED_INTELASM=$enableval ],
  1172. [ ENABLED_INTELASM=no ]
  1173. )
  1174. if test "$ENABLED_ASM" = "yes"
  1175. then
  1176. if test "$ENABLED_AESNI" = "small"
  1177. then
  1178. AM_CFLAGS="$AM_CFLAGS -DAES_GCM_AESNI_NO_UNROLL"
  1179. ENABLED_AESNI=yes
  1180. fi
  1181. if test "$ENABLED_AESNI" = "yes" || test "$ENABLED_INTELASM" = "yes"
  1182. then
  1183. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI"
  1184. if test "$GCC" = "yes"
  1185. then
  1186. # clang needs these flags
  1187. if test "$CC" = "clang"
  1188. then
  1189. AM_CFLAGS="$AM_CFLAGS -maes -mpclmul"
  1190. else
  1191. # GCC needs these flags, icc doesn't
  1192. # opt levels greater than 2 may cause problems on systems w/o
  1193. # aesni
  1194. if test "$CC" != "icc"
  1195. then
  1196. AM_CFLAGS="$AM_CFLAGS -maes -msse4 -mpclmul"
  1197. fi
  1198. fi
  1199. fi
  1200. AS_IF([test "x$ENABLED_AESGCM" != "xno"],[AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"])
  1201. fi
  1202. if test "$ENABLED_INTELASM" = "yes"
  1203. then
  1204. AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDSEED -DUSE_INTEL_SPEEDUP"
  1205. ENABLED_AESNI=yes
  1206. fi
  1207. fi
  1208. # INTEL RDRAND
  1209. AC_ARG_ENABLE([intelrand],
  1210. [AS_HELP_STRING([--enable-intelrand],[Enable Intel rdrand as preferred RNG source (default: disabled)])],
  1211. [ ENABLED_INTELRDRAND=$enableval ],
  1212. [ ENABLED_INTELRDRAND=no ]
  1213. )
  1214. if test "$ENABLED_INTELRDRAND" = "yes"
  1215. then
  1216. AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDRAND"
  1217. fi
  1218. # Linux af_alg
  1219. AC_ARG_ENABLE([afalg],
  1220. [AS_HELP_STRING([--enable-afalg],[Enable Linux af_alg use for crypto (default: disabled)])],
  1221. [ ENABLED_AFALG=$enableval ],
  1222. [ ENABLED_AFALG=no ]
  1223. )
  1224. if test "$ENABLED_AFALG" = "yes"
  1225. then
  1226. if test "$ENABLED_AESCCM" = "yes"
  1227. then
  1228. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  1229. fi
  1230. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG"
  1231. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_HASH"
  1232. fi
  1233. if test "$ENABLED_AFALG" = "xilinx"
  1234. then
  1235. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX -DWOLFSSL_AFALG_XILINX_AES"
  1236. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX_SHA3 -DWOLFSSL_AFALG_XILINX_RSA"
  1237. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA3_224 -DWOLFSSL_NOSHA3_256 -DWOLFSSL_NOSHA3_512 -DWOLFSSL_NO_SHAKE256"
  1238. ENABLED_AFALG="yes"
  1239. ENABLED_XILINX="yes"
  1240. fi
  1241. if test "$ENABLED_AFALG" = "xilinx-aes"
  1242. then
  1243. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX -DWOLFSSL_AFALG_XILINX_AES"
  1244. ENABLED_AFALG="yes"
  1245. ENABLED_XILINX="yes"
  1246. fi
  1247. if test "$ENABLED_AFALG" = "xilinx-sha3"
  1248. then
  1249. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX"
  1250. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX_SHA3"
  1251. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA3_224 -DWOLFSSL_NOSHA3_256 -DWOLFSSL_NOSHA3_512 -DWOLFSSL_NO_SHAKE256"
  1252. ENABLED_AFALG="yes"
  1253. ENABLED_XILINX="yes"
  1254. fi
  1255. if test "$ENABLED_AFALG" = "xilinx-rsa"
  1256. then
  1257. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX"
  1258. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_XILINX_RSA"
  1259. ENABLED_AFALG="yes"
  1260. ENABLED_XILINX="yes"
  1261. fi
  1262. # Support for Linux dev/crypto calls
  1263. AC_ARG_ENABLE([devcrypto],
  1264. [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)])],
  1265. [ ENABLED_DEVCRYPTO=$enableval ],
  1266. [ ENABLED_DEVCRYPTO=no ]
  1267. )
  1268. if test "$ENABLED_DEVCRYPTO" = "yes" || test "$ENABLED_DEVCRYPTO" = "all"
  1269. then
  1270. #enable all devcrypto supported algorithms
  1271. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  1272. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
  1273. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_AES"
  1274. if test "$ENABLED_AESCCM" = "yes"
  1275. then
  1276. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  1277. fi
  1278. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HASH"
  1279. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_HASH_RAW"
  1280. ENABLED_DEVCRYPTO=yes
  1281. fi
  1282. if test "$ENABLED_DEVCRYPTO" = "aes"
  1283. then
  1284. #enable only AES-CBC algorithm support
  1285. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  1286. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_AES"
  1287. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
  1288. if test "$ENABLED_AESCCM" = "yes"
  1289. then
  1290. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_DIRECT"
  1291. fi
  1292. ENABLED_DEVCRYPTO=yes
  1293. fi
  1294. if test "$ENABLED_DEVCRYPTO" = "cbc"
  1295. then
  1296. #enable only AES-CBC algorithm support
  1297. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  1298. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_CBC"
  1299. ENABLED_DEVCRYPTO=yes
  1300. fi
  1301. if test "$ENABLED_DEVCRYPTO" = "hash"
  1302. then
  1303. #enable only hash algorithm support
  1304. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO"
  1305. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HASH"
  1306. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_HASH_RAW"
  1307. ENABLED_DEVCRYPTO=yes
  1308. fi
  1309. # Camellia
  1310. AC_ARG_ENABLE([camellia],
  1311. [AS_HELP_STRING([--enable-camellia],[Enable wolfSSL Camellia support (default: disabled)])],
  1312. [ ENABLED_CAMELLIA=$enableval ],
  1313. [ ENABLED_CAMELLIA=no ]
  1314. )
  1315. if test "$ENABLED_CAMELLIA" = "yes"
  1316. then
  1317. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAMELLIA"
  1318. fi
  1319. # MD2
  1320. AC_ARG_ENABLE([md2],
  1321. [AS_HELP_STRING([--enable-md2],[Enable wolfSSL MD2 support (default: disabled)])],
  1322. [ ENABLED_MD2=$enableval ],
  1323. [ ENABLED_MD2=no ]
  1324. )
  1325. if test "$ENABLED_BUMP" = "yes"
  1326. then
  1327. ENABLED_MD2="yes"
  1328. fi
  1329. if test "$ENABLED_MD2" = "yes"
  1330. then
  1331. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MD2"
  1332. fi
  1333. # NULL CIPHER
  1334. AC_ARG_ENABLE([nullcipher],
  1335. [AS_HELP_STRING([--enable-nullcipher],[Enable wolfSSL NULL cipher support (default: disabled)])],
  1336. [ ENABLED_NULL_CIPHER=$enableval ],
  1337. [ ENABLED_NULL_CIPHER=no ]
  1338. )
  1339. if test "$ENABLED_OPENSSH" = "yes"
  1340. then
  1341. ENABLED_NULL_CIPHER="yes"
  1342. fi
  1343. if test "$ENABLED_NULL_CIPHER" = "yes"
  1344. then
  1345. AM_CFLAGS="$AM_CFLAGS -DHAVE_NULL_CIPHER"
  1346. fi
  1347. # RIPEMD
  1348. AC_ARG_ENABLE([ripemd],
  1349. [AS_HELP_STRING([--enable-ripemd],[Enable wolfSSL RIPEMD-160 support (default: disabled)])],
  1350. [ ENABLED_RIPEMD=$enableval ],
  1351. [ ENABLED_RIPEMD=no ]
  1352. )
  1353. if test "$ENABLED_OPENSSH" = "yes"
  1354. then
  1355. ENABLED_RIPEMD="yes"
  1356. fi
  1357. if test "$ENABLED_RIPEMD" = "yes"
  1358. then
  1359. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RIPEMD"
  1360. fi
  1361. # BLAKE2
  1362. AC_ARG_ENABLE([blake2],
  1363. [AS_HELP_STRING([--enable-blake2],[Enable wolfSSL BLAKE2b support (default: disabled)])],
  1364. [ ENABLED_BLAKE2=$enableval ],
  1365. [ ENABLED_BLAKE2=no ]
  1366. )
  1367. if test "$ENABLED_BLAKE2" = "yes"
  1368. then
  1369. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2 -DHAVE_BLAKE2B"
  1370. fi
  1371. AC_ARG_ENABLE([blake2s],
  1372. [AS_HELP_STRING([--enable-blake2s],[Enable wolfSSL BLAKE2s support (default: disabled)])],
  1373. [ ENABLED_BLAKE2S=$enableval ],
  1374. [ ENABLED_BLAKE2S=no ]
  1375. )
  1376. if test "$ENABLED_BLAKE2S" = "yes"
  1377. then
  1378. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2S"
  1379. ENABLED_BLAKE2="yes"
  1380. fi
  1381. # SHA512
  1382. AC_ARG_ENABLE([sha512],
  1383. [AS_HELP_STRING([--enable-sha512],[Enable wolfSSL SHA-512 support (default: enabled)])],
  1384. [ ENABLED_SHA512=$enableval ],
  1385. [ ENABLED_SHA512=yes ]
  1386. )
  1387. # options that don't require sha512
  1388. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes" || test "$ENABLED_32BIT" = "yes" || test "$ENABLED_16BIT" = "yes"
  1389. then
  1390. ENABLED_SHA512="no"
  1391. fi
  1392. # options that require sha512
  1393. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_FORTRESS" = "yes"
  1394. then
  1395. ENABLED_SHA512="yes"
  1396. ENABLED_SHA384="yes"
  1397. fi
  1398. if test "$ENABLED_SHA512" = "yes"
  1399. then
  1400. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512"
  1401. fi
  1402. # SHA384
  1403. AC_ARG_ENABLE([sha384],
  1404. [AS_HELP_STRING([--enable-sha384],[Enable wolfSSL SHA-384 support (default: enabled)])],
  1405. [ ENABLED_SHA384=$enableval ],
  1406. [ ENABLED_SHA384=yes ]
  1407. )
  1408. # options that don't require sha384
  1409. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes" || test "$ENABLED_32BIT" = "yes" || test "$ENABLED_16BIT" = "yes"
  1410. then
  1411. ENABLED_SHA384="no"
  1412. fi
  1413. # options that require sha384
  1414. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_FORTRESS" = "yes"
  1415. then
  1416. ENABLED_SHA384="yes"
  1417. fi
  1418. if test "$ENABLED_SHA384" = "yes"
  1419. then
  1420. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA384"
  1421. fi
  1422. # SESSION CERTS
  1423. AC_ARG_ENABLE([sessioncerts],
  1424. [AS_HELP_STRING([--enable-sessioncerts],[Enable session cert storing (default: disabled)])],
  1425. [ ENABLED_SESSIONCERTS=$enableval ],
  1426. [ ENABLED_SESSIONCERTS=no ]
  1427. )
  1428. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_OPENVPN" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  1429. then
  1430. ENABLED_SESSIONCERTS=yes
  1431. fi
  1432. if test "$ENABLED_TLS13" = "yes" && test "$ENABLED_PSK" = "yes"
  1433. then
  1434. ENABLED_SESSIONCERTS=yes
  1435. fi
  1436. if test "$ENABLED_SESSIONCERTS" = "yes"
  1437. then
  1438. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  1439. fi
  1440. # KEY GENERATION
  1441. AC_ARG_ENABLE([keygen],
  1442. [AS_HELP_STRING([--enable-keygen],[Enable key generation (default: disabled)])],
  1443. [ ENABLED_KEYGEN=$enableval ],
  1444. [ ENABLED_KEYGEN=no ]
  1445. )
  1446. if test "$ENABLED_KEYGEN" = "yes"
  1447. then
  1448. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  1449. fi
  1450. # CERT GENERATION
  1451. AC_ARG_ENABLE([certgen],
  1452. [AS_HELP_STRING([--enable-certgen],[Enable cert generation (default: disabled)])],
  1453. [ ENABLED_CERTGEN=$enableval ],
  1454. [ ENABLED_CERTGEN=no ]
  1455. )
  1456. if test "$ENABLED_OPENVPN" = "yes" || test "$ENABLED_OPENSSH" = "yes"
  1457. then
  1458. ENABLED_CERTGEN=yes
  1459. fi
  1460. if test "$ENABLED_CERTGEN" = "yes"
  1461. then
  1462. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  1463. fi
  1464. # CERT REQUEST GENERATION
  1465. AC_ARG_ENABLE([certreq],
  1466. [AS_HELP_STRING([--enable-certreq],[Enable cert request generation (default: disabled)])],
  1467. [ ENABLED_CERTREQ=$enableval ],
  1468. [ ENABLED_CERTREQ=no ]
  1469. )
  1470. if test "$ENABLED_CERTREQ" = "yes"
  1471. then
  1472. if test "$ENABLED_CERTGEN" = "no"
  1473. then
  1474. AC_MSG_ERROR([cannot enable certreq without enabling certgen.])
  1475. fi
  1476. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  1477. fi
  1478. # CERT REQUEST EXTENSION
  1479. AC_ARG_ENABLE([certext],
  1480. [AS_HELP_STRING([--enable-certext],[Enable cert request extensions (default: disabled)])],
  1481. [ ENABLED_CERTEXT=$enableval ],
  1482. [ ENABLED_CERTEXT=no ]
  1483. )
  1484. if test "$ENABLED_OPENVPN" = "yes"
  1485. then
  1486. ENABLED_CERTEXT=yes
  1487. fi
  1488. if test "$ENABLED_CERTEXT" = "yes"
  1489. then
  1490. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  1491. fi
  1492. # DECODED CERT CACHE
  1493. AC_ARG_ENABLE([certgencache],
  1494. [AS_HELP_STRING([--enable-certgencache],[Enable decoded cert caching (default: disabled)])],
  1495. [ ENABLED_certgencache=$enableval ],
  1496. [ ENABLED_certgencache=no ]
  1497. )
  1498. if test "$ENABLED_certgencache" = "yes"
  1499. then
  1500. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN_CACHE"
  1501. fi
  1502. # SEP
  1503. AC_ARG_ENABLE([sep],
  1504. [AS_HELP_STRING([--enable-sep],[Enable sep extensions (default: disabled)])],
  1505. [ ENABLED_SEP=$enableval ],
  1506. [ ENABLED_SEP=no ]
  1507. )
  1508. if test "$ENABLED_SEP" = "yes"
  1509. then
  1510. AM_CFLAGS="-DWOLFSSL_SEP -DKEEP_PEER_CERT $AM_CFLAGS"
  1511. fi
  1512. # HKDF
  1513. AC_ARG_ENABLE([hkdf],
  1514. [AS_HELP_STRING([--enable-hkdf],[Enable HKDF (HMAC-KDF) support (default: disabled)])],
  1515. [ ENABLED_HKDF=$enableval ],
  1516. [ ENABLED_HKDF=no ]
  1517. )
  1518. if test "$ENABLED_TLS13" = "yes"
  1519. then
  1520. ENABLED_HKDF="yes"
  1521. fi
  1522. if test "$ENABLED_HKDF" = "yes"
  1523. then
  1524. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"
  1525. fi
  1526. # X9.63 KDF
  1527. AC_ARG_ENABLE([x963kdf],
  1528. [AS_HELP_STRING([--enable-x963kdf],[Enable X9.63 KDF support (default: disabled)])],
  1529. [ ENABLED_X963KDF=$enableval ],
  1530. [ ENABLED_X963KDF=no ]
  1531. )
  1532. if test "$ENABLED_X963KDF" = "yes"
  1533. then
  1534. AM_CFLAGS="$AM_CFLAGS -DHAVE_X963_KDF"
  1535. fi
  1536. # DSA
  1537. AC_ARG_ENABLE([dsa],
  1538. [AS_HELP_STRING([--enable-dsa],[Enable DSA (default: disabled)])],
  1539. [ ENABLED_DSA=$enableval ],
  1540. [ ENABLED_DSA=no ]
  1541. )
  1542. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_OPENVPN" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_QT" = "yes"
  1543. then
  1544. ENABLED_DSA="yes"
  1545. fi
  1546. if test "$ENABLED_DSA" = "no" && test "$ENABLED_OPENSSH" = "no"
  1547. then
  1548. AM_CFLAGS="$AM_CFLAGS -DNO_DSA"
  1549. else
  1550. ENABLED_CERTS=yes
  1551. fi
  1552. # ECC Shamir
  1553. AC_ARG_ENABLE([eccshamir],
  1554. [AS_HELP_STRING([--enable-eccshamir],[Enable ECC Shamir (default: enabled)])],
  1555. [ ENABLED_ECC_SHAMIR=$enableval ],
  1556. [ ENABLED_ECC_SHAMIR=yes ]
  1557. )
  1558. # ECC
  1559. AC_ARG_ENABLE([ecc],
  1560. [AS_HELP_STRING([--enable-ecc],[Enable ECC (default: enabled)])],
  1561. [ ENABLED_ECC=$enableval ],
  1562. [ ENABLED_ECC=yes ]
  1563. )
  1564. # lean psk doesn't need ecc
  1565. if test "$ENABLED_LEANPSK" = "yes"
  1566. then
  1567. ENABLED_ECC=no
  1568. fi
  1569. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$ENABLED_SIGNAL" = "yes"
  1570. then
  1571. ENABLED_ECC="yes"
  1572. fi
  1573. if test "$ENABLED_ECC" != "no"
  1574. then
  1575. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  1576. if test "$ENABLED_ECC_SHAMIR" = "yes" && test "$ENABLED_LOWRESOURCE" = "no"
  1577. then
  1578. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  1579. fi
  1580. if test "$ENABLED_ECC" = "nonblock"
  1581. then
  1582. AM_CFLAGS="$AM_CFLAGS -DWC_ECC_NONBLOCK"
  1583. fi
  1584. ENABLED_CERTS=yes
  1585. fi
  1586. # ECC Custom Curves
  1587. AC_ARG_ENABLE([ecccustcurves],
  1588. [AS_HELP_STRING([--enable-ecccustcurves],[Enable ECC custom curves (default: disabled)])],
  1589. [ ENABLED_ECCCUSTCURVES=$enableval ],
  1590. [ ENABLED_ECCCUSTCURVES=no ]
  1591. )
  1592. if test "$ENABLED_ECCCUSTCURVES" != "no"
  1593. then
  1594. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES"
  1595. # For distro, all or ecccustcurves=all builds, enable all curve types
  1596. if test "$ENABLED_DISTRO" = "yes" || test "$ENABLED_ALL" = "yes" || test "$ENABLED_ECCCUSTCURVES" = "all"
  1597. then
  1598. # Enable ECC SECPR2, SECPR3, BRAINPOOL and KOBLITZ curves
  1599. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ"
  1600. # Enable ECC Cofactor support
  1601. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_CDH"
  1602. # If fastmath enabled and on x86 use speedups
  1603. if test "x$ENABLED_FASTMATH" = "xyes" && test "$host_cpu" = "x86_64"
  1604. then
  1605. AM_CFLAGS="$AM_CFLAGS -DTFM_ECC192 -DTFM_ECC224 -DTFM_ECC256 -DTFM_ECC384 -DTFM_ECC521"
  1606. fi
  1607. fi
  1608. fi
  1609. # ECC Minimum Key Size
  1610. ENABLED_ECCMINSZ=224
  1611. AC_ARG_WITH([eccminsz],
  1612. [AS_HELP_STRING([--with-eccminsz=BITS],[Sets the ECC minimum key size (default: 224 bits)])],
  1613. [
  1614. ENABLED_ECCMINSZ=$withval
  1615. AM_CFLAGS="$AM_CFLAGS -DECC_MIN_KEY_SZ=$withval"
  1616. ]
  1617. )
  1618. # Compressed Key
  1619. AC_ARG_ENABLE([compkey],
  1620. [AS_HELP_STRING([--enable-compkey],[Enable compressed keys support (default: disabled)])],
  1621. [ ENABLED_COMPKEY=$enableval ],
  1622. [ ENABLED_COMPKEY=no ]
  1623. )
  1624. if test "$ENABLED_WPAS" = "yes"
  1625. then
  1626. ENABLED_COMPKEY=yes
  1627. fi
  1628. if test "$ENABLED_COMPKEY" = "yes"
  1629. then
  1630. AM_CFLAGS="$AM_CFLAGS -DHAVE_COMP_KEY"
  1631. fi
  1632. # for using memory optimization setting on both curve25519 and ed25519
  1633. ENABLED_CURVE25519_SMALL=no
  1634. ENABLED_ED25519_SMALL=no
  1635. # CURVE25519
  1636. AC_ARG_ENABLE([curve25519],
  1637. [AS_HELP_STRING([--enable-curve25519],[Enable Curve25519 (default: disabled)])],
  1638. [ ENABLED_CURVE25519=$enableval ],
  1639. [ ENABLED_CURVE25519=no ]
  1640. )
  1641. if test "$ENABLED_OPENSSH" = "yes"
  1642. then
  1643. ENABLED_CURVE25519="yes"
  1644. fi
  1645. if test "$ENABLED_CURVE25519" != "no"
  1646. then
  1647. if test "$ENABLED_CURVE25519" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1648. then
  1649. AM_CFLAGS="$AM_CFLAGS -DCURVE25519_SMALL"
  1650. ENABLED_CURVE25519_SMALL=yes
  1651. ENABLED_CURVE25519=yes
  1652. fi
  1653. if test "$ENABLED_CURVE25519" = "no128bit" || test "$ENABLED_32BIT" = "yes"
  1654. then
  1655. AM_CFLAGS="$AM_CFLAGS -DNO_CURVED25519_128BIT"
  1656. ENABLED_CURVE25519=yes
  1657. fi
  1658. AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE25519"
  1659. ENABLED_FEMATH=yes
  1660. fi
  1661. # ED25519
  1662. AC_ARG_ENABLE([ed25519],
  1663. [AS_HELP_STRING([--enable-ed25519],[Enable ED25519 (default: disabled)])],
  1664. [ ENABLED_ED25519=$enableval ],
  1665. [ ENABLED_ED25519=no ]
  1666. )
  1667. if test "$ENABLED_OPENSSH" = "yes"
  1668. then
  1669. ENABLED_ED25519="yes"
  1670. fi
  1671. if test "$ENABLED_ED25519" != "no" && test "$ENABLED_32BIT" = "no"
  1672. then
  1673. if test "$ENABLED_ED25519" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1674. then
  1675. AM_CFLAGS="$AM_CFLAGS -DED25519_SMALL"
  1676. ENABLED_ED25519_SMALL=yes
  1677. ENABLED_CURVE25519_SMALL=yes
  1678. ENABLED_ED25519=yes
  1679. fi
  1680. if test "$ENABLED_SHA512" = "no"
  1681. then
  1682. AC_MSG_ERROR([cannot enable ed25519 without enabling sha512.])
  1683. fi
  1684. ENABLED_FEMATH=yes
  1685. ENABLED_GEMATH=yes
  1686. AM_CFLAGS="$AM_CFLAGS -DHAVE_ED25519"
  1687. ENABLED_CERTS=yes
  1688. fi
  1689. # for using memory optimization setting on both curve448 and ed448
  1690. ENABLED_CURVE448_SMALL=no
  1691. ENABLED_ED448_SMALL=no
  1692. # CURVE448
  1693. AC_ARG_ENABLE([curve448],
  1694. [AS_HELP_STRING([--enable-curve448],[Enable Curve448 (default: disabled)])],
  1695. [ ENABLED_CURVE448=$enableval ],
  1696. [ ENABLED_CURVE448=no ]
  1697. )
  1698. if test "$ENABLED_CURVE448" != "no"
  1699. then
  1700. if test "$ENABLED_CURVE448" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1701. then
  1702. AM_CFLAGS="$AM_CFLAGS -DCURVE448_SMALL"
  1703. ENABLED_CURVE448_SMALL=yes
  1704. ENABLED_CURVE448=yes
  1705. fi
  1706. if test "$ENABLED_CURVE448" = "no128bit" || test "$ENABLED_32BIT" = "yes"
  1707. then
  1708. AM_CFLAGS="$AM_CFLAGS -DNO_CURVED448_128BIT"
  1709. ENABLED_CURVE448=yes
  1710. fi
  1711. AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE448"
  1712. ENABLED_FE448=yes
  1713. fi
  1714. # ED448
  1715. AC_ARG_ENABLE([ed448],
  1716. [AS_HELP_STRING([--enable-ed448],[Enable ED448 (default: disabled)])],
  1717. [ ENABLED_ED448=$enableval ],
  1718. [ ENABLED_ED448=no ]
  1719. )
  1720. if test "$ENABLED_ED448" != "no" && test "$ENABLED_32BIT" = "no"
  1721. then
  1722. if test "$ENABLED_ED448" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  1723. then
  1724. AM_CFLAGS="$AM_CFLAGS -DED448_SMALL"
  1725. ENABLED_ED448_SMALL=yes
  1726. ENABLED_CURVE448_SMALL=yes
  1727. ENABLED_ED448=yes
  1728. fi
  1729. if test "$ENABLED_SHA512" = "no"
  1730. then
  1731. AC_MSG_ERROR([cannot enable ed448 without enabling sha512.])
  1732. fi
  1733. ENABLED_FE448=yes
  1734. ENABLED_GE448=yes
  1735. AM_CFLAGS="$AM_CFLAGS -DHAVE_ED448"
  1736. # EdDSA448 requires SHAKE256 which requires SHA-3
  1737. ENABLED_SHAKE3=yes
  1738. ENABLED_SHAKE256=yes
  1739. ENABLED_CERTS=yes
  1740. fi
  1741. # FP ECC, Fixed Point cache ECC
  1742. AC_ARG_ENABLE([fpecc],
  1743. [AS_HELP_STRING([--enable-fpecc],[Enable Fixed Point cache ECC (default: disabled)])],
  1744. [ ENABLED_FPECC=$enableval ],
  1745. [ ENABLED_FPECC=no ]
  1746. )
  1747. if test "$ENABLED_FPECC" = "yes"
  1748. then
  1749. if test "$ENABLED_ECC" = "no"
  1750. then
  1751. AC_MSG_ERROR([cannot enable fpecc without enabling ecc.])
  1752. fi
  1753. AM_CFLAGS="$AM_CFLAGS -DFP_ECC"
  1754. fi
  1755. # ECC encrypt
  1756. AC_ARG_ENABLE([eccencrypt],
  1757. [AS_HELP_STRING([--enable-eccencrypt],[Enable ECC encrypt (default: disabled)])],
  1758. [ ENABLED_ECC_ENCRYPT=$enableval ],
  1759. [ ENABLED_ECC_ENCRYPT=no ]
  1760. )
  1761. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  1762. then
  1763. if test "$ENABLED_ECC" = "no"
  1764. then
  1765. AC_MSG_ERROR([cannot enable eccencrypt without enabling ecc.])
  1766. fi
  1767. if test "$ENABLED_HKDF" = "no"
  1768. then
  1769. AC_MSG_ERROR([cannot enable eccencrypt without enabling hkdf.])
  1770. fi
  1771. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_ENCRYPT"
  1772. fi
  1773. # PSK
  1774. AC_ARG_ENABLE([psk],
  1775. [AS_HELP_STRING([--enable-psk],[Enable PSK (default: disabled)])],
  1776. [ ENABLED_PSK=$enableval ],
  1777. [ ENABLED_PSK=no ]
  1778. )
  1779. # Single PSK identity
  1780. AC_ARG_ENABLE([psk-one-id],
  1781. [AS_HELP_STRING([--enable-psk-one-id],[Enable PSK (default: disabled)])],
  1782. [ ENABLED_PSK_ONE_ID=$enableval ],
  1783. [ ENABLED_PSK_ONE_ID=no ]
  1784. )
  1785. if test "$ENABLED_PSK_ONE_ID" = "yes"
  1786. then
  1787. if test "$ENABLED_PSK" = "no"
  1788. then
  1789. ENABLED_PSK="yes"
  1790. fi
  1791. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PSK_ONE_ID"
  1792. fi
  1793. # ERROR STRINGS
  1794. AC_ARG_ENABLE([errorstrings],
  1795. [AS_HELP_STRING([--enable-errorstrings],[Enable error strings table (default: enabled)])],
  1796. [ ENABLED_ERROR_STRINGS=$enableval ],
  1797. [ ENABLED_ERROR_STRINGS=yes ]
  1798. )
  1799. if test "$ENABLED_ERROR_STRINGS" = "no"
  1800. then
  1801. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  1802. else
  1803. # turn off error strings if leanpsk or leantls on
  1804. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1805. then
  1806. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  1807. ENABLED_ERROR_STRINGS=no
  1808. fi
  1809. fi
  1810. # ERROR QUEUE
  1811. AC_ARG_ENABLE([errorqueue],
  1812. [AS_HELP_STRING([--disable-errorqueue],[Disables adding nodes to error queue when compiled with OPENSSL_EXTRA (default: enabled)])],
  1813. [ ENABLED_ERROR_QUEUE=$enableval ],
  1814. [ ENABLED_ERROR_QUEUE=yes ]
  1815. )
  1816. if test "$ENABLED_ERROR_QUEUE" = "no"
  1817. then
  1818. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_QUEUE"
  1819. fi
  1820. # OLD TLS
  1821. AC_ARG_ENABLE([oldtls],
  1822. [AS_HELP_STRING([--enable-oldtls],[Enable old TLS versions < 1.2 (default: enabled)])],
  1823. [ ENABLED_OLD_TLS=$enableval ],
  1824. [ ENABLED_OLD_TLS=yes ]
  1825. )
  1826. if test "$ENABLED_OLD_TLS" = "no"
  1827. then
  1828. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  1829. else
  1830. # turn off old if leanpsk or leantls on
  1831. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1832. then
  1833. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  1834. ENABLED_OLD_TLS=no
  1835. fi
  1836. fi
  1837. # TLSv1.2
  1838. AC_ARG_ENABLE([tlsv12],
  1839. [AS_HELP_STRING([--enable-tlsv12],[Enable TLS versions 1.2 (default: enabled)])],
  1840. [ ENABLED_TLSV12=$enableval ],
  1841. [ ENABLED_TLSV12=yes ]
  1842. )
  1843. if test "$ENABLED_TLSV12" = "no"
  1844. then
  1845. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_TLS12 -DNO_OLD_TLS"
  1846. fi
  1847. # TLSv1.0
  1848. AC_ARG_ENABLE([tlsv10],
  1849. [AS_HELP_STRING([--enable-tlsv10],[Enable old TLS versions 1.0 (default: disabled)])],
  1850. [ ENABLED_TLSV10=$enableval ],
  1851. [ ENABLED_TLSV10=no ]
  1852. )
  1853. if test "$ENABLED_TLSV10" = "yes"
  1854. then
  1855. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_TLSV10"
  1856. fi
  1857. # SSLv3
  1858. AC_ARG_ENABLE([sslv3],
  1859. [AS_HELP_STRING([--enable-sslv3],[Enable SSL version 3.0 (default: disabled)])],
  1860. [ ENABLED_SSLV3=$enableval ],
  1861. [ ENABLED_SSLV3=no]
  1862. )
  1863. if test "x$ENABLED_HAPROXY" = "xyes" && test "x$ENABLED_ALL" = "xno"
  1864. then
  1865. ENABLED_SSLV3="yes"
  1866. fi
  1867. if test "$ENABLED_SSLV3" = "yes"
  1868. then
  1869. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_SSLV3"
  1870. fi
  1871. # STACK SIZE info for testwolfcrypt and examples
  1872. AC_ARG_ENABLE([stacksize],
  1873. [AS_HELP_STRING([--enable-stacksize],[Enable stack size info on examples (default: disabled)])],
  1874. [ ENABLED_STACKSIZE=$enableval ],
  1875. [ ENABLED_STACKSIZE=no ]
  1876. )
  1877. if test "$ENABLED_STACKSIZE" != "no"
  1878. then
  1879. AC_CHECK_FUNC([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  1880. AC_CHECK_DECL([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  1881. AC_CHECK_FUNC([pthread_attr_setstack], [], AC_CHECK_LIB([pthread],[pthread_attr_setstack]))
  1882. AC_CHECK_DECL([pthread_attr_setstack], [], [AC_MSG_ERROR(stacksize needs pthread_attr_setstack)], [[#include <pthread.h>]])
  1883. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE"
  1884. fi
  1885. if test "$ENABLED_STACKSIZE" = "verbose"
  1886. then
  1887. if test "$thread_ls_on" != "yes"
  1888. then
  1889. AC_MSG_ERROR(stacksize-verbose needs thread-local storage.)
  1890. fi
  1891. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE_VERBOSE"
  1892. fi
  1893. # MEMORY
  1894. AC_ARG_ENABLE([memory],
  1895. [AS_HELP_STRING([--enable-memory],[Enable memory callbacks (default: enabled)])],
  1896. [ ENABLED_MEMORY=$enableval ],
  1897. [ ENABLED_MEMORY=yes ]
  1898. )
  1899. if test "$ENABLED_MEMORY" = "no"
  1900. then
  1901. AM_CFLAGS="$AM_CFLAGS -DNO_WOLFSSL_MEMORY"
  1902. else
  1903. # turn off memory cb if leanpsk or leantls on
  1904. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1905. then
  1906. # but don't turn on NO_WOLFSSL_MEMORY because using own
  1907. ENABLED_MEMORY=no
  1908. fi
  1909. fi
  1910. # MEMORY SIZE info
  1911. AC_ARG_ENABLE([trackmemory],
  1912. [AS_HELP_STRING([--enable-trackmemory],[Enable memory use info on wolfCrypt and wolfSSL cleanup (default: disabled)])],
  1913. [ ENABLED_TRACKMEMORY=$enableval ],
  1914. [ ENABLED_TRACKMEMORY=no ]
  1915. )
  1916. if test "$ENABLED_TRACKMEMORY" != "no"
  1917. then
  1918. if test "$ENABLED_MEMORY" = "yes"
  1919. then
  1920. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY"
  1921. else
  1922. AC_MSG_ERROR([trackmemory requires using wolfSSL memory (--enable-memory).])
  1923. fi
  1924. if test "$ENABLED_TRACKMEMORY" = "verbose"
  1925. then
  1926. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY_VERBOSE"
  1927. fi
  1928. fi
  1929. # MEMORY usage logging
  1930. AC_ARG_ENABLE([memorylog],
  1931. [AS_HELP_STRING([--enable-memorylog],[Enable dynamic memory logging (default: disabled)])],
  1932. [ ENABLED_MEMORYLOG=$enableval ],
  1933. [ ENABLED_MEMORYLOG=no ]
  1934. )
  1935. if test "$ENABLED_MEMORYLOG" = "yes"
  1936. then
  1937. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MEMORY_LOG"
  1938. fi
  1939. # STACK usage logging
  1940. AC_ARG_ENABLE([stacklog],
  1941. [AS_HELP_STRING([--enable-stacklog],[Enable stack logging (default: disabled)])],
  1942. [ ENABLED_STACKLOG=$enableval ],
  1943. [ ENABLED_STACKLOG=no ]
  1944. )
  1945. if test "$ENABLED_STACKLOG" = "yes"
  1946. then
  1947. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STACK_LOG -finstrument-functions"
  1948. fi
  1949. if test "$ENABLED_QT" = "yes"
  1950. then
  1951. # Requires opensslextra and opensslall
  1952. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  1953. then
  1954. ENABLED_OPENSSLALL="yes"
  1955. ENABLED_OPENSSLEXTRA="yes"
  1956. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA -DOPENSSL_ALL -DHAVE_EX_DATA"
  1957. fi
  1958. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_QT -DSESSION_CERTS -DOPENSSL_NO_SSL2"
  1959. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN -DHAVE_EX_DATA"
  1960. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ"
  1961. if test "x$ENABLED_ALL" = "xno"; then
  1962. # Don't enable old SSL/TLS for --enable-all, which is used by distro
  1963. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_SSLV3 -DWOLFSSL_ALLOW_TLSV10"
  1964. fi
  1965. # Requires OCSP make sure on
  1966. if test "x$ENABLED_OCSP" = "xno"
  1967. then
  1968. ENABLED_OCSP="yes"
  1969. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1970. fi
  1971. # Requires PSK make sure on
  1972. if test "x$ENABLED_PSK" = "xno"
  1973. then
  1974. ENABLED_PSK="yes"
  1975. fi
  1976. # Requires RC4 make sure on
  1977. if test "x$ENABLED_ARC4" = "xno"
  1978. then
  1979. ENABLED_ARC4="yes"
  1980. fi
  1981. if test "x$ENABLED_CERTEXT" = "xno"
  1982. then
  1983. ENABLED_CERTEXT="yes"
  1984. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  1985. fi
  1986. if test "x$ENABLED_CERTGEN" = "xno"
  1987. then
  1988. ENABLED_CERTGEN="yes"
  1989. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  1990. fi
  1991. # requires oldnames disabled
  1992. enable_oldnames=no
  1993. fi
  1994. AC_ARG_ENABLE([qt-test],
  1995. [AS_HELP_STRING([--enable-qt-test],[Enable qt tests (default: disabled)])],
  1996. [ ENABLED_QT_TEST=$enableval ],
  1997. [ ENABLED_QT_TEST=no ]
  1998. )
  1999. if test "$ENABLED_QT_TEST" = "yes"
  2000. then
  2001. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL3 -DWOLFSSL_STATIC_RSA"
  2002. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_PSK"
  2003. fi
  2004. # RSA
  2005. AC_ARG_ENABLE([rsa],
  2006. [AS_HELP_STRING([--enable-rsa],[Enable RSA (default: enabled)])],
  2007. [ ENABLED_RSA=$enableval ],
  2008. [ ENABLED_RSA=yes ]
  2009. )
  2010. if test "$ENABLED_RSA" = "no"
  2011. then
  2012. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  2013. else
  2014. # turn off RSA if leanpsk or leantls on
  2015. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2016. then
  2017. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  2018. ENABLED_RSA=no
  2019. else
  2020. ENABLED_CERTS=yes
  2021. fi
  2022. fi
  2023. AC_ARG_ENABLE([oaep],
  2024. [AS_HELP_STRING([--enable-oaep],[Enable RSA OAEP (default: enabled)])],
  2025. [ ENABLED_OAEP=$enableval ],
  2026. [ ENABLED_OAEP=yes ]
  2027. )
  2028. if test "$ENABLED_OAEP" = "no"
  2029. then
  2030. AM_CFLAGS="$AM_CFLAGS -DWC_NO_RSA_OAEP"
  2031. fi
  2032. AC_ARG_ENABLE([rsapub],
  2033. [AS_HELP_STRING([--enable-rsapub],[Enable RSA Public Only (default: disabled)])],
  2034. [ ENABLED_RSAPUB=$enableval ],
  2035. [ ENABLED_RSAPUB=no ]
  2036. )
  2037. if test "$ENABLED_RSAPUB" = "yes"
  2038. then
  2039. if test "$ENABLED_RSA" = "no"
  2040. then
  2041. ENABLED_RSA="yes"
  2042. fi
  2043. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RSA_PUBLIC_ONLY"
  2044. fi
  2045. AC_ARG_ENABLE([rsavfy],
  2046. [AS_HELP_STRING([--enable-rsavfy],[Enable RSA Verify Inline Only (default: disabled)])],
  2047. [ ENABLED_RSAVFY=$enableval ],
  2048. [ ENABLED_RSAVFY=no ]
  2049. )
  2050. if test "$ENABLED_RSAVFY" = "yes"
  2051. then
  2052. if test "$ENABLED_RSA" = "no"
  2053. then
  2054. ENABLED_RSA="yes"
  2055. fi
  2056. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RSA_PUBLIC_ONLY -DWOLFSSL_RSA_VERIFY_ONLY"
  2057. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RSA_VERIFY_INLINE -DNO_SIG_WRAPPER"
  2058. fi
  2059. # RSA-PSS
  2060. AC_ARG_ENABLE([rsapss],
  2061. [ --enable-rsapss Enable RSA-PSS (default: disabled)],
  2062. [ ENABLED_RSAPSS=$enableval ],
  2063. [ ENABLED_RSAPSS=no ]
  2064. )
  2065. if test "$ENABLED_RSA" = "no"
  2066. then
  2067. ENABLED_RSAPSS="no"
  2068. else
  2069. if test "$ENABLED_TLS13" = "yes"
  2070. then
  2071. ENABLED_RSAPSS="yes"
  2072. fi
  2073. fi
  2074. if test "$ENABLED_RSAPSS" = "yes"
  2075. then
  2076. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS"
  2077. fi
  2078. # DH
  2079. AC_ARG_ENABLE([dh],
  2080. [AS_HELP_STRING([--enable-dh],[Enable DH (default: enabled)])],
  2081. [ ENABLED_DH=$enableval ],
  2082. [ ENABLED_DH=yes ]
  2083. )
  2084. if test "$ENABLED_OPENSSH" = "yes"
  2085. then
  2086. ENABLED_DH="yes"
  2087. fi
  2088. if test "$ENABLED_DH" = "no"
  2089. then
  2090. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  2091. else
  2092. # turn off DH if leanpsk or leantls on
  2093. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2094. then
  2095. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  2096. ENABLED_DH=no
  2097. fi
  2098. fi
  2099. # Anonymous
  2100. AC_ARG_ENABLE([anon],
  2101. [AS_HELP_STRING([--enable-anon],[Enable Anonymous (default: disabled)])],
  2102. [ ENABLED_ANON=$enableval ],
  2103. [ ENABLED_ANON=no ]
  2104. )
  2105. if test "x$ENABLED_WPAS" = "xyes"
  2106. then
  2107. ENABLED_ANON=yes
  2108. fi
  2109. if test "x$ENABLED_ANON" = "xyes"
  2110. then
  2111. if test "x$ENABLED_DH" != "xyes"
  2112. then
  2113. AC_MSG_ERROR([Anonymous suite requires DH.])
  2114. fi
  2115. AM_CFLAGS="$AM_CFLAGS -DHAVE_ANON"
  2116. fi
  2117. # ASN
  2118. # turn off asn, which means no certs, no rsa, no dsa, no ecc,
  2119. # and no big int (unless dh is on)
  2120. AC_ARG_ENABLE([asn],
  2121. [AS_HELP_STRING([--enable-asn],[Enable ASN (default: enabled)])],
  2122. [ ENABLED_ASN=$enableval ],
  2123. [ ENABLED_ASN=yes ]
  2124. )
  2125. if test "$ENABLED_ASN" = "no"
  2126. then
  2127. AM_CFLAGS="$AM_CFLAGS -DNO_ASN"
  2128. if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no"
  2129. then
  2130. # DH and ECC need bigint
  2131. AM_CFLAGS="$AM_CFLAGS -DNO_BIG_INT"
  2132. fi
  2133. else
  2134. # turn off ASN if leanpsk on
  2135. if test "$ENABLED_LEANPSK" = "yes"
  2136. then
  2137. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_BIG_INT"
  2138. ENABLED_ASN=no
  2139. else
  2140. if test "$ENABLED_ASN" = "nocrypt"
  2141. then
  2142. AM_CFLAGS="$AM_CFLAGS -DNO_ASN_CRYPT"
  2143. enable_pwdbased=no
  2144. fi
  2145. fi
  2146. fi
  2147. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_RSAVFY" = "no" && test "$ENABLED_ASN" = "no"
  2148. then
  2149. AC_MSG_ERROR([please disable rsa if disabling asn.])
  2150. fi
  2151. if test "$ENABLED_DSA" = "yes" && test "$ENABLED_ASN" = "no"
  2152. then
  2153. AC_MSG_ERROR([please disable dsa if disabling asn.])
  2154. fi
  2155. # DH and ECC need bigint
  2156. if test "$ENABLED_ASN" = "no" && test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no" && test "$ENABLED_RSA" = "no"
  2157. then
  2158. ENABLED_FASTMATH=no
  2159. ENABLED_SLOWMATH=no
  2160. fi
  2161. # AES
  2162. AC_ARG_ENABLE([aes],
  2163. [AS_HELP_STRING([--enable-aes],[Enable AES (default: enabled)])],
  2164. [ ENABLED_AES=$enableval ],
  2165. [ ENABLED_AES=yes ]
  2166. )
  2167. if test "$ENABLED_AES" = "no"
  2168. then
  2169. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  2170. if test "$ENABLED_FORTRESS" = "yes"
  2171. then
  2172. AC_MSG_ERROR([fortress requires aes])
  2173. fi
  2174. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  2175. then
  2176. AC_MSG_ERROR([cannot enable eccencrypt and hkdf without aes.])
  2177. fi
  2178. if test "$ENABLED_AESGCM" = "yes"
  2179. then
  2180. AC_MSG_ERROR([AESGCM requires AES.])
  2181. fi
  2182. if test "$ENABLED_AESCCM" = "yes"
  2183. then
  2184. AC_MSG_ERROR([AESCCM requires AES.])
  2185. fi
  2186. if test "$ENABLED_AESCTR" = "yes"
  2187. then
  2188. AC_MSG_ERROR([AESCTR requires AES.])
  2189. fi
  2190. else
  2191. # turn off AES if leanpsk on
  2192. if test "$ENABLED_LEANPSK" = "yes"
  2193. then
  2194. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  2195. ENABLED_AES=no
  2196. fi
  2197. fi
  2198. # CODING
  2199. AC_ARG_ENABLE([coding],
  2200. [AS_HELP_STRING([--enable-coding],[Enable Coding base 16/64 (default: enabled)])],
  2201. [ ENABLED_CODING=$enableval ],
  2202. [ ENABLED_CODING=yes ]
  2203. )
  2204. if test "$ENABLED_CODING" = "no"
  2205. then
  2206. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  2207. else
  2208. # turn off CODING if leanpsk on
  2209. if test "$ENABLED_LEANPSK" = "yes"
  2210. then
  2211. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  2212. ENABLED_CODING=no
  2213. fi
  2214. fi
  2215. # Base64 Encode
  2216. BASE64ENCODE_DEFAULT=no
  2217. if test "$host_cpu" = "x86_64"
  2218. then
  2219. BASE64ENCODE_DEFAULT=yes
  2220. fi
  2221. AC_ARG_ENABLE([base64encode],
  2222. [AS_HELP_STRING([--enable-base64encode],[Enable Base64 encoding (default: enabled on x86_64)])],
  2223. [ ENABLED_BASE64ENCODE=$enableval ],
  2224. [ ENABLED_BASE64ENCODE=$BASE64ENCODE_DEFAULT ]
  2225. )
  2226. if test "$ENABLED_BASE64ENCODE" = "yes"
  2227. then
  2228. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BASE64_ENCODE"
  2229. fi
  2230. # Base16
  2231. AC_ARG_ENABLE([base16],
  2232. [AS_HELP_STRING([--enable-base16],[Enable Base16 encoding/decoding (default: disabled)])],
  2233. [ ENABLED_BASE16=$enableval ],
  2234. [ ENABLED_BASE16=no ]
  2235. )
  2236. if test "$ENABLED_BASE16" = "yes"
  2237. then
  2238. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BASE16"
  2239. fi
  2240. # DES3
  2241. AC_ARG_ENABLE([des3],
  2242. [AS_HELP_STRING([--enable-des3],[Enable DES3 (default: disabled)])],
  2243. [ ENABLED_DES3=$enableval ],
  2244. [ ENABLED_DES3=no ]
  2245. )
  2246. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_QT" = "yes" || test "$ENABLED_OPENVPN" = "yes" || test "x$ENABLED_WPAS" != "xno"
  2247. then
  2248. ENABLED_DES3="yes"
  2249. fi
  2250. # IDEA
  2251. AC_ARG_ENABLE([idea],
  2252. [AS_HELP_STRING([--enable-idea],[Enable IDEA Cipher (default: disabled)])],
  2253. [ ENABLED_IDEA=$enableval ],
  2254. [ ENABLED_IDEA=no ]
  2255. )
  2256. if test "x$ENABLED_IDEA" = "xyes"
  2257. then
  2258. AM_CFLAGS="$AM_CFLAGS -DHAVE_IDEA"
  2259. fi
  2260. # ARC4
  2261. AC_ARG_ENABLE([arc4],
  2262. [AS_HELP_STRING([--enable-arc4],[Enable ARC4 (default: disabled)])],
  2263. [ ENABLED_ARC4=$enableval ],
  2264. [ ENABLED_ARC4=no ]
  2265. )
  2266. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes"
  2267. then
  2268. ENABLED_ARC4="yes"
  2269. fi
  2270. if test "$ENABLED_ARC4" = "no"
  2271. then
  2272. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  2273. else
  2274. # turn off ARC4 if leanpsk or leantls on
  2275. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2276. then
  2277. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  2278. ENABLED_ARC4=no
  2279. fi
  2280. fi
  2281. # MD5
  2282. AC_ARG_ENABLE([md5],
  2283. [AS_HELP_STRING([--enable-md5],[Enable MD5 (default: enabled)])],
  2284. [ ENABLED_MD5=$enableval ],
  2285. [ ENABLED_MD5=yes ]
  2286. )
  2287. if test "$ENABLED_MD5" = "no"
  2288. then
  2289. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  2290. else
  2291. # turn off MD5 if leanpsk or leantls on
  2292. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2293. then
  2294. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  2295. ENABLED_MD5=no
  2296. fi
  2297. fi
  2298. # SHA
  2299. AC_ARG_ENABLE([sha],
  2300. [AS_HELP_STRING([--enable-sha],[Enable SHA (default: enabled)])],
  2301. [ ENABLED_SHA=$enableval ],
  2302. [ ENABLED_SHA=yes ]
  2303. )
  2304. if test "$ENABLED_SHA" = "no"
  2305. then
  2306. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  2307. else
  2308. # turn off SHA if leanpsk or leantls on
  2309. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2310. then
  2311. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  2312. ENABLED_SHA=no
  2313. fi
  2314. fi
  2315. # CMAC
  2316. AC_ARG_ENABLE([cmac],
  2317. [AS_HELP_STRING([--enable-cmac],[Enable CMAC (default: disabled)])],
  2318. [ ENABLED_CMAC=$enableval ],
  2319. [ ENABLED_CMAC=no ]
  2320. )
  2321. if test "$ENABLED_WPAS" != "no"
  2322. then
  2323. ENABLED_CMAC=yes
  2324. fi
  2325. AS_IF([test "x$ENABLED_CMAC" = "xyes"],
  2326. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC -DWOLFSSL_AES_DIRECT"])
  2327. # AES-XTS
  2328. AC_ARG_ENABLE([xts],
  2329. [AS_HELP_STRING([--enable-xts],[Enable XTS (default: disabled)])],
  2330. [ ENABLED_XTS=$enableval ],
  2331. [ ENABLED_XTS=no ]
  2332. )
  2333. AS_IF([test "x$ENABLED_XTS" = "xyes"],
  2334. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_XTS -DWOLFSSL_AES_DIRECT"])
  2335. # Web Server Build
  2336. AC_ARG_ENABLE([webserver],
  2337. [AS_HELP_STRING([--enable-webserver],[Enable Web Server (default: disabled)])],
  2338. [ ENABLED_WEBSERVER=$enableval ],
  2339. [ ENABLED_WEBSERVER=no ]
  2340. )
  2341. if test "$ENABLED_WEBSERVER" = "yes"
  2342. then
  2343. AM_CFLAGS="$AM_CFLAGS -DHAVE_WEBSERVER"
  2344. fi
  2345. # Web Client Build (HTTP Client)
  2346. AC_ARG_ENABLE([webclient],
  2347. [AS_HELP_STRING([--enable-webclient],[Enable Web Client (HTTP) (default: disabled)])],
  2348. [ ENABLED_WEBCLIENT=$enableval ],
  2349. [ ENABLED_WEBCLIENT=no ]
  2350. )
  2351. if test "$ENABLED_WEBCLIENT" = "yes"
  2352. then
  2353. AM_CFLAGS="$AM_CFLAGS -DHAVE_HTTP_CLIENT"
  2354. fi
  2355. # HC128
  2356. AC_ARG_ENABLE([hc128],
  2357. [AS_HELP_STRING([--enable-hc128],[Enable HC-128 (default: disabled)])],
  2358. [ ENABLED_HC128=$enableval ],
  2359. [ ENABLED_HC128=no ]
  2360. )
  2361. if test "$ENABLED_HC128" = "no"
  2362. then
  2363. AM_CFLAGS="$AM_CFLAGS -DNO_HC128"
  2364. else
  2365. AM_CFLAGS="$AM_CFLAGS -DHAVE_HC128"
  2366. fi
  2367. # RABBIT
  2368. AC_ARG_ENABLE([rabbit],
  2369. [AS_HELP_STRING([--enable-rabbit],[Enable RABBIT (default: disabled)])],
  2370. [ ENABLED_RABBIT=$enableval ],
  2371. [ ENABLED_RABBIT=no ]
  2372. )
  2373. if test "$ENABLED_RABBIT" = "no"
  2374. then
  2375. AM_CFLAGS="$AM_CFLAGS -DNO_RABBIT"
  2376. else
  2377. AM_CFLAGS="$AM_CFLAGS -DHAVE_RABBIT"
  2378. fi
  2379. # RC2
  2380. AC_ARG_ENABLE([rc2],
  2381. [AS_HELP_STRING([--enable-rc2],[Enable RC2 encryption (default: disabled)])],
  2382. [ ENABLED_RC2=$enableval ],
  2383. [ ENABLED_RC2=no ]
  2384. )
  2385. if test "$ENABLED_RC2" = "yes"
  2386. then
  2387. AM_CFLAGS="$AM_CFLAGS -DWC_RC2"
  2388. fi
  2389. # FIPS
  2390. AS_CASE([$FIPS_VERSION],
  2391. ["v2"],[
  2392. AS_IF([test "x$FIPS_READY" = "xyes"],
  2393. [AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS_VERSION=3"],
  2394. [AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS_VERSION=2"])
  2395. AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS -DWOLFSSL_KEY_GEN -DWOLFSSL_SHA224 -DWOLFSSL_AES_DIRECT -DHAVE_AES_ECB -DHAVE_ECC_CDH -DWC_RSA_NO_PADDING -DWOLFSSL_VALIDATE_FFC_IMPORT -DHAVE_FFDHE_Q"
  2396. ENABLED_KEYGEN="yes"
  2397. ENABLED_SHA224="yes"
  2398. # Shake256 is a SHA-3 algorithm not in our FIPS algorithm list
  2399. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_SHAKE256"
  2400. AS_IF([test "x$ENABLED_AESCCM" != "xyes"],
  2401. [ENABLED_AESCCM="yes"
  2402. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"])
  2403. AS_IF([test "x$ENABLED_RSAPSS" != "xyes"],
  2404. [ENABLED_RSAPSS="yes"
  2405. AM_CFLAGS="$AM_CFLAGS -DWC_RSA_PSS"])
  2406. AS_IF([test "x$ENABLED_ECC" != "xyes"],
  2407. [ENABLED_ECC="yes"
  2408. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DWOLFSSL_VALIDATE_ECC_IMPORT"
  2409. AS_IF([test "x$ENABLED_ECC_SHAMIR" = "xyes"],
  2410. [AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"])],
  2411. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_IMPORT"])
  2412. AS_IF([test "x$ENABLED_AESCTR" != "xyes"],
  2413. [ENABLED_AESCTR="yes"
  2414. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER"])
  2415. AS_IF([test "x$ENABLED_CMAC" != "xyes"],
  2416. [ENABLED_CMAC="yes"
  2417. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC"])
  2418. AS_IF([test "x$ENABLED_HKDF" != "xyes"],
  2419. [ENABLED_HKDF="yes"
  2420. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"])
  2421. AS_IF([test "x$ENABLED_INTELASM" = "xyes"],
  2422. [AM_CFLAGS="$AM_CFLAGS -DFORCE_FAILURE_RDSEED"])
  2423. ],
  2424. ["rand"],[
  2425. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_FIPS_RAND -DHAVE_FIPS -DHAVE_FIPS_VERSION=2"
  2426. ],
  2427. ["v1"],[
  2428. AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS"
  2429. ])
  2430. AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$thread_ls_on" = "xno"],
  2431. [AC_MSG_ERROR([FIPS requires Thread Local Storage])])
  2432. AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$FIPS_VERSION" != "xrand"],
  2433. [
  2434. # Force enable the prerequisites.
  2435. AS_IF([test "x$ENABLED_SHA512" = "xno"],
  2436. [ENABLED_SHA512="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"])
  2437. AS_IF([test "x$ENABLED_AESGCM" = "xno"],
  2438. [ENABLED_AESGCM="yes"; AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"])
  2439. AS_IF([test "x$ENABLED_DES3" = "xno"],[ENABLED_DES3="yes"])
  2440. ],
  2441. [
  2442. AS_IF([test "x$ENABLED_FORTRESS" = "xyes"],[ENABLED_DES3="yes"])
  2443. ])
  2444. # SELFTEST
  2445. AC_ARG_ENABLE([selftest],
  2446. [AS_HELP_STRING([--enable-selftest],[Enable selftest, Will NOT work w/o CAVP selftest license (default: disabled)])],
  2447. [ ENABLED_SELFTEST=$enableval ],
  2448. [ ENABLED_SELFTEST="no" ]
  2449. )
  2450. AS_CASE([$ENABLED_SELFTEST],
  2451. ["v2"],[
  2452. # selftest v2 (wolfCrypt 4.1.0)
  2453. ENABLED_SELFTEST="yes"
  2454. SELFTEST_VERSION="v2"
  2455. ],
  2456. ["no"],[SELFTEST_VERSION="none"],
  2457. [
  2458. # selftest v1 (wolfCrypt 3.14.2)
  2459. ENABLED_SELFTEST="yes"
  2460. SELFTEST_VERSION="v1"
  2461. ])
  2462. AS_CASE([$SELFTEST_VERSION],
  2463. ["v2"],[
  2464. AM_CFLAGS="$AM_CFLAGS -DHAVE_SELFTEST -DHAVE_SELFTEST_VERSION=2"
  2465. ],
  2466. ["v1"],[
  2467. AM_CFLAGS="$AM_CFLAGS -DHAVE_SELFTEST"
  2468. ])
  2469. # set sha224 default
  2470. SHA224_DEFAULT=no
  2471. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64"
  2472. then
  2473. if test "x$ENABLED_AFALG" = "xno" && test "x$ENABLED_DEVCRYPTO" = "xno" && ( test "x$ENABLED_FIPS" = "xno" || test "x$FIPS_VERSION" = "xv2" )
  2474. then
  2475. SHA224_DEFAULT=yes
  2476. fi
  2477. fi
  2478. # SHA224
  2479. AC_ARG_ENABLE([sha224],
  2480. [AS_HELP_STRING([--enable-sha224],[Enable wolfSSL SHA-224 support (default: enabled on x86_64/aarch64)])],
  2481. [ ENABLED_SHA224=$enableval ],
  2482. [ ENABLED_SHA224=$SHA224_DEFAULT ]
  2483. )
  2484. if test "$ENABLED_SHA224" = "yes"
  2485. then
  2486. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA224"
  2487. fi
  2488. # set sha3 default
  2489. SHA3_DEFAULT=no
  2490. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64"
  2491. then
  2492. if test "x$ENABLED_FIPS" = "xno" || test "x$FIPS_VERSION" = "xv2"
  2493. then
  2494. SHA3_DEFAULT=yes
  2495. fi
  2496. fi
  2497. # SHA3
  2498. AC_ARG_ENABLE([sha3],
  2499. [AS_HELP_STRING([--enable-sha3],[Enable wolfSSL SHA-3 support (default: enabled on x86_64/aarch64)])],
  2500. [ ENABLED_SHA3=$enableval ],
  2501. [ ENABLED_SHA3=$SHA3_DEFAULT ]
  2502. )
  2503. if test "$ENABLED_SHA3" = "small"
  2504. then
  2505. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3_SMALL"
  2506. ENABLED_SHA3="yes"
  2507. fi
  2508. if test "$ENABLED_SHA3" = "yes" && test "$ENABLED_32BIT" = "no"
  2509. then
  2510. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3"
  2511. fi
  2512. # SHAKE256
  2513. AC_ARG_ENABLE([shake256],
  2514. [AS_HELP_STRING([--enable-shake256],[Enable wolfSSL SHAKE256 support (default: enabled on x86_64/aarch64)])],
  2515. [ ENABLED_SHAKE256=$enableval ],
  2516. [ ENABLED_SHAKE256=$ENABLED_SHA3 ]
  2517. )
  2518. if test "$ENABLED_SHAKE256" = "yes" || test "$ENABLED_SHAKE256" = "small"
  2519. then
  2520. if test "$ENABLED_32BIT" = "no"
  2521. then
  2522. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHAKE256"
  2523. if test "$ENABLED_SHA3" = "no"
  2524. then
  2525. AC_MSG_ERROR([Must have SHA-3 enabled: --enable-sha3])
  2526. fi
  2527. fi
  2528. fi
  2529. # set POLY1305 default
  2530. POLY1305_DEFAULT=yes
  2531. if test "x$ENABLED_FIPS" = "xyes"
  2532. then
  2533. POLY1305_DEFAULT=no
  2534. fi
  2535. # POLY1305
  2536. AC_ARG_ENABLE([poly1305],
  2537. [AS_HELP_STRING([--enable-poly1305],[Enable wolfSSL POLY1305 support (default: enabled)])],
  2538. [ ENABLED_POLY1305=$enableval ],
  2539. [ ENABLED_POLY1305=$POLY1305_DEFAULT]
  2540. )
  2541. # leanpsk and leantls don't need poly1305
  2542. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2543. then
  2544. ENABLED_POLY1305=no
  2545. fi
  2546. if test "$ENABLED_POLY1305" = "yes"
  2547. then
  2548. AM_CFLAGS="$AM_CFLAGS -DHAVE_POLY1305 -DHAVE_ONE_TIME_AUTH"
  2549. fi
  2550. # set CHACHA default
  2551. CHACHA_DEFAULT=yes
  2552. if test "x$ENABLED_FIPS" = "xyes"
  2553. then
  2554. CHACHA_DEFAULT=no
  2555. fi
  2556. # CHACHA
  2557. AC_ARG_ENABLE([chacha],
  2558. [AS_HELP_STRING([--enable-chacha],[Enable CHACHA (default: enabled). Use `=noasm` to disable ASM AVX/AVX2 speedups])],
  2559. [ ENABLED_CHACHA=$enableval ],
  2560. [ ENABLED_CHACHA=$CHACHA_DEFAULT]
  2561. )
  2562. # leanpsk and leantls don't need chacha
  2563. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2564. then
  2565. ENABLED_CHACHA=no
  2566. fi
  2567. if test "$ENABLED_CHACHA" = "noasm" || test "$ENABLED_ASM" = "no"
  2568. then
  2569. AM_CFLAGS="$AM_CFLAGS -DNO_CHACHA_ASM"
  2570. fi
  2571. if test "$ENABLED_CHACHA" = "yes"
  2572. then
  2573. AM_CFLAGS="$AM_CFLAGS -DHAVE_CHACHA"
  2574. fi
  2575. # XCHACHA
  2576. AC_ARG_ENABLE([xchacha],
  2577. [AS_HELP_STRING([--enable-xchacha],[Enable XCHACHA (default: disabled).])],
  2578. [ ENABLED_XCHACHA=$enableval ],
  2579. [ ENABLED_XCHACHA=no]
  2580. )
  2581. if test "$ENABLED_XCHACHA" = "yes"
  2582. then
  2583. if test "$ENABLED_CHACHA" = "no"
  2584. then
  2585. AC_MSG_ERROR([XChaCha (--enable-xchacha) depends on ChaCha (--enable-chacha)])
  2586. fi
  2587. AM_CFLAGS="$AM_CFLAGS -DHAVE_XCHACHA"
  2588. fi
  2589. # Hash DRBG
  2590. AC_ARG_ENABLE([hashdrbg],
  2591. [AS_HELP_STRING([--enable-hashdrbg],[Enable Hash DRBG support (default: enabled)])],
  2592. [ ENABLED_HASHDRBG=$enableval ],
  2593. [ ENABLED_HASHDRBG=yes ]
  2594. )
  2595. if test "x$ENABLED_HASHDRBG" = "xyes"
  2596. then
  2597. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  2598. else
  2599. # turn on Hash DRBG if FIPS is on
  2600. if test "x$ENABLED_FIPS" = "xyes"
  2601. then
  2602. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  2603. ENABLED_HASHDRBG=yes
  2604. else
  2605. AM_CFLAGS="$AM_CFLAGS -DWC_NO_HASHDRBG"
  2606. fi
  2607. fi
  2608. # Filesystem Build
  2609. if test "$ENABLED_LINUXKM" = "yes"
  2610. then
  2611. ENABLED_FILESYSTEM_DEFAULT=no
  2612. else
  2613. ENABLED_FILESYSTEM_DEFAULT=yes
  2614. fi
  2615. AC_ARG_ENABLE([filesystem],
  2616. [AS_HELP_STRING([--enable-filesystem],[Enable Filesystem support (default: enabled)])],
  2617. [ ENABLED_FILESYSTEM=$enableval ],
  2618. [ ENABLED_FILESYSTEM=$ENABLED_FILESYSTEM_DEFAULT ]
  2619. )
  2620. if test "$ENABLED_FILESYSTEM" = "no"
  2621. then
  2622. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  2623. else
  2624. # turn off filesystem if leanpsk on
  2625. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LINUXKM" = "yes"
  2626. then
  2627. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  2628. ENABLED_FILESYSTEM=no
  2629. fi
  2630. fi
  2631. # inline Build
  2632. AC_ARG_ENABLE([inline],
  2633. [AS_HELP_STRING([--enable-inline],[Enable inline functions (default: enabled)])],
  2634. [ ENABLED_INLINE=$enableval ],
  2635. [ ENABLED_INLINE=yes ]
  2636. )
  2637. if test "$ENABLED_INLINE" = "no"
  2638. then
  2639. AM_CFLAGS="$AM_CFLAGS -DNO_INLINE"
  2640. fi
  2641. # OCSP
  2642. AC_ARG_ENABLE([ocsp],
  2643. [AS_HELP_STRING([--enable-ocsp],[Enable OCSP (default: disabled)])],
  2644. [ ENABLED_OCSP=$enableval ],
  2645. [ ENABLED_OCSP=no ],
  2646. )
  2647. if test "x$ENABLED_OPENSSLALL" = "xyes" || test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  2648. then
  2649. ENABLED_OCSP=yes
  2650. fi
  2651. if test "$ENABLED_OCSP" = "yes"
  2652. then
  2653. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  2654. fi
  2655. if test "$ENABLED_OCSP" = "yes"
  2656. then
  2657. # check openssl command tool for testing ocsp
  2658. AC_CHECK_PROG([HAVE_OPENSSL_CMD],[openssl],[yes],[no])
  2659. if test "$HAVE_OPENSSL_CMD" = "yes"
  2660. then
  2661. AM_CFLAGS="$AM_CFLAGS -DHAVE_OPENSSL_CMD"
  2662. else
  2663. AC_MSG_WARN([openssl command line tool not available for testing ocsp])
  2664. fi
  2665. fi
  2666. # Certificate Status Request : a.k.a. OCSP Stapling
  2667. AC_ARG_ENABLE([ocspstapling],
  2668. [AS_HELP_STRING([--enable-ocspstapling],[Enable OCSP Stapling (default: disabled)])],
  2669. [ ENABLED_CERTIFICATE_STATUS_REQUEST=$enableval ],
  2670. [ ENABLED_CERTIFICATE_STATUS_REQUEST=no ]
  2671. )
  2672. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  2673. then
  2674. ENABLED_CERTIFICATE_STATUS_REQUEST="yes"
  2675. fi
  2676. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"
  2677. then
  2678. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST"
  2679. # Requires OCSP make sure on
  2680. if test "x$ENABLED_OCSP" = "xno"
  2681. then
  2682. ENABLED_OCSP="yes"
  2683. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  2684. fi
  2685. fi
  2686. # Certificate Status Request v2 : a.k.a. OCSP stapling v2
  2687. AC_ARG_ENABLE([ocspstapling2],
  2688. [AS_HELP_STRING([--enable-ocspstapling2],[Enable OCSP Stapling v2 (default: disabled)])],
  2689. [ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=$enableval ],
  2690. [ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=no ]
  2691. )
  2692. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  2693. then
  2694. ENABLED_CERTIFICATE_STATUS_REQUEST_V2=yes
  2695. fi
  2696. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"
  2697. then
  2698. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST_V2"
  2699. # Requires OCSP make sure on
  2700. if test "x$ENABLED_OCSP" = "xno"
  2701. then
  2702. ENABLED_OCSP="yes"
  2703. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  2704. fi
  2705. fi
  2706. # CRL
  2707. AC_ARG_ENABLE([crl],
  2708. [AS_HELP_STRING([--enable-crl],[Enable CRL (default: disabled)])],
  2709. [ ENABLED_CRL=$enableval ],
  2710. [ ENABLED_CRL=no ],
  2711. )
  2712. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_OPENVPN" = "xyes" || test "x$ENABLED_WPAS" != "xno" || test "x$ENABLED_LIGHTY" = "xyes"
  2713. then
  2714. ENABLED_CRL=yes
  2715. fi
  2716. if test "$ENABLED_CRL" = "yes"
  2717. then
  2718. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  2719. fi
  2720. # CRL Monitor
  2721. AC_ARG_ENABLE([crl-monitor],
  2722. [AS_HELP_STRING([--enable-crl-monitor],[Enable CRL Monitor (default: disabled)])],
  2723. [ ENABLED_CRL_MONITOR=$enableval ],
  2724. [ ENABLED_CRL_MONITOR=no ],
  2725. )
  2726. if test "$ENABLED_CRL_MONITOR" = "yes"
  2727. then
  2728. case $host_os in
  2729. *linux* | *darwin* | *freebsd*)
  2730. if test "x$ENABLED_SINGLETHREADED" = "xno"; then
  2731. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR"
  2732. else
  2733. ENABLED_CRL_MONITOR="no"
  2734. AC_MSG_ERROR([crl monitor requires threading / pthread])
  2735. fi
  2736. ;;
  2737. *)
  2738. if test "x$ENABLED_DISTRO" = "xyes" ; then
  2739. ENABLED_CRL_MONITOR="no"
  2740. else
  2741. AC_MSG_ERROR( [crl monitor only allowed on linux, OS X, or freebsd])
  2742. fi
  2743. break;;
  2744. esac
  2745. fi
  2746. # USER CRYPTO
  2747. ENABLED_USER_CRYPTO="no"
  2748. ENABLED_USER_RSA="no"
  2749. AC_DEFINE([BUILD_USER_RSA], [], [User RSA is being defined])
  2750. trycryptodir=""
  2751. AC_ARG_WITH([user-crypto],
  2752. [AS_HELP_STRING([--with-user-crypto=PATH],[Path to USER_CRYPTO install (default /usr/local)])],
  2753. [
  2754. CPPFLAGS="$CPPFLAGS -DHAVE_USER_CRYPTO"
  2755. LIBS="$LIBS -lusercrypto"
  2756. if test "x$withval" != "xno" ; then
  2757. trycryptodir=$withval
  2758. fi
  2759. if test "x$withval" = "xyes" ; then
  2760. trycryptodir="/usr/local"
  2761. fi
  2762. LDFLAGS="$LDFLAGS -L$trycryptodir/lib"
  2763. CPPFLAGS="$CPPFLAGS -I$trycryptodir/include"
  2764. #Look for RSA Init function in usercrypto lib
  2765. AC_CHECK_LIB([usercrypto], [wc_InitRsaKey], [user_rsa_linked=yes], [user_rsa_linked=no])
  2766. if test "x$user_rsa_linked" = "xyes" ; then
  2767. AC_MSG_NOTICE([User user_rsa.h being used])
  2768. AM_CFLAGS="$AM_CFLAGS -DHAVE_USER_RSA"
  2769. ENABLED_USER_RSA=yes
  2770. ENABLED_USER_CRYPTO=yes
  2771. fi
  2772. #Display check and find result of link attempts
  2773. AC_MSG_CHECKING([for USER_CRYPTO])
  2774. if test "x$ENABLED_USER_CRYPTO" = "xno" ; then
  2775. AC_MSG_RESULT([no])
  2776. AC_MSG_ERROR([USER_CRYPTO not found. Either move to /usr/include and /usr/lib or
  2777. Specify its path using --with-user-crypto=/dir/])
  2778. else
  2779. AC_MSG_RESULT([yes])
  2780. # Check if .la is available if not then rely on exported path
  2781. AC_CHECK_FILE($trycryptodir/lib/libusercrypto.la, [LIB_ADD="$trycryptodir/lib/libusercrypto.la $LIB_ADD"], [LIB_ADD="-lusercrypto $LIB_ADD"])
  2782. AM_LDFLAGS="$AM_LDFLAGS -L$trycryptodir/lib"
  2783. AM_CFLAGS="$AM_CFLAGS -DHAVE_USER_CRYPTO"
  2784. fi
  2785. ]
  2786. )
  2787. if test "$ENABLED_USER_CRYPTO" = "yes" && test "$ENABLED_FIPS" = "yes"
  2788. then
  2789. AC_MSG_ERROR([cannot enable user crypto and fips, user crypto posibility of using code in fips boundary.])
  2790. fi
  2791. # NTRU
  2792. ENABLED_NTRU="no"
  2793. tryntrudir=""
  2794. AC_ARG_WITH([ntru],
  2795. [AS_HELP_STRING([--with-ntru=PATH],[Path to NTRU install (default /usr/)])],
  2796. [
  2797. AC_MSG_CHECKING([for NTRU])
  2798. CPPFLAGS="$CPPFLAGS -DHAVE_NTRU -DHAVE_TLS_EXTENSIONS"
  2799. LIBS="$LIBS -lntruencrypt"
  2800. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libntruencrypt/ntru_crypto_drbg.h>]], [[ ntru_crypto_drbg_instantiate(0, 0, 0, 0, 0); ]])], [ ntru_linked=yes ],[ ntru_linked=no ])
  2801. if test "x$ntru_linked" = "xno" ; then
  2802. if test "x$withval" != "xno" ; then
  2803. tryntrudir=$withval
  2804. fi
  2805. if test "x$withval" = "xyes" ; then
  2806. tryntrudir="/usr"
  2807. fi
  2808. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$tryntrudir/lib"
  2809. CPPFLAGS="$CPPFLAGS -I$tryntrudir/include"
  2810. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libntruencrypt/ntru_crypto_drbg.h>]], [[ ntru_crypto_drbg_instantiate(0, 0, 0, 0, 0); ]])], [ ntru_linked=yes ],[ ntru_linked=no ])
  2811. if test "x$ntru_linked" = "xno" ; then
  2812. AC_MSG_ERROR([NTRU isn't found.
  2813. If it's already installed, specify its path using --with-ntru=/dir/])
  2814. fi
  2815. AC_MSG_RESULT([yes])
  2816. AM_LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
  2817. else
  2818. AC_MSG_RESULT([yes])
  2819. fi
  2820. AM_CFLAGS="$AM_CFLAGS -DHAVE_NTRU -DHAVE_TLS_EXTENSIONS -DWOLFSSL_STATIC_RSA"
  2821. ENABLED_NTRU="yes"
  2822. ]
  2823. )
  2824. # QSH
  2825. AC_ARG_ENABLE([qsh],
  2826. [AS_HELP_STRING([--enable-qsh],[Enable QSH (default: disabled)])],
  2827. [ ENABLED_QSH=$enableval ],
  2828. [ ENABLED_QSH=no ]
  2829. )
  2830. if test "x$ENABLED_QSH" = "xyes"
  2831. then
  2832. if test "x$ENABLED_NTRU" = "xno"
  2833. then
  2834. AC_MSG_ERROR([cannot enable qsh without NTRU])
  2835. fi
  2836. AM_CFLAGS="$AM_CFLAGS -DHAVE_QSH -DWOLFSSL_STATIC_DH -DWOLFSSL_STATIC_PSK"
  2837. fi
  2838. # Whitewood netRandom client library
  2839. ENABLED_WNR="no"
  2840. trywnrdir=""
  2841. AC_ARG_WITH([wnr],
  2842. [AS_HELP_STRING([--with-wnr=PATH],[Path to Whitewood netRandom install (default /usr/local)])],
  2843. [
  2844. AC_MSG_CHECKING([for Whitewood netRandom])
  2845. CPPFLAGS="$CPPFLAGS -DHAVE_WNR"
  2846. LIBS="$LIBS -lwnr"
  2847. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wnr.h>]], [[ wnr_setup(0, 0); ]])], [ wnr_linked=yes ],[ wnr_linked=no ])
  2848. if test "x$wnr_linked" = "xno" ; then
  2849. if test "x$withval" != "xno" ; then
  2850. trywnrdir=$withval
  2851. fi
  2852. if test "x$withval" = "xyes" ; then
  2853. trywnrdir="/usr/local"
  2854. fi
  2855. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$trywnrdir/lib"
  2856. CPPFLAGS="$CPPFLAGS -I$trywnrdir/include"
  2857. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wnr.h>]], [[ wnr_setup(0, 0); ]])], [ wnr_linked=yes ],[ wnr_linked=no ])
  2858. if test "x$wnr_linked" = "xno" ; then
  2859. AC_MSG_ERROR([Whitewood netRandom isn't found.
  2860. If it's already installed, specify its path using --with-wnr=/dir/])
  2861. fi
  2862. AC_MSG_RESULT([yes])
  2863. AM_LDFLAGS="$AM_LDFLAGS -L$trywnrdir/lib"
  2864. else
  2865. AC_MSG_RESULT([yes])
  2866. fi
  2867. AM_CFLAGS="$AM_CFLAGS -DHAVE_WNR"
  2868. ENABLED_WNR="yes"
  2869. ]
  2870. )
  2871. # SNI
  2872. AC_ARG_ENABLE([sni],
  2873. [AS_HELP_STRING([--enable-sni],[Enable SNI (default: disabled)])],
  2874. [ ENABLED_SNI=$enableval ],
  2875. [ ENABLED_SNI=no ]
  2876. )
  2877. if test "x$ENABLED_QT" = "xyes"
  2878. then
  2879. ENABLED_SNI="yes"
  2880. fi
  2881. if test "x$ENABLED_SNI" = "xyes"
  2882. then
  2883. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  2884. fi
  2885. # Maximum Fragment Length
  2886. AC_ARG_ENABLE([maxfragment],
  2887. [AS_HELP_STRING([--enable-maxfragment],[Enable Maximum Fragment Length (default: disabled)])],
  2888. [ ENABLED_MAX_FRAGMENT=$enableval ],
  2889. [ ENABLED_MAX_FRAGMENT=no ]
  2890. )
  2891. # ALPN
  2892. AC_ARG_ENABLE([alpn],
  2893. [AS_HELP_STRING([--enable-alpn],[Enable ALPN (default: disabled)])],
  2894. [ ENABLED_ALPN=$enableval ],
  2895. [ ENABLED_ALPN=no ]
  2896. )
  2897. if test "x$ENABLED_ALPN" = "xyes"
  2898. then
  2899. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
  2900. fi
  2901. # Maximum Fragment Length
  2902. if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
  2903. then
  2904. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
  2905. fi
  2906. # Trusted CA Indication Extension
  2907. AC_ARG_ENABLE([trustedca],
  2908. [AS_HELP_STRING([--enable-trustedca],[Enable Trusted CA Indication (default: disabled)])],
  2909. [ ENABLED_TRUSTED_CA=$enableval ],[ ENABLED_TRUSTED_CA=no ])
  2910. AS_IF([test "x$ENABLED_TRUSTED_CA" = "xyes"],
  2911. [AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUSTED_CA"])
  2912. # Truncated HMAC
  2913. AC_ARG_ENABLE([truncatedhmac],
  2914. [AS_HELP_STRING([--enable-truncatedhmac],[Enable Truncated HMAC (default: disabled)])],
  2915. [ ENABLED_TRUNCATED_HMAC=$enableval ],
  2916. [ ENABLED_TRUNCATED_HMAC=no ]
  2917. )
  2918. if test "x$ENABLED_TRUNCATED_HMAC" = "xyes"
  2919. then
  2920. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUNCATED_HMAC"
  2921. fi
  2922. # Renegotiation Indication - (FAKE Secure Renegotiation)
  2923. AC_ARG_ENABLE([renegotiation-indication],
  2924. [AS_HELP_STRING([--enable-renegotiation-indication],[Enable Renegotiation Indication (default: disabled)])],
  2925. [ ENABLED_RENEGOTIATION_INDICATION=$enableval ],
  2926. [ ENABLED_RENEGOTIATION_INDICATION=no ]
  2927. )
  2928. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  2929. then
  2930. AM_CFLAGS="$AM_CFLAGS -DHAVE_RENEGOTIATION_INDICATION"
  2931. fi
  2932. # Secure Renegotiation
  2933. AC_ARG_ENABLE([secure-renegotiation],
  2934. [AS_HELP_STRING([--enable-secure-renegotiation],[Enable Secure Renegotiation (default: disabled)])],
  2935. [ ENABLED_SECURE_RENEGOTIATION=$enableval ],
  2936. [ ENABLED_SECURE_RENEGOTIATION=no ]
  2937. )
  2938. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xyes"
  2939. then
  2940. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  2941. then
  2942. AC_MSG_ERROR([cannot enable renegotiation-indication and secure-renegotiation.])
  2943. fi
  2944. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION -DHAVE_SERVER_RENEGOTIATION_INFO"
  2945. fi
  2946. # Fallback SCSV
  2947. AC_ARG_ENABLE([fallback-scsv],
  2948. [AS_HELP_STRING([--enable-fallback-scsv],[Enable Fallback SCSV (default: disabled)])],
  2949. [ ENABLED_FALLBACK_SCSV=$enableval ],
  2950. [ ENABLED_FALLBACK_SCSV=no ]
  2951. )
  2952. if test "x$ENABLED_FALLBACK_SCSV" = "xyes"
  2953. then
  2954. AM_CFLAGS="$AM_CFLAGS -DHAVE_FALLBACK_SCSV"
  2955. fi
  2956. # Supported Elliptic Curves Extensions
  2957. AC_ARG_ENABLE([supportedcurves],
  2958. [AS_HELP_STRING([--enable-supportedcurves],[Enable Supported Elliptic Curves (default: enabled)])],
  2959. [ENABLED_SUPPORTED_CURVES=$enableval],
  2960. [ENABLED_SUPPORTED_CURVES=yes])
  2961. if test "x$ENABLED_SUPPORTED_CURVES" = "xyes"
  2962. then
  2963. AS_IF([test "x$ENABLED_ECC" = "xno" && test "x$ENABLED_CURVE25519" = "xno" && test "x$ENABLED_CURVE448" = "xno"],
  2964. [ENABLED_SUPPORTED_CURVES=no],
  2965. [AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES"])
  2966. fi
  2967. # Diffie-Hellman
  2968. if test "$ENABLED_DH" = "yes"
  2969. then
  2970. if test "$ENABLED_TLS13" = "yes" || test "$ENABLED_SUPPORTED_CURVES" = "yes"
  2971. then
  2972. AM_CFLAGS="-DHAVE_FFDHE_2048 $AM_CFLAGS"
  2973. fi
  2974. fi
  2975. # FFDHE parameters only
  2976. AC_ARG_ENABLE([ffdhe-only],
  2977. [AS_HELP_STRING([--enable-ffdhe-only],[Enable using only FFDHE in client (default: disabled)])],
  2978. [ ENABLED_FFDHE_ONLY=$enableval ],
  2979. [ ENABLED_FFDHE_ONLY=no ]
  2980. )
  2981. if test "x$ENABLED_FFDHE_ONLY" = "xyes"
  2982. then
  2983. if test "$ENABLED_DH" = "no"
  2984. then
  2985. AC_MSG_ERROR([FFDHE only support requires DH support])
  2986. fi
  2987. if test "$ENABLED_SUPPORTED_CURVES" = "no"
  2988. then
  2989. AC_MSG_ERROR([FFDHE only support requires Supported Curves extension])
  2990. fi
  2991. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_REQUIRE_FFDHE"
  2992. fi
  2993. # TLS 1.3 Requires either ECC or (RSA/DH), or CURVE25519/ED25519 or CURVE448/ED448
  2994. if test "x$ENABLED_PSK" = "xno" && test "x$ENABLED_ECC" = "xno" && \
  2995. (test "x$ENABLED_RSA" = "xno" || test "x$ENABLED_DH" = "xno") && \
  2996. (test "x$ENABLED_CURVE25519" = "xno" || test "x$ENABLED_ED25519" = "xno") && \
  2997. (test "x$ENABLED_CURVE448" = "xno" || test "x$ENABLED_ED448" = "xno")
  2998. then
  2999. # disable TLS 1.3
  3000. ENABLED_TLS13=no
  3001. fi
  3002. if test "$ENABLED_TLS13" = "yes" && (test "x$ENABLED_ECC" = "xyes" || \
  3003. test "x$ENABLED_DH" = "xyes")
  3004. then
  3005. AM_CFLAGS="-DHAVE_SUPPORTED_CURVES $AM_CFLAGS"
  3006. fi
  3007. if test "$ENABLED_TLS13" = "yes"
  3008. then
  3009. AM_CFLAGS="-DWOLFSSL_TLS13 -DHAVE_TLS_EXTENSIONS $AM_CFLAGS"
  3010. fi
  3011. # Session Ticket Extension
  3012. AC_ARG_ENABLE([session-ticket],
  3013. [AS_HELP_STRING([--enable-session-ticket],[Enable Session Ticket (default: disabled)])],
  3014. [ ENABLED_SESSION_TICKET=$enableval ],
  3015. [ ENABLED_SESSION_TICKET=no ]
  3016. )
  3017. if test "x$ENABLED_NGINX" = "xyes" || test "$ENABLED_WPAS" = "yes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  3018. then
  3019. ENABLED_SESSION_TICKET=yes
  3020. fi
  3021. if test "x$ENABLED_SESSION_TICKET" = "xyes"
  3022. then
  3023. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
  3024. fi
  3025. # Extended Master Secret Extension
  3026. AC_ARG_ENABLE([extended-master],
  3027. [AS_HELP_STRING([--enable-extended-master],[Enable Extended Master Secret (default: enabled)])],
  3028. [ ENABLED_EXTENDED_MASTER=$enableval ],
  3029. [ ENABLED_EXTENDED_MASTER=yes ]
  3030. )
  3031. if test "x$ENABLED_EXTENDED_MASTER" = "xyes"
  3032. then
  3033. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXTENDED_MASTER"
  3034. fi
  3035. # TLS Extensions
  3036. AC_ARG_ENABLE([tlsx],
  3037. [AS_HELP_STRING([--enable-tlsx],[Enable all TLS Extensions (default: disabled)])],
  3038. [ ENABLED_TLSX=$enableval ],
  3039. [ ENABLED_TLSX=no ]
  3040. )
  3041. if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_SIGNAL" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  3042. then
  3043. ENABLED_TLSX=yes
  3044. fi
  3045. if test "x$ENABLED_TLSX" = "xyes"
  3046. then
  3047. ENABLED_SNI=yes
  3048. ENABLED_MAX_FRAGMENT=yes
  3049. ENABLED_TRUNCATED_HMAC=yes
  3050. ENABLED_ALPN=yes
  3051. ENABLED_TRUSTED_CA=yes
  3052. ENABLED_ENCRYPT_THEN_MAC=yes
  3053. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_ALPN -DHAVE_TRUSTED_CA"
  3054. # Check the ECC supported curves prereq
  3055. AS_IF([test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_CURVE25519" = "xyes" || test "x$ENABLED_CURVE448" = "xyes" || test "x$ENABLED_TLS13" = "xyes"],
  3056. [ENABLED_SUPPORTED_CURVES=yes
  3057. AM_CFLAGS="$AM_CFLAGS -DHAVE_SUPPORTED_CURVES"])
  3058. fi
  3059. # Early Data handshake in TLS v1.3 and above
  3060. AC_ARG_ENABLE([earlydata],
  3061. [AS_HELP_STRING([--enable-earlydata],[Enable Early Data handshake with wolfSSL TLS v1.3 (default: disabled)])],
  3062. [ ENABLED_TLS13_EARLY_DATA=$enableval ],
  3063. [ ENABLED_TLS13_EARLY_DATA=no ]
  3064. )
  3065. if test "$ENABLED_TLS13_EARLY_DATA" = "group"
  3066. then
  3067. ENABLED_TLS13_EARLY_DATA="yes"
  3068. # Group EarlyData with ClientHello
  3069. AM_CFLAGS="-DWOLFSSL_EARLY_DATA_GROUP $AM_CFLAGS"
  3070. fi
  3071. if test "$ENABLED_TLS13_EARLY_DATA" = "yes"
  3072. then
  3073. if test "x$ENABLED_TLS13" = "xno"
  3074. then
  3075. AC_MSG_ERROR([cannot enable earlydata without enabling tls13.])
  3076. fi
  3077. if test "x$ENABLED_SESSION_TICKET" = "xno" && test "x$ENABLED_PSK" = "xno"
  3078. then
  3079. AC_MSG_ERROR([cannot enable earlydata without enabling session tickets and/or PSK.])
  3080. fi
  3081. AM_CFLAGS="-DWOLFSSL_EARLY_DATA $AM_CFLAGS"
  3082. fi
  3083. if test "$ENABLED_TLSV12" = "no" && test "$ENABLED_TLS13" = "yes" && test "x$ENABLED_SESSION_TICKET" = "xno"
  3084. then
  3085. AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE"
  3086. fi
  3087. # PKCS7
  3088. AC_ARG_ENABLE([pkcs7],
  3089. [AS_HELP_STRING([--enable-pkcs7],[Enable PKCS7 (default: disabled)])],
  3090. [ ENABLED_PKCS7=$enableval ],
  3091. [ ENABLED_PKCS7=no ]
  3092. )
  3093. # wolfSSH Options
  3094. AC_ARG_ENABLE([ssh],
  3095. [AS_HELP_STRING([--enable-ssh],[Enable wolfSSH options (default: disabled)])],
  3096. [ ENABLED_WOLFSSH=$enableval ],
  3097. [ ENABLED_WOLFSSH=no ]
  3098. )
  3099. # wolfTPM Options
  3100. AC_ARG_ENABLE([wolftpm],
  3101. [AS_HELP_STRING([--enable-wolftpm],[Enable wolfTPM options (default: disabled)])],
  3102. [ ENABLED_WOLFTPM=$enableval ],
  3103. [ ENABLED_WOLFTPM=no ]
  3104. )
  3105. if test "x$ENABLED_WOLFTPM" = "xyes"
  3106. then
  3107. # Requires cryptocb (set in its enable section)
  3108. # Requires certgen, certreq, certext
  3109. if test "x$ENABLED_CERTGEN" = "xno"
  3110. then
  3111. ENABLED_CERTGEN="yes"
  3112. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3113. fi
  3114. if test "x$ENABLED_CERTREQ" = "xno"
  3115. then
  3116. ENABLED_CERTREQ="yes"
  3117. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  3118. fi
  3119. if test "x$ENABLED_CERTEXT" = "xno"
  3120. then
  3121. ENABLED_CERTEXT="yes"
  3122. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  3123. fi
  3124. # Requires PKCS7
  3125. if test "x$ENABLED_PKCS7" = "xno"
  3126. then
  3127. ENABLED_PKCS7="yes"
  3128. fi
  3129. # Requires aescfb
  3130. if test "x$ENABLED_AESCFB" = "xno"
  3131. then
  3132. ENABLED_AESCFB="yes"
  3133. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_CFB"
  3134. fi
  3135. fi
  3136. # Simple Certificate Enrollment Protocol (SCEP)
  3137. AC_ARG_ENABLE([scep],
  3138. [AS_HELP_STRING([--enable-scep],[Enable wolfSCEP (default: disabled)])],
  3139. [ ENABLED_WOLFSCEP=$enableval ],
  3140. [ ENABLED_WOLFSCEP=no ]
  3141. )
  3142. # Secure Remote Password
  3143. AC_ARG_ENABLE([srp],
  3144. [AS_HELP_STRING([--enable-srp],[Enable Secure Remote Password (default: disabled)])],
  3145. [ ENABLED_SRP=$enableval ],
  3146. [ ENABLED_SRP=no ]
  3147. )
  3148. if test "x$ENABLED_SRP" = "xyes"
  3149. then
  3150. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_SRP"
  3151. fi
  3152. # Indefinite length encoded BER message support
  3153. AC_ARG_ENABLE([indef],
  3154. [AS_HELP_STRING([--enable-indef],[Enable parsing of indefinite length encoded msgs (default: disabled)])],
  3155. [ ENABLED_BER_INDEF=$enableval ],
  3156. [ ENABLED_BER_INDEF=no ]
  3157. )
  3158. if test "x$ENABLED_BER_INDEF" = "xyes"
  3159. then
  3160. AM_CFLAGS="$AM_CFLAGS -DASN_BER_TO_DER"
  3161. fi
  3162. # Small Stack - Cache on object
  3163. AC_ARG_ENABLE([smallstackcache],
  3164. [AS_HELP_STRING([--enable-smallstackcache],[Enable Small Stack Usage Caching (default: disabled)])],
  3165. [ ENABLED_SMALL_STACK_CACHE=$enableval ],
  3166. [ ENABLED_SMALL_STACK_CACHE=no ]
  3167. )
  3168. if test "x$ENABLED_SMALL_STACK_CACHE" = "xyes"
  3169. then
  3170. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SMALL_STACK_CACHE"
  3171. fi
  3172. # Small Stack
  3173. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  3174. then
  3175. ENABLED_SMALL_STACK_DEFAULT=yes
  3176. else
  3177. ENABLED_SMALL_STACK_DEFAULT=no
  3178. fi
  3179. AC_ARG_ENABLE([smallstack],
  3180. [AS_HELP_STRING([--enable-smallstack],[Enable Small Stack Usage (default: disabled)])],
  3181. [ ENABLED_SMALL_STACK=$enableval ],
  3182. [ ENABLED_SMALL_STACK=$ENABLED_SMALL_STACK_DEFAULT ]
  3183. )
  3184. if test "x$ENABLED_SMALL_STACK_CACHE" = "xyes"
  3185. then
  3186. ENABLED_SMALL_STACK=yes
  3187. fi
  3188. if test "x$ENABLED_SMALL_STACK" = "xyes"
  3189. then
  3190. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SMALL_STACK"
  3191. fi
  3192. #valgrind
  3193. AC_ARG_ENABLE([valgrind],
  3194. [AS_HELP_STRING([--enable-valgrind],[Enable valgrind for unit tests (default: disabled)])],
  3195. [ ENABLED_VALGRIND=$enableval ],
  3196. [ ENABLED_VALGRIND=no ]
  3197. )
  3198. if test "$ENABLED_VALGRIND" = "yes"
  3199. then
  3200. AC_CHECK_PROG([HAVE_VALGRIND],[valgrind],[yes],[no])
  3201. if test "$HAVE_VALGRIND" = "no"
  3202. then
  3203. AC_MSG_ERROR([Valgrind not found.])
  3204. fi
  3205. enable_shared=no
  3206. enable_static=yes
  3207. AM_CFLAGS="$AM_CFLAGS -DHAVE_VALGRIND"
  3208. fi
  3209. # Test certs, use internal cert functions for extra testing
  3210. AC_ARG_ENABLE([testcert],
  3211. [AS_HELP_STRING([--enable-testcert],[Enable Test Cert (default: disabled)])],
  3212. [ ENABLED_TESTCERT=$enableval ],
  3213. [ ENABLED_TESTCERT=no ]
  3214. )
  3215. if test "$ENABLED_TESTCERT" = "yes"
  3216. then
  3217. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TEST_CERT"
  3218. fi
  3219. # I/O Pool, an example to show user how to override memory handler and use
  3220. # a pool for the input/output buffer requests
  3221. AC_ARG_ENABLE([iopool],
  3222. [AS_HELP_STRING([--enable-iopool],[Enable I/O Pool example (default: disabled)])],
  3223. [ ENABLED_IOPOOL=$enableval ],
  3224. [ ENABLED_IOPOOL=no ]
  3225. )
  3226. if test "$ENABLED_IOPOOL" = "yes"
  3227. then
  3228. if test "$thread_ls_on" = "no"
  3229. then
  3230. AC_MSG_ERROR([I/O Pool example requires Thread Local Storage])
  3231. fi
  3232. AM_CFLAGS="$AM_CFLAGS -DHAVE_IO_POOL -DXMALLOC_USER"
  3233. fi
  3234. # Certificate Service Support
  3235. AC_ARG_ENABLE([certservice],
  3236. [AS_HELP_STRING([--enable-certservice],[Enable cert service (default: disabled)])],
  3237. [ ENABLED_CERT_SERVICE=$enableval ],
  3238. [ ENABLED_CERT_SERVICE=no ]
  3239. )
  3240. if test "$ENABLED_CERT_SERVICE" = "yes"
  3241. then
  3242. # Requires ecc,certgen, and opensslextra make sure on
  3243. if test "x$ENABLED_CERTGEN" = "xno"
  3244. then
  3245. ENABLED_CERTGEN="yes"
  3246. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3247. fi
  3248. if test "x$ENABLED_ECC" = "xno"
  3249. then
  3250. ENABLED_ECC="yes"
  3251. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  3252. if test "$ENABLED_ECC_SHAMIR" = "yes"
  3253. then
  3254. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  3255. fi
  3256. fi
  3257. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3258. then
  3259. ENABLED_OPENSSLEXTRA="yes"
  3260. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  3261. fi
  3262. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_CERT_SERVICE"
  3263. fi
  3264. # wolfSSL JNI
  3265. AC_ARG_ENABLE([jni],
  3266. [AS_HELP_STRING([--enable-jni],[Enable wolfSSL JNI (default: disabled)])],
  3267. [ ENABLED_JNI=$enableval ],
  3268. [ ENABLED_JNI=no ]
  3269. )
  3270. if test "$ENABLED_JNI" = "yes"
  3271. then
  3272. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_JNI -DHAVE_EX_DATA"
  3273. # Enable prereqs if not already enabled
  3274. if test "x$ENABLED_DTLS" = "xno"
  3275. then
  3276. ENABLED_DTLS="yes"
  3277. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS"
  3278. fi
  3279. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  3280. then
  3281. ENABLED_OPENSSLEXTRA="yes"
  3282. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  3283. fi
  3284. if test "x$ENABLED_OPENSSLALL" = "xno"
  3285. then
  3286. ENABLED_OPENSSLALL="yes"
  3287. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_ALL"
  3288. fi
  3289. if test "x$ENABLED_CRL" = "xno"
  3290. then
  3291. ENABLED_CRL="yes"
  3292. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  3293. fi
  3294. if test "x$ENABLED_OCSP" = "xno"
  3295. then
  3296. ENABLED_OCSP="yes"
  3297. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  3298. fi
  3299. if test "x$ENABLED_CRL_MONITOR" = "xno" && test "x$ENABLED_DISTRO" = "xno"
  3300. then
  3301. ENABLED_CRL_MONITOR="yes"
  3302. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR"
  3303. fi
  3304. if test "x$ENABLED_SAVESESSION" = "xno"
  3305. then
  3306. ENABLED_SAVESESSION="yes"
  3307. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  3308. fi
  3309. if test "x$ENABLED_SAVECERT" = "xno"
  3310. then
  3311. ENABLED_SAVECERT="yes"
  3312. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  3313. fi
  3314. if test "x$ENABLED_ATOMICUSER" = "xno"
  3315. then
  3316. ENABLED_ATOMICUSER="yes"
  3317. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  3318. fi
  3319. if test "x$ENABLED_ECC" = "xno"
  3320. then
  3321. ENABLED_ECC="yes"
  3322. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  3323. if test "$ENABLED_ECC_SHAMIR" = "yes"
  3324. then
  3325. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  3326. fi
  3327. fi
  3328. if test "x$ENABLED_PKCALLBACKS" = "xno"
  3329. then
  3330. ENABLED_PKCALLBACKS="yes"
  3331. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  3332. fi
  3333. if test "x$ENABLED_DH" = "xno"
  3334. then
  3335. ENABLED_DH="yes"
  3336. AM_CFLAGS="$AM_CFLAGS -DHAVE_DH"
  3337. fi
  3338. if test "x$ENABLED_PSK" = "xno"
  3339. then
  3340. ENABLED_PSK="yes"
  3341. fi
  3342. if test "x$ENABLED_CERTEXT" = "xno"
  3343. then
  3344. ENABLED_CERTEXT="yes"
  3345. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  3346. fi
  3347. if test "x$ENABLED_CERTGEN" = "xno"
  3348. then
  3349. ENABLED_CERTGEN="yes"
  3350. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3351. fi
  3352. if test "x$ENABLED_SNI" = "xno"
  3353. then
  3354. ENABLED_SNI="yes"
  3355. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  3356. fi
  3357. if test "x$ENABLED_ALPN" = "xno"
  3358. then
  3359. ENABLED_ALPN="yes"
  3360. AM_CFLAGS="$AM_CFLAGS -DHAVE_ALPN"
  3361. fi
  3362. fi
  3363. if test "$ENABLED_LIGHTY" = "yes"
  3364. then
  3365. # Requires opensslextra make sure on
  3366. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3367. then
  3368. ENABLED_OPENSSLEXTRA="yes"
  3369. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  3370. fi
  3371. AM_CFLAGS="$AM_CFLAGS -DHAVE_LIGHTY -DHAVE_WOLFSSL_SSL_H=1"
  3372. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
  3373. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_ALL"
  3374. # recommended if building wolfSSL specifically for use by lighttpd
  3375. if test "x$ENABLED_ALL" = "xno"; then
  3376. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL2 -DOPENSSL_NO_COMP"
  3377. if test "x$ENABLED_SSLV3" = "xno"; then
  3378. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL3"
  3379. if test "x$ENABLED_TLSV10" = "xno"; then
  3380. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  3381. ENABLED_OLD_TLS=no
  3382. fi
  3383. fi
  3384. if test "x$ENABLED_CRL_MONITOR" = "xno"; then
  3385. AM_CFLAGS="$AM_CFLAGS -DSINGLE_THREADED"
  3386. ENABLED_SINGLETHREADED="yes"
  3387. fi
  3388. # w/ lighttpd 1.4.56 once wolfSSL updated to expose non-filesystem funcs
  3389. #AM_CFLAGS="$AM_CFLAGS -DNO_BIO"
  3390. #AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  3391. #ENABLED_FILESYSTEM=no
  3392. fi
  3393. fi
  3394. if test "$ENABLED_NGINX" = "yes"
  3395. then
  3396. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NGINX -DWOLFSSL_SIGNER_DER_CERT"
  3397. fi
  3398. if test "$ENABLED_HAPROXY" = "yes"
  3399. then
  3400. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAPROXY"
  3401. # Requires opensslextra make sure on
  3402. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3403. then
  3404. ENABLED_OPENSSLEXTRA="yes"
  3405. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  3406. fi
  3407. fi
  3408. if test "$ENABLED_SIGNAL" = "yes"
  3409. then
  3410. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SIGNAL -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  3411. # Requires opensslextra make sure on
  3412. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3413. then
  3414. ENABLED_OPENSSLEXTRA="yes"
  3415. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  3416. fi
  3417. fi
  3418. if test "$ENABLED_OPENVPN" = "yes"
  3419. then
  3420. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB -DHAVE_EX_DATA -DWOLFSSL_KEY_GEN -DWOLFSSL_OPENVPN"
  3421. fi
  3422. if test "$ENABLED_NGINX" = "yes"|| test "x$ENABLED_HAPROXY" = "xyes" || test "x$ENABLED_LIGHTY" = "xyes"
  3423. then
  3424. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_VERIFY_CB"
  3425. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  3426. AM_CFLAGS="$AM_CFLAGS -DKEEP_OUR_CERT -DKEEP_PEER_CERT"
  3427. AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE -DHAVE_EX_DATA"
  3428. ENABLED_CERTGEN="yes"
  3429. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3430. fi
  3431. if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_QT" = "yes"
  3432. then
  3433. ENABLED_ARC4="yes"
  3434. fi
  3435. if test "$ENABLED_ARC4" = "no"
  3436. then
  3437. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  3438. else
  3439. # turn off ARC4 if leanpsk or leantls on
  3440. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  3441. then
  3442. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  3443. ENABLED_ARC4=no
  3444. fi
  3445. fi
  3446. # Asio Support
  3447. AC_ARG_ENABLE([asio],
  3448. [AS_HELP_STRING([--enable-asio],[Enable asio (default: disabled)])],
  3449. [ ENABLED_ASIO=$enableval ],
  3450. [ ENABLED_ASIO=no ]
  3451. )
  3452. if test "$ENABLED_ASIO" = "yes"
  3453. then
  3454. # Requires opensslextra and opensslall
  3455. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3456. then
  3457. ENABLED_OPENSSLALL="yes"
  3458. ENABLED_OPENSSLEXTRA="yes"
  3459. AM_CFLAGS="-DOPENSSL_EXTRA -DOPENSSL_ALL $AM_CFLAGS"
  3460. fi
  3461. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASIO -DASIO_USE_WOLFSSL -DWOLFSSL_KEY_GEN"
  3462. AM_CFLAGS="$AM_CFLAGS -DBOOST_ASIO_USE_WOLFSSL -DHAVE_EX_DATA"
  3463. AM_CFLAGS="$AM_CFLAGS -DSSL_TXT_TLSV1_2 -DSSL_TXT_TLSV1_1"
  3464. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL2 -DOPENSSL_NO_SSL3"
  3465. if test "$ENABLED_TLSV10" = "yes"
  3466. then
  3467. AM_CFLAGS="$AM_CFLAGS -DSSL_TXT_TLSV1"
  3468. fi
  3469. # Requires OCSP make sure on
  3470. if test "x$ENABLED_OCSP" = "xno"
  3471. then
  3472. ENABLED_OCSP="yes"
  3473. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  3474. fi
  3475. fi
  3476. # Apache HTTPD
  3477. AC_ARG_ENABLE([apachehttpd],
  3478. [AS_HELP_STRING([--enable-apachehttpd],[Enable Apache httpd (default: disabled)])],
  3479. [ ENABLED_APACHE_HTTPD=$enableval ],
  3480. [ ENABLED_APACHE_HTTPD=no ]
  3481. )
  3482. if test "$ENABLED_APACHE_HTTPD" = "yes"
  3483. then
  3484. # Requires opensslextra and opensslall
  3485. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3486. then
  3487. ENABLED_OPENSSLALL="yes"
  3488. ENABLED_OPENSSLEXTRA="yes"
  3489. AM_CFLAGS="-DOPENSSL_EXTRA -DOPENSSL_ALL $AM_CFLAGS"
  3490. fi
  3491. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_APACHE_HTTPD"
  3492. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL2 -DOPENSSL_NO_SSL3 -DOPENSSL_NO_COMP"
  3493. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA -DWOLFSSL_SIGNER_DER_CERT"
  3494. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT -DWOLFSSL_CERT_GEN"
  3495. # Requires OCSP make sure on
  3496. if test "x$ENABLED_OCSP" = "xno"
  3497. then
  3498. ENABLED_OCSP="yes"
  3499. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  3500. fi
  3501. # Requires sessioncerts make sure on
  3502. if test "x$ENABLED_SESSIONCERTS" = "xno"
  3503. then
  3504. ENABLED_SESSIONCERTS="yes"
  3505. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  3506. fi
  3507. # Requires ALPN
  3508. if test "x$ENABLED_ALPN" = "xno"
  3509. then
  3510. ENABLED_ALPN="yes"
  3511. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
  3512. fi
  3513. # Requires CRL
  3514. if test "x$ENABLED_CRL" = "xno"
  3515. then
  3516. ENABLED_CRL="yes"
  3517. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  3518. fi
  3519. # Requires Certificate Generation, Request and Extensions
  3520. if test "x$ENABLED_CERTGEN" = "xno"
  3521. then
  3522. ENABLED_CERTGEN="yes"
  3523. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3524. fi
  3525. if test "x$ENABLED_CERTREQ" = "xno"
  3526. then
  3527. ENABLED_CERTREQ="yes"
  3528. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  3529. fi
  3530. if test "x$ENABLED_CERTEXT" = "xno"
  3531. then
  3532. ENABLED_CERTEXT="yes"
  3533. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  3534. fi
  3535. # Requires Secure Renegotiation
  3536. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xno"
  3537. then
  3538. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION -DHAVE_SERVER_RENEGOTIATION_INFO"
  3539. fi
  3540. fi
  3541. # Encrypt-Then-Mac
  3542. AC_ARG_ENABLE([enc-then-mac],
  3543. [AS_HELP_STRING([--enable-enc-then-mac],[Enable Encryptr-Then-Mac extension (default: enabled)])],
  3544. [ ENABLED_ENCRYPT_THEN_MAC=$enableval ],
  3545. [ ENABLED_ENCRYPT_THEN_MAC=yes ]
  3546. )
  3547. if test "x$ENABLED_APACHE_HTTPD" = "xyes"
  3548. then
  3549. ENABLED_ENCRYPT_THEN_MAC=no
  3550. fi
  3551. if test "x$ENABLED_TLSX" = "xyes"
  3552. then
  3553. ENABLED_ENCRYPT_THEN_MAC=yes
  3554. fi
  3555. AS_IF([test "x$ENABLED_SNIFFER" = "xyes"],[ENABLED_ENCRYPT_THEN_MAC="no"])
  3556. if test "x$ENABLED_ENCRYPT_THEN_MAC" = "xyes"
  3557. then
  3558. AM_CFLAGS="$AM_CFLAGS -DHAVE_ENCRYPT_THEN_MAC"
  3559. fi
  3560. # stunnel Support
  3561. AC_ARG_ENABLE([stunnel],
  3562. [AS_HELP_STRING([--enable-stunnel],[Enable stunnel (default: disabled)])],
  3563. [ ENABLED_STUNNEL=$enableval ],
  3564. [ ENABLED_STUNNEL=no ]
  3565. )
  3566. if test "$ENABLED_WPAS" = "yes"
  3567. then
  3568. ENABLED_STUNNEL="yes"
  3569. fi
  3570. if test "$ENABLED_STUNNEL" = "yes"
  3571. then
  3572. # Requires opensslextra make sure on
  3573. if test "x$ENABLED_OPENSSLEXTRA" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3574. then
  3575. ENABLED_OPENSSLEXTRA="yes"
  3576. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  3577. fi
  3578. # Requires OCSP make sure on
  3579. if test "x$ENABLED_OCSP" = "xno"
  3580. then
  3581. ENABLED_OCSP="yes"
  3582. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  3583. fi
  3584. # Requires coding make sure on
  3585. if test "x$ENABLED_CODING" = "xno"
  3586. then
  3587. ENABLED_CODING="yes"
  3588. fi
  3589. # Requires sessioncerts make sure on
  3590. if test "x$ENABLED_SESSIONCERTS" = "xno"
  3591. then
  3592. ENABLED_SESSIONCERTS="yes"
  3593. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  3594. fi
  3595. # Requires crls, make sure on
  3596. if test "x$ENABLED_CRL" = "xno"
  3597. then
  3598. ENABLED_CRL="yes"
  3599. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  3600. fi
  3601. # Requires DES3, make sure on
  3602. if test "x$ENABLED_DES3" = "xno"
  3603. then
  3604. ENABLED_DES3="yes"
  3605. fi
  3606. # Requires tlsx, make sure on
  3607. if test "x$ENABLED_TLSX" = "xno"
  3608. then
  3609. ENABLED_TLSX="yes"
  3610. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC"
  3611. # Check the ECC supported curves prereq
  3612. AS_IF([test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_CURVE25519" = "xyes"],
  3613. [ENABLED_SUPPORTED_CURVES=yes
  3614. AM_CFLAGS="$AM_CFLAGS -DHAVE_SUPPORTED_CURVES"])
  3615. fi
  3616. # Requires ecc make sure on
  3617. if test "x$ENABLED_ECC" = "xno"
  3618. then
  3619. ENABLED_OPENSSLEXTRA="yes"
  3620. ENABLED_ECC="yes"
  3621. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  3622. if test "$ENABLED_ECC_SHAMIR" = "yes"
  3623. then
  3624. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  3625. fi
  3626. fi
  3627. # Requires wolfSSL_OBJ_txt2nid
  3628. if test "x$ENABLED_CERTEXT" = "xno"
  3629. then
  3630. ENABLED_CERTEXT="yes"
  3631. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  3632. fi
  3633. # Requires certgen
  3634. if test "x$ENABLED_CERTGEN" = "xno"
  3635. then
  3636. ENABLED_CERTGEN="yes"
  3637. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3638. fi
  3639. AM_CFLAGS="$AM_CFLAGS -DHAVE_STUNNEL -DWOLFSSL_ALWAYS_VERIFY_CB"
  3640. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI -DHAVE_EX_DATA"
  3641. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB"
  3642. fi
  3643. if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no" \
  3644. && test "x$ENABLED_STUNNEL" = "xno"
  3645. then
  3646. AM_CFLAGS="$AM_CFLAGS -DNO_PSK"
  3647. fi
  3648. if test "$ENABLED_PSK" = "no" && \
  3649. (test "$ENABLED_LEANPSK" = "yes" || test "x$ENABLED_STUNNEL" = "xyes")
  3650. then
  3651. ENABLED_PSK=yes
  3652. fi
  3653. # libest Support
  3654. AC_ARG_ENABLE([libest],
  3655. [AS_HELP_STRING([--enable-libest],[Enable libest (default: disabled)])],
  3656. [ ENABLED_LIBEST=$enableval ],
  3657. [ ENABLED_LIBEST=no ]
  3658. )
  3659. if test "$ENABLED_LIBEST" = "yes"
  3660. then
  3661. AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA -DHAVE_LIBEST -DWOLFSSL_ALT_NAMES"
  3662. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PSS_SALT_LEN_DISCOVER"
  3663. # Requires opensslextra and opensslall
  3664. if test "x$ENABLED_OPENSSLALL" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  3665. then
  3666. ENABLED_OPENSSLALL="yes"
  3667. ENABLED_OPENSSLEXTRA="yes"
  3668. AM_CFLAGS="-DOPENSSL_EXTRA -DOPENSSL_ALL $AM_CFLAGS"
  3669. AM_CFLAGS="-DWOLFSSL_EITHER_SIDE -DWC_RSA_NO_PADDING $AM_CFLAGS"
  3670. AM_CFLAGS="-DWC_RSA_PSS -DWOLFSSL_PSS_LONG_SALT $AM_CFLAGS"
  3671. fi
  3672. # Requires OCSP
  3673. if test "x$ENABLED_OCSP" = "xno"
  3674. then
  3675. ENABLED_OCSP="yes"
  3676. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  3677. fi
  3678. # Requires PKCS7
  3679. if test "x$ENABLED_PKCS7" = "xno"
  3680. then
  3681. ENABLED_PKCS7="yes"
  3682. fi
  3683. # Requires Certificate Generation and Request
  3684. if test "x$ENABLED_CERTGEN" = "xno"
  3685. then
  3686. ENABLED_CERTGEN="yes"
  3687. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  3688. fi
  3689. if test "x$ENABLED_CERTREQ" = "xno"
  3690. then
  3691. ENABLED_CERTREQ="yes"
  3692. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  3693. fi
  3694. if test "x$ENABLED_CERTEXT" = "xno"
  3695. then
  3696. ENABLED_CERTEXT="yes"
  3697. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  3698. fi
  3699. # Requires CRL
  3700. if test "x$ENABLED_CRL" = "xno"
  3701. then
  3702. ENABLED_CRL="yes"
  3703. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  3704. fi
  3705. if test "x$ENABLED_SRP" = "xno"
  3706. then
  3707. ENABLED_SRP="yes"
  3708. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_SRP"
  3709. fi
  3710. # Enable prereqs if not already enabled
  3711. if test "x$ENABLED_KEYGEN" = "xno"
  3712. then
  3713. ENABLED_KEYGEN="yes"
  3714. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  3715. fi
  3716. # Requires sessioncerts make sure on
  3717. if test "x$ENABLED_SESSIONCERTS" = "xno"
  3718. then
  3719. ENABLED_SESSIONCERTS="yes"
  3720. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  3721. fi
  3722. if test "x$ENABLED_DSA" = "xno"
  3723. then
  3724. AC_MSG_WARN([Enabling DSA with --enable-dsa is recommended for libest])
  3725. fi
  3726. fi
  3727. # MD4
  3728. AC_ARG_ENABLE([md4],
  3729. [AS_HELP_STRING([--enable-md4],[Enable MD4 (default: disabled)])],
  3730. [ ENABLED_MD4=$enableval ],
  3731. [ ENABLED_MD4=no ]
  3732. )
  3733. if test "$ENABLED_MD4" = "no"
  3734. then
  3735. #turn on MD4 if using stunnel
  3736. if test "x$ENABLED_STUNNEL" = "xyes" || test "x$ENABLED_WPAS" != "xno"
  3737. then
  3738. ENABLED_MD4="yes"
  3739. else
  3740. AM_CFLAGS="$AM_CFLAGS -DNO_MD4"
  3741. fi
  3742. fi
  3743. # Encrypted keys
  3744. AC_ARG_ENABLE([enckeys],
  3745. [AS_HELP_STRING([--enable-enckeys],[Enable PEM encrypted private key support (default: disabled)])],
  3746. [ ENABLED_ENCKEYS=$enableval ],
  3747. [ ENABLED_ENCKEYS=no ]
  3748. )
  3749. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_WEBSERVER" = "yes" || test "$ENABLED_WPAS" != "no"
  3750. then
  3751. ENABLED_ENCKEYS=yes
  3752. fi
  3753. if test "$ENABLED_ENCKEYS" = "yes"
  3754. then
  3755. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ENCRYPTED_KEYS"
  3756. fi
  3757. # PWDBASED has to come after certservice since we want it on w/o explicit on
  3758. # PWDBASED
  3759. AC_ARG_ENABLE([pwdbased],
  3760. [AS_HELP_STRING([--enable-pwdbased],[Enable PWDBASED (default: disabled)])],
  3761. [ ENABLED_PWDBASED=$enableval ],
  3762. [ ENABLED_PWDBASED=no ]
  3763. )
  3764. if test "$ENABLED_PWDBASED" = "no"
  3765. then
  3766. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_OPENSSLALL" = "yes" || test "$ENABLED_WEBSERVER" = "yes" || test "$ENABLED_ENCKEYS" = "yes"
  3767. then
  3768. # opensslextra, opensslall, webserver, and enckeys needs pwdbased
  3769. ENABLED_PWDBASED=yes
  3770. else
  3771. AM_CFLAGS="$AM_CFLAGS -DNO_PWDBASED"
  3772. fi
  3773. fi
  3774. AC_ARG_ENABLE([scrypt],
  3775. [AS_HELP_STRING([--enable-scrypt],[Enable SCRYPT (default: disabled)])],
  3776. [ ENABLED_SCRYPT=$enableval ],
  3777. [ ENABLED_SCRYPT=no ]
  3778. )
  3779. if test "$ENABLED_SCRYPT" = "yes"
  3780. then
  3781. if test "$ENABLED_PWDBASED" = "no"
  3782. then
  3783. AC_MSG_ERROR([cannot enable scrypt without enabling pwdbased.])
  3784. fi
  3785. AM_CFLAGS="$AM_CFLAGS -DHAVE_SCRYPT"
  3786. fi
  3787. # wolfCrypt Only Build
  3788. AC_ARG_ENABLE([cryptonly],
  3789. [AS_HELP_STRING([--enable-cryptonly],[Enable wolfCrypt Only build (default: disabled)])],
  3790. [ENABLED_CRYPTONLY=$enableval],
  3791. [ENABLED_CRYPTONLY=no])
  3792. AS_IF([test "x$FIPS_VERSION" = "xrand"],[ENABLED_CRYPTONLY="yes"])
  3793. if test "$ENABLED_CRYPTONLY" = "yes"
  3794. then
  3795. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_ONLY"
  3796. fi
  3797. if test "x$ENABLED_CRYPTONLY" = "xno"
  3798. then
  3799. if test "x$ENABLED_PSK" = "xno" && test "x$ENABLED_ASN" = "xno"
  3800. then
  3801. AC_MSG_ERROR([please enable psk if disabling asn.])
  3802. fi
  3803. if test "x$ENABLED_ECC" != "xno" && test "x$ENABLED_ASN" = "xno"
  3804. then
  3805. AC_MSG_ERROR([please disable ecc if disabling asn.])
  3806. fi
  3807. if test "$ENABLED_AFALG" = "yes"
  3808. then
  3809. # for TLS connections the intermediate hash needs to store buffer
  3810. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AFALG_HASH_KEEP"
  3811. fi
  3812. if test "$ENABLED_DEVCRYPTO" = "yes"
  3813. then
  3814. # for TLS connections the intermediate hash needs to store buffer
  3815. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DEVCRYPTO_HASH_KEEP"
  3816. fi
  3817. fi
  3818. # set fastmath default
  3819. FASTMATH_DEFAULT=no
  3820. if test "$host_cpu" = "x86_64" || test "$host_cpu" = "aarch64"
  3821. then
  3822. FASTMATH_DEFAULT=yes
  3823. fi
  3824. if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
  3825. then
  3826. FASTMATH_DEFAULT=no
  3827. fi
  3828. if test "$ENABLED_SP_MATH" = "yes"
  3829. then
  3830. FASTMATH_DEFAULT=no
  3831. fi
  3832. # fastmath
  3833. AC_ARG_ENABLE([fastmath],
  3834. [AS_HELP_STRING([--enable-fastmath],[Enable fast math ops (default: enabled on x86_64/aarch64)])],
  3835. [ ENABLED_FASTMATH=$enableval ],
  3836. [ ENABLED_FASTMATH=$FASTMATH_DEFAULT]
  3837. )
  3838. if test "x$ENABLED_FASTMATH" = "xyes"
  3839. then
  3840. # turn off fastmth if leanpsk on or asn off (w/o DH and ECC)
  3841. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no"
  3842. then
  3843. if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no" && test "$ENABLED_RSA" = "no"
  3844. then
  3845. ENABLED_FASTMATH=no
  3846. else
  3847. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  3848. ENABLED_SLOWMATH="no"
  3849. fi
  3850. else
  3851. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  3852. ENABLED_SLOWMATH="no"
  3853. fi
  3854. if test "$host_cpu" = "x86_64"
  3855. then
  3856. # Have settings.h set FP_MAX_BITS higher if user didn't set directly
  3857. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_64_BUILD"
  3858. fi
  3859. AS_IF([test "x$host_cpu" = "xaarch64"],[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AARCH64_BUILD"])
  3860. fi
  3861. # fast HUGE math
  3862. AC_ARG_ENABLE([fasthugemath],
  3863. [AS_HELP_STRING([--enable-fasthugemath],[Enable fast math + huge code (default: disabled)])],
  3864. [ ENABLED_FASTHUGEMATH=$enableval ],
  3865. [ ENABLED_FASTHUGEMATH=no ]
  3866. )
  3867. if test "$ENABLED_BUMP" = "yes"
  3868. then
  3869. ENABLED_FASTHUGEMATH="yes"
  3870. fi
  3871. if test "$ENABLED_FASTHUGEMATH" = "yes"
  3872. then
  3873. ENABLED_FASTMATH="yes"
  3874. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  3875. ENABLED_SLOWMATH="no"
  3876. fi
  3877. # Enable Examples, used to disable examples
  3878. if test "$ENABLED_LINUXKM" = "yes"
  3879. then
  3880. ENABLED_EXAMPLES_DEFAULT=no
  3881. else
  3882. ENABLED_EXAMPLES_DEFAULT=yes
  3883. fi
  3884. AC_ARG_ENABLE([examples],
  3885. [AS_HELP_STRING([--enable-examples],[Enable Examples (default: enabled)])],
  3886. [ ENABLED_EXAMPLES=$enableval ],
  3887. [ ENABLED_EXAMPLES=$ENABLED_EXAMPLES_DEFAULT ]
  3888. )
  3889. AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
  3890. AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"])
  3891. AS_IF([test "x$ENABLED_CRYPTONLY" = "xyes"], [ENABLED_EXAMPLES="no"])
  3892. # Enable wolfCrypt test and benchmark
  3893. if test "$ENABLED_LINUXKM" = "yes"
  3894. then
  3895. ENABLED_CRYPT_TESTS_DEFAULT=no
  3896. else
  3897. ENABLED_CRYPT_TESTS_DEFAULT=yes
  3898. fi
  3899. AC_ARG_ENABLE([crypttests],
  3900. [AS_HELP_STRING([--enable-crypttests],[Enable Crypt Bench/Test (default: enabled)])],
  3901. [ ENABLED_CRYPT_TESTS=$enableval ],
  3902. [ ENABLED_CRYPT_TESTS=$ENABLED_CRYPT_TESTS_DEFAULT ]
  3903. )
  3904. AC_SUBST([ENABLED_CRYPT_TESTS])
  3905. # LIBZ
  3906. ENABLED_LIBZ="no"
  3907. trylibzdir=""
  3908. AC_ARG_WITH([libz],
  3909. [ --with-libz=PATH PATH to libz install (default /usr/) ],
  3910. [
  3911. AC_MSG_CHECKING([for libz])
  3912. CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
  3913. LIBS="$LIBS -lz"
  3914. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  3915. if test "x$libz_linked" = "xno" ; then
  3916. if test "x$withval" != "xno" ; then
  3917. trylibzdir=$withval
  3918. fi
  3919. if test "x$withval" = "xyes" ; then
  3920. trylibzdir="/usr"
  3921. fi
  3922. LDFLAGS="$LDFLAGS -L$trylibzdir/lib"
  3923. CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
  3924. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  3925. if test "x$libz_linked" = "xno" ; then
  3926. AC_MSG_ERROR([libz isn't found.
  3927. If it's already installed, specify its path using --with-libz=/dir/])
  3928. fi
  3929. AC_MSG_RESULT([yes])
  3930. else
  3931. AC_MSG_RESULT([yes])
  3932. fi
  3933. ENABLED_LIBZ="yes"
  3934. ]
  3935. )
  3936. # PKCS#11
  3937. AC_ARG_ENABLE([pkcs11],
  3938. [AS_HELP_STRING([--enable-pkcs11],[Enable pkcs11 access (default: disabled)])],
  3939. [ ENABLED_PKCS11=$enableval ],
  3940. [ ENABLED_PKCS11=no ]
  3941. )
  3942. if test "x$ENABLED_PKCS11" = "xyes"
  3943. then
  3944. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS11 -DHAVE_WOLF_BIGINT"
  3945. LIBS="$LIBS -ldl"
  3946. fi
  3947. # PKCS#12
  3948. AC_ARG_ENABLE([pkcs12],
  3949. [AS_HELP_STRING([--enable-pkcs12],[Enable pkcs12 (default: enabled)])],
  3950. [ ENABLED_PKCS12=$enableval ],
  3951. [ ENABLED_PKCS12=yes ]
  3952. )
  3953. if test "x$ENABLED_PKCS12" = "xno"
  3954. then
  3955. AM_CFLAGS="$AM_CFLAGS -DNO_PKCS12"
  3956. fi
  3957. # cavium
  3958. trycaviumdir=""
  3959. AC_ARG_WITH([cavium],
  3960. [ --with-cavium=PATH PATH to cavium/software dir ],
  3961. [
  3962. AC_MSG_CHECKING([for cavium])
  3963. CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
  3964. LIB_ADD="-lrt $LIB_ADD"
  3965. if test "x$withval" = "xyes" ; then
  3966. AC_MSG_ERROR([need a PATH for --with-cavium])
  3967. fi
  3968. if test "x$withval" != "xno" ; then
  3969. trycaviumdir=$withval
  3970. fi
  3971. LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
  3972. CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
  3973. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
  3974. if test "x$cavium_linked" = "xno" ; then
  3975. AC_MSG_ERROR([cavium isn't found.
  3976. If it's already installed, specify its path using --with-cavium=/dir/])
  3977. else
  3978. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM"
  3979. fi
  3980. AC_MSG_RESULT([yes])
  3981. enable_shared=no
  3982. enable_static=yes
  3983. ENABLED_CAVIUM=yes
  3984. ],
  3985. [ ENABLED_CAVIUM=no ]
  3986. )
  3987. # cavium V
  3988. trycaviumdir=""
  3989. AC_ARG_WITH([cavium-v],
  3990. [ --with-cavium-v=PATH PATH to Cavium V/software dir ],
  3991. [
  3992. AC_MSG_CHECKING([for cavium])
  3993. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM -DHAVE_CAVIUM_V"
  3994. LIB_ADD="-lrt -lcrypto $LIB_ADD"
  3995. if test "x$withval" = "xyes" ; then
  3996. AC_MSG_ERROR([need a PATH for --with-cavium])
  3997. fi
  3998. if test "x$withval" != "xno" ; then
  3999. trycaviumdir=$withval
  4000. fi
  4001. AC_CHECK_FILES([$trycaviumdir/lib/libnitrox.a], [AM_CPPFLAGS="-I$trycaviumdir/include $AM_CPPFLAGS"], [ENABLED_CAVIUM_V=no])
  4002. LIB_STATIC_ADD="$trycaviumdir/lib/libnitrox.a $LIB_STATIC_ADD"
  4003. if test "$ENABLED_CAVIUM_V" = "no"; then
  4004. AC_MSG_ERROR([Could not find Nitrox library])
  4005. fi
  4006. enable_shared=no
  4007. enable_static=yes
  4008. enable_opensslextra=yes
  4009. ENABLED_CAVIUM=yes
  4010. ENABLED_CAVIUM_V=yes
  4011. ],
  4012. [
  4013. ENABLED_CAVIUM_=no
  4014. ENABLED_CAVIUM_V=no
  4015. ]
  4016. )
  4017. # Cavium Octeon
  4018. OCTEON_ROOT=""
  4019. : ${OCTEON_OBJ="obj-octeon2"}
  4020. : ${OCTEON_HOST="standalone"}
  4021. AC_ARG_WITH([octeon-sync],
  4022. [AS_HELP_STRING([--with-octeon-sync=PATH],[PATH to Cavium Octeon SDK dir (sync)])],
  4023. [
  4024. AC_MSG_CHECKING([for octeon])
  4025. if test "x$withval" = "xyes" ; then
  4026. AC_MSG_ERROR([need a PATH for --with-octeon])
  4027. fi
  4028. if test "x$withval" != "xno" ; then
  4029. OCTEON_ROOT=$withval
  4030. fi
  4031. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM_OCTEON_SYNC"
  4032. AM_CFLAGS="$AM_CFLAGS -DOCTEON_MODEL=$OCTEON_MODEL"
  4033. AM_CFLAGS="$AM_CFLAGS -I$OCTEON_ROOT/executive"
  4034. AS_CASE([$OCTEON_HOST],['linux'],[AM_CFLAGS="$AM_CFLAGS -DCVMX_BUILD_FOR_LINUX_HOST"])
  4035. #-I$OCTEON_ROOT/target/include
  4036. AM_LDFLAGS="$AM_LDFLAGS -lrt -Xlinker -T -Xlinker $OCTEON_ROOT/executive/cvmx-shared-linux.ld"
  4037. AM_LDFLAGS="$AM_LDFLAGS -L$OCTEON_ROOT/executive/$OCTEON_OBJ -lcvmx -lfdt"
  4038. enable_shared=no
  4039. enable_static=yes
  4040. ENABLED_OCTEON_SYNC=yes
  4041. AC_MSG_RESULT([yes])
  4042. ],
  4043. [ENABLED_OCTEON_SYNC=no]
  4044. )
  4045. # Intel QuickAssist
  4046. QAT_DIR=""
  4047. BUILD_INTEL_QAT_VERSION=2
  4048. AC_ARG_WITH([intelqa],
  4049. [AS_HELP_STRING([--with-intelqa=PATH],[PATH to Intel QuickAssist (QAT) driver dir])],
  4050. [ENABLED_INTEL_QA=yes; QAT_DIR=$withval],
  4051. [ENABLED_INTEL_QA=no])
  4052. AC_ARG_WITH([intelqa-sync],
  4053. [AS_HELP_STRING([--with-intelqa-sync=PATH],[PATH to Intel QuickAssist (QAT) driver dir (sync)])],
  4054. [ENABLED_INTEL_QA_SYNC=yes; QAT_DIR=$withval],
  4055. [ENABLED_INTEL_QA_SYNC=no])
  4056. AS_IF([test "x$ENABLED_INTEL_QA" = "xyes" && test "x$ENABLED_INTEL_QA_SYNC" = "xyes"],
  4057. [AC_MSG_ERROR([Both Intel QA Async and Sync are selected, only select one.])])
  4058. AS_IF([test "x$ENABLED_INTEL_QA" = "xyes" || test "x$ENABLED_INTEL_QA_SYNC" = "xyes"],
  4059. [AC_MSG_CHECKING([for intelqa])
  4060. AS_IF([test "x$ENABLED_INTEL_QA" = "xyes"],
  4061. [AM_CPPFLAGS="$AM_CPPFLAGS -DHAVE_INTEL_QA -DDO_CRYPTO -DUSER_SPACE"; intelqa_opt=""],
  4062. [AM_CPPFLAGS="$AM_CPPFLAGS -DHAVE_INTEL_QA_SYNC -DQAT_USE_POLLING_THREAD -DO_CRYPTO -DUSER_SPACE"; intelqa_opt="-sync"])
  4063. OLD_LIBS="$LIBS"
  4064. OLD_CPPFLAGS="$CPPFLAGS"
  4065. AS_IF([test "x$QAT_DIR" = "xyes"],[AC_MSG_ERROR([need a PATH for --with-intelqa$intelqa_opt])])
  4066. AM_CPPFLAGS="$AM_CPPFLAGS -I$QAT_DIR/quickassist/include -I$QAT_DIR/quickassist/include/lac -I$QAT_DIR/quickassist/utilities/osal/include \
  4067. -I$QAT_DIR/quickassist/utilities/osal/src/linux/user_space/include -I$QAT_DIR/quickassist/lookaside/access_layer/include \
  4068. -I$QAT_DIR/quickassist/lookaside/access_layer/src/common/include -I$srcdir/wolfssl -I$srcdir/wolfssl/wolfcrypt/port/intel \
  4069. -I$QAT_DIR/quickassist/utilities/libusdm_drv"
  4070. CPPFLAGS="$AM_CPPFLAGS"
  4071. LDFLAGS="$LDFLAGS -L$QAT_DIR/build"
  4072. LIBS="$LIBS -lqat_s -lusdm_drv_s"
  4073. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]],[[Cpa16U count = 0; cpaCyGetNumInstances(&count);]])],[intelqa_linked=yes],[intelqa_linked=no])
  4074. AS_IF([test "x$intelqa_linked" = "xno"],
  4075. [# Try old QAT driver libraries
  4076. LIBS="$OLD_LIBS -licp_qa_al_s"
  4077. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]],[[Cpa16U count = 0; cpaCyGetNumInstances(&count);]])],[intelqa_linked=yes],[intelqa_linked=no])
  4078. AS_IF([test "x$intelqa_linked" = "xno"],
  4079. [AC_MSG_ERROR([Intel QuickAssist not found. If it's already installed, specify its path using --with-intelqa$intelqa_opt=/dir/])],
  4080. [BUILD_INTEL_QAT_VERSION=1])
  4081. ])
  4082. AC_MSG_RESULT([yes])
  4083. AS_IF([test "x$BUILD_INTEL_QAT_VERSION" = "x1"],
  4084. [LIB_ADD="-ladf_proxy -losal -lrt $LIB_ADD"],
  4085. [LIB_ADD="-losal -lrt $LIB_ADD"])
  4086. CPPFLAGS="$OLD_CPPFLAGS"
  4087. ])
  4088. ENABLED_SP_RSA=no
  4089. ENABLED_SP_DH=no
  4090. ENABLED_SP_FF_2048=no
  4091. ENABLED_SP_FF_3072=no
  4092. ENABLED_SP_FF_4096=no
  4093. ENABLED_SP_ECC=no
  4094. ENABLED_SP_EC_256=no
  4095. ENABLED_SP_EC_384=no
  4096. ENABLED_SP_NO_MALLOC=no
  4097. ENABLED_SP_NONBLOCK=no
  4098. ENABLED_SP_SMALL=no
  4099. for v in `echo $ENABLED_SP | tr "," " "`
  4100. do
  4101. case $v in
  4102. small)
  4103. ENABLED_SP_SMALL=yes
  4104. ENABLED_SP_RSA=yes
  4105. ENABLED_SP_DH=yes
  4106. ENABLED_SP_FF_2048=yes
  4107. ENABLED_SP_FF_3072=yes
  4108. ENABLED_SP_ECC=yes
  4109. ENABLED_SP_EC_256=yes
  4110. if test "$host_cpu" = "x86_64"; then
  4111. ENABLED_SP_FF_4096=yes
  4112. ENABLED_SP_EC_384=yes
  4113. fi
  4114. ;;
  4115. yes)
  4116. ENABLED_SP_RSA=yes
  4117. ENABLED_SP_DH=yes
  4118. ENABLED_SP_FF_2048=yes
  4119. ENABLED_SP_FF_3072=yes
  4120. ENABLED_SP_ECC=yes
  4121. ENABLED_SP_EC_256=yes
  4122. if test "$host_cpu" = "x86_64"; then
  4123. ENABLED_SP_FF_4096=yes
  4124. ENABLED_SP_EC_384=yes
  4125. fi
  4126. ;;
  4127. no)
  4128. ;;
  4129. smallec256 | smallp256 | small256)
  4130. ENABLED_SP_SMALL=yes
  4131. ENABLED_SP_ECC=yes
  4132. ENABLED_SP_EC_256=yes
  4133. ;;
  4134. ec256 | p256 | 256)
  4135. ENABLED_SP_ECC=yes
  4136. ENABLED_SP_EC_256=yes
  4137. ;;
  4138. smallec384 | smallp384 | small384)
  4139. ENABLED_SP_SMALL=yes
  4140. ENABLED_SP_ECC=yes
  4141. ENABLED_SP_EC_384=yes
  4142. ;;
  4143. ec384 | p384 | 384)
  4144. ENABLED_SP_ECC=yes
  4145. ENABLED_SP_EC_384=yes
  4146. ;;
  4147. small2048)
  4148. ENABLED_SP_SMALL=yes
  4149. ENABLED_SP_RSA=yes
  4150. ENABLED_SP_DH=yes
  4151. ENABLED_SP_FF_2048=yes
  4152. ;;
  4153. 2048)
  4154. ENABLED_SP_RSA=yes
  4155. ENABLED_SP_DH=yes
  4156. ENABLED_SP_FF_2048=yes
  4157. ;;
  4158. smallrsa2048)
  4159. ENABLED_SP_SMALL=yes
  4160. ENABLED_SP_RSA=yes
  4161. ENABLED_SP_FF_2048=yes
  4162. ;;
  4163. rsa2048)
  4164. ENABLED_SP_RSA=yes
  4165. ENABLED_SP_FF_2048=yes
  4166. ;;
  4167. small3072)
  4168. ENABLED_SP_SMALL=yes
  4169. ENABLED_SP_RSA=yes
  4170. ENABLED_SP_DH=yes
  4171. ENABLED_SP_FF_3072=yes
  4172. ;;
  4173. 3072)
  4174. ENABLED_SP_RSA=yes
  4175. ENABLED_SP_DH=yes
  4176. ENABLED_SP_FF_3072=yes
  4177. ;;
  4178. smallrsa3072)
  4179. ENABLED_SP_SMALL=yes
  4180. ENABLED_SP_RSA=yes
  4181. ENABLED_SP_FF_3072=yes
  4182. ;;
  4183. rsa3072)
  4184. ENABLED_SP_RSA=yes
  4185. ENABLED_SP_FF_3072=yes
  4186. ;;
  4187. small4096)
  4188. ENABLED_SP_SMALL=yes
  4189. ENABLED_SP_RSA=yes
  4190. ENABLED_SP_DH=yes
  4191. ENABLED_SP_FF_4096=yes
  4192. ;;
  4193. 4096 | +4096)
  4194. ENABLED_SP_RSA=yes
  4195. ENABLED_SP_DH=yes
  4196. ENABLED_SP_FF_4096=yes
  4197. ;;
  4198. smallrsa4096)
  4199. ENABLED_SP_SMALL=yes
  4200. ENABLED_SP_RSA=yes
  4201. ENABLED_SP_FF_4096=yes
  4202. ;;
  4203. rsa4096)
  4204. ENABLED_SP_RSA=yes
  4205. ENABLED_SP_FF_4096=yes
  4206. ;;
  4207. nomalloc)
  4208. ENABLED_SP_NO_MALLOC=yes
  4209. ;;
  4210. nonblock)
  4211. # Requires small and no malloc
  4212. ENABLED_SP_NONBLOCK=yes
  4213. ENABLED_SP_NO_MALLOC=yes
  4214. ENABLED_SP_SMALL=yes
  4215. ;;
  4216. *)
  4217. AC_MSG_ERROR([Invalid choice of Single Precision length in bits [256, 2048, 3072]: $ENABLED_SP.])
  4218. break;;
  4219. esac
  4220. done
  4221. ENABLED_SP=no
  4222. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_SP_RSA" = "yes"; then
  4223. ENABLED_SP=yes
  4224. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_RSA"
  4225. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_HAVE_SP_RSA"
  4226. fi
  4227. if test "$ENABLED_DH" = "yes" && test "$ENABLED_SP_DH" = "yes"; then
  4228. ENABLED_SP=yes
  4229. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_DH"
  4230. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_HAVE_SP_DH"
  4231. fi
  4232. if test "$ENABLED_SP_RSA" = "yes" || test "$ENABLED_SP_DH" = "yes"; then
  4233. if test "$ENABLED_SP_FF_2048" = "no"; then
  4234. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_2048"
  4235. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_2048"
  4236. fi
  4237. if test "$ENABLED_SP_FF_3072" = "no"; then
  4238. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_3072"
  4239. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_3072"
  4240. fi
  4241. if test "$ENABLED_SP_FF_4096" = "yes"; then
  4242. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_4096"
  4243. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_4096"
  4244. fi
  4245. fi
  4246. if test "$ENABLED_ECC" != "no" && test "$ENABLED_SP_ECC" = "yes"; then
  4247. ENABLED_SP=yes
  4248. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_SP_ECC"
  4249. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_HAVE_SP_ECC"
  4250. if test "$ENABLED_SP_EC_256" = "no"; then
  4251. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_256"
  4252. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_256"
  4253. fi
  4254. if test "$ENABLED_SP_EC_384" = "yes"; then
  4255. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC384 -DWOLFSSL_SP_384"
  4256. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_384"
  4257. fi
  4258. fi
  4259. if test "$ENABLED_SP_SMALL" = "yes"; then
  4260. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  4261. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_SMALL"
  4262. fi
  4263. if test "$ENABLED_SP_NO_MALLOC" = "yes"; then
  4264. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_MALLOC"
  4265. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_MALLOC"
  4266. fi
  4267. if test "$ENABLED_SP_NONBLOCK" = "yes"; then
  4268. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NONBLOCK"
  4269. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NONBLOCK"
  4270. fi
  4271. if test "$ENABLED_SMALL" = "yes"; then
  4272. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  4273. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_SMALL"
  4274. fi
  4275. if test "$ENABLED_SP_MATH" = "yes"; then
  4276. if test "$ENABLED_SP" = "no"; then
  4277. AC_MSG_ERROR([Must have SP enabled: --enable-sp])
  4278. fi
  4279. if test "$ENABLED_ECCCUSTCURVES" = "yes"; then
  4280. AC_MSG_ERROR([Cannot use single precision math and custom curves])
  4281. fi
  4282. if test "$ENABLED_OPENSSLEXTRA" = "yes"; then
  4283. AC_MSG_ERROR([Cannot use single precision math and OpenSSL extra])
  4284. fi
  4285. if test "$ENABLED_DSA" = "yes"; then
  4286. AC_MSG_ERROR([Cannot use single precision math and DSA])
  4287. fi
  4288. if test "$ENABLED_SRP" = "yes"; then
  4289. AC_MSG_ERROR([Cannot use single precision math and SRP])
  4290. fi
  4291. if test "$ENABLED_SP_RSA" = "no" && test "$ENABLED_RSA" = "yes"; then
  4292. AC_MSG_ERROR([Cannot use RSA single precision only math and RSA])
  4293. fi
  4294. if test "$ENABLED_SP_DH" = "no" && test "$ENABLED_DH" = "yes"; then
  4295. AC_MSG_ERROR([Cannot use DH single precision only math and DH])
  4296. fi
  4297. ENABLED_FASTMATH="no"
  4298. ENABLED_SLOWMATH="no"
  4299. fi
  4300. for v in `echo $ENABLED_SP_MATH_ALL | tr "," " "`
  4301. do
  4302. case $v in
  4303. yes | no)
  4304. ;;
  4305. small)
  4306. ENABLED_SP_MATH_ALL="yes"
  4307. ENABLED_SP_SMALL="yes"
  4308. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
  4309. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_SMALL"
  4310. ;;
  4311. huge)
  4312. ENABLED_SP_MATH_ALL="yes"
  4313. ENABLED_FASTHUGEMATH="yes"
  4314. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  4315. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_INT_LARGE_COMBA"
  4316. ;;
  4317. 256 | 384 | 521 | 1024 | 2048 | 3072 | 4096)
  4318. AM_CFLAGS="$AM_CFLAGS -DSP_INT_BITS=$v"
  4319. ENABLED_SP_MATH_ALL="yes"
  4320. ;;
  4321. *)
  4322. AC_MSG_ERROR([Support SP int bit sizes: 256, 384, 521, 1024, 2048, 3072, 4096. $ENABLED_SP_MATH_ALL not supported])
  4323. ;;
  4324. esac
  4325. done
  4326. if test "$ENABLED_SP_MATH_ALL" = "yes"; then
  4327. ENABLED_FASTMATH="no"
  4328. ENABLED_SLOWMATH="no"
  4329. ENABLED_SP="yes"
  4330. #ENABLED_SP_MATH="yes"
  4331. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MATH_ALL"
  4332. case $host_cpu in
  4333. *x86_64*)
  4334. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_X86_64"
  4335. ;;
  4336. *x86*)
  4337. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_X86"
  4338. ;;
  4339. *aarch64*)
  4340. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM64"
  4341. ;;
  4342. *arm*)
  4343. if test $host_alias = "thumb"; then
  4344. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM_THUMB"
  4345. else
  4346. if test $host_alias = "cortex"; then
  4347. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM_CORTEX_M"
  4348. else
  4349. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM32"
  4350. fi
  4351. fi
  4352. ;;
  4353. *ppc64* | *powerpc64*)
  4354. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_PPC64"
  4355. ;;
  4356. *ppc* | *powerpc*)
  4357. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_PPC"
  4358. ;;
  4359. *mips64*)
  4360. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MIPS64"
  4361. ;;
  4362. *mips*)
  4363. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MIPS"
  4364. ;;
  4365. *riscv32*)
  4366. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_RISCV32"
  4367. ;;
  4368. *riscv64*)
  4369. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_RISCV64"
  4370. ;;
  4371. *s390x*)
  4372. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_S390X"
  4373. ;;
  4374. esac
  4375. fi
  4376. AC_ARG_ENABLE([sp-asm],
  4377. [AS_HELP_STRING([--enable-sp-asm],[Enable Single Precision assembly implementation (default: disabled)])],
  4378. [ ENABLED_SP_ASM=$enableval ],
  4379. [ ENABLED_SP_ASM=no ],
  4380. )
  4381. if test "$ENABLED_SP_ASM" = "yes"; then
  4382. if test "$ENABLED_SP" = "no"; then
  4383. AC_MSG_ERROR([Must have SP enabled: --enable-sp])
  4384. fi
  4385. if test "$ENABLED_SP_NONBLOCK" = "yes"; then
  4386. AC_MSG_ERROR([SP non-blocking not supported with sp-asm])
  4387. fi
  4388. if test "$ENABLED_ASM" = "no"; then
  4389. AC_MSG_ERROR([Assembly code turned off])
  4390. fi
  4391. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ASM"
  4392. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ASM"
  4393. case $host_cpu in
  4394. *aarch64*)
  4395. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM64_ASM"
  4396. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM64_ASM"
  4397. ENABLED_SP_ARM64_ASM=yes
  4398. ;;
  4399. *arm*)
  4400. if test $host_alias = "thumb"; then
  4401. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM_THUMB_ASM"
  4402. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM_THUMB_ASM"
  4403. ENABLED_SP_ARM_THUMB_ASM=yes
  4404. else
  4405. if test $host_alias = "cortex"; then
  4406. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM_CORTEX_M_ASM"
  4407. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM_CORTEX_M_ASM"
  4408. ENABLED_SP_ARM_CORTEX_ASM=yes
  4409. else
  4410. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_ARM32_ASM"
  4411. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_ARM32_ASM"
  4412. ENABLED_SP_ARM32_ASM=yes
  4413. fi
  4414. fi
  4415. ;;
  4416. *x86_64*)
  4417. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_X86_64_ASM"
  4418. AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_X86_64_ASM"
  4419. ENABLED_SP_X86_64_ASM=yes
  4420. if test "x$ENABLED_FASTMATH" = "xno"
  4421. then
  4422. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_64_BUILD"
  4423. fi
  4424. ;;
  4425. *)
  4426. AC_MSG_ERROR([ASM not available for CPU. Supported CPUs: x86_64, aarch64, arm])
  4427. ;;
  4428. esac
  4429. fi
  4430. if test "$ENABLED_SP_MATH" = "yes"; then
  4431. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MATH"
  4432. fi
  4433. # Fast RSA using Intel IPP
  4434. ippdir="${srcdir}/IPP"
  4435. ipplib="lib" # if autoconf guesses 32bit system changes lib directory
  4436. fastRSA_found=no
  4437. abs_path=`pwd`
  4438. # set up variables used
  4439. IPPLIBS=
  4440. IPPHEADERS=
  4441. IPPLINK=
  4442. AC_ARG_ENABLE([fast-rsa],
  4443. [AS_HELP_STRING([--enable-fast-rsa],[Enable RSA using Intel IPP (default: disabled)])],
  4444. [ ENABLED_FAST_RSA=$enableval ],
  4445. [ ENABLED_FAST_RSA=no ],
  4446. )
  4447. # Fast RSA does not support RSA-PSS
  4448. if test "$ENABLED_RSAPSS" = "yes"; then
  4449. ENABLED_FAST_RSA=no
  4450. fi
  4451. if test "$ENABLED_USER_RSA" = "no" && test "$ENABLED_FIPS" = "no"; then
  4452. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  4453. ipplib="lib_32" # 32 bit OS detected
  4454. fi
  4455. # Use static IPP Libraries
  4456. if test "$enable_shared" = "no" && test "$ENABLED_FAST_RSA" = "yes"; then
  4457. case $host_os in
  4458. *darwin*)
  4459. ipplib="$ipplib/mac_static"
  4460. AC_MSG_ERROR([Issue with static linking to libippcp.a on Mac.
  4461. Dynamic IPP libraries supported on Mac])
  4462. break;;
  4463. *linux*)
  4464. ipplib="$ipplib/linux_static"
  4465. break;;
  4466. *)
  4467. ENABLED_FAST_RSA=no
  4468. esac
  4469. AC_CHECK_FILES([$srcdir/IPP/$ipplib/libippcore.a $srcdir/IPP/$ipplib/libippcp.a], [], [ENABLED_FAST_RSA=no])
  4470. AC_CHECK_FILES([$srcdir/IPP/include/ipp.h $srcdir/IPP/include/ippcp.h], [AM_CPPFLAGS="-I$srcdir/IPP/include $AM_CPPFLAGS"], [ENABLED_FAST_RSA=no])
  4471. LIB_STATIC_ADD="$srcdir/IPP/$ipplib/libippcp.a $srcdir/IPP/$ipplib/libippcore.a $LIB_STATIC_ADD"
  4472. if test "$ENABLED_FAST_RSA" = "no"; then
  4473. AC_MSG_ERROR([Could not find fast rsa libraries])
  4474. fi
  4475. else
  4476. # Check for and use bundled IPP libraries
  4477. if test "$ENABLED_FAST_RSA" = "yes"; then
  4478. AC_MSG_NOTICE([Using local IPP crypto library])
  4479. AC_CHECK_FILES([$abs_path/IPP/include/ippcp.h],
  4480. [
  4481. # build and default locations on linux and mac
  4482. STORE_LDFLAGS=${LDFLAGS}
  4483. STORE_CPPFLAGS=${CPPFLAGS}
  4484. # using LDFLAGS instead of AM_ temporarily to test link to library
  4485. LDFLAGS="-L$ippdir/$ipplib -lippcp -lippcore"
  4486. CPPFLAGS="-I$ippdir/include"
  4487. AC_CHECK_HEADERS([ippcp.h], [AC_CHECK_LIB([ippcp], [ippsRSAEncrypt_PKCSv15], [fastRSA_found=yes], [fastRSA_found=no])], [fastRSA_found=no])
  4488. name="$ippdir/$ipplib/libippcp"
  4489. case $host_os in
  4490. *darwin*)
  4491. # check file existence and conditionally set variables
  4492. AC_CHECK_FILES([$abs_path/IPP/$ipplib/libippcp.dylib], [
  4493. IPPLIBS="${name}.dylib ${name}-9.0.dylib ${name}e9-9.0.dylib ${name}g9-9.0.dylib ${name}h9-9.0.dylib ${name}k0-9.0.dylib ${name}l9-9.0.dylib ${name}n8-9.0.dylib ${name}p8-9.0.dylib ${name}s8-9.0.dylib ${name}y8-9.0.dylib IPP/lib/libippcore.dylib IPP/lib/libippcore-9.0.dylib"
  4494. IPPLINK="mkdir -p src/.libs && ln -f ${name}.dylib src/.libs/libippcp.dylib && ln -f ${srcdir}/${name}-9.0.dylib src/.libs/libippcp-9.0.dylib && ln -f ${srcdir}/${name}e9-9.0.dylib src/.libs/libippcpe9-9.0.dylib && ln -f ${srcdir}/${name}g9-9.0.dylib src/.libs/libippcpg9-9.0.dylib && ln -f ${srcdir}/${name}h9-9.0.dylib src/.libs/libippcph9-9.0.dylib && ln -f ${srcdir}/${name}k0-9.0.dylib src/.libs/libippcpk0-9.0.dylib && ln -f ${srcdir}/${name}l9-9.0.dylib src/.libs/libippcpl9-9.0.dylib && ln -f ${srcdir}/${name}n8-9.0.dylib src/.libs/libippcpn8-9.0.dylib && ln -f ${srcdir}/${name}p8-9.0.dylib src/.libs/libippcpp8-9.0.dylib && ln -f ${srcdir}/${name}s8-9.0.dylib src/.libs/libippcps8-9.0.dylib && ln -f ${srcdir}/${name}y8-9.0.dylib src/.libs/libippcpy8-9.0.dylib && ln -f ${srcdir}/IPP/lib/libippcore.dylib src/.libs/libippcore.dylib && ln -f ${srcdir}/IPP/lib/libippcore-9.0.dylib src/.libs/libippcore-9.0.dylib"
  4495. ], [fastRSA_found=no])
  4496. break;;
  4497. *linux*)
  4498. # check file existence and conditionally set variables
  4499. AC_CHECK_FILES([$abs_path/IPP/$ipplib/libippcp.so.9.0], [
  4500. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  4501. IPPLIBS="${name}.so.9.0 ${name}g9.so.9.0 ${name}h9.so.9.0 ${name}p8.so.9.0 ${name}px.so.9.0 ${name}s8.so.9.0 ${name}.so ${name}w7.so.9.0 IPP/$ipplib/libippcore.so IPP/$ipplib/libippcore.so.9.0"
  4502. IPPLINK="mkdir -p src/.libs && ln -f ${name}.so.9.0 src/.libs/libippcp.so.9.0 && ln -f ${name}g9.so.9.0 src/.libs/libippcpg9.so.9.0 && ln -f ${name}h9.so.9.0 src/.libs/libippcph9.so.9.0 && ln -f ${name}p8.so.9.0 src/.libs/libippcpp8.so.9.0 && ln -f ${name}px.so.9.0 src/.libs/libippcppx.so.9.0 && ln -f ${name}s8.so.9.0 src/.libs/libippcps8.so.9.0 && ln -f ${name}.so src/.libs/libippcp.so && ln -f ${name}w7.so.9.0 src/.libs/libippcpw7.so.9.0 && ln -f IPP/$ipplib/libippcore.so src/.libs/libippcore.so && ln -f IPP/$ipplib/libippcore.so.9.0 src/.libs/libippcore.so.9.0"
  4503. else
  4504. IPPLIBS="${name}.so.9.0 ${name}e9.so.9.0 ${name}k0.so.9.0 ${name}l9.so.9.0 ${name}m7.so.9.0 ${name}mx.so.9.0 ${name}.so ${name}n8.so.9.0 ${name}y8.so.9.0 IPP/lib/libippcore.so IPP/lib/libippcore.so.9.0"
  4505. IPPLINK="mkdir -p src/.libs && ln -f ${name}.so.9.0 src/.libs/libippcp.so.9.0 && ln -f ${name}e9.so.9.0 src/.libs/libippcpe9.so.9.0 && ln -f ${name}k0.so.9.0 src/.libs/libippcpk0.so.9.0 && ln -f ${name}l9.so.9.0 src/.libs/libippcpl9.so.9.0 && ln -f ${name}m7.so.9.0 src/.libs/libippcpm7.so.9.0 && ln -f ${name}mx.so.9.0 src/.libs/libippcpmx.so.9.0 && ln -f ${name}.so src/.libs/libippcp.so && ln -f ${name}n8.so.9.0 src/.libs/libippcpn8.so.9.0 && ln -f ${name}y8.so.9.0 src/.libs/libippcpy8.so.9.0 && ln -f IPP/lib/libippcore.so src/.libs/libippcore.so && ln -f IPP/lib/libippcore.so.9.0 src/.libs/libippcore.so.9.0"
  4506. fi
  4507. ], [fastRSA_found=no])
  4508. break;;
  4509. *)
  4510. fastRSA_found=no
  4511. esac
  4512. if test "$fastRSA_found" = "yes"; then
  4513. # was succesfull so add tested LDFLAGS to AM_ flags
  4514. AM_LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}"
  4515. AM_CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}"
  4516. IPPHEADERS="${srcdir}/IPP/include/*.h"
  4517. fi
  4518. # restore LDFLAGS to user set
  4519. LDFLAGS=${STORE_LDFLAGS}
  4520. CPPFLAGS=${STORE_CPPFLAGS}
  4521. ], [fastRSA_found=no])
  4522. fi
  4523. # Don't cache the result so it can be checked
  4524. AS_UNSET([ac_cv_header_ippcp_h])
  4525. AS_UNSET([ac_cv_header_ipp_h])
  4526. AS_UNSET([ac_cv_lib_ippcp_ippsRSAEncrypt_PKCSv15]);
  4527. # Check link and see if user has pre-existing IPP Libraries if not using local
  4528. if test "$ENABLED_FAST_RSA" = "yes" && test "$fastRSA_found" = "no"; then
  4529. AC_MSG_NOTICE([Checking if IPP crypto library installed])
  4530. AC_CHECK_HEADER([ippcp.h], [AC_CHECK_LIB([ippcp], [ippsRSAEncrypt_PKCSv15],
  4531. [
  4532. fastRSA_found=yes
  4533. AM_LDFLAGS="${AM_LDFLAGS} -lippcore -lippcp"
  4534. ], [ fastRSA_found=no])
  4535. ], [fastRSA_found=no])
  4536. # Error out on not finding libraries
  4537. if test "$fastRSA_found" = "no"; then
  4538. AC_MSG_ERROR([Could not find fast rsa libraries])
  4539. fi
  4540. fi
  4541. fi # end of if for shared library
  4542. else # if user rsa is set than do not use fast rsa option
  4543. if test "$ENABLED_FAST_RSA" = "yes"; then
  4544. AC_MSG_ERROR([Could not use fast rsa libraries with user crypto or fips])
  4545. fi
  4546. fi # end of if for user rsa crypto or fips
  4547. # End result of checking for IPP Libraries
  4548. AC_MSG_CHECKING([for fast RSA])
  4549. if test "$ENABLED_FAST_RSA" = "yes"; then
  4550. AM_CFLAGS="$AM_CFLAGS -DHAVE_FAST_RSA -DHAVE_USER_RSA"
  4551. # add in user crypto header that uses Intel IPP
  4552. AM_CPPFLAGS="$AM_CPPFLAGS -I$srcdir/wolfcrypt/user-crypto/include"
  4553. if test "$enable_shared" = "yes"; then
  4554. LIBS="$LIBS -lippcore -lippcp"
  4555. LIB_ADD="-lippcp -lippcore $LIB_ADD"
  4556. else
  4557. LIB_ADD="$srcdir/IPP/$ipplib/libippcp.a $srcdir/IPP/$ipplib/libippcore.a $LIB_ADD"
  4558. fi
  4559. AC_MSG_RESULT([yes])
  4560. else
  4561. AC_MSG_RESULT([no])
  4562. fi
  4563. AC_SUBST([IPPLIBS])
  4564. AC_SUBST([IPPHEADERS])
  4565. AC_SUBST([IPPLINK])
  4566. # static memory use
  4567. AC_ARG_ENABLE([staticmemory],
  4568. [AS_HELP_STRING([--enable-staticmemory],[Enable static memory use (default: disabled)])],
  4569. [ ENABLED_STATICMEMORY=$enableval ],
  4570. [ ENABLED_STATICMEMORY=no ]
  4571. )
  4572. if test "x$ENABLED_STATICMEMORY" = "xyes"
  4573. then
  4574. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY"
  4575. if test "x$ENABLED_FASTMATH" = "xno"
  4576. then
  4577. AC_MSG_ERROR([please use --enable-fastmath if enabling staticmemory.])
  4578. fi
  4579. if test "$ENABLED_LOWRESOURCE" = "yes" && test "$ENABLED_RSA" = "no"
  4580. then
  4581. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY_SMALL"
  4582. fi
  4583. fi
  4584. # microchip api
  4585. AC_ARG_ENABLE([mcapi],
  4586. [AS_HELP_STRING([--enable-mcapi],[Enable Microchip API (default: disabled)])],
  4587. [ ENABLED_MCAPI=$enableval ],
  4588. [ ENABLED_MCAPI=no ]
  4589. )
  4590. if test "$ENABLED_MCAPI" = "yes"
  4591. then
  4592. AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI"
  4593. if test "x$ENABLED_AESCTR" != "xyes"
  4594. then
  4595. # These flags are already implied by --enable-aesctr
  4596. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  4597. fi
  4598. if test "x$ENABLED_AESGCM" != "xyes" && test "x$ENABLED_AESGCM" != "xno"
  4599. then
  4600. # Use the smaller object size implementation
  4601. ENABLED_AESGCM=yes
  4602. fi
  4603. fi
  4604. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
  4605. then
  4606. AC_MSG_ERROR([please enable sha512 if enabling mcapi.])
  4607. fi
  4608. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_ECC" = "no"
  4609. then
  4610. AC_MSG_ERROR([please enable ecc if enabling mcapi.])
  4611. fi
  4612. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_LIBZ" = "no"
  4613. then
  4614. AC_MSG_ERROR([please use --with-libz if enabling mcapi.])
  4615. fi
  4616. # Asynchronous Crypto
  4617. AC_ARG_ENABLE([asynccrypt],
  4618. [AS_HELP_STRING([--enable-asynccrypt],[Enable Asynchronous Crypto (default: disabled)])],
  4619. [ ENABLED_ASYNCCRYPT=$enableval ],
  4620. [ ENABLED_ASYNCCRYPT=no ]
  4621. )
  4622. if test "$ENABLED_ASYNCCRYPT" = "yes"
  4623. then
  4624. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT -DHAVE_WOLF_EVENT -DHAVE_WOLF_BIGINT -DWOLFSSL_NO_HASH_RAW"
  4625. # if no async hardware then use simulator for testing
  4626. if test "x$ENABLED_CAVIUM" = "xno" && test "x$ENABLED_INTEL_QA" = "xno"
  4627. then
  4628. # Async threading is Linux specific
  4629. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT_TEST"
  4630. fi
  4631. fi
  4632. # check for async if using Intel QuckAssist or Cavium
  4633. if test "x$ENABLED_INTEL_QA" = "xyes" || test "x$ENABLED_CAVIUM" = "xyes" ; then
  4634. if test "x$ENABLED_ASYNCCRYPT" = "xno" ; then
  4635. AC_MSG_ERROR([Please enable asynchronous support using --enable-asynccrypt])
  4636. fi
  4637. fi
  4638. # Asynchronous threading
  4639. AC_ARG_ENABLE([asyncthreads],
  4640. [AS_HELP_STRING([--enable-asyncthreads],[Enable Asynchronous Threading (default: enabled)])],
  4641. [ ENABLED_ASYNCTHREADS=$enableval ],
  4642. [ ENABLED_ASYNCTHREADS=yes ]
  4643. )
  4644. if test "$ENABLED_ASYNCCRYPT" = "yes" && test "$ENABLED_ASYNCTHREADS" = "yes"
  4645. then
  4646. AX_PTHREAD([ENABLED_ASYNCTHREADS=yes],[ENABLED_ASYNCTHREADS=no])
  4647. else
  4648. ENABLED_ASYNCTHREADS=no
  4649. fi
  4650. if test "$ENABLED_ASYNCTHREADS" = "yes"
  4651. then
  4652. LIB_ADD="-lpthread $LIB_ADD"
  4653. AM_CFLAGS="$AM_CFLAGS -D_GNU_SOURCE"
  4654. else
  4655. AM_CFLAGS="$AM_CFLAGS -DWC_NO_ASYNC_THREADING"
  4656. fi
  4657. # cryptodev is old name, replaced with cryptocb
  4658. AC_ARG_ENABLE([cryptodev],
  4659. [AS_HELP_STRING([--enable-cryptodev],[DEPRECATED, use cryptocb instead])],
  4660. [ ENABLED_CRYPTOCB=$enableval ],[ ENABLED_CRYPTOCB=no ])
  4661. # Support for crypto callbacks
  4662. AC_ARG_ENABLE([cryptocb],
  4663. [AS_HELP_STRING([--enable-cryptocb],[Enable crypto callbacks (default: disabled)])],
  4664. [ ENABLED_CRYPTOCB=$enableval ],
  4665. [ ENABLED_CRYPTOCB=no ]
  4666. )
  4667. if test "x$ENABLED_PKCS11" = "xyes" || test "x$ENABLED_WOLFTPM" = "xyes"
  4668. then
  4669. ENABLED_CRYPTOCB=yes
  4670. fi
  4671. if test "$ENABLED_CRYPTOCB" = "yes"
  4672. then
  4673. AM_CFLAGS="$AM_CFLAGS -DWOLF_CRYPTO_CB"
  4674. fi
  4675. # Session Export
  4676. AC_ARG_ENABLE([sessionexport],
  4677. [AS_HELP_STRING([--enable-sessionexport],[Enable export and import of sessions (default: disabled)])],
  4678. [ ENABLED_SESSIONEXPORT=$enableval ],
  4679. [ ENABLED_SESSIONEXPORT=no ]
  4680. )
  4681. if test "$ENABLED_SESSIONEXPORT" = "yes" ||
  4682. test "$ENABLED_SESSIONEXPORT" = "nopeer"
  4683. then
  4684. if test "$ENABLED_DTLS" = "no"
  4685. then
  4686. AC_MSG_ERROR([Only DTLS supported with session export])
  4687. fi
  4688. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SESSION_EXPORT"
  4689. if test "$ENABLED_SESSIONEXPORT" = "nopeer"
  4690. then
  4691. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SESSION_EXPORT_NOPEER"
  4692. fi
  4693. fi
  4694. # AES key wrap
  4695. AC_ARG_ENABLE([aeskeywrap],
  4696. [AS_HELP_STRING([--enable-aeskeywrap],[Enable AES key wrap support (default: disabled)])],
  4697. [ ENABLED_AESKEYWRAP=$enableval ],
  4698. [ ENABLED_AESKEYWRAP=no ]
  4699. )
  4700. if test "$ENABLED_WPAS" != "no" && test "$ENABLED_FIPS" = "no"
  4701. then
  4702. ENABLED_AESKEYWRAP="yes"
  4703. fi
  4704. if test "$ENABLED_AESKEYWRAP" = "yes"
  4705. then
  4706. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_KEYWRAP -DWOLFSSL_AES_DIRECT"
  4707. fi
  4708. # Old name support for backwards compatibility
  4709. AC_ARG_ENABLE([oldnames],
  4710. [AS_HELP_STRING([--enable-oldnames],[Keep backwards compat with old names (default: enabled)])],
  4711. [ ENABLED_OLDNAMES=$enableval ],
  4712. [ ENABLED_OLDNAMES=yes ]
  4713. )
  4714. if test "x$ENABLED_OLDNAMES" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
  4715. then
  4716. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_RNGNAME -DNO_OLD_WC_NAMES -DNO_OLD_SSL_NAMES"
  4717. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_SHA_NAMES"
  4718. fi
  4719. # Memory Tests
  4720. AC_ARG_ENABLE([memtest],
  4721. [AS_HELP_STRING([--enable-memtest],[Memory testing option, for internal use (default: disabled)])],
  4722. [ ENABLED_MEMTEST=$enableval ],
  4723. [ ENABLED_MEMTEST=no ]
  4724. )
  4725. if test "x$ENABLED_MEMTEST" != "xno"
  4726. then
  4727. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY -DWOLFSSL_DEBUG_MEMORY -DWOLFSSL_FORCE_MALLOC_FAIL_TEST"
  4728. fi
  4729. # Enable hash flags support
  4730. # Hash flags are useful for runtime options such as SHA3 KECCAK256 selection
  4731. AC_ARG_ENABLE([hashflags],
  4732. [AS_HELP_STRING([--enable-hashflags],[Enable support for hash flags (default: disabled)])],
  4733. [ ENABLED_HASHFLAGS=$enableval ],
  4734. [ ENABLED_HASHFLAGS=no ]
  4735. )
  4736. if test "x$ENABLED_HASHFLAGS" != "xno"
  4737. then
  4738. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HASH_FLAGS"
  4739. fi
  4740. # Support for enabling setting default DH parameters in
  4741. AC_ARG_ENABLE([defaultdhparams],
  4742. [AS_HELP_STRING([--enable-dhdefaultparams],[Enables option for default dh parameters (default: disabled)])],
  4743. [ ENABLED_DHDEFAULTPARAMS=$enableval ],
  4744. [ ENABLED_DHDEFAULTPARAMS=no ]
  4745. )
  4746. if test "$ENABLED_DHDEFAULTPARAMS" = "yes" || test "$ENABLED_QT" = "no"
  4747. then
  4748. ENABLED_DHDEFAULTPARAMS=yes
  4749. AM_CFLAGS="$AM_CFLAGS -DHAVE_DH_DEFAULT_PARAMS"
  4750. fi
  4751. # User Settings
  4752. AC_ARG_ENABLE([usersettings],
  4753. [AS_HELP_STRING([--enable-usersettings],[Use your own user_settings.h and do not add Makefile CFLAGS (default: disabled)])],
  4754. [ ENABLED_USERSETTINGS=$enableval ],
  4755. [ ENABLED_USERSETTINGS=no ]
  4756. )
  4757. # Default optimization CFLAGS enable
  4758. AC_ARG_ENABLE([optflags],
  4759. [AS_HELP_STRING([--enable-optflags],[Enable default optimization CFLAGS for the compiler (default: enabled)])],
  4760. [ ENABLED_OPTFLAGS=$enableval ],
  4761. [ ENABLED_OPTFLAGS=yes ]
  4762. )
  4763. # check if should run the trusted peer certs test
  4764. # (for now checking both C_FLAGS and C_EXTRA_FLAGS)
  4765. AS_CASE(["$CFLAGS $CPPFLAGS"],[*'WOLFSSL_TRUST_PEER_CERT'*],[ENABLED_TRUSTED_PEER_CERT=yes])
  4766. # dertermine if we have key validation mechanism
  4767. if test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_RSA" = "xyes"
  4768. then
  4769. if test "x$ENABLED_ASN" = "xyes"
  4770. then
  4771. ENABLED_PKI="yes"
  4772. fi
  4773. fi
  4774. # When building for wolfRand, strip out all options to disable everything.
  4775. AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$FIPS_VERSION" = "xrand"],
  4776. [NEW_AM_CFLAGS="-DNO_AES -DNO_DH -DNO_ASN -DNO_RSA -DNO_SHA -DNO_MD5 -DNO_BIG_INT"
  4777. for v in $AM_CFLAGS
  4778. do
  4779. case $v in
  4780. -DHAVE_FFDHE_2048 | -DTFM_TIMING_RESISTANT | -DECC_TIMING_RESISTANT | \
  4781. -DWC_RSA_BLINDING | -DHAVE_AESGCM | -DWOLFSSL_SHA512 | -DWOLFSSL_SHA384 | \
  4782. -DHAVE_ECC | -DTFM_ECC256 | -DECC_SHAMIR | -DHAVE_TLS_EXTENSIONS | \
  4783. -DHAVE_SUPPORTED_CURVES | -DHAVE_EXTENDED_MASTER | -DUSE_FAST_MATH)
  4784. AS_ECHO(["ignoring $v"])
  4785. ;;
  4786. *)
  4787. NEW_AM_CFLAGS="$NEW_AM_CFLAGS $v"
  4788. ;;
  4789. esac
  4790. done
  4791. AM_CFLAGS=$NEW_AM_CFLAGS])
  4792. case $host_cpu in
  4793. *arm*)
  4794. if test $host_alias = "thumb"; then
  4795. AM_CFLAGS="$AM_CFLAGS -mthumb -march=armv6"
  4796. else
  4797. if test $host_alias = "cortex"; then
  4798. AM_CFLAGS="$AM_CFLAGS -mcpu=cortex-r5"
  4799. fi
  4800. fi
  4801. ;;
  4802. esac
  4803. ################################################################################
  4804. # Check for build-type conflicts #
  4805. ################################################################################
  4806. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  4807. test "x$ENABLED_LEANPSK" = "xyes"],
  4808. [AC_MSG_ERROR([Cannot use Max Strength and Lean PSK at the same time.])])
  4809. AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
  4810. test "x$ENABLED_ASN" = "xno"],
  4811. [AC_MSG_ERROR([please enable asn if enabling ocsp.])])
  4812. AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
  4813. test "x$ENABLED_RSA" = "xno" && \
  4814. test "x$ENABLED_ECC" = "xno"],
  4815. [AC_MSG_ERROR([please enable rsa or ecc if enabling ocsp.])])
  4816. # Sync Intel QA and Sync Cavium Octeon require the crypto callback
  4817. AS_IF([test "x$ENABLED_INTEL_QA_SYNC" = "xyes" || test "x$ENABLED_OCTEON_SYNC" = "xyes"],
  4818. [AS_IF([test "x$ENABLED_CRYPTOCB" = "xno"],
  4819. [AC_MSG_ERROR([please enable the crypto callback support using --enable-cryptocb])])])
  4820. # checks for pkcs7 needed enables
  4821. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  4822. test "x$ENABLED_RSA" = "xno" && \
  4823. test "x$ENABLED_ECC" = "xno"],
  4824. [AC_MSG_ERROR([please enable ecc or rsa if enabling pkcs7.])])
  4825. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  4826. test "x$ENABLED_SHA" = "xno"],
  4827. [AC_MSG_ERROR([please enable sha if enabling pkcs7.])])
  4828. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  4829. test "x$ENABLED_AES" = "xno" && \
  4830. test "x$ENABLED_DES3" = "xno"],
  4831. [AC_MSG_ERROR([please enable either AES or 3DES if enabling pkcs7.])])
  4832. AS_IF([test "x$ENABLED_WOLFSCEP" = "xyes" && \
  4833. test "x$ENABLED_AES" = "xno" && \
  4834. test "x$ENABLED_DES3" = "xno"],
  4835. [AC_MSG_ERROR([please enable either AES or 3DES if enabling scep.])])
  4836. AS_IF([test "x$ENABLED_LEANTLS" = "xyes" && \
  4837. test "x$ENABLED_ECC" = "xno"],
  4838. [AC_MSG_ERROR([please enable ecc if enabling leantls.])])
  4839. AS_IF([test "x$ENABLED_SNIFFER" = "xyes" && \
  4840. test "x$ENABLED_RSA" = "xno" && \
  4841. test "x$ENABLED_ECC" = "xno"],
  4842. [AC_MSG_ERROR([please enable ecc or rsa if enabling sniffer.])])
  4843. # Lean TLS forces off prereqs of SCEP.
  4844. AS_IF([test "x$ENABLED_SCEP" = "xyes" && \
  4845. test "x$ENABLED_LEANTLS" = "xyes"],
  4846. [AC_MSG_ERROR([Cannot use SCEP and Lean TLS at the same time.])])
  4847. # CMAC currently requires AES.
  4848. AS_IF([test "x$ENABLED_CMAC" = "xyes" && \
  4849. test "x$ENABLED_AES" = "xno"],
  4850. [AC_MSG_ERROR([cannot use CMAC without AES.])])
  4851. ################################################################################
  4852. # Update CFLAGS based on options #
  4853. ################################################################################
  4854. AS_IF([test "x$ENABLED_MCAPI" = "xyes"],
  4855. [AS_IF([test "x$ENABLED_DES3" = "xno"],[ENABLED_DES3="yes"])])
  4856. if test "$ENABLED_WOLFSCEP" = "yes"
  4857. then
  4858. # Enable prereqs if not already enabled
  4859. if test "x$ENABLED_KEYGEN" = "xno"
  4860. then
  4861. ENABLED_KEYGEN="yes"
  4862. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  4863. fi
  4864. if test "x$ENABLED_CERTGEN" = "xno"
  4865. then
  4866. ENABLED_CERTGEN="yes"
  4867. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  4868. fi
  4869. if test "x$ENABLED_CERTREQ" = "xno"
  4870. then
  4871. ENABLED_CERTREQ="yes"
  4872. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  4873. fi
  4874. if test "x$ENABLED_CERTEXT" = "xno"
  4875. then
  4876. ENABLED_CERTEXT="yes"
  4877. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  4878. fi
  4879. if test "x$ENABLED_PKCS7" = "xno"
  4880. then
  4881. ENABLED_PKCS7="yes"
  4882. fi
  4883. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_WOLFSCEP"
  4884. fi
  4885. if test "x$ENABLED_PKCS7" = "xyes"
  4886. then
  4887. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  4888. # Enable prereqs if not already enabled
  4889. if test "x$ENABLED_AESKEYWRAP" = "xno"
  4890. then
  4891. ENABLED_AESKEYWRAP="yes"
  4892. AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_KEYWRAP -DWOLFSSL_AES_DIRECT"
  4893. fi
  4894. if test "x$ENABLED_X963KDF" = "xno" && test "$ENABLED_ECC" != "no"
  4895. then
  4896. ENABLED_X963KDF="yes"
  4897. AM_CFLAGS="$AM_CFLAGS -DHAVE_X963_KDF"
  4898. fi
  4899. fi
  4900. if test "x$ENABLED_DES3" = "xno"
  4901. then
  4902. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  4903. else
  4904. # turn off DES3 if leanpsk or leantls on
  4905. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  4906. then
  4907. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  4908. ENABLED_DES3=no
  4909. fi
  4910. fi
  4911. if test "$ENABLED_AESGCM" != "no"
  4912. then
  4913. if test "$ENABLED_AESGCM" = "word32"
  4914. then
  4915. AM_CFLAGS="$AM_CFLAGS -DGCM_WORD32"
  4916. ENABLED_AESGCM=yes
  4917. fi
  4918. if test "$ENABLED_AESGCM" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
  4919. then
  4920. AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL"
  4921. ENABLED_AESGCM=yes
  4922. fi
  4923. if test "$ENABLED_AESGCM" = "table"
  4924. then
  4925. AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE"
  4926. ENABLED_AESGCM=yes
  4927. fi
  4928. if test "$ENABLED_AESGCM" = "4bit"
  4929. then
  4930. AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE_4BIT"
  4931. ENABLED_AESGCM=yes
  4932. fi
  4933. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  4934. fi
  4935. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes"],
  4936. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MAX_STRENGTH"])
  4937. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  4938. test "x$ENABLED_OLD_TLS" = "xyes"],
  4939. [AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  4940. ENABLED_OLD_TLS=no])
  4941. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  4942. test "x$ENABLED_SSLV3" = "xyes"],
  4943. [AC_MSG_ERROR([Cannot use Max Strength and SSLv3 at the same time.])])
  4944. AS_IF([test "x$ENABLED_SCTP" = "xyes"],
  4945. [AM_CFLAGS="-DWOLFSSL_SCTP $AM_CFLAGS"])
  4946. AS_IF([test "x$ENABLED_MCAST" = "xyes"],
  4947. [AM_CFLAGS="-DWOLFSSL_MULTICAST $AM_CFLAGS"])
  4948. # WOLFSSL_AFALG does not support SHA224 yet
  4949. AS_IF([(test "x$ENABLED_AFALG" = "xyes") && (test "x$ENABLED_SHA224" = "xyes")],
  4950. [AC_MSG_ERROR([--enable-sha224 with --enable-afalg not yet supported])])
  4951. # WOLFSSL_DEVCRYPTO does not support SHA224 yet
  4952. AS_IF([(test "x$ENABLED_DEVCRYPTO" = "xyes") && (test "x$ENABLED_SHA224" = "xyes")],
  4953. [AC_MSG_ERROR([--enable-sha224 with --enable-devcrypto not yet supported])])
  4954. # SCTP and Multicast require DTLS
  4955. AS_IF([(test "x$ENABLED_DTLS" = "xno") && \
  4956. (test "x$ENABLED_SCTP" = "xyes" || test "x$ENABLED_MCAST" = "xyes")],
  4957. [AM_CFLAGS="-DWOLFSSL_DTLS $AM_CFLAGS"
  4958. ENABLED_DTLS=yes])
  4959. # Multicast requires the null cipher
  4960. AS_IF([test "x$ENABLED_NULL_CIPHER" = "xno" && \
  4961. test "x$ENABLED_MCAST" = "xyes"],
  4962. [AM_CFLAGS="-DHAVE_NULL_CIPHER $AM_CFLAGS"
  4963. ENABLED_NULL_CIPHER=yes])
  4964. # wolfSSH and WPA Supplicant both need Public MP, only enable once.
  4965. # This will let you know if you enabled wolfSSH but have any of the prereqs
  4966. # disabled. Some of these options, disabling them adds things to the FLAGS and
  4967. # you need to check and add items in two places depending on the option.
  4968. AS_IF([test "x$ENABLED_WOLFSSH" = "xyes"],[AS_IF([test "x$ENABLED_WPAS" = "xno"],[AM_CFLAGS="-DWOLFSSL_PUBLIC_MP $AM_CFLAGS"])])
  4969. if test "x$ENABLED_OPENSSLCOEXIST" = "xyes"; then
  4970. if test "x$ENABLED_OPENSSLALL" = "xyes"; then
  4971. AC_MSG_ERROR([Cannot use --enable-opensslcoexist with --enable-opensslall])
  4972. fi
  4973. if test "x$ENABLED_OPENSSLEXTRA" = "xyes"; then
  4974. AC_MSG_ERROR([Cannot use --enable-opensslcoexist with --enable-opensslextra])
  4975. fi
  4976. fi
  4977. if test "x$ENABLED_CERTS" = "xno" || test "x$ENABLED_LEANPSK" = "xyes" || test "x$ENABLED_ASN" = "xno"; then
  4978. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS"
  4979. fi
  4980. ################################################################################
  4981. # USER SETTINGS
  4982. if test "x$ENABLED_USERSETTINGS" = "xyes"
  4983. then
  4984. # Replace all options and just use WOLFSSL_USER_SETTINGS
  4985. AM_CFLAGS="-DWOLFSSL_USER_SETTINGS"
  4986. fi
  4987. # OPTIMIZE FLAGS
  4988. # For distro disable custom build options that interfere with symbol generation
  4989. if test "$GCC" = "yes" && test "$ENABLED_DISTRO" = "no"
  4990. then
  4991. AM_CFLAGS="$AM_CFLAGS -Wall -Wno-unused"
  4992. if test "$ax_enable_debug" = "no"
  4993. then
  4994. AS_IF([test "x$ENABLED_OPTFLAGS" = "xyes"], [
  4995. if test "$ENABLED_FASTMATH" = "yes"
  4996. then
  4997. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  4998. if test "$ENABLED_FASTHUGEMATH" = "yes"
  4999. then
  5000. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  5001. fi
  5002. else
  5003. if test "$ENABLED_SP" = "yes" && test "$ENABLED_SP_SMALL" = "no"
  5004. then
  5005. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  5006. if test "$ENABLED_FASTHUGEMATH" = "yes"
  5007. then
  5008. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  5009. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_INT_LARGE_COMBA"
  5010. fi
  5011. else
  5012. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_CFLAGS"
  5013. fi
  5014. fi
  5015. ])
  5016. fi
  5017. fi
  5018. # ICC command line warning for non supported warning flags
  5019. if test "$CC" = "icc"
  5020. then
  5021. AM_CFLAGS="$AM_CFLAGS -wd10006"
  5022. fi
  5023. # Expose HAVE___UINT128_T to options flags"
  5024. if test "$ac_cv_type___uint128_t" = "yes"
  5025. then
  5026. AM_CFLAGS="$AM_CFLAGS -DHAVE___UINT128_T=1"
  5027. fi
  5028. LIB_SOCKET_NSL
  5029. AX_HARDEN_CC_COMPILER_FLAGS
  5030. # if mingw then link to ws2_32 for sockets
  5031. case $host_os in
  5032. mingw*)
  5033. LDFLAGS="$LDFLAGS -lws2_32"
  5034. if test "$enable_shared" = "yes"
  5035. then
  5036. AC_DEFINE([WOLFSSL_DLL], [1], [Use __declspec(dllexport) when building library])
  5037. if test "$enable_static" = "yes"
  5038. then
  5039. MINGW_LIB_WARNING="yes"
  5040. fi
  5041. fi ;;
  5042. esac
  5043. if test "x$ENABLED_LINUXKM" = "xyes"; then
  5044. AX_SIMD_CC_COMPILER_FLAGS
  5045. AC_SUBST([CFLAGS_FPU_DISABLE])
  5046. AC_SUBST([CFLAGS_FPU_ENABLE])
  5047. AC_SUBST([CFLAGS_SIMD_DISABLE])
  5048. AC_SUBST([CFLAGS_SIMD_ENABLE])
  5049. AC_SUBST([CFLAGS_AUTO_VECTORIZE_DISABLE])
  5050. AC_SUBST([CFLAGS_AUTO_VECTORIZE_ENABLE])
  5051. AC_SUBST([ASFLAGS_FPU_DISABLE_SIMD_ENABLE])
  5052. AC_SUBST([ASFLAGS_FPU_ENABLE_SIMD_DISABLE])
  5053. AC_SUBST([ASFLAGS_FPUSIMD_DISABLE])
  5054. AC_SUBST([ASFLAGS_FPUSIMD_ENABLE])
  5055. if test "$ENABLED_FILESYSTEM" = "yes"; then
  5056. AC_MSG_ERROR([--enable-filesystem is incompatible with --enable-linuxkm.])
  5057. fi
  5058. if test "$ENABLED_AFALG" = "yes"; then
  5059. AC_MSG_ERROR([--enable-afalg is incompatible with --enable-linuxkm.])
  5060. fi
  5061. if test "$ENABLED_DEVCRYPTO" = "yes"; then
  5062. AC_MSG_ERROR([--enable-devcrypto is incompatible with --enable-linuxkm.])
  5063. fi
  5064. if test "$ENABLED_PKCS11" = "yes"; then
  5065. AC_MSG_ERROR([--enable-pkcs11 is incompatible with --enable-linuxkm.])
  5066. fi
  5067. if test "$ENABLED_JNI" = "yes"; then
  5068. AC_MSG_ERROR([--enable-jni is incompatible with --enable-linuxkm.])
  5069. fi
  5070. if test "$ENABLED_16BIT" = "yes"; then
  5071. AC_MSG_ERROR([--enable-16bit is incompatible with --enable-linuxkm.])
  5072. fi
  5073. if test "$ENABLED_SINGLETHREADED" = "yes"; then
  5074. AC_MSG_ERROR([--enable-singlethreaded is incompatible with --enable-linuxkm.])
  5075. fi
  5076. if test "$ENABLED_VALGRIND" = "yes"; then
  5077. AC_MSG_ERROR([--enable-valgrind is incompatible with --enable-linuxkm.])
  5078. fi
  5079. if test "$ENABLED_FASTMATH" = "yes"; then
  5080. AC_MSG_ERROR([--enable-fastmath is incompatible with --enable-linuxkm (exceeds stack limit).])
  5081. fi
  5082. if test "$ENABLED_FAST_RSA" = "yes"; then
  5083. AC_MSG_ERROR([--enable-fastrsa is incompatible with --enable-linuxkm.])
  5084. fi
  5085. if test "$ENABLED_LIBZ_RSA" = "yes"; then
  5086. AC_MSG_ERROR([--with-libz is incompatible with --enable-linuxkm.])
  5087. fi
  5088. if test "$ENABLED_IOPOOL" = "yes"; then
  5089. AC_MSG_ERROR([--enable-iopool is incompatible with --enable-linuxkm.])
  5090. fi
  5091. #FIPS currently depends on thread-local storage
  5092. if test "$ENABLED_FIPS" = "yes"; then
  5093. AC_MSG_ERROR([--enable-fips is incompatible with --enable-linuxkm.])
  5094. fi
  5095. if test "$ENABLED_EXAMPLES" = "yes"; then
  5096. AC_MSG_ERROR([--enable-examples is incompatible with --enable-linuxkm.])
  5097. fi
  5098. if test "$ENABLED_SMALL_STACK" != "yes"; then
  5099. AC_MSG_ERROR([--enable-smallstack is required for --enable-linuxkm.])
  5100. fi
  5101. if test "$ENABLED_SP_MATH" = "no" && test "$ENABLED_SP_MATH_ALL" = "no"; then
  5102. AC_MSG_ERROR([--enable-sp-math or --enable-sp-math-all is required for --enable-linuxkm.])
  5103. fi
  5104. if test "$ENABLED_STACKSIZE" != "no"; then
  5105. AC_MSG_ERROR([--enable-stacksize is incompatible with --enable-linuxkm.])
  5106. fi
  5107. if test "$ENABLED_STACKLOG" = "yes"; then
  5108. AC_MSG_ERROR([--enable-stacklog is incompatible with --enable-linuxkm.])
  5109. fi
  5110. if test "$ENABLED_COMPKEY" = "yes"; then
  5111. AC_MSG_ERROR([--enable-compkey is incompatible with --enable-linuxkm.])
  5112. fi
  5113. fi
  5114. # The following AM_CONDITIONAL statements set flags for use in the Makefiles.
  5115. # Some of these affect build targets and objects, some trigger different
  5116. # test scripts for make check.
  5117. AM_CONDITIONAL([BUILD_DISTRO],[test "x$ENABLED_DISTRO" = "xyes"])
  5118. AM_CONDITIONAL([BUILD_ALL],[test "x$ENABLED_ALL" = "xyes"])
  5119. AM_CONDITIONAL([BUILD_TLS13],[test "x$ENABLED_TLS13" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5120. AM_CONDITIONAL([BUILD_RNG],[test "x$ENABLED_RNG" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5121. AM_CONDITIONAL([BUILD_SCTP],[test "x$ENABLED_SCTP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5122. AM_CONDITIONAL([BUILD_MCAST],[test "x$ENABLED_MCAST" = "xyes"])
  5123. AM_CONDITIONAL([BUILD_IPV6],[test "x$ENABLED_IPV6" = "xyes"])
  5124. AM_CONDITIONAL([BUILD_LEANPSK],[test "x$ENABLED_LEANPSK" = "xyes"])
  5125. AM_CONDITIONAL([BUILD_LEANTLS],[test "x$ENABLED_LEANTLS" = "xyes"])
  5126. AM_CONDITIONAL([BUILD_LOWMEM],[test "x$ENABLED_LOWRESOURCE" = "xyes"])
  5127. AM_CONDITIONAL([BUILD_PKCALLBACKS], [ test "x$ENABLED_PKCALLBACKS" = "xyes"])
  5128. AM_CONDITIONAL([BUILD_CRYPTOAUTHLIB],[test "x$ENABLED_CRYPTOAUTHLIB" = "xyes"])
  5129. AM_CONDITIONAL([BUILD_SNIFFER], [ test "x$ENABLED_SNIFFER" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5130. AM_CONDITIONAL([BUILD_SNIFFTEST],[ test "x$ENABLED_SNIFFTEST" = "xyes"])
  5131. AM_CONDITIONAL([BUILD_AESGCM],[test "x$ENABLED_AESGCM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5132. AM_CONDITIONAL([BUILD_AESCCM],[test "x$ENABLED_AESCCM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5133. AM_CONDITIONAL([BUILD_ARMASM],[test "x$ENABLED_ARMASM" = "xyes"])
  5134. AM_CONDITIONAL([BUILD_XILINX],[test "x$ENABLED_XILINX" = "xyes"])
  5135. AM_CONDITIONAL([BUILD_AESNI],[test "x$ENABLED_AESNI" = "xyes"])
  5136. AM_CONDITIONAL([BUILD_INTELASM],[test "x$ENABLED_INTELASM" = "xyes"])
  5137. AM_CONDITIONAL([BUILD_AFALG],[test "x$ENABLED_AFALG" = "xyes"])
  5138. AM_CONDITIONAL([BUILD_DEVCRYPTO],[test "x$ENABLED_DEVCRYPTO" = "xyes"])
  5139. AM_CONDITIONAL([BUILD_CAMELLIA],[test "x$ENABLED_CAMELLIA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5140. AM_CONDITIONAL([BUILD_MD2],[test "x$ENABLED_MD2" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5141. AM_CONDITIONAL([BUILD_RIPEMD],[test "x$ENABLED_RIPEMD" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5142. AM_CONDITIONAL([BUILD_BLAKE2],[test "x$ENABLED_BLAKE2" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5143. AM_CONDITIONAL([BUILD_BLAKE2S],[test "x$ENABLED_BLAKE2S" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5144. AM_CONDITIONAL([BUILD_SHA512],[test "x$ENABLED_SHA512" = "xyes" || test "x$ENABLED_SHA384" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5145. AM_CONDITIONAL([BUILD_DSA],[test "x$ENABLED_DSA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5146. AM_CONDITIONAL([BUILD_ECC],[test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5147. AM_CONDITIONAL([BUILD_ED25519],[test "x$ENABLED_ED25519" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5148. AM_CONDITIONAL([BUILD_ED25519_SMALL],[test "x$ENABLED_ED25519_SMALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5149. AM_CONDITIONAL([BUILD_FEMATH], [test "x$ENABLED_FEMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5150. AM_CONDITIONAL([BUILD_GEMATH], [test "x$ENABLED_GEMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5151. AM_CONDITIONAL([BUILD_CURVE25519],[test "x$ENABLED_CURVE25519" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5152. AM_CONDITIONAL([BUILD_CURVE25519_SMALL],[test "x$ENABLED_CURVE25519_SMALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5153. AM_CONDITIONAL([BUILD_ED448],[test "x$ENABLED_ED448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5154. AM_CONDITIONAL([BUILD_ED448_SMALL],[test "x$ENABLED_ED448_SMALL" = "xyes"])
  5155. AM_CONDITIONAL([BUILD_FE448], [test "x$ENABLED_FE448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5156. AM_CONDITIONAL([BUILD_GE448], [test "x$ENABLED_GE448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5157. AM_CONDITIONAL([BUILD_CURVE448],[test "x$ENABLED_CURVE448" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5158. AM_CONDITIONAL([BUILD_CURVE448_SMALL],[test "x$ENABLED_CURVE448_SMALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5159. AM_CONDITIONAL([BUILD_MEMORY],[test "x$ENABLED_MEMORY" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5160. AM_CONDITIONAL([BUILD_RSA],[test "x$ENABLED_RSA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5161. AM_CONDITIONAL([BUILD_DH],[test "x$ENABLED_DH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5162. AM_CONDITIONAL([BUILD_ASN],[test "x$ENABLED_ASN" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5163. AM_CONDITIONAL([BUILD_AES],[test "x$ENABLED_AES" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5164. AM_CONDITIONAL([BUILD_CODING],[test "x$ENABLED_CODING" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5165. AM_CONDITIONAL([BUILD_IDEA],[test "x$ENABLED_IDEA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5166. AM_CONDITIONAL([BUILD_RC4],[test "x$ENABLED_ARC4" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5167. AM_CONDITIONAL([BUILD_MD5],[test "x$ENABLED_MD5" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5168. AM_CONDITIONAL([BUILD_SHA],[test "x$ENABLED_SHA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5169. AM_CONDITIONAL([BUILD_HC128],[test "x$ENABLED_HC128" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5170. AM_CONDITIONAL([BUILD_RABBIT],[test "x$ENABLED_RABBIT" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5171. AM_CONDITIONAL([BUILD_FIPS],[test "x$ENABLED_FIPS" = "xyes"])
  5172. AM_CONDITIONAL([BUILD_FIPS_V1],[test "x$FIPS_VERSION" = "xv1"])
  5173. AM_CONDITIONAL([BUILD_FIPS_V2],[test "x$FIPS_VERSION" = "xv2"])
  5174. AM_CONDITIONAL([BUILD_FIPS_RAND],[test "x$FIPS_VERSION" = "xrand"])
  5175. AM_CONDITIONAL([BUILD_FIPS_READY],[test "x$FIPS_READY" = "xyes"])
  5176. AM_CONDITIONAL([BUILD_CMAC],[test "x$ENABLED_CMAC" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5177. AM_CONDITIONAL([BUILD_SELFTEST],[test "x$ENABLED_SELFTEST" = "xyes"])
  5178. AM_CONDITIONAL([BUILD_SHA224],[test "x$ENABLED_SHA224" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5179. AM_CONDITIONAL([BUILD_SHA3],[test "x$ENABLED_SHA3" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5180. AM_CONDITIONAL([BUILD_POLY1305],[test "x$ENABLED_POLY1305" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5181. AM_CONDITIONAL([BUILD_CHACHA],[test "x$ENABLED_CHACHA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5182. AM_CONDITIONAL([BUILD_XCHACHA],[test "x$ENABLED_XCHACHA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5183. AM_CONDITIONAL([BUILD_INLINE],[test "x$ENABLED_INLINE" = "xyes"])
  5184. AM_CONDITIONAL([BUILD_OCSP],[test "x$ENABLED_OCSP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5185. AM_CONDITIONAL([BUILD_OCSP_STAPLING],[test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"])
  5186. AM_CONDITIONAL([BUILD_OCSP_STAPLING_V2],[test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"])
  5187. AM_CONDITIONAL([BUILD_CRL],[test "x$ENABLED_CRL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5188. AM_CONDITIONAL([BUILD_CRL_MONITOR],[test "x$ENABLED_CRL_MONITOR" = "xyes"])
  5189. AM_CONDITIONAL([BUILD_USER_RSA],[test "x$ENABLED_USER_RSA" = "xyes"] )
  5190. AM_CONDITIONAL([BUILD_USER_CRYPTO],[test "x$ENABLED_USER_CRYPTO" = "xyes"])
  5191. AM_CONDITIONAL([BUILD_NTRU],[test "x$ENABLED_NTRU" = "xyes"])
  5192. AM_CONDITIONAL([BUILD_WNR],[test "x$ENABLED_WNR" = "xyes"])
  5193. AM_CONDITIONAL([BUILD_SRP],[test "x$ENABLED_SRP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5194. AM_CONDITIONAL([USE_VALGRIND],[test "x$ENABLED_VALGRIND" = "xyes"])
  5195. AM_CONDITIONAL([BUILD_MD4],[test "x$ENABLED_MD4" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5196. AM_CONDITIONAL([BUILD_PWDBASED],[test "x$ENABLED_PWDBASED" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5197. AM_CONDITIONAL([BUILD_SCRYPT],[test "x$ENABLED_SCRYPT" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5198. AM_CONDITIONAL([BUILD_CRYPTONLY],[test "x$ENABLED_CRYPTONLY" = "xyes" && test "x$ENABLED_OPENSSLEXTRA" = "xno"])
  5199. AM_CONDITIONAL([BUILD_FASTMATH],[test "x$ENABLED_FASTMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5200. AM_CONDITIONAL([BUILD_SLOWMATH],[test "x$ENABLED_SLOWMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5201. AM_CONDITIONAL([BUILD_EXAMPLE_SERVERS],[test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  5202. AM_CONDITIONAL([BUILD_EXAMPLE_CLIENTS],[test "x$ENABLED_EXAMPLES" = "xyes"])
  5203. AM_CONDITIONAL([BUILD_TESTS],[test "x$ENABLED_EXAMPLES" = "xyes"])
  5204. AM_CONDITIONAL([BUILD_THREADED_EXAMPLES],[test "x$ENABLED_SINGLETHREADED" = "xno" && test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  5205. AM_CONDITIONAL([BUILD_WOLFCRYPT_TESTS],[test "x$ENABLED_CRYPT_TESTS" = "xyes"])
  5206. AM_CONDITIONAL([BUILD_LIBZ],[test "x$ENABLED_LIBZ" = "xyes"])
  5207. AM_CONDITIONAL([BUILD_PKCS11],[test "x$ENABLED_PKCS11" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5208. AM_CONDITIONAL([BUILD_PKCS12],[test "x$ENABLED_PKCS12" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5209. AM_CONDITIONAL([BUILD_CAVIUM],[test "x$ENABLED_CAVIUM" = "xyes"])
  5210. AM_CONDITIONAL([BUILD_CAVIUM_V],[test "x$ENABLED_CAVIUM_V" = "xyes"])
  5211. AM_CONDITIONAL([BUILD_OCTEON_SYNC],[test "x$ENABLED_OCTEON_SYNC" = "xyes"])
  5212. AM_CONDITIONAL([BUILD_INTEL_QA],[test "x$ENABLED_INTEL_QA" = "xyes"])
  5213. AM_CONDITIONAL([BUILD_INTEL_QA_SYNC],[test "x$ENABLED_INTEL_QA_SYNC" = "xyes"])
  5214. AM_CONDITIONAL([BUILD_SP],[test "x$ENABLED_SP" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5215. AM_CONDITIONAL([BUILD_SP_C],[(test "x$ENABLED_SP" = "xyes" && test "x$ENABLED_SP_ASM" = "xno") || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5216. AM_CONDITIONAL([BUILD_SP_ARM64],[test "x$ENABLED_SP_ARM64_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5217. AM_CONDITIONAL([BUILD_SP_ARM32],[test "x$ENABLED_SP_ARM32_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5218. AM_CONDITIONAL([BUILD_SP_ARM_THUMB],[test "x$ENABLED_SP_ARM_THUMB_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5219. AM_CONDITIONAL([BUILD_SP_ARM_CORTEX],[test "x$ENABLED_SP_ARM_CORTEX_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5220. AM_CONDITIONAL([BUILD_SP_X86_64],[test "x$ENABLED_SP_X86_64_ASM" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5221. AM_CONDITIONAL([BUILD_SP_INT],[test "x$ENABLED_SP_MATH" = "xyes" || test "x$ENABLED_SP_MATH_ALL" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5222. AM_CONDITIONAL([BUILD_FAST_RSA],[test "x$ENABLED_FAST_RSA" = "xyes"])
  5223. AM_CONDITIONAL([BUILD_MCAPI],[test "x$ENABLED_MCAPI" = "xyes"])
  5224. AM_CONDITIONAL([BUILD_ASYNCCRYPT],[test "x$ENABLED_ASYNCCRYPT" = "xyes"])
  5225. AM_CONDITIONAL([BUILD_WOLFEVENT],[test "x$ENABLED_ASYNCCRYPT" = "xyes"])
  5226. AM_CONDITIONAL([BUILD_CRYPTOCB],[test "x$ENABLED_CRYPTOCB" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5227. AM_CONDITIONAL([BUILD_PSK],[test "x$ENABLED_PSK" = "xyes"])
  5228. AM_CONDITIONAL([BUILD_TRUST_PEER_CERT],[test "x$ENABLED_TRUSTED_PEER_CERT" = "xyes"])
  5229. AM_CONDITIONAL([BUILD_PKI],[test "x$ENABLED_PKI" = "xyes"])
  5230. AM_CONDITIONAL([BUILD_DES3],[test "x$ENABLED_DES3" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5231. AM_CONDITIONAL([BUILD_PKCS7],[test "x$ENABLED_PKCS7" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
  5232. AM_CONDITIONAL([BUILD_HASHFLAGS],[test "x$ENABLED_HASHFLAGS" = "xyes"])
  5233. AM_CONDITIONAL([BUILD_LINUXKM],[test "$ENABLED_LINUXKM" = "yes"])
  5234. AM_CONDITIONAL([BUILD_NO_LIBRARY],[test "$ENABLED_NO_LIBRARY" = "yes"])
  5235. AM_CONDITIONAL([BUILD_RC2],[test "x$ENABLED_RC2" = "xyes"])
  5236. if test "$ax_enable_debug" = "yes" ||
  5237. test "$ENABLED_STACKSIZE" != "no" ||
  5238. (test "$ENABLED_LEANTLS" = "no" &&
  5239. test "$ENABLED_LEANPSK" = "no" &&
  5240. test "$ENABLED_LOWRESOURCE" = "no")
  5241. then
  5242. AM_CFLAGS="$AM_CFLAGS -DHAVE_WC_INTROSPECTION"
  5243. fi
  5244. CREATE_HEX_VERSION
  5245. AC_SUBST([AM_CPPFLAGS])
  5246. AC_SUBST([AM_CFLAGS])
  5247. AC_SUBST([AM_LDFLAGS])
  5248. AC_SUBST([AM_CCASFLAGS])
  5249. AC_SUBST([LIB_ADD])
  5250. AC_SUBST([LIB_STATIC_ADD])
  5251. # FINAL
  5252. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  5253. AC_CONFIG_FILES([Makefile
  5254. wolfssl/version.h
  5255. wolfssl/options.h
  5256. cyassl/options.h
  5257. support/wolfssl.pc
  5258. rpm/spec
  5259. wolfcrypt/test/test_paths.h
  5260. ])
  5261. AC_CONFIG_FILES([scripts/unit.test],[chmod +x scripts/unit.test])
  5262. AX_CREATE_GENERIC_CONFIG
  5263. AX_AM_JOBSERVER([yes])
  5264. AC_OUTPUT
  5265. # force make clean
  5266. echo "---"
  5267. echo "Running make clean..."
  5268. make clean >/dev/null 2>&1
  5269. # generate user options header
  5270. echo "---"
  5271. echo "Generating user options header..."
  5272. OPTION_FILE="wolfssl/options.h"
  5273. rm -f $OPTION_FILE
  5274. echo "/* wolfssl options.h" > $OPTION_FILE
  5275. echo " * generated from configure options" >> $OPTION_FILE
  5276. echo " *" >> $OPTION_FILE
  5277. echo " * Copyright (C) 2006-2020 wolfSSL Inc." >> $OPTION_FILE
  5278. echo " *" >> $OPTION_FILE
  5279. echo " * This file is part of wolfSSL. (formerly known as CyaSSL)" >> $OPTION_FILE
  5280. echo " *" >> $OPTION_FILE
  5281. echo " */" >> $OPTION_FILE
  5282. echo "" >> $OPTION_FILE
  5283. echo "#ifndef WOLFSSL_OPTIONS_H" >> $OPTION_FILE
  5284. echo "#define WOLFSSL_OPTIONS_H" >> $OPTION_FILE
  5285. echo "" >> $OPTION_FILE
  5286. echo "" >> $OPTION_FILE
  5287. echo "#ifdef __cplusplus" >> $OPTION_FILE
  5288. echo "extern \"C\" {" >> $OPTION_FILE
  5289. echo "#endif" >> $OPTION_FILE
  5290. echo "" >> $OPTION_FILE
  5291. for option in $CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS; do
  5292. defonly=`echo $option | sed 's/^-D//'`
  5293. if test "$defonly" != "$option"
  5294. then
  5295. noequalsign=`echo $defonly | sed 's/=/ /'`
  5296. if test "$noequalsign" = "NDEBUG" || test "$noequalsign" = "DEBUG"
  5297. then
  5298. echo "not outputting (N)DEBUG to $OPTION_FILE"
  5299. continue
  5300. fi
  5301. # allow user to ignore system options
  5302. ignoresys=$(echo "$noequalsign" | grep '^_.*')
  5303. if test -n "$ignoresys"
  5304. then
  5305. echo "#ifndef WOLFSSL_OPTIONS_IGNORE_SYS" >> $OPTION_FILE
  5306. fi
  5307. noarg=`echo $defonly | sed 's/=.*//'`
  5308. echo "#undef $noarg" >> $OPTION_FILE
  5309. echo "#define $noequalsign" >> $OPTION_FILE
  5310. if test -n "$ignoresys"
  5311. then
  5312. echo "#endif" >> $OPTION_FILE
  5313. fi
  5314. echo "" >> $OPTION_FILE
  5315. else
  5316. echo "option w/o begin -D is $option, not saving to $OPTION_FILE"
  5317. fi
  5318. done
  5319. echo "" >> $OPTION_FILE
  5320. echo "#ifdef __cplusplus" >> $OPTION_FILE
  5321. echo "}" >> $OPTION_FILE
  5322. echo "#endif" >> $OPTION_FILE
  5323. echo "" >> $OPTION_FILE
  5324. echo "" >> $OPTION_FILE
  5325. echo "#endif /* WOLFSSL_OPTIONS_H */" >> $OPTION_FILE
  5326. echo "" >> $OPTION_FILE
  5327. echo
  5328. #backwards compatibility for those who have included options or version
  5329. touch cyassl/options.h
  5330. echo "/* cyassl options.h" > cyassl/options.h
  5331. echo " * generated from wolfssl/options.h" >> cyassl/options.h
  5332. echo " */" >> cyassl/options.h
  5333. echo ""
  5334. while read -r line
  5335. do
  5336. echo "$line" >> cyassl/options.h
  5337. done < $OPTION_FILE
  5338. # switch ifdef protection in cyassl/option.h to CYASSL_OPTONS_H, remove bak
  5339. sed -i.bak 's/WOLFSSL_OPTIONS_H/CYASSL_OPTIONS_H/g' cyassl/options.h
  5340. # workaround for mingw sed that may get "Permission denied" trying to preserver permissions
  5341. case $host_os in
  5342. mingw*)
  5343. chmod u+w cyassl/options.h ;;
  5344. esac
  5345. rm cyassl/options.h.bak
  5346. # output config summary
  5347. echo "---"
  5348. echo "Configuration summary for $PACKAGE_NAME version $VERSION"
  5349. echo ""
  5350. echo " * Installation prefix: $prefix"
  5351. echo " * System type: $host_vendor-$host_os"
  5352. echo " * Host CPU: $host_cpu"
  5353. echo " * C Compiler: $CC"
  5354. echo " * C Flags: $CFLAGS"
  5355. echo " * C++ Compiler: $CXX"
  5356. echo " * C++ Flags: $CXXFLAGS"
  5357. echo " * CPP Flags: $CPPFLAGS"
  5358. echo " * CCAS Flags: $CCASFLAGS"
  5359. echo " * LIB Flags: $LIB"
  5360. test "$ENABLED_LINUXKM" = "yes" && \
  5361. echo " * Linux Kernel Build Root: $KERNEL_ROOT" && \
  5362. echo " * Linux Kernel Build Arch: $KERNEL_ARCH" && \
  5363. echo " * fpu disable C flags: $CFLAGS_FPU_DISABLE" && \
  5364. echo " * fpu enable C flags: $CFLAGS_FPU_ENABLE" && \
  5365. echo " * SIMD disable C flags: $CFLAGS_SIMD_DISABLE" && \
  5366. echo " * SIMD enable C flags: $CFLAGS_SIMD_ENABLE" && \
  5367. echo " * No-auto-vectorize C flags: $CFLAGS_AUTO_VECTORIZE_DISABLE" && \
  5368. echo " * Auto-vectorize C flags: $CFLAGS_AUTO_VECTORIZE_ENABLE" && \
  5369. echo " * SIMD enable as flags: $ASFLAGS_FPU_DISABLE_SIMD_ENABLE" && \
  5370. echo " * FPU enable as flags: $ASFLAGS_FPU_ENABLE_SIMD_DISABLE" && \
  5371. echo " * SIMD+FPU disable as flags: $ASFLAGS_FPUSIMD_DISABLE" && \
  5372. echo " * SIMD+FPU enable as flags: $ASFLAGS_FPUSIMD_ENABLE"
  5373. echo " * Debug enabled: $ax_enable_debug"
  5374. echo " * Coverage enabled: $ax_enable_coverage"
  5375. echo " * Warnings as failure: $ac_cv_warnings_as_errors"
  5376. echo " * make -j: $enable_jobserver"
  5377. echo " * VCS checkout: $ac_cv_vcs_checkout"
  5378. echo
  5379. echo " Features "
  5380. if test "$ENABLED_FIPS" = "yes"; then
  5381. echo " * FIPS: $FIPS_VERSION"
  5382. else
  5383. echo " * FIPS: $ENABLED_FIPS"
  5384. fi
  5385. echo " * Single threaded: $ENABLED_SINGLETHREADED"
  5386. echo " * Filesystem: $ENABLED_FILESYSTEM"
  5387. echo " * OpenSSH Build: $ENABLED_OPENSSH"
  5388. echo " * OpenSSL Extra API: $ENABLED_OPENSSLEXTRA"
  5389. echo " * OpenSSL Coexist: $ENABLED_OPENSSLCOEXIST"
  5390. echo " * Old Names: $ENABLED_OLDNAMES"
  5391. echo " * Max Strength Build: $ENABLED_MAXSTRENGTH"
  5392. echo " * Distro Build: $ENABLED_DISTRO"
  5393. echo " * fastmath: $ENABLED_FASTMATH"
  5394. echo " * Assembly Allowed: $ENABLED_ASM"
  5395. echo " * sniffer: $ENABLED_SNIFFER"
  5396. echo " * snifftest: $ENABLED_SNIFFTEST"
  5397. echo " * ARC4: $ENABLED_ARC4"
  5398. echo " * AES: $ENABLED_AES"
  5399. echo " * AES-NI: $ENABLED_AESNI"
  5400. echo " * AES-CBC: $ENABLED_AESCBC"
  5401. echo " * AES-GCM: $ENABLED_AESGCM"
  5402. echo " * AES-CCM: $ENABLED_AESCCM"
  5403. echo " * AES-CTR: $ENABLED_AESCTR"
  5404. echo " * AES-CFB: $ENABLED_AESCFB"
  5405. echo " * AES-OFB: $ENABLED_AESOFB"
  5406. echo " * DES3: $ENABLED_DES3"
  5407. echo " * IDEA: $ENABLED_IDEA"
  5408. echo " * Camellia: $ENABLED_CAMELLIA"
  5409. echo " * NULL Cipher: $ENABLED_NULL_CIPHER"
  5410. echo " * MD2: $ENABLED_MD2"
  5411. echo " * MD4: $ENABLED_MD4"
  5412. echo " * MD5: $ENABLED_MD5"
  5413. echo " * RIPEMD: $ENABLED_RIPEMD"
  5414. echo " * SHA: $ENABLED_SHA"
  5415. echo " * SHA-224: $ENABLED_SHA224"
  5416. echo " * SHA-384: $ENABLED_SHA384"
  5417. echo " * SHA-512: $ENABLED_SHA512"
  5418. echo " * SHA3: $ENABLED_SHA3"
  5419. echo " * SHAKE256: $ENABLED_SHAKE256"
  5420. echo " * BLAKE2: $ENABLED_BLAKE2"
  5421. echo " * BLAKE2S: $ENABLED_BLAKE2S"
  5422. echo " * CMAC: $ENABLED_CMAC"
  5423. echo " * keygen: $ENABLED_KEYGEN"
  5424. echo " * certgen: $ENABLED_CERTGEN"
  5425. echo " * certreq: $ENABLED_CERTREQ"
  5426. echo " * certext: $ENABLED_CERTEXT"
  5427. echo " * certgencache: $ENABLED_certgencache"
  5428. echo " * HC-128: $ENABLED_HC128"
  5429. echo " * RABBIT: $ENABLED_RABBIT"
  5430. echo " * CHACHA: $ENABLED_CHACHA"
  5431. echo " * XCHACHA: $ENABLED_XCHACHA"
  5432. echo " * Hash DRBG: $ENABLED_HASHDRBG"
  5433. echo " * PWDBASED: $ENABLED_PWDBASED"
  5434. echo " * scrypt: $ENABLED_SCRYPT"
  5435. echo " * wolfCrypt Only: $ENABLED_CRYPTONLY"
  5436. echo " * HKDF: $ENABLED_HKDF"
  5437. echo " * X9.63 KDF: $ENABLED_X963KDF"
  5438. echo " * MD4: $ENABLED_MD4"
  5439. echo " * PSK: $ENABLED_PSK"
  5440. echo " * Poly1305: $ENABLED_POLY1305"
  5441. echo " * LEANPSK: $ENABLED_LEANPSK"
  5442. echo " * LEANTLS: $ENABLED_LEANTLS"
  5443. echo " * RSA: $ENABLED_RSA"
  5444. echo " * RSA-PSS: $ENABLED_RSAPSS"
  5445. echo " * DSA: $ENABLED_DSA"
  5446. echo " * DH: $ENABLED_DH"
  5447. echo " * DH Default Parameters: $ENABLED_DHDEFAULTPARAMS"
  5448. echo " * ECC: $ENABLED_ECC"
  5449. echo " * ECC Custom Curves $ENABLED_ECCCUSTCURVES"
  5450. echo " * ECC Minimum Bits $ENABLED_ECCMINSZ"
  5451. echo " * CURVE25519: $ENABLED_CURVE25519"
  5452. echo " * ED25519: $ENABLED_ED25519"
  5453. echo " * CURVE448: $ENABLED_CURVE448"
  5454. echo " * ED448: $ENABLED_ED448"
  5455. echo " * FPECC: $ENABLED_FPECC"
  5456. echo " * ECC_ENCRYPT: $ENABLED_ECC_ENCRYPT"
  5457. echo " * ASN: $ENABLED_ASN"
  5458. echo " * Anonymous cipher: $ENABLED_ANON"
  5459. echo " * CODING: $ENABLED_CODING"
  5460. echo " * MEMORY: $ENABLED_MEMORY"
  5461. echo " * I/O POOL: $ENABLED_IOPOOL"
  5462. echo " * LIGHTY: $ENABLED_LIGHTY"
  5463. echo " * HAPROXY: $ENABLED_HAPROXY"
  5464. echo " * STUNNEL: $ENABLED_STUNNEL"
  5465. echo " * Apache httpd: $ENABLED_APACHE_HTTPD"
  5466. echo " * NGINX: $ENABLED_NGINX"
  5467. echo " * ASIO: $ENABLED_ASIO"
  5468. echo " * LIBWEBSOCKETS: $ENABLED_LIBWEBSOCKETS"
  5469. echo " * Qt $ENABLED_QT"
  5470. echo " * Qt Unit Testing $ENABLED_QT_TEST"
  5471. echo " * SIGNAL: $ENABLED_SIGNAL"
  5472. echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
  5473. echo " * DTLS: $ENABLED_DTLS"
  5474. echo " * SCTP: $ENABLED_SCTP"
  5475. echo " * Indefinite Length: $ENABLED_BER_INDEF"
  5476. echo " * Multicast: $ENABLED_MCAST"
  5477. echo " * SSL v3.0 (Old): $ENABLED_SSLV3"
  5478. echo " * TLS v1.0 (Old): $ENABLED_TLSV10"
  5479. echo " * TLS v1.1 (Old): $ENABLED_OLD_TLS"
  5480. echo " * TLS v1.2: $ENABLED_TLSV12"
  5481. echo " * TLS v1.3: $ENABLED_TLS13"
  5482. echo " * Post-handshake Auth: $ENABLED_TLS13_POST_AUTH"
  5483. echo " * Early Data: $ENABLED_TLS13_EARLY_DATA"
  5484. echo " * Send State in HRR Cookie: $ENABLED_SEND_HRR_COOKIE"
  5485. echo " * OCSP: $ENABLED_OCSP"
  5486. echo " * OCSP Stapling: $ENABLED_CERTIFICATE_STATUS_REQUEST"
  5487. echo " * OCSP Stapling v2: $ENABLED_CERTIFICATE_STATUS_REQUEST_V2"
  5488. echo " * CRL: $ENABLED_CRL"
  5489. echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
  5490. echo " * Persistent session cache: $ENABLED_SAVESESSION"
  5491. echo " * Persistent cert cache: $ENABLED_SAVECERT"
  5492. echo " * Atomic User Record Layer: $ENABLED_ATOMICUSER"
  5493. echo " * Public Key Callbacks: $ENABLED_PKCALLBACKS"
  5494. echo " * NTRU: $ENABLED_NTRU"
  5495. echo " * QSH: $ENABLED_QSH"
  5496. echo " * Whitewood netRandom: $ENABLED_WNR"
  5497. echo " * Server Name Indication: $ENABLED_SNI"
  5498. echo " * ALPN: $ENABLED_ALPN"
  5499. echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
  5500. echo " * Trusted CA Indication: $ENABLED_TRUSTED_CA"
  5501. echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
  5502. echo " * Supported Elliptic Curves: $ENABLED_SUPPORTED_CURVES"
  5503. echo " * FFDHE only in client: $ENABLED_FFDHE_ONLY"
  5504. echo " * Session Ticket: $ENABLED_SESSION_TICKET"
  5505. echo " * Extended Master Secret: $ENABLED_EXTENDED_MASTER"
  5506. echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
  5507. echo " * Secure Renegotiation: $ENABLED_SECURE_RENEGOTIATION"
  5508. echo " * Fallback SCSV: $ENABLED_FALLBACK_SCSV"
  5509. echo " * All TLS Extensions: $ENABLED_TLSX"
  5510. echo " * PKCS#7 $ENABLED_PKCS7"
  5511. echo " * wolfSSH $ENABLED_WOLFSSH"
  5512. echo " * wolfTPM $ENABLED_WOLFTPM"
  5513. echo " * wolfSCEP $ENABLED_WOLFSCEP"
  5514. echo " * Secure Remote Password $ENABLED_SRP"
  5515. echo " * Small Stack: $ENABLED_SMALL_STACK"
  5516. echo " * Linux Kernel Module: $ENABLED_LINUXKM"
  5517. echo " * valgrind unit tests: $ENABLED_VALGRIND"
  5518. echo " * LIBZ: $ENABLED_LIBZ"
  5519. echo " * Examples: $ENABLED_EXAMPLES"
  5520. echo " * Crypt tests: $ENABLED_CRYPT_TESTS"
  5521. echo " * Stack sizes in tests: $ENABLED_STACKSIZE"
  5522. echo " * Heap stats in tests: $ENABLED_TRACKMEMORY"
  5523. echo " * User Crypto: $ENABLED_USER_CRYPTO"
  5524. echo " * Fast RSA: $ENABLED_FAST_RSA"
  5525. echo " * Single Precision: $ENABLED_SP"
  5526. if test "$ENABLED_SP_MATH_ALL" != "no"
  5527. then
  5528. echo " * SP math implementation: all"
  5529. elif test "$ENABLED_SP_MATH" != "no"
  5530. then
  5531. echo " * SP math implementation: restricted"
  5532. else
  5533. echo " * SP math implementation: no"
  5534. fi
  5535. echo " * Async Crypto: $ENABLED_ASYNCCRYPT"
  5536. echo " * PKCS#11: $ENABLED_PKCS11"
  5537. echo " * PKCS#12: $ENABLED_PKCS12"
  5538. echo " * Cavium Nitrox: $ENABLED_CAVIUM"
  5539. echo " * Cavium Octeon (Sync): $ENABLED_OCTEON_SYNC"
  5540. echo " * Intel Quick Assist: $ENABLED_INTEL_QA"
  5541. echo " * ARM ASM: $ENABLED_ARMASM"
  5542. echo " * AES Key Wrap: $ENABLED_AESKEYWRAP"
  5543. echo " * Write duplicate: $ENABLED_WRITEDUP"
  5544. echo " * Xilinx Hardware Acc.: $ENABLED_XILINX"
  5545. echo " * Inline Code: $ENABLED_INLINE"
  5546. echo " * Linux AF_ALG: $ENABLED_AFALG"
  5547. echo " * Linux devcrypto: $ENABLED_DEVCRYPTO"
  5548. echo " * Crypto callbacks: $ENABLED_CRYPTOCB"
  5549. echo ""
  5550. echo "---"
  5551. echo >> config.h
  5552. echo "#define LIBWOLFSSL_CONFIGURE_ARGS \"$ac_configure_args\"" >> config.h
  5553. echo >> config.h
  5554. echo "#define LIBWOLFSSL_GLOBAL_CFLAGS \"$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS\"" >> config.h
  5555. ################################################################################
  5556. # Show warnings at bottom so they are noticed
  5557. ################################################################################
  5558. if test "$ENABLED_ASYNCCRYPT" = "yes"
  5559. then
  5560. AC_MSG_WARN([Make sure real async files are loaded. Contact wolfSSL for details on using the asynccrypt option.])
  5561. fi
  5562. # MinGW static vs shared library
  5563. # Reference URL from libtool for MinGW is located at
  5564. # http://www.gnu.org/software/libtool/manual/libtool.html#Cygwin-to-MinGW-Cross
  5565. # this allows for not even having dllimport/dllexport on functions
  5566. # with recent libtools, only requiring it with global variables.
  5567. #
  5568. # The following warning is displayed here because if not using "contemporary GNU
  5569. # tools" there is the possibility of export/import issues.
  5570. # wolfSSL uses __declspec(dllexport) and "contemporary GNU tools" handle the
  5571. # case where both static and shared libraries are built.
  5572. #
  5573. # More can be found about the MinGW linker at
  5574. # https://sourceware.org/binutils/docs/ld/WIN32.html
  5575. if test "$MINGW_LIB_WARNING" = "yes"
  5576. then
  5577. AC_MSG_WARN([Building with shared and static library at the same time on this system may cause export/import problems when using non contemporary GNU tools.])
  5578. fi