12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824 |
- #!/bin/sh
- # ssl-opt.sh
- #
- # Copyright The Mbed TLS Contributors
- # SPDX-License-Identifier: Apache-2.0
- #
- # Licensed under the Apache License, Version 2.0 (the "License"); you may
- # not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- #
- # Purpose
- #
- # Executes tests to prove various TLS/SSL options and extensions.
- #
- # The goal is not to cover every ciphersuite/version, but instead to cover
- # specific options (max fragment length, truncated hmac, etc) or procedures
- # (session resumption from cache or ticket, renego, etc).
- #
- # The tests assume a build with default options, with exceptions expressed
- # with a dependency. The tests focus on functionality and do not consider
- # performance.
- #
- set -u
- # Limit the size of each log to 10 GiB, in case of failures with this script
- # where it may output seemingly unlimited length error logs.
- ulimit -f 20971520
- ORIGINAL_PWD=$PWD
- if ! cd "$(dirname "$0")"; then
- exit 125
- fi
- # default values, can be overridden by the environment
- : ${P_SRV:=../programs/ssl/ssl_server2}
- : ${P_CLI:=../programs/ssl/ssl_client2}
- : ${P_PXY:=../programs/test/udp_proxy}
- : ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system
- : ${GNUTLS_CLI:=gnutls-cli}
- : ${GNUTLS_SERV:=gnutls-serv}
- : ${PERL:=perl}
- guess_config_name() {
- if git diff --quiet ../include/mbedtls/config.h 2>/dev/null; then
- echo "default"
- else
- echo "unknown"
- fi
- }
- : ${MBEDTLS_TEST_OUTCOME_FILE=}
- : ${MBEDTLS_TEST_CONFIGURATION:="$(guess_config_name)"}
- : ${MBEDTLS_TEST_PLATFORM:="$(uname -s | tr -c \\n0-9A-Za-z _)-$(uname -m | tr -c \\n0-9A-Za-z _)"}
- O_SRV="$OPENSSL_CMD s_server -www -cert data_files/server5.crt -key data_files/server5.key"
- O_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_CMD s_client"
- G_SRV="$GNUTLS_SERV --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key"
- G_CLI="echo 'GET / HTTP/1.0' | $GNUTLS_CLI --x509cafile data_files/test-ca_cat12.crt"
- TCP_CLIENT="$PERL scripts/tcp_client.pl"
- # alternative versions of OpenSSL and GnuTLS (no default path)
- if [ -n "${OPENSSL_LEGACY:-}" ]; then
- O_LEGACY_SRV="$OPENSSL_LEGACY s_server -www -cert data_files/server5.crt -key data_files/server5.key"
- O_LEGACY_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_LEGACY s_client"
- else
- O_LEGACY_SRV=false
- O_LEGACY_CLI=false
- fi
- if [ -n "${GNUTLS_NEXT_SERV:-}" ]; then
- G_NEXT_SRV="$GNUTLS_NEXT_SERV --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key"
- else
- G_NEXT_SRV=false
- fi
- if [ -n "${GNUTLS_NEXT_CLI:-}" ]; then
- G_NEXT_CLI="echo 'GET / HTTP/1.0' | $GNUTLS_NEXT_CLI --x509cafile data_files/test-ca_cat12.crt"
- else
- G_NEXT_CLI=false
- fi
- TESTS=0
- FAILS=0
- SKIPS=0
- CONFIG_H='../include/mbedtls/config.h'
- MEMCHECK=0
- FILTER='.*'
- EXCLUDE='^$'
- SHOW_TEST_NUMBER=0
- RUN_TEST_NUMBER=''
- PRESERVE_LOGS=0
- # Pick a "unique" server port in the range 10000-19999, and a proxy
- # port which is this plus 10000. Each port number may be independently
- # overridden by a command line option.
- SRV_PORT=$(($$ % 10000 + 10000))
- PXY_PORT=$((SRV_PORT + 10000))
- print_usage() {
- echo "Usage: $0 [options]"
- printf " -h|--help\tPrint this help.\n"
- printf " -m|--memcheck\tCheck memory leaks and errors.\n"
- printf " -f|--filter\tOnly matching tests are executed (BRE)\n"
- printf " -e|--exclude\tMatching tests are excluded (BRE)\n"
- printf " -n|--number\tExecute only numbered test (comma-separated, e.g. '245,256')\n"
- printf " -s|--show-numbers\tShow test numbers in front of test names\n"
- printf " -p|--preserve-logs\tPreserve logs of successful tests as well\n"
- printf " --outcome-file\tFile where test outcomes are written\n"
- printf " \t(default: \$MBEDTLS_TEST_OUTCOME_FILE, none if empty)\n"
- printf " --port \tTCP/UDP port (default: randomish 1xxxx)\n"
- printf " --proxy-port\tTCP/UDP proxy port (default: randomish 2xxxx)\n"
- printf " --seed \tInteger seed value to use for this test run\n"
- }
- get_options() {
- while [ $# -gt 0 ]; do
- case "$1" in
- -f|--filter)
- shift; FILTER=$1
- ;;
- -e|--exclude)
- shift; EXCLUDE=$1
- ;;
- -m|--memcheck)
- MEMCHECK=1
- ;;
- -n|--number)
- shift; RUN_TEST_NUMBER=$1
- ;;
- -s|--show-numbers)
- SHOW_TEST_NUMBER=1
- ;;
- -p|--preserve-logs)
- PRESERVE_LOGS=1
- ;;
- --port)
- shift; SRV_PORT=$1
- ;;
- --proxy-port)
- shift; PXY_PORT=$1
- ;;
- --seed)
- shift; SEED="$1"
- ;;
- -h|--help)
- print_usage
- exit 0
- ;;
- *)
- echo "Unknown argument: '$1'"
- print_usage
- exit 1
- ;;
- esac
- shift
- done
- }
- # Make the outcome file path relative to the original directory, not
- # to .../tests
- case "$MBEDTLS_TEST_OUTCOME_FILE" in
- [!/]*)
- MBEDTLS_TEST_OUTCOME_FILE="$ORIGINAL_PWD/$MBEDTLS_TEST_OUTCOME_FILE"
- ;;
- esac
- # Skip next test; use this macro to skip tests which are legitimate
- # in theory and expected to be re-introduced at some point, but
- # aren't expected to succeed at the moment due to problems outside
- # our control (such as bugs in other TLS implementations).
- skip_next_test() {
- SKIP_NEXT="YES"
- }
- # skip next test if the flag is not enabled in config.h
- requires_config_enabled() {
- if grep "^#define $1" $CONFIG_H > /dev/null; then :; else
- SKIP_NEXT="YES"
- fi
- }
- # skip next test if the flag is enabled in config.h
- requires_config_disabled() {
- if grep "^#define $1" $CONFIG_H > /dev/null; then
- SKIP_NEXT="YES"
- fi
- }
- get_config_value_or_default() {
- # This function uses the query_config command line option to query the
- # required Mbed TLS compile time configuration from the ssl_server2
- # program. The command will always return a success value if the
- # configuration is defined and the value will be printed to stdout.
- #
- # Note that if the configuration is not defined or is defined to nothing,
- # the output of this function will be an empty string.
- ${P_SRV} "query_config=${1}"
- }
- requires_config_value_at_least() {
- VAL="$( get_config_value_or_default "$1" )"
- if [ -z "$VAL" ]; then
- # Should never happen
- echo "Mbed TLS configuration $1 is not defined"
- exit 1
- elif [ "$VAL" -lt "$2" ]; then
- SKIP_NEXT="YES"
- fi
- }
- requires_config_value_at_most() {
- VAL=$( get_config_value_or_default "$1" )
- if [ -z "$VAL" ]; then
- # Should never happen
- echo "Mbed TLS configuration $1 is not defined"
- exit 1
- elif [ "$VAL" -gt "$2" ]; then
- SKIP_NEXT="YES"
- fi
- }
- requires_ciphersuite_enabled() {
- if [ -z "$($P_CLI --help 2>/dev/null | grep $1)" ]; then
- SKIP_NEXT="YES"
- fi
- }
- # maybe_requires_ciphersuite_enabled CMD [RUN_TEST_OPTION...]
- # If CMD (call to a TLS client or server program) requires a specific
- # ciphersuite, arrange to only run the test case if this ciphersuite is
- # enabled. As an exception, do run the test case if it expects a ciphersuite
- # mismatch.
- maybe_requires_ciphersuite_enabled() {
- case "$1" in
- *\ force_ciphersuite=*) :;;
- *) return;; # No specific required ciphersuite
- esac
- ciphersuite="${1##*\ force_ciphersuite=}"
- ciphersuite="${ciphersuite%%[!-0-9A-Z_a-z]*}"
- shift
- case "$*" in
- *"-s SSL - The server has no ciphersuites in common"*)
- # This test case expects a ciphersuite mismatch, so it doesn't
- # require the ciphersuite to be enabled.
- ;;
- *)
- requires_ciphersuite_enabled "$ciphersuite"
- ;;
- esac
- unset ciphersuite
- }
- # skip next test if OpenSSL doesn't support FALLBACK_SCSV
- requires_openssl_with_fallback_scsv() {
- if [ -z "${OPENSSL_HAS_FBSCSV:-}" ]; then
- if $OPENSSL_CMD s_client -help 2>&1 | grep fallback_scsv >/dev/null
- then
- OPENSSL_HAS_FBSCSV="YES"
- else
- OPENSSL_HAS_FBSCSV="NO"
- fi
- fi
- if [ "$OPENSSL_HAS_FBSCSV" = "NO" ]; then
- SKIP_NEXT="YES"
- fi
- }
- # skip next test if GnuTLS isn't available
- requires_gnutls() {
- if [ -z "${GNUTLS_AVAILABLE:-}" ]; then
- if ( which "$GNUTLS_CLI" && which "$GNUTLS_SERV" ) >/dev/null 2>&1; then
- GNUTLS_AVAILABLE="YES"
- else
- GNUTLS_AVAILABLE="NO"
- fi
- fi
- if [ "$GNUTLS_AVAILABLE" = "NO" ]; then
- SKIP_NEXT="YES"
- fi
- }
- # skip next test if GnuTLS-next isn't available
- requires_gnutls_next() {
- if [ -z "${GNUTLS_NEXT_AVAILABLE:-}" ]; then
- if ( which "${GNUTLS_NEXT_CLI:-}" && which "${GNUTLS_NEXT_SERV:-}" ) >/dev/null 2>&1; then
- GNUTLS_NEXT_AVAILABLE="YES"
- else
- GNUTLS_NEXT_AVAILABLE="NO"
- fi
- fi
- if [ "$GNUTLS_NEXT_AVAILABLE" = "NO" ]; then
- SKIP_NEXT="YES"
- fi
- }
- # skip next test if OpenSSL-legacy isn't available
- requires_openssl_legacy() {
- if [ -z "${OPENSSL_LEGACY_AVAILABLE:-}" ]; then
- if which "${OPENSSL_LEGACY:-}" >/dev/null 2>&1; then
- OPENSSL_LEGACY_AVAILABLE="YES"
- else
- OPENSSL_LEGACY_AVAILABLE="NO"
- fi
- fi
- if [ "$OPENSSL_LEGACY_AVAILABLE" = "NO" ]; then
- SKIP_NEXT="YES"
- fi
- }
- # skip next test if IPv6 isn't available on this host
- requires_ipv6() {
- if [ -z "${HAS_IPV6:-}" ]; then
- $P_SRV server_addr='::1' > $SRV_OUT 2>&1 &
- SRV_PID=$!
- sleep 1
- kill $SRV_PID >/dev/null 2>&1
- if grep "NET - Binding of the socket failed" $SRV_OUT >/dev/null; then
- HAS_IPV6="NO"
- else
- HAS_IPV6="YES"
- fi
- rm -r $SRV_OUT
- fi
- if [ "$HAS_IPV6" = "NO" ]; then
- SKIP_NEXT="YES"
- fi
- }
- # skip next test if it's i686 or uname is not available
- requires_not_i686() {
- if [ -z "${IS_I686:-}" ]; then
- IS_I686="YES"
- if which "uname" >/dev/null 2>&1; then
- if [ -z "$(uname -a | grep i686)" ]; then
- IS_I686="NO"
- fi
- fi
- fi
- if [ "$IS_I686" = "YES" ]; then
- SKIP_NEXT="YES"
- fi
- }
- # Calculate the input & output maximum content lengths set in the config
- MAX_CONTENT_LEN=$( ../scripts/config.py get MBEDTLS_SSL_MAX_CONTENT_LEN || echo "16384")
- MAX_IN_LEN=$( ../scripts/config.py get MBEDTLS_SSL_IN_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
- MAX_OUT_LEN=$( ../scripts/config.py get MBEDTLS_SSL_OUT_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
- if [ "$MAX_IN_LEN" -lt "$MAX_CONTENT_LEN" ]; then
- MAX_CONTENT_LEN="$MAX_IN_LEN"
- fi
- if [ "$MAX_OUT_LEN" -lt "$MAX_CONTENT_LEN" ]; then
- MAX_CONTENT_LEN="$MAX_OUT_LEN"
- fi
- # skip the next test if the SSL output buffer is less than 16KB
- requires_full_size_output_buffer() {
- if [ "$MAX_OUT_LEN" -ne 16384 ]; then
- SKIP_NEXT="YES"
- fi
- }
- # skip the next test if valgrind is in use
- not_with_valgrind() {
- if [ "$MEMCHECK" -gt 0 ]; then
- SKIP_NEXT="YES"
- fi
- }
- # skip the next test if valgrind is NOT in use
- only_with_valgrind() {
- if [ "$MEMCHECK" -eq 0 ]; then
- SKIP_NEXT="YES"
- fi
- }
- # multiply the client timeout delay by the given factor for the next test
- client_needs_more_time() {
- CLI_DELAY_FACTOR=$1
- }
- # wait for the given seconds after the client finished in the next test
- server_needs_more_time() {
- SRV_DELAY_SECONDS=$1
- }
- # print_name <name>
- print_name() {
- TESTS=$(( $TESTS + 1 ))
- LINE=""
- if [ "$SHOW_TEST_NUMBER" -gt 0 ]; then
- LINE="$TESTS "
- fi
- LINE="$LINE$1"
- printf "%s " "$LINE"
- LEN=$(( 72 - `echo "$LINE" | wc -c` ))
- for i in `seq 1 $LEN`; do printf '.'; done
- printf ' '
- }
- # record_outcome <outcome> [<failure-reason>]
- # The test name must be in $NAME.
- record_outcome() {
- echo "$1"
- if [ -n "$MBEDTLS_TEST_OUTCOME_FILE" ]; then
- printf '%s;%s;%s;%s;%s;%s\n' \
- "$MBEDTLS_TEST_PLATFORM" "$MBEDTLS_TEST_CONFIGURATION" \
- "ssl-opt" "$NAME" \
- "$1" "${2-}" \
- >>"$MBEDTLS_TEST_OUTCOME_FILE"
- fi
- }
- # fail <message>
- fail() {
- record_outcome "FAIL" "$1"
- echo " ! $1"
- mv $SRV_OUT o-srv-${TESTS}.log
- mv $CLI_OUT o-cli-${TESTS}.log
- if [ -n "$PXY_CMD" ]; then
- mv $PXY_OUT o-pxy-${TESTS}.log
- fi
- echo " ! outputs saved to o-XXX-${TESTS}.log"
- if [ "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then
- echo " ! server output:"
- cat o-srv-${TESTS}.log
- echo " ! ========================================================"
- echo " ! client output:"
- cat o-cli-${TESTS}.log
- if [ -n "$PXY_CMD" ]; then
- echo " ! ========================================================"
- echo " ! proxy output:"
- cat o-pxy-${TESTS}.log
- fi
- echo ""
- fi
- FAILS=$(( $FAILS + 1 ))
- }
- # is_polar <cmd_line>
- is_polar() {
- echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null
- }
- # openssl s_server doesn't have -www with DTLS
- check_osrv_dtls() {
- if echo "$SRV_CMD" | grep 's_server.*-dtls' >/dev/null; then
- NEEDS_INPUT=1
- SRV_CMD="$( echo $SRV_CMD | sed s/-www// )"
- else
- NEEDS_INPUT=0
- fi
- }
- # provide input to commands that need it
- provide_input() {
- if [ $NEEDS_INPUT -eq 0 ]; then
- return
- fi
- while true; do
- echo "HTTP/1.0 200 OK"
- sleep 1
- done
- }
- # has_mem_err <log_file_name>
- has_mem_err() {
- if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" &&
- grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null
- then
- return 1 # false: does not have errors
- else
- return 0 # true: has errors
- fi
- }
- # Wait for process $2 named $3 to be listening on port $1. Print error to $4.
- if type lsof >/dev/null 2>/dev/null; then
- wait_app_start() {
- START_TIME=$(date +%s)
- if [ "$DTLS" -eq 1 ]; then
- proto=UDP
- else
- proto=TCP
- fi
- # Make a tight loop, server normally takes less than 1s to start.
- while ! lsof -a -n -b -i "$proto:$1" -p "$2" >/dev/null 2>/dev/null; do
- if [ $(( $(date +%s) - $START_TIME )) -gt $DOG_DELAY ]; then
- echo "$3 START TIMEOUT"
- echo "$3 START TIMEOUT" >> $4
- break
- fi
- # Linux and *BSD support decimal arguments to sleep. On other
- # OSes this may be a tight loop.
- sleep 0.1 2>/dev/null || true
- done
- }
- else
- echo "Warning: lsof not available, wait_app_start = sleep"
- wait_app_start() {
- sleep "$START_DELAY"
- }
- fi
- # Wait for server process $2 to be listening on port $1.
- wait_server_start() {
- wait_app_start $1 $2 "SERVER" $SRV_OUT
- }
- # Wait for proxy process $2 to be listening on port $1.
- wait_proxy_start() {
- wait_app_start $1 $2 "PROXY" $PXY_OUT
- }
- # Given the client or server debug output, parse the unix timestamp that is
- # included in the first 4 bytes of the random bytes and check that it's within
- # acceptable bounds
- check_server_hello_time() {
- # Extract the time from the debug (lvl 3) output of the client
- SERVER_HELLO_TIME="$(sed -n 's/.*server hello, current time: //p' < "$1")"
- # Get the Unix timestamp for now
- CUR_TIME=$(date +'%s')
- THRESHOLD_IN_SECS=300
- # Check if the ServerHello time was printed
- if [ -z "$SERVER_HELLO_TIME" ]; then
- return 1
- fi
- # Check the time in ServerHello is within acceptable bounds
- if [ $SERVER_HELLO_TIME -lt $(( $CUR_TIME - $THRESHOLD_IN_SECS )) ]; then
- # The time in ServerHello is at least 5 minutes before now
- return 1
- elif [ $SERVER_HELLO_TIME -gt $(( $CUR_TIME + $THRESHOLD_IN_SECS )) ]; then
- # The time in ServerHello is at least 5 minutes later than now
- return 1
- else
- return 0
- fi
- }
- # Get handshake memory usage from server or client output and put it into the variable specified by the first argument
- handshake_memory_get() {
- OUTPUT_VARIABLE="$1"
- OUTPUT_FILE="$2"
- # Get memory usage from a pattern like "Heap memory usage after handshake: 23112 bytes. Peak memory usage was 33112"
- MEM_USAGE=$(sed -n 's/.*Heap memory usage after handshake: //p' < "$OUTPUT_FILE" | grep -o "[0-9]*" | head -1)
- # Check if memory usage was read
- if [ -z "$MEM_USAGE" ]; then
- echo "Error: Can not read the value of handshake memory usage"
- return 1
- else
- eval "$OUTPUT_VARIABLE=$MEM_USAGE"
- return 0
- fi
- }
- # Get handshake memory usage from server or client output and check if this value
- # is not higher than the maximum given by the first argument
- handshake_memory_check() {
- MAX_MEMORY="$1"
- OUTPUT_FILE="$2"
- # Get memory usage
- if ! handshake_memory_get "MEMORY_USAGE" "$OUTPUT_FILE"; then
- return 1
- fi
- # Check if memory usage is below max value
- if [ "$MEMORY_USAGE" -gt "$MAX_MEMORY" ]; then
- echo "\nFailed: Handshake memory usage was $MEMORY_USAGE bytes," \
- "but should be below $MAX_MEMORY bytes"
- return 1
- else
- return 0
- fi
- }
- # wait for client to terminate and set CLI_EXIT
- # must be called right after starting the client
- wait_client_done() {
- CLI_PID=$!
- CLI_DELAY=$(( $DOG_DELAY * $CLI_DELAY_FACTOR ))
- CLI_DELAY_FACTOR=1
- ( sleep $CLI_DELAY; echo "===CLIENT_TIMEOUT===" >> $CLI_OUT; kill $CLI_PID ) &
- DOG_PID=$!
- wait $CLI_PID
- CLI_EXIT=$?
- kill $DOG_PID >/dev/null 2>&1
- wait $DOG_PID
- echo "EXIT: $CLI_EXIT" >> $CLI_OUT
- sleep $SRV_DELAY_SECONDS
- SRV_DELAY_SECONDS=0
- }
- # check if the given command uses dtls and sets global variable DTLS
- detect_dtls() {
- if echo "$1" | grep 'dtls=1\|-dtls1\|-u' >/dev/null; then
- DTLS=1
- else
- DTLS=0
- fi
- }
- # Compare file content
- # Usage: find_in_both pattern file1 file2
- # extract from file1 the first line matching the pattern
- # check in file2 that the same line can be found
- find_in_both() {
- srv_pattern=$(grep -m 1 "$1" "$2");
- if [ -z "$srv_pattern" ]; then
- return 1;
- fi
- if grep "$srv_pattern" $3 >/dev/null; then :
- return 0;
- else
- return 1;
- fi
- }
- # Usage: run_test name [-p proxy_cmd] srv_cmd cli_cmd cli_exit [option [...]]
- # Options: -s pattern pattern that must be present in server output
- # -c pattern pattern that must be present in client output
- # -u pattern lines after pattern must be unique in client output
- # -f call shell function on client output
- # -S pattern pattern that must be absent in server output
- # -C pattern pattern that must be absent in client output
- # -U pattern lines after pattern must be unique in server output
- # -F call shell function on server output
- # -g call shell function on server and client output
- run_test() {
- NAME="$1"
- shift 1
- if echo "$NAME" | grep "$FILTER" | grep -v "$EXCLUDE" >/dev/null; then :
- else
- SKIP_NEXT="NO"
- # There was no request to run the test, so don't record its outcome.
- return
- fi
- print_name "$NAME"
- # Do we only run numbered tests?
- if [ "X$RUN_TEST_NUMBER" = "X" ]; then :
- elif echo ",$RUN_TEST_NUMBER," | grep ",$TESTS," >/dev/null; then :
- else
- SKIP_NEXT="YES"
- fi
- # does this test use a proxy?
- if [ "X$1" = "X-p" ]; then
- PXY_CMD="$2"
- shift 2
- else
- PXY_CMD=""
- fi
- # get commands and client output
- SRV_CMD="$1"
- CLI_CMD="$2"
- CLI_EXPECT="$3"
- shift 3
- # Check if test uses files
- TEST_USES_FILES=$(echo "$SRV_CMD $CLI_CMD" | grep "\.\(key\|crt\|pem\)" )
- if [ ! -z "$TEST_USES_FILES" ]; then
- requires_config_enabled MBEDTLS_FS_IO
- fi
- # If the client or serve requires a ciphersuite, check that it's enabled.
- maybe_requires_ciphersuite_enabled "$SRV_CMD" "$@"
- maybe_requires_ciphersuite_enabled "$CLI_CMD" "$@"
- # should we skip?
- if [ "X$SKIP_NEXT" = "XYES" ]; then
- SKIP_NEXT="NO"
- record_outcome "SKIP"
- SKIPS=$(( $SKIPS + 1 ))
- return
- fi
- # update DTLS variable
- detect_dtls "$SRV_CMD"
- # if the test uses DTLS but no custom proxy, add a simple proxy
- # as it provides timing info that's useful to debug failures
- if [ -z "$PXY_CMD" ] && [ "$DTLS" -eq 1 ]; then
- PXY_CMD="$P_PXY"
- case " $SRV_CMD " in
- *' server_addr=::1 '*)
- PXY_CMD="$PXY_CMD server_addr=::1 listen_addr=::1";;
- esac
- fi
- # fix client port
- if [ -n "$PXY_CMD" ]; then
- CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$PXY_PORT/g )
- else
- CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$SRV_PORT/g )
- fi
- # prepend valgrind to our commands if active
- if [ "$MEMCHECK" -gt 0 ]; then
- if is_polar "$SRV_CMD"; then
- SRV_CMD="valgrind --leak-check=full $SRV_CMD"
- fi
- if is_polar "$CLI_CMD"; then
- CLI_CMD="valgrind --leak-check=full $CLI_CMD"
- fi
- fi
- TIMES_LEFT=2
- while [ $TIMES_LEFT -gt 0 ]; do
- TIMES_LEFT=$(( $TIMES_LEFT - 1 ))
- # run the commands
- if [ -n "$PXY_CMD" ]; then
- printf "# %s\n%s\n" "$NAME" "$PXY_CMD" > $PXY_OUT
- $PXY_CMD >> $PXY_OUT 2>&1 &
- PXY_PID=$!
- wait_proxy_start "$PXY_PORT" "$PXY_PID"
- fi
- check_osrv_dtls
- printf '# %s\n%s\n' "$NAME" "$SRV_CMD" > $SRV_OUT
- provide_input | $SRV_CMD >> $SRV_OUT 2>&1 &
- SRV_PID=$!
- wait_server_start "$SRV_PORT" "$SRV_PID"
- printf '# %s\n%s\n' "$NAME" "$CLI_CMD" > $CLI_OUT
- eval "$CLI_CMD" >> $CLI_OUT 2>&1 &
- wait_client_done
- sleep 0.05
- # terminate the server (and the proxy)
- kill $SRV_PID
- wait $SRV_PID
- if [ -n "$PXY_CMD" ]; then
- kill $PXY_PID >/dev/null 2>&1
- wait $PXY_PID
- fi
- # retry only on timeouts
- if grep '===CLIENT_TIMEOUT===' $CLI_OUT >/dev/null; then
- printf "RETRY "
- else
- TIMES_LEFT=0
- fi
- done
- # check if the client and server went at least to the handshake stage
- # (useful to avoid tests with only negative assertions and non-zero
- # expected client exit to incorrectly succeed in case of catastrophic
- # failure)
- if is_polar "$SRV_CMD"; then
- if grep "Performing the SSL/TLS handshake" $SRV_OUT >/dev/null; then :;
- else
- fail "server or client failed to reach handshake stage"
- return
- fi
- fi
- if is_polar "$CLI_CMD"; then
- if grep "Performing the SSL/TLS handshake" $CLI_OUT >/dev/null; then :;
- else
- fail "server or client failed to reach handshake stage"
- return
- fi
- fi
- # check server exit code
- if [ $? != 0 ]; then
- fail "server fail"
- return
- fi
- # check client exit code
- if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \
- \( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ]
- then
- fail "bad client exit code (expected $CLI_EXPECT, got $CLI_EXIT)"
- return
- fi
- # check other assertions
- # lines beginning with == are added by valgrind, ignore them
- # lines with 'Serious error when reading debug info', are valgrind issues as well
- while [ $# -gt 0 ]
- do
- case $1 in
- "-s")
- if grep -v '^==' $SRV_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then :; else
- fail "pattern '$2' MUST be present in the Server output"
- return
- fi
- ;;
- "-c")
- if grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then :; else
- fail "pattern '$2' MUST be present in the Client output"
- return
- fi
- ;;
- "-S")
- if grep -v '^==' $SRV_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then
- fail "pattern '$2' MUST NOT be present in the Server output"
- return
- fi
- ;;
- "-C")
- if grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then
- fail "pattern '$2' MUST NOT be present in the Client output"
- return
- fi
- ;;
- # The filtering in the following two options (-u and -U) do the following
- # - ignore valgrind output
- # - filter out everything but lines right after the pattern occurrences
- # - keep one of each non-unique line
- # - count how many lines remain
- # A line with '--' will remain in the result from previous outputs, so the number of lines in the result will be 1
- # if there were no duplicates.
- "-U")
- if [ $(grep -v '^==' $SRV_OUT | grep -v 'Serious error when reading debug info' | grep -A1 "$2" | grep -v "$2" | sort | uniq -d | wc -l) -gt 1 ]; then
- fail "lines following pattern '$2' must be unique in Server output"
- return
- fi
- ;;
- "-u")
- if [ $(grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep -A1 "$2" | grep -v "$2" | sort | uniq -d | wc -l) -gt 1 ]; then
- fail "lines following pattern '$2' must be unique in Client output"
- return
- fi
- ;;
- "-F")
- if ! $2 "$SRV_OUT"; then
- fail "function call to '$2' failed on Server output"
- return
- fi
- ;;
- "-f")
- if ! $2 "$CLI_OUT"; then
- fail "function call to '$2' failed on Client output"
- return
- fi
- ;;
- "-g")
- if ! eval "$2 '$SRV_OUT' '$CLI_OUT'"; then
- fail "function call to '$2' failed on Server and Client output"
- return
- fi
- ;;
- *)
- echo "Unknown test: $1" >&2
- exit 1
- esac
- shift 2
- done
- # check valgrind's results
- if [ "$MEMCHECK" -gt 0 ]; then
- if is_polar "$SRV_CMD" && has_mem_err $SRV_OUT; then
- fail "Server has memory errors"
- return
- fi
- if is_polar "$CLI_CMD" && has_mem_err $CLI_OUT; then
- fail "Client has memory errors"
- return
- fi
- fi
- # if we're here, everything is ok
- record_outcome "PASS"
- if [ "$PRESERVE_LOGS" -gt 0 ]; then
- mv $SRV_OUT o-srv-${TESTS}.log
- mv $CLI_OUT o-cli-${TESTS}.log
- if [ -n "$PXY_CMD" ]; then
- mv $PXY_OUT o-pxy-${TESTS}.log
- fi
- fi
- rm -f $SRV_OUT $CLI_OUT $PXY_OUT
- }
- run_test_psa() {
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSA-supported ciphersuite: $1" \
- "$P_SRV debug_level=3 force_version=tls1_2" \
- "$P_CLI debug_level=3 force_version=tls1_2 force_ciphersuite=$1" \
- 0 \
- -c "Successfully setup PSA-based decryption cipher context" \
- -c "Successfully setup PSA-based encryption cipher context" \
- -c "PSA calc verify" \
- -c "calc PSA finished" \
- -s "Successfully setup PSA-based decryption cipher context" \
- -s "Successfully setup PSA-based encryption cipher context" \
- -s "PSA calc verify" \
- -s "calc PSA finished" \
- -C "Failed to setup PSA-based cipher context"\
- -S "Failed to setup PSA-based cipher context"\
- -s "Protocol is TLSv1.2" \
- -c "Perform PSA-based ECDH computation."\
- -c "Perform PSA-based computation of digest of ServerKeyExchange" \
- -S "error" \
- -C "error"
- }
- run_test_psa_force_curve() {
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSA - ECDH with $1" \
- "$P_SRV debug_level=4 force_version=tls1_2" \
- "$P_CLI debug_level=4 force_version=tls1_2 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256 curves=$1" \
- 0 \
- -c "Successfully setup PSA-based decryption cipher context" \
- -c "Successfully setup PSA-based encryption cipher context" \
- -c "PSA calc verify" \
- -c "calc PSA finished" \
- -s "Successfully setup PSA-based decryption cipher context" \
- -s "Successfully setup PSA-based encryption cipher context" \
- -s "PSA calc verify" \
- -s "calc PSA finished" \
- -C "Failed to setup PSA-based cipher context"\
- -S "Failed to setup PSA-based cipher context"\
- -s "Protocol is TLSv1.2" \
- -c "Perform PSA-based ECDH computation."\
- -c "Perform PSA-based computation of digest of ServerKeyExchange" \
- -S "error" \
- -C "error"
- }
- # Test that the server's memory usage after a handshake is reduced when a client specifies
- # a maximum fragment length.
- # first argument ($1) is MFL for SSL client
- # second argument ($2) is memory usage for SSL client with default MFL (16k)
- run_test_memory_after_hanshake_with_mfl()
- {
- # The test passes if the difference is around 2*(16k-MFL)
- local MEMORY_USAGE_LIMIT="$(( $2 - ( 2 * ( 16384 - $1 )) ))"
- # Leave some margin for robustness
- MEMORY_USAGE_LIMIT="$(( ( MEMORY_USAGE_LIMIT * 110 ) / 100 ))"
- run_test "Handshake memory usage (MFL $1)" \
- "$P_SRV debug_level=3 auth_mode=required force_version=tls1_2" \
- "$P_CLI debug_level=3 force_version=tls1_2 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM max_frag_len=$1" \
- 0 \
- -F "handshake_memory_check $MEMORY_USAGE_LIMIT"
- }
- # Test that the server's memory usage after a handshake is reduced when a client specifies
- # different values of Maximum Fragment Length: default (16k), 4k, 2k, 1k and 512 bytes
- run_tests_memory_after_hanshake()
- {
- # all tests in this sequence requires the same configuration (see requires_config_enabled())
- SKIP_THIS_TESTS="$SKIP_NEXT"
- # first test with default MFU is to get reference memory usage
- MEMORY_USAGE_MFL_16K=0
- run_test "Handshake memory usage initial (MFL 16384 - default)" \
- "$P_SRV debug_level=3 auth_mode=required force_version=tls1_2" \
- "$P_CLI debug_level=3 force_version=tls1_2 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM" \
- 0 \
- -F "handshake_memory_get MEMORY_USAGE_MFL_16K"
- SKIP_NEXT="$SKIP_THIS_TESTS"
- run_test_memory_after_hanshake_with_mfl 4096 "$MEMORY_USAGE_MFL_16K"
- SKIP_NEXT="$SKIP_THIS_TESTS"
- run_test_memory_after_hanshake_with_mfl 2048 "$MEMORY_USAGE_MFL_16K"
- SKIP_NEXT="$SKIP_THIS_TESTS"
- run_test_memory_after_hanshake_with_mfl 1024 "$MEMORY_USAGE_MFL_16K"
- SKIP_NEXT="$SKIP_THIS_TESTS"
- run_test_memory_after_hanshake_with_mfl 512 "$MEMORY_USAGE_MFL_16K"
- }
- cleanup() {
- rm -f $CLI_OUT $SRV_OUT $PXY_OUT $SESSION
- rm -f context_srv.txt
- rm -f context_cli.txt
- test -n "${SRV_PID:-}" && kill $SRV_PID >/dev/null 2>&1
- test -n "${PXY_PID:-}" && kill $PXY_PID >/dev/null 2>&1
- test -n "${CLI_PID:-}" && kill $CLI_PID >/dev/null 2>&1
- test -n "${DOG_PID:-}" && kill $DOG_PID >/dev/null 2>&1
- exit 1
- }
- #
- # MAIN
- #
- get_options "$@"
- # sanity checks, avoid an avalanche of errors
- P_SRV_BIN="${P_SRV%%[ ]*}"
- P_CLI_BIN="${P_CLI%%[ ]*}"
- P_PXY_BIN="${P_PXY%%[ ]*}"
- if [ ! -x "$P_SRV_BIN" ]; then
- echo "Command '$P_SRV_BIN' is not an executable file"
- exit 1
- fi
- if [ ! -x "$P_CLI_BIN" ]; then
- echo "Command '$P_CLI_BIN' is not an executable file"
- exit 1
- fi
- if [ ! -x "$P_PXY_BIN" ]; then
- echo "Command '$P_PXY_BIN' is not an executable file"
- exit 1
- fi
- if [ "$MEMCHECK" -gt 0 ]; then
- if which valgrind >/dev/null 2>&1; then :; else
- echo "Memcheck not possible. Valgrind not found"
- exit 1
- fi
- fi
- if which $OPENSSL_CMD >/dev/null 2>&1; then :; else
- echo "Command '$OPENSSL_CMD' not found"
- exit 1
- fi
- # used by watchdog
- MAIN_PID="$$"
- # We use somewhat arbitrary delays for tests:
- # - how long do we wait for the server to start (when lsof not available)?
- # - how long do we allow for the client to finish?
- # (not to check performance, just to avoid waiting indefinitely)
- # Things are slower with valgrind, so give extra time here.
- #
- # Note: without lsof, there is a trade-off between the running time of this
- # script and the risk of spurious errors because we didn't wait long enough.
- # The watchdog delay on the other hand doesn't affect normal running time of
- # the script, only the case where a client or server gets stuck.
- if [ "$MEMCHECK" -gt 0 ]; then
- START_DELAY=6
- DOG_DELAY=60
- else
- START_DELAY=2
- DOG_DELAY=20
- fi
- # some particular tests need more time:
- # - for the client, we multiply the usual watchdog limit by a factor
- # - for the server, we sleep for a number of seconds after the client exits
- # see client_need_more_time() and server_needs_more_time()
- CLI_DELAY_FACTOR=1
- SRV_DELAY_SECONDS=0
- # fix commands to use this port, force IPv4 while at it
- # +SRV_PORT will be replaced by either $SRV_PORT or $PXY_PORT later
- P_SRV="$P_SRV server_addr=127.0.0.1 server_port=$SRV_PORT"
- P_CLI="$P_CLI server_addr=127.0.0.1 server_port=+SRV_PORT"
- P_PXY="$P_PXY server_addr=127.0.0.1 server_port=$SRV_PORT listen_addr=127.0.0.1 listen_port=$PXY_PORT ${SEED:+"seed=$SEED"}"
- O_SRV="$O_SRV -accept $SRV_PORT -dhparam data_files/dhparams.pem"
- O_CLI="$O_CLI -connect localhost:+SRV_PORT"
- G_SRV="$G_SRV -p $SRV_PORT"
- G_CLI="$G_CLI -p +SRV_PORT"
- if [ -n "${OPENSSL_LEGACY:-}" ]; then
- O_LEGACY_SRV="$O_LEGACY_SRV -accept $SRV_PORT -dhparam data_files/dhparams.pem"
- O_LEGACY_CLI="$O_LEGACY_CLI -connect localhost:+SRV_PORT"
- fi
- if [ -n "${GNUTLS_NEXT_SERV:-}" ]; then
- G_NEXT_SRV="$G_NEXT_SRV -p $SRV_PORT"
- fi
- if [ -n "${GNUTLS_NEXT_CLI:-}" ]; then
- G_NEXT_CLI="$G_NEXT_CLI -p +SRV_PORT"
- fi
- # Allow SHA-1, because many of our test certificates use it
- P_SRV="$P_SRV allow_sha1=1"
- P_CLI="$P_CLI allow_sha1=1"
- # Also pick a unique name for intermediate files
- SRV_OUT="srv_out.$$"
- CLI_OUT="cli_out.$$"
- PXY_OUT="pxy_out.$$"
- SESSION="session.$$"
- SKIP_NEXT="NO"
- trap cleanup INT TERM HUP
- # Basic test
- # Checks that:
- # - things work with all ciphersuites active (used with config-full in all.sh)
- # - the expected (highest security) parameters are selected
- # ("signature_algorithm ext: 6" means SHA-512 (highest common hash))
- run_test "Default" \
- "$P_SRV debug_level=3" \
- "$P_CLI" \
- 0 \
- -s "Protocol is TLSv1.2" \
- -s "Ciphersuite is TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256" \
- -s "client hello v3, signature_algorithm ext: 6" \
- -s "ECDHE curve: secp521r1" \
- -S "error" \
- -C "error"
- run_test "Default, DTLS" \
- "$P_SRV dtls=1" \
- "$P_CLI dtls=1" \
- 0 \
- -s "Protocol is DTLSv1.2" \
- -s "Ciphersuite is TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256"
- run_test "TLS client auth: required" \
- "$P_SRV auth_mode=required" \
- "$P_CLI" \
- 0 \
- -s "Verifying peer X.509 certificate... ok"
- requires_config_enabled MBEDTLS_X509_CRT_PARSE_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- run_test "TLS: password protected client key" \
- "$P_SRV auth_mode=required" \
- "$P_CLI crt_file=data_files/server5.crt key_file=data_files/server5.key.enc key_pwd=PolarSSLTest" \
- 0
- requires_config_enabled MBEDTLS_X509_CRT_PARSE_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- run_test "TLS: password protected server key" \
- "$P_SRV crt_file=data_files/server5.crt key_file=data_files/server5.key.enc key_pwd=PolarSSLTest" \
- "$P_CLI" \
- 0
- requires_config_enabled MBEDTLS_X509_CRT_PARSE_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- run_test "TLS: password protected server key, two certificates" \
- "$P_SRV \
- key_file=data_files/server5.key.enc key_pwd=PolarSSLTest crt_file=data_files/server5.crt \
- key_file2=data_files/server2.key.enc key_pwd2=PolarSSLTest crt_file2=data_files/server2.crt" \
- "$P_CLI" \
- 0
- requires_config_enabled MBEDTLS_ZLIB_SUPPORT
- run_test "Default (compression enabled)" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3" \
- 0 \
- -s "Allocating compression buffer" \
- -c "Allocating compression buffer" \
- -s "Record expansion is unknown (compression)" \
- -c "Record expansion is unknown (compression)" \
- -S "error" \
- -C "error"
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "CA callback on client" \
- "$P_SRV debug_level=3" \
- "$P_CLI ca_callback=1 debug_level=3 " \
- 0 \
- -c "use CA callback for X.509 CRT verification" \
- -S "error" \
- -C "error"
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- requires_config_enabled MBEDTLS_X509_CRT_PARSE_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- run_test "CA callback on server" \
- "$P_SRV auth_mode=required" \
- "$P_CLI ca_callback=1 debug_level=3 crt_file=data_files/server5.crt \
- key_file=data_files/server5.key" \
- 0 \
- -c "use CA callback for X.509 CRT verification" \
- -s "Verifying peer X.509 certificate... ok" \
- -S "error" \
- -C "error"
- # Test using an opaque private key for client authentication
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- requires_config_enabled MBEDTLS_X509_CRT_PARSE_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- run_test "Opaque key for client authentication" \
- "$P_SRV auth_mode=required" \
- "$P_CLI key_opaque=1 crt_file=data_files/server5.crt \
- key_file=data_files/server5.key" \
- 0 \
- -c "key type: Opaque" \
- -s "Verifying peer X.509 certificate... ok" \
- -S "error" \
- -C "error"
- # Test ciphersuites which we expect to be fully supported by PSA Crypto
- # and check that we don't fall back to Mbed TLS' internal crypto primitives.
- run_test_psa TLS-ECDHE-ECDSA-WITH-AES-128-CCM
- run_test_psa TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8
- run_test_psa TLS-ECDHE-ECDSA-WITH-AES-256-CCM
- run_test_psa TLS-ECDHE-ECDSA-WITH-AES-256-CCM-8
- run_test_psa TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
- run_test_psa TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384
- run_test_psa TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA
- run_test_psa TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256
- run_test_psa TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384
- requires_config_enabled MBEDTLS_ECP_DP_SECP521R1_ENABLED
- run_test_psa_force_curve "secp521r1"
- requires_config_enabled MBEDTLS_ECP_DP_BP512R1_ENABLED
- run_test_psa_force_curve "brainpoolP512r1"
- requires_config_enabled MBEDTLS_ECP_DP_SECP384R1_ENABLED
- run_test_psa_force_curve "secp384r1"
- requires_config_enabled MBEDTLS_ECP_DP_BP384R1_ENABLED
- run_test_psa_force_curve "brainpoolP384r1"
- requires_config_enabled MBEDTLS_ECP_DP_SECP256R1_ENABLED
- run_test_psa_force_curve "secp256r1"
- requires_config_enabled MBEDTLS_ECP_DP_SECP256K1_ENABLED
- run_test_psa_force_curve "secp256k1"
- requires_config_enabled MBEDTLS_ECP_DP_BP256R1_ENABLED
- run_test_psa_force_curve "brainpoolP256r1"
- requires_config_enabled MBEDTLS_ECP_DP_SECP224R1_ENABLED
- run_test_psa_force_curve "secp224r1"
- requires_config_enabled MBEDTLS_ECP_DP_SECP224K1_ENABLED
- run_test_psa_force_curve "secp224k1"
- requires_config_enabled MBEDTLS_ECP_DP_SECP192R1_ENABLED
- run_test_psa_force_curve "secp192r1"
- requires_config_enabled MBEDTLS_ECP_DP_SECP192K1_ENABLED
- run_test_psa_force_curve "secp192k1"
- # Test current time in ServerHello
- requires_config_enabled MBEDTLS_HAVE_TIME
- run_test "ServerHello contains gmt_unix_time" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3" \
- 0 \
- -f "check_server_hello_time" \
- -F "check_server_hello_time"
- # Test for uniqueness of IVs in AEAD ciphersuites
- run_test "Unique IV in GCM" \
- "$P_SRV exchanges=20 debug_level=4" \
- "$P_CLI exchanges=20 debug_level=4 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \
- 0 \
- -u "IV used" \
- -U "IV used"
- # Tests for certificate verification callback
- run_test "Configuration-specific CRT verification callback" \
- "$P_SRV debug_level=3" \
- "$P_CLI context_crt_cb=0 debug_level=3" \
- 0 \
- -S "error" \
- -c "Verify requested for " \
- -c "Use configuration-specific verification callback" \
- -C "Use context-specific verification callback" \
- -C "error"
- run_test "Context-specific CRT verification callback" \
- "$P_SRV debug_level=3" \
- "$P_CLI context_crt_cb=1 debug_level=3" \
- 0 \
- -S "error" \
- -c "Verify requested for " \
- -c "Use context-specific verification callback" \
- -C "Use configuration-specific verification callback" \
- -C "error"
- # Tests for rc4 option
- requires_config_enabled MBEDTLS_REMOVE_ARC4_CIPHERSUITES
- run_test "RC4: server disabled, client enabled" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 1 \
- -s "SSL - The server has no ciphersuites in common"
- requires_config_enabled MBEDTLS_REMOVE_ARC4_CIPHERSUITES
- run_test "RC4: server half, client enabled" \
- "$P_SRV arc4=1" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 1 \
- -s "SSL - The server has no ciphersuites in common"
- run_test "RC4: server enabled, client disabled" \
- "$P_SRV force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI" \
- 1 \
- -s "SSL - The server has no ciphersuites in common"
- run_test "RC4: both enabled" \
- "$P_SRV force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - The server has no ciphersuites in common"
- # Test empty CA list in CertificateRequest in TLS 1.1 and earlier
- requires_gnutls
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- run_test "CertificateRequest with empty CA list, TLS 1.1 (GnuTLS server)" \
- "$G_SRV"\
- "$P_CLI force_version=tls1_1" \
- 0
- requires_gnutls
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1
- run_test "CertificateRequest with empty CA list, TLS 1.0 (GnuTLS server)" \
- "$G_SRV"\
- "$P_CLI force_version=tls1" \
- 0
- # Tests for SHA-1 support
- requires_config_disabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
- run_test "SHA-1 forbidden by default in server certificate" \
- "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \
- "$P_CLI debug_level=2 allow_sha1=0" \
- 1 \
- -c "The certificate is signed with an unacceptable hash"
- requires_config_enabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
- run_test "SHA-1 allowed by default in server certificate" \
- "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \
- "$P_CLI debug_level=2 allow_sha1=0" \
- 0
- run_test "SHA-1 explicitly allowed in server certificate" \
- "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \
- "$P_CLI allow_sha1=1" \
- 0
- run_test "SHA-256 allowed by default in server certificate" \
- "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2-sha256.crt" \
- "$P_CLI allow_sha1=0" \
- 0
- requires_config_disabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
- run_test "SHA-1 forbidden by default in client certificate" \
- "$P_SRV auth_mode=required allow_sha1=0" \
- "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \
- 1 \
- -s "The certificate is signed with an unacceptable hash"
- requires_config_enabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
- run_test "SHA-1 allowed by default in client certificate" \
- "$P_SRV auth_mode=required allow_sha1=0" \
- "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \
- 0
- run_test "SHA-1 explicitly allowed in client certificate" \
- "$P_SRV auth_mode=required allow_sha1=1" \
- "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \
- 0
- run_test "SHA-256 allowed by default in client certificate" \
- "$P_SRV auth_mode=required allow_sha1=0" \
- "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha256.crt" \
- 0
- # Tests for datagram packing
- run_test "DTLS: multiple records in same datagram, client and server" \
- "$P_SRV dtls=1 dgram_packing=1 debug_level=2" \
- "$P_CLI dtls=1 dgram_packing=1 debug_level=2" \
- 0 \
- -c "next record in same datagram" \
- -s "next record in same datagram"
- run_test "DTLS: multiple records in same datagram, client only" \
- "$P_SRV dtls=1 dgram_packing=0 debug_level=2" \
- "$P_CLI dtls=1 dgram_packing=1 debug_level=2" \
- 0 \
- -s "next record in same datagram" \
- -C "next record in same datagram"
- run_test "DTLS: multiple records in same datagram, server only" \
- "$P_SRV dtls=1 dgram_packing=1 debug_level=2" \
- "$P_CLI dtls=1 dgram_packing=0 debug_level=2" \
- 0 \
- -S "next record in same datagram" \
- -c "next record in same datagram"
- run_test "DTLS: multiple records in same datagram, neither client nor server" \
- "$P_SRV dtls=1 dgram_packing=0 debug_level=2" \
- "$P_CLI dtls=1 dgram_packing=0 debug_level=2" \
- 0 \
- -S "next record in same datagram" \
- -C "next record in same datagram"
- # Tests for Truncated HMAC extension
- run_test "Truncated HMAC: client default, server default" \
- "$P_SRV debug_level=4" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -s "dumping 'expected mac' (20 bytes)" \
- -S "dumping 'expected mac' (10 bytes)"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Truncated HMAC: client disabled, server default" \
- "$P_SRV debug_level=4" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \
- 0 \
- -s "dumping 'expected mac' (20 bytes)" \
- -S "dumping 'expected mac' (10 bytes)"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Truncated HMAC: client enabled, server default" \
- "$P_SRV debug_level=4" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "dumping 'expected mac' (20 bytes)" \
- -S "dumping 'expected mac' (10 bytes)"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Truncated HMAC: client enabled, server disabled" \
- "$P_SRV debug_level=4 trunc_hmac=0" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "dumping 'expected mac' (20 bytes)" \
- -S "dumping 'expected mac' (10 bytes)"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Truncated HMAC: client disabled, server enabled" \
- "$P_SRV debug_level=4 trunc_hmac=1" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \
- 0 \
- -s "dumping 'expected mac' (20 bytes)" \
- -S "dumping 'expected mac' (10 bytes)"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Truncated HMAC: client enabled, server enabled" \
- "$P_SRV debug_level=4 trunc_hmac=1" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \
- 0 \
- -S "dumping 'expected mac' (20 bytes)" \
- -s "dumping 'expected mac' (10 bytes)"
- run_test "Truncated HMAC, DTLS: client default, server default" \
- "$P_SRV dtls=1 debug_level=4" \
- "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -s "dumping 'expected mac' (20 bytes)" \
- -S "dumping 'expected mac' (10 bytes)"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Truncated HMAC, DTLS: client disabled, server default" \
- "$P_SRV dtls=1 debug_level=4" \
- "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \
- 0 \
- -s "dumping 'expected mac' (20 bytes)" \
- -S "dumping 'expected mac' (10 bytes)"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Truncated HMAC, DTLS: client enabled, server default" \
- "$P_SRV dtls=1 debug_level=4" \
- "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "dumping 'expected mac' (20 bytes)" \
- -S "dumping 'expected mac' (10 bytes)"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Truncated HMAC, DTLS: client enabled, server disabled" \
- "$P_SRV dtls=1 debug_level=4 trunc_hmac=0" \
- "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "dumping 'expected mac' (20 bytes)" \
- -S "dumping 'expected mac' (10 bytes)"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Truncated HMAC, DTLS: client disabled, server enabled" \
- "$P_SRV dtls=1 debug_level=4 trunc_hmac=1" \
- "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \
- 0 \
- -s "dumping 'expected mac' (20 bytes)" \
- -S "dumping 'expected mac' (10 bytes)"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Truncated HMAC, DTLS: client enabled, server enabled" \
- "$P_SRV dtls=1 debug_level=4 trunc_hmac=1" \
- "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \
- 0 \
- -S "dumping 'expected mac' (20 bytes)" \
- -s "dumping 'expected mac' (10 bytes)"
- # Tests for Context serialization
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, client serializes, CCM" \
- "$P_SRV dtls=1 serialize=0 exchanges=2" \
- "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -c "Deserializing connection..." \
- -S "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, client serializes, ChaChaPoly" \
- "$P_SRV dtls=1 serialize=0 exchanges=2" \
- "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
- 0 \
- -c "Deserializing connection..." \
- -S "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, client serializes, GCM" \
- "$P_SRV dtls=1 serialize=0 exchanges=2" \
- "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \
- 0 \
- -c "Deserializing connection..." \
- -S "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Context serialization, client serializes, with CID" \
- "$P_SRV dtls=1 serialize=0 exchanges=2 cid=1 cid_val=dead" \
- "$P_CLI dtls=1 serialize=1 exchanges=2 cid=1 cid_val=beef" \
- 0 \
- -c "Deserializing connection..." \
- -S "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, server serializes, CCM" \
- "$P_SRV dtls=1 serialize=1 exchanges=2" \
- "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -C "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, server serializes, ChaChaPoly" \
- "$P_SRV dtls=1 serialize=1 exchanges=2" \
- "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
- 0 \
- -C "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, server serializes, GCM" \
- "$P_SRV dtls=1 serialize=1 exchanges=2" \
- "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \
- 0 \
- -C "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Context serialization, server serializes, with CID" \
- "$P_SRV dtls=1 serialize=1 exchanges=2 cid=1 cid_val=dead" \
- "$P_CLI dtls=1 serialize=0 exchanges=2 cid=1 cid_val=beef" \
- 0 \
- -C "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, both serialize, CCM" \
- "$P_SRV dtls=1 serialize=1 exchanges=2" \
- "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -c "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, both serialize, ChaChaPoly" \
- "$P_SRV dtls=1 serialize=1 exchanges=2" \
- "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
- 0 \
- -c "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, both serialize, GCM" \
- "$P_SRV dtls=1 serialize=1 exchanges=2" \
- "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \
- 0 \
- -c "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Context serialization, both serialize, with CID" \
- "$P_SRV dtls=1 serialize=1 exchanges=2 cid=1 cid_val=dead" \
- "$P_CLI dtls=1 serialize=1 exchanges=2 cid=1 cid_val=beef" \
- 0 \
- -c "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, re-init, client serializes, CCM" \
- "$P_SRV dtls=1 serialize=0 exchanges=2" \
- "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -c "Deserializing connection..." \
- -S "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, re-init, client serializes, ChaChaPoly" \
- "$P_SRV dtls=1 serialize=0 exchanges=2" \
- "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
- 0 \
- -c "Deserializing connection..." \
- -S "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, re-init, client serializes, GCM" \
- "$P_SRV dtls=1 serialize=0 exchanges=2" \
- "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \
- 0 \
- -c "Deserializing connection..." \
- -S "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Context serialization, re-init, client serializes, with CID" \
- "$P_SRV dtls=1 serialize=0 exchanges=2 cid=1 cid_val=dead" \
- "$P_CLI dtls=1 serialize=2 exchanges=2 cid=1 cid_val=beef" \
- 0 \
- -c "Deserializing connection..." \
- -S "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, re-init, server serializes, CCM" \
- "$P_SRV dtls=1 serialize=2 exchanges=2" \
- "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -C "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, re-init, server serializes, ChaChaPoly" \
- "$P_SRV dtls=1 serialize=2 exchanges=2" \
- "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
- 0 \
- -C "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, re-init, server serializes, GCM" \
- "$P_SRV dtls=1 serialize=2 exchanges=2" \
- "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
- 0 \
- -C "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Context serialization, re-init, server serializes, with CID" \
- "$P_SRV dtls=1 serialize=2 exchanges=2 cid=1 cid_val=dead" \
- "$P_CLI dtls=1 serialize=0 exchanges=2 cid=1 cid_val=beef" \
- 0 \
- -C "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, re-init, both serialize, CCM" \
- "$P_SRV dtls=1 serialize=2 exchanges=2" \
- "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -c "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, re-init, both serialize, ChaChaPoly" \
- "$P_SRV dtls=1 serialize=2 exchanges=2" \
- "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
- 0 \
- -c "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Context serialization, re-init, both serialize, GCM" \
- "$P_SRV dtls=1 serialize=2 exchanges=2" \
- "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
- 0 \
- -c "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Context serialization, re-init, both serialize, with CID" \
- "$P_SRV dtls=1 serialize=2 exchanges=2 cid=1 cid_val=dead" \
- "$P_CLI dtls=1 serialize=2 exchanges=2 cid=1 cid_val=beef" \
- 0 \
- -c "Deserializing connection..." \
- -s "Deserializing connection..."
- requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION
- run_test "Saving the serialized context to a file" \
- "$P_SRV dtls=1 serialize=1 context_file=context_srv.txt" \
- "$P_CLI dtls=1 serialize=1 context_file=context_cli.txt" \
- 0 \
- -s "Save serialized context to a file... ok" \
- -c "Save serialized context to a file... ok"
- rm -f context_srv.txt
- rm -f context_cli.txt
- # Tests for DTLS Connection ID extension
- # So far, the CID API isn't implemented, so we can't
- # grep for output witnessing its use. This needs to be
- # changed once the CID extension is implemented.
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli enabled, Srv disabled" \
- "$P_SRV debug_level=3 dtls=1 cid=0" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \
- 0 \
- -s "Disable use of CID extension." \
- -s "found CID extension" \
- -s "Client sent CID extension, but CID disabled" \
- -c "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -S "server hello, adding CID extension" \
- -C "found CID extension" \
- -S "Copy CIDs into SSL transform" \
- -C "Copy CIDs into SSL transform" \
- -c "Use of Connection ID was rejected by the server"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli disabled, Srv enabled" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \
- "$P_CLI debug_level=3 dtls=1 cid=0" \
- 0 \
- -c "Disable use of CID extension." \
- -C "client hello, adding CID extension" \
- -S "found CID extension" \
- -s "Enable use of CID extension." \
- -S "server hello, adding CID extension" \
- -C "found CID extension" \
- -S "Copy CIDs into SSL transform" \
- -C "Copy CIDs into SSL transform" \
- -s "Use of Connection ID was not offered by client"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID nonempty" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -c "Peer CID (length 2 Bytes): de ad" \
- -s "Peer CID (length 2 Bytes): be ef" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID, 3D: Cli+Srv enabled, Cli+Srv CID nonempty" \
- -p "$P_PXY drop=5 delay=5 duplicate=5 bad_cid=1" \
- "$P_SRV debug_level=3 dtls=1 cid=1 dgram_packing=0 cid_val=dead" \
- "$P_CLI debug_level=3 dtls=1 cid=1 dgram_packing=0 cid_val=beef" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -c "Peer CID (length 2 Bytes): de ad" \
- -s "Peer CID (length 2 Bytes): be ef" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated" \
- -c "ignoring unexpected CID" \
- -s "ignoring unexpected CID"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID, MTU: Cli+Srv enabled, Cli+Srv CID nonempty" \
- -p "$P_PXY mtu=800" \
- "$P_SRV debug_level=3 mtu=800 dtls=1 cid=1 cid_val=dead" \
- "$P_CLI debug_level=3 mtu=800 dtls=1 cid=1 cid_val=beef" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -c "Peer CID (length 2 Bytes): de ad" \
- -s "Peer CID (length 2 Bytes): be ef" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID, 3D+MTU: Cli+Srv enabled, Cli+Srv CID nonempty" \
- -p "$P_PXY mtu=800 drop=5 delay=5 duplicate=5 bad_cid=1" \
- "$P_SRV debug_level=3 mtu=800 dtls=1 cid=1 cid_val=dead" \
- "$P_CLI debug_level=3 mtu=800 dtls=1 cid=1 cid_val=beef" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -c "Peer CID (length 2 Bytes): de ad" \
- -s "Peer CID (length 2 Bytes): be ef" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated" \
- -c "ignoring unexpected CID" \
- -s "ignoring unexpected CID"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Cli CID empty" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \
- "$P_CLI debug_level=3 dtls=1 cid=1" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -c "Peer CID (length 4 Bytes): de ad be ef" \
- -s "Peer CID (length 0 Bytes):" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Srv CID empty" \
- "$P_SRV debug_level=3 dtls=1 cid=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -s "Peer CID (length 4 Bytes): de ad be ef" \
- -c "Peer CID (length 0 Bytes):" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID empty" \
- "$P_SRV debug_level=3 dtls=1 cid=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -S "Use of Connection ID has been negotiated" \
- -C "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID nonempty, AES-128-CCM-8" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -c "Peer CID (length 2 Bytes): de ad" \
- -s "Peer CID (length 2 Bytes): be ef" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Cli CID empty, AES-128-CCM-8" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \
- "$P_CLI debug_level=3 dtls=1 cid=1 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -c "Peer CID (length 4 Bytes): de ad be ef" \
- -s "Peer CID (length 0 Bytes):" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Srv CID empty, AES-128-CCM-8" \
- "$P_SRV debug_level=3 dtls=1 cid=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=deadbeef force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -s "Peer CID (length 4 Bytes): de ad be ef" \
- -c "Peer CID (length 0 Bytes):" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID empty, AES-128-CCM-8" \
- "$P_SRV debug_level=3 dtls=1 cid=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -S "Use of Connection ID has been negotiated" \
- -C "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID nonempty, AES-128-CBC" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -c "Peer CID (length 2 Bytes): de ad" \
- -s "Peer CID (length 2 Bytes): be ef" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Cli CID empty, AES-128-CBC" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \
- "$P_CLI debug_level=3 dtls=1 cid=1 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -c "Peer CID (length 4 Bytes): de ad be ef" \
- -s "Peer CID (length 0 Bytes):" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Srv CID empty, AES-128-CBC" \
- "$P_SRV debug_level=3 dtls=1 cid=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=deadbeef force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -s "Peer CID (length 4 Bytes): de ad be ef" \
- -c "Peer CID (length 0 Bytes):" \
- -s "Use of Connection ID has been negotiated" \
- -c "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID empty, AES-128-CBC" \
- "$P_SRV debug_level=3 dtls=1 cid=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -c "Enable use of CID extension." \
- -s "Enable use of CID extension." \
- -c "client hello, adding CID extension" \
- -s "found CID extension" \
- -s "Use of CID extension negotiated" \
- -s "server hello, adding CID extension" \
- -c "found CID extension" \
- -c "Use of CID extension negotiated" \
- -s "Copy CIDs into SSL transform" \
- -c "Copy CIDs into SSL transform" \
- -S "Use of Connection ID has been negotiated" \
- -C "Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID: Cli+Srv enabled, renegotiate without change of CID" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -s "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -s "(after renegotiation) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID: Cli+Srv enabled, renegotiate with different CID" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead cid_val_renego=beef renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef cid_val_renego=dead renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -s "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -s "(after renegotiation) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID, no packing: Cli+Srv enabled, renegotiate with different CID" \
- "$P_SRV debug_level=3 dtls=1 cid=1 dgram_packing=0 cid_val=dead cid_val_renego=beef renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 dgram_packing=0 cid_val=beef cid_val_renego=dead renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -s "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -s "(after renegotiation) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID, 3D+MTU: Cli+Srv enabled, renegotiate with different CID" \
- -p "$P_PXY mtu=800 drop=5 delay=5 duplicate=5 bad_cid=1" \
- "$P_SRV debug_level=3 mtu=800 dtls=1 cid=1 cid_val=dead cid_val_renego=beef renegotiation=1" \
- "$P_CLI debug_level=3 mtu=800 dtls=1 cid=1 cid_val=beef cid_val_renego=dead renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -s "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -s "(after renegotiation) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Use of Connection ID has been negotiated" \
- -c "ignoring unexpected CID" \
- -s "ignoring unexpected CID"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID: Cli+Srv enabled, renegotiate without CID" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead cid_renego=0 renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef cid_renego=0 renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -C "(after renegotiation) Use of Connection ID has been negotiated" \
- -S "(after renegotiation) Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID, no packing: Cli+Srv enabled, renegotiate without CID" \
- "$P_SRV debug_level=3 dtls=1 dgram_packing=0 cid=1 cid_val=dead cid_renego=0 renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 dgram_packing=0 cid=1 cid_val=beef cid_renego=0 renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -C "(after renegotiation) Use of Connection ID has been negotiated" \
- -S "(after renegotiation) Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID, 3D+MTU: Cli+Srv enabled, renegotiate without CID" \
- -p "$P_PXY drop=5 delay=5 duplicate=5 bad_cid=1" \
- "$P_SRV debug_level=3 mtu=800 dtls=1 cid=1 cid_val=dead cid_renego=0 renegotiation=1" \
- "$P_CLI debug_level=3 mtu=800 dtls=1 cid=1 cid_val=beef cid_renego=0 renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -C "(after renegotiation) Use of Connection ID has been negotiated" \
- -S "(after renegotiation) Use of Connection ID has been negotiated" \
- -c "ignoring unexpected CID" \
- -s "ignoring unexpected CID"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID: Cli+Srv enabled, CID on renegotiation" \
- "$P_SRV debug_level=3 dtls=1 cid=0 cid_renego=1 cid_val_renego=dead renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 cid=0 cid_renego=1 cid_val_renego=beef renegotiation=1 renegotiate=1" \
- 0 \
- -S "(initial handshake) Use of Connection ID has been negotiated" \
- -C "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -s "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -c "(after renegotiation) Use of Connection ID has been negotiated" \
- -s "(after renegotiation) Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID, no packing: Cli+Srv enabled, CID on renegotiation" \
- "$P_SRV debug_level=3 dtls=1 dgram_packing=0 cid=0 cid_renego=1 cid_val_renego=dead renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 dgram_packing=0 cid=0 cid_renego=1 cid_val_renego=beef renegotiation=1 renegotiate=1" \
- 0 \
- -S "(initial handshake) Use of Connection ID has been negotiated" \
- -C "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -s "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -c "(after renegotiation) Use of Connection ID has been negotiated" \
- -s "(after renegotiation) Use of Connection ID has been negotiated"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID, 3D+MTU: Cli+Srv enabled, CID on renegotiation" \
- -p "$P_PXY mtu=800 drop=5 delay=5 duplicate=5 bad_cid=1" \
- "$P_SRV debug_level=3 mtu=800 dtls=1 dgram_packing=1 cid=0 cid_renego=1 cid_val_renego=dead renegotiation=1" \
- "$P_CLI debug_level=3 mtu=800 dtls=1 dgram_packing=1 cid=0 cid_renego=1 cid_val_renego=beef renegotiation=1 renegotiate=1" \
- 0 \
- -S "(initial handshake) Use of Connection ID has been negotiated" \
- -C "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -s "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -c "(after renegotiation) Use of Connection ID has been negotiated" \
- -s "(after renegotiation) Use of Connection ID has been negotiated" \
- -c "ignoring unexpected CID" \
- -s "ignoring unexpected CID"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID: Cli+Srv enabled, Cli disables on renegotiation" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef cid_renego=0 renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -C "(after renegotiation) Use of Connection ID has been negotiated" \
- -S "(after renegotiation) Use of Connection ID has been negotiated" \
- -s "(after renegotiation) Use of Connection ID was not offered by client"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID, 3D: Cli+Srv enabled, Cli disables on renegotiation" \
- -p "$P_PXY drop=5 delay=5 duplicate=5 bad_cid=1" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef cid_renego=0 renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -C "(after renegotiation) Use of Connection ID has been negotiated" \
- -S "(after renegotiation) Use of Connection ID has been negotiated" \
- -s "(after renegotiation) Use of Connection ID was not offered by client" \
- -c "ignoring unexpected CID" \
- -s "ignoring unexpected CID"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID: Cli+Srv enabled, Srv disables on renegotiation" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead cid_renego=0 renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -C "(after renegotiation) Use of Connection ID has been negotiated" \
- -S "(after renegotiation) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Use of Connection ID was rejected by the server"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Connection ID, 3D: Cli+Srv enabled, Srv disables on renegotiation" \
- -p "$P_PXY drop=5 delay=5 duplicate=5 bad_cid=1" \
- "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead cid_renego=0 renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef renegotiation=1 renegotiate=1" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \
- -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \
- -C "(after renegotiation) Use of Connection ID has been negotiated" \
- -S "(after renegotiation) Use of Connection ID has been negotiated" \
- -c "(after renegotiation) Use of Connection ID was rejected by the server" \
- -c "ignoring unexpected CID" \
- -s "ignoring unexpected CID"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
- run_test "Connection ID: Cli+Srv enabled, variable buffer lengths, MFL=512" \
- "$P_SRV dtls=1 cid=1 cid_val=dead debug_level=2" \
- "$P_CLI force_ciphersuite="TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" max_frag_len=512 dtls=1 cid=1 cid_val=beef" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -s "Reallocating in_buf" \
- -s "Reallocating out_buf"
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
- run_test "Connection ID: Cli+Srv enabled, variable buffer lengths, MFL=1024" \
- "$P_SRV dtls=1 cid=1 cid_val=dead debug_level=2" \
- "$P_CLI force_ciphersuite="TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" max_frag_len=1024 dtls=1 cid=1 cid_val=beef" \
- 0 \
- -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \
- -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \
- -s "(initial handshake) Use of Connection ID has been negotiated" \
- -c "(initial handshake) Use of Connection ID has been negotiated" \
- -s "Reallocating in_buf" \
- -s "Reallocating out_buf"
- # Tests for Encrypt-then-MAC extension
- run_test "Encrypt then MAC: default" \
- "$P_SRV debug_level=3 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- "$P_CLI debug_level=3" \
- 0 \
- -c "client hello, adding encrypt_then_mac extension" \
- -s "found encrypt then mac extension" \
- -s "server hello, adding encrypt then mac extension" \
- -c "found encrypt_then_mac extension" \
- -c "using encrypt then mac" \
- -s "using encrypt then mac"
- run_test "Encrypt then MAC: client enabled, server disabled" \
- "$P_SRV debug_level=3 etm=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- "$P_CLI debug_level=3 etm=1" \
- 0 \
- -c "client hello, adding encrypt_then_mac extension" \
- -s "found encrypt then mac extension" \
- -S "server hello, adding encrypt then mac extension" \
- -C "found encrypt_then_mac extension" \
- -C "using encrypt then mac" \
- -S "using encrypt then mac"
- run_test "Encrypt then MAC: client enabled, aead cipher" \
- "$P_SRV debug_level=3 etm=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-GCM-SHA256" \
- "$P_CLI debug_level=3 etm=1" \
- 0 \
- -c "client hello, adding encrypt_then_mac extension" \
- -s "found encrypt then mac extension" \
- -S "server hello, adding encrypt then mac extension" \
- -C "found encrypt_then_mac extension" \
- -C "using encrypt then mac" \
- -S "using encrypt then mac"
- run_test "Encrypt then MAC: client enabled, stream cipher" \
- "$P_SRV debug_level=3 etm=1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI debug_level=3 etm=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -c "client hello, adding encrypt_then_mac extension" \
- -s "found encrypt then mac extension" \
- -S "server hello, adding encrypt then mac extension" \
- -C "found encrypt_then_mac extension" \
- -C "using encrypt then mac" \
- -S "using encrypt then mac"
- run_test "Encrypt then MAC: client disabled, server enabled" \
- "$P_SRV debug_level=3 etm=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- "$P_CLI debug_level=3 etm=0" \
- 0 \
- -C "client hello, adding encrypt_then_mac extension" \
- -S "found encrypt then mac extension" \
- -S "server hello, adding encrypt then mac extension" \
- -C "found encrypt_then_mac extension" \
- -C "using encrypt then mac" \
- -S "using encrypt then mac"
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Encrypt then MAC: client SSLv3, server enabled" \
- "$P_SRV debug_level=3 min_version=ssl3 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- "$P_CLI debug_level=3 force_version=ssl3" \
- 0 \
- -C "client hello, adding encrypt_then_mac extension" \
- -S "found encrypt then mac extension" \
- -S "server hello, adding encrypt then mac extension" \
- -C "found encrypt_then_mac extension" \
- -C "using encrypt then mac" \
- -S "using encrypt then mac"
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Encrypt then MAC: client enabled, server SSLv3" \
- "$P_SRV debug_level=3 force_version=ssl3 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- "$P_CLI debug_level=3 min_version=ssl3" \
- 0 \
- -c "client hello, adding encrypt_then_mac extension" \
- -S "found encrypt then mac extension" \
- -S "server hello, adding encrypt then mac extension" \
- -C "found encrypt_then_mac extension" \
- -C "using encrypt then mac" \
- -S "using encrypt then mac"
- # Tests for Extended Master Secret extension
- run_test "Extended Master Secret: default" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3" \
- 0 \
- -c "client hello, adding extended_master_secret extension" \
- -s "found extended master secret extension" \
- -s "server hello, adding extended master secret extension" \
- -c "found extended_master_secret extension" \
- -c "session hash for extended master secret" \
- -s "session hash for extended master secret"
- run_test "Extended Master Secret: client enabled, server disabled" \
- "$P_SRV debug_level=3 extended_ms=0" \
- "$P_CLI debug_level=3 extended_ms=1" \
- 0 \
- -c "client hello, adding extended_master_secret extension" \
- -s "found extended master secret extension" \
- -S "server hello, adding extended master secret extension" \
- -C "found extended_master_secret extension" \
- -C "session hash for extended master secret" \
- -S "session hash for extended master secret"
- run_test "Extended Master Secret: client disabled, server enabled" \
- "$P_SRV debug_level=3 extended_ms=1" \
- "$P_CLI debug_level=3 extended_ms=0" \
- 0 \
- -C "client hello, adding extended_master_secret extension" \
- -S "found extended master secret extension" \
- -S "server hello, adding extended master secret extension" \
- -C "found extended_master_secret extension" \
- -C "session hash for extended master secret" \
- -S "session hash for extended master secret"
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Extended Master Secret: client SSLv3, server enabled" \
- "$P_SRV debug_level=3 min_version=ssl3" \
- "$P_CLI debug_level=3 force_version=ssl3" \
- 0 \
- -C "client hello, adding extended_master_secret extension" \
- -S "found extended master secret extension" \
- -S "server hello, adding extended master secret extension" \
- -C "found extended_master_secret extension" \
- -C "session hash for extended master secret" \
- -S "session hash for extended master secret"
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Extended Master Secret: client enabled, server SSLv3" \
- "$P_SRV debug_level=3 force_version=ssl3" \
- "$P_CLI debug_level=3 min_version=ssl3" \
- 0 \
- -c "client hello, adding extended_master_secret extension" \
- -S "found extended master secret extension" \
- -S "server hello, adding extended master secret extension" \
- -C "found extended_master_secret extension" \
- -C "session hash for extended master secret" \
- -S "session hash for extended master secret"
- # Tests for FALLBACK_SCSV
- run_test "Fallback SCSV: default" \
- "$P_SRV debug_level=2" \
- "$P_CLI debug_level=3 force_version=tls1_1" \
- 0 \
- -C "adding FALLBACK_SCSV" \
- -S "received FALLBACK_SCSV" \
- -S "inapropriate fallback" \
- -C "is a fatal alert message (msg 86)"
- run_test "Fallback SCSV: explicitly disabled" \
- "$P_SRV debug_level=2" \
- "$P_CLI debug_level=3 force_version=tls1_1 fallback=0" \
- 0 \
- -C "adding FALLBACK_SCSV" \
- -S "received FALLBACK_SCSV" \
- -S "inapropriate fallback" \
- -C "is a fatal alert message (msg 86)"
- run_test "Fallback SCSV: enabled" \
- "$P_SRV debug_level=2" \
- "$P_CLI debug_level=3 force_version=tls1_1 fallback=1" \
- 1 \
- -c "adding FALLBACK_SCSV" \
- -s "received FALLBACK_SCSV" \
- -s "inapropriate fallback" \
- -c "is a fatal alert message (msg 86)"
- run_test "Fallback SCSV: enabled, max version" \
- "$P_SRV debug_level=2" \
- "$P_CLI debug_level=3 fallback=1" \
- 0 \
- -c "adding FALLBACK_SCSV" \
- -s "received FALLBACK_SCSV" \
- -S "inapropriate fallback" \
- -C "is a fatal alert message (msg 86)"
- requires_openssl_with_fallback_scsv
- run_test "Fallback SCSV: default, openssl server" \
- "$O_SRV" \
- "$P_CLI debug_level=3 force_version=tls1_1 fallback=0" \
- 0 \
- -C "adding FALLBACK_SCSV" \
- -C "is a fatal alert message (msg 86)"
- requires_openssl_with_fallback_scsv
- run_test "Fallback SCSV: enabled, openssl server" \
- "$O_SRV" \
- "$P_CLI debug_level=3 force_version=tls1_1 fallback=1" \
- 1 \
- -c "adding FALLBACK_SCSV" \
- -c "is a fatal alert message (msg 86)"
- requires_openssl_with_fallback_scsv
- run_test "Fallback SCSV: disabled, openssl client" \
- "$P_SRV debug_level=2" \
- "$O_CLI -tls1_1" \
- 0 \
- -S "received FALLBACK_SCSV" \
- -S "inapropriate fallback"
- requires_openssl_with_fallback_scsv
- run_test "Fallback SCSV: enabled, openssl client" \
- "$P_SRV debug_level=2" \
- "$O_CLI -tls1_1 -fallback_scsv" \
- 1 \
- -s "received FALLBACK_SCSV" \
- -s "inapropriate fallback"
- requires_openssl_with_fallback_scsv
- run_test "Fallback SCSV: enabled, max version, openssl client" \
- "$P_SRV debug_level=2" \
- "$O_CLI -fallback_scsv" \
- 0 \
- -s "received FALLBACK_SCSV" \
- -S "inapropriate fallback"
- # Test sending and receiving empty application data records
- run_test "Encrypt then MAC: empty application data record" \
- "$P_SRV auth_mode=none debug_level=4 etm=1" \
- "$P_CLI auth_mode=none etm=1 request_size=0 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -S "0000: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f" \
- -s "dumping 'input payload after decrypt' (0 bytes)" \
- -c "0 bytes written in 1 fragments"
- run_test "Encrypt then MAC: disabled, empty application data record" \
- "$P_SRV auth_mode=none debug_level=4 etm=0" \
- "$P_CLI auth_mode=none etm=0 request_size=0" \
- 0 \
- -s "dumping 'input payload after decrypt' (0 bytes)" \
- -c "0 bytes written in 1 fragments"
- run_test "Encrypt then MAC, DTLS: empty application data record" \
- "$P_SRV auth_mode=none debug_level=4 etm=1 dtls=1" \
- "$P_CLI auth_mode=none etm=1 request_size=0 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA dtls=1" \
- 0 \
- -S "0000: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f" \
- -s "dumping 'input payload after decrypt' (0 bytes)" \
- -c "0 bytes written in 1 fragments"
- run_test "Encrypt then MAC, DTLS: disabled, empty application data record" \
- "$P_SRV auth_mode=none debug_level=4 etm=0 dtls=1" \
- "$P_CLI auth_mode=none etm=0 request_size=0 dtls=1" \
- 0 \
- -s "dumping 'input payload after decrypt' (0 bytes)" \
- -c "0 bytes written in 1 fragments"
- ## ClientHello generated with
- ## "openssl s_client -CAfile tests/data_files/test-ca.crt -tls1_1 -connect localhost:4433 -cipher ..."
- ## then manually twiddling the ciphersuite list.
- ## The ClientHello content is spelled out below as a hex string as
- ## "prefix ciphersuite1 ciphersuite2 ciphersuite3 ciphersuite4 suffix".
- ## The expected response is an inappropriate_fallback alert.
- requires_openssl_with_fallback_scsv
- run_test "Fallback SCSV: beginning of list" \
- "$P_SRV debug_level=2" \
- "$TCP_CLIENT localhost $SRV_PORT '160301003e0100003a03022aafb94308dc22ca1086c65acc00e414384d76b61ecab37df1633b1ae1034dbe000008 5600 0031 0032 0033 0100000900230000000f000101' '15030200020256'" \
- 0 \
- -s "received FALLBACK_SCSV" \
- -s "inapropriate fallback"
- requires_openssl_with_fallback_scsv
- run_test "Fallback SCSV: end of list" \
- "$P_SRV debug_level=2" \
- "$TCP_CLIENT localhost $SRV_PORT '160301003e0100003a03022aafb94308dc22ca1086c65acc00e414384d76b61ecab37df1633b1ae1034dbe000008 0031 0032 0033 5600 0100000900230000000f000101' '15030200020256'" \
- 0 \
- -s "received FALLBACK_SCSV" \
- -s "inapropriate fallback"
- ## Here the expected response is a valid ServerHello prefix, up to the random.
- requires_openssl_with_fallback_scsv
- run_test "Fallback SCSV: not in list" \
- "$P_SRV debug_level=2" \
- "$TCP_CLIENT localhost $SRV_PORT '160301003e0100003a03022aafb94308dc22ca1086c65acc00e414384d76b61ecab37df1633b1ae1034dbe000008 0056 0031 0032 0033 0100000900230000000f000101' '16030200300200002c0302'" \
- 0 \
- -S "received FALLBACK_SCSV" \
- -S "inapropriate fallback"
- # Tests for CBC 1/n-1 record splitting
- run_test "CBC Record splitting: TLS 1.2, no splitting" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \
- request_size=123 force_version=tls1_2" \
- 0 \
- -s "Read from client: 123 bytes read" \
- -S "Read from client: 1 bytes read" \
- -S "122 bytes read"
- run_test "CBC Record splitting: TLS 1.1, no splitting" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \
- request_size=123 force_version=tls1_1" \
- 0 \
- -s "Read from client: 123 bytes read" \
- -S "Read from client: 1 bytes read" \
- -S "122 bytes read"
- run_test "CBC Record splitting: TLS 1.0, splitting" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \
- request_size=123 force_version=tls1" \
- 0 \
- -S "Read from client: 123 bytes read" \
- -s "Read from client: 1 bytes read" \
- -s "122 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "CBC Record splitting: SSLv3, splitting" \
- "$P_SRV min_version=ssl3" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \
- request_size=123 force_version=ssl3" \
- 0 \
- -S "Read from client: 123 bytes read" \
- -s "Read from client: 1 bytes read" \
- -s "122 bytes read"
- run_test "CBC Record splitting: TLS 1.0 RC4, no splitting" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
- request_size=123 force_version=tls1" \
- 0 \
- -s "Read from client: 123 bytes read" \
- -S "Read from client: 1 bytes read" \
- -S "122 bytes read"
- run_test "CBC Record splitting: TLS 1.0, splitting disabled" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \
- request_size=123 force_version=tls1 recsplit=0" \
- 0 \
- -s "Read from client: 123 bytes read" \
- -S "Read from client: 1 bytes read" \
- -S "122 bytes read"
- run_test "CBC Record splitting: TLS 1.0, splitting, nbio" \
- "$P_SRV nbio=2" \
- "$P_CLI nbio=2 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \
- request_size=123 force_version=tls1" \
- 0 \
- -S "Read from client: 123 bytes read" \
- -s "Read from client: 1 bytes read" \
- -s "122 bytes read"
- # Tests for Session Tickets
- run_test "Session resume using tickets: basic" \
- "$P_SRV debug_level=3 tickets=1" \
- "$P_CLI debug_level=3 tickets=1 reconnect=1" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -s "found session ticket extension" \
- -s "server hello, adding session ticket extension" \
- -c "found session_ticket extension" \
- -c "parse new session ticket" \
- -S "session successfully restored from cache" \
- -s "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using tickets: cache disabled" \
- "$P_SRV debug_level=3 tickets=1 cache_max=0" \
- "$P_CLI debug_level=3 tickets=1 reconnect=1" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -s "found session ticket extension" \
- -s "server hello, adding session ticket extension" \
- -c "found session_ticket extension" \
- -c "parse new session ticket" \
- -S "session successfully restored from cache" \
- -s "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using tickets: timeout" \
- "$P_SRV debug_level=3 tickets=1 cache_max=0 ticket_timeout=1" \
- "$P_CLI debug_level=3 tickets=1 reconnect=1 reco_delay=2" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -s "found session ticket extension" \
- -s "server hello, adding session ticket extension" \
- -c "found session_ticket extension" \
- -c "parse new session ticket" \
- -S "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -S "a session has been resumed" \
- -C "a session has been resumed"
- run_test "Session resume using tickets: session copy" \
- "$P_SRV debug_level=3 tickets=1 cache_max=0" \
- "$P_CLI debug_level=3 tickets=1 reconnect=1 reco_mode=0" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -s "found session ticket extension" \
- -s "server hello, adding session ticket extension" \
- -c "found session_ticket extension" \
- -c "parse new session ticket" \
- -S "session successfully restored from cache" \
- -s "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using tickets: openssl server" \
- "$O_SRV" \
- "$P_CLI debug_level=3 tickets=1 reconnect=1" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -c "found session_ticket extension" \
- -c "parse new session ticket" \
- -c "a session has been resumed"
- run_test "Session resume using tickets: openssl client" \
- "$P_SRV debug_level=3 tickets=1" \
- "( $O_CLI -sess_out $SESSION; \
- $O_CLI -sess_in $SESSION; \
- rm -f $SESSION )" \
- 0 \
- -s "found session ticket extension" \
- -s "server hello, adding session ticket extension" \
- -S "session successfully restored from cache" \
- -s "session successfully restored from ticket" \
- -s "a session has been resumed"
- # Tests for Session Tickets with DTLS
- run_test "Session resume using tickets, DTLS: basic" \
- "$P_SRV debug_level=3 dtls=1 tickets=1" \
- "$P_CLI debug_level=3 dtls=1 tickets=1 reconnect=1 skip_close_notify=1" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -s "found session ticket extension" \
- -s "server hello, adding session ticket extension" \
- -c "found session_ticket extension" \
- -c "parse new session ticket" \
- -S "session successfully restored from cache" \
- -s "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using tickets, DTLS: cache disabled" \
- "$P_SRV debug_level=3 dtls=1 tickets=1 cache_max=0" \
- "$P_CLI debug_level=3 dtls=1 tickets=1 reconnect=1 skip_close_notify=1" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -s "found session ticket extension" \
- -s "server hello, adding session ticket extension" \
- -c "found session_ticket extension" \
- -c "parse new session ticket" \
- -S "session successfully restored from cache" \
- -s "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using tickets, DTLS: timeout" \
- "$P_SRV debug_level=3 dtls=1 tickets=1 cache_max=0 ticket_timeout=1" \
- "$P_CLI debug_level=3 dtls=1 tickets=1 reconnect=1 skip_close_notify=1 reco_delay=2" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -s "found session ticket extension" \
- -s "server hello, adding session ticket extension" \
- -c "found session_ticket extension" \
- -c "parse new session ticket" \
- -S "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -S "a session has been resumed" \
- -C "a session has been resumed"
- run_test "Session resume using tickets, DTLS: session copy" \
- "$P_SRV debug_level=3 dtls=1 tickets=1 cache_max=0" \
- "$P_CLI debug_level=3 dtls=1 tickets=1 reconnect=1 skip_close_notify=1 reco_mode=0" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -s "found session ticket extension" \
- -s "server hello, adding session ticket extension" \
- -c "found session_ticket extension" \
- -c "parse new session ticket" \
- -S "session successfully restored from cache" \
- -s "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using tickets, DTLS: openssl server" \
- "$O_SRV -dtls1" \
- "$P_CLI dtls=1 debug_level=3 tickets=1 reconnect=1" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -c "found session_ticket extension" \
- -c "parse new session ticket" \
- -c "a session has been resumed"
- run_test "Session resume using tickets, DTLS: openssl client" \
- "$P_SRV dtls=1 debug_level=3 tickets=1" \
- "( $O_CLI -dtls1 -sess_out $SESSION; \
- $O_CLI -dtls1 -sess_in $SESSION; \
- rm -f $SESSION )" \
- 0 \
- -s "found session ticket extension" \
- -s "server hello, adding session ticket extension" \
- -S "session successfully restored from cache" \
- -s "session successfully restored from ticket" \
- -s "a session has been resumed"
- # Tests for Session Resume based on session-ID and cache
- run_test "Session resume using cache: tickets enabled on client" \
- "$P_SRV debug_level=3 tickets=0" \
- "$P_CLI debug_level=3 tickets=1 reconnect=1" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -s "found session ticket extension" \
- -S "server hello, adding session ticket extension" \
- -C "found session_ticket extension" \
- -C "parse new session ticket" \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache: tickets enabled on server" \
- "$P_SRV debug_level=3 tickets=1" \
- "$P_CLI debug_level=3 tickets=0 reconnect=1" \
- 0 \
- -C "client hello, adding session ticket extension" \
- -S "found session ticket extension" \
- -S "server hello, adding session ticket extension" \
- -C "found session_ticket extension" \
- -C "parse new session ticket" \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache: cache_max=0" \
- "$P_SRV debug_level=3 tickets=0 cache_max=0" \
- "$P_CLI debug_level=3 tickets=0 reconnect=1" \
- 0 \
- -S "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -S "a session has been resumed" \
- -C "a session has been resumed"
- run_test "Session resume using cache: cache_max=1" \
- "$P_SRV debug_level=3 tickets=0 cache_max=1" \
- "$P_CLI debug_level=3 tickets=0 reconnect=1" \
- 0 \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache: timeout > delay" \
- "$P_SRV debug_level=3 tickets=0" \
- "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=0" \
- 0 \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache: timeout < delay" \
- "$P_SRV debug_level=3 tickets=0 cache_timeout=1" \
- "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=2" \
- 0 \
- -S "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -S "a session has been resumed" \
- -C "a session has been resumed"
- run_test "Session resume using cache: no timeout" \
- "$P_SRV debug_level=3 tickets=0 cache_timeout=0" \
- "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=2" \
- 0 \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache: session copy" \
- "$P_SRV debug_level=3 tickets=0" \
- "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_mode=0" \
- 0 \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache: openssl client" \
- "$P_SRV debug_level=3 tickets=0" \
- "( $O_CLI -sess_out $SESSION; \
- $O_CLI -sess_in $SESSION; \
- rm -f $SESSION )" \
- 0 \
- -s "found session ticket extension" \
- -S "server hello, adding session ticket extension" \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed"
- run_test "Session resume using cache: openssl server" \
- "$O_SRV" \
- "$P_CLI debug_level=3 tickets=0 reconnect=1" \
- 0 \
- -C "found session_ticket extension" \
- -C "parse new session ticket" \
- -c "a session has been resumed"
- # Tests for Session Resume based on session-ID and cache, DTLS
- run_test "Session resume using cache, DTLS: tickets enabled on client" \
- "$P_SRV dtls=1 debug_level=3 tickets=0" \
- "$P_CLI dtls=1 debug_level=3 tickets=1 reconnect=1 skip_close_notify=1" \
- 0 \
- -c "client hello, adding session ticket extension" \
- -s "found session ticket extension" \
- -S "server hello, adding session ticket extension" \
- -C "found session_ticket extension" \
- -C "parse new session ticket" \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache, DTLS: tickets enabled on server" \
- "$P_SRV dtls=1 debug_level=3 tickets=1" \
- "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1" \
- 0 \
- -C "client hello, adding session ticket extension" \
- -S "found session ticket extension" \
- -S "server hello, adding session ticket extension" \
- -C "found session_ticket extension" \
- -C "parse new session ticket" \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache, DTLS: cache_max=0" \
- "$P_SRV dtls=1 debug_level=3 tickets=0 cache_max=0" \
- "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1" \
- 0 \
- -S "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -S "a session has been resumed" \
- -C "a session has been resumed"
- run_test "Session resume using cache, DTLS: cache_max=1" \
- "$P_SRV dtls=1 debug_level=3 tickets=0 cache_max=1" \
- "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1" \
- 0 \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache, DTLS: timeout > delay" \
- "$P_SRV dtls=1 debug_level=3 tickets=0" \
- "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1 reco_delay=0" \
- 0 \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache, DTLS: timeout < delay" \
- "$P_SRV dtls=1 debug_level=3 tickets=0 cache_timeout=1" \
- "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1 reco_delay=2" \
- 0 \
- -S "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -S "a session has been resumed" \
- -C "a session has been resumed"
- run_test "Session resume using cache, DTLS: no timeout" \
- "$P_SRV dtls=1 debug_level=3 tickets=0 cache_timeout=0" \
- "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1 reco_delay=2" \
- 0 \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache, DTLS: session copy" \
- "$P_SRV dtls=1 debug_level=3 tickets=0" \
- "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1 reco_mode=0" \
- 0 \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed" \
- -c "a session has been resumed"
- run_test "Session resume using cache, DTLS: openssl client" \
- "$P_SRV dtls=1 debug_level=3 tickets=0" \
- "( $O_CLI -dtls1 -sess_out $SESSION; \
- $O_CLI -dtls1 -sess_in $SESSION; \
- rm -f $SESSION )" \
- 0 \
- -s "found session ticket extension" \
- -S "server hello, adding session ticket extension" \
- -s "session successfully restored from cache" \
- -S "session successfully restored from ticket" \
- -s "a session has been resumed"
- run_test "Session resume using cache, DTLS: openssl server" \
- "$O_SRV -dtls1" \
- "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1" \
- 0 \
- -C "found session_ticket extension" \
- -C "parse new session ticket" \
- -c "a session has been resumed"
- # Tests for Max Fragment Length extension
- if [ "$MAX_CONTENT_LEN" -lt "4096" ]; then
- printf '%s defines MBEDTLS_SSL_MAX_CONTENT_LEN to be less than 4096. Fragment length tests will fail.\n' "${CONFIG_H}"
- exit 1
- fi
- if [ $MAX_CONTENT_LEN -ne 16384 ]; then
- echo "Using non-default maximum content length $MAX_CONTENT_LEN"
- fi
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: enabled, default" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3" \
- 0 \
- -c "Maximum input fragment length is $MAX_CONTENT_LEN" \
- -c "Maximum output fragment length is $MAX_CONTENT_LEN" \
- -s "Maximum input fragment length is $MAX_CONTENT_LEN" \
- -s "Maximum output fragment length is $MAX_CONTENT_LEN" \
- -C "client hello, adding max_fragment_length extension" \
- -S "found max fragment length extension" \
- -S "server hello, max_fragment_length extension" \
- -C "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: enabled, default, larger message" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3 request_size=$(( $MAX_CONTENT_LEN + 1))" \
- 0 \
- -c "Maximum input fragment length is $MAX_CONTENT_LEN" \
- -c "Maximum output fragment length is $MAX_CONTENT_LEN" \
- -s "Maximum input fragment length is $MAX_CONTENT_LEN" \
- -s "Maximum output fragment length is $MAX_CONTENT_LEN" \
- -C "client hello, adding max_fragment_length extension" \
- -S "found max fragment length extension" \
- -S "server hello, max_fragment_length extension" \
- -C "found max_fragment_length extension" \
- -c "$(( $MAX_CONTENT_LEN + 1)) bytes written in 2 fragments" \
- -s "$MAX_CONTENT_LEN bytes read" \
- -s "1 bytes read"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length, DTLS: enabled, default, larger message" \
- "$P_SRV debug_level=3 dtls=1" \
- "$P_CLI debug_level=3 dtls=1 request_size=$(( $MAX_CONTENT_LEN + 1))" \
- 1 \
- -c "Maximum input fragment length is $MAX_CONTENT_LEN" \
- -c "Maximum output fragment length is $MAX_CONTENT_LEN" \
- -s "Maximum input fragment length is $MAX_CONTENT_LEN" \
- -s "Maximum output fragment length is $MAX_CONTENT_LEN" \
- -C "client hello, adding max_fragment_length extension" \
- -S "found max fragment length extension" \
- -S "server hello, max_fragment_length extension" \
- -C "found max_fragment_length extension" \
- -c "fragment larger than.*maximum "
- # Run some tests with MBEDTLS_SSL_MAX_FRAGMENT_LENGTH disabled
- # (session fragment length will be 16384 regardless of mbedtls
- # content length configuration.)
- requires_config_disabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: disabled, larger message" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3 request_size=$(( $MAX_CONTENT_LEN + 1))" \
- 0 \
- -C "Maximum input fragment length is 16384" \
- -C "Maximum output fragment length is 16384" \
- -S "Maximum input fragment length is 16384" \
- -S "Maximum output fragment length is 16384" \
- -c "$(( $MAX_CONTENT_LEN + 1)) bytes written in 2 fragments" \
- -s "$MAX_CONTENT_LEN bytes read" \
- -s "1 bytes read"
- requires_config_disabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length DTLS: disabled, larger message" \
- "$P_SRV debug_level=3 dtls=1" \
- "$P_CLI debug_level=3 dtls=1 request_size=$(( $MAX_CONTENT_LEN + 1))" \
- 1 \
- -C "Maximum input fragment length is 16384" \
- -C "Maximum output fragment length is 16384" \
- -S "Maximum input fragment length is 16384" \
- -S "Maximum output fragment length is 16384" \
- -c "fragment larger than.*maximum "
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: used by client" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3 max_frag_len=4096" \
- 0 \
- -c "Maximum input fragment length is 4096" \
- -c "Maximum output fragment length is 4096" \
- -s "Maximum input fragment length is 4096" \
- -s "Maximum output fragment length is 4096" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 512, server 1024" \
- "$P_SRV debug_level=3 max_frag_len=1024" \
- "$P_CLI debug_level=3 max_frag_len=512" \
- 0 \
- -c "Maximum input fragment length is 512" \
- -c "Maximum output fragment length is 512" \
- -s "Maximum input fragment length is 512" \
- -s "Maximum output fragment length is 512" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 512, server 2048" \
- "$P_SRV debug_level=3 max_frag_len=2048" \
- "$P_CLI debug_level=3 max_frag_len=512" \
- 0 \
- -c "Maximum input fragment length is 512" \
- -c "Maximum output fragment length is 512" \
- -s "Maximum input fragment length is 512" \
- -s "Maximum output fragment length is 512" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 512, server 4096" \
- "$P_SRV debug_level=3 max_frag_len=4096" \
- "$P_CLI debug_level=3 max_frag_len=512" \
- 0 \
- -c "Maximum input fragment length is 512" \
- -c "Maximum output fragment length is 512" \
- -s "Maximum input fragment length is 512" \
- -s "Maximum output fragment length is 512" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 1024, server 512" \
- "$P_SRV debug_level=3 max_frag_len=512" \
- "$P_CLI debug_level=3 max_frag_len=1024" \
- 0 \
- -c "Maximum input fragment length is 1024" \
- -c "Maximum output fragment length is 1024" \
- -s "Maximum input fragment length is 1024" \
- -s "Maximum output fragment length is 512" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 1024, server 2048" \
- "$P_SRV debug_level=3 max_frag_len=2048" \
- "$P_CLI debug_level=3 max_frag_len=1024" \
- 0 \
- -c "Maximum input fragment length is 1024" \
- -c "Maximum output fragment length is 1024" \
- -s "Maximum input fragment length is 1024" \
- -s "Maximum output fragment length is 1024" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 1024, server 4096" \
- "$P_SRV debug_level=3 max_frag_len=4096" \
- "$P_CLI debug_level=3 max_frag_len=1024" \
- 0 \
- -c "Maximum input fragment length is 1024" \
- -c "Maximum output fragment length is 1024" \
- -s "Maximum input fragment length is 1024" \
- -s "Maximum output fragment length is 1024" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 2048, server 512" \
- "$P_SRV debug_level=3 max_frag_len=512" \
- "$P_CLI debug_level=3 max_frag_len=2048" \
- 0 \
- -c "Maximum input fragment length is 2048" \
- -c "Maximum output fragment length is 2048" \
- -s "Maximum input fragment length is 2048" \
- -s "Maximum output fragment length is 512" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 2048, server 1024" \
- "$P_SRV debug_level=3 max_frag_len=1024" \
- "$P_CLI debug_level=3 max_frag_len=2048" \
- 0 \
- -c "Maximum input fragment length is 2048" \
- -c "Maximum output fragment length is 2048" \
- -s "Maximum input fragment length is 2048" \
- -s "Maximum output fragment length is 1024" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 2048, server 4096" \
- "$P_SRV debug_level=3 max_frag_len=4096" \
- "$P_CLI debug_level=3 max_frag_len=2048" \
- 0 \
- -c "Maximum input fragment length is 2048" \
- -c "Maximum output fragment length is 2048" \
- -s "Maximum input fragment length is 2048" \
- -s "Maximum output fragment length is 2048" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 4096, server 512" \
- "$P_SRV debug_level=3 max_frag_len=512" \
- "$P_CLI debug_level=3 max_frag_len=4096" \
- 0 \
- -c "Maximum input fragment length is 4096" \
- -c "Maximum output fragment length is 4096" \
- -s "Maximum input fragment length is 4096" \
- -s "Maximum output fragment length is 512" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 4096, server 1024" \
- "$P_SRV debug_level=3 max_frag_len=1024" \
- "$P_CLI debug_level=3 max_frag_len=4096" \
- 0 \
- -c "Maximum input fragment length is 4096" \
- -c "Maximum output fragment length is 4096" \
- -s "Maximum input fragment length is 4096" \
- -s "Maximum output fragment length is 1024" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client 4096, server 2048" \
- "$P_SRV debug_level=3 max_frag_len=2048" \
- "$P_CLI debug_level=3 max_frag_len=4096" \
- 0 \
- -c "Maximum input fragment length is 4096" \
- -c "Maximum output fragment length is 4096" \
- -s "Maximum input fragment length is 4096" \
- -s "Maximum output fragment length is 2048" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: used by server" \
- "$P_SRV debug_level=3 max_frag_len=4096" \
- "$P_CLI debug_level=3" \
- 0 \
- -c "Maximum input fragment length is $MAX_CONTENT_LEN" \
- -c "Maximum output fragment length is $MAX_CONTENT_LEN" \
- -s "Maximum input fragment length is $MAX_CONTENT_LEN" \
- -s "Maximum output fragment length is 4096" \
- -C "client hello, adding max_fragment_length extension" \
- -S "found max fragment length extension" \
- -S "server hello, max_fragment_length extension" \
- -C "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- requires_gnutls
- run_test "Max fragment length: gnutls server" \
- "$G_SRV" \
- "$P_CLI debug_level=3 max_frag_len=4096" \
- 0 \
- -c "Maximum input fragment length is 4096" \
- -c "Maximum output fragment length is 4096" \
- -c "client hello, adding max_fragment_length extension" \
- -c "found max_fragment_length extension"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client, message just fits" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3 max_frag_len=2048 request_size=2048" \
- 0 \
- -c "Maximum input fragment length is 2048" \
- -c "Maximum output fragment length is 2048" \
- -s "Maximum input fragment length is 2048" \
- -s "Maximum output fragment length is 2048" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension" \
- -c "2048 bytes written in 1 fragments" \
- -s "2048 bytes read"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: client, larger message" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3 max_frag_len=2048 request_size=2345" \
- 0 \
- -c "Maximum input fragment length is 2048" \
- -c "Maximum output fragment length is 2048" \
- -s "Maximum input fragment length is 2048" \
- -s "Maximum output fragment length is 2048" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension" \
- -c "2345 bytes written in 2 fragments" \
- -s "2048 bytes read" \
- -s "297 bytes read"
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Max fragment length: DTLS client, larger message" \
- "$P_SRV debug_level=3 dtls=1" \
- "$P_CLI debug_level=3 dtls=1 max_frag_len=2048 request_size=2345" \
- 1 \
- -c "Maximum input fragment length is 2048" \
- -c "Maximum output fragment length is 2048" \
- -s "Maximum input fragment length is 2048" \
- -s "Maximum output fragment length is 2048" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension" \
- -c "fragment larger than.*maximum"
- # Tests for renegotiation
- # Renegotiation SCSV always added, regardless of SSL_RENEGOTIATION
- run_test "Renegotiation: none, for reference" \
- "$P_SRV debug_level=3 exchanges=2 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=2" \
- 0 \
- -C "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -S "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -C "=> renegotiate" \
- -S "=> renegotiate" \
- -S "write hello request"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: client-initiated" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -S "write hello request"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: server-initiated" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "write hello request"
- # Checks that no Signature Algorithm with SHA-1 gets negotiated. Negotiating SHA-1 would mean that
- # the server did not parse the Signature Algorithm extension. This test is valid only if an MD
- # algorithm stronger than SHA-1 is enabled in config.h
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: Signature Algorithms parsing, client-initiated" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -S "write hello request" \
- -S "client hello v3, signature_algorithm ext: 2" # Is SHA-1 negotiated?
- # Checks that no Signature Algorithm with SHA-1 gets negotiated. Negotiating SHA-1 would mean that
- # the server did not parse the Signature Algorithm extension. This test is valid only if an MD
- # algorithm stronger than SHA-1 is enabled in config.h
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: Signature Algorithms parsing, server-initiated" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "write hello request" \
- -S "client hello v3, signature_algorithm ext: 2" # Is SHA-1 negotiated?
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: double" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "write hello request"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "Renegotiation with max fragment length: client 2048, server 512" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1 max_frag_len=512" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 max_frag_len=2048 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \
- 0 \
- -c "Maximum input fragment length is 2048" \
- -c "Maximum output fragment length is 2048" \
- -s "Maximum input fragment length is 2048" \
- -s "Maximum output fragment length is 512" \
- -c "client hello, adding max_fragment_length extension" \
- -s "found max fragment length extension" \
- -s "server hello, max_fragment_length extension" \
- -c "found max_fragment_length extension" \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "write hello request"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: client-initiated, server-rejected" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=0 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
- 1 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -S "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -S "=> renegotiate" \
- -S "write hello request" \
- -c "SSL - Unexpected message at ServerHello in renegotiation" \
- -c "failed"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: server-initiated, client-rejected, default" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
- 0 \
- -C "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -S "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -C "=> renegotiate" \
- -S "=> renegotiate" \
- -s "write hello request" \
- -S "SSL - An unexpected message was received from our peer" \
- -S "failed"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: server-initiated, client-rejected, not enforced" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
- renego_delay=-1 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
- 0 \
- -C "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -S "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -C "=> renegotiate" \
- -S "=> renegotiate" \
- -s "write hello request" \
- -S "SSL - An unexpected message was received from our peer" \
- -S "failed"
- # delay 2 for 1 alert record + 1 application data record
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: server-initiated, client-rejected, delay 2" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
- renego_delay=2 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
- 0 \
- -C "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -S "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -C "=> renegotiate" \
- -S "=> renegotiate" \
- -s "write hello request" \
- -S "SSL - An unexpected message was received from our peer" \
- -S "failed"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: server-initiated, client-rejected, delay 0" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
- renego_delay=0 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
- 0 \
- -C "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -S "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -C "=> renegotiate" \
- -S "=> renegotiate" \
- -s "write hello request" \
- -s "SSL - An unexpected message was received from our peer"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: server-initiated, client-accepted, delay 0" \
- "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
- renego_delay=0 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "write hello request" \
- -S "SSL - An unexpected message was received from our peer" \
- -S "failed"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: periodic, just below period" \
- "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \
- 0 \
- -C "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -S "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -S "record counter limit reached: renegotiate" \
- -C "=> renegotiate" \
- -S "=> renegotiate" \
- -S "write hello request" \
- -S "SSL - An unexpected message was received from our peer" \
- -S "failed"
- # one extra exchange to be able to complete renego
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: periodic, just above period" \
- "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=4 renegotiation=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -s "record counter limit reached: renegotiate" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "write hello request" \
- -S "SSL - An unexpected message was received from our peer" \
- -S "failed"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: periodic, two times period" \
- "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=7 renegotiation=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -s "record counter limit reached: renegotiate" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "write hello request" \
- -S "SSL - An unexpected message was received from our peer" \
- -S "failed"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: periodic, above period, disabled" \
- "$P_SRV debug_level=3 exchanges=9 renegotiation=0 renego_period=3 auth_mode=optional" \
- "$P_CLI debug_level=3 exchanges=4 renegotiation=1" \
- 0 \
- -C "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -S "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -S "record counter limit reached: renegotiate" \
- -C "=> renegotiate" \
- -S "=> renegotiate" \
- -S "write hello request" \
- -S "SSL - An unexpected message was received from our peer" \
- -S "failed"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: nbio, client-initiated" \
- "$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1 auth_mode=optional" \
- "$P_CLI debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -S "write hello request"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: nbio, server-initiated" \
- "$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1 auth_mode=optional" \
- "$P_CLI debug_level=3 nbio=2 exchanges=2 renegotiation=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "write hello request"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: openssl server, client-initiated" \
- "$O_SRV -www" \
- "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -C "ssl_hanshake() returned" \
- -C "error" \
- -c "HTTP/1.0 200 [Oo][Kk]"
- requires_gnutls
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: gnutls server strict, client-initiated" \
- "$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \
- "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -C "ssl_hanshake() returned" \
- -C "error" \
- -c "HTTP/1.0 200 [Oo][Kk]"
- requires_gnutls
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: gnutls server unsafe, client-initiated default" \
- "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
- "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
- 1 \
- -c "client hello, adding renegotiation extension" \
- -C "found renegotiation extension" \
- -c "=> renegotiate" \
- -c "mbedtls_ssl_handshake() returned" \
- -c "error" \
- -C "HTTP/1.0 200 [Oo][Kk]"
- requires_gnutls
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: gnutls server unsafe, client-inititated no legacy" \
- "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
- "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \
- allow_legacy=0" \
- 1 \
- -c "client hello, adding renegotiation extension" \
- -C "found renegotiation extension" \
- -c "=> renegotiate" \
- -c "mbedtls_ssl_handshake() returned" \
- -c "error" \
- -C "HTTP/1.0 200 [Oo][Kk]"
- requires_gnutls
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: gnutls server unsafe, client-inititated legacy" \
- "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
- "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \
- allow_legacy=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -C "found renegotiation extension" \
- -c "=> renegotiate" \
- -C "ssl_hanshake() returned" \
- -C "error" \
- -c "HTTP/1.0 200 [Oo][Kk]"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: DTLS, client-initiated" \
- "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1" \
- "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -S "write hello request"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: DTLS, server-initiated" \
- "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \
- "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 \
- read_timeout=1000 max_resend=2" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "write hello request"
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: DTLS, renego_period overflow" \
- "$P_SRV debug_level=3 dtls=1 exchanges=4 renegotiation=1 renego_period=18446462598732840962 auth_mode=optional" \
- "$P_CLI debug_level=3 dtls=1 exchanges=4 renegotiation=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
- -s "found renegotiation extension" \
- -s "server hello, secure renegotiation extension" \
- -s "record counter limit reached: renegotiate" \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "write hello request"
- requires_gnutls
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "Renegotiation: DTLS, gnutls server, client-initiated" \
- "$G_SRV -u --mtu 4096" \
- "$P_CLI debug_level=3 dtls=1 exchanges=1 renegotiation=1 renegotiate=1" \
- 0 \
- -c "client hello, adding renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -C "mbedtls_ssl_handshake returned" \
- -C "error" \
- -s "Extra-header:"
- # Test for the "secure renegotation" extension only (no actual renegotiation)
- requires_gnutls
- run_test "Renego ext: gnutls server strict, client default" \
- "$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \
- "$P_CLI debug_level=3" \
- 0 \
- -c "found renegotiation extension" \
- -C "error" \
- -c "HTTP/1.0 200 [Oo][Kk]"
- requires_gnutls
- run_test "Renego ext: gnutls server unsafe, client default" \
- "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
- "$P_CLI debug_level=3" \
- 0 \
- -C "found renegotiation extension" \
- -C "error" \
- -c "HTTP/1.0 200 [Oo][Kk]"
- requires_gnutls
- run_test "Renego ext: gnutls server unsafe, client break legacy" \
- "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
- "$P_CLI debug_level=3 allow_legacy=-1" \
- 1 \
- -C "found renegotiation extension" \
- -c "error" \
- -C "HTTP/1.0 200 [Oo][Kk]"
- requires_gnutls
- run_test "Renego ext: gnutls client strict, server default" \
- "$P_SRV debug_level=3" \
- "$G_CLI --priority=NORMAL:%SAFE_RENEGOTIATION localhost" \
- 0 \
- -s "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \
- -s "server hello, secure renegotiation extension"
- requires_gnutls
- run_test "Renego ext: gnutls client unsafe, server default" \
- "$P_SRV debug_level=3" \
- "$G_CLI --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION localhost" \
- 0 \
- -S "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \
- -S "server hello, secure renegotiation extension"
- requires_gnutls
- run_test "Renego ext: gnutls client unsafe, server break legacy" \
- "$P_SRV debug_level=3 allow_legacy=-1" \
- "$G_CLI --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION localhost" \
- 1 \
- -S "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \
- -S "server hello, secure renegotiation extension"
- # Tests for silently dropping trailing extra bytes in .der certificates
- requires_gnutls
- run_test "DER format: no trailing bytes" \
- "$P_SRV crt_file=data_files/server5-der0.crt \
- key_file=data_files/server5.key" \
- "$G_CLI localhost" \
- 0 \
- -c "Handshake was completed" \
- requires_gnutls
- run_test "DER format: with a trailing zero byte" \
- "$P_SRV crt_file=data_files/server5-der1a.crt \
- key_file=data_files/server5.key" \
- "$G_CLI localhost" \
- 0 \
- -c "Handshake was completed" \
- requires_gnutls
- run_test "DER format: with a trailing random byte" \
- "$P_SRV crt_file=data_files/server5-der1b.crt \
- key_file=data_files/server5.key" \
- "$G_CLI localhost" \
- 0 \
- -c "Handshake was completed" \
- requires_gnutls
- run_test "DER format: with 2 trailing random bytes" \
- "$P_SRV crt_file=data_files/server5-der2.crt \
- key_file=data_files/server5.key" \
- "$G_CLI localhost" \
- 0 \
- -c "Handshake was completed" \
- requires_gnutls
- run_test "DER format: with 4 trailing random bytes" \
- "$P_SRV crt_file=data_files/server5-der4.crt \
- key_file=data_files/server5.key" \
- "$G_CLI localhost" \
- 0 \
- -c "Handshake was completed" \
- requires_gnutls
- run_test "DER format: with 8 trailing random bytes" \
- "$P_SRV crt_file=data_files/server5-der8.crt \
- key_file=data_files/server5.key" \
- "$G_CLI localhost" \
- 0 \
- -c "Handshake was completed" \
- requires_gnutls
- run_test "DER format: with 9 trailing random bytes" \
- "$P_SRV crt_file=data_files/server5-der9.crt \
- key_file=data_files/server5.key" \
- "$G_CLI localhost" \
- 0 \
- -c "Handshake was completed" \
- # Tests for auth_mode, there are duplicated tests using ca callback for authentication
- # When updating these tests, modify the matching authentication tests accordingly
- run_test "Authentication: server badcert, client required" \
- "$P_SRV crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- "$P_CLI debug_level=1 auth_mode=required" \
- 1 \
- -c "x509_verify_cert() returned" \
- -c "! The certificate is not correctly signed by the trusted CA" \
- -c "! mbedtls_ssl_handshake returned" \
- -c "X509 - Certificate verification failed"
- run_test "Authentication: server badcert, client optional" \
- "$P_SRV crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- "$P_CLI debug_level=1 auth_mode=optional" \
- 0 \
- -c "x509_verify_cert() returned" \
- -c "! The certificate is not correctly signed by the trusted CA" \
- -C "! mbedtls_ssl_handshake returned" \
- -C "X509 - Certificate verification failed"
- run_test "Authentication: server goodcert, client optional, no trusted CA" \
- "$P_SRV" \
- "$P_CLI debug_level=3 auth_mode=optional ca_file=none ca_path=none" \
- 0 \
- -c "x509_verify_cert() returned" \
- -c "! The certificate is not correctly signed by the trusted CA" \
- -c "! Certificate verification flags"\
- -C "! mbedtls_ssl_handshake returned" \
- -C "X509 - Certificate verification failed" \
- -C "SSL - No CA Chain is set, but required to operate"
- run_test "Authentication: server goodcert, client required, no trusted CA" \
- "$P_SRV" \
- "$P_CLI debug_level=3 auth_mode=required ca_file=none ca_path=none" \
- 1 \
- -c "x509_verify_cert() returned" \
- -c "! The certificate is not correctly signed by the trusted CA" \
- -c "! Certificate verification flags"\
- -c "! mbedtls_ssl_handshake returned" \
- -c "SSL - No CA Chain is set, but required to operate"
- # The purpose of the next two tests is to test the client's behaviour when receiving a server
- # certificate with an unsupported elliptic curve. This should usually not happen because
- # the client informs the server about the supported curves - it does, though, in the
- # corner case of a static ECDH suite, because the server doesn't check the curve on that
- # occasion (to be fixed). If that bug's fixed, the test needs to be altered to use a
- # different means to have the server ignoring the client's supported curve list.
- requires_config_enabled MBEDTLS_ECP_C
- run_test "Authentication: server ECDH p256v1, client required, p256v1 unsupported" \
- "$P_SRV debug_level=1 key_file=data_files/server5.key \
- crt_file=data_files/server5.ku-ka.crt" \
- "$P_CLI debug_level=3 auth_mode=required curves=secp521r1" \
- 1 \
- -c "bad certificate (EC key curve)"\
- -c "! Certificate verification flags"\
- -C "bad server certificate (ECDH curve)" # Expect failure at earlier verification stage
- requires_config_enabled MBEDTLS_ECP_C
- run_test "Authentication: server ECDH p256v1, client optional, p256v1 unsupported" \
- "$P_SRV debug_level=1 key_file=data_files/server5.key \
- crt_file=data_files/server5.ku-ka.crt" \
- "$P_CLI debug_level=3 auth_mode=optional curves=secp521r1" \
- 1 \
- -c "bad certificate (EC key curve)"\
- -c "! Certificate verification flags"\
- -c "bad server certificate (ECDH curve)" # Expect failure only at ECDH params check
- run_test "Authentication: server badcert, client none" \
- "$P_SRV crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- "$P_CLI debug_level=1 auth_mode=none" \
- 0 \
- -C "x509_verify_cert() returned" \
- -C "! The certificate is not correctly signed by the trusted CA" \
- -C "! mbedtls_ssl_handshake returned" \
- -C "X509 - Certificate verification failed"
- run_test "Authentication: client SHA256, server required" \
- "$P_SRV auth_mode=required" \
- "$P_CLI debug_level=3 crt_file=data_files/server6.crt \
- key_file=data_files/server6.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \
- 0 \
- -c "Supported Signature Algorithm found: 4," \
- -c "Supported Signature Algorithm found: 5,"
- run_test "Authentication: client SHA384, server required" \
- "$P_SRV auth_mode=required" \
- "$P_CLI debug_level=3 crt_file=data_files/server6.crt \
- key_file=data_files/server6.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \
- 0 \
- -c "Supported Signature Algorithm found: 4," \
- -c "Supported Signature Algorithm found: 5,"
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Authentication: client has no cert, server required (SSLv3)" \
- "$P_SRV debug_level=3 min_version=ssl3 auth_mode=required" \
- "$P_CLI debug_level=3 force_version=ssl3 crt_file=none \
- key_file=data_files/server5.key" \
- 1 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -c "got no certificate to send" \
- -S "x509_verify_cert() returned" \
- -s "client has no certificate" \
- -s "! mbedtls_ssl_handshake returned" \
- -c "! mbedtls_ssl_handshake returned" \
- -s "No client certification received from the client, but required by the authentication mode"
- run_test "Authentication: client has no cert, server required (TLS)" \
- "$P_SRV debug_level=3 auth_mode=required" \
- "$P_CLI debug_level=3 crt_file=none \
- key_file=data_files/server5.key" \
- 1 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -c "= write certificate$" \
- -C "skip write certificate$" \
- -S "x509_verify_cert() returned" \
- -s "client has no certificate" \
- -s "! mbedtls_ssl_handshake returned" \
- -c "! mbedtls_ssl_handshake returned" \
- -s "No client certification received from the client, but required by the authentication mode"
- run_test "Authentication: client badcert, server required" \
- "$P_SRV debug_level=3 auth_mode=required" \
- "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- 1 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -s "x509_verify_cert() returned" \
- -s "! The certificate is not correctly signed by the trusted CA" \
- -s "! mbedtls_ssl_handshake returned" \
- -s "send alert level=2 message=48" \
- -c "! mbedtls_ssl_handshake returned" \
- -s "X509 - Certificate verification failed"
- # We don't check that the client receives the alert because it might
- # detect that its write end of the connection is closed and abort
- # before reading the alert message.
- run_test "Authentication: client cert not trusted, server required" \
- "$P_SRV debug_level=3 auth_mode=required" \
- "$P_CLI debug_level=3 crt_file=data_files/server5-selfsigned.crt \
- key_file=data_files/server5.key" \
- 1 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -s "x509_verify_cert() returned" \
- -s "! The certificate is not correctly signed by the trusted CA" \
- -s "! mbedtls_ssl_handshake returned" \
- -c "! mbedtls_ssl_handshake returned" \
- -s "X509 - Certificate verification failed"
- run_test "Authentication: client badcert, server optional" \
- "$P_SRV debug_level=3 auth_mode=optional" \
- "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- 0 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -s "x509_verify_cert() returned" \
- -s "! The certificate is not correctly signed by the trusted CA" \
- -S "! mbedtls_ssl_handshake returned" \
- -C "! mbedtls_ssl_handshake returned" \
- -S "X509 - Certificate verification failed"
- run_test "Authentication: client badcert, server none" \
- "$P_SRV debug_level=3 auth_mode=none" \
- "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- 0 \
- -s "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got no certificate request" \
- -c "skip write certificate" \
- -c "skip write certificate verify" \
- -s "skip parse certificate verify" \
- -S "x509_verify_cert() returned" \
- -S "! The certificate is not correctly signed by the trusted CA" \
- -S "! mbedtls_ssl_handshake returned" \
- -C "! mbedtls_ssl_handshake returned" \
- -S "X509 - Certificate verification failed"
- run_test "Authentication: client no cert, server optional" \
- "$P_SRV debug_level=3 auth_mode=optional" \
- "$P_CLI debug_level=3 crt_file=none key_file=none" \
- 0 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate$" \
- -C "got no certificate to send" \
- -S "SSLv3 client has no certificate" \
- -c "skip write certificate verify" \
- -s "skip parse certificate verify" \
- -s "! Certificate was missing" \
- -S "! mbedtls_ssl_handshake returned" \
- -C "! mbedtls_ssl_handshake returned" \
- -S "X509 - Certificate verification failed"
- run_test "Authentication: openssl client no cert, server optional" \
- "$P_SRV debug_level=3 auth_mode=optional" \
- "$O_CLI" \
- 0 \
- -S "skip write certificate request" \
- -s "skip parse certificate verify" \
- -s "! Certificate was missing" \
- -S "! mbedtls_ssl_handshake returned" \
- -S "X509 - Certificate verification failed"
- run_test "Authentication: client no cert, openssl server optional" \
- "$O_SRV -verify 10" \
- "$P_CLI debug_level=3 crt_file=none key_file=none" \
- 0 \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate$" \
- -c "skip write certificate verify" \
- -C "! mbedtls_ssl_handshake returned"
- run_test "Authentication: client no cert, openssl server required" \
- "$O_SRV -Verify 10" \
- "$P_CLI debug_level=3 crt_file=none key_file=none" \
- 1 \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate$" \
- -c "skip write certificate verify" \
- -c "! mbedtls_ssl_handshake returned"
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Authentication: client no cert, ssl3" \
- "$P_SRV debug_level=3 auth_mode=optional force_version=ssl3" \
- "$P_CLI debug_level=3 crt_file=none key_file=none min_version=ssl3" \
- 0 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate$" \
- -c "skip write certificate verify" \
- -c "got no certificate to send" \
- -s "SSLv3 client has no certificate" \
- -s "skip parse certificate verify" \
- -s "! Certificate was missing" \
- -S "! mbedtls_ssl_handshake returned" \
- -C "! mbedtls_ssl_handshake returned" \
- -S "X509 - Certificate verification failed"
- # The "max_int chain" tests assume that MAX_INTERMEDIATE_CA is set to its
- # default value (8)
- MAX_IM_CA='8'
- MAX_IM_CA_CONFIG=$( ../scripts/config.py get MBEDTLS_X509_MAX_INTERMEDIATE_CA)
- if [ -n "$MAX_IM_CA_CONFIG" ] && [ "$MAX_IM_CA_CONFIG" -ne "$MAX_IM_CA" ]; then
- cat <<EOF
- ${CONFIG_H} contains a value for the configuration of
- MBEDTLS_X509_MAX_INTERMEDIATE_CA that is different from the script's
- test value of ${MAX_IM_CA}.
- The tests assume this value and if it changes, the tests in this
- script should also be adjusted.
- EOF
- exit 1
- fi
- requires_full_size_output_buffer
- run_test "Authentication: server max_int chain, client default" \
- "$P_SRV crt_file=data_files/dir-maxpath/c09.pem \
- key_file=data_files/dir-maxpath/09.key" \
- "$P_CLI server_name=CA09 ca_file=data_files/dir-maxpath/00.crt" \
- 0 \
- -C "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- run_test "Authentication: server max_int+1 chain, client default" \
- "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \
- key_file=data_files/dir-maxpath/10.key" \
- "$P_CLI server_name=CA10 ca_file=data_files/dir-maxpath/00.crt" \
- 1 \
- -c "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- run_test "Authentication: server max_int+1 chain, client optional" \
- "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \
- key_file=data_files/dir-maxpath/10.key" \
- "$P_CLI server_name=CA10 ca_file=data_files/dir-maxpath/00.crt \
- auth_mode=optional" \
- 1 \
- -c "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- run_test "Authentication: server max_int+1 chain, client none" \
- "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \
- key_file=data_files/dir-maxpath/10.key" \
- "$P_CLI server_name=CA10 ca_file=data_files/dir-maxpath/00.crt \
- auth_mode=none" \
- 0 \
- -C "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- run_test "Authentication: client max_int+1 chain, server default" \
- "$P_SRV ca_file=data_files/dir-maxpath/00.crt" \
- "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \
- key_file=data_files/dir-maxpath/10.key" \
- 0 \
- -S "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- run_test "Authentication: client max_int+1 chain, server optional" \
- "$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=optional" \
- "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \
- key_file=data_files/dir-maxpath/10.key" \
- 1 \
- -s "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- run_test "Authentication: client max_int+1 chain, server required" \
- "$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=required" \
- "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \
- key_file=data_files/dir-maxpath/10.key" \
- 1 \
- -s "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- run_test "Authentication: client max_int chain, server required" \
- "$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=required" \
- "$P_CLI crt_file=data_files/dir-maxpath/c09.pem \
- key_file=data_files/dir-maxpath/09.key" \
- 0 \
- -S "X509 - A fatal error occurred"
- # Tests for CA list in CertificateRequest messages
- run_test "Authentication: send CA list in CertificateRequest (default)" \
- "$P_SRV debug_level=3 auth_mode=required" \
- "$P_CLI crt_file=data_files/server6.crt \
- key_file=data_files/server6.key" \
- 0 \
- -s "requested DN"
- run_test "Authentication: do not send CA list in CertificateRequest" \
- "$P_SRV debug_level=3 auth_mode=required cert_req_ca_list=0" \
- "$P_CLI crt_file=data_files/server6.crt \
- key_file=data_files/server6.key" \
- 0 \
- -S "requested DN"
- run_test "Authentication: send CA list in CertificateRequest, client self signed" \
- "$P_SRV debug_level=3 auth_mode=required cert_req_ca_list=0" \
- "$P_CLI debug_level=3 crt_file=data_files/server5-selfsigned.crt \
- key_file=data_files/server5.key" \
- 1 \
- -S "requested DN" \
- -s "x509_verify_cert() returned" \
- -s "! The certificate is not correctly signed by the trusted CA" \
- -s "! mbedtls_ssl_handshake returned" \
- -c "! mbedtls_ssl_handshake returned" \
- -s "X509 - Certificate verification failed"
- # Tests for auth_mode, using CA callback, these are duplicated from the authentication tests
- # When updating these tests, modify the matching authentication tests accordingly
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: server badcert, client required" \
- "$P_SRV crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- "$P_CLI ca_callback=1 debug_level=3 auth_mode=required" \
- 1 \
- -c "use CA callback for X.509 CRT verification" \
- -c "x509_verify_cert() returned" \
- -c "! The certificate is not correctly signed by the trusted CA" \
- -c "! mbedtls_ssl_handshake returned" \
- -c "X509 - Certificate verification failed"
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: server badcert, client optional" \
- "$P_SRV crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- "$P_CLI ca_callback=1 debug_level=3 auth_mode=optional" \
- 0 \
- -c "use CA callback for X.509 CRT verification" \
- -c "x509_verify_cert() returned" \
- -c "! The certificate is not correctly signed by the trusted CA" \
- -C "! mbedtls_ssl_handshake returned" \
- -C "X509 - Certificate verification failed"
- # The purpose of the next two tests is to test the client's behaviour when receiving a server
- # certificate with an unsupported elliptic curve. This should usually not happen because
- # the client informs the server about the supported curves - it does, though, in the
- # corner case of a static ECDH suite, because the server doesn't check the curve on that
- # occasion (to be fixed). If that bug's fixed, the test needs to be altered to use a
- # different means to have the server ignoring the client's supported curve list.
- requires_config_enabled MBEDTLS_ECP_C
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: server ECDH p256v1, client required, p256v1 unsupported" \
- "$P_SRV debug_level=1 key_file=data_files/server5.key \
- crt_file=data_files/server5.ku-ka.crt" \
- "$P_CLI ca_callback=1 debug_level=3 auth_mode=required curves=secp521r1" \
- 1 \
- -c "use CA callback for X.509 CRT verification" \
- -c "bad certificate (EC key curve)" \
- -c "! Certificate verification flags" \
- -C "bad server certificate (ECDH curve)" # Expect failure at earlier verification stage
- requires_config_enabled MBEDTLS_ECP_C
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: server ECDH p256v1, client optional, p256v1 unsupported" \
- "$P_SRV debug_level=1 key_file=data_files/server5.key \
- crt_file=data_files/server5.ku-ka.crt" \
- "$P_CLI ca_callback=1 debug_level=3 auth_mode=optional curves=secp521r1" \
- 1 \
- -c "use CA callback for X.509 CRT verification" \
- -c "bad certificate (EC key curve)"\
- -c "! Certificate verification flags"\
- -c "bad server certificate (ECDH curve)" # Expect failure only at ECDH params check
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: client SHA256, server required" \
- "$P_SRV ca_callback=1 debug_level=3 auth_mode=required" \
- "$P_CLI debug_level=3 crt_file=data_files/server6.crt \
- key_file=data_files/server6.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \
- 0 \
- -s "use CA callback for X.509 CRT verification" \
- -c "Supported Signature Algorithm found: 4," \
- -c "Supported Signature Algorithm found: 5,"
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: client SHA384, server required" \
- "$P_SRV ca_callback=1 debug_level=3 auth_mode=required" \
- "$P_CLI debug_level=3 crt_file=data_files/server6.crt \
- key_file=data_files/server6.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \
- 0 \
- -s "use CA callback for X.509 CRT verification" \
- -c "Supported Signature Algorithm found: 4," \
- -c "Supported Signature Algorithm found: 5,"
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: client badcert, server required" \
- "$P_SRV ca_callback=1 debug_level=3 auth_mode=required" \
- "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- 1 \
- -s "use CA callback for X.509 CRT verification" \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -s "x509_verify_cert() returned" \
- -s "! The certificate is not correctly signed by the trusted CA" \
- -s "! mbedtls_ssl_handshake returned" \
- -s "send alert level=2 message=48" \
- -c "! mbedtls_ssl_handshake returned" \
- -s "X509 - Certificate verification failed"
- # We don't check that the client receives the alert because it might
- # detect that its write end of the connection is closed and abort
- # before reading the alert message.
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: client cert not trusted, server required" \
- "$P_SRV ca_callback=1 debug_level=3 auth_mode=required" \
- "$P_CLI debug_level=3 crt_file=data_files/server5-selfsigned.crt \
- key_file=data_files/server5.key" \
- 1 \
- -s "use CA callback for X.509 CRT verification" \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -s "x509_verify_cert() returned" \
- -s "! The certificate is not correctly signed by the trusted CA" \
- -s "! mbedtls_ssl_handshake returned" \
- -c "! mbedtls_ssl_handshake returned" \
- -s "X509 - Certificate verification failed"
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: client badcert, server optional" \
- "$P_SRV ca_callback=1 debug_level=3 auth_mode=optional" \
- "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- 0 \
- -s "use CA callback for X.509 CRT verification" \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -s "x509_verify_cert() returned" \
- -s "! The certificate is not correctly signed by the trusted CA" \
- -S "! mbedtls_ssl_handshake returned" \
- -C "! mbedtls_ssl_handshake returned" \
- -S "X509 - Certificate verification failed"
- requires_full_size_output_buffer
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: server max_int chain, client default" \
- "$P_SRV crt_file=data_files/dir-maxpath/c09.pem \
- key_file=data_files/dir-maxpath/09.key" \
- "$P_CLI ca_callback=1 debug_level=3 server_name=CA09 ca_file=data_files/dir-maxpath/00.crt" \
- 0 \
- -c "use CA callback for X.509 CRT verification" \
- -C "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: server max_int+1 chain, client default" \
- "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \
- key_file=data_files/dir-maxpath/10.key" \
- "$P_CLI debug_level=3 ca_callback=1 server_name=CA10 ca_file=data_files/dir-maxpath/00.crt" \
- 1 \
- -c "use CA callback for X.509 CRT verification" \
- -c "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: server max_int+1 chain, client optional" \
- "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \
- key_file=data_files/dir-maxpath/10.key" \
- "$P_CLI ca_callback=1 server_name=CA10 ca_file=data_files/dir-maxpath/00.crt \
- debug_level=3 auth_mode=optional" \
- 1 \
- -c "use CA callback for X.509 CRT verification" \
- -c "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: client max_int+1 chain, server optional" \
- "$P_SRV ca_callback=1 debug_level=3 ca_file=data_files/dir-maxpath/00.crt auth_mode=optional" \
- "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \
- key_file=data_files/dir-maxpath/10.key" \
- 1 \
- -s "use CA callback for X.509 CRT verification" \
- -s "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: client max_int+1 chain, server required" \
- "$P_SRV ca_callback=1 debug_level=3 ca_file=data_files/dir-maxpath/00.crt auth_mode=required" \
- "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \
- key_file=data_files/dir-maxpath/10.key" \
- 1 \
- -s "use CA callback for X.509 CRT verification" \
- -s "X509 - A fatal error occurred"
- requires_full_size_output_buffer
- requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
- run_test "Authentication, CA callback: client max_int chain, server required" \
- "$P_SRV ca_callback=1 debug_level=3 ca_file=data_files/dir-maxpath/00.crt auth_mode=required" \
- "$P_CLI crt_file=data_files/dir-maxpath/c09.pem \
- key_file=data_files/dir-maxpath/09.key" \
- 0 \
- -s "use CA callback for X.509 CRT verification" \
- -S "X509 - A fatal error occurred"
- # Tests for certificate selection based on SHA verson
- run_test "Certificate hash: client TLS 1.2 -> SHA-2" \
- "$P_SRV crt_file=data_files/server5.crt \
- key_file=data_files/server5.key \
- crt_file2=data_files/server5-sha1.crt \
- key_file2=data_files/server5.key" \
- "$P_CLI force_version=tls1_2" \
- 0 \
- -c "signed using.*ECDSA with SHA256" \
- -C "signed using.*ECDSA with SHA1"
- run_test "Certificate hash: client TLS 1.1 -> SHA-1" \
- "$P_SRV crt_file=data_files/server5.crt \
- key_file=data_files/server5.key \
- crt_file2=data_files/server5-sha1.crt \
- key_file2=data_files/server5.key" \
- "$P_CLI force_version=tls1_1" \
- 0 \
- -C "signed using.*ECDSA with SHA256" \
- -c "signed using.*ECDSA with SHA1"
- run_test "Certificate hash: client TLS 1.0 -> SHA-1" \
- "$P_SRV crt_file=data_files/server5.crt \
- key_file=data_files/server5.key \
- crt_file2=data_files/server5-sha1.crt \
- key_file2=data_files/server5.key" \
- "$P_CLI force_version=tls1" \
- 0 \
- -C "signed using.*ECDSA with SHA256" \
- -c "signed using.*ECDSA with SHA1"
- run_test "Certificate hash: client TLS 1.1, no SHA-1 -> SHA-2 (order 1)" \
- "$P_SRV crt_file=data_files/server5.crt \
- key_file=data_files/server5.key \
- crt_file2=data_files/server6.crt \
- key_file2=data_files/server6.key" \
- "$P_CLI force_version=tls1_1" \
- 0 \
- -c "serial number.*09" \
- -c "signed using.*ECDSA with SHA256" \
- -C "signed using.*ECDSA with SHA1"
- run_test "Certificate hash: client TLS 1.1, no SHA-1 -> SHA-2 (order 2)" \
- "$P_SRV crt_file=data_files/server6.crt \
- key_file=data_files/server6.key \
- crt_file2=data_files/server5.crt \
- key_file2=data_files/server5.key" \
- "$P_CLI force_version=tls1_1" \
- 0 \
- -c "serial number.*0A" \
- -c "signed using.*ECDSA with SHA256" \
- -C "signed using.*ECDSA with SHA1"
- # tests for SNI
- run_test "SNI: no SNI callback" \
- "$P_SRV debug_level=3 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key" \
- "$P_CLI server_name=localhost" \
- 0 \
- -S "parse ServerName extension" \
- -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \
- -c "subject name *: C=NL, O=PolarSSL, CN=localhost"
- run_test "SNI: matching cert 1" \
- "$P_SRV debug_level=3 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \
- "$P_CLI server_name=localhost" \
- 0 \
- -s "parse ServerName extension" \
- -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \
- -c "subject name *: C=NL, O=PolarSSL, CN=localhost"
- run_test "SNI: matching cert 2" \
- "$P_SRV debug_level=3 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \
- "$P_CLI server_name=polarssl.example" \
- 0 \
- -s "parse ServerName extension" \
- -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \
- -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example"
- run_test "SNI: no matching cert" \
- "$P_SRV debug_level=3 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \
- "$P_CLI server_name=nonesuch.example" \
- 1 \
- -s "parse ServerName extension" \
- -s "ssl_sni_wrapper() returned" \
- -s "mbedtls_ssl_handshake returned" \
- -c "mbedtls_ssl_handshake returned" \
- -c "SSL - A fatal alert message was received from our peer"
- run_test "SNI: client auth no override: optional" \
- "$P_SRV debug_level=3 auth_mode=optional \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-" \
- "$P_CLI debug_level=3 server_name=localhost" \
- 0 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify"
- run_test "SNI: client auth override: none -> optional" \
- "$P_SRV debug_level=3 auth_mode=none \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,optional" \
- "$P_CLI debug_level=3 server_name=localhost" \
- 0 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify"
- run_test "SNI: client auth override: optional -> none" \
- "$P_SRV debug_level=3 auth_mode=optional \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,none" \
- "$P_CLI debug_level=3 server_name=localhost" \
- 0 \
- -s "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got no certificate request" \
- -c "skip write certificate" \
- -c "skip write certificate verify" \
- -s "skip parse certificate verify"
- run_test "SNI: CA no override" \
- "$P_SRV debug_level=3 auth_mode=optional \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- ca_file=data_files/test-ca.crt \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,required" \
- "$P_CLI debug_level=3 server_name=localhost \
- crt_file=data_files/server6.crt key_file=data_files/server6.key" \
- 1 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -s "x509_verify_cert() returned" \
- -s "! The certificate is not correctly signed by the trusted CA" \
- -S "The certificate has been revoked (is on a CRL)"
- run_test "SNI: CA override" \
- "$P_SRV debug_level=3 auth_mode=optional \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- ca_file=data_files/test-ca.crt \
- sni=localhost,data_files/server2.crt,data_files/server2.key,data_files/test-ca2.crt,-,required" \
- "$P_CLI debug_level=3 server_name=localhost \
- crt_file=data_files/server6.crt key_file=data_files/server6.key" \
- 0 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -S "x509_verify_cert() returned" \
- -S "! The certificate is not correctly signed by the trusted CA" \
- -S "The certificate has been revoked (is on a CRL)"
- run_test "SNI: CA override with CRL" \
- "$P_SRV debug_level=3 auth_mode=optional \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- ca_file=data_files/test-ca.crt \
- sni=localhost,data_files/server2.crt,data_files/server2.key,data_files/test-ca2.crt,data_files/crl-ec-sha256.pem,required" \
- "$P_CLI debug_level=3 server_name=localhost \
- crt_file=data_files/server6.crt key_file=data_files/server6.key" \
- 1 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -s "x509_verify_cert() returned" \
- -S "! The certificate is not correctly signed by the trusted CA" \
- -s "The certificate has been revoked (is on a CRL)"
- # Tests for SNI and DTLS
- run_test "SNI: DTLS, no SNI callback" \
- "$P_SRV debug_level=3 dtls=1 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key" \
- "$P_CLI server_name=localhost dtls=1" \
- 0 \
- -S "parse ServerName extension" \
- -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \
- -c "subject name *: C=NL, O=PolarSSL, CN=localhost"
- run_test "SNI: DTLS, matching cert 1" \
- "$P_SRV debug_level=3 dtls=1 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \
- "$P_CLI server_name=localhost dtls=1" \
- 0 \
- -s "parse ServerName extension" \
- -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \
- -c "subject name *: C=NL, O=PolarSSL, CN=localhost"
- run_test "SNI: DTLS, matching cert 2" \
- "$P_SRV debug_level=3 dtls=1 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \
- "$P_CLI server_name=polarssl.example dtls=1" \
- 0 \
- -s "parse ServerName extension" \
- -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \
- -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example"
- run_test "SNI: DTLS, no matching cert" \
- "$P_SRV debug_level=3 dtls=1 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \
- "$P_CLI server_name=nonesuch.example dtls=1" \
- 1 \
- -s "parse ServerName extension" \
- -s "ssl_sni_wrapper() returned" \
- -s "mbedtls_ssl_handshake returned" \
- -c "mbedtls_ssl_handshake returned" \
- -c "SSL - A fatal alert message was received from our peer"
- run_test "SNI: DTLS, client auth no override: optional" \
- "$P_SRV debug_level=3 auth_mode=optional dtls=1 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-" \
- "$P_CLI debug_level=3 server_name=localhost dtls=1" \
- 0 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify"
- run_test "SNI: DTLS, client auth override: none -> optional" \
- "$P_SRV debug_level=3 auth_mode=none dtls=1 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,optional" \
- "$P_CLI debug_level=3 server_name=localhost dtls=1" \
- 0 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify"
- run_test "SNI: DTLS, client auth override: optional -> none" \
- "$P_SRV debug_level=3 auth_mode=optional dtls=1 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,none" \
- "$P_CLI debug_level=3 server_name=localhost dtls=1" \
- 0 \
- -s "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got no certificate request" \
- -c "skip write certificate" \
- -c "skip write certificate verify" \
- -s "skip parse certificate verify"
- run_test "SNI: DTLS, CA no override" \
- "$P_SRV debug_level=3 auth_mode=optional dtls=1 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- ca_file=data_files/test-ca.crt \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,required" \
- "$P_CLI debug_level=3 server_name=localhost dtls=1 \
- crt_file=data_files/server6.crt key_file=data_files/server6.key" \
- 1 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -s "x509_verify_cert() returned" \
- -s "! The certificate is not correctly signed by the trusted CA" \
- -S "The certificate has been revoked (is on a CRL)"
- run_test "SNI: DTLS, CA override" \
- "$P_SRV debug_level=3 auth_mode=optional dtls=1 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- ca_file=data_files/test-ca.crt \
- sni=localhost,data_files/server2.crt,data_files/server2.key,data_files/test-ca2.crt,-,required" \
- "$P_CLI debug_level=3 server_name=localhost dtls=1 \
- crt_file=data_files/server6.crt key_file=data_files/server6.key" \
- 0 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -S "x509_verify_cert() returned" \
- -S "! The certificate is not correctly signed by the trusted CA" \
- -S "The certificate has been revoked (is on a CRL)"
- run_test "SNI: DTLS, CA override with CRL" \
- "$P_SRV debug_level=3 auth_mode=optional \
- crt_file=data_files/server5.crt key_file=data_files/server5.key dtls=1 \
- ca_file=data_files/test-ca.crt \
- sni=localhost,data_files/server2.crt,data_files/server2.key,data_files/test-ca2.crt,data_files/crl-ec-sha256.pem,required" \
- "$P_CLI debug_level=3 server_name=localhost dtls=1 \
- crt_file=data_files/server6.crt key_file=data_files/server6.key" \
- 1 \
- -S "skip write certificate request" \
- -C "skip parse certificate request" \
- -c "got a certificate request" \
- -C "skip write certificate" \
- -C "skip write certificate verify" \
- -S "skip parse certificate verify" \
- -s "x509_verify_cert() returned" \
- -S "! The certificate is not correctly signed by the trusted CA" \
- -s "The certificate has been revoked (is on a CRL)"
- # Tests for non-blocking I/O: exercise a variety of handshake flows
- run_test "Non-blocking I/O: basic handshake" \
- "$P_SRV nbio=2 tickets=0 auth_mode=none" \
- "$P_CLI nbio=2 tickets=0" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Non-blocking I/O: client auth" \
- "$P_SRV nbio=2 tickets=0 auth_mode=required" \
- "$P_CLI nbio=2 tickets=0" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Non-blocking I/O: ticket" \
- "$P_SRV nbio=2 tickets=1 auth_mode=none" \
- "$P_CLI nbio=2 tickets=1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Non-blocking I/O: ticket + client auth" \
- "$P_SRV nbio=2 tickets=1 auth_mode=required" \
- "$P_CLI nbio=2 tickets=1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Non-blocking I/O: ticket + client auth + resume" \
- "$P_SRV nbio=2 tickets=1 auth_mode=required" \
- "$P_CLI nbio=2 tickets=1 reconnect=1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Non-blocking I/O: ticket + resume" \
- "$P_SRV nbio=2 tickets=1 auth_mode=none" \
- "$P_CLI nbio=2 tickets=1 reconnect=1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Non-blocking I/O: session-id resume" \
- "$P_SRV nbio=2 tickets=0 auth_mode=none" \
- "$P_CLI nbio=2 tickets=0 reconnect=1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- # Tests for event-driven I/O: exercise a variety of handshake flows
- run_test "Event-driven I/O: basic handshake" \
- "$P_SRV event=1 tickets=0 auth_mode=none" \
- "$P_CLI event=1 tickets=0" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O: client auth" \
- "$P_SRV event=1 tickets=0 auth_mode=required" \
- "$P_CLI event=1 tickets=0" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O: ticket" \
- "$P_SRV event=1 tickets=1 auth_mode=none" \
- "$P_CLI event=1 tickets=1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O: ticket + client auth" \
- "$P_SRV event=1 tickets=1 auth_mode=required" \
- "$P_CLI event=1 tickets=1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O: ticket + client auth + resume" \
- "$P_SRV event=1 tickets=1 auth_mode=required" \
- "$P_CLI event=1 tickets=1 reconnect=1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O: ticket + resume" \
- "$P_SRV event=1 tickets=1 auth_mode=none" \
- "$P_CLI event=1 tickets=1 reconnect=1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O: session-id resume" \
- "$P_SRV event=1 tickets=0 auth_mode=none" \
- "$P_CLI event=1 tickets=0 reconnect=1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O, DTLS: basic handshake" \
- "$P_SRV dtls=1 event=1 tickets=0 auth_mode=none" \
- "$P_CLI dtls=1 event=1 tickets=0" \
- 0 \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O, DTLS: client auth" \
- "$P_SRV dtls=1 event=1 tickets=0 auth_mode=required" \
- "$P_CLI dtls=1 event=1 tickets=0" \
- 0 \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O, DTLS: ticket" \
- "$P_SRV dtls=1 event=1 tickets=1 auth_mode=none" \
- "$P_CLI dtls=1 event=1 tickets=1" \
- 0 \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O, DTLS: ticket + client auth" \
- "$P_SRV dtls=1 event=1 tickets=1 auth_mode=required" \
- "$P_CLI dtls=1 event=1 tickets=1" \
- 0 \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O, DTLS: ticket + client auth + resume" \
- "$P_SRV dtls=1 event=1 tickets=1 auth_mode=required" \
- "$P_CLI dtls=1 event=1 tickets=1 reconnect=1 skip_close_notify=1" \
- 0 \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O, DTLS: ticket + resume" \
- "$P_SRV dtls=1 event=1 tickets=1 auth_mode=none" \
- "$P_CLI dtls=1 event=1 tickets=1 reconnect=1 skip_close_notify=1" \
- 0 \
- -c "Read from server: .* bytes read"
- run_test "Event-driven I/O, DTLS: session-id resume" \
- "$P_SRV dtls=1 event=1 tickets=0 auth_mode=none" \
- "$P_CLI dtls=1 event=1 tickets=0 reconnect=1 skip_close_notify=1" \
- 0 \
- -c "Read from server: .* bytes read"
- # This test demonstrates the need for the mbedtls_ssl_check_pending function.
- # During session resumption, the client will send its ApplicationData record
- # within the same datagram as the Finished messages. In this situation, the
- # server MUST NOT idle on the underlying transport after handshake completion,
- # because the ApplicationData request has already been queued internally.
- run_test "Event-driven I/O, DTLS: session-id resume, UDP packing" \
- -p "$P_PXY pack=50" \
- "$P_SRV dtls=1 event=1 tickets=0 auth_mode=required" \
- "$P_CLI dtls=1 event=1 tickets=0 reconnect=1 skip_close_notify=1" \
- 0 \
- -c "Read from server: .* bytes read"
- # Tests for version negotiation
- run_test "Version check: all -> 1.2" \
- "$P_SRV" \
- "$P_CLI" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -s "Protocol is TLSv1.2" \
- -c "Protocol is TLSv1.2"
- run_test "Version check: cli max 1.1 -> 1.1" \
- "$P_SRV" \
- "$P_CLI max_version=tls1_1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -s "Protocol is TLSv1.1" \
- -c "Protocol is TLSv1.1"
- run_test "Version check: srv max 1.1 -> 1.1" \
- "$P_SRV max_version=tls1_1" \
- "$P_CLI" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -s "Protocol is TLSv1.1" \
- -c "Protocol is TLSv1.1"
- run_test "Version check: cli+srv max 1.1 -> 1.1" \
- "$P_SRV max_version=tls1_1" \
- "$P_CLI max_version=tls1_1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -s "Protocol is TLSv1.1" \
- -c "Protocol is TLSv1.1"
- run_test "Version check: cli max 1.1, srv min 1.1 -> 1.1" \
- "$P_SRV min_version=tls1_1" \
- "$P_CLI max_version=tls1_1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -s "Protocol is TLSv1.1" \
- -c "Protocol is TLSv1.1"
- run_test "Version check: cli min 1.1, srv max 1.1 -> 1.1" \
- "$P_SRV max_version=tls1_1" \
- "$P_CLI min_version=tls1_1" \
- 0 \
- -S "mbedtls_ssl_handshake returned" \
- -C "mbedtls_ssl_handshake returned" \
- -s "Protocol is TLSv1.1" \
- -c "Protocol is TLSv1.1"
- run_test "Version check: cli min 1.2, srv max 1.1 -> fail" \
- "$P_SRV max_version=tls1_1" \
- "$P_CLI min_version=tls1_2" \
- 1 \
- -s "mbedtls_ssl_handshake returned" \
- -c "mbedtls_ssl_handshake returned" \
- -c "SSL - Handshake protocol not within min/max boundaries"
- run_test "Version check: srv min 1.2, cli max 1.1 -> fail" \
- "$P_SRV min_version=tls1_2" \
- "$P_CLI max_version=tls1_1" \
- 1 \
- -s "mbedtls_ssl_handshake returned" \
- -c "mbedtls_ssl_handshake returned" \
- -s "SSL - Handshake protocol not within min/max boundaries"
- # Tests for ALPN extension
- run_test "ALPN: none" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3" \
- 0 \
- -C "client hello, adding alpn extension" \
- -S "found alpn extension" \
- -C "got an alert message, type: \\[2:120]" \
- -S "server hello, adding alpn extension" \
- -C "found alpn extension " \
- -C "Application Layer Protocol is" \
- -S "Application Layer Protocol is"
- run_test "ALPN: client only" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3 alpn=abc,1234" \
- 0 \
- -c "client hello, adding alpn extension" \
- -s "found alpn extension" \
- -C "got an alert message, type: \\[2:120]" \
- -S "server hello, adding alpn extension" \
- -C "found alpn extension " \
- -c "Application Layer Protocol is (none)" \
- -S "Application Layer Protocol is"
- run_test "ALPN: server only" \
- "$P_SRV debug_level=3 alpn=abc,1234" \
- "$P_CLI debug_level=3" \
- 0 \
- -C "client hello, adding alpn extension" \
- -S "found alpn extension" \
- -C "got an alert message, type: \\[2:120]" \
- -S "server hello, adding alpn extension" \
- -C "found alpn extension " \
- -C "Application Layer Protocol is" \
- -s "Application Layer Protocol is (none)"
- run_test "ALPN: both, common cli1-srv1" \
- "$P_SRV debug_level=3 alpn=abc,1234" \
- "$P_CLI debug_level=3 alpn=abc,1234" \
- 0 \
- -c "client hello, adding alpn extension" \
- -s "found alpn extension" \
- -C "got an alert message, type: \\[2:120]" \
- -s "server hello, adding alpn extension" \
- -c "found alpn extension" \
- -c "Application Layer Protocol is abc" \
- -s "Application Layer Protocol is abc"
- run_test "ALPN: both, common cli2-srv1" \
- "$P_SRV debug_level=3 alpn=abc,1234" \
- "$P_CLI debug_level=3 alpn=1234,abc" \
- 0 \
- -c "client hello, adding alpn extension" \
- -s "found alpn extension" \
- -C "got an alert message, type: \\[2:120]" \
- -s "server hello, adding alpn extension" \
- -c "found alpn extension" \
- -c "Application Layer Protocol is abc" \
- -s "Application Layer Protocol is abc"
- run_test "ALPN: both, common cli1-srv2" \
- "$P_SRV debug_level=3 alpn=abc,1234" \
- "$P_CLI debug_level=3 alpn=1234,abcde" \
- 0 \
- -c "client hello, adding alpn extension" \
- -s "found alpn extension" \
- -C "got an alert message, type: \\[2:120]" \
- -s "server hello, adding alpn extension" \
- -c "found alpn extension" \
- -c "Application Layer Protocol is 1234" \
- -s "Application Layer Protocol is 1234"
- run_test "ALPN: both, no common" \
- "$P_SRV debug_level=3 alpn=abc,123" \
- "$P_CLI debug_level=3 alpn=1234,abcde" \
- 1 \
- -c "client hello, adding alpn extension" \
- -s "found alpn extension" \
- -c "got an alert message, type: \\[2:120]" \
- -S "server hello, adding alpn extension" \
- -C "found alpn extension" \
- -C "Application Layer Protocol is 1234" \
- -S "Application Layer Protocol is 1234"
- # Tests for keyUsage in leaf certificates, part 1:
- # server-side certificate/suite selection
- run_test "keyUsage srv: RSA, digitalSignature -> (EC)DHE-RSA" \
- "$P_SRV key_file=data_files/server2.key \
- crt_file=data_files/server2.ku-ds.crt" \
- "$P_CLI" \
- 0 \
- -c "Ciphersuite is TLS-[EC]*DHE-RSA-WITH-"
- run_test "keyUsage srv: RSA, keyEncipherment -> RSA" \
- "$P_SRV key_file=data_files/server2.key \
- crt_file=data_files/server2.ku-ke.crt" \
- "$P_CLI" \
- 0 \
- -c "Ciphersuite is TLS-RSA-WITH-"
- run_test "keyUsage srv: RSA, keyAgreement -> fail" \
- "$P_SRV key_file=data_files/server2.key \
- crt_file=data_files/server2.ku-ka.crt" \
- "$P_CLI" \
- 1 \
- -C "Ciphersuite is "
- run_test "keyUsage srv: ECDSA, digitalSignature -> ECDHE-ECDSA" \
- "$P_SRV key_file=data_files/server5.key \
- crt_file=data_files/server5.ku-ds.crt" \
- "$P_CLI" \
- 0 \
- -c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-"
- run_test "keyUsage srv: ECDSA, keyAgreement -> ECDH-" \
- "$P_SRV key_file=data_files/server5.key \
- crt_file=data_files/server5.ku-ka.crt" \
- "$P_CLI" \
- 0 \
- -c "Ciphersuite is TLS-ECDH-"
- run_test "keyUsage srv: ECDSA, keyEncipherment -> fail" \
- "$P_SRV key_file=data_files/server5.key \
- crt_file=data_files/server5.ku-ke.crt" \
- "$P_CLI" \
- 1 \
- -C "Ciphersuite is "
- # Tests for keyUsage in leaf certificates, part 2:
- # client-side checking of server cert
- run_test "keyUsage cli: DigitalSignature+KeyEncipherment, RSA: OK" \
- "$O_SRV -key data_files/server2.key \
- -cert data_files/server2.ku-ds_ke.crt" \
- "$P_CLI debug_level=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -C "bad certificate (usage extensions)" \
- -C "Processing of the Certificate handshake message failed" \
- -c "Ciphersuite is TLS-"
- run_test "keyUsage cli: DigitalSignature+KeyEncipherment, DHE-RSA: OK" \
- "$O_SRV -key data_files/server2.key \
- -cert data_files/server2.ku-ds_ke.crt" \
- "$P_CLI debug_level=1 \
- force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -C "bad certificate (usage extensions)" \
- -C "Processing of the Certificate handshake message failed" \
- -c "Ciphersuite is TLS-"
- run_test "keyUsage cli: KeyEncipherment, RSA: OK" \
- "$O_SRV -key data_files/server2.key \
- -cert data_files/server2.ku-ke.crt" \
- "$P_CLI debug_level=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -C "bad certificate (usage extensions)" \
- -C "Processing of the Certificate handshake message failed" \
- -c "Ciphersuite is TLS-"
- run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail" \
- "$O_SRV -key data_files/server2.key \
- -cert data_files/server2.ku-ke.crt" \
- "$P_CLI debug_level=1 \
- force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
- 1 \
- -c "bad certificate (usage extensions)" \
- -c "Processing of the Certificate handshake message failed" \
- -C "Ciphersuite is TLS-"
- run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail, soft" \
- "$O_SRV -key data_files/server2.key \
- -cert data_files/server2.ku-ke.crt" \
- "$P_CLI debug_level=1 auth_mode=optional \
- force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -c "bad certificate (usage extensions)" \
- -C "Processing of the Certificate handshake message failed" \
- -c "Ciphersuite is TLS-" \
- -c "! Usage does not match the keyUsage extension"
- run_test "keyUsage cli: DigitalSignature, DHE-RSA: OK" \
- "$O_SRV -key data_files/server2.key \
- -cert data_files/server2.ku-ds.crt" \
- "$P_CLI debug_level=1 \
- force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -C "bad certificate (usage extensions)" \
- -C "Processing of the Certificate handshake message failed" \
- -c "Ciphersuite is TLS-"
- run_test "keyUsage cli: DigitalSignature, RSA: fail" \
- "$O_SRV -key data_files/server2.key \
- -cert data_files/server2.ku-ds.crt" \
- "$P_CLI debug_level=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 1 \
- -c "bad certificate (usage extensions)" \
- -c "Processing of the Certificate handshake message failed" \
- -C "Ciphersuite is TLS-"
- run_test "keyUsage cli: DigitalSignature, RSA: fail, soft" \
- "$O_SRV -key data_files/server2.key \
- -cert data_files/server2.ku-ds.crt" \
- "$P_CLI debug_level=1 auth_mode=optional \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -c "bad certificate (usage extensions)" \
- -C "Processing of the Certificate handshake message failed" \
- -c "Ciphersuite is TLS-" \
- -c "! Usage does not match the keyUsage extension"
- # Tests for keyUsage in leaf certificates, part 3:
- # server-side checking of client cert
- run_test "keyUsage cli-auth: RSA, DigitalSignature: OK" \
- "$P_SRV debug_level=1 auth_mode=optional" \
- "$O_CLI -key data_files/server2.key \
- -cert data_files/server2.ku-ds.crt" \
- 0 \
- -S "bad certificate (usage extensions)" \
- -S "Processing of the Certificate handshake message failed"
- run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (soft)" \
- "$P_SRV debug_level=1 auth_mode=optional" \
- "$O_CLI -key data_files/server2.key \
- -cert data_files/server2.ku-ke.crt" \
- 0 \
- -s "bad certificate (usage extensions)" \
- -S "Processing of the Certificate handshake message failed"
- run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (hard)" \
- "$P_SRV debug_level=1 auth_mode=required" \
- "$O_CLI -key data_files/server2.key \
- -cert data_files/server2.ku-ke.crt" \
- 1 \
- -s "bad certificate (usage extensions)" \
- -s "Processing of the Certificate handshake message failed"
- run_test "keyUsage cli-auth: ECDSA, DigitalSignature: OK" \
- "$P_SRV debug_level=1 auth_mode=optional" \
- "$O_CLI -key data_files/server5.key \
- -cert data_files/server5.ku-ds.crt" \
- 0 \
- -S "bad certificate (usage extensions)" \
- -S "Processing of the Certificate handshake message failed"
- run_test "keyUsage cli-auth: ECDSA, KeyAgreement: fail (soft)" \
- "$P_SRV debug_level=1 auth_mode=optional" \
- "$O_CLI -key data_files/server5.key \
- -cert data_files/server5.ku-ka.crt" \
- 0 \
- -s "bad certificate (usage extensions)" \
- -S "Processing of the Certificate handshake message failed"
- # Tests for extendedKeyUsage, part 1: server-side certificate/suite selection
- run_test "extKeyUsage srv: serverAuth -> OK" \
- "$P_SRV key_file=data_files/server5.key \
- crt_file=data_files/server5.eku-srv.crt" \
- "$P_CLI" \
- 0
- run_test "extKeyUsage srv: serverAuth,clientAuth -> OK" \
- "$P_SRV key_file=data_files/server5.key \
- crt_file=data_files/server5.eku-srv.crt" \
- "$P_CLI" \
- 0
- run_test "extKeyUsage srv: codeSign,anyEKU -> OK" \
- "$P_SRV key_file=data_files/server5.key \
- crt_file=data_files/server5.eku-cs_any.crt" \
- "$P_CLI" \
- 0
- run_test "extKeyUsage srv: codeSign -> fail" \
- "$P_SRV key_file=data_files/server5.key \
- crt_file=data_files/server5.eku-cli.crt" \
- "$P_CLI" \
- 1
- # Tests for extendedKeyUsage, part 2: client-side checking of server cert
- run_test "extKeyUsage cli: serverAuth -> OK" \
- "$O_SRV -key data_files/server5.key \
- -cert data_files/server5.eku-srv.crt" \
- "$P_CLI debug_level=1" \
- 0 \
- -C "bad certificate (usage extensions)" \
- -C "Processing of the Certificate handshake message failed" \
- -c "Ciphersuite is TLS-"
- run_test "extKeyUsage cli: serverAuth,clientAuth -> OK" \
- "$O_SRV -key data_files/server5.key \
- -cert data_files/server5.eku-srv_cli.crt" \
- "$P_CLI debug_level=1" \
- 0 \
- -C "bad certificate (usage extensions)" \
- -C "Processing of the Certificate handshake message failed" \
- -c "Ciphersuite is TLS-"
- run_test "extKeyUsage cli: codeSign,anyEKU -> OK" \
- "$O_SRV -key data_files/server5.key \
- -cert data_files/server5.eku-cs_any.crt" \
- "$P_CLI debug_level=1" \
- 0 \
- -C "bad certificate (usage extensions)" \
- -C "Processing of the Certificate handshake message failed" \
- -c "Ciphersuite is TLS-"
- run_test "extKeyUsage cli: codeSign -> fail" \
- "$O_SRV -key data_files/server5.key \
- -cert data_files/server5.eku-cs.crt" \
- "$P_CLI debug_level=1" \
- 1 \
- -c "bad certificate (usage extensions)" \
- -c "Processing of the Certificate handshake message failed" \
- -C "Ciphersuite is TLS-"
- # Tests for extendedKeyUsage, part 3: server-side checking of client cert
- run_test "extKeyUsage cli-auth: clientAuth -> OK" \
- "$P_SRV debug_level=1 auth_mode=optional" \
- "$O_CLI -key data_files/server5.key \
- -cert data_files/server5.eku-cli.crt" \
- 0 \
- -S "bad certificate (usage extensions)" \
- -S "Processing of the Certificate handshake message failed"
- run_test "extKeyUsage cli-auth: serverAuth,clientAuth -> OK" \
- "$P_SRV debug_level=1 auth_mode=optional" \
- "$O_CLI -key data_files/server5.key \
- -cert data_files/server5.eku-srv_cli.crt" \
- 0 \
- -S "bad certificate (usage extensions)" \
- -S "Processing of the Certificate handshake message failed"
- run_test "extKeyUsage cli-auth: codeSign,anyEKU -> OK" \
- "$P_SRV debug_level=1 auth_mode=optional" \
- "$O_CLI -key data_files/server5.key \
- -cert data_files/server5.eku-cs_any.crt" \
- 0 \
- -S "bad certificate (usage extensions)" \
- -S "Processing of the Certificate handshake message failed"
- run_test "extKeyUsage cli-auth: codeSign -> fail (soft)" \
- "$P_SRV debug_level=1 auth_mode=optional" \
- "$O_CLI -key data_files/server5.key \
- -cert data_files/server5.eku-cs.crt" \
- 0 \
- -s "bad certificate (usage extensions)" \
- -S "Processing of the Certificate handshake message failed"
- run_test "extKeyUsage cli-auth: codeSign -> fail (hard)" \
- "$P_SRV debug_level=1 auth_mode=required" \
- "$O_CLI -key data_files/server5.key \
- -cert data_files/server5.eku-cs.crt" \
- 1 \
- -s "bad certificate (usage extensions)" \
- -s "Processing of the Certificate handshake message failed"
- # Tests for DHM parameters loading
- run_test "DHM parameters: reference" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=3" \
- 0 \
- -c "value of 'DHM: P ' (2048 bits)" \
- -c "value of 'DHM: G ' (2 bits)"
- run_test "DHM parameters: other parameters" \
- "$P_SRV dhm_file=data_files/dhparams.pem" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=3" \
- 0 \
- -c "value of 'DHM: P ' (1024 bits)" \
- -c "value of 'DHM: G ' (2 bits)"
- # Tests for DHM client-side size checking
- run_test "DHM size: server default, client default, OK" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=1" \
- 0 \
- -C "DHM prime too short:"
- run_test "DHM size: server default, client 2048, OK" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=1 dhmlen=2048" \
- 0 \
- -C "DHM prime too short:"
- run_test "DHM size: server 1024, client default, OK" \
- "$P_SRV dhm_file=data_files/dhparams.pem" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=1" \
- 0 \
- -C "DHM prime too short:"
- run_test "DHM size: server 1000, client default, rejected" \
- "$P_SRV dhm_file=data_files/dh.1000.pem" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=1" \
- 1 \
- -c "DHM prime too short:"
- run_test "DHM size: server default, client 2049, rejected" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=1 dhmlen=2049" \
- 1 \
- -c "DHM prime too short:"
- # Tests for PSK callback
- run_test "PSK callback: psk, no callback" \
- "$P_SRV psk=abc123 psk_identity=foo" \
- "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=foo psk=abc123" \
- 0 \
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: opaque psk on client, no callback" \
- "$P_SRV extended_ms=0 debug_level=1 psk=abc123 psk_identity=foo" \
- "$P_CLI extended_ms=0 debug_level=1 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=foo psk=abc123 psk_opaque=1" \
- 0 \
- -c "skip PMS generation for opaque PSK"\
- -S "skip PMS generation for opaque PSK"\
- -C "session hash for extended master secret"\
- -S "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: opaque psk on client, no callback, SHA-384" \
- "$P_SRV extended_ms=0 debug_level=1 psk=abc123 psk_identity=foo" \
- "$P_CLI extended_ms=0 debug_level=1 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384 \
- psk_identity=foo psk=abc123 psk_opaque=1" \
- 0 \
- -c "skip PMS generation for opaque PSK"\
- -S "skip PMS generation for opaque PSK"\
- -C "session hash for extended master secret"\
- -S "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: opaque psk on client, no callback, EMS" \
- "$P_SRV extended_ms=1 debug_level=3 psk=abc123 psk_identity=foo" \
- "$P_CLI extended_ms=1 debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=foo psk=abc123 psk_opaque=1" \
- 0 \
- -c "skip PMS generation for opaque PSK"\
- -S "skip PMS generation for opaque PSK"\
- -c "session hash for extended master secret"\
- -s "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: opaque psk on client, no callback, SHA-384, EMS" \
- "$P_SRV extended_ms=1 debug_level=3 psk=abc123 psk_identity=foo" \
- "$P_CLI extended_ms=1 debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384 \
- psk_identity=foo psk=abc123 psk_opaque=1" \
- 0 \
- -c "skip PMS generation for opaque PSK"\
- -S "skip PMS generation for opaque PSK"\
- -c "session hash for extended master secret"\
- -s "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, static opaque on server, no callback" \
- "$P_SRV extended_ms=0 debug_level=1 psk=abc123 psk_identity=foo psk_opaque=1 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=1 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=foo psk=abc123" \
- 0 \
- -C "skip PMS generation for opaque PSK"\
- -s "skip PMS generation for opaque PSK"\
- -C "session hash for extended master secret"\
- -S "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, static opaque on server, no callback, SHA-384" \
- "$P_SRV extended_ms=0 debug_level=1 psk=abc123 psk_identity=foo psk_opaque=1 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384" \
- "$P_CLI extended_ms=0 debug_level=1 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384 \
- psk_identity=foo psk=abc123" \
- 0 \
- -C "skip PMS generation for opaque PSK"\
- -s "skip PMS generation for opaque PSK"\
- -C "session hash for extended master secret"\
- -S "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, static opaque on server, no callback, EMS" \
- "$P_SRV debug_level=3 psk=abc123 psk_identity=foo psk_opaque=1 min_version=tls1_2 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA extended_ms=1" \
- "$P_CLI debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=foo psk=abc123 extended_ms=1" \
- 0 \
- -c "session hash for extended master secret"\
- -s "session hash for extended master secret"\
- -C "skip PMS generation for opaque PSK"\
- -s "skip PMS generation for opaque PSK"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, static opaque on server, no callback, EMS, SHA384" \
- "$P_SRV debug_level=3 psk=abc123 psk_identity=foo psk_opaque=1 min_version=tls1_2 \
- force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384 extended_ms=1" \
- "$P_CLI debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384 \
- psk_identity=foo psk=abc123 extended_ms=1" \
- 0 \
- -c "session hash for extended master secret"\
- -s "session hash for extended master secret"\
- -C "skip PMS generation for opaque PSK"\
- -s "skip PMS generation for opaque PSK"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, no static PSK on server, opaque PSK from callback" \
- "$P_SRV extended_ms=0 debug_level=3 psk_list=abc,dead,def,beef psk_list_opaque=1 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=def psk=beef" \
- 0 \
- -C "skip PMS generation for opaque PSK"\
- -s "skip PMS generation for opaque PSK"\
- -C "session hash for extended master secret"\
- -S "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, no static PSK on server, opaque PSK from callback, SHA-384" \
- "$P_SRV extended_ms=0 debug_level=3 psk_list=abc,dead,def,beef psk_list_opaque=1 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384 \
- psk_identity=def psk=beef" \
- 0 \
- -C "skip PMS generation for opaque PSK"\
- -s "skip PMS generation for opaque PSK"\
- -C "session hash for extended master secret"\
- -S "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, no static PSK on server, opaque PSK from callback, EMS" \
- "$P_SRV debug_level=3 psk_list=abc,dead,def,beef psk_list_opaque=1 min_version=tls1_2 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA extended_ms=1" \
- "$P_CLI debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=abc psk=dead extended_ms=1" \
- 0 \
- -c "session hash for extended master secret"\
- -s "session hash for extended master secret"\
- -C "skip PMS generation for opaque PSK"\
- -s "skip PMS generation for opaque PSK"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, no static PSK on server, opaque PSK from callback, EMS, SHA384" \
- "$P_SRV debug_level=3 psk_list=abc,dead,def,beef psk_list_opaque=1 min_version=tls1_2 \
- force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384 extended_ms=1" \
- "$P_CLI debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384 \
- psk_identity=abc psk=dead extended_ms=1" \
- 0 \
- -c "session hash for extended master secret"\
- -s "session hash for extended master secret"\
- -C "skip PMS generation for opaque PSK"\
- -s "skip PMS generation for opaque PSK"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, mismatching static raw PSK on server, opaque PSK from callback" \
- "$P_SRV extended_ms=0 psk_identity=foo psk=abc123 debug_level=3 psk_list=abc,dead,def,beef psk_list_opaque=1 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=def psk=beef" \
- 0 \
- -C "skip PMS generation for opaque PSK"\
- -s "skip PMS generation for opaque PSK"\
- -C "session hash for extended master secret"\
- -S "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, mismatching static opaque PSK on server, opaque PSK from callback" \
- "$P_SRV extended_ms=0 psk_opaque=1 psk_identity=foo psk=abc123 debug_level=3 psk_list=abc,dead,def,beef psk_list_opaque=1 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=def psk=beef" \
- 0 \
- -C "skip PMS generation for opaque PSK"\
- -s "skip PMS generation for opaque PSK"\
- -C "session hash for extended master secret"\
- -S "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, mismatching static opaque PSK on server, raw PSK from callback" \
- "$P_SRV extended_ms=0 psk_opaque=1 psk_identity=foo psk=abc123 debug_level=3 psk_list=abc,dead,def,beef min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=def psk=beef" \
- 0 \
- -C "skip PMS generation for opaque PSK"\
- -C "session hash for extended master secret"\
- -S "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, id-matching but wrong raw PSK on server, opaque PSK from callback" \
- "$P_SRV extended_ms=0 psk_opaque=1 psk_identity=def psk=abc123 debug_level=3 psk_list=abc,dead,def,beef min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=def psk=beef" \
- 0 \
- -C "skip PMS generation for opaque PSK"\
- -C "session hash for extended master secret"\
- -S "session hash for extended master secret"\
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
- run_test "PSK callback: raw psk on client, matching opaque PSK on server, wrong opaque PSK from callback" \
- "$P_SRV extended_ms=0 psk_opaque=1 psk_identity=def psk=beef debug_level=3 psk_list=abc,dead,def,abc123 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls1_2 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=def psk=beef" \
- 1 \
- -s "SSL - Verification of the message MAC failed"
- run_test "PSK callback: no psk, no callback" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=foo psk=abc123" \
- 1 \
- -s "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- run_test "PSK callback: callback overrides other settings" \
- "$P_SRV psk=abc123 psk_identity=foo psk_list=abc,dead,def,beef" \
- "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=foo psk=abc123" \
- 1 \
- -S "SSL - None of the common ciphersuites is usable" \
- -s "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- run_test "PSK callback: first id matches" \
- "$P_SRV psk_list=abc,dead,def,beef" \
- "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=abc psk=dead" \
- 0 \
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- run_test "PSK callback: second id matches" \
- "$P_SRV psk_list=abc,dead,def,beef" \
- "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=def psk=beef" \
- 0 \
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- run_test "PSK callback: no match" \
- "$P_SRV psk_list=abc,dead,def,beef" \
- "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=ghi psk=beef" \
- 1 \
- -S "SSL - None of the common ciphersuites is usable" \
- -s "SSL - Unknown identity received" \
- -S "SSL - Verification of the message MAC failed"
- run_test "PSK callback: wrong key" \
- "$P_SRV psk_list=abc,dead,def,beef" \
- "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
- psk_identity=abc psk=beef" \
- 1 \
- -S "SSL - None of the common ciphersuites is usable" \
- -S "SSL - Unknown identity received" \
- -s "SSL - Verification of the message MAC failed"
- # Tests for EC J-PAKE
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
- run_test "ECJPAKE: client not configured" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3" \
- 0 \
- -C "add ciphersuite: 0xc0ff" \
- -C "adding ecjpake_kkpp extension" \
- -S "found ecjpake kkpp extension" \
- -S "skip ecjpake kkpp extension" \
- -S "ciphersuite mismatch: ecjpake not configured" \
- -S "server hello, ecjpake kkpp extension" \
- -C "found ecjpake_kkpp extension" \
- -S "None of the common ciphersuites is usable"
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
- run_test "ECJPAKE: server not configured" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3 ecjpake_pw=bla \
- force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \
- 1 \
- -c "add ciphersuite: 0xc0ff" \
- -c "adding ecjpake_kkpp extension" \
- -s "found ecjpake kkpp extension" \
- -s "skip ecjpake kkpp extension" \
- -s "ciphersuite mismatch: ecjpake not configured" \
- -S "server hello, ecjpake kkpp extension" \
- -C "found ecjpake_kkpp extension" \
- -s "None of the common ciphersuites is usable"
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
- run_test "ECJPAKE: working, TLS" \
- "$P_SRV debug_level=3 ecjpake_pw=bla" \
- "$P_CLI debug_level=3 ecjpake_pw=bla \
- force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \
- 0 \
- -c "add ciphersuite: 0xc0ff" \
- -c "adding ecjpake_kkpp extension" \
- -C "re-using cached ecjpake parameters" \
- -s "found ecjpake kkpp extension" \
- -S "skip ecjpake kkpp extension" \
- -S "ciphersuite mismatch: ecjpake not configured" \
- -s "server hello, ecjpake kkpp extension" \
- -c "found ecjpake_kkpp extension" \
- -S "None of the common ciphersuites is usable" \
- -S "SSL - Verification of the message MAC failed"
- server_needs_more_time 1
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE
- run_test "ECJPAKE: password mismatch, TLS" \
- "$P_SRV debug_level=3 ecjpake_pw=bla" \
- "$P_CLI debug_level=3 ecjpake_pw=bad \
- force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \
- 1 \
- -C "re-using cached ecjpake parameters" \
- -s "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE
- run_test "ECJPAKE: working, DTLS" \
- "$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla" \
- "$P_CLI debug_level=3 dtls=1 ecjpake_pw=bla \
- force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \
- 0 \
- -c "re-using cached ecjpake parameters" \
- -S "SSL - Verification of the message MAC failed"
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE
- run_test "ECJPAKE: working, DTLS, no cookie" \
- "$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla cookies=0" \
- "$P_CLI debug_level=3 dtls=1 ecjpake_pw=bla \
- force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \
- 0 \
- -C "re-using cached ecjpake parameters" \
- -S "SSL - Verification of the message MAC failed"
- server_needs_more_time 1
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE
- run_test "ECJPAKE: password mismatch, DTLS" \
- "$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla" \
- "$P_CLI debug_level=3 dtls=1 ecjpake_pw=bad \
- force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \
- 1 \
- -c "re-using cached ecjpake parameters" \
- -s "SSL - Verification of the message MAC failed"
- # for tests with configs/config-thread.h
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE
- run_test "ECJPAKE: working, DTLS, nolog" \
- "$P_SRV dtls=1 ecjpake_pw=bla" \
- "$P_CLI dtls=1 ecjpake_pw=bla \
- force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \
- 0
- # Tests for ciphersuites per version
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- requires_config_enabled MBEDTLS_CAMELLIA_C
- requires_config_enabled MBEDTLS_AES_C
- run_test "Per-version suites: SSL3" \
- "$P_SRV min_version=ssl3 version_suites=TLS-RSA-WITH-CAMELLIA-128-CBC-SHA,TLS-RSA-WITH-AES-256-CBC-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
- "$P_CLI force_version=ssl3" \
- 0 \
- -c "Ciphersuite is TLS-RSA-WITH-CAMELLIA-128-CBC-SHA"
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1
- requires_config_enabled MBEDTLS_CAMELLIA_C
- requires_config_enabled MBEDTLS_AES_C
- run_test "Per-version suites: TLS 1.0" \
- "$P_SRV version_suites=TLS-RSA-WITH-CAMELLIA-128-CBC-SHA,TLS-RSA-WITH-AES-256-CBC-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
- "$P_CLI force_version=tls1 arc4=1" \
- 0 \
- -c "Ciphersuite is TLS-RSA-WITH-AES-256-CBC-SHA"
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- requires_config_enabled MBEDTLS_CAMELLIA_C
- requires_config_enabled MBEDTLS_AES_C
- run_test "Per-version suites: TLS 1.1" \
- "$P_SRV version_suites=TLS-RSA-WITH-CAMELLIA-128-CBC-SHA,TLS-RSA-WITH-AES-256-CBC-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
- "$P_CLI force_version=tls1_1" \
- 0 \
- -c "Ciphersuite is TLS-RSA-WITH-AES-128-CBC-SHA"
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
- requires_config_enabled MBEDTLS_CAMELLIA_C
- requires_config_enabled MBEDTLS_AES_C
- run_test "Per-version suites: TLS 1.2" \
- "$P_SRV version_suites=TLS-RSA-WITH-CAMELLIA-128-CBC-SHA,TLS-RSA-WITH-AES-256-CBC-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
- "$P_CLI force_version=tls1_2" \
- 0 \
- -c "Ciphersuite is TLS-RSA-WITH-AES-128-GCM-SHA256"
- # Test for ClientHello without extensions
- requires_gnutls
- run_test "ClientHello without extensions" \
- "$P_SRV debug_level=3" \
- "$G_CLI --priority=NORMAL:%NO_EXTENSIONS:%DISABLE_SAFE_RENEGOTIATION localhost" \
- 0 \
- -s "dumping 'client hello extensions' (0 bytes)"
- # Tests for mbedtls_ssl_get_bytes_avail()
- run_test "mbedtls_ssl_get_bytes_avail: no extra data" \
- "$P_SRV" \
- "$P_CLI request_size=100" \
- 0 \
- -s "Read from client: 100 bytes read$"
- run_test "mbedtls_ssl_get_bytes_avail: extra data" \
- "$P_SRV" \
- "$P_CLI request_size=500" \
- 0 \
- -s "Read from client: 500 bytes read (.*+.*)"
- # Tests for small client packets
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Small client packet SSLv3 BlockCipher" \
- "$P_SRV min_version=ssl3" \
- "$P_CLI request_size=1 force_version=ssl3 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Small client packet SSLv3 StreamCipher" \
- "$P_SRV min_version=ssl3 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=1 force_version=ssl3 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.0 BlockCipher" \
- "$P_SRV" \
- "$P_CLI request_size=1 force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.0 BlockCipher, without EtM" \
- "$P_SRV" \
- "$P_CLI request_size=1 force_version=tls1 etm=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.0 BlockCipher, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.0 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.0 StreamCipher" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=1 force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.0 StreamCipher, without EtM" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=1 force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.0 StreamCipher, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.0 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
- trunc_hmac=1 etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.1 BlockCipher" \
- "$P_SRV" \
- "$P_CLI request_size=1 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.1 BlockCipher, without EtM" \
- "$P_SRV" \
- "$P_CLI request_size=1 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.1 BlockCipher, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.1 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.1 StreamCipher" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=1 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.1 StreamCipher, without EtM" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=1 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.1 StreamCipher, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.1 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.2 BlockCipher" \
- "$P_SRV" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.2 BlockCipher, without EtM" \
- "$P_SRV" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.2 BlockCipher larger MAC" \
- "$P_SRV" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.2 BlockCipher, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.2 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.2 StreamCipher" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.2 StreamCipher, without EtM" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.2 StreamCipher, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet TLS 1.2 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.2 AEAD" \
- "$P_SRV" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
- 0 \
- -s "Read from client: 1 bytes read"
- run_test "Small client packet TLS 1.2 AEAD shorter tag" \
- "$P_SRV" \
- "$P_CLI request_size=1 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
- 0 \
- -s "Read from client: 1 bytes read"
- # Tests for small client packets in DTLS
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- run_test "Small client packet DTLS 1.0" \
- "$P_SRV dtls=1 force_version=dtls1" \
- "$P_CLI dtls=1 request_size=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- run_test "Small client packet DTLS 1.0, without EtM" \
- "$P_SRV dtls=1 force_version=dtls1 etm=0" \
- "$P_CLI dtls=1 request_size=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet DTLS 1.0, truncated hmac" \
- "$P_SRV dtls=1 force_version=dtls1 trunc_hmac=1" \
- "$P_CLI dtls=1 request_size=1 trunc_hmac=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet DTLS 1.0, without EtM, truncated MAC" \
- "$P_SRV dtls=1 force_version=dtls1 trunc_hmac=1 etm=0" \
- "$P_CLI dtls=1 request_size=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1"\
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- run_test "Small client packet DTLS 1.2" \
- "$P_SRV dtls=1 force_version=dtls1_2" \
- "$P_CLI dtls=1 request_size=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- run_test "Small client packet DTLS 1.2, without EtM" \
- "$P_SRV dtls=1 force_version=dtls1_2 etm=0" \
- "$P_CLI dtls=1 request_size=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet DTLS 1.2, truncated hmac" \
- "$P_SRV dtls=1 force_version=dtls1_2 trunc_hmac=1" \
- "$P_CLI dtls=1 request_size=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small client packet DTLS 1.2, without EtM, truncated MAC" \
- "$P_SRV dtls=1 force_version=dtls1_2 trunc_hmac=1 etm=0" \
- "$P_CLI dtls=1 request_size=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1"\
- 0 \
- -s "Read from client: 1 bytes read"
- # Tests for small server packets
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Small server packet SSLv3 BlockCipher" \
- "$P_SRV response_size=1 min_version=ssl3" \
- "$P_CLI force_version=ssl3 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Small server packet SSLv3 StreamCipher" \
- "$P_SRV response_size=1 min_version=ssl3 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=ssl3 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.0 BlockCipher" \
- "$P_SRV response_size=1" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.0 BlockCipher, without EtM" \
- "$P_SRV response_size=1" \
- "$P_CLI force_version=tls1 etm=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.0 BlockCipher, truncated MAC" \
- "$P_SRV response_size=1 trunc_hmac=1" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.0 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=1 trunc_hmac=1" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.0 StreamCipher" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.0 StreamCipher, without EtM" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.0 StreamCipher, truncated MAC" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.0 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI force_version=tls1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
- trunc_hmac=1 etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.1 BlockCipher" \
- "$P_SRV response_size=1" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.1 BlockCipher, without EtM" \
- "$P_SRV response_size=1" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.1 BlockCipher, truncated MAC" \
- "$P_SRV response_size=1 trunc_hmac=1" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.1 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=1 trunc_hmac=1" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.1 StreamCipher" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.1 StreamCipher, without EtM" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.1 StreamCipher, truncated MAC" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.1 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.2 BlockCipher" \
- "$P_SRV response_size=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.2 BlockCipher, without EtM" \
- "$P_SRV response_size=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.2 BlockCipher larger MAC" \
- "$P_SRV response_size=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.2 BlockCipher, truncated MAC" \
- "$P_SRV response_size=1 trunc_hmac=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.2 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=1 trunc_hmac=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.2 StreamCipher" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.2 StreamCipher, without EtM" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.2 StreamCipher, truncated MAC" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet TLS 1.2 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.2 AEAD" \
- "$P_SRV response_size=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
- 0 \
- -c "Read from server: 1 bytes read"
- run_test "Small server packet TLS 1.2 AEAD shorter tag" \
- "$P_SRV response_size=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
- 0 \
- -c "Read from server: 1 bytes read"
- # Tests for small server packets in DTLS
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- run_test "Small server packet DTLS 1.0" \
- "$P_SRV dtls=1 response_size=1 force_version=dtls1" \
- "$P_CLI dtls=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- run_test "Small server packet DTLS 1.0, without EtM" \
- "$P_SRV dtls=1 response_size=1 force_version=dtls1 etm=0" \
- "$P_CLI dtls=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet DTLS 1.0, truncated hmac" \
- "$P_SRV dtls=1 response_size=1 force_version=dtls1 trunc_hmac=1" \
- "$P_CLI dtls=1 trunc_hmac=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet DTLS 1.0, without EtM, truncated MAC" \
- "$P_SRV dtls=1 response_size=1 force_version=dtls1 trunc_hmac=1 etm=0" \
- "$P_CLI dtls=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1"\
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- run_test "Small server packet DTLS 1.2" \
- "$P_SRV dtls=1 response_size=1 force_version=dtls1_2" \
- "$P_CLI dtls=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- run_test "Small server packet DTLS 1.2, without EtM" \
- "$P_SRV dtls=1 response_size=1 force_version=dtls1_2 etm=0" \
- "$P_CLI dtls=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet DTLS 1.2, truncated hmac" \
- "$P_SRV dtls=1 response_size=1 force_version=dtls1_2 trunc_hmac=1" \
- "$P_CLI dtls=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -c "Read from server: 1 bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Small server packet DTLS 1.2, without EtM, truncated MAC" \
- "$P_SRV dtls=1 response_size=1 force_version=dtls1_2 trunc_hmac=1 etm=0" \
- "$P_CLI dtls=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1"\
- 0 \
- -c "Read from server: 1 bytes read"
- # A test for extensions in SSLv3
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "SSLv3 with extensions, server side" \
- "$P_SRV min_version=ssl3 debug_level=3" \
- "$P_CLI force_version=ssl3 tickets=1 max_frag_len=4096 alpn=abc,1234" \
- 0 \
- -S "dumping 'client hello extensions'" \
- -S "server hello, total extension length:"
- # Test for large client packets
- # How many fragments do we expect to write $1 bytes?
- fragments_for_write() {
- echo "$(( ( $1 + $MAX_OUT_LEN - 1 ) / $MAX_OUT_LEN ))"
- }
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Large client packet SSLv3 BlockCipher" \
- "$P_SRV min_version=ssl3" \
- "$P_CLI request_size=16384 force_version=ssl3 recsplit=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Large client packet SSLv3 StreamCipher" \
- "$P_SRV min_version=ssl3 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=16384 force_version=ssl3 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.0 BlockCipher" \
- "$P_SRV" \
- "$P_CLI request_size=16384 force_version=tls1 recsplit=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.0 BlockCipher, without EtM" \
- "$P_SRV" \
- "$P_CLI request_size=16384 force_version=tls1 etm=0 recsplit=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.0 BlockCipher, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1 recsplit=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.0 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1 etm=0 recsplit=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.0 StreamCipher" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=16384 force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.0 StreamCipher, without EtM" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=16384 force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.0 StreamCipher, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.0 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.1 BlockCipher" \
- "$P_SRV" \
- "$P_CLI request_size=16384 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.1 BlockCipher, without EtM" \
- "$P_SRV" \
- "$P_CLI request_size=16384 force_version=tls1_1 etm=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.1 BlockCipher, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.1 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.1 StreamCipher" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=16384 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.1 StreamCipher, without EtM" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=16384 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.1 StreamCipher, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.1 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.2 BlockCipher" \
- "$P_SRV" \
- "$P_CLI request_size=16384 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.2 BlockCipher, without EtM" \
- "$P_SRV" \
- "$P_CLI request_size=16384 force_version=tls1_2 etm=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.2 BlockCipher larger MAC" \
- "$P_SRV" \
- "$P_CLI request_size=16384 force_version=tls1_2 \
- force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.2 BlockCipher, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.2 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.2 StreamCipher" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=16384 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.2 StreamCipher, without EtM" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI request_size=16384 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.2 StreamCipher, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- 0 \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large client packet TLS 1.2 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI request_size=16384 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.2 AEAD" \
- "$P_SRV" \
- "$P_CLI request_size=16384 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- run_test "Large client packet TLS 1.2 AEAD shorter tag" \
- "$P_SRV" \
- "$P_CLI request_size=16384 force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
- 0 \
- -c "16384 bytes written in $(fragments_for_write 16384) fragments" \
- -s "Read from client: $MAX_CONTENT_LEN bytes read"
- # Test for large server packets
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Large server packet SSLv3 StreamCipher" \
- "$P_SRV response_size=16384 min_version=ssl3 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=ssl3 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -c "Read from server: 16384 bytes read"
- # Checking next 4 tests logs for 1n-1 split against BEAST too
- requires_config_enabled MBEDTLS_SSL_PROTO_SSL3
- run_test "Large server packet SSLv3 BlockCipher" \
- "$P_SRV response_size=16384 min_version=ssl3" \
- "$P_CLI force_version=ssl3 recsplit=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"\
- -c "16383 bytes read"\
- -C "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.0 BlockCipher" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1 recsplit=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"\
- -c "16383 bytes read"\
- -C "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.0 BlockCipher, without EtM" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1 etm=0 recsplit=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 1 bytes read"\
- -c "16383 bytes read"\
- -C "Read from server: 16384 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large server packet TLS 1.0 BlockCipher truncated MAC" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1 recsplit=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
- trunc_hmac=1" \
- 0 \
- -c "Read from server: 1 bytes read"\
- -c "16383 bytes read"\
- -C "Read from server: 16384 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large server packet TLS 1.0 StreamCipher truncated MAC" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
- trunc_hmac=1" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.0 StreamCipher" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.0 StreamCipher, without EtM" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large server packet TLS 1.0 StreamCipher, truncated MAC" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large server packet TLS 1.0 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI force_version=tls1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.1 BlockCipher" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.1 BlockCipher, without EtM" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1_1 etm=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large server packet TLS 1.1 BlockCipher truncated MAC" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
- trunc_hmac=1" \
- 0 \
- -c "Read from server: 16384 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large server packet TLS 1.1 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=16384 trunc_hmac=1" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.1 StreamCipher" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.1 StreamCipher, without EtM" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large server packet TLS 1.1 StreamCipher truncated MAC" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
- trunc_hmac=1" \
- 0 \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.1 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI force_version=tls1_1 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.2 BlockCipher" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.2 BlockCipher, without EtM" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1_2 etm=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.2 BlockCipher larger MAC" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
- 0 \
- -c "Read from server: 16384 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large server packet TLS 1.2 BlockCipher truncated MAC" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
- trunc_hmac=1" \
- 0 \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.2 BlockCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=16384 trunc_hmac=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.2 StreamCipher" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.2 StreamCipher, without EtM" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large server packet TLS 1.2 StreamCipher truncated MAC" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
- trunc_hmac=1" \
- 0 \
- -c "Read from server: 16384 bytes read"
- requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC
- run_test "Large server packet TLS 1.2 StreamCipher, without EtM, truncated MAC" \
- "$P_SRV response_size=16384 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \
- 0 \
- -s "16384 bytes written in 1 fragments" \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.2 AEAD" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
- 0 \
- -c "Read from server: 16384 bytes read"
- run_test "Large server packet TLS 1.2 AEAD shorter tag" \
- "$P_SRV response_size=16384" \
- "$P_CLI force_version=tls1_2 \
- force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
- 0 \
- -c "Read from server: 16384 bytes read"
- # Tests for restartable ECC
- requires_config_enabled MBEDTLS_ECP_RESTARTABLE
- run_test "EC restart: TLS, default" \
- "$P_SRV auth_mode=required" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- debug_level=1" \
- 0 \
- -C "x509_verify_cert.*4b00" \
- -C "mbedtls_pk_verify.*4b00" \
- -C "mbedtls_ecdh_make_public.*4b00" \
- -C "mbedtls_pk_sign.*4b00"
- requires_config_enabled MBEDTLS_ECP_RESTARTABLE
- run_test "EC restart: TLS, max_ops=0" \
- "$P_SRV auth_mode=required" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- debug_level=1 ec_max_ops=0" \
- 0 \
- -C "x509_verify_cert.*4b00" \
- -C "mbedtls_pk_verify.*4b00" \
- -C "mbedtls_ecdh_make_public.*4b00" \
- -C "mbedtls_pk_sign.*4b00"
- requires_config_enabled MBEDTLS_ECP_RESTARTABLE
- run_test "EC restart: TLS, max_ops=65535" \
- "$P_SRV auth_mode=required" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- debug_level=1 ec_max_ops=65535" \
- 0 \
- -C "x509_verify_cert.*4b00" \
- -C "mbedtls_pk_verify.*4b00" \
- -C "mbedtls_ecdh_make_public.*4b00" \
- -C "mbedtls_pk_sign.*4b00"
- requires_config_enabled MBEDTLS_ECP_RESTARTABLE
- run_test "EC restart: TLS, max_ops=1000" \
- "$P_SRV auth_mode=required" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- debug_level=1 ec_max_ops=1000" \
- 0 \
- -c "x509_verify_cert.*4b00" \
- -c "mbedtls_pk_verify.*4b00" \
- -c "mbedtls_ecdh_make_public.*4b00" \
- -c "mbedtls_pk_sign.*4b00"
- requires_config_enabled MBEDTLS_ECP_RESTARTABLE
- run_test "EC restart: TLS, max_ops=1000, badsign" \
- "$P_SRV auth_mode=required \
- crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- debug_level=1 ec_max_ops=1000" \
- 1 \
- -c "x509_verify_cert.*4b00" \
- -C "mbedtls_pk_verify.*4b00" \
- -C "mbedtls_ecdh_make_public.*4b00" \
- -C "mbedtls_pk_sign.*4b00" \
- -c "! The certificate is not correctly signed by the trusted CA" \
- -c "! mbedtls_ssl_handshake returned" \
- -c "X509 - Certificate verification failed"
- requires_config_enabled MBEDTLS_ECP_RESTARTABLE
- run_test "EC restart: TLS, max_ops=1000, auth_mode=optional badsign" \
- "$P_SRV auth_mode=required \
- crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- debug_level=1 ec_max_ops=1000 auth_mode=optional" \
- 0 \
- -c "x509_verify_cert.*4b00" \
- -c "mbedtls_pk_verify.*4b00" \
- -c "mbedtls_ecdh_make_public.*4b00" \
- -c "mbedtls_pk_sign.*4b00" \
- -c "! The certificate is not correctly signed by the trusted CA" \
- -C "! mbedtls_ssl_handshake returned" \
- -C "X509 - Certificate verification failed"
- requires_config_enabled MBEDTLS_ECP_RESTARTABLE
- run_test "EC restart: TLS, max_ops=1000, auth_mode=none badsign" \
- "$P_SRV auth_mode=required \
- crt_file=data_files/server5-badsign.crt \
- key_file=data_files/server5.key" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- debug_level=1 ec_max_ops=1000 auth_mode=none" \
- 0 \
- -C "x509_verify_cert.*4b00" \
- -c "mbedtls_pk_verify.*4b00" \
- -c "mbedtls_ecdh_make_public.*4b00" \
- -c "mbedtls_pk_sign.*4b00" \
- -C "! The certificate is not correctly signed by the trusted CA" \
- -C "! mbedtls_ssl_handshake returned" \
- -C "X509 - Certificate verification failed"
- requires_config_enabled MBEDTLS_ECP_RESTARTABLE
- run_test "EC restart: DTLS, max_ops=1000" \
- "$P_SRV auth_mode=required dtls=1" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- dtls=1 debug_level=1 ec_max_ops=1000" \
- 0 \
- -c "x509_verify_cert.*4b00" \
- -c "mbedtls_pk_verify.*4b00" \
- -c "mbedtls_ecdh_make_public.*4b00" \
- -c "mbedtls_pk_sign.*4b00"
- requires_config_enabled MBEDTLS_ECP_RESTARTABLE
- run_test "EC restart: TLS, max_ops=1000 no client auth" \
- "$P_SRV" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- debug_level=1 ec_max_ops=1000" \
- 0 \
- -c "x509_verify_cert.*4b00" \
- -c "mbedtls_pk_verify.*4b00" \
- -c "mbedtls_ecdh_make_public.*4b00" \
- -C "mbedtls_pk_sign.*4b00"
- requires_config_enabled MBEDTLS_ECP_RESTARTABLE
- run_test "EC restart: TLS, max_ops=1000, ECDHE-PSK" \
- "$P_SRV psk=abc123" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-PSK-WITH-AES-128-CBC-SHA256 \
- psk=abc123 debug_level=1 ec_max_ops=1000" \
- 0 \
- -C "x509_verify_cert.*4b00" \
- -C "mbedtls_pk_verify.*4b00" \
- -C "mbedtls_ecdh_make_public.*4b00" \
- -C "mbedtls_pk_sign.*4b00"
- # Tests of asynchronous private key support in SSL
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: sign, delay=0" \
- "$P_SRV \
- async_operations=s async_private_delay1=0 async_private_delay2=0" \
- "$P_CLI" \
- 0 \
- -s "Async sign callback: using key slot " \
- -s "Async resume (slot [0-9]): sign done, status=0"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: sign, delay=1" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_delay2=1" \
- "$P_CLI" \
- 0 \
- -s "Async sign callback: using key slot " \
- -s "Async resume (slot [0-9]): call 0 more times." \
- -s "Async resume (slot [0-9]): sign done, status=0"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: sign, delay=2" \
- "$P_SRV \
- async_operations=s async_private_delay1=2 async_private_delay2=2" \
- "$P_CLI" \
- 0 \
- -s "Async sign callback: using key slot " \
- -U "Async sign callback: using key slot " \
- -s "Async resume (slot [0-9]): call 1 more times." \
- -s "Async resume (slot [0-9]): call 0 more times." \
- -s "Async resume (slot [0-9]): sign done, status=0"
- # Test that the async callback correctly signs the 36-byte hash of TLS 1.0/1.1
- # with RSA PKCS#1v1.5 as used in TLS 1.0/1.1.
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- run_test "SSL async private: sign, RSA, TLS 1.1" \
- "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt \
- async_operations=s async_private_delay1=0 async_private_delay2=0" \
- "$P_CLI force_version=tls1_1" \
- 0 \
- -s "Async sign callback: using key slot " \
- -s "Async resume (slot [0-9]): sign done, status=0"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: sign, SNI" \
- "$P_SRV debug_level=3 \
- async_operations=s async_private_delay1=0 async_private_delay2=0 \
- crt_file=data_files/server5.crt key_file=data_files/server5.key \
- sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \
- "$P_CLI server_name=polarssl.example" \
- 0 \
- -s "Async sign callback: using key slot " \
- -s "Async resume (slot [0-9]): sign done, status=0" \
- -s "parse ServerName extension" \
- -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \
- -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: decrypt, delay=0" \
- "$P_SRV \
- async_operations=d async_private_delay1=0 async_private_delay2=0" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -s "Async decrypt callback: using key slot " \
- -s "Async resume (slot [0-9]): decrypt done, status=0"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: decrypt, delay=1" \
- "$P_SRV \
- async_operations=d async_private_delay1=1 async_private_delay2=1" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -s "Async decrypt callback: using key slot " \
- -s "Async resume (slot [0-9]): call 0 more times." \
- -s "Async resume (slot [0-9]): decrypt done, status=0"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: decrypt RSA-PSK, delay=0" \
- "$P_SRV psk=abc123 \
- async_operations=d async_private_delay1=0 async_private_delay2=0" \
- "$P_CLI psk=abc123 \
- force_ciphersuite=TLS-RSA-PSK-WITH-AES-128-CBC-SHA256" \
- 0 \
- -s "Async decrypt callback: using key slot " \
- -s "Async resume (slot [0-9]): decrypt done, status=0"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: decrypt RSA-PSK, delay=1" \
- "$P_SRV psk=abc123 \
- async_operations=d async_private_delay1=1 async_private_delay2=1" \
- "$P_CLI psk=abc123 \
- force_ciphersuite=TLS-RSA-PSK-WITH-AES-128-CBC-SHA256" \
- 0 \
- -s "Async decrypt callback: using key slot " \
- -s "Async resume (slot [0-9]): call 0 more times." \
- -s "Async resume (slot [0-9]): decrypt done, status=0"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: sign callback not present" \
- "$P_SRV \
- async_operations=d async_private_delay1=1 async_private_delay2=1" \
- "$P_CLI; [ \$? -eq 1 ] &&
- $P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -S "Async sign callback" \
- -s "! mbedtls_ssl_handshake returned" \
- -s "The own private key or pre-shared key is not set, but needed" \
- -s "Async resume (slot [0-9]): decrypt done, status=0" \
- -s "Successful connection"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: decrypt callback not present" \
- "$P_SRV debug_level=1 \
- async_operations=s async_private_delay1=1 async_private_delay2=1" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA;
- [ \$? -eq 1 ] && $P_CLI" \
- 0 \
- -S "Async decrypt callback" \
- -s "! mbedtls_ssl_handshake returned" \
- -s "got no RSA private key" \
- -s "Async resume (slot [0-9]): sign done, status=0" \
- -s "Successful connection"
- # key1: ECDSA, key2: RSA; use key1 from slot 0
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: slot 0 used with key1" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- key_file2=data_files/server2.key crt_file2=data_files/server2.crt" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -s "Async sign callback: using key slot 0," \
- -s "Async resume (slot 0): call 0 more times." \
- -s "Async resume (slot 0): sign done, status=0"
- # key1: ECDSA, key2: RSA; use key2 from slot 0
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: slot 0 used with key2" \
- "$P_SRV \
- async_operations=s async_private_delay2=1 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- key_file2=data_files/server2.key crt_file2=data_files/server2.crt" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -s "Async sign callback: using key slot 0," \
- -s "Async resume (slot 0): call 0 more times." \
- -s "Async resume (slot 0): sign done, status=0"
- # key1: ECDSA, key2: RSA; use key2 from slot 1
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: slot 1 used with key2" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_delay2=1 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- key_file2=data_files/server2.key crt_file2=data_files/server2.crt" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -s "Async sign callback: using key slot 1," \
- -s "Async resume (slot 1): call 0 more times." \
- -s "Async resume (slot 1): sign done, status=0"
- # key1: ECDSA, key2: RSA; use key2 directly
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: fall back to transparent key" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- key_file2=data_files/server2.key crt_file2=data_files/server2.crt " \
- "$P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -s "Async sign callback: no key matches this certificate."
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: sign, error in start" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_delay2=1 \
- async_private_error=1" \
- "$P_CLI" \
- 1 \
- -s "Async sign callback: injected error" \
- -S "Async resume" \
- -S "Async cancel" \
- -s "! mbedtls_ssl_handshake returned"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: sign, cancel after start" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_delay2=1 \
- async_private_error=2" \
- "$P_CLI" \
- 1 \
- -s "Async sign callback: using key slot " \
- -S "Async resume" \
- -s "Async cancel"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: sign, error in resume" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_delay2=1 \
- async_private_error=3" \
- "$P_CLI" \
- 1 \
- -s "Async sign callback: using key slot " \
- -s "Async resume callback: sign done but injected error" \
- -S "Async cancel" \
- -s "! mbedtls_ssl_handshake returned"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: decrypt, error in start" \
- "$P_SRV \
- async_operations=d async_private_delay1=1 async_private_delay2=1 \
- async_private_error=1" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 1 \
- -s "Async decrypt callback: injected error" \
- -S "Async resume" \
- -S "Async cancel" \
- -s "! mbedtls_ssl_handshake returned"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: decrypt, cancel after start" \
- "$P_SRV \
- async_operations=d async_private_delay1=1 async_private_delay2=1 \
- async_private_error=2" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 1 \
- -s "Async decrypt callback: using key slot " \
- -S "Async resume" \
- -s "Async cancel"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: decrypt, error in resume" \
- "$P_SRV \
- async_operations=d async_private_delay1=1 async_private_delay2=1 \
- async_private_error=3" \
- "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 1 \
- -s "Async decrypt callback: using key slot " \
- -s "Async resume callback: decrypt done but injected error" \
- -S "Async cancel" \
- -s "! mbedtls_ssl_handshake returned"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: cancel after start then operate correctly" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_delay2=1 \
- async_private_error=-2" \
- "$P_CLI; [ \$? -eq 1 ] && $P_CLI" \
- 0 \
- -s "Async cancel" \
- -s "! mbedtls_ssl_handshake returned" \
- -s "Async resume" \
- -s "Successful connection"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: error in resume then operate correctly" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_delay2=1 \
- async_private_error=-3" \
- "$P_CLI; [ \$? -eq 1 ] && $P_CLI" \
- 0 \
- -s "! mbedtls_ssl_handshake returned" \
- -s "Async resume" \
- -s "Successful connection"
- # key1: ECDSA, key2: RSA; use key1 through async, then key2 directly
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: cancel after start then fall back to transparent key" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_error=-2 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- key_file2=data_files/server2.key crt_file2=data_files/server2.crt" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256;
- [ \$? -eq 1 ] &&
- $P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -s "Async sign callback: using key slot 0" \
- -S "Async resume" \
- -s "Async cancel" \
- -s "! mbedtls_ssl_handshake returned" \
- -s "Async sign callback: no key matches this certificate." \
- -s "Successful connection"
- # key1: ECDSA, key2: RSA; use key1 through async, then key2 directly
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- run_test "SSL async private: sign, error in resume then fall back to transparent key" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_error=-3 \
- key_file=data_files/server5.key crt_file=data_files/server5.crt \
- key_file2=data_files/server2.key crt_file2=data_files/server2.crt" \
- "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256;
- [ \$? -eq 1 ] &&
- $P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -s "Async resume" \
- -s "! mbedtls_ssl_handshake returned" \
- -s "Async sign callback: no key matches this certificate." \
- -s "Successful connection"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "SSL async private: renegotiation: client-initiated, sign" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_delay2=1 \
- exchanges=2 renegotiation=1" \
- "$P_CLI exchanges=2 renegotiation=1 renegotiate=1" \
- 0 \
- -s "Async sign callback: using key slot " \
- -s "Async resume (slot [0-9]): sign done, status=0"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "SSL async private: renegotiation: server-initiated, sign" \
- "$P_SRV \
- async_operations=s async_private_delay1=1 async_private_delay2=1 \
- exchanges=2 renegotiation=1 renegotiate=1" \
- "$P_CLI exchanges=2 renegotiation=1" \
- 0 \
- -s "Async sign callback: using key slot " \
- -s "Async resume (slot [0-9]): sign done, status=0"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "SSL async private: renegotiation: client-initiated, decrypt" \
- "$P_SRV \
- async_operations=d async_private_delay1=1 async_private_delay2=1 \
- exchanges=2 renegotiation=1" \
- "$P_CLI exchanges=2 renegotiation=1 renegotiate=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -s "Async decrypt callback: using key slot " \
- -s "Async resume (slot [0-9]): decrypt done, status=0"
- requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "SSL async private: renegotiation: server-initiated, decrypt" \
- "$P_SRV \
- async_operations=d async_private_delay1=1 async_private_delay2=1 \
- exchanges=2 renegotiation=1 renegotiate=1" \
- "$P_CLI exchanges=2 renegotiation=1 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -s "Async decrypt callback: using key slot " \
- -s "Async resume (slot [0-9]): decrypt done, status=0"
- # Tests for ECC extensions (rfc 4492)
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_CIPHER_MODE_CBC
- requires_config_enabled MBEDTLS_SHA256_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
- run_test "Force a non ECC ciphersuite in the client side" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -C "client hello, adding supported_elliptic_curves extension" \
- -C "client hello, adding supported_point_formats extension" \
- -S "found supported elliptic curves extension" \
- -S "found supported point formats extension"
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_CIPHER_MODE_CBC
- requires_config_enabled MBEDTLS_SHA256_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
- run_test "Force a non ECC ciphersuite in the server side" \
- "$P_SRV debug_level=3 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA256" \
- "$P_CLI debug_level=3" \
- 0 \
- -C "found supported_point_formats extension" \
- -S "server hello, supported_point_formats extension"
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_CIPHER_MODE_CBC
- requires_config_enabled MBEDTLS_SHA256_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
- run_test "Force an ECC ciphersuite in the client side" \
- "$P_SRV debug_level=3" \
- "$P_CLI debug_level=3 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \
- 0 \
- -c "client hello, adding supported_elliptic_curves extension" \
- -c "client hello, adding supported_point_formats extension" \
- -s "found supported elliptic curves extension" \
- -s "found supported point formats extension"
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_CIPHER_MODE_CBC
- requires_config_enabled MBEDTLS_SHA256_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
- run_test "Force an ECC ciphersuite in the server side" \
- "$P_SRV debug_level=3 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \
- "$P_CLI debug_level=3" \
- 0 \
- -c "found supported_point_formats extension" \
- -s "server hello, supported_point_formats extension"
- # Tests for DTLS HelloVerifyRequest
- run_test "DTLS cookie: enabled" \
- "$P_SRV dtls=1 debug_level=2" \
- "$P_CLI dtls=1 debug_level=2" \
- 0 \
- -s "cookie verification failed" \
- -s "cookie verification passed" \
- -S "cookie verification skipped" \
- -c "received hello verify request" \
- -s "hello verification requested" \
- -S "SSL - The requested feature is not available"
- run_test "DTLS cookie: disabled" \
- "$P_SRV dtls=1 debug_level=2 cookies=0" \
- "$P_CLI dtls=1 debug_level=2" \
- 0 \
- -S "cookie verification failed" \
- -S "cookie verification passed" \
- -s "cookie verification skipped" \
- -C "received hello verify request" \
- -S "hello verification requested" \
- -S "SSL - The requested feature is not available"
- run_test "DTLS cookie: default (failing)" \
- "$P_SRV dtls=1 debug_level=2 cookies=-1" \
- "$P_CLI dtls=1 debug_level=2 hs_timeout=100-400" \
- 1 \
- -s "cookie verification failed" \
- -S "cookie verification passed" \
- -S "cookie verification skipped" \
- -C "received hello verify request" \
- -S "hello verification requested" \
- -s "SSL - The requested feature is not available"
- requires_ipv6
- run_test "DTLS cookie: enabled, IPv6" \
- "$P_SRV dtls=1 debug_level=2 server_addr=::1" \
- "$P_CLI dtls=1 debug_level=2 server_addr=::1" \
- 0 \
- -s "cookie verification failed" \
- -s "cookie verification passed" \
- -S "cookie verification skipped" \
- -c "received hello verify request" \
- -s "hello verification requested" \
- -S "SSL - The requested feature is not available"
- run_test "DTLS cookie: enabled, nbio" \
- "$P_SRV dtls=1 nbio=2 debug_level=2" \
- "$P_CLI dtls=1 nbio=2 debug_level=2" \
- 0 \
- -s "cookie verification failed" \
- -s "cookie verification passed" \
- -S "cookie verification skipped" \
- -c "received hello verify request" \
- -s "hello verification requested" \
- -S "SSL - The requested feature is not available"
- # Tests for client reconnecting from the same port with DTLS
- not_with_valgrind # spurious resend
- run_test "DTLS client reconnect from same port: reference" \
- "$P_SRV dtls=1 exchanges=2 read_timeout=20000 hs_timeout=10000-20000" \
- "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=10000-20000" \
- 0 \
- -C "resend" \
- -S "The operation timed out" \
- -S "Client initiated reconnection from same port"
- not_with_valgrind # spurious resend
- run_test "DTLS client reconnect from same port: reconnect" \
- "$P_SRV dtls=1 exchanges=2 read_timeout=20000 hs_timeout=10000-20000" \
- "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=10000-20000 reconnect_hard=1" \
- 0 \
- -C "resend" \
- -S "The operation timed out" \
- -s "Client initiated reconnection from same port"
- not_with_valgrind # server/client too slow to respond in time (next test has higher timeouts)
- run_test "DTLS client reconnect from same port: reconnect, nbio, no valgrind" \
- "$P_SRV dtls=1 exchanges=2 read_timeout=1000 nbio=2" \
- "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=500-1000 reconnect_hard=1" \
- 0 \
- -S "The operation timed out" \
- -s "Client initiated reconnection from same port"
- only_with_valgrind # Only with valgrind, do previous test but with higher read_timeout and hs_timeout
- run_test "DTLS client reconnect from same port: reconnect, nbio, valgrind" \
- "$P_SRV dtls=1 exchanges=2 read_timeout=2000 nbio=2 hs_timeout=1500-6000" \
- "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=1500-3000 reconnect_hard=1" \
- 0 \
- -S "The operation timed out" \
- -s "Client initiated reconnection from same port"
- run_test "DTLS client reconnect from same port: no cookies" \
- "$P_SRV dtls=1 exchanges=2 read_timeout=1000 cookies=0" \
- "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=500-8000 reconnect_hard=1" \
- 0 \
- -s "The operation timed out" \
- -S "Client initiated reconnection from same port"
- run_test "DTLS client reconnect from same port: attacker-injected" \
- -p "$P_PXY inject_clihlo=1" \
- "$P_SRV dtls=1 exchanges=2 debug_level=1" \
- "$P_CLI dtls=1 exchanges=2" \
- 0 \
- -s "possible client reconnect from the same port" \
- -S "Client initiated reconnection from same port"
- # Tests for various cases of client authentication with DTLS
- # (focused on handshake flows and message parsing)
- run_test "DTLS client auth: required" \
- "$P_SRV dtls=1 auth_mode=required" \
- "$P_CLI dtls=1" \
- 0 \
- -s "Verifying peer X.509 certificate... ok"
- run_test "DTLS client auth: optional, client has no cert" \
- "$P_SRV dtls=1 auth_mode=optional" \
- "$P_CLI dtls=1 crt_file=none key_file=none" \
- 0 \
- -s "! Certificate was missing"
- run_test "DTLS client auth: none, client has no cert" \
- "$P_SRV dtls=1 auth_mode=none" \
- "$P_CLI dtls=1 crt_file=none key_file=none debug_level=2" \
- 0 \
- -c "skip write certificate$" \
- -s "! Certificate verification was skipped"
- run_test "DTLS wrong PSK: badmac alert" \
- "$P_SRV dtls=1 psk=abc123 force_ciphersuite=TLS-PSK-WITH-AES-128-GCM-SHA256" \
- "$P_CLI dtls=1 psk=abc124" \
- 1 \
- -s "SSL - Verification of the message MAC failed" \
- -c "SSL - A fatal alert message was received from our peer"
- # Tests for receiving fragmented handshake messages with DTLS
- requires_gnutls
- run_test "DTLS reassembly: no fragmentation (gnutls server)" \
- "$G_SRV -u --mtu 2048 -a" \
- "$P_CLI dtls=1 debug_level=2" \
- 0 \
- -C "found fragmented DTLS handshake message" \
- -C "error"
- requires_gnutls
- run_test "DTLS reassembly: some fragmentation (gnutls server)" \
- "$G_SRV -u --mtu 512" \
- "$P_CLI dtls=1 debug_level=2" \
- 0 \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- requires_gnutls
- run_test "DTLS reassembly: more fragmentation (gnutls server)" \
- "$G_SRV -u --mtu 128" \
- "$P_CLI dtls=1 debug_level=2" \
- 0 \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- requires_gnutls
- run_test "DTLS reassembly: more fragmentation, nbio (gnutls server)" \
- "$G_SRV -u --mtu 128" \
- "$P_CLI dtls=1 nbio=2 debug_level=2" \
- 0 \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- requires_gnutls
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "DTLS reassembly: fragmentation, renego (gnutls server)" \
- "$G_SRV -u --mtu 256" \
- "$P_CLI debug_level=3 dtls=1 renegotiation=1 renegotiate=1" \
- 0 \
- -c "found fragmented DTLS handshake message" \
- -c "client hello, adding renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -C "mbedtls_ssl_handshake returned" \
- -C "error" \
- -s "Extra-header:"
- requires_gnutls
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "DTLS reassembly: fragmentation, nbio, renego (gnutls server)" \
- "$G_SRV -u --mtu 256" \
- "$P_CLI debug_level=3 nbio=2 dtls=1 renegotiation=1 renegotiate=1" \
- 0 \
- -c "found fragmented DTLS handshake message" \
- -c "client hello, adding renegotiation extension" \
- -c "found renegotiation extension" \
- -c "=> renegotiate" \
- -C "mbedtls_ssl_handshake returned" \
- -C "error" \
- -s "Extra-header:"
- run_test "DTLS reassembly: no fragmentation (openssl server)" \
- "$O_SRV -dtls1 -mtu 2048" \
- "$P_CLI dtls=1 debug_level=2" \
- 0 \
- -C "found fragmented DTLS handshake message" \
- -C "error"
- run_test "DTLS reassembly: some fragmentation (openssl server)" \
- "$O_SRV -dtls1 -mtu 768" \
- "$P_CLI dtls=1 debug_level=2" \
- 0 \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- run_test "DTLS reassembly: more fragmentation (openssl server)" \
- "$O_SRV -dtls1 -mtu 256" \
- "$P_CLI dtls=1 debug_level=2" \
- 0 \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- run_test "DTLS reassembly: fragmentation, nbio (openssl server)" \
- "$O_SRV -dtls1 -mtu 256" \
- "$P_CLI dtls=1 nbio=2 debug_level=2" \
- 0 \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # Tests for sending fragmented handshake messages with DTLS
- #
- # Use client auth when we need the client to send large messages,
- # and use large cert chains on both sides too (the long chains we have all use
- # both RSA and ECDSA, but ideally we should have long chains with either).
- # Sizes reached (UDP payload):
- # - 2037B for server certificate
- # - 1542B for client certificate
- # - 1013B for newsessionticket
- # - all others below 512B
- # All those tests assume MAX_CONTENT_LEN is at least 2048
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "DTLS fragmenting: none (for reference)" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- max_frag_len=4096" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=2500-60000 \
- max_frag_len=4096" \
- 0 \
- -S "found fragmented DTLS handshake message" \
- -C "found fragmented DTLS handshake message" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "DTLS fragmenting: server only (max_frag_len)" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- max_frag_len=1024" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=2500-60000 \
- max_frag_len=2048" \
- 0 \
- -S "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # With the MFL extension, the server has no way of forcing
- # the client to not exceed a certain MTU; hence, the following
- # test can't be replicated with an MTU proxy such as the one
- # `client-initiated, server only (max_frag_len)` below.
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "DTLS fragmenting: server only (more) (max_frag_len)" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- max_frag_len=512" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=2500-60000 \
- max_frag_len=4096" \
- 0 \
- -S "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "DTLS fragmenting: client-initiated, server only (max_frag_len)" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=none \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- max_frag_len=2048" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=2500-60000 \
- max_frag_len=1024" \
- 0 \
- -S "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # While not required by the standard defining the MFL extension
- # (according to which it only applies to records, not to datagrams),
- # Mbed TLS will never send datagrams larger than MFL + { Max record expansion },
- # as otherwise there wouldn't be any means to communicate MTU restrictions
- # to the peer.
- # The next test checks that no datagrams significantly larger than the
- # negotiated MFL are sent.
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "DTLS fragmenting: client-initiated, server only (max_frag_len), proxy MTU" \
- -p "$P_PXY mtu=1110" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=none \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- max_frag_len=2048" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=2500-60000 \
- max_frag_len=1024" \
- 0 \
- -S "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "DTLS fragmenting: client-initiated, both (max_frag_len)" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- max_frag_len=2048" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=2500-60000 \
- max_frag_len=1024" \
- 0 \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # While not required by the standard defining the MFL extension
- # (according to which it only applies to records, not to datagrams),
- # Mbed TLS will never send datagrams larger than MFL + { Max record expansion },
- # as otherwise there wouldn't be any means to communicate MTU restrictions
- # to the peer.
- # The next test checks that no datagrams significantly larger than the
- # negotiated MFL are sent.
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_test "DTLS fragmenting: client-initiated, both (max_frag_len), proxy MTU" \
- -p "$P_PXY mtu=1110" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- max_frag_len=2048" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=2500-60000 \
- max_frag_len=1024" \
- 0 \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- run_test "DTLS fragmenting: none (for reference) (MTU)" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- mtu=4096" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=2500-60000 \
- mtu=4096" \
- 0 \
- -S "found fragmented DTLS handshake message" \
- -C "found fragmented DTLS handshake message" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- run_test "DTLS fragmenting: client (MTU)" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=3500-60000 \
- mtu=4096" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=3500-60000 \
- mtu=1024" \
- 0 \
- -s "found fragmented DTLS handshake message" \
- -C "found fragmented DTLS handshake message" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- run_test "DTLS fragmenting: server (MTU)" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- mtu=512" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=2500-60000 \
- mtu=2048" \
- 0 \
- -S "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- run_test "DTLS fragmenting: both (MTU=1024)" \
- -p "$P_PXY mtu=1024" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- mtu=1024" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=2500-60000 \
- mtu=1024" \
- 0 \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # Forcing ciphersuite for this test to fit the MTU of 512 with full config.
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- run_test "DTLS fragmenting: both (MTU=512)" \
- -p "$P_PXY mtu=512" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=2500-60000 \
- mtu=512" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- hs_timeout=2500-60000 \
- mtu=512" \
- 0 \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # Test for automatic MTU reduction on repeated resend.
- # Forcing ciphersuite for this test to fit the MTU of 508 with full config.
- # The ratio of max/min timeout should ideally equal 4 to accept two
- # retransmissions, but in some cases (like both the server and client using
- # fragmentation and auto-reduction) an extra retransmission might occur,
- # hence the ratio of 8.
- not_with_valgrind
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- run_test "DTLS fragmenting: proxy MTU: auto-reduction (not valgrind)" \
- -p "$P_PXY mtu=508" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=400-3200" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- hs_timeout=400-3200" \
- 0 \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # Forcing ciphersuite for this test to fit the MTU of 508 with full config.
- only_with_valgrind
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- run_test "DTLS fragmenting: proxy MTU: auto-reduction (with valgrind)" \
- -p "$P_PXY mtu=508" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=250-10000" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- hs_timeout=250-10000" \
- 0 \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # the proxy shouldn't drop or mess up anything, so we shouldn't need to resend
- # OTOH the client might resend if the server is to slow to reset after sending
- # a HelloVerifyRequest, so only check for no retransmission server-side
- not_with_valgrind # spurious autoreduction due to timeout
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- run_test "DTLS fragmenting: proxy MTU, simple handshake (MTU=1024)" \
- -p "$P_PXY mtu=1024" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=10000-60000 \
- mtu=1024" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=10000-60000 \
- mtu=1024" \
- 0 \
- -S "autoreduction" \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # Forcing ciphersuite for this test to fit the MTU of 512 with full config.
- # the proxy shouldn't drop or mess up anything, so we shouldn't need to resend
- # OTOH the client might resend if the server is to slow to reset after sending
- # a HelloVerifyRequest, so only check for no retransmission server-side
- not_with_valgrind # spurious autoreduction due to timeout
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- run_test "DTLS fragmenting: proxy MTU, simple handshake (MTU=512)" \
- -p "$P_PXY mtu=512" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=10000-60000 \
- mtu=512" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- hs_timeout=10000-60000 \
- mtu=512" \
- 0 \
- -S "autoreduction" \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- not_with_valgrind # spurious autoreduction due to timeout
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- run_test "DTLS fragmenting: proxy MTU, simple handshake, nbio (MTU=1024)" \
- -p "$P_PXY mtu=1024" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=10000-60000 \
- mtu=1024 nbio=2" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=10000-60000 \
- mtu=1024 nbio=2" \
- 0 \
- -S "autoreduction" \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # Forcing ciphersuite for this test to fit the MTU of 512 with full config.
- not_with_valgrind # spurious autoreduction due to timeout
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- run_test "DTLS fragmenting: proxy MTU, simple handshake, nbio (MTU=512)" \
- -p "$P_PXY mtu=512" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=10000-60000 \
- mtu=512 nbio=2" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- hs_timeout=10000-60000 \
- mtu=512 nbio=2" \
- 0 \
- -S "autoreduction" \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # Forcing ciphersuite for this test to fit the MTU of 1450 with full config.
- # This ensures things still work after session_reset().
- # It also exercises the "resumed handshake" flow.
- # Since we don't support reading fragmented ClientHello yet,
- # up the MTU to 1450 (larger than ClientHello with session ticket,
- # but still smaller than client's Certificate to ensure fragmentation).
- # An autoreduction on the client-side might happen if the server is
- # slow to reset, therefore omitting '-C "autoreduction"' below.
- # reco_delay avoids races where the client reconnects before the server has
- # resumed listening, which would result in a spurious autoreduction.
- not_with_valgrind # spurious autoreduction due to timeout
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- run_test "DTLS fragmenting: proxy MTU, resumed handshake" \
- -p "$P_PXY mtu=1450" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=10000-60000 \
- mtu=1450" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=10000-60000 \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- mtu=1450 reconnect=1 skip_close_notify=1 reco_delay=1" \
- 0 \
- -S "autoreduction" \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # An autoreduction on the client-side might happen if the server is
- # slow to reset, therefore omitting '-C "autoreduction"' below.
- not_with_valgrind # spurious autoreduction due to timeout
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- requires_config_enabled MBEDTLS_CHACHAPOLY_C
- run_test "DTLS fragmenting: proxy MTU, ChachaPoly renego" \
- -p "$P_PXY mtu=512" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- exchanges=2 renegotiation=1 \
- hs_timeout=10000-60000 \
- mtu=512" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- exchanges=2 renegotiation=1 renegotiate=1 \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- hs_timeout=10000-60000 \
- mtu=512" \
- 0 \
- -S "autoreduction" \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # An autoreduction on the client-side might happen if the server is
- # slow to reset, therefore omitting '-C "autoreduction"' below.
- not_with_valgrind # spurious autoreduction due to timeout
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- run_test "DTLS fragmenting: proxy MTU, AES-GCM renego" \
- -p "$P_PXY mtu=512" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- exchanges=2 renegotiation=1 \
- hs_timeout=10000-60000 \
- mtu=512" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- exchanges=2 renegotiation=1 renegotiate=1 \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- hs_timeout=10000-60000 \
- mtu=512" \
- 0 \
- -S "autoreduction" \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # An autoreduction on the client-side might happen if the server is
- # slow to reset, therefore omitting '-C "autoreduction"' below.
- not_with_valgrind # spurious autoreduction due to timeout
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_CCM_C
- run_test "DTLS fragmenting: proxy MTU, AES-CCM renego" \
- -p "$P_PXY mtu=1024" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- exchanges=2 renegotiation=1 \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8 \
- hs_timeout=10000-60000 \
- mtu=1024" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- exchanges=2 renegotiation=1 renegotiate=1 \
- hs_timeout=10000-60000 \
- mtu=1024" \
- 0 \
- -S "autoreduction" \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # An autoreduction on the client-side might happen if the server is
- # slow to reset, therefore omitting '-C "autoreduction"' below.
- not_with_valgrind # spurious autoreduction due to timeout
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_CIPHER_MODE_CBC
- requires_config_enabled MBEDTLS_SSL_ENCRYPT_THEN_MAC
- run_test "DTLS fragmenting: proxy MTU, AES-CBC EtM renego" \
- -p "$P_PXY mtu=1024" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- exchanges=2 renegotiation=1 \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256 \
- hs_timeout=10000-60000 \
- mtu=1024" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- exchanges=2 renegotiation=1 renegotiate=1 \
- hs_timeout=10000-60000 \
- mtu=1024" \
- 0 \
- -S "autoreduction" \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # An autoreduction on the client-side might happen if the server is
- # slow to reset, therefore omitting '-C "autoreduction"' below.
- not_with_valgrind # spurious autoreduction due to timeout
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SHA256_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_CIPHER_MODE_CBC
- run_test "DTLS fragmenting: proxy MTU, AES-CBC non-EtM renego" \
- -p "$P_PXY mtu=1024" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- exchanges=2 renegotiation=1 \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256 etm=0 \
- hs_timeout=10000-60000 \
- mtu=1024" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- exchanges=2 renegotiation=1 renegotiate=1 \
- hs_timeout=10000-60000 \
- mtu=1024" \
- 0 \
- -S "autoreduction" \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # Forcing ciphersuite for this test to fit the MTU of 512 with full config.
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- client_needs_more_time 2
- run_test "DTLS fragmenting: proxy MTU + 3d" \
- -p "$P_PXY mtu=512 drop=8 delay=8 duplicate=8" \
- "$P_SRV dgram_packing=0 dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=250-10000 mtu=512" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- hs_timeout=250-10000 mtu=512" \
- 0 \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # Forcing ciphersuite for this test to fit the MTU of 512 with full config.
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- client_needs_more_time 2
- run_test "DTLS fragmenting: proxy MTU + 3d, nbio" \
- -p "$P_PXY mtu=512 drop=8 delay=8 duplicate=8" \
- "$P_SRV dtls=1 debug_level=2 auth_mode=required \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=250-10000 mtu=512 nbio=2" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \
- hs_timeout=250-10000 mtu=512 nbio=2" \
- 0 \
- -s "found fragmented DTLS handshake message" \
- -c "found fragmented DTLS handshake message" \
- -C "error"
- # interop tests for DTLS fragmentating with reliable connection
- #
- # here and below we just want to test that the we fragment in a way that
- # pleases other implementations, so we don't need the peer to fragment
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
- requires_gnutls
- run_test "DTLS fragmenting: gnutls server, DTLS 1.2" \
- "$G_SRV -u" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- mtu=512 force_version=dtls1_2" \
- 0 \
- -c "fragmenting handshake message" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- requires_gnutls
- run_test "DTLS fragmenting: gnutls server, DTLS 1.0" \
- "$G_SRV -u" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- mtu=512 force_version=dtls1" \
- 0 \
- -c "fragmenting handshake message" \
- -C "error"
- # We use --insecure for the GnuTLS client because it expects
- # the hostname / IP it connects to to be the name used in the
- # certificate obtained from the server. Here, however, it
- # connects to 127.0.0.1 while our test certificates use 'localhost'
- # as the server name in the certificate. This will make the
- # certifiate validation fail, but passing --insecure makes
- # GnuTLS continue the connection nonetheless.
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
- requires_gnutls
- requires_not_i686
- run_test "DTLS fragmenting: gnutls client, DTLS 1.2" \
- "$P_SRV dtls=1 debug_level=2 \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- mtu=512 force_version=dtls1_2" \
- "$G_CLI -u --insecure 127.0.0.1" \
- 0 \
- -s "fragmenting handshake message"
- # See previous test for the reason to use --insecure
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- requires_gnutls
- requires_not_i686
- run_test "DTLS fragmenting: gnutls client, DTLS 1.0" \
- "$P_SRV dtls=1 debug_level=2 \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- mtu=512 force_version=dtls1" \
- "$G_CLI -u --insecure 127.0.0.1" \
- 0 \
- -s "fragmenting handshake message"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
- run_test "DTLS fragmenting: openssl server, DTLS 1.2" \
- "$O_SRV -dtls1_2 -verify 10" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- mtu=512 force_version=dtls1_2" \
- 0 \
- -c "fragmenting handshake message" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- run_test "DTLS fragmenting: openssl server, DTLS 1.0" \
- "$O_SRV -dtls1 -verify 10" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- mtu=512 force_version=dtls1" \
- 0 \
- -c "fragmenting handshake message" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
- run_test "DTLS fragmenting: openssl client, DTLS 1.2" \
- "$P_SRV dtls=1 debug_level=2 \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- mtu=512 force_version=dtls1_2" \
- "$O_CLI -dtls1_2" \
- 0 \
- -s "fragmenting handshake message"
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- run_test "DTLS fragmenting: openssl client, DTLS 1.0" \
- "$P_SRV dtls=1 debug_level=2 \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- mtu=512 force_version=dtls1" \
- "$O_CLI -dtls1" \
- 0 \
- -s "fragmenting handshake message"
- # interop tests for DTLS fragmentating with unreliable connection
- #
- # again we just want to test that the we fragment in a way that
- # pleases other implementations, so we don't need the peer to fragment
- requires_gnutls_next
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
- client_needs_more_time 4
- run_test "DTLS fragmenting: 3d, gnutls server, DTLS 1.2" \
- -p "$P_PXY drop=8 delay=8 duplicate=8" \
- "$G_NEXT_SRV -u" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=250-60000 mtu=512 force_version=dtls1_2" \
- 0 \
- -c "fragmenting handshake message" \
- -C "error"
- requires_gnutls_next
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- client_needs_more_time 4
- run_test "DTLS fragmenting: 3d, gnutls server, DTLS 1.0" \
- -p "$P_PXY drop=8 delay=8 duplicate=8" \
- "$G_NEXT_SRV -u" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=250-60000 mtu=512 force_version=dtls1" \
- 0 \
- -c "fragmenting handshake message" \
- -C "error"
- requires_gnutls_next
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
- client_needs_more_time 4
- run_test "DTLS fragmenting: 3d, gnutls client, DTLS 1.2" \
- -p "$P_PXY drop=8 delay=8 duplicate=8" \
- "$P_SRV dtls=1 debug_level=2 \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=250-60000 mtu=512 force_version=dtls1_2" \
- "$G_NEXT_CLI -u --insecure 127.0.0.1" \
- 0 \
- -s "fragmenting handshake message"
- requires_gnutls_next
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- client_needs_more_time 4
- run_test "DTLS fragmenting: 3d, gnutls client, DTLS 1.0" \
- -p "$P_PXY drop=8 delay=8 duplicate=8" \
- "$P_SRV dtls=1 debug_level=2 \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=250-60000 mtu=512 force_version=dtls1" \
- "$G_NEXT_CLI -u --insecure 127.0.0.1" \
- 0 \
- -s "fragmenting handshake message"
- ## Interop test with OpenSSL might trigger a bug in recent versions (including
- ## all versions installed on the CI machines), reported here:
- ## Bug report: https://github.com/openssl/openssl/issues/6902
- ## They should be re-enabled once a fixed version of OpenSSL is available
- ## (this should happen in some 1.1.1_ release according to the ticket).
- skip_next_test
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
- client_needs_more_time 4
- run_test "DTLS fragmenting: 3d, openssl server, DTLS 1.2" \
- -p "$P_PXY drop=8 delay=8 duplicate=8" \
- "$O_SRV -dtls1_2 -verify 10" \
- "$P_CLI dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=250-60000 mtu=512 force_version=dtls1_2" \
- 0 \
- -c "fragmenting handshake message" \
- -C "error"
- skip_next_test
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- client_needs_more_time 4
- run_test "DTLS fragmenting: 3d, openssl server, DTLS 1.0" \
- -p "$P_PXY drop=8 delay=8 duplicate=8" \
- "$O_SRV -dtls1 -verify 10" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- crt_file=data_files/server8_int-ca2.crt \
- key_file=data_files/server8.key \
- hs_timeout=250-60000 mtu=512 force_version=dtls1" \
- 0 \
- -c "fragmenting handshake message" \
- -C "error"
- skip_next_test
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
- client_needs_more_time 4
- run_test "DTLS fragmenting: 3d, openssl client, DTLS 1.2" \
- -p "$P_PXY drop=8 delay=8 duplicate=8" \
- "$P_SRV dtls=1 debug_level=2 \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=250-60000 mtu=512 force_version=dtls1_2" \
- "$O_CLI -dtls1_2" \
- 0 \
- -s "fragmenting handshake message"
- # -nbio is added to prevent s_client from blocking in case of duplicated
- # messages at the end of the handshake
- skip_next_test
- requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
- requires_config_enabled MBEDTLS_RSA_C
- requires_config_enabled MBEDTLS_ECDSA_C
- requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1
- client_needs_more_time 4
- run_test "DTLS fragmenting: 3d, openssl client, DTLS 1.0" \
- -p "$P_PXY drop=8 delay=8 duplicate=8" \
- "$P_SRV dgram_packing=0 dtls=1 debug_level=2 \
- crt_file=data_files/server7_int-ca.crt \
- key_file=data_files/server7.key \
- hs_timeout=250-60000 mtu=512 force_version=dtls1" \
- "$O_CLI -nbio -dtls1" \
- 0 \
- -s "fragmenting handshake message"
- # Tests for DTLS-SRTP (RFC 5764)
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP all profiles supported" \
- "$P_SRV dtls=1 use_srtp=1 debug_level=3" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server supports all profiles. Client supports one profile." \
- "$P_SRV dtls=1 use_srtp=1 debug_level=3" \
- "$P_CLI dtls=1 use_srtp=1 srtp_force_profile=5 debug_level=3" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile: MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80" \
- -s "selected srtp profile: MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile: MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server supports one profile. Client supports all profiles." \
- "$P_SRV dtls=1 use_srtp=1 srtp_force_profile=6 debug_level=3" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile: MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile: MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server and Client support only one matching profile." \
- "$P_SRV dtls=1 use_srtp=1 srtp_force_profile=2 debug_level=3" \
- "$P_CLI dtls=1 use_srtp=1 srtp_force_profile=2 debug_level=3" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" \
- -s "selected srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server and Client support only one different profile." \
- "$P_SRV dtls=1 use_srtp=1 srtp_force_profile=2 debug_level=3" \
- "$P_CLI dtls=1 use_srtp=1 srtp_force_profile=6 debug_level=3" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile: MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32" \
- -S "selected srtp profile" \
- -S "server hello, adding use_srtp extension" \
- -S "DTLS-SRTP key material is"\
- -c "client hello, adding use_srtp extension" \
- -C "found use_srtp extension" \
- -C "found srtp profile" \
- -C "selected srtp profile" \
- -C "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server doesn't support use_srtp extension." \
- "$P_SRV dtls=1 debug_level=3" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -s "found use_srtp extension" \
- -S "server hello, adding use_srtp extension" \
- -S "DTLS-SRTP key material is"\
- -c "client hello, adding use_srtp extension" \
- -C "found use_srtp extension" \
- -C "found srtp profile" \
- -C "selected srtp profile" \
- -C "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP all profiles supported. mki used" \
- "$P_SRV dtls=1 use_srtp=1 support_mki=1 debug_level=3" \
- "$P_CLI dtls=1 use_srtp=1 mki=542310ab34290481 debug_level=3" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "dumping 'using mki' (8 bytes)" \
- -s "DTLS-SRTP key material is"\
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile" \
- -c "selected srtp profile" \
- -c "dumping 'sending mki' (8 bytes)" \
- -c "dumping 'received mki' (8 bytes)" \
- -c "DTLS-SRTP key material is"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -g "find_in_both '^ *DTLS-SRTP mki value: [0-9A-F]*$'"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP all profiles supported. server doesn't support mki." \
- "$P_SRV dtls=1 use_srtp=1 debug_level=3" \
- "$P_CLI dtls=1 use_srtp=1 mki=542310ab34290481 debug_level=3" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -s "DTLS-SRTP no mki value negotiated"\
- -S "dumping 'using mki' (8 bytes)" \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -c "DTLS-SRTP no mki value negotiated"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -c "dumping 'sending mki' (8 bytes)" \
- -C "dumping 'received mki' (8 bytes)" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP all profiles supported. openssl client." \
- "$P_SRV dtls=1 use_srtp=1 debug_level=3" \
- "$O_CLI -dtls1 -use_srtp SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -c "SRTP Extension negotiated, profile=SRTP_AES128_CM_SHA1_80"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server supports all profiles. Client supports all profiles, in different order. openssl client." \
- "$P_SRV dtls=1 use_srtp=1 debug_level=3" \
- "$O_CLI -dtls1 -use_srtp SRTP_AES128_CM_SHA1_32:SRTP_AES128_CM_SHA1_80 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -c "SRTP Extension negotiated, profile=SRTP_AES128_CM_SHA1_32"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server supports all profiles. Client supports one profile. openssl client." \
- "$P_SRV dtls=1 use_srtp=1 debug_level=3" \
- "$O_CLI -dtls1 -use_srtp SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -c "SRTP Extension negotiated, profile=SRTP_AES128_CM_SHA1_32"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server supports one profile. Client supports all profiles. openssl client." \
- "$P_SRV dtls=1 use_srtp=1 srtp_force_profile=2 debug_level=3" \
- "$O_CLI -dtls1 -use_srtp SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -c "SRTP Extension negotiated, profile=SRTP_AES128_CM_SHA1_32"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server and Client support only one matching profile. openssl client." \
- "$P_SRV dtls=1 use_srtp=1 srtp_force_profile=2 debug_level=3" \
- "$O_CLI -dtls1 -use_srtp SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
- -c "SRTP Extension negotiated, profile=SRTP_AES128_CM_SHA1_32"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server and Client support only one different profile. openssl client." \
- "$P_SRV dtls=1 use_srtp=1 srtp_force_profile=1 debug_level=3" \
- "$O_CLI -dtls1 -use_srtp SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -S "selected srtp profile" \
- -S "server hello, adding use_srtp extension" \
- -S "DTLS-SRTP key material is"\
- -C "SRTP Extension negotiated, profile"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server doesn't support use_srtp extension. openssl client" \
- "$P_SRV dtls=1 debug_level=3" \
- "$O_CLI -dtls1 -use_srtp SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- 0 \
- -s "found use_srtp extension" \
- -S "server hello, adding use_srtp extension" \
- -S "DTLS-SRTP key material is"\
- -C "SRTP Extension negotiated, profile"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP all profiles supported. openssl server" \
- "$O_SRV -dtls1 -verify 0 -use_srtp SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile" \
- -c "selected srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80" \
- -c "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server supports all profiles. Client supports all profiles, in different order. openssl server." \
- "$O_SRV -dtls1 -verify 0 -use_srtp SRTP_AES128_CM_SHA1_32:SRTP_AES128_CM_SHA1_80 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server supports all profiles. Client supports one profile. openssl server." \
- "$O_SRV -dtls1 -verify 0 -use_srtp SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- "$P_CLI dtls=1 use_srtp=1 srtp_force_profile=2 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server supports one profile. Client supports all profiles. openssl server." \
- "$O_SRV -dtls1 -verify 0 -use_srtp SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server and Client support only one matching profile. openssl server." \
- "$O_SRV -dtls1 -verify 0 -use_srtp SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- "$P_CLI dtls=1 use_srtp=1 srtp_force_profile=2 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server and Client support only one different profile. openssl server." \
- "$O_SRV -dtls1 -verify 0 -use_srtp SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- "$P_CLI dtls=1 use_srtp=1 srtp_force_profile=6 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -C "found use_srtp extension" \
- -C "found srtp profile" \
- -C "selected srtp profile" \
- -C "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP server doesn't support use_srtp extension. openssl server" \
- "$O_SRV -dtls1" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -C "found use_srtp extension" \
- -C "found srtp profile" \
- -C "selected srtp profile" \
- -C "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- run_test "DTLS-SRTP all profiles supported. server doesn't support mki. openssl server." \
- "$O_SRV -dtls1 -verify 0 -use_srtp SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32 -keymatexport 'EXTRACTOR-dtls_srtp' -keymatexportlen 60" \
- "$P_CLI dtls=1 use_srtp=1 mki=542310ab34290481 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -c "DTLS-SRTP no mki value negotiated"\
- -c "dumping 'sending mki' (8 bytes)" \
- -C "dumping 'received mki' (8 bytes)" \
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP all profiles supported. gnutls client." \
- "$P_SRV dtls=1 use_srtp=1 debug_level=3" \
- "$G_CLI -u --srtp-profiles=SRTP_AES128_CM_HMAC_SHA1_80:SRTP_AES128_CM_HMAC_SHA1_32:SRTP_NULL_HMAC_SHA1_80:SRTP_NULL_SHA1_32 --insecure 127.0.0.1" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -c "SRTP profile: SRTP_AES128_CM_HMAC_SHA1_80"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server supports all profiles. Client supports all profiles, in different order. gnutls client." \
- "$P_SRV dtls=1 use_srtp=1 debug_level=3" \
- "$G_CLI -u --srtp-profiles=SRTP_NULL_HMAC_SHA1_80:SRTP_AES128_CM_HMAC_SHA1_80:SRTP_NULL_SHA1_32:SRTP_AES128_CM_HMAC_SHA1_32 --insecure 127.0.0.1" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -c "SRTP profile: SRTP_NULL_HMAC_SHA1_80"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server supports all profiles. Client supports one profile. gnutls client." \
- "$P_SRV dtls=1 use_srtp=1 debug_level=3" \
- "$G_CLI -u --srtp-profiles=SRTP_AES128_CM_HMAC_SHA1_32 --insecure 127.0.0.1" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" \
- -s "selected srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -c "SRTP profile: SRTP_AES128_CM_HMAC_SHA1_32"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server supports one profile. Client supports all profiles. gnutls client." \
- "$P_SRV dtls=1 use_srtp=1 srtp_force_profile=6 debug_level=3" \
- "$G_CLI -u --srtp-profiles=SRTP_AES128_CM_HMAC_SHA1_80:SRTP_AES128_CM_HMAC_SHA1_32:SRTP_NULL_HMAC_SHA1_80:SRTP_NULL_SHA1_32 --insecure 127.0.0.1" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile: MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -c "SRTP profile: SRTP_NULL_SHA1_32"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server and Client support only one matching profile. gnutls client." \
- "$P_SRV dtls=1 use_srtp=1 srtp_force_profile=2 debug_level=3" \
- "$G_CLI -u --srtp-profiles=SRTP_AES128_CM_HMAC_SHA1_32 --insecure 127.0.0.1" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -s "selected srtp profile" \
- -s "server hello, adding use_srtp extension" \
- -s "DTLS-SRTP key material is"\
- -c "SRTP profile: SRTP_AES128_CM_HMAC_SHA1_32"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server and Client support only one different profile. gnutls client." \
- "$P_SRV dtls=1 use_srtp=1 srtp_force_profile=1 debug_level=3" \
- "$G_CLI -u --srtp-profiles=SRTP_AES128_CM_HMAC_SHA1_32 --insecure 127.0.0.1" \
- 0 \
- -s "found use_srtp extension" \
- -s "found srtp profile" \
- -S "selected srtp profile" \
- -S "server hello, adding use_srtp extension" \
- -S "DTLS-SRTP key material is"\
- -C "SRTP profile:"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server doesn't support use_srtp extension. gnutls client" \
- "$P_SRV dtls=1 debug_level=3" \
- "$G_CLI -u --srtp-profiles=SRTP_AES128_CM_HMAC_SHA1_80:SRTP_AES128_CM_HMAC_SHA1_32:SRTP_NULL_HMAC_SHA1_80:SRTP_NULL_SHA1_32 --insecure 127.0.0.1" \
- 0 \
- -s "found use_srtp extension" \
- -S "server hello, adding use_srtp extension" \
- -S "DTLS-SRTP key material is"\
- -C "SRTP profile:"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP all profiles supported. gnutls server" \
- "$G_SRV -u --srtp-profiles=SRTP_AES128_CM_HMAC_SHA1_80:SRTP_AES128_CM_HMAC_SHA1_32:SRTP_NULL_HMAC_SHA1_80:SRTP_NULL_SHA1_32" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile" \
- -c "selected srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80" \
- -c "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server supports all profiles. Client supports all profiles, in different order. gnutls server." \
- "$G_SRV -u --srtp-profiles=SRTP_NULL_SHA1_32:SRTP_AES128_CM_HMAC_SHA1_32:SRTP_AES128_CM_HMAC_SHA1_80:SRTP_NULL_HMAC_SHA1_80:SRTP_NULL_SHA1_32" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile" \
- -c "selected srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80" \
- -c "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server supports all profiles. Client supports one profile. gnutls server." \
- "$G_SRV -u --srtp-profiles=SRTP_NULL_SHA1_32:SRTP_AES128_CM_HMAC_SHA1_32:SRTP_AES128_CM_HMAC_SHA1_80:SRTP_NULL_HMAC_SHA1_80:SRTP_NULL_SHA1_32" \
- "$P_CLI dtls=1 use_srtp=1 srtp_force_profile=2 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server supports one profile. Client supports all profiles. gnutls server." \
- "$G_SRV -u --srtp-profiles=SRTP_NULL_HMAC_SHA1_80" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile: MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server and Client support only one matching profile. gnutls server." \
- "$G_SRV -u --srtp-profiles=SRTP_AES128_CM_HMAC_SHA1_32" \
- "$P_CLI dtls=1 use_srtp=1 srtp_force_profile=2 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile: MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server and Client support only one different profile. gnutls server." \
- "$G_SRV -u --srtp-profiles=SRTP_AES128_CM_HMAC_SHA1_32" \
- "$P_CLI dtls=1 use_srtp=1 srtp_force_profile=6 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -C "found use_srtp extension" \
- -C "found srtp profile" \
- -C "selected srtp profile" \
- -C "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP server doesn't support use_srtp extension. gnutls server" \
- "$G_SRV -u" \
- "$P_CLI dtls=1 use_srtp=1 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -C "found use_srtp extension" \
- -C "found srtp profile" \
- -C "selected srtp profile" \
- -C "DTLS-SRTP key material is"\
- -C "error"
- requires_config_enabled MBEDTLS_SSL_DTLS_SRTP
- requires_gnutls
- run_test "DTLS-SRTP all profiles supported. mki used. gnutls server." \
- "$G_SRV -u --srtp-profiles=SRTP_AES128_CM_HMAC_SHA1_80:SRTP_AES128_CM_HMAC_SHA1_32:SRTP_NULL_HMAC_SHA1_80:SRTP_NULL_SHA1_32" \
- "$P_CLI dtls=1 use_srtp=1 mki=542310ab34290481 debug_level=3" \
- 0 \
- -c "client hello, adding use_srtp extension" \
- -c "found use_srtp extension" \
- -c "found srtp profile" \
- -c "selected srtp profile" \
- -c "DTLS-SRTP key material is"\
- -c "DTLS-SRTP mki value:"\
- -c "dumping 'sending mki' (8 bytes)" \
- -c "dumping 'received mki' (8 bytes)" \
- -C "error"
- # Tests for specific things with "unreliable" UDP connection
- not_with_valgrind # spurious resend due to timeout
- run_test "DTLS proxy: reference" \
- -p "$P_PXY" \
- "$P_SRV dtls=1 debug_level=2 hs_timeout=10000-20000" \
- "$P_CLI dtls=1 debug_level=2 hs_timeout=10000-20000" \
- 0 \
- -C "replayed record" \
- -S "replayed record" \
- -C "Buffer record from epoch" \
- -S "Buffer record from epoch" \
- -C "ssl_buffer_message" \
- -S "ssl_buffer_message" \
- -C "discarding invalid record" \
- -S "discarding invalid record" \
- -S "resend" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- not_with_valgrind # spurious resend due to timeout
- run_test "DTLS proxy: duplicate every packet" \
- -p "$P_PXY duplicate=1" \
- "$P_SRV dtls=1 dgram_packing=0 debug_level=2 hs_timeout=10000-20000" \
- "$P_CLI dtls=1 dgram_packing=0 debug_level=2 hs_timeout=10000-20000" \
- 0 \
- -c "replayed record" \
- -s "replayed record" \
- -c "record from another epoch" \
- -s "record from another epoch" \
- -S "resend" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- run_test "DTLS proxy: duplicate every packet, server anti-replay off" \
- -p "$P_PXY duplicate=1" \
- "$P_SRV dtls=1 dgram_packing=0 debug_level=2 anti_replay=0" \
- "$P_CLI dtls=1 dgram_packing=0 debug_level=2" \
- 0 \
- -c "replayed record" \
- -S "replayed record" \
- -c "record from another epoch" \
- -s "record from another epoch" \
- -c "resend" \
- -s "resend" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- run_test "DTLS proxy: multiple records in same datagram" \
- -p "$P_PXY pack=50" \
- "$P_SRV dtls=1 dgram_packing=0 debug_level=2" \
- "$P_CLI dtls=1 dgram_packing=0 debug_level=2" \
- 0 \
- -c "next record in same datagram" \
- -s "next record in same datagram"
- run_test "DTLS proxy: multiple records in same datagram, duplicate every packet" \
- -p "$P_PXY pack=50 duplicate=1" \
- "$P_SRV dtls=1 dgram_packing=0 debug_level=2" \
- "$P_CLI dtls=1 dgram_packing=0 debug_level=2" \
- 0 \
- -c "next record in same datagram" \
- -s "next record in same datagram"
- run_test "DTLS proxy: inject invalid AD record, default badmac_limit" \
- -p "$P_PXY bad_ad=1" \
- "$P_SRV dtls=1 dgram_packing=0 debug_level=1" \
- "$P_CLI dtls=1 dgram_packing=0 debug_level=1 read_timeout=100" \
- 0 \
- -c "discarding invalid record (mac)" \
- -s "discarding invalid record (mac)" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK" \
- -S "too many records with bad MAC" \
- -S "Verification of the message MAC failed"
- run_test "DTLS proxy: inject invalid AD record, badmac_limit 1" \
- -p "$P_PXY bad_ad=1" \
- "$P_SRV dtls=1 dgram_packing=0 debug_level=1 badmac_limit=1" \
- "$P_CLI dtls=1 dgram_packing=0 debug_level=1 read_timeout=100" \
- 1 \
- -C "discarding invalid record (mac)" \
- -S "discarding invalid record (mac)" \
- -S "Extra-header:" \
- -C "HTTP/1.0 200 OK" \
- -s "too many records with bad MAC" \
- -s "Verification of the message MAC failed"
- run_test "DTLS proxy: inject invalid AD record, badmac_limit 2" \
- -p "$P_PXY bad_ad=1" \
- "$P_SRV dtls=1 dgram_packing=0 debug_level=1 badmac_limit=2" \
- "$P_CLI dtls=1 dgram_packing=0 debug_level=1 read_timeout=100" \
- 0 \
- -c "discarding invalid record (mac)" \
- -s "discarding invalid record (mac)" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK" \
- -S "too many records with bad MAC" \
- -S "Verification of the message MAC failed"
- run_test "DTLS proxy: inject invalid AD record, badmac_limit 2, exchanges 2"\
- -p "$P_PXY bad_ad=1" \
- "$P_SRV dtls=1 dgram_packing=0 debug_level=1 badmac_limit=2 exchanges=2" \
- "$P_CLI dtls=1 dgram_packing=0 debug_level=1 read_timeout=100 exchanges=2" \
- 1 \
- -c "discarding invalid record (mac)" \
- -s "discarding invalid record (mac)" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK" \
- -s "too many records with bad MAC" \
- -s "Verification of the message MAC failed"
- run_test "DTLS proxy: delay ChangeCipherSpec" \
- -p "$P_PXY delay_ccs=1" \
- "$P_SRV dtls=1 debug_level=1 dgram_packing=0" \
- "$P_CLI dtls=1 debug_level=1 dgram_packing=0" \
- 0 \
- -c "record from another epoch" \
- -s "record from another epoch" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- # Tests for reordering support with DTLS
- run_test "DTLS reordering: Buffer out-of-order handshake message on client" \
- -p "$P_PXY delay_srv=ServerHello" \
- "$P_SRV dgram_packing=0 cookies=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- 0 \
- -c "Buffering HS message" \
- -c "Next handshake message has been buffered - load"\
- -S "Buffering HS message" \
- -S "Next handshake message has been buffered - load"\
- -C "Injecting buffered CCS message" \
- -C "Remember CCS message" \
- -S "Injecting buffered CCS message" \
- -S "Remember CCS message"
- run_test "DTLS reordering: Buffer out-of-order handshake message fragment on client" \
- -p "$P_PXY delay_srv=ServerHello" \
- "$P_SRV mtu=512 dgram_packing=0 cookies=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- 0 \
- -c "Buffering HS message" \
- -c "found fragmented DTLS handshake message"\
- -c "Next handshake message 1 not or only partially bufffered" \
- -c "Next handshake message has been buffered - load"\
- -S "Buffering HS message" \
- -S "Next handshake message has been buffered - load"\
- -C "Injecting buffered CCS message" \
- -C "Remember CCS message" \
- -S "Injecting buffered CCS message" \
- -S "Remember CCS message"
- # The client buffers the ServerKeyExchange before receiving the fragmented
- # Certificate message; at the time of writing, together these are aroudn 1200b
- # in size, so that the bound below ensures that the certificate can be reassembled
- # while keeping the ServerKeyExchange.
- requires_config_value_at_least "MBEDTLS_SSL_DTLS_MAX_BUFFERING" 1300
- run_test "DTLS reordering: Buffer out-of-order hs msg before reassembling next" \
- -p "$P_PXY delay_srv=Certificate delay_srv=Certificate" \
- "$P_SRV mtu=512 dgram_packing=0 cookies=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- 0 \
- -c "Buffering HS message" \
- -c "Next handshake message has been buffered - load"\
- -C "attempt to make space by freeing buffered messages" \
- -S "Buffering HS message" \
- -S "Next handshake message has been buffered - load"\
- -C "Injecting buffered CCS message" \
- -C "Remember CCS message" \
- -S "Injecting buffered CCS message" \
- -S "Remember CCS message"
- # The size constraints ensure that the delayed certificate message can't
- # be reassembled while keeping the ServerKeyExchange message, but it can
- # when dropping it first.
- requires_config_value_at_least "MBEDTLS_SSL_DTLS_MAX_BUFFERING" 900
- requires_config_value_at_most "MBEDTLS_SSL_DTLS_MAX_BUFFERING" 1299
- run_test "DTLS reordering: Buffer out-of-order hs msg before reassembling next, free buffered msg" \
- -p "$P_PXY delay_srv=Certificate delay_srv=Certificate" \
- "$P_SRV mtu=512 dgram_packing=0 cookies=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- 0 \
- -c "Buffering HS message" \
- -c "attempt to make space by freeing buffered future messages" \
- -c "Enough space available after freeing buffered HS messages" \
- -S "Buffering HS message" \
- -S "Next handshake message has been buffered - load"\
- -C "Injecting buffered CCS message" \
- -C "Remember CCS message" \
- -S "Injecting buffered CCS message" \
- -S "Remember CCS message"
- run_test "DTLS reordering: Buffer out-of-order handshake message on server" \
- -p "$P_PXY delay_cli=Certificate" \
- "$P_SRV dgram_packing=0 auth_mode=required cookies=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- 0 \
- -C "Buffering HS message" \
- -C "Next handshake message has been buffered - load"\
- -s "Buffering HS message" \
- -s "Next handshake message has been buffered - load" \
- -C "Injecting buffered CCS message" \
- -C "Remember CCS message" \
- -S "Injecting buffered CCS message" \
- -S "Remember CCS message"
- run_test "DTLS reordering: Buffer out-of-order CCS message on client"\
- -p "$P_PXY delay_srv=NewSessionTicket" \
- "$P_SRV dgram_packing=0 cookies=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- 0 \
- -C "Buffering HS message" \
- -C "Next handshake message has been buffered - load"\
- -S "Buffering HS message" \
- -S "Next handshake message has been buffered - load" \
- -c "Injecting buffered CCS message" \
- -c "Remember CCS message" \
- -S "Injecting buffered CCS message" \
- -S "Remember CCS message"
- run_test "DTLS reordering: Buffer out-of-order CCS message on server"\
- -p "$P_PXY delay_cli=ClientKeyExchange" \
- "$P_SRV dgram_packing=0 cookies=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- 0 \
- -C "Buffering HS message" \
- -C "Next handshake message has been buffered - load"\
- -S "Buffering HS message" \
- -S "Next handshake message has been buffered - load" \
- -C "Injecting buffered CCS message" \
- -C "Remember CCS message" \
- -s "Injecting buffered CCS message" \
- -s "Remember CCS message"
- run_test "DTLS reordering: Buffer encrypted Finished message" \
- -p "$P_PXY delay_ccs=1" \
- "$P_SRV dgram_packing=0 cookies=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 \
- hs_timeout=2500-60000" \
- 0 \
- -s "Buffer record from epoch 1" \
- -s "Found buffered record from current epoch - load" \
- -c "Buffer record from epoch 1" \
- -c "Found buffered record from current epoch - load"
- # In this test, both the fragmented NewSessionTicket and the ChangeCipherSpec
- # from the server are delayed, so that the encrypted Finished message
- # is received and buffered. When the fragmented NewSessionTicket comes
- # in afterwards, the encrypted Finished message must be freed in order
- # to make space for the NewSessionTicket to be reassembled.
- # This works only in very particular circumstances:
- # - MBEDTLS_SSL_DTLS_MAX_BUFFERING must be large enough to allow buffering
- # of the NewSessionTicket, but small enough to also allow buffering of
- # the encrypted Finished message.
- # - The MTU setting on the server must be so small that the NewSessionTicket
- # needs to be fragmented.
- # - All messages sent by the server must be small enough to be either sent
- # without fragmentation or be reassembled within the bounds of
- # MBEDTLS_SSL_DTLS_MAX_BUFFERING. Achieve this by testing with a PSK-based
- # handshake, omitting CRTs.
- requires_config_value_at_least "MBEDTLS_SSL_DTLS_MAX_BUFFERING" 190
- requires_config_value_at_most "MBEDTLS_SSL_DTLS_MAX_BUFFERING" 230
- run_test "DTLS reordering: Buffer encrypted Finished message, drop for fragmented NewSessionTicket" \
- -p "$P_PXY delay_srv=NewSessionTicket delay_srv=NewSessionTicket delay_ccs=1" \
- "$P_SRV mtu=140 response_size=90 dgram_packing=0 psk=abc123 psk_identity=foo cookies=0 dtls=1 debug_level=2" \
- "$P_CLI dgram_packing=0 dtls=1 debug_level=2 force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8 psk=abc123 psk_identity=foo" \
- 0 \
- -s "Buffer record from epoch 1" \
- -s "Found buffered record from current epoch - load" \
- -c "Buffer record from epoch 1" \
- -C "Found buffered record from current epoch - load" \
- -c "Enough space available after freeing future epoch record"
- # Tests for "randomly unreliable connection": try a variety of flows and peers
- client_needs_more_time 2
- run_test "DTLS proxy: 3d (drop, delay, duplicate), \"short\" PSK handshake" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 auth_mode=none \
- psk=abc123" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 psk=abc123 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
- 0 \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 2
- run_test "DTLS proxy: 3d, \"short\" RSA handshake" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 auth_mode=none" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 \
- force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
- 0 \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 2
- run_test "DTLS proxy: 3d, \"short\" (no ticket, no cli_auth) FS handshake" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 auth_mode=none" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0" \
- 0 \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 2
- run_test "DTLS proxy: 3d, FS, client auth" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 auth_mode=required" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0" \
- 0 \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 2
- run_test "DTLS proxy: 3d, FS, ticket" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=1 auth_mode=none" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=1" \
- 0 \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 2
- run_test "DTLS proxy: 3d, max handshake (FS, ticket + client auth)" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=1 auth_mode=required" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=1" \
- 0 \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 2
- run_test "DTLS proxy: 3d, max handshake, nbio" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 nbio=2 tickets=1 \
- auth_mode=required" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 nbio=2 tickets=1" \
- 0 \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 4
- run_test "DTLS proxy: 3d, min handshake, resumption" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 auth_mode=none \
- psk=abc123 debug_level=3" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 psk=abc123 \
- debug_level=3 reconnect=1 skip_close_notify=1 read_timeout=1000 max_resend=10 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
- 0 \
- -s "a session has been resumed" \
- -c "a session has been resumed" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 4
- run_test "DTLS proxy: 3d, min handshake, resumption, nbio" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 auth_mode=none \
- psk=abc123 debug_level=3 nbio=2" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 psk=abc123 \
- debug_level=3 reconnect=1 skip_close_notify=1 read_timeout=1000 max_resend=10 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8 nbio=2" \
- 0 \
- -s "a session has been resumed" \
- -c "a session has been resumed" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 4
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "DTLS proxy: 3d, min handshake, client-initiated renego" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 auth_mode=none \
- psk=abc123 renegotiation=1 debug_level=2" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 psk=abc123 \
- renegotiate=1 debug_level=2 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
- 0 \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 4
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "DTLS proxy: 3d, min handshake, client-initiated renego, nbio" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 auth_mode=none \
- psk=abc123 renegotiation=1 debug_level=2" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 psk=abc123 \
- renegotiate=1 debug_level=2 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
- 0 \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 4
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "DTLS proxy: 3d, min handshake, server-initiated renego" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 auth_mode=none \
- psk=abc123 renegotiate=1 renegotiation=1 exchanges=4 \
- debug_level=2" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 psk=abc123 \
- renegotiation=1 exchanges=4 debug_level=2 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
- 0 \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- client_needs_more_time 4
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- run_test "DTLS proxy: 3d, min handshake, server-initiated renego, nbio" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$P_SRV dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 auth_mode=none \
- psk=abc123 renegotiate=1 renegotiation=1 exchanges=4 \
- debug_level=2 nbio=2" \
- "$P_CLI dtls=1 dgram_packing=0 hs_timeout=500-10000 tickets=0 psk=abc123 \
- renegotiation=1 exchanges=4 debug_level=2 nbio=2 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
- 0 \
- -c "=> renegotiate" \
- -s "=> renegotiate" \
- -s "Extra-header:" \
- -c "HTTP/1.0 200 OK"
- ## Interop tests with OpenSSL might trigger a bug in recent versions (including
- ## all versions installed on the CI machines), reported here:
- ## Bug report: https://github.com/openssl/openssl/issues/6902
- ## They should be re-enabled once a fixed version of OpenSSL is available
- ## (this should happen in some 1.1.1_ release according to the ticket).
- skip_next_test
- client_needs_more_time 6
- not_with_valgrind # risk of non-mbedtls peer timing out
- run_test "DTLS proxy: 3d, openssl server" \
- -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \
- "$O_SRV -dtls1 -mtu 2048" \
- "$P_CLI dgram_packing=0 dtls=1 hs_timeout=500-60000 tickets=0" \
- 0 \
- -c "HTTP/1.0 200 OK"
- skip_next_test # see above
- client_needs_more_time 8
- not_with_valgrind # risk of non-mbedtls peer timing out
- run_test "DTLS proxy: 3d, openssl server, fragmentation" \
- -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \
- "$O_SRV -dtls1 -mtu 768" \
- "$P_CLI dgram_packing=0 dtls=1 hs_timeout=500-60000 tickets=0" \
- 0 \
- -c "HTTP/1.0 200 OK"
- skip_next_test # see above
- client_needs_more_time 8
- not_with_valgrind # risk of non-mbedtls peer timing out
- run_test "DTLS proxy: 3d, openssl server, fragmentation, nbio" \
- -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \
- "$O_SRV -dtls1 -mtu 768" \
- "$P_CLI dgram_packing=0 dtls=1 hs_timeout=500-60000 nbio=2 tickets=0" \
- 0 \
- -c "HTTP/1.0 200 OK"
- requires_gnutls
- client_needs_more_time 6
- not_with_valgrind # risk of non-mbedtls peer timing out
- run_test "DTLS proxy: 3d, gnutls server" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$G_SRV -u --mtu 2048 -a" \
- "$P_CLI dgram_packing=0 dtls=1 hs_timeout=500-60000" \
- 0 \
- -s "Extra-header:" \
- -c "Extra-header:"
- requires_gnutls_next
- client_needs_more_time 8
- not_with_valgrind # risk of non-mbedtls peer timing out
- run_test "DTLS proxy: 3d, gnutls server, fragmentation" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$G_NEXT_SRV -u --mtu 512" \
- "$P_CLI dgram_packing=0 dtls=1 hs_timeout=500-60000" \
- 0 \
- -s "Extra-header:" \
- -c "Extra-header:"
- requires_gnutls_next
- client_needs_more_time 8
- not_with_valgrind # risk of non-mbedtls peer timing out
- run_test "DTLS proxy: 3d, gnutls server, fragmentation, nbio" \
- -p "$P_PXY drop=5 delay=5 duplicate=5" \
- "$G_NEXT_SRV -u --mtu 512" \
- "$P_CLI dgram_packing=0 dtls=1 hs_timeout=500-60000 nbio=2" \
- 0 \
- -s "Extra-header:" \
- -c "Extra-header:"
- requires_config_enabled MBEDTLS_SSL_EXPORT_KEYS
- run_test "export keys functionality" \
- "$P_SRV eap_tls=1 debug_level=3" \
- "$P_CLI eap_tls=1 debug_level=3" \
- 0 \
- -s "exported maclen is " \
- -s "exported keylen is " \
- -s "exported ivlen is " \
- -c "exported maclen is " \
- -c "exported keylen is " \
- -c "exported ivlen is " \
- -c "EAP-TLS key material is:"\
- -s "EAP-TLS key material is:"\
- -c "EAP-TLS IV is:" \
- -s "EAP-TLS IV is:"
- # Test heap memory usage after handshake
- requires_config_enabled MBEDTLS_MEMORY_DEBUG
- requires_config_enabled MBEDTLS_MEMORY_BUFFER_ALLOC_C
- requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
- run_tests_memory_after_hanshake
- # Final report
- echo "------------------------------------------------------------------------"
- if [ $FAILS = 0 ]; then
- printf "PASSED"
- else
- printf "FAILED"
- fi
- PASSES=$(( $TESTS - $FAILS ))
- echo " ($PASSES / $TESTS tests ($SKIPS skipped))"
- exit $FAILS
|