configure.ac 160 KB

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