1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157 |
- #!/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 "${OPENSSL_NEXT:-}" ]; then
- O_NEXT_SRV="$OPENSSL_NEXT s_server -www -cert data_files/server5.crt -key data_files/server5.key"
- O_NEXT_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_NEXT s_client"
- else
- O_NEXT_SRV=false
- O_NEXT_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 (substring or BRE)\n"
- printf " -e|--exclude\tMatching tests are excluded (substring or 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
- # Read boolean configuration options from config.h for easy and quick
- # testing. Skip non-boolean options (with something other than spaces
- # and a comment after "#define SYMBOL"). The variable contains a
- # space-separated list of symbols.
- CONFIGS_ENABLED=" $(<"$CONFIG_H" \
- sed -n 's!^ *#define *\([A-Za-z][0-9A-Z_a-z]*\) *\(/*\)*!\1!p' |
- tr '\n' ' ')"
- # 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() {
- case $CONFIGS_ENABLED in
- *" $1 "*) :;;
- *) SKIP_NEXT="YES";;
- esac
- }
- # skip next test if the flag is enabled in config.h
- requires_config_disabled() {
- case $CONFIGS_ENABLED in
- *" $1 "*) SKIP_NEXT="YES";;
- esac
- }
- 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_config_value_equals() {
- 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" -ne "$2" ]; then
- SKIP_NEXT="YES"
- fi
- }
- # Space-separated list of ciphersuites supported by this build of
- # Mbed TLS.
- P_CIPHERSUITES=" $($P_CLI --help 2>/dev/null |
- grep TLS- |
- tr -s ' \n' ' ')"
- requires_ciphersuite_enabled() {
- case $P_CIPHERSUITES in
- *" $1 "*) :;;
- *) SKIP_NEXT="YES";;
- esac
- }
- # 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 either IN_CONTENT_LEN or MAX_CONTENT_LEN are below a value
- requires_max_content_len() {
- requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" $1
- requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" $1
- }
- # 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
- }
- requires_openssl_next() {
- if [ -z "${OPENSSL_NEXT_AVAILABLE:-}" ]; then
- if which "${OPENSSL_NEXT:-}" >/dev/null 2>&1; then
- OPENSSL_NEXT_AVAILABLE="YES"
- else
- OPENSSL_NEXT_AVAILABLE="NO"
- fi
- fi
- if [ "$OPENSSL_NEXT_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=$( get_config_value_or_default "MBEDTLS_SSL_MAX_CONTENT_LEN" )
- MAX_IN_LEN=$( get_config_value_or_default "MBEDTLS_SSL_IN_CONTENT_LEN" )
- MAX_OUT_LEN=$( get_config_value_or_default "MBEDTLS_SSL_OUT_CONTENT_LEN" )
- # Calculate the maximum content length that fits both
- 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
- }
- # True if the presence of the given pattern in a log definitely indicates
- # that the test has failed. False if the presence is inconclusive.
- #
- # Inputs:
- # * $1: pattern found in the logs
- # * $TIMES_LEFT: >0 if retrying is an option
- #
- # Outputs:
- # * $outcome: set to a retry reason if the pattern is inconclusive,
- # unchanged otherwise.
- # * Return value: 1 if the pattern is inconclusive,
- # 0 if the failure is definitive.
- log_pattern_presence_is_conclusive() {
- # If we've run out of attempts, then don't retry no matter what.
- if [ $TIMES_LEFT -eq 0 ]; then
- return 0
- fi
- case $1 in
- "resend")
- # An undesired resend may have been caused by the OS dropping or
- # delaying a packet at an inopportune time.
- outcome="RETRY(resend)"
- return 1;;
- esac
- }
- # 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() {
- case "$1" in
- *ssl_client2*) true;;
- *ssl_server2*) true;;
- *) false;;
- esac
- }
- # openssl s_server doesn't have -www with DTLS
- check_osrv_dtls() {
- case "$SRV_CMD" in
- *s_server*-dtls*)
- NEEDS_INPUT=1
- SRV_CMD="$( echo $SRV_CMD | sed s/-www// )";;
- *) NEEDS_INPUT=0;;
- esac
- }
- # 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() {
- newline='
- '
- 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 true; do
- SERVER_PIDS=$(lsof -a -n -b -i "$proto:$1" -F p)
- # When we use a proxy, it will be listening on the same port we
- # are checking for as well as the server and lsof will list both.
- # If multiple PIDs are returned, each one will be on a separate
- # line, each prepended with 'p'.
- case ${newline}${SERVER_PIDS}${newline} in
- *${newline}p${2}${newline}*) break;;
- esac
- 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() {
- case "$1" in
- *dtls=1*|*-dtls*|*-u*) DTLS=1;;
- *) DTLS=0;;
- esac
- }
- # check if the given command uses gnutls and sets global variable CMD_IS_GNUTLS
- is_gnutls() {
- case "$1" in
- *gnutls-cli*)
- CMD_IS_GNUTLS=1
- ;;
- *gnutls-serv*)
- CMD_IS_GNUTLS=1
- ;;
- *)
- CMD_IS_GNUTLS=0
- ;;
- esac
- }
- # 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
- }
- # Analyze the commands that will be used in a test.
- #
- # Analyze and possibly instrument $PXY_CMD, $CLI_CMD, $SRV_CMD to pass
- # extra arguments or go through wrappers.
- # Set $DTLS (0=TLS, 1=DTLS).
- analyze_test_commands() {
- # 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
- # update CMD_IS_GNUTLS variable
- is_gnutls "$SRV_CMD"
- # if the server uses gnutls but doesn't set priority, explicitly
- # set the default priority
- if [ "$CMD_IS_GNUTLS" -eq 1 ]; then
- case "$SRV_CMD" in
- *--priority*) :;;
- *) SRV_CMD="$SRV_CMD --priority=NORMAL";;
- esac
- fi
- # update CMD_IS_GNUTLS variable
- is_gnutls "$CLI_CMD"
- # if the client uses gnutls but doesn't set priority, explicitly
- # set the default priority
- if [ "$CMD_IS_GNUTLS" -eq 1 ]; then
- case "$CLI_CMD" in
- *--priority*) :;;
- *) CLI_CMD="$CLI_CMD --priority=NORMAL";;
- 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
- }
- # Check for failure conditions after a test case.
- #
- # Inputs from run_test:
- # * positional parameters: test options (see run_test documentation)
- # * $CLI_EXIT: client return code
- # * $CLI_EXPECT: expected client return code
- # * $SRV_RET: server return code
- # * $CLI_OUT, $SRV_OUT, $PXY_OUT: files containing client/server/proxy logs
- # * $TIMES_LEFT: if nonzero, a RETRY outcome is allowed
- #
- # Outputs:
- # * $outcome: one of PASS/RETRY*/FAIL
- check_test_failure() {
- outcome=FAIL
- if [ $TIMES_LEFT -gt 0 ] &&
- grep '===CLIENT_TIMEOUT===' $CLI_OUT >/dev/null
- then
- outcome="RETRY(client-timeout)"
- return
- fi
- # 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 (only for Mbed TLS: GnuTLS and OpenSSL don't
- # exit with status 0 when interrupted by a signal, and we don't really
- # care anyway), in case e.g. the server reports a memory leak.
- if [ $SRV_RET != 0 ] && is_polar "$SRV_CMD"; then
- fail "Server exited with status $SRV_RET"
- 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
- if log_pattern_presence_is_conclusive "$2"; then
- fail "pattern '$2' MUST NOT be present in the Server output"
- fi
- return
- fi
- ;;
- "-C")
- if grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then
- if log_pattern_presence_is_conclusive "$2"; then
- fail "pattern '$2' MUST NOT be present in the Client output"
- fi
- 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
- outcome=PASS
- }
- # Run the current test case: start the server and if applicable the proxy, run
- # the client, wait for all processes to finish or time out.
- #
- # Inputs:
- # * $NAME: test case name
- # * $CLI_CMD, $SRV_CMD, $PXY_CMD: commands to run
- # * $CLI_OUT, $SRV_OUT, $PXY_OUT: files to contain client/server/proxy logs
- #
- # Outputs:
- # * $CLI_EXIT: client return code
- # * $SRV_RET: server return code
- do_run_test_once() {
- # 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
- SRV_RET=$?
- if [ -n "$PXY_CMD" ]; then
- kill $PXY_PID >/dev/null 2>&1
- wait $PXY_PID
- 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 is_excluded "$NAME"; then
- 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 [ -n "$RUN_TEST_NUMBER" ]; then
- case ",$RUN_TEST_NUMBER," in
- *",$TESTS,"*) :;;
- *) SKIP_NEXT="YES";;
- esac
- 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
- case "$SRV_CMD $CLI_CMD" in
- *data_files/*)
- requires_config_enabled MBEDTLS_FS_IO;;
- esac
- # 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
- analyze_test_commands "$@"
- TIMES_LEFT=2
- while [ $TIMES_LEFT -gt 0 ]; do
- TIMES_LEFT=$(( $TIMES_LEFT - 1 ))
- do_run_test_once
- check_test_failure "$@"
- case $outcome in
- PASS) break;;
- RETRY*) printf "$outcome ";;
- FAIL) return;;
- esac
- done
- # If we get this far, the test case passed.
- 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=tls12" \
- "$P_CLI debug_level=3 force_version=tls12 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=tls12" \
- "$P_CLI debug_level=4 force_version=tls12 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)
- 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=tls12" \
- "$P_CLI debug_level=3 force_version=tls12 \
- 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=tls12" \
- "$P_CLI debug_level=3 force_version=tls12 \
- 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 "$@"
- # Optimize filters: if $FILTER and $EXCLUDE can be expressed as shell
- # patterns rather than regular expressions, use a case statement instead
- # of calling grep. To keep the optimizer simple, it is incomplete and only
- # detects simple cases: plain substring, everything, nothing.
- #
- # As an exception, the character '.' is treated as an ordinary character
- # if it is the only special character in the string. This is because it's
- # rare to need "any one character", but needing a literal '.' is common
- # (e.g. '-f "DTLS 1.2"').
- need_grep=
- case "$FILTER" in
- '^$') simple_filter=;;
- '.*') simple_filter='*';;
- *[][$+*?\\^{\|}]*) # Regexp special characters (other than .), we need grep
- need_grep=1;;
- *) # No regexp or shell-pattern special character
- simple_filter="*$FILTER*";;
- esac
- case "$EXCLUDE" in
- '^$') simple_exclude=;;
- '.*') simple_exclude='*';;
- *[][$+*?\\^{\|}]*) # Regexp special characters (other than .), we need grep
- need_grep=1;;
- *) # No regexp or shell-pattern special character
- simple_exclude="*$EXCLUDE*";;
- esac
- if [ -n "$need_grep" ]; then
- is_excluded () {
- ! echo "$1" | grep "$FILTER" | grep -q -v "$EXCLUDE"
- }
- else
- is_excluded () {
- case "$1" in
- $simple_exclude) true;;
- $simple_filter) false;;
- *) true;;
- esac
- }
- fi
- # 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
- # Note: Using 'localhost' rather than 127.0.0.1 here is unwise, as on many
- # machines that will resolve to ::1, and we don't want ipv6 here.
- 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"
- O_CLI="$O_CLI -connect 127.0.0.1:+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 127.0.0.1:+SRV_PORT"
- fi
- if [ -n "${OPENSSL_NEXT:-}" ]; then
- O_NEXT_SRV="$O_NEXT_SRV -accept $SRV_PORT"
- O_NEXT_CLI="$O_NEXT_CLI -connect 127.0.0.1:+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"
- ## SECP224K1 is buggy via the PSA API
- ## (https://github.com/ARMmbed/mbedtls/issues/3541),
- ## so it is disabled in PSA even when it's enabled in Mbed TLS.
- ## The proper dependency would be on PSA_WANT_ECC_SECP_K1_224 but
- ## dependencies on PSA symbols in ssl-opt.sh are not implemented yet.
- #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
- 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"
- 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
- 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"
- 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"
- # This and the test below it require MAX_CONTENT_LEN to be at least MFL+1, because the
- # tests check that the buffer contents are reallocated when the message is
- # larger than the buffer.
- requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
- requires_config_enabled MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
- requires_max_content_len 513
- 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
- requires_max_content_len 1025
- 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=tls12" \
- 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"
- # For reasons that aren't fully understood, this test randomly fails with high
- # probability with OpenSSL 1.0.2g on the CI, see #5012.
- requires_openssl_next
- run_test "Session resume using tickets, DTLS: openssl client" \
- "$P_SRV dtls=1 debug_level=3 tickets=1" \
- "( $O_NEXT_CLI -dtls1 -sess_out $SESSION; \
- $O_NEXT_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"
- # For reasons that aren't fully understood, this test randomly fails with high
- # probability with OpenSSL 1.0.2g on the CI, see #5012.
- requires_openssl_next
- run_test "Session resume using cache, DTLS: openssl client" \
- "$P_SRV dtls=1 debug_level=3 tickets=0" \
- "( $O_NEXT_CLI -dtls1 -sess_out $SESSION; \
- $O_NEXT_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
- 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_max_content_len 4096
- 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_max_content_len 1024
- 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_max_content_len 2048
- 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_max_content_len 4096
- 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_max_content_len 1024
- 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_max_content_len 2048
- 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_max_content_len 4096
- 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_max_content_len 2048
- 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_max_content_len 2048
- 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_max_content_len 4096
- 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_max_content_len 4096
- 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_max_content_len 4096
- 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_max_content_len 4096
- 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_max_content_len 4096
- 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_max_content_len 4096
- 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_max_content_len 2048
- 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_max_content_len 2048
- 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_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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"
- # This script assumes that MBEDTLS_X509_MAX_INTERMEDIATE_CA has its default
- # value, defined here as MAX_IM_CA. Some test cases will be skipped if the
- # library is configured with a different value.
- MAX_IM_CA='8'
- # The tests for the max_int tests can pass with any number higher than MAX_IM_CA
- # because only a chain of MAX_IM_CA length is tested. Equally, the max_int+1
- # tests can pass with any number less than MAX_IM_CA. However, stricter preconditions
- # are in place so that the semantics are consistent with the test description.
- requires_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
- 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=tls12" \
- 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=tls12" \
- 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=tls12" \
- "$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 999, client 999, OK" \
- "$P_SRV dhm_file=data_files/dh.999.pem" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=1 dhmlen=999" \
- 0 \
- -C "DHM prime too short:"
- run_test "DHM size: server 1000, client 1000, OK" \
- "$P_SRV dhm_file=data_files/dh.1000.pem" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=1 dhmlen=1000" \
- 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 1000, client 1001, 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 dhmlen=1001" \
- 1 \
- -c "DHM prime too short:"
- run_test "DHM size: server 999, client 1000, rejected" \
- "$P_SRV dhm_file=data_files/dh.999.pem" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=1 dhmlen=1000" \
- 1 \
- -c "DHM prime too short:"
- run_test "DHM size: server 998, client 999, rejected" \
- "$P_SRV dhm_file=data_files/dh.998.pem" \
- "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
- debug_level=1 dhmlen=999" \
- 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=tls12 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=tls12 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=tls12 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=tls12 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=tls12 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=1 min_version=tls12 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=tls12 force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384" \
- "$P_CLI extended_ms=0 debug_level=1 min_version=tls12 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=tls12 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA extended_ms=1" \
- "$P_CLI debug_level=3 min_version=tls12 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=tls12 \
- force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384 extended_ms=1" \
- "$P_CLI debug_level=3 min_version=tls12 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=tls12 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls12 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=tls12 force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls12 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=tls12 \
- force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA extended_ms=1" \
- "$P_CLI debug_level=3 min_version=tls12 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=tls12 \
- force_ciphersuite=TLS-PSK-WITH-AES-256-CBC-SHA384 extended_ms=1" \
- "$P_CLI debug_level=3 min_version=tls12 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=tls12 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls12 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=tls12 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls12 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=tls12 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls12 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=tls12 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls12 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=tls12 force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA" \
- "$P_CLI extended_ms=0 debug_level=3 min_version=tls12 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_ENABLED
- 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_ENABLED
- 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_ENABLED
- 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_ENABLED
- 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_ENABLED
- 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=tls12" \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=dtls12" \
- "$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=dtls12 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=dtls12 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=dtls12 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=dtls12" \
- "$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=dtls12 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=dtls12 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=dtls12 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
- requires_max_content_len 4096
- 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=tls12 \
- 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=tls12 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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
- # The tests below fail when the server's OUT_CONTENT_LEN is less than 16384.
- 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=tls12 \
- 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=tls12 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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=tls12 \
- 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
- requires_max_content_len 4096
- 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
- requires_max_content_len 2048
- 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
- requires_max_content_len 4096
- 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
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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
- requires_max_content_len 4096
- 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
- requires_max_content_len 4096
- 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
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- requires_config_enabled MBEDTLS_CHACHAPOLY_C
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_CCM_C
- requires_max_content_len 2048
- 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_ENABLED
- 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
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_CIPHER_MODE_CBC
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- client_needs_more_time 2
- requires_max_content_len 2048
- 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_ENABLED
- requires_config_enabled MBEDTLS_AES_C
- requires_config_enabled MBEDTLS_GCM_C
- client_needs_more_time 2
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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=dtls12" \
- 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
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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=dtls12" \
- "$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
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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=dtls12" \
- 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_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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=dtls12" \
- "$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
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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=dtls12" \
- 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
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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=dtls12" \
- "$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
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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=dtls12" \
- 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
- requires_max_content_len 2048
- 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
- requires_max_content_len 2048
- 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=dtls12" \
- "$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
- requires_max_content_len 2048
- 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
- requires_max_content_len 16384
- 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
|