1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378 |
- #! /usr/bin/env perl
- # Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
- #
- # Licensed under the Apache License 2.0 (the "License"). You may not use
- # this file except in compliance with the License. You can obtain a copy
- # in the file LICENSE in the source distribution or at
- # https://www.openssl.org/source/license.html
- #
- #========================================================================
- # Written by Xiaokang Qian <xiaokang.qian@arm.com> for the OpenSSL project,
- # derived from https://github.com/ARM-software/AArch64cryptolib, original
- # author Samuel Lee <Samuel.Lee@arm.com>. The module is, however, dual
- # licensed under OpenSSL and SPDX BSD-3-Clause licenses depending on where you
- # obtain it.
- #========================================================================
- #
- # Approach - We want to reload constants as we have plenty of spare ASIMD slots around crypto units for loading
- # Unroll x8 in main loop, main loop to act on 8 16B blocks per iteration, and then do modulo of the accumulated
- # intermediate hashesfrom the 8 blocks.
- #
- # ____________________________________________________
- # | |
- # | PRE |
- # |____________________________________________________|
- # | | | |
- # | CTR block 8k+13| AES block 8k+8 | GHASH block 8k+0 |
- # |________________|________________|__________________|
- # | | | |
- # | CTR block 8k+14| AES block 8k+9 | GHASH block 8k+1 |
- # |________________|________________|__________________|
- # | | | |
- # | CTR block 8k+15| AES block 8k+10| GHASH block 8k+2 |
- # |________________|________________|__________________|
- # | | | |
- # | CTR block 8k+16| AES block 8k+11| GHASH block 8k+3 |
- # |________________|________________|__________________|
- # | | | |
- # | CTR block 8k+17| AES block 8k+12| GHASH block 8k+4 |
- # |________________|________________|__________________|
- # | | | |
- # | CTR block 8k+18| AES block 8k+13| GHASH block 8k+5 |
- # |________________|________________|__________________|
- # | | | |
- # | CTR block 8k+19| AES block 8k+14| GHASH block 8k+6 |
- # |________________|________________|__________________|
- # | | | |
- # | CTR block 8k+20| AES block 8k+15| GHASH block 8k+7 |
- # |________________|____(mostly)____|__________________|
- # | |
- # | MODULO |
- # |____________________________________________________|
- #
- # PRE:
- # Ensure previous generated intermediate hash is aligned and merged with result for GHASH 4k+0
- # EXT low_acc, low_acc, low_acc, #8
- # EOR res_curr (8k+0), res_curr (4k+0), low_acc
- #
- # CTR block:
- # Increment and byte reverse counter in scalar registers and transfer to SIMD registers
- # REV ctr32, rev_ctr32
- # ORR ctr64, constctr96_top32, ctr32, LSL #32
- # INS ctr_next.d[0], constctr96_bottom64 // Keeping this in scalar registers to free up space in SIMD RF
- # INS ctr_next.d[1], ctr64X
- # ADD rev_ctr32, #1
- #
- # AES block:
- # Do AES encryption/decryption on CTR block X and EOR it with input block X. Take 256 bytes key below for example.
- # Doing small trick here of loading input in scalar registers, EORing with last key and then transferring
- # Given we are very constrained in our ASIMD registers this is quite important
- #
- # Encrypt:
- # LDR input_low, [ input_ptr ], #8
- # LDR input_high, [ input_ptr ], #8
- # EOR input_low, k14_low
- # EOR input_high, k14_high
- # INS res_curr.d[0], input_low
- # INS res_curr.d[1], input_high
- # AESE ctr_curr, k0; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k1; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k2; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k3; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k4; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k5; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k6; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k7; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k8; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k9; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k10; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k11; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k12; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k13
- # EOR res_curr, res_curr, ctr_curr
- # ST1 { res_curr.16b }, [ output_ptr ], #16
- #
- # Decrypt:
- # AESE ctr_curr, k0; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k1; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k2; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k3; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k4; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k5; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k6; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k7; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k8; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k9; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k10; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k11; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k12; AESMC ctr_curr, ctr_curr
- # AESE ctr_curr, k13
- # LDR res_curr, [ input_ptr ], #16
- # EOR res_curr, res_curr, ctr_curr
- # MOV output_low, res_curr.d[0]
- # MOV output_high, res_curr.d[1]
- # EOR output_low, k14_low
- # EOR output_high, k14_high
- # STP output_low, output_high, [ output_ptr ], #16
- # GHASH block X:
- # Do 128b karatsuba polynomial multiplication on block
- # We only have 64b->128b polynomial multipliers, naively that means we need to do 4 64b multiplies to generate a 128b
- #
- # multiplication:
- # Pmull(A,B) == (Pmull(Ah,Bh)<<128 | Pmull(Al,Bl)) ^ (Pmull(Ah,Bl) ^ Pmull(Al,Bh))<<64
- #
- # The idea behind Karatsuba multiplication is that we can do just 3 64b multiplies:
- # Pmull(A,B) == (Pmull(Ah,Bh)<<128 | Pmull(Al,Bl)) ^ (Pmull(Ah^Al,Bh^Bl) ^ Pmull(Ah,Bh) ^ Pmull(Al,Bl))<<64
- #
- # There is some complication here because the bit order of GHASH's PMULL is reversed compared to elsewhere, so we are
- # multiplying with "twisted" powers of H
- #
- # Note: We can PMULL directly into the acc_x in first GHASH of the loop
- # Note: For scheduling big cores we want to split the processing to happen over two loop iterations - otherwise the critical
- # path latency dominates the performance
- #
- # This has a knock on effect on register pressure, so we have to be a bit more clever with our temporary registers
- # than indicated here
- # REV64 res_curr, res_curr
- # INS t_m.d[0], res_curr.d[1]
- # EOR t_m.8B, t_m.8B, res_curr.8B
- # PMULL2 t_h, res_curr, HX
- # PMULL t_l, res_curr, HX
- # PMULL t_m, t_m, HX_k
- # EOR acc_h, acc_h, t_h
- # EOR acc_l, acc_l, t_l
- # EOR acc_m, acc_m, t_m
- #
- # MODULO: take the partial accumulators (~representing sum of 256b multiplication results), from GHASH and do modulo reduction on them
- # There is some complication here because the bit order of GHASH's PMULL is reversed compared to elsewhere, so we are doing modulo
- # with a reversed constant
- # EOR3 acc_m, acc_m, acc_l, acc_h // Finish off karatsuba processing
- # PMULL t_mod, acc_h, mod_constant
- # EXT acc_h, acc_h, acc_h, #8
- # EOR3 acc_m, acc_m, t_mod, acc_h
- # PMULL acc_h, acc_m, mod_constant
- # EXT acc_m, acc_m, acc_m, #8
- # EOR3 acc_l, acc_l, acc_m, acc_h
- $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
- $flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
- $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
- ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
- ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate ) or
- die "can't locate arm-xlate.pl";
- die "only for 64 bit" if $flavour !~ /64/;
- open OUT,"| \"$^X\" $xlate $flavour $output";
- *STDOUT=*OUT;
- $code=<<___;
- #include "arm_arch.h"
- #if __ARM_MAX_ARCH__>=8
- ___
- $code.=".arch armv8-a+crypto\n.text\n";
- $input_ptr="x0"; #argument block
- $bit_length="x1";
- $byte_length="x9";
- $output_ptr="x2";
- $current_tag="x3";
- $counter="x16";
- $constant_temp="x15";
- $modulo_constant="x10";
- $cc="x8";
- {
- my ($end_input_ptr,$main_end_input_ptr,$temp0_x,$temp1_x)=map("x$_",(4..7));
- my ($temp2_x,$temp3_x)=map("x$_",(13..14));
- my ($ctr0b,$ctr1b,$ctr2b,$ctr3b,$ctr4b,$ctr5b,$ctr6b,$ctr7b,$res0b,$res1b,$res2b,$res3b,$res4b,$res5b,$res6b,$res7b)=map("v$_.16b",(0..15));
- my ($ctr0,$ctr1,$ctr2,$ctr3,$ctr4,$ctr5,$ctr6,$ctr7,$res0,$res1,$res2,$res3,$res4,$res5,$res6,$res7)=map("v$_",(0..15));
- my ($ctr0d,$ctr1d,$ctr2d,$ctr3d,$ctr4d,$ctr5d,$ctr6d,$ctr7d)=map("d$_",(0..7));
- my ($ctr0q,$ctr1q,$ctr2q,$ctr3q,$ctr4q,$ctr5q,$ctr6q,$ctr7q)=map("q$_",(0..7));
- my ($res0q,$res1q,$res2q,$res3q,$res4q,$res5q,$res6q,$res7q)=map("q$_",(8..15));
- my ($ctr_t0,$ctr_t1,$ctr_t2,$ctr_t3,$ctr_t4,$ctr_t5,$ctr_t6,$ctr_t7)=map("v$_",(8..15));
- my ($ctr_t0b,$ctr_t1b,$ctr_t2b,$ctr_t3b,$ctr_t4b,$ctr_t5b,$ctr_t6b,$ctr_t7b)=map("v$_.16b",(8..15));
- my ($ctr_t0q,$ctr_t1q,$ctr_t2q,$ctr_t3q,$ctr_t4q,$ctr_t5q,$ctr_t6q,$ctr_t7q)=map("q$_",(8..15));
- my ($acc_hb,$acc_mb,$acc_lb)=map("v$_.16b",(17..19));
- my ($acc_h,$acc_m,$acc_l)=map("v$_",(17..19));
- my ($h1,$h12k,$h2,$h3,$h34k,$h4)=map("v$_",(20..25));
- my ($h5,$h56k,$h6,$h7,$h78k,$h8)=map("v$_",(20..25));
- my ($h1q,$h12kq,$h2q,$h3q,$h34kq,$h4q)=map("q$_",(20..25));
- my ($h5q,$h56kq,$h6q,$h7q,$h78kq,$h8q)=map("q$_",(20..25));
- my $t0="v16";
- my $t0d="d16";
- my $t1="v29";
- my $t2=$res1;
- my $t3=$t1;
- my $t4=$res0;
- my $t5=$res2;
- my $t6=$t0;
- my $t7=$res3;
- my $t8=$res4;
- my $t9=$res5;
- my $t10=$res6;
- my $t11="v21";
- my $t12=$t1;
- my $rtmp_ctr="v30";
- my $rtmp_ctrq="q30";
- my $rctr_inc="v31";
- my $rctr_incd="d31";
- my $mod_constantd=$t0d;
- my $mod_constant=$t0;
- my ($rk0,$rk1,$rk2)=map("v$_.16b",(26..28));
- my ($rk3,$rk4,$rk5)=map("v$_.16b",(26..28));
- my ($rk6,$rk7,$rk8)=map("v$_.16b",(26..28));
- my ($rk9,$rk10,$rk11)=map("v$_.16b",(26..28));
- my ($rk12,$rk13,$rk14)=map("v$_.16b",(26..28));
- my ($rk0q,$rk1q,$rk2q)=map("q$_",(26..28));
- my ($rk3q,$rk4q,$rk5q)=map("q$_",(26..28));
- my ($rk6q,$rk7q,$rk8q)=map("q$_",(26..28));
- my ($rk9q,$rk10q,$rk11q)=map("q$_",(26..28));
- my ($rk12q,$rk13q,$rk14q)=map("q$_",(26..28));
- my $rk2q1="v28.1q";
- my $rk3q1="v26.1q";
- my $rk4v="v27";
- #########################################################################################
- # size_t unroll8_eor3_aes_gcm_enc_128_kernel(const uint8_t * plaintext,
- # uint64_t plaintext_length,
- # uint8_t * ciphertext,
- # uint64_t *Xi,
- # unsigned char ivec[16],
- # const void *key);
- #
- $code.=<<___;
- .global unroll8_eor3_aes_gcm_enc_128_kernel
- .type unroll8_eor3_aes_gcm_enc_128_kernel,%function
- .align 4
- unroll8_eor3_aes_gcm_enc_128_kernel:
- AARCH64_VALID_CALL_TARGET
- cbz x1, .L128_enc_ret
- stp d8, d9, [sp, #-80]!
- lsr $byte_length, $bit_length, #3
- mov $counter, x4
- mov $cc, x5
- stp d10, d11, [sp, #16]
- stp d12, d13, [sp, #32]
- stp d14, d15, [sp, #48]
- mov x5, #0xc200000000000000
- stp x5, xzr, [sp, #64]
- add $modulo_constant, sp, #64
- mov $constant_temp, #0x100000000 @ set up counter increment
- movi $rctr_inc.16b, #0x0
- mov $rctr_inc.d[1], $constant_temp
- mov $main_end_input_ptr, $byte_length
- ld1 { $ctr0b}, [$counter] @ CTR block 0
- sub $main_end_input_ptr, $main_end_input_ptr, #1 @ byte_len - 1
- and $main_end_input_ptr, $main_end_input_ptr, #0xffffffffffffff80 @ number of bytes to be processed in main loop (at least 1 byte must be handled by tail)
- rev32 $rtmp_ctr.16b, $ctr0.16b @ set up reversed counter
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 0
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 1
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 2
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 2
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 3
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 3
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 4
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 4
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 5
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 5
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 6
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 6
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 7
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 7
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 0
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 1
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 1
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 1
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 2
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 1
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 2
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 2
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 2
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 3
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 3
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 3
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 3
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 3
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 4
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 3
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 4
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 5
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 5
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 5
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 5
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 5
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 6
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 6
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 7
- ld1 { $acc_lb}, [$current_tag]
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 7
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 7
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 7
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 7
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- ldr $rk10q, [$cc, #160] @ load rk10
- aese $ctr3b, $rk9 @ AES block 8k+11 - round 9
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- aese $ctr2b, $rk9 @ AES block 8k+10 - round 9
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- aese $ctr6b, $rk9 @ AES block 8k+14 - round 9
- aese $ctr4b, $rk9 @ AES block 8k+12 - round 9
- add $main_end_input_ptr, $main_end_input_ptr, $input_ptr
- aese $ctr0b, $rk9 @ AES block 8k+8 - round 9
- aese $ctr7b, $rk9 @ AES block 8k+15 - round 9
- aese $ctr5b, $rk9 @ AES block 8k+13 - round 9
- aese $ctr1b, $rk9 @ AES block 8k+9 - round 9
- add $end_input_ptr, $input_ptr, $bit_length, lsr #3 @ end_input_ptr
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- b.ge .L128_enc_tail @ handle tail
- ldp $ctr_t0q, $ctr_t1q, [$input_ptr], #32 @ AES block 0, 1 - load plaintext
- ldp $ctr_t2q, $ctr_t3q, [$input_ptr], #32 @ AES block 2, 3 - load plaintext
- ldp $ctr_t4q, $ctr_t5q, [$input_ptr], #32 @ AES block 4, 5 - load plaintext
- ldp $ctr_t6q, $ctr_t7q, [$input_ptr], #32 @ AES block 6, 7 - load plaintext
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- eor3 $res0b, $ctr_t0b, $ctr0b, $rk10 @ AES block 0 - result
- rev32 $ctr0.16b, $rtmp_ctr.16b @ CTR block 8
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8
- eor3 $res1b, $ctr_t1b, $ctr1b, $rk10 @ AES block 1 - result
- stp $res0q, $res1q, [$output_ptr], #32 @ AES block 0, 1 - store result
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 9
- eor3 $res5b, $ctr_t5b, $ctr5b, $rk10 @ AES block 5 - result
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 9
- eor3 $res2b, $ctr_t2b, $ctr2b, $rk10 @ AES block 2 - result
- eor3 $res6b, $ctr_t6b, $ctr6b, $rk10 @ AES block 6 - result
- eor3 $res4b, $ctr_t4b, $ctr4b, $rk10 @ AES block 4 - result
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 10
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 10
- eor3 $res3b, $ctr_t3b, $ctr3b, $rk10 @ AES block 3 - result
- eor3 $res7b, $ctr_t7b, $ctr7b,$rk10 @ AES block 7 - result
- stp $res2q, $res3q, [$output_ptr], #32 @ AES block 2, 3 - store result
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 11
- stp $res4q, $res5q, [$output_ptr], #32 @ AES block 4, 5 - store result
- stp $res6q, $res7q, [$output_ptr], #32 @ AES block 6, 7 - store result
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 12
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 12
- b.ge .L128_enc_prepretail @ do prepretail
- .L128_enc_main_loop: @ main loop start
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- rev64 $res1b, $res1b @ GHASH block 8k+1
- rev64 $res0b, $res0b @ GHASH block 8k
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- rev64 $res5b, $res5b @ GHASH block 8k+5 (t0, t1, t2 and t3 free)
- rev64 $res3b, $res3b @ GHASH block 8k+3
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- eor $res0b, $res0b, $acc_lb @ PRE 1
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- rev64 $res7b, $res7b @ GHASH block 8k+7 (t0, t1, t2 and t3 free)
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- rev64 $res2b, $res2b @ GHASH block 8k+2
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h3l | h3h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- eor3 $acc_hb, $acc_hb, $t1.16b,$t2.16b @ GHASH block 8k+2, 8k+3 - high
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- rev64 $res6b, $res6b @ GHASH block 8k+6 (t0, t1, and t2 free)
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- rev64 $res4b, $res4b @ GHASH block 8k+4 (t0, t1, and t2 free)
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h1l | h1h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- ldp $ctr_t0q, $ctr_t1q, [$input_ptr], #32 @ AES block 8k+8, 8k+9 - load plaintext
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- rev32 $h1.16b, $rtmp_ctr.16b @ CTR block 8k+16
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+16
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- ldp $ctr_t2q, $ctr_t3q, [$input_ptr], #32 @ AES block 8k+10, 8k+11 - load plaintext
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- pmull $t11.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- rev32 $h2.16b, $rtmp_ctr.16b @ CTR block 8k+17
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- ldp $ctr_t4q, $ctr_t5q, [$input_ptr], #32 @ AES block 8k+12, 8k+13 - load plaintext
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+17
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- ldr $rk10q, [$cc, #160] @ load rk10
- ext $t12.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- rev32 $h3.16b, $rtmp_ctr.16b @ CTR block 8k+18
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+18
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- aese $ctr2b, $rk9 @ AES block 8k+10 - round 9
- aese $ctr4b, $rk9 @ AES block 8k+12 - round 9
- aese $ctr1b, $rk9 @ AES block 8k+9 - round 9
- ldp $ctr_t6q, $ctr_t7q, [$input_ptr], #32 @ AES block 8k+14, 8k+15 - load plaintext
- rev32 $h4.16b, $rtmp_ctr.16b @ CTR block 8k+19
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+19
- cmp $input_ptr, $main_end_input_ptr @ LOOP CONTROL
- eor3 $res4b, $ctr_t4b, $ctr4b, $rk10 @ AES block 4 - result
- aese $ctr7b, $rk9 @ AES block 8k+15 - round 9
- aese $ctr6b, $rk9 @ AES block 8k+14 - round 9
- aese $ctr3b, $rk9 @ AES block 8k+11 - round 9
- eor3 $res2b, $ctr_t2b, $ctr2b, $rk10 @ AES block 8k+10 - result
- mov $ctr2.16b, $h3.16b @ CTR block 8k+18
- aese $ctr0b, $rk9 @ AES block 8k+8 - round 9
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 8k+20
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+20
- eor3 $res7b, $ctr_t7b, $ctr7b, $rk10 @ AES block 7 - result
- aese $ctr5b, $rk9 @ AES block 8k+13 - round 9
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- eor3 $res1b, $ctr_t1b, $ctr1b, $rk10 @ AES block 8k+9 - result
- eor3 $res3b, $ctr_t3b, $ctr3b, $rk10 @ AES block 8k+11 - result
- mov $ctr3.16b, $h4.16b @ CTR block 8k+19
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- eor3 $res5b, $ctr_t5b, $ctr5b, $rk10 @ AES block 5 - result
- mov $ctr1.16b, $h2.16b @ CTR block 8k+17
- eor3 $res0b, $ctr_t0b, $ctr0b, $rk10 @ AES block 8k+8 - result
- mov $ctr0.16b, $h1.16b @ CTR block 8k+16
- stp $res0q, $res1q, [$output_ptr], #32 @ AES block 8k+8, 8k+9 - store result
- stp $res2q, $res3q, [$output_ptr], #32 @ AES block 8k+10, 8k+11 - store result
- eor3 $res6b, $ctr_t6b, $ctr6b, $rk10 @ AES block 6 - result
- stp $res4q, $res5q, [$output_ptr], #32 @ AES block 8k+12, 8k+13 - store result
- eor3 $acc_lb, $acc_lb, $acc_hb, $t11.16b @ MODULO - fold into low
- stp $res6q, $res7q, [$output_ptr], #32 @ AES block 8k+14, 8k+15 - store result
- b.lt .L128_enc_main_loop
- .L128_enc_prepretail: @ PREPRETAIL
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- rev64 $res0b, $res0b @ GHASH block 8k
- rev64 $res1b, $res1b @ GHASH block 8k+1
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h6k | h5k
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- rev64 $res3b, $res3b @ GHASH block 8k+3
- rev64 $res2b, $res2b @ GHASH block 8k+2
- eor $res0b, $res0b, $acc_lb @ PRE 1
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- rev64 $res5b, $res5b @ GHASH block 8k+5 (t0, t1, t2 and t3 free)
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- rev64 $res4b, $res4b @ GHASH block 8k+4 (t0, t1, and t2 free)
- rev64 $res7b, $res7b @ GHASH block 8k+7 (t0, t1, t2 and t3 free)
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- rev64 $res6b, $res6b @ GHASH block 8k+6 (t0, t1, and t2 free)
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h1l | h1h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- pmull $t11.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- ext $t12.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- ext $acc_mb, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- eor3 $acc_lb, $acc_lb, $acc_hb, $acc_mb @ MODULO - fold into low
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- ldr $rk10q, [$cc, #160] @ load rk10
- aese $ctr6b, $rk9 @ AES block 8k+14 - round 9
- aese $ctr2b, $rk9 @ AES block 8k+10 - round 9
- aese $ctr0b, $rk9 @ AES block 8k+8 - round 9
- aese $ctr1b, $rk9 @ AES block 8k+9 - round 9
- aese $ctr3b, $rk9 @ AES block 8k+11 - round 9
- aese $ctr5b, $rk9 @ AES block 8k+13 - round 9
- aese $ctr4b, $rk9 @ AES block 8k+12 - round 9
- aese $ctr7b, $rk9 @ AES block 8k+15 - round 9
- .L128_enc_tail: @ TAIL
- sub $main_end_input_ptr, $end_input_ptr, $input_ptr @ main_end_input_ptr is number of bytes left to process
- ldr $ctr_t0q, [$input_ptr], #16 @ AES block 8k+8 - load plaintext
- mov $t1.16b, $rk10
- ldp $h5q, $h56kq, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- eor3 $res1b, $ctr_t0b, $ctr0b, $t1.16b @ AES block 8k+8 - result
- ext $t0.16b, $acc_lb, $acc_lb, #8 @ prepare final partial tag
- ldp $h6q, $h7q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldp $h78kq, $h8q, [$current_tag, #192] @ load h8k | h7k
- ext $h8.16b, $h8.16b, $h8.16b, #8
- cmp $main_end_input_ptr, #112
- b.gt .L128_enc_blocks_more_than_7
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- movi $acc_h.8b, #0
- cmp $main_end_input_ptr, #96
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- mov $ctr3b, $ctr2b
- mov $ctr2b, $ctr1b
- movi $acc_l.8b, #0
- movi $acc_m.8b, #0
- b.gt .L128_enc_blocks_more_than_6
- mov $ctr7b, $ctr6b
- cmp $main_end_input_ptr, #80
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- mov $ctr3b, $ctr1b
- b.gt .L128_enc_blocks_more_than_5
- cmp $main_end_input_ptr, #64
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr1b
- b.gt .L128_enc_blocks_more_than_4
- mov $ctr7b, $ctr6b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr1b
- cmp $main_end_input_ptr, #48
- b.gt .L128_enc_blocks_more_than_3
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr1b
- cmp $main_end_input_ptr, #32
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- b.gt .L128_enc_blocks_more_than_2
- cmp $main_end_input_ptr, #16
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr1b
- b.gt .L128_enc_blocks_more_than_1
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- b .L128_enc_blocks_less_than_1
- .L128_enc_blocks_more_than_7: @ blocks left > 7
- st1 { $res1b}, [$output_ptr], #16 @ AES final-7 block - store result
- rev64 $res0b, $res1b @ GHASH final-7 block
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-6 block - load plaintext
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-7 block - mid
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH final-7 block - high
- ins $acc_m.d[0], $h78k.d[1] @ GHASH final-7 block - mid
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-7 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor3 $res1b, $ctr_t1b, $ctr1b, $t1.16b @ AES final-6 block - result
- pmull $acc_m.1q, $rk4v.1d, $acc_m.1d @ GHASH final-7 block - mid
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH final-7 block - low
- .L128_enc_blocks_more_than_6: @ blocks left > 6
- st1 { $res1b}, [$output_ptr], #16 @ AES final-6 block - store result
- rev64 $res0b, $res1b @ GHASH final-6 block
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-5 block - load plaintext
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-6 block - mid
- eor3 $res1b, $ctr_t1b, $ctr2b, $t1.16b @ AES final-5 block - result
- pmull $rk3q1, $res0.1d, $h7.1d @ GHASH final-6 block - low
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-6 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull $rk4v.1q, $rk4v.1d, $h78k.1d @ GHASH final-6 block - mid
- pmull2 $rk2q1, $res0.2d, $h7.2d @ GHASH final-6 block - high
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-6 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-6 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-6 block - high
- .L128_enc_blocks_more_than_5: @ blocks left > 5
- st1 { $res1b}, [$output_ptr], #16 @ AES final-5 block - store result
- rev64 $res0b, $res1b @ GHASH final-5 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-5 block - mid
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-4 block - load plaintext
- pmull2 $rk2q1, $res0.2d, $h6.2d @ GHASH final-5 block - high
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-5 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-5 block - mid
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-5 block - mid
- eor3 $res1b, $ctr_t1b, $ctr3b, $t1.16b @ AES final-4 block - result
- pmull $rk3q1, $res0.1d, $h6.1d @ GHASH final-5 block - low
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull2 $rk4v.1q, $rk4v.2d, $h56k.2d @ GHASH final-5 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-5 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-5 block - mid
- .L128_enc_blocks_more_than_4: @ blocks left > 4
- st1 { $res1b}, [$output_ptr], #16 @ AES final-4 block - store result
- rev64 $res0b, $res1b @ GHASH final-4 block
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-3 block - load plaintext
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-4 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull2 $rk2q1, $res0.2d, $h5.2d @ GHASH final-4 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-4 block - mid
- pmull $rk3q1, $res0.1d, $h5.1d @ GHASH final-4 block - low
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-4 block - high
- pmull $rk4v.1q, $rk4v.1d, $h56k.1d @ GHASH final-4 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-4 block - low
- eor3 $res1b, $ctr_t1b, $ctr4b, $t1.16b @ AES final-3 block - result
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-4 block - mid
- .L128_enc_blocks_more_than_3: @ blocks left > 3
- st1 { $res1b}, [$output_ptr], #16 @ AES final-3 block - store result
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- rev64 $res0b, $res1b @ GHASH final-3 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- movi $t0.8b, #0 @ suppress further partial tag feed in
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-3 block - mid
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- pmull $rk3q1, $res0.1d, $h4.1d @ GHASH final-3 block - low
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-2 block - load plaintext
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-3 block - mid
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-3 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-3 block - low
- eor3 $res1b, $ctr_t1b, $ctr5b, $t1.16b @ AES final-2 block - result
- pmull2 $rk4v.1q, $rk4v.2d, $h34k.2d @ GHASH final-3 block - mid
- pmull2 $rk2q1, $res0.2d, $h4.2d @ GHASH final-3 block - high
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-3 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-3 block - high
- .L128_enc_blocks_more_than_2: @ blocks left > 2
- st1 { $res1b}, [$output_ptr], #16 @ AES final-2 block - store result
- rev64 $res0b, $res1b @ GHASH final-2 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-1 block - load plaintext
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-2 block - mid
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-2 block - mid
- eor3 $res1b, $ctr_t1b, $ctr6b, $t1.16b @ AES final-1 block - result
- pmull2 $rk2q1, $res0.2d, $h3.2d @ GHASH final-2 block - high
- pmull $rk3q1, $res0.1d, $h3.1d @ GHASH final-2 block - low
- pmull $rk4v.1q, $rk4v.1d, $h34k.1d @ GHASH final-2 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-2 block - high
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-2 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-2 block - low
- .L128_enc_blocks_more_than_1: @ blocks left > 1
- st1 { $res1b}, [$output_ptr], #16 @ AES final-1 block - store result
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- rev64 $res0b, $res1b @ GHASH final-1 block
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final block - load plaintext
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- movi $t0.8b, #0 @ suppress further partial tag feed in
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-1 block - mid
- eor3 $res1b, $ctr_t1b, $ctr7b, $t1.16b @ AES final block - result
- pmull2 $rk2q1, $res0.2d, $h2.2d @ GHASH final-1 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-1 block - mid
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-1 block - mid
- pmull $rk3q1, $res0.1d, $h2.1d @ GHASH final-1 block - low
- pmull2 $rk4v.1q, $rk4v.2d, $h12k.2d @ GHASH final-1 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-1 block - high
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-1 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-1 block - low
- .L128_enc_blocks_less_than_1: @ blocks left <= 1
- rev32 $rtmp_ctr.16b, $rtmp_ctr.16b
- str $rtmp_ctrq, [$counter] @ store the updated counter
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- sub $bit_length, $bit_length, #128 @ bit_length -= 128
- neg $bit_length, $bit_length @ bit_length = 128 - #bits in input (in range [1,128])
- mvn $temp0_x, xzr @ temp0_x = 0xffffffffffffffff
- ld1 { $rk0}, [$output_ptr] @ load existing bytes where the possibly partial last block is to be stored
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- lsr $temp0_x, $temp0_x, $bit_length @ temp0_x is mask for top 64b of last block
- mvn $temp1_x, xzr @ temp1_x = 0xffffffffffffffff
- cmp $bit_length, #64
- csel $temp2_x, $temp1_x, $temp0_x, lt
- csel $temp3_x, $temp0_x, xzr, lt
- mov $ctr0.d[1], $temp3_x
- mov $ctr0.d[0], $temp2_x @ ctr0b is mask for last block
- and $res1b, $res1b, $ctr0b @ possibly partial last block has zeroes in highest bits
- rev64 $res0b, $res1b @ GHASH final block
- bif $res1b, $rk0, $ctr0b @ insert existing bytes in top end of result before storing
- st1 { $res1b}, [$output_ptr] @ store all 16B
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $t0.d[0], $res0.d[1] @ GHASH final block - mid
- eor $t0.8b, $t0.8b, $res0.8b @ GHASH final block - mid
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- pmull $t0.1q, $t0.1d, $h12k.1d @ GHASH final block - mid
- pmull2 $rk2q1, $res0.2d, $h1.2d @ GHASH final block - high
- eor $acc_mb, $acc_mb, $t0.16b @ GHASH final block - mid
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- pmull $rk3q1, $res0.1d, $h1.1d @ GHASH final block - low
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final block - high
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final block - low
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- eor3 $acc_lb, $acc_lb, $acc_hb, $t11.16b @ MODULO - fold into low
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- st1 { $acc_l.16b }, [$current_tag]
- mov x0, $byte_length
- ldp d10, d11, [sp, #16]
- ldp d12, d13, [sp, #32]
- ldp d14, d15, [sp, #48]
- ldp d8, d9, [sp], #80
- ret
- .L128_enc_ret:
- mov w0, #0x0
- ret
- .size unroll8_eor3_aes_gcm_enc_128_kernel,.-unroll8_eor3_aes_gcm_enc_128_kernel
- ___
- #########################################################################################
- # size_t unroll8_eor3_aes_gcm_dec_128_kernel(const uint8_t * ciphertext,
- # uint64_t plaintext_length,
- # uint8_t * plaintext,
- # uint64_t *Xi,
- # unsigned char ivec[16],
- # const void *key);
- #
- $code.=<<___;
- .global unroll8_eor3_aes_gcm_dec_128_kernel
- .type unroll8_eor3_aes_gcm_dec_128_kernel,%function
- .align 4
- unroll8_eor3_aes_gcm_dec_128_kernel:
- AARCH64_VALID_CALL_TARGET
- cbz x1, .L128_dec_ret
- stp d8, d9, [sp, #-80]!
- lsr $byte_length, $bit_length, #3
- mov $counter, x4
- mov $cc, x5
- stp d10, d11, [sp, #16]
- stp d12, d13, [sp, #32]
- stp d14, d15, [sp, #48]
- mov x5, #0xc200000000000000
- stp x5, xzr, [sp, #64]
- add $modulo_constant, sp, #64
- mov $main_end_input_ptr, $byte_length
- ld1 { $ctr0b}, [$counter] @ CTR block 0
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- sub $main_end_input_ptr, $main_end_input_ptr, #1 @ byte_len - 1
- mov $constant_temp, #0x100000000 @ set up counter increment
- movi $rctr_inc.16b, #0x0
- mov $rctr_inc.d[1], $constant_temp
- ld1 { $acc_lb}, [$current_tag]
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- rev32 $rtmp_ctr.16b, $ctr0.16b @ set up reversed counter
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 0
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 0
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 1
- and $main_end_input_ptr, $main_end_input_ptr, #0xffffffffffffff80 @ number of bytes to be processed in main loop (at least 1 byte must be handled by tail)
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 2
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 2
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 0
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 3
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 3
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 1
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 1
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 4
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 4
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 5
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 5
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 0
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 6
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 6
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 0
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 7
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 0
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 1
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 1
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 2
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 1
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 2
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 2
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 2
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 3
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 3
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 3
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 3
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 3
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 4
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 3
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 4
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 5
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 5
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 5
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 6
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 5
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 6
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 6
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 7
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 7
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 7
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 7
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 7
- add $main_end_input_ptr, $main_end_input_ptr, $input_ptr
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 7
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 8
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 8
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 8
- aese $ctr0b, $rk9 @ AES block 0 - round 9
- aese $ctr1b, $rk9 @ AES block 1 - round 9
- aese $ctr6b, $rk9 @ AES block 6 - round 9
- ldr $rk10q, [$cc, #160] @ load rk10
- aese $ctr4b, $rk9 @ AES block 4 - round 9
- aese $ctr3b, $rk9 @ AES block 3 - round 9
- aese $ctr2b, $rk9 @ AES block 2 - round 9
- aese $ctr5b, $rk9 @ AES block 5 - round 9
- aese $ctr7b, $rk9 @ AES block 7 - round 9
- add $end_input_ptr, $input_ptr, $bit_length, lsr #3 @ end_input_ptr
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- b.ge .L128_dec_tail @ handle tail
- ldp $res0q, $res1q, [$input_ptr], #32 @ AES block 0, 1 - load ciphertext
- eor3 $ctr0b, $res0b, $ctr0b, $rk10 @ AES block 0 - result
- eor3 $ctr1b, $res1b, $ctr1b, $rk10 @ AES block 1 - result
- stp $ctr0q, $ctr1q, [$output_ptr], #32 @ AES block 0, 1 - store result
- rev32 $ctr0.16b, $rtmp_ctr.16b @ CTR block 8
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8
- ldp $res2q, $res3q, [$input_ptr], #32 @ AES block 2, 3 - load ciphertext
- ldp $res4q, $res5q, [$input_ptr], #32 @ AES block 4, 5 - load ciphertext
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 9
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 9
- ldp $res6q, $res7q, [$input_ptr], #32 @ AES block 6, 7 - load ciphertext
- eor3 $ctr3b, $res3b, $ctr3b, $rk10 @ AES block 3 - result
- eor3 $ctr2b, $res2b, $ctr2b, $rk10 @ AES block 2 - result
- stp $ctr2q, $ctr3q, [$output_ptr], #32 @ AES block 2, 3 - store result
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 10
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 10
- eor3 $ctr6b, $res6b, $ctr6b, $rk10 @ AES block 6 - result
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 11
- eor3 $ctr4b, $res4b, $ctr4b, $rk10 @ AES block 4 - result
- eor3 $ctr5b, $res5b, $ctr5b, $rk10 @ AES block 5 - result
- stp $ctr4q, $ctr5q, [$output_ptr], #32 @ AES block 4, 5 - store result
- eor3 $ctr7b, $res7b, $ctr7b, $rk10 @ AES block 7 - result
- stp $ctr6q, $ctr7q, [$output_ptr], #32 @ AES block 6, 7 - store result
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 12
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 12
- b.ge .L128_dec_prepretail @ do prepretail
- .L128_dec_main_loop: @ main loop start
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- rev64 $res1b, $res1b @ GHASH block 8k+1
- rev64 $res0b, $res0b @ GHASH block 8k
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- rev64 $res6b, $res6b @ GHASH block 8k+6
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- eor $res0b, $res0b, $acc_lb @ PRE 1
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- rev64 $res2b, $res2b @ GHASH block 8k+2
- rev64 $res4b, $res4b @ GHASH block 8k+4
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- rev64 $res3b, $res3b @ GHASH block 8k+3
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- rev64 $res5b, $res5b @ GHASH block 8k+5
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- rev64 $res7b, $res7b @ GHASH block 8k+7
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- rev32 $h1.16b, $rtmp_ctr.16b @ CTR block 8k+16
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+16
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- rev32 $h2.16b, $rtmp_ctr.16b @ CTR block 8k+17
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+17
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- ldp $res0q, $res1q, [$input_ptr], #32 @ AES block 8k+8, 8k+9 - load ciphertext
- ldp $res2q, $res3q, [$input_ptr], #32 @ AES block 8k+10, 8k+11 - load ciphertext
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- rev32 $h3.16b, $rtmp_ctr.16b @ CTR block 8k+18
- ldp $res4q, $res5q, [$input_ptr], #32 @ AES block 8k+12, 8k+13 - load ciphertext
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- ldp $res6q, $res7q, [$input_ptr], #32 @ AES block 8k+14, 8k+15 - load ciphertext
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+18
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- aese $ctr0b, $rk9 @ AES block 8k+8 - round 9
- aese $ctr1b, $rk9 @ AES block 8k+9 - round 9
- ldr $rk10q, [$cc, #160] @ load rk10
- aese $ctr6b, $rk9 @ AES block 8k+14 - round 9
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- aese $ctr2b, $rk9 @ AES block 8k+10 - round 9
- aese $ctr7b, $rk9 @ AES block 8k+15 - round 9
- aese $ctr4b, $rk9 @ AES block 8k+12 - round 9
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- rev32 $h4.16b, $rtmp_ctr.16b @ CTR block 8k+19
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+19
- aese $ctr3b, $rk9 @ AES block 8k+11 - round 9
- aese $ctr5b, $rk9 @ AES block 8k+13 - round 9
- eor3 $ctr1b, $res1b, $ctr1b, $rk10 @ AES block 8k+9 - result
- eor3 $ctr0b, $res0b, $ctr0b, $rk10 @ AES block 8k+8 - result
- eor3 $ctr7b, $res7b, $ctr7b, $rk10 @ AES block 8k+15 - result
- eor3 $ctr6b, $res6b, $ctr6b, $rk10 @ AES block 8k+14 - result
- eor3 $ctr2b, $res2b, $ctr2b, $rk10 @ AES block 8k+10 - result
- stp $ctr0q, $ctr1q, [$output_ptr], #32 @ AES block 8k+8, 8k+9 - store result
- mov $ctr1.16b, $h2.16b @ CTR block 8k+17
- eor3 $ctr4b, $res4b, $ctr4b, $rk10 @ AES block 8k+12 - result
- eor3 $acc_lb, $acc_lb, $acc_hb, $t11.16b @ MODULO - fold into low
- mov $ctr0.16b, $h1.16b @ CTR block 8k+16
- eor3 $ctr3b, $res3b, $ctr3b, $rk10 @ AES block 8k+11 - result
- cmp $input_ptr, $main_end_input_ptr @ LOOP CONTROL
- stp $ctr2q, $ctr3q, [$output_ptr], #32 @ AES block 8k+10, 8k+11 - store result
- eor3 $ctr5b, $res5b, $ctr5b, $rk10 @ AES block 8k+13 - result
- mov $ctr2.16b, $h3.16b @ CTR block 8k+18
- stp $ctr4q, $ctr5q, [$output_ptr], #32 @ AES block 8k+12, 8k+13 - store result
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 8k+20
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+20
- stp $ctr6q, $ctr7q, [$output_ptr], #32 @ AES block 8k+14, 8k+15 - store result
- mov $ctr3.16b, $h4.16b @ CTR block 8k+19
- b.lt .L128_dec_main_loop
- .L128_dec_prepretail: @ PREPRETAIL
- rev64 $res3b, $res3b @ GHASH block 8k+3
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- rev64 $res0b, $res0b @ GHASH block 8k
- rev64 $res2b, $res2b @ GHASH block 8k+2
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- eor $res0b, $res0b, $acc_lb @ PRE 1
- rev64 $res1b, $res1b @ GHASH block 8k+1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- rev64 $res5b, $res5b @ GHASH block 8k+5
- rev64 $res4b, $res4b @ GHASH block 8k+4
- rev64 $res6b, $res6b @ GHASH block 8k+6
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- rev64 $res7b, $res7b @ GHASH block 8k+7
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- ldr $rk10q, [$cc, #160] @ load rk10
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr6b, $rk9 @ AES block 8k+14 - round 9
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- eor3 $acc_lb, $acc_lb, $acc_hb, $t11.16b @ MODULO - fold into low
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- aese $ctr2b, $rk9 @ AES block 8k+10 - round 9
- aese $ctr3b, $rk9 @ AES block 8k+11 - round 9
- aese $ctr5b, $rk9 @ AES block 8k+13 - round 9
- aese $ctr0b, $rk9 @ AES block 8k+8 - round 9
- aese $ctr4b, $rk9 @ AES block 8k+12 - round 9
- aese $ctr1b, $rk9 @ AES block 8k+9 - round 9
- aese $ctr7b, $rk9 @ AES block 8k+15 - round 9
- .L128_dec_tail: @ TAIL
- mov $t1.16b, $rk10
- sub $main_end_input_ptr, $end_input_ptr, $input_ptr @ main_end_input_ptr is number of bytes left to process
- cmp $main_end_input_ptr, #112
- ldp $h78kq, $h8q, [$current_tag, #192] @ load h8k | h7k
- ext $h8.16b, $h8.16b, $h8.16b, #8
- ldr $res1q, [$input_ptr], #16 @ AES block 8k+8 - load ciphertext
- ldp $h5q, $h56kq, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ext $t0.16b, $acc_lb, $acc_lb, #8 @ prepare final partial tag
- ldp $h6q, $h7q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- ext $h7.16b, $h7.16b, $h7.16b, #8
- eor3 $res4b, $res1b, $ctr0b, $t1.16b @ AES block 8k+8 - result
- b.gt .L128_dec_blocks_more_than_7
- cmp $main_end_input_ptr, #96
- mov $ctr7b, $ctr6b
- movi $acc_l.8b, #0
- movi $acc_h.8b, #0
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- mov $ctr3b, $ctr2b
- mov $ctr2b, $ctr1b
- movi $acc_m.8b, #0
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- b.gt .L128_dec_blocks_more_than_6
- cmp $main_end_input_ptr, #80
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- mov $ctr3b, $ctr1b
- b.gt .L128_dec_blocks_more_than_5
- cmp $main_end_input_ptr, #64
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr1b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- b.gt .L128_dec_blocks_more_than_4
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr1b
- cmp $main_end_input_ptr, #48
- b.gt .L128_dec_blocks_more_than_3
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr6b
- cmp $main_end_input_ptr, #32
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- mov $ctr6b, $ctr1b
- b.gt .L128_dec_blocks_more_than_2
- cmp $main_end_input_ptr, #16
- mov $ctr7b, $ctr1b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- b.gt L128_dec_blocks_more_than_1
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- b .L128_dec_blocks_less_than_1
- .L128_dec_blocks_more_than_7: @ blocks left > 7
- rev64 $res0b, $res1b @ GHASH final-7 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $acc_m.d[0], $h78k.d[1] @ GHASH final-7 block - mid
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH final-7 block - low
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-7 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- ldr $res1q, [$input_ptr], #16 @ AES final-6 block - load ciphertext
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-7 block - mid
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH final-7 block - high
- st1 { $res4b}, [$output_ptr], #16 @ AES final-7 block - store result
- eor3 $res4b, $res1b, $ctr1b, $t1.16b @ AES final-6 block - result
- pmull $acc_m.1q, $rk4v.1d, $acc_m.1d @ GHASH final-7 block - mid
- .L128_dec_blocks_more_than_6: @ blocks left > 6
- rev64 $res0b, $res1b @ GHASH final-6 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-6 block - mid
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-6 block - mid
- pmull $rk3q1, $res0.1d, $h7.1d @ GHASH final-6 block - low
- ldr $res1q, [$input_ptr], #16 @ AES final-5 block - load ciphertext
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull $rk4v.1q, $rk4v.1d, $h78k.1d @ GHASH final-6 block - mid
- st1 { $res4b}, [$output_ptr], #16 @ AES final-6 block - store result
- pmull2 $rk2q1, $res0.2d, $h7.2d @ GHASH final-6 block - high
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-6 block - low
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-6 block - high
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-6 block - mid
- eor3 $res4b, $res1b, $ctr2b, $t1.16b @ AES final-5 block - result
- .L128_dec_blocks_more_than_5: @ blocks left > 5
- rev64 $res0b, $res1b @ GHASH final-5 block
- ldr $res1q, [$input_ptr], #16 @ AES final-4 block - load ciphertext
- st1 { $res4b}, [$output_ptr], #16 @ AES final-5 block - store result
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-5 block - mid
- eor3 $res4b, $res1b, $ctr3b, $t1.16b @ AES final-4 block - result
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-5 block - mid
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-5 block - mid
- pmull $rk3q1, $res0.1d, $h6.1d @ GHASH final-5 block - low
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull2 $rk4v.1q, $rk4v.2d, $h56k.2d @ GHASH final-5 block - mid
- pmull2 $rk2q1, $res0.2d, $h6.2d @ GHASH final-5 block - high
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-5 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-5 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-5 block - high
- .L128_dec_blocks_more_than_4: @ blocks left > 4
- rev64 $res0b, $res1b @ GHASH final-4 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ldr $res1q, [$input_ptr], #16 @ AES final-3 block - load ciphertext
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-4 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull2 $rk2q1, $res0.2d, $h5.2d @ GHASH final-4 block - high
- pmull $rk3q1, $res0.1d, $h5.1d @ GHASH final-4 block - low
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-4 block - high
- st1 { $res4b}, [$output_ptr], #16 @ AES final-4 block - store result
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-4 block - mid
- eor3 $res4b, $res1b, $ctr4b, $t1.16b @ AES final-3 block - result
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-4 block - low
- pmull $rk4v.1q, $rk4v.1d, $h56k.1d @ GHASH final-4 block - mid
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-4 block - mid
- .L128_dec_blocks_more_than_3: @ blocks left > 3
- st1 { $res4b}, [$output_ptr], #16 @ AES final-3 block - store result
- rev64 $res0b, $res1b @ GHASH final-3 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-3 block - mid
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-3 block - mid
- ldr $res1q, [$input_ptr], #16 @ AES final-2 block - load ciphertext
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-3 block - mid
- pmull $rk3q1, $res0.1d, $h4.1d @ GHASH final-3 block - low
- pmull2 $rk2q1, $res0.2d, $h4.2d @ GHASH final-3 block - high
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor3 $res4b, $res1b, $ctr5b, $t1.16b @ AES final-2 block - result
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-3 block - low
- pmull2 $rk4v.1q, $rk4v.2d, $h34k.2d @ GHASH final-3 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-3 block - high
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-3 block - mid
- .L128_dec_blocks_more_than_2: @ blocks left > 2
- rev64 $res0b, $res1b @ GHASH final-2 block
- st1 { $res4b}, [$output_ptr], #16 @ AES final-2 block - store result
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- movi $t0.8b, #0 @ suppress further partial tag feed in
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-2 block - mid
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-2 block - mid
- pmull $rk3q1, $res0.1d, $h3.1d @ GHASH final-2 block - low
- pmull2 $rk2q1, $res0.2d, $h3.2d @ GHASH final-2 block - high
- pmull $rk4v.1q, $rk4v.1d, $h34k.1d @ GHASH final-2 block - mid
- ldr $res1q, [$input_ptr], #16 @ AES final-1 block - load ciphertext
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-2 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-2 block - low
- eor3 $res4b, $res1b, $ctr6b, $t1.16b @ AES final-1 block - result
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-2 block - high
- .L128_dec_blocks_more_than_1: @ blocks left > 1
- st1 { $res4b}, [$output_ptr], #16 @ AES final-1 block - store result
- rev64 $res0b, $res1b @ GHASH final-1 block
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- movi $t0.8b, #0 @ suppress further partial tag feed in
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-1 block - mid
- ldr $res1q, [$input_ptr], #16 @ AES final block - load ciphertext
- pmull2 $rk2q1, $res0.2d, $h2.2d @ GHASH final-1 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-1 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-1 block - high
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-1 block - mid
- eor3 $res4b, $res1b, $ctr7b, $t1.16b @ AES final block - result
- pmull $rk3q1, $res0.1d, $h2.1d @ GHASH final-1 block - low
- pmull2 $rk4v.1q, $rk4v.2d, $h12k.2d @ GHASH final-1 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-1 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-1 block - mid
- .L128_dec_blocks_less_than_1: @ blocks left <= 1
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- sub $bit_length, $bit_length, #128 @ bit_length -= 128
- neg $bit_length, $bit_length @ bit_length = 128 - #bits in input (in range [1,128])
- mvn $temp0_x, xzr @ temp0_x = 0xffffffffffffffff
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- lsr $temp0_x, $temp0_x, $bit_length @ temp0_x is mask for top 64b of last block
- cmp $bit_length, #64
- mvn $temp1_x, xzr @ temp1_x = 0xffffffffffffffff
- csel $temp2_x, $temp1_x, $temp0_x, lt
- csel $temp3_x, $temp0_x, xzr, lt
- mov $ctr0.d[1], $temp3_x
- mov $ctr0.d[0], $temp2_x @ ctr0b is mask for last block
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ld1 { $rk0}, [$output_ptr] @ load existing bytes where the possibly partial last block is to be stored
- and $res1b, $res1b, $ctr0b @ possibly partial last block has zeroes in highest bits
- rev64 $res0b, $res1b @ GHASH final block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- pmull2 $rk2q1, $res0.2d, $h1.2d @ GHASH final block - high
- ins $t0.d[0], $res0.d[1] @ GHASH final block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final block - high
- eor $t0.8b, $t0.8b, $res0.8b @ GHASH final block - mid
- bif $res4b, $rk0, $ctr0b @ insert existing bytes in top end of result before storing
- pmull $t0.1q, $t0.1d, $h12k.1d @ GHASH final block - mid
- st1 { $res4b}, [$output_ptr] @ store all 16B
- pmull $rk3q1, $res0.1d, $h1.1d @ GHASH final block - low
- eor $acc_mb, $acc_mb, $t0.16b @ GHASH final block - mid
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final block - low
- eor $t10.16b, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- pmull $t11.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- ext $acc_hb, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- eor $acc_mb, $acc_mb, $t10.16b @ MODULO - karatsuba tidy up
- eor3 $acc_mb, $acc_mb, $acc_hb, $t11.16b @ MODULO - fold into mid
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- ext $acc_mb, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- eor3 $acc_lb, $acc_lb, $acc_mb, $acc_hb @ MODULO - fold into low
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- st1 { $acc_l.16b }, [$current_tag]
- rev32 $rtmp_ctr.16b, $rtmp_ctr.16b
- str $rtmp_ctrq, [$counter] @ store the updated counter
- mov x0, $byte_length
- ldp d10, d11, [sp, #16]
- ldp d12, d13, [sp, #32]
- ldp d14, d15, [sp, #48]
- ldp d8, d9, [sp], #80
- ret
- .L128_dec_ret:
- mov w0, #0x0
- ret
- .size unroll8_eor3_aes_gcm_dec_128_kernel,.-unroll8_eor3_aes_gcm_dec_128_kernel
- ___
- }
- {
- my ($end_input_ptr,$main_end_input_ptr,$temp0_x,$temp1_x)=map("x$_",(4..7));
- my ($temp2_x,$temp3_x)=map("x$_",(13..14));
- my ($ctr0b,$ctr1b,$ctr2b,$ctr3b,$ctr4b,$ctr5b,$ctr6b,$ctr7b,$res0b,$res1b,$res2b,$res3b,$res4b,$res5b,$res6b,$res7b)=map("v$_.16b",(0..15));
- my ($ctr0,$ctr1,$ctr2,$ctr3,$ctr4,$ctr5,$ctr6,$ctr7,$res0,$res1,$res2,$res3,$res4,$res5,$res6,$res7)=map("v$_",(0..15));
- my ($ctr0d,$ctr1d,$ctr2d,$ctr3d,$ctr4d,$ctr5d,$ctr6d,$ctr7d)=map("d$_",(0..7));
- my ($ctr0q,$ctr1q,$ctr2q,$ctr3q,$ctr4q,$ctr5q,$ctr6q,$ctr7q)=map("q$_",(0..7));
- my ($res0q,$res1q,$res2q,$res3q,$res4q,$res5q,$res6q,$res7q)=map("q$_",(8..15));
- my ($ctr_t0,$ctr_t1,$ctr_t2,$ctr_t3,$ctr_t4,$ctr_t5,$ctr_t6,$ctr_t7)=map("v$_",(8..15));
- my ($ctr_t0b,$ctr_t1b,$ctr_t2b,$ctr_t3b,$ctr_t4b,$ctr_t5b,$ctr_t6b,$ctr_t7b)=map("v$_.16b",(8..15));
- my ($ctr_t0q,$ctr_t1q,$ctr_t2q,$ctr_t3q,$ctr_t4q,$ctr_t5q,$ctr_t6q,$ctr_t7q)=map("q$_",(8..15));
- my ($acc_hb,$acc_mb,$acc_lb)=map("v$_.16b",(17..19));
- my ($acc_h,$acc_m,$acc_l)=map("v$_",(17..19));
- my ($h1,$h12k,$h2,$h3,$h34k,$h4)=map("v$_",(20..25));
- my ($h5,$h56k,$h6,$h7,$h78k,$h8)=map("v$_",(20..25));
- my ($h1q,$h12kq,$h2q,$h3q,$h34kq,$h4q)=map("q$_",(20..25));
- my ($h5q,$h56kq,$h6q,$h7q,$h78kq,$h8q)=map("q$_",(20..25));
- my $t0="v16";
- my $t0d="d16";
- my $t1="v29";
- my $t2=$res1;
- my $t3=$t1;
- my $t4=$res0;
- my $t5=$res2;
- my $t6=$t0;
- my $t7=$res3;
- my $t8=$res4;
- my $t9=$res5;
- my $t10=$res6;
- my $t11="v21";
- my $t12=$t1;
- my $rtmp_ctr="v30";
- my $rtmp_ctrq="q30";
- my $rctr_inc="v31";
- my $rctr_incd="d31";
- my $mod_constantd=$t0d;
- my $mod_constant=$t0;
- my ($rk0,$rk1,$rk2)=map("v$_.16b",(26..28));
- my ($rk3,$rk4,$rk5)=map("v$_.16b",(26..28));
- my ($rk6,$rk7,$rk8)=map("v$_.16b",(26..28));
- my ($rk9,$rk10,$rk11)=map("v$_.16b",(26..28));
- my ($rk12,$rk13,$rk14)=map("v$_.16b",(26..28));
- my ($rk0q,$rk1q,$rk2q)=map("q$_",(26..28));
- my ($rk3q,$rk4q,$rk5q)=map("q$_",(26..28));
- my ($rk6q,$rk7q,$rk8q)=map("q$_",(26..28));
- my ($rk9q,$rk10q,$rk11q)=map("q$_",(26..28));
- my ($rk12q,$rk13q,$rk14q)=map("q$_",(26..28));
- my $rk2q1="v28.1q";
- my $rk3q1="v26.1q";
- my $rk4v="v27";
- #########################################################################################
- # size_t unroll8_eor3_aes_gcm_enc_192_kernel(const uint8_t * plaintext,
- # uint64_t plaintext_length,
- # uint8_t * ciphertext,
- # uint64_t *Xi,
- # unsigned char ivec[16],
- # const void *key);
- #
- $code.=<<___;
- .global unroll8_eor3_aes_gcm_enc_192_kernel
- .type unroll8_eor3_aes_gcm_enc_192_kernel,%function
- .align 4
- unroll8_eor3_aes_gcm_enc_192_kernel:
- AARCH64_VALID_CALL_TARGET
- cbz x1, .L192_enc_ret
- stp d8, d9, [sp, #-80]!
- lsr $byte_length, $bit_length, #3
- mov $counter, x4
- mov $cc, x5
- stp d10, d11, [sp, #16]
- stp d12, d13, [sp, #32]
- stp d14, d15, [sp, #48]
- mov x5, #0xc200000000000000
- stp x5, xzr, [sp, #64]
- add $modulo_constant, sp, #64
- mov $main_end_input_ptr, $byte_length
- ld1 { $ctr0b}, [$counter] @ CTR block 0
- mov $constant_temp, #0x100000000 @ set up counter increment
- movi $rctr_inc.16b, #0x0
- mov $rctr_inc.d[1], $constant_temp
- rev32 $rtmp_ctr.16b, $ctr0.16b @ set up reversed counter
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 0
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 1
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 2
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 2
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 3
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 3
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 4
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 4
- sub $main_end_input_ptr, $main_end_input_ptr, #1 @ byte_len - 1
- and $main_end_input_ptr, $main_end_input_ptr, #0xffffffffffffff80 @ number of bytes to be processed in main loop (at least 1 byte must be handled by tail)
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 5
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 5
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- add $main_end_input_ptr, $main_end_input_ptr, $input_ptr
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 6
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 6
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 7
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 0
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 1
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 1
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 1
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 1
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 2
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 1
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 1
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 2
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 2
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 3
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 3
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 3
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 3
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 3
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 4
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 3
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 4
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 5
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 5
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 5
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 5
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 7
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 6
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 6
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 6
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 7
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 7
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 7
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 7
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 7
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 8
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 8
- add $end_input_ptr, $input_ptr, $bit_length, lsr #3 @ end_input_ptr
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 9
- ld1 { $acc_lb}, [$current_tag]
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 9
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 9
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 9
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 9
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 9
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 9
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 14 - round 10
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 9
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 11 - round 10
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 9 - round 10
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 13 - round 10
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 12 - round 10
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 8 - round 10
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 10 - round 10
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 15 - round 10
- aese $ctr6b, $rk11 @ AES block 14 - round 11
- aese $ctr3b, $rk11 @ AES block 11 - round 11
- aese $ctr4b, $rk11 @ AES block 12 - round 11
- aese $ctr7b, $rk11 @ AES block 15 - round 11
- ldr $rk12q, [$cc, #192] @ load rk12
- aese $ctr1b, $rk11 @ AES block 9 - round 11
- aese $ctr5b, $rk11 @ AES block 13 - round 11
- aese $ctr2b, $rk11 @ AES block 10 - round 11
- aese $ctr0b, $rk11 @ AES block 8 - round 11
- b.ge .L192_enc_tail @ handle tail
- ldp $ctr_t0q, $ctr_t1q, [$input_ptr], #32 @ AES block 0, 1 - load plaintext
- ldp $ctr_t2q, $ctr_t3q, [$input_ptr], #32 @ AES block 2, 3 - load plaintext
- ldp $ctr_t4q, $ctr_t5q, [$input_ptr], #32 @ AES block 4, 5 - load plaintext
- ldp $ctr_t6q, $ctr_t7q, [$input_ptr], #32 @ AES block 6, 7 - load plaintext
- eor3 $res0b, $ctr_t0b, $ctr0b, $rk12 @ AES block 0 - result
- rev32 $ctr0.16b, $rtmp_ctr.16b @ CTR block 8
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8
- eor3 $res3b, $ctr_t3b, $ctr3b, $rk12 @ AES block 3 - result
- eor3 $res1b, $ctr_t1b, $ctr1b, $rk12 @ AES block 1 - result
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 9
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 9
- eor3 $res4b, $ctr_t4b, $ctr4b, $rk12 @ AES block 4 - result
- eor3 $res5b, $ctr_t5b, $ctr5b, $rk12 @ AES block 5 - result
- eor3 $res7b, $ctr_t7b, $ctr7b, $rk12 @ AES block 7 - result
- stp $res0q, $res1q, [$output_ptr], #32 @ AES block 0, 1 - store result
- eor3 $res2b, $ctr_t2b, $ctr2b, $rk12 @ AES block 2 - result
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 10
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 10
- stp $res2q, $res3q, [$output_ptr], #32 @ AES block 2, 3 - store result
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 11
- eor3 $res6b, $ctr_t6b, $ctr6b, $rk12 @ AES block 6 - result
- stp $res4q, $res5q, [$output_ptr], #32 @ AES block 4, 5 - store result
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 12
- stp $res6q, $res7q, [$output_ptr], #32 @ AES block 6, 7 - store result
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 12
- b.ge .L192_enc_prepretail @ do prepretail
- .L192_enc_main_loop: @ main loop start
- rev64 $res4b, $res4b @ GHASH block 8k+4 (t0, t1, and t2 free)
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- rev64 $res2b, $res2b @ GHASH block 8k+2
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- rev64 $res0b, $res0b @ GHASH block 8k
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- rev64 $res1b, $res1b @ GHASH block 8k+1
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- eor $res0b, $res0b, $acc_lb @ PRE 1
- rev64 $res3b, $res3b @ GHASH block 8k+3
- rev64 $res5b, $res5b @ GHASH block 8k+5 (t0, t1, t2 and t3 free)
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- rev64 $res7b, $res7b @ GHASH block 8k+7 (t0, t1, t2 and t3 free)
- rev64 $res6b, $res6b @ GHASH block 8k+6 (t0, t1, and t2 free)
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- rev32 $h1.16b, $rtmp_ctr.16b @ CTR block 8k+16
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+16
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 9
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 9
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 9
- ldp $ctr_t0q, $ctr_t1q, [$input_ptr], #32 @ AES block 8k+8, 8k+9 - load plaintext
- pmull $t11.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- rev32 $h2.16b, $rtmp_ctr.16b @ CTR block 8k+17
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 9
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 9
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 9
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 9
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 9
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+17
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 10
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 10
- ldr $rk12q, [$cc, #192] @ load rk12
- ext $t12.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 10
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 10
- ldp $ctr_t2q, $ctr_t3q, [$input_ptr], #32 @ AES block 8k+10, 8k+11 - load plaintext
- aese $ctr4b, $rk11 @ AES block 8k+12 - round 11
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- ldp $ctr_t4q, $ctr_t5q, [$input_ptr], #32 @ AES block 8k+12, 8k+13 - load plaintext
- ldp $ctr_t6q, $ctr_t7q, [$input_ptr], #32 @ AES block 8k+14, 8k+15 - load plaintext
- aese $ctr2b, $rk11 @ AES block 8k+10 - round 11
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 10
- rev32 $h3.16b, $rtmp_ctr.16b @ CTR block 8k+18
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 10
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 10
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 10
- aese $ctr5b, $rk11 @ AES block 8k+13 - round 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+18
- aese $ctr7b, $rk11 @ AES block 8k+15 - round 11
- aese $ctr0b, $rk11 @ AES block 8k+8 - round 11
- eor3 $res4b, $ctr_t4b, $ctr4b, $rk12 @ AES block 4 - result
- aese $ctr6b, $rk11 @ AES block 8k+14 - round 11
- aese $ctr3b, $rk11 @ AES block 8k+11 - round 11
- aese $ctr1b, $rk11 @ AES block 8k+9 - round 11
- rev32 $h4.16b, $rtmp_ctr.16b @ CTR block 8k+19
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+19
- eor3 $res7b, $ctr_t7b, $ctr7b, $rk12 @ AES block 7 - result
- eor3 $res2b, $ctr_t2b, $ctr2b, $rk12 @ AES block 8k+10 - result
- eor3 $res0b, $ctr_t0b, $ctr0b, $rk12 @ AES block 8k+8 - result
- mov $ctr2.16b, $h3.16b @ CTR block 8k+18
- eor3 $res1b, $ctr_t1b, $ctr1b, $rk12 @ AES block 8k+9 - result
- mov $ctr1.16b, $h2.16b @ CTR block 8k+17
- stp $res0q, $res1q, [$output_ptr], #32 @ AES block 8k+8, 8k+9 - store result
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- eor3 $res6b, $ctr_t6b, $ctr6b, $rk12 @ AES block 6 - result
- mov $ctr0.16b, $h1.16b @ CTR block 8k+16
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 8k+20
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+20
- eor3 $res5b, $ctr_t5b, $ctr5b, $rk12 @ AES block 5 - result
- eor3 $acc_lb, $acc_lb, $acc_hb, $t11.16b @ MODULO - fold into low
- eor3 $res3b, $ctr_t3b, $ctr3b, $rk12 @ AES block 8k+11 - result
- mov $ctr3.16b, $h4.16b @ CTR block 8k+19
- stp $res2q, $res3q, [$output_ptr], #32 @ AES block 8k+10, 8k+11 - store result
- stp $res4q, $res5q, [$output_ptr], #32 @ AES block 8k+12, 8k+13 - store result
- cmp $input_ptr, $main_end_input_ptr @ LOOP CONTROL
- stp $res6q, $res7q, [$output_ptr], #32 @ AES block 8k+14, 8k+15 - store result
- b.lt .L192_enc_main_loop
- .L192_enc_prepretail: @ PREPRETAIL
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- rev64 $res0b, $res0b @ GHASH block 8k
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- rev64 $res3b, $res3b @ GHASH block 8k+3
- rev64 $res2b, $res2b @ GHASH block 8k+2
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- eor $res0b, $res0b, $acc_lb @ PRE 1
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- rev64 $res1b, $res1b @ GHASH block 8k+1
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- rev64 $res5b, $res5b @ GHASH block 8k+5 (t0, t1, t2 and t3 free)
- rev64 $res6b, $res6b @ GHASH block 8k+6 (t0, t1, and t2 free)
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- rev64 $res4b, $res4b @ GHASH block 8k+4 (t0, t1, and t2 free)
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- rev64 $res7b, $res7b @ GHASH block 8k+7 (t0, t1, t2 and t3 free)
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- ext $t12.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- pmull $t11.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 9
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 9
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 9
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 9
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 9
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 9
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 9
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 9
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- ldr $rk12q, [$cc, #192] @ load rk12
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 10
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 10
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 10
- eor3 $acc_lb, $acc_lb, $acc_hb, $t11.16b @ MODULO - fold into low
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 10
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 10
- aese $ctr1b, $rk11 @ AES block 8k+9 - round 11
- aese $ctr7b, $rk11 @ AES block 8k+15 - round 11
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 10
- aese $ctr3b, $rk11 @ AES block 8k+11 - round 11
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 10
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 10
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- aese $ctr2b, $rk11 @ AES block 8k+10 - round 11
- aese $ctr0b, $rk11 @ AES block 8k+8 - round 11
- aese $ctr6b, $rk11 @ AES block 8k+14 - round 11
- aese $ctr4b, $rk11 @ AES block 8k+12 - round 11
- aese $ctr5b, $rk11 @ AES block 8k+13 - round 11
- .L192_enc_tail: @ TAIL
- ldp $h5q, $h56kq, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- sub $main_end_input_ptr, $end_input_ptr, $input_ptr @ main_end_input_ptr is number of bytes left to process
- ldr $ctr_t0q, [$input_ptr], #16 @ AES block 8k+8 - l3ad plaintext
- ldp $h78kq, $h8q, [$current_tag, #192] @ load h8k | h7k
- ext $h8.16b, $h8.16b, $h8.16b, #8
- mov $t1.16b, $rk12
- ldp $h6q, $h7q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- ext $h7.16b, $h7.16b, $h7.16b, #8
- cmp $main_end_input_ptr, #112
- eor3 $res1b, $ctr_t0b, $ctr0b, $t1.16b @ AES block 8k+8 - result
- ext $t0.16b, $acc_lb, $acc_lb, #8 @ prepare final partial tag
- b.gt .L192_enc_blocks_more_than_7
- cmp $main_end_input_ptr, #96
- mov $ctr7b, $ctr6b
- movi $acc_h.8b, #0
- mov $ctr6b, $ctr5b
- movi $acc_l.8b, #0
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- mov $ctr3b, $ctr2b
- mov $ctr2b, $ctr1b
- movi $acc_m.8b, #0
- b.gt .L192_enc_blocks_more_than_6
- mov $ctr7b, $ctr6b
- cmp $main_end_input_ptr, #80
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- mov $ctr3b, $ctr1b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- b.gt .L192_enc_blocks_more_than_5
- cmp $main_end_input_ptr, #64
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr1b
- b.gt .L192_enc_blocks_more_than_4
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr1b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- cmp $main_end_input_ptr, #48
- b.gt .L192_enc_blocks_more_than_3
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr1b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- cmp $main_end_input_ptr, #32
- b.gt .L192_enc_blocks_more_than_2
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- cmp $main_end_input_ptr, #16
- mov $ctr7b, $ctr1b
- b.gt .L192_enc_blocks_more_than_1
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- b .L192_enc_blocks_less_than_1
- .L192_enc_blocks_more_than_7: @ blocks left > 7
- st1 { $res1b}, [$output_ptr], #16 @ AES final-7 block - store result
- rev64 $res0b, $res1b @ GHASH final-7 block
- ins $acc_m.d[0], $h78k.d[1] @ GHASH final-7 block - mid
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-7 block - mid
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-6 block - load plaintext
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-7 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH final-7 block - low
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH final-7 block - high
- pmull $acc_m.1q, $rk4v.1d, $acc_m.1d @ GHASH final-7 block - mid
- eor3 $res1b, $ctr_t1b, $ctr1b, $t1.16b @ AES final-6 block - result
- .L192_enc_blocks_more_than_6: @ blocks left > 6
- st1 { $res1b}, [$output_ptr], #16 @ AES final-6 block - store result
- rev64 $res0b, $res1b @ GHASH final-6 block
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-5 block - load plaintext
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-6 block - mid
- pmull $rk3q1, $res0.1d, $h7.1d @ GHASH final-6 block - low
- eor3 $res1b, $ctr_t1b, $ctr2b, $t1.16b @ AES final-5 block - result
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull2 $rk2q1, $res0.2d, $h7.2d @ GHASH final-6 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-6 block - mid
- pmull $rk4v.1q, $rk4v.1d, $h78k.1d @ GHASH final-6 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-6 block - high
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-6 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-6 block - mid
- .L192_enc_blocks_more_than_5: @ blocks left > 5
- st1 { $res1b}, [$output_ptr], #16 @ AES final-5 block - store result
- rev64 $res0b, $res1b @ GHASH final-5 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-5 block - mid
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-4 block - load plaintext
- pmull2 $rk2q1, $res0.2d, $h6.2d @ GHASH final-5 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-5 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-5 block - high
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-5 block - mid
- pmull $rk3q1, $res0.1d, $h6.1d @ GHASH final-5 block - low
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-5 block - low
- pmull2 $rk4v.1q, $rk4v.2d, $h56k.2d @ GHASH final-5 block - mid
- eor3 $res1b, $ctr_t1b, $ctr3b, $t1.16b @ AES final-4 block - result
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-5 block - mid
- .L192_enc_blocks_more_than_4: @ blocks left > 4
- st1 { $res1b}, [$output_ptr], #16 @ AES final-4 block - store result
- rev64 $res0b, $res1b @ GHASH final-4 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-3 block - load plaintext
- pmull2 $rk2q1, $res0.2d, $h5.2d @ GHASH final-4 block - high
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-4 block - mid
- pmull $rk3q1, $res0.1d, $h5.1d @ GHASH final-4 block - low
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-4 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-4 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-4 block - low
- pmull $rk4v.1q, $rk4v.1d, $h56k.1d @ GHASH final-4 block - mid
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-4 block - mid
- eor3 $res1b, $ctr_t1b, $ctr4b, $t1.16b @ AES final-3 block - result
- .L192_enc_blocks_more_than_3: @ blocks left > 3
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- st1 { $res1b}, [$output_ptr], #16 @ AES final-3 block - store result
- rev64 $res0b, $res1b @ GHASH final-3 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- movi $t0.8b, #0 @ suppress further partial tag feed in
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-2 block - load plaintext
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-3 block - mid
- eor3 $res1b, $ctr_t1b, $ctr5b, $t1.16b @ AES final-2 block - result
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-3 block - mid
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-3 block - mid
- pmull $rk3q1, $res0.1d, $h4.1d @ GHASH final-3 block - low
- pmull2 $rk2q1, $res0.2d, $h4.2d @ GHASH final-3 block - high
- pmull2 $rk4v.1q, $rk4v.2d, $h34k.2d @ GHASH final-3 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-3 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-3 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-3 block - high
- .L192_enc_blocks_more_than_2: @ blocks left > 2
- st1 { $res1b}, [$output_ptr], #16 @ AES final-2 block - store result
- rev64 $res0b, $res1b @ GHASH final-2 block
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-1 block - load plaintext
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-2 block - mid
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-2 block - mid
- pmull $rk3q1, $res0.1d, $h3.1d @ GHASH final-2 block - low
- pmull2 $rk2q1, $res0.2d, $h3.2d @ GHASH final-2 block - high
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull $rk4v.1q, $rk4v.1d, $h34k.1d @ GHASH final-2 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-2 block - low
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-2 block - high
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-2 block - mid
- eor3 $res1b, $ctr_t1b, $ctr6b, $t1.16b @ AES final-1 block - result
- .L192_enc_blocks_more_than_1: @ blocks left > 1
- ldr $h2q, [$current_tag, #64] @ load h1l | h1h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- st1 { $res1b}, [$output_ptr], #16 @ AES final-1 block - store result
- rev64 $res0b, $res1b @ GHASH final-1 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-1 block - mid
- pmull $rk3q1, $res0.1d, $h2.1d @ GHASH final-1 block - low
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-1 block - low
- pmull2 $rk2q1, $res0.2d, $h2.2d @ GHASH final-1 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-1 block - mid
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final block - load plaintext
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-1 block - mid
- eor3 $res1b, $ctr_t1b, $ctr7b, $t1.16b @ AES final block - result
- pmull2 $rk4v.1q, $rk4v.2d, $h12k.2d @ GHASH final-1 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-1 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-1 block - high
- .L192_enc_blocks_less_than_1: @ blocks left <= 1
- mvn $temp0_x, xzr @ temp0_x = 0xffffffffffffffff
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- sub $bit_length, $bit_length, #128 @ bit_length -= 128
- neg $bit_length, $bit_length @ bit_length = 128 - #bits in input (in range [1,128])
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- lsr $temp0_x, $temp0_x, $bit_length @ temp0_x is mask for top 64b of last block
- cmp $bit_length, #64
- mvn $temp1_x, xzr @ temp1_x = 0xffffffffffffffff
- csel $temp2_x, $temp1_x, $temp0_x, lt
- csel $temp3_x, $temp0_x, xzr, lt
- mov $ctr0.d[1], $temp3_x
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ld1 { $rk0}, [$output_ptr] @ load existing bytes where the possibly partial last block is to be stored
- mov $ctr0.d[0], $temp2_x @ ctr0b is mask for last block
- and $res1b, $res1b, $ctr0b @ possibly partial last block has zeroes in highest bits
- rev64 $res0b, $res1b @ GHASH final block
- bif $res1b, $rk0, $ctr0b @ insert existing bytes in top end of result before storing
- st1 { $res1b}, [$output_ptr] @ store all 16B
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $t0.d[0], $res0.d[1] @ GHASH final block - mid
- pmull2 $rk2q1, $res0.2d, $h1.2d @ GHASH final block - high
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final block - high
- pmull $rk3q1, $res0.1d, $h1.1d @ GHASH final block - low
- eor $t0.8b, $t0.8b, $res0.8b @ GHASH final block - mid
- pmull $t0.1q, $t0.1d, $h12k.1d @ GHASH final block - mid
- eor $acc_mb, $acc_mb, $t0.16b @ GHASH final block - mid
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final block - low
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- rev32 $rtmp_ctr.16b, $rtmp_ctr.16b
- str $rtmp_ctrq, [$counter] @ store the updated counter
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- eor3 $acc_lb, $acc_lb, $acc_hb, $t11.16b @ MODULO - fold into low
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- st1 { $acc_l.16b }, [$current_tag]
- mov x0, $byte_length @ return sizes
- ldp d10, d11, [sp, #16]
- ldp d12, d13, [sp, #32]
- ldp d14, d15, [sp, #48]
- ldp d8, d9, [sp], #80
- ret
- .L192_enc_ret:
- mov w0, #0x0
- ret
- .size unroll8_eor3_aes_gcm_enc_192_kernel,.-unroll8_eor3_aes_gcm_enc_192_kernel
- ___
- #########################################################################################
- # size_t unroll8_eor3_aes_gcm_dec_192_kernel(const uint8_t * ciphertext,
- # uint64_t plaintext_length,
- # uint8_t * plaintext,
- # uint64_t *Xi,
- # unsigned char ivec[16],
- # const void *key);
- #
- $code.=<<___;
- .global unroll8_eor3_aes_gcm_dec_192_kernel
- .type unroll8_eor3_aes_gcm_dec_192_kernel,%function
- .align 4
- unroll8_eor3_aes_gcm_dec_192_kernel:
- AARCH64_VALID_CALL_TARGET
- cbz x1, .L192_dec_ret
- stp d8, d9, [sp, #-80]!
- lsr $byte_length, $bit_length, #3
- mov $counter, x4
- mov $cc, x5
- stp d10, d11, [sp, #16]
- stp d12, d13, [sp, #32]
- stp d14, d15, [sp, #48]
- mov x5, #0xc200000000000000
- stp x5, xzr, [sp, #64]
- add $modulo_constant, sp, #64
- mov $main_end_input_ptr, $byte_length
- ld1 { $ctr0b}, [$counter] @ CTR block 0
- ld1 { $acc_lb}, [$current_tag]
- mov $constant_temp, #0x100000000 @ set up counter increment
- movi $rctr_inc.16b, #0x0
- mov $rctr_inc.d[1], $constant_temp
- rev32 $rtmp_ctr.16b, $ctr0.16b @ set up reversed counter
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 0
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 1
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 2
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 2
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 3
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 3
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 4
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 4
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 5
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 5
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 6
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 6
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 7
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 0
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 1
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 1
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 1
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 1
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 2
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 1
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 2
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 2
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 3
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 3
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 3
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 3
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 3
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 3
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 4
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 5
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 4
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 5
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 5
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 5
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 5
- sub $main_end_input_ptr, $main_end_input_ptr, #1 @ byte_len - 1
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 6
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 6
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 7
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 7
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 7
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 7
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 7
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 8
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 8
- and $main_end_input_ptr, $main_end_input_ptr, #0xffffffffffffff80 @ number of bytes to be processed in main loop (at least 1 byte must be handled by tail)
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 8
- add $end_input_ptr, $input_ptr, $bit_length, lsr #3 @ end_input_ptr
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 9
- ld1 { $acc_lb}, [$current_tag]
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 9
- add $main_end_input_ptr, $main_end_input_ptr, $input_ptr
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 9
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 9
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 9
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 9
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 9
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 9
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 10
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 10
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 10
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 10
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 10
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 10
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 10
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 10
- ldr $rk12q, [$cc, #192] @ load rk12
- aese $ctr0b, $rk11 @ AES block 0 - round 11
- aese $ctr1b, $rk11 @ AES block 1 - round 11
- aese $ctr4b, $rk11 @ AES block 4 - round 11
- aese $ctr6b, $rk11 @ AES block 6 - round 11
- aese $ctr5b, $rk11 @ AES block 5 - round 11
- aese $ctr7b, $rk11 @ AES block 7 - round 11
- aese $ctr2b, $rk11 @ AES block 2 - round 11
- aese $ctr3b, $rk11 @ AES block 3 - round 11
- b.ge .L192_dec_tail @ handle tail
- ldp $res0q, $res1q, [$input_ptr], #32 @ AES block 0, 1 - load ciphertext
- ldp $res2q, $res3q, [$input_ptr], #32 @ AES block 2, 3 - load ciphertext
- ldp $res4q, $res5q, [$input_ptr], #32 @ AES block 4, 5 - load ciphertext
- eor3 $ctr1b, $res1b, $ctr1b, $rk12 @ AES block 1 - result
- eor3 $ctr0b, $res0b, $ctr0b, $rk12 @ AES block 0 - result
- stp $ctr0q, $ctr1q, [$output_ptr], #32 @ AES block 0, 1 - store result
- rev32 $ctr0.16b, $rtmp_ctr.16b @ CTR block 8
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 9
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 9
- eor3 $ctr3b, $res3b, $ctr3b, $rk12 @ AES block 3 - result
- eor3 $ctr2b, $res2b, $ctr2b, $rk12 @ AES block 2 - result
- stp $ctr2q, $ctr3q, [$output_ptr], #32 @ AES block 2, 3 - store result
- ldp $res6q, $res7q, [$input_ptr], #32 @ AES block 6, 7 - load ciphertext
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 10
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 10
- eor3 $ctr4b, $res4b, $ctr4b, $rk12 @ AES block 4 - result
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 11
- eor3 $ctr5b, $res5b, $ctr5b, $rk12 @ AES block 5 - result
- stp $ctr4q, $ctr5q, [$output_ptr], #32 @ AES block 4, 5 - store result
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- eor3 $ctr6b, $res6b, $ctr6b, $rk12 @ AES block 6 - result
- eor3 $ctr7b, $res7b, $ctr7b, $rk12 @ AES block 7 - result
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 12
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 12
- stp $ctr6q, $ctr7q, [$output_ptr], #32 @ AES block 6, 7 - store result
- b.ge .L192_dec_prepretail @ do prepretail
- .L192_dec_main_loop: @ main loop start
- rev64 $res1b, $res1b @ GHASH block 8k+1
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- rev64 $res0b, $res0b @ GHASH block 8k
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- rev64 $res4b, $res4b @ GHASH block 8k+4
- rev64 $res3b, $res3b @ GHASH block 8k+3
- eor $res0b, $res0b, $acc_lb @ PRE 1
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- rev64 $res5b, $res5b @ GHASH block 8k+5
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- rev64 $res2b, $res2b @ GHASH block 8k+2
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- rev64 $res7b, $res7b @ GHASH block 8k+7
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- rev64 $res6b, $res6b @ GHASH block 8k+6
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- rev32 $h1.16b, $rtmp_ctr.16b @ CTR block 8k+16
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+16
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 9
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 9
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 9
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 9
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- ldp $res0q, $res1q, [$input_ptr], #32 @ AES block 8k+8, 8k+9 - load ciphertext
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 9
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 9
- ldp $res2q, $res3q, [$input_ptr], #32 @ AES block 8k+10, 8k+11 - load ciphertext
- rev32 $h2.16b, $rtmp_ctr.16b @ CTR block 8k+17
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+17
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 9
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 9
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 10
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 10
- ldp $res4q, $res5q, [$input_ptr], #32 @ AES block 8k+12, 8k+13 - load ciphertext
- rev32 $h3.16b, $rtmp_ctr.16b @ CTR block 8k+18
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+18
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 10
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 10
- ldr $rk12q, [$cc, #192] @ load rk12
- ldp $res6q, $res7q, [$input_ptr], #32 @ AES block 8k+14, 8k+15 - load ciphertext
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 10
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 10
- aese $ctr0b, $rk11 @ AES block 8k+8 - round 11
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- aese $ctr1b, $rk11 @ AES block 8k+9 - round 11
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 10
- aese $ctr6b, $rk11 @ AES block 8k+14 - round 11
- aese $ctr3b, $rk11 @ AES block 8k+11 - round 11
- eor3 $ctr0b, $res0b, $ctr0b, $rk12 @ AES block 8k+8 - result
- rev32 $h4.16b, $rtmp_ctr.16b @ CTR block 8k+19
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 10
- aese $ctr4b, $rk11 @ AES block 8k+12 - round 11
- aese $ctr2b, $rk11 @ AES block 8k+10 - round 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+19
- aese $ctr7b, $rk11 @ AES block 8k+15 - round 11
- aese $ctr5b, $rk11 @ AES block 8k+13 - round 11
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- eor3 $ctr1b, $res1b, $ctr1b, $rk12 @ AES block 8k+9 - result
- stp $ctr0q, $ctr1q, [$output_ptr], #32 @ AES block 8k+8, 8k+9 - store result
- eor3 $ctr3b, $res3b, $ctr3b, $rk12 @ AES block 8k+11 - result
- eor3 $ctr2b, $res2b, $ctr2b, $rk12 @ AES block 8k+10 - result
- eor3 $ctr7b, $res7b, $ctr7b, $rk12 @ AES block 8k+15 - result
- stp $ctr2q, $ctr3q, [$output_ptr], #32 @ AES block 8k+10, 8k+11 - store result
- eor3 $ctr5b, $res5b, $ctr5b, $rk12 @ AES block 8k+13 - result
- eor3 $acc_lb, $acc_lb, $acc_hb, $t11.16b @ MODULO - fold into low
- mov $ctr3.16b, $h4.16b @ CTR block 8k+19
- eor3 $ctr4b, $res4b, $ctr4b, $rk12 @ AES block 8k+12 - result
- stp $ctr4q, $ctr5q, [$output_ptr], #32 @ AES block 8k+12, 8k+13 - store result
- cmp $input_ptr, $main_end_input_ptr @ LOOP CONTROL
- eor3 $ctr6b, $res6b, $ctr6b, $rk12 @ AES block 8k+14 - result
- stp $ctr6q, $ctr7q, [$output_ptr], #32 @ AES block 8k+14, 8k+15 - store result
- mov $ctr0.16b, $h1.16b @ CTR block 8k+16
- mov $ctr1.16b, $h2.16b @ CTR block 8k+17
- mov $ctr2.16b, $h3.16b @ CTR block 8k+18
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 8k+20
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+20
- b.lt .L192_dec_main_loop
- .L192_dec_prepretail: @ PREPRETAIL
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- rev64 $res0b, $res0b @ GHASH block 8k
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- rev64 $res3b, $res3b @ GHASH block 8k+3
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- eor $res0b, $res0b, $acc_lb @ PRE 1
- rev64 $res2b, $res2b @ GHASH block 8k+2
- rev64 $res1b, $res1b @ GHASH block 8k+1
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- rev64 $res5b, $res5b @ GHASH block 8k+5
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- rev64 $res7b, $res7b @ GHASH block 8k+7
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- rev64 $res4b, $res4b @ GHASH block 8k+4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- rev64 $res6b, $res6b @ GHASH block 8k+6
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 9
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 9
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 9
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 9
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 9
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 9
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 9
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 9
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- ldr $rk12q, [$cc, #192] @ load rk12
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 10
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 10
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 10
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 10
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 10
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 10
- aese $ctr0b, $rk11 @ AES block 8k+8 - round 11
- eor3 $acc_lb, $acc_lb, $acc_hb, $t11.16b @ MODULO - fold into low
- aese $ctr5b, $rk11 @ AES block 8k+13 - round 11
- aese $ctr2b, $rk11 @ AES block 8k+10 - round 11
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 10
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 10
- aese $ctr6b, $rk11 @ AES block 8k+14 - round 11
- aese $ctr4b, $rk11 @ AES block 8k+12 - round 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- aese $ctr3b, $rk11 @ AES block 8k+11 - round 11
- aese $ctr1b, $rk11 @ AES block 8k+9 - round 11
- aese $ctr7b, $rk11 @ AES block 8k+15 - round 11
- .L192_dec_tail: @ TAIL
- sub $main_end_input_ptr, $end_input_ptr, $input_ptr @ main_end_input_ptr is number of bytes left to process
- ldp $h5q, $h56kq, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $res1q, [$input_ptr], #16 @ AES block 8k+8 - load ciphertext
- ldp $h78kq, $h8q, [$current_tag, #192] @ load h8k | h7k
- ext $h8.16b, $h8.16b, $h8.16b, #8
- mov $t1.16b, $rk12
- ldp $h6q, $h7q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ext $t0.16b, $acc_lb, $acc_lb, #8 @ prepare final partial tag
- eor3 $res4b, $res1b, $ctr0b, $t1.16b @ AES block 8k+8 - result
- cmp $main_end_input_ptr, #112
- b.gt .L192_dec_blocks_more_than_7
- mov $ctr7b, $ctr6b
- movi $acc_h.8b, #0
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- cmp $main_end_input_ptr, #96
- movi $acc_l.8b, #0
- mov $ctr3b, $ctr2b
- mov $ctr2b, $ctr1b
- movi $acc_m.8b, #0
- b.gt .L192_dec_blocks_more_than_6
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- mov $ctr3b, $ctr1b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- cmp $main_end_input_ptr, #80
- b.gt .L192_dec_blocks_more_than_5
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr1b
- cmp $main_end_input_ptr, #64
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- b.gt .L192_dec_blocks_more_than_4
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr1b
- cmp $main_end_input_ptr, #48
- b.gt .L192_dec_blocks_more_than_3
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr6b
- cmp $main_end_input_ptr, #32
- mov $ctr6b, $ctr1b
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- b.gt .L192_dec_blocks_more_than_2
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr1b
- cmp $main_end_input_ptr, #16
- b.gt .L192_dec_blocks_more_than_1
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- b .L192_dec_blocks_less_than_1
- .L192_dec_blocks_more_than_7: @ blocks left > 7
- rev64 $res0b, $res1b @ GHASH final-7 block
- ins $acc_m.d[0], $h78k.d[1] @ GHASH final-7 block - mid
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH final-7 block - high
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-7 block - mid
- ldr $res1q, [$input_ptr], #16 @ AES final-6 block - load ciphertext
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH final-7 block - low
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-7 block - mid
- st1 { $res4b}, [$output_ptr], #16 @ AES final-7 block - store result
- eor3 $res4b, $res1b, $ctr1b, $t1.16b @ AES final-6 block - result
- pmull $acc_m.1q, $rk4v.1d, $acc_m.1d @ GHASH final-7 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- .L192_dec_blocks_more_than_6: @ blocks left > 6
- rev64 $res0b, $res1b @ GHASH final-6 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ldr $res1q, [$input_ptr], #16 @ AES final-5 block - load ciphertext
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-6 block - mid
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-6 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull2 $rk2q1, $res0.2d, $h7.2d @ GHASH final-6 block - high
- st1 { $res4b}, [$output_ptr], #16 @ AES final-6 block - store result
- eor3 $res4b, $res1b, $ctr2b, $t1.16b @ AES final-5 block - result
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-6 block - high
- pmull $rk4v.1q, $rk4v.1d, $h78k.1d @ GHASH final-6 block - mid
- pmull $rk3q1, $res0.1d, $h7.1d @ GHASH final-6 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-6 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-6 block - low
- .L192_dec_blocks_more_than_5: @ blocks left > 5
- rev64 $res0b, $res1b @ GHASH final-5 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-5 block - mid
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-5 block - mid
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-5 block - mid
- pmull2 $rk2q1, $res0.2d, $h6.2d @ GHASH final-5 block - high
- ldr $res1q, [$input_ptr], #16 @ AES final-4 block - load ciphertext
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-5 block - high
- pmull $rk3q1, $res0.1d, $h6.1d @ GHASH final-5 block - low
- pmull2 $rk4v.1q, $rk4v.2d, $h56k.2d @ GHASH final-5 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-5 block - low
- movi $t0.8b, #0 @ suppress further partial tag feed in
- st1 { $res4b}, [$output_ptr], #16 @ AES final-5 block - store result
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-5 block - mid
- eor3 $res4b, $res1b, $ctr3b, $t1.16b @ AES final-4 block - result
- .L192_dec_blocks_more_than_4: @ blocks left > 4
- rev64 $res0b, $res1b @ GHASH final-4 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- movi $t0.8b, #0 @ suppress further partial tag feed in
- ldr $res1q, [$input_ptr], #16 @ AES final-3 block - load ciphertext
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-4 block - mid
- pmull $rk3q1, $res0.1d, $h5.1d @ GHASH final-4 block - low
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-4 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-4 block - low
- pmull $rk4v.1q, $rk4v.1d, $h56k.1d @ GHASH final-4 block - mid
- st1 { $res4b}, [$output_ptr], #16 @ AES final-4 block - store result
- pmull2 $rk2q1, $res0.2d, $h5.2d @ GHASH final-4 block - high
- eor3 $res4b, $res1b, $ctr4b, $t1.16b @ AES final-3 block - result
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-4 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-4 block - high
- .L192_dec_blocks_more_than_3: @ blocks left > 3
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- rev64 $res0b, $res1b @ GHASH final-3 block
- ldr $res1q, [$input_ptr], #16 @ AES final-2 block - load ciphertext
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-3 block - mid
- pmull2 $rk2q1, $res0.2d, $h4.2d @ GHASH final-3 block - high
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-3 block - high
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull $rk3q1, $res0.1d, $h4.1d @ GHASH final-3 block - low
- st1 { $res4b}, [$output_ptr], #16 @ AES final-3 block - store result
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-3 block - mid
- eor3 $res4b, $res1b, $ctr5b, $t1.16b @ AES final-2 block - result
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-3 block - low
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-3 block - mid
- pmull2 $rk4v.1q, $rk4v.2d, $h34k.2d @ GHASH final-3 block - mid
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-3 block - mid
- .L192_dec_blocks_more_than_2: @ blocks left > 2
- rev64 $res0b, $res1b @ GHASH final-2 block
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-2 block - mid
- ldr $res1q, [$input_ptr], #16 @ AES final-1 block - load ciphertext
- pmull2 $rk2q1, $res0.2d, $h3.2d @ GHASH final-2 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-2 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-2 block - high
- pmull $rk3q1, $res0.1d, $h3.1d @ GHASH final-2 block - low
- pmull $rk4v.1q, $rk4v.1d, $h34k.1d @ GHASH final-2 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-2 block - low
- st1 { $res4b}, [$output_ptr], #16 @ AES final-2 block - store result
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-2 block - mid
- eor3 $res4b, $res1b, $ctr6b, $t1.16b @ AES final-1 block - result
- .L192_dec_blocks_more_than_1: @ blocks left > 1
- rev64 $res0b, $res1b @ GHASH final-1 block
- ldr $res1q, [$input_ptr], #16 @ AES final block - load ciphertext
- ldr $h2q, [$current_tag, #64] @ load h1l | h1h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- movi $t0.8b, #0 @ suppress further partial tag feed in
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- pmull $rk3q1, $res0.1d, $h2.1d @ GHASH final-1 block - low
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-1 block - mid
- st1 { $res4b}, [$output_ptr], #16 @ AES final-1 block - store result
- pmull2 $rk2q1, $res0.2d, $h2.2d @ GHASH final-1 block - high
- eor3 $res4b, $res1b, $ctr7b, $t1.16b @ AES final block - result
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-1 block - mid
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-1 block - mid
- pmull2 $rk4v.1q, $rk4v.2d, $h12k.2d @ GHASH final-1 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-1 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-1 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-1 block - high
- .L192_dec_blocks_less_than_1: @ blocks left <= 1
- rev32 $rtmp_ctr.16b, $rtmp_ctr.16b
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- sub $bit_length, $bit_length, #128 @ bit_length -= 128
- str $rtmp_ctrq, [$counter] @ store the updated counter
- neg $bit_length, $bit_length @ bit_length = 128 - #bits in input (in range [1,128])
- mvn $temp0_x, xzr @ temp0_x = 0xffffffffffffffff
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- mvn $temp1_x, xzr @ temp1_x = 0xffffffffffffffff
- lsr $temp0_x, $temp0_x, $bit_length @ temp0_x is mask for top 64b of last block
- cmp $bit_length, #64
- csel $temp2_x, $temp1_x, $temp0_x, lt
- csel $temp3_x, $temp0_x, xzr, lt
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- mov $ctr0.d[1], $temp3_x
- ld1 { $rk0}, [$output_ptr] @ load existing bytes where the possibly partial last block is to be stored
- mov $ctr0.d[0], $temp2_x @ ctr0b is mask for last block
- and $res1b, $res1b, $ctr0b @ possibly partial last block has zeroes in highest bits
- bif $res4b, $rk0, $ctr0b @ insert existing bytes in top end of result before storing
- rev64 $res0b, $res1b @ GHASH final block
- st1 { $res4b}, [$output_ptr] @ store all 16B
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $t0.d[0], $res0.d[1] @ GHASH final block - mid
- pmull $rk3q1, $res0.1d, $h1.1d @ GHASH final block - low
- eor $t0.8b, $t0.8b, $res0.8b @ GHASH final block - mid
- pmull2 $rk2q1, $res0.2d, $h1.2d @ GHASH final block - high
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final block - low
- pmull $t0.1q, $t0.1d, $h12k.1d @ GHASH final block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final block - high
- eor $t10.16b, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- eor $acc_mb, $acc_mb, $t0.16b @ GHASH final block - mid
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- pmull $t11.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- ext $acc_hb, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- eor $acc_mb, $acc_mb, $t10.16b @ MODULO - karatsuba tidy up
- eor3 $acc_mb, $acc_mb, $acc_hb, $t11.16b @ MODULO - fold into mid
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- ext $acc_mb, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- eor3 $acc_lb, $acc_lb, $acc_mb, $acc_hb @ MODULO - fold into low
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- st1 { $acc_l.16b }, [$current_tag]
- mov x0, $byte_length
- ldp d10, d11, [sp, #16]
- ldp d12, d13, [sp, #32]
- ldp d14, d15, [sp, #48]
- ldp d8, d9, [sp], #80
- ret
- .L192_dec_ret:
- mov w0, #0x0
- ret
- .size unroll8_eor3_aes_gcm_dec_192_kernel,.-unroll8_eor3_aes_gcm_dec_192_kernel
- ___
- }
- {
- my ($end_input_ptr,$main_end_input_ptr,$temp0_x,$temp1_x)=map("x$_",(4..7));
- my ($temp2_x,$temp3_x)=map("x$_",(13..14));
- my ($ctr0b,$ctr1b,$ctr2b,$ctr3b,$ctr4b,$ctr5b,$ctr6b,$ctr7b,$res0b,$res1b,$res2b,$res3b,$res4b,$res5b,$res6b,$res7b)=map("v$_.16b",(0..15));
- my ($ctr0,$ctr1,$ctr2,$ctr3,$ctr4,$ctr5,$ctr6,$ctr7,$res0,$res1,$res2,$res3,$res4,$res5,$res6,$res7)=map("v$_",(0..15));
- my ($ctr0d,$ctr1d,$ctr2d,$ctr3d,$ctr4d,$ctr5d,$ctr6d,$ctr7d)=map("d$_",(0..7));
- my ($ctr0q,$ctr1q,$ctr2q,$ctr3q,$ctr4q,$ctr5q,$ctr6q,$ctr7q)=map("q$_",(0..7));
- my ($res0q,$res1q,$res2q,$res3q,$res4q,$res5q,$res6q,$res7q)=map("q$_",(8..15));
- my ($ctr_t0,$ctr_t1,$ctr_t2,$ctr_t3,$ctr_t4,$ctr_t5,$ctr_t6,$ctr_t7)=map("v$_",(8..15));
- my ($ctr_t0b,$ctr_t1b,$ctr_t2b,$ctr_t3b,$ctr_t4b,$ctr_t5b,$ctr_t6b,$ctr_t7b)=map("v$_.16b",(8..15));
- my ($ctr_t0q,$ctr_t1q,$ctr_t2q,$ctr_t3q,$ctr_t4q,$ctr_t5q,$ctr_t6q,$ctr_t7q)=map("q$_",(8..15));
- my ($acc_hb,$acc_mb,$acc_lb)=map("v$_.16b",(17..19));
- my ($acc_h,$acc_m,$acc_l)=map("v$_",(17..19));
- my ($h1,$h12k,$h2,$h3,$h34k,$h4)=map("v$_",(20..25));
- my ($h5,$h56k,$h6,$h7,$h78k,$h8)=map("v$_",(20..25));
- my ($h1q,$h12kq,$h2q,$h3q,$h34kq,$h4q)=map("q$_",(20..25));
- my ($h5q,$h56kq,$h6q,$h7q,$h78kq,$h8q)=map("q$_",(20..25));
- my $t0="v16";
- my $t0d="d16";
- my $t1="v29";
- my $t2=$res1;
- my $t3=$t1;
- my $t4=$res0;
- my $t5=$res2;
- my $t6=$t0;
- my $t7=$res3;
- my $t8=$res4;
- my $t9=$res5;
- my $t10=$res6;
- my $t11="v21";
- my $t12=$t1;
- my $rtmp_ctr="v30";
- my $rtmp_ctrq="q30";
- my $rctr_inc="v31";
- my $rctr_incd="d31";
- my $mod_constantd=$t0d;
- my $mod_constant=$t0;
- my ($rk0,$rk1,$rk2)=map("v$_.16b",(26..28));
- my ($rk3,$rk4,$rk5)=map("v$_.16b",(26..28));
- my ($rk6,$rk7,$rk8)=map("v$_.16b",(26..28));
- my ($rk9,$rk10,$rk11)=map("v$_.16b",(26..28));
- my ($rk12,$rk13,$rk14)=map("v$_.16b",(26..28));
- my ($rk0q,$rk1q,$rk2q)=map("q$_",(26..28));
- my ($rk3q,$rk4q,$rk5q)=map("q$_",(26..28));
- my ($rk6q,$rk7q,$rk8q)=map("q$_",(26..28));
- my ($rk9q,$rk10q,$rk11q)=map("q$_",(26..28));
- my ($rk12q,$rk13q,$rk14q)=map("q$_",(26..28));
- my $rk2q1="v28.1q";
- my $rk3q1="v26.1q";
- my $rk4v="v27";
- #########################################################################################
- # size_t unroll8_eor3_aes_gcm_enc_256_kernel(const uint8_t * plaintext,
- # uint64_t plaintext_length,
- # uint8_t * ciphertext,
- # uint64_t *Xi,
- # unsigned char ivec[16],
- # const void *key);
- #
- $code.=<<___;
- .global unroll8_eor3_aes_gcm_enc_256_kernel
- .type unroll8_eor3_aes_gcm_enc_256_kernel,%function
- .align 4
- unroll8_eor3_aes_gcm_enc_256_kernel:
- AARCH64_VALID_CALL_TARGET
- cbz x1, .L256_enc_ret
- stp d8, d9, [sp, #-80]!
- lsr $byte_length, $bit_length, #3
- mov $counter, x4
- mov $cc, x5
- stp d10, d11, [sp, #16]
- stp d12, d13, [sp, #32]
- stp d14, d15, [sp, #48]
- mov x5, #0xc200000000000000
- stp x5, xzr, [sp, #64]
- add $modulo_constant, sp, #64
- ld1 { $ctr0b}, [$counter] @ CTR block 0
- mov $main_end_input_ptr, $byte_length
- mov $constant_temp, #0x100000000 @ set up counter increment
- movi $rctr_inc.16b, #0x0
- mov $rctr_inc.d[1], $constant_temp
- sub $main_end_input_ptr, $main_end_input_ptr, #1 @ byte_len - 1
- and $main_end_input_ptr, $main_end_input_ptr, #0xffffffffffffff80 @ number of bytes to be processed in main loop (at least 1 byte must be handled by tail)
- add $main_end_input_ptr, $main_end_input_ptr, $input_ptr
- rev32 $rtmp_ctr.16b, $ctr0.16b @ set up reversed counter
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 0
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 1
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 2
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 2
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 3
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 3
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 4
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 4
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 5
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 5
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 6
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 6
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 7
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 0
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 1
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 1
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 1
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 1
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 1
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 2
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 1
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 2
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 2
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 2
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 3
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 3
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 3
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 3
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 3
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 3
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 4
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 5
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 5
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 5
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 5
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 6
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 6
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 6
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 7
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 7
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 7
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 7
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 8
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 8
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 8
- ld1 { $acc_lb}, [$current_tag]
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 9
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 9
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 9
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 9
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 9
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 9
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 9
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 10
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 10
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 9
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 10
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 10
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 10
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 10
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 10
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 10
- aese $ctr4b, $rk11 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 11
- ldp $rk12q, $rk13q, [$cc, #192] @ load rk12, rk13
- aese $ctr5b, $rk11 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 11
- aese $ctr2b, $rk11 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 11
- aese $ctr6b, $rk11 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 11
- aese $ctr1b, $rk11 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 11
- aese $ctr0b, $rk11 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 11
- aese $ctr3b, $rk11 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 11
- aese $ctr7b, $rk11 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 7
- ldr $rk14q, [$cc, #224] @ load rk14
- aese $ctr4b, $rk12 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 12
- aese $ctr2b, $rk12 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 12
- aese $ctr1b, $rk12 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 12
- aese $ctr0b, $rk12 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 12
- aese $ctr5b, $rk12 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 12
- aese $ctr3b, $rk12 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 12
- aese $ctr2b, $rk13 @ AES block 2 - round 13
- aese $ctr1b, $rk13 @ AES block 1 - round 13
- aese $ctr4b, $rk13 @ AES block 4 - round 13
- aese $ctr6b, $rk12 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 12
- aese $ctr7b, $rk12 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 12
- aese $ctr0b, $rk13 @ AES block 0 - round 13
- aese $ctr5b, $rk13 @ AES block 5 - round 13
- aese $ctr6b, $rk13 @ AES block 6 - round 13
- aese $ctr7b, $rk13 @ AES block 7 - round 13
- aese $ctr3b, $rk13 @ AES block 3 - round 13
- add $end_input_ptr, $input_ptr, $bit_length, lsr #3 @ end_input_ptr
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- b.ge .L256_enc_tail @ handle tail
- ldp $ctr_t0q, $ctr_t1q, [$input_ptr], #32 @ AES block 0, 1 - load plaintext
- ldp $ctr_t2q, $ctr_t3q, [$input_ptr], #32 @ AES block 2, 3 - load plaintext
- eor3 $res0b, $ctr_t0b, $ctr0b, $rk14 @ AES block 0 - result
- rev32 $ctr0.16b, $rtmp_ctr.16b @ CTR block 8
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8
- eor3 $res1b, $ctr_t1b, $ctr1b, $rk14 @ AES block 1 - result
- eor3 $res3b, $ctr_t3b, $ctr3b, $rk14 @ AES block 3 - result
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 9
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 9
- ldp $ctr_t4q, $ctr_t5q, [$input_ptr], #32 @ AES block 4, 5 - load plaintext
- ldp $ctr_t6q, $ctr_t7q, [$input_ptr], #32 @ AES block 6, 7 - load plaintext
- eor3 $res2b, $ctr_t2b, $ctr2b, $rk14 @ AES block 2 - result
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 10
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 10
- stp $res0q, $res1q, [$output_ptr], #32 @ AES block 0, 1 - store result
- stp $res2q, $res3q, [$output_ptr], #32 @ AES block 2, 3 - store result
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 11
- eor3 $res4b, $ctr_t4b, $ctr4b, $rk14 @ AES block 4 - result
- eor3 $res7b, $ctr_t7b, $ctr7b, $rk14 @ AES block 7 - result
- eor3 $res6b, $ctr_t6b, $ctr6b, $rk14 @ AES block 6 - result
- eor3 $res5b, $ctr_t5b, $ctr5b, $rk14 @ AES block 5 - result
- stp $res4q, $res5q, [$output_ptr], #32 @ AES block 4, 5 - store result
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 12
- stp $res6q, $res7q, [$output_ptr], #32 @ AES block 6, 7 - store result
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 12
- b.ge .L256_enc_prepretail @ do prepretail
- .L256_enc_main_loop: @ main loop start
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- rev64 $res3b, $res3b @ GHASH block 8k+3
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- rev64 $res1b, $res1b @ GHASH block 8k+1
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- rev64 $res0b, $res0b @ GHASH block 8k
- rev64 $res4b, $res4b @ GHASH block 8k+4
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- eor $res0b, $res0b, $acc_lb @ PRE 1
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- rev64 $res6b, $res6b @ GHASH block 8k+6
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- rev64 $res2b, $res2b @ GHASH block 8k+2
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- rev64 $res5b, $res5b @ GHASH block 8k+5
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- rev64 $res7b, $res7b @ GHASH block 8k+7
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 9
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 9
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 9
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 9
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 9
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 9
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 9
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 9
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 10
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 10
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 10
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 10
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 10
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 10
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 10
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 10
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- ldp $rk12q, $rk13q, [$cc, #192] @ load rk12, rk13
- rev32 $h1.16b, $rtmp_ctr.16b @ CTR block 8k+16
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- ldp $ctr_t0q, $ctr_t1q, [$input_ptr], #32 @ AES block 8k+8, 8k+9 - load plaintext
- aese $ctr2b, $rk11 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 11
- aese $ctr6b, $rk11 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+16
- aese $ctr3b, $rk11 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 11
- aese $ctr0b, $rk11 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 11
- aese $ctr7b, $rk11 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 11
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- aese $ctr1b, $rk11 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 11
- aese $ctr7b, $rk12 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 12
- aese $ctr5b, $rk11 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 11
- aese $ctr3b, $rk12 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 12
- aese $ctr6b, $rk12 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 12
- rev32 $h2.16b, $rtmp_ctr.16b @ CTR block 8k+17
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+17
- aese $ctr4b, $rk11 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 11
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- aese $ctr5b, $rk12 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 12
- ldr $rk14q, [$cc, #224] @ load rk14
- aese $ctr7b, $rk13 @ AES block 8k+15 - round 13
- ldp $ctr_t2q, $ctr_t3q, [$input_ptr], #32 @ AES block 8k+10, 8k+11 - load plaintext
- aese $ctr2b, $rk12 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 12
- aese $ctr4b, $rk12 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 12
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- aese $ctr1b, $rk12 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 12
- ldp $ctr_t4q, $ctr_t5q, [$input_ptr], #32 @ AES block 4, 5 - load plaintext
- ldp $ctr_t6q, $ctr_t7q, [$input_ptr], #32 @ AES block 6, 7 - load plaintext
- aese $ctr2b, $rk13 @ AES block 8k+10 - round 13
- aese $ctr4b, $rk13 @ AES block 8k+12 - round 13
- rev32 $h3.16b, $rtmp_ctr.16b @ CTR block 8k+18
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+18
- aese $ctr5b, $rk13 @ AES block 8k+13 - round 13
- aese $ctr0b, $rk12 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 12
- aese $ctr3b, $rk13 @ AES block 8k+11 - round 13
- cmp $input_ptr, $main_end_input_ptr @ LOOP CONTROL
- eor3 $res2b, $ctr_t2b, $ctr2b, $rk14 @ AES block 8k+10 - result
- rev32 $h4.16b, $rtmp_ctr.16b @ CTR block 8k+19
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+19
- aese $ctr0b, $rk13 @ AES block 8k+8 - round 13
- aese $ctr6b, $rk13 @ AES block 8k+14 - round 13
- eor3 $res5b, $ctr_t5b, $ctr5b, $rk14 @ AES block 5 - result
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- aese $ctr1b, $rk13 @ AES block 8k+9 - round 13
- eor3 $res4b, $ctr_t4b, $ctr4b, $rk14 @ AES block 4 - result
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 8k+20
- eor3 $res3b, $ctr_t3b, $ctr3b, $rk14 @ AES block 8k+11 - result
- mov $ctr3.16b, $h4.16b @ CTR block 8k+19
- eor3 $res1b, $ctr_t1b, $ctr1b, $rk14 @ AES block 8k+9 - result
- eor3 $res0b, $ctr_t0b, $ctr0b, $rk14 @ AES block 8k+8 - result
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+20
- stp $res0q, $res1q, [$output_ptr], #32 @ AES block 8k+8, 8k+9 - store result
- mov $ctr2.16b, $h3.16b @ CTR block 8k+18
- eor3 $res7b, $ctr_t7b, $ctr7b, $rk14 @ AES block 7 - result
- eor3 $acc_lb, $acc_lb, $t11.16b, $acc_hb @ MODULO - fold into low
- stp $res2q, $res3q, [$output_ptr], #32 @ AES block 8k+10, 8k+11 - store result
- eor3 $res6b, $ctr_t6b, $ctr6b, $rk14 @ AES block 6 - result
- mov $ctr1.16b, $h2.16b @ CTR block 8k+17
- stp $res4q, $res5q, [$output_ptr], #32 @ AES block 4, 5 - store result
- stp $res6q, $res7q, [$output_ptr], #32 @ AES block 6, 7 - store result
- mov $ctr0.16b, $h1.16b @ CTR block 8k+16
- b.lt .L256_enc_main_loop
- .L256_enc_prepretail: @ PREPRETAIL
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- rev64 $res2b, $res2b @ GHASH block 8k+2
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- rev64 $res5b, $res5b @ GHASH block 8k+5
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- rev64 $res0b, $res0b @ GHASH block 8k
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- rev64 $res1b, $res1b @ GHASH block 8k+1
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- eor $res0b, $res0b, $acc_lb @ PRE 1
- rev64 $res3b, $res3b @ GHASH block 8k+3
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- rev64 $res6b, $res6b @ GHASH block 8k+6
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- rev64 $res4b, $res4b @ GHASH block 8k+4
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- rev64 $res7b, $res7b @ GHASH block 8k+7
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 9
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 9
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 9
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 9
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 9
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 9
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 9
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 10
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 10
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 9
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 10
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 10
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 10
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 10
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 10
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 10
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- aese $ctr7b, $rk11 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 11
- ldp $rk12q, $rk13q, [$cc, #192] @ load rk12, rk13
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- aese $ctr2b, $rk11 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 11
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- aese $ctr1b, $rk11 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 11
- aese $ctr6b, $rk11 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 11
- aese $ctr0b, $rk11 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 11
- aese $ctr4b, $rk11 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 11
- aese $ctr5b, $rk11 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 11
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- aese $ctr3b, $rk11 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 11
- ldr $rk14q, [$cc, #224] @ load rk14
- aese $ctr1b, $rk12 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 12
- aese $ctr2b, $rk12 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 12
- aese $ctr0b, $rk12 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 12
- aese $ctr6b, $rk12 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 12
- aese $ctr5b, $rk12 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 12
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- aese $ctr4b, $rk12 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 12
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- aese $ctr3b, $rk12 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 12
- aese $ctr7b, $rk12 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 12
- aese $ctr0b, $rk13 @ AES block 8k+8 - round 13
- eor3 $acc_lb, $acc_lb, $t11.16b, $acc_hb @ MODULO - fold into low
- aese $ctr5b, $rk13 @ AES block 8k+13 - round 13
- aese $ctr1b, $rk13 @ AES block 8k+9 - round 13
- aese $ctr3b, $rk13 @ AES block 8k+11 - round 13
- aese $ctr4b, $rk13 @ AES block 8k+12 - round 13
- aese $ctr7b, $rk13 @ AES block 8k+15 - round 13
- aese $ctr2b, $rk13 @ AES block 8k+10 - round 13
- aese $ctr6b, $rk13 @ AES block 8k+14 - round 13
- .L256_enc_tail: @ TAIL
- ldp $h78kq, $h8q, [$current_tag, #192] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- sub $main_end_input_ptr, $end_input_ptr, $input_ptr @ main_end_input_ptr is number of bytes left to process
- ldr $ctr_t0q, [$input_ptr], #16 @ AES block 8k+8 - load plaintext
- ldp $h5q, $h56kq, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ext $t0.16b, $acc_lb, $acc_lb, #8 @ prepare final partial tag
- ldp $h6q, $h7q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- ext $h7.16b, $h7.16b, $h7.16b, #8
- mov $t1.16b, $rk14
- cmp $main_end_input_ptr, #112
- eor3 $res1b, $ctr_t0b, $ctr0b, $t1.16b @ AES block 8k+8 - result
- b.gt .L256_enc_blocks_more_than_7
- movi $acc_l.8b, #0
- mov $ctr7b, $ctr6b
- movi $acc_h.8b, #0
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- mov $ctr3b, $ctr2b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr2b, $ctr1b
- movi $acc_m.8b, #0
- cmp $main_end_input_ptr, #96
- b.gt .L256_enc_blocks_more_than_6
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- cmp $main_end_input_ptr, #80
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- mov $ctr3b, $ctr1b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- b.gt .L256_enc_blocks_more_than_5
- mov $ctr7b, $ctr6b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- cmp $main_end_input_ptr, #64
- mov $ctr4b, $ctr1b
- b.gt .L256_enc_blocks_more_than_4
- cmp $main_end_input_ptr, #48
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr1b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- b.gt .L256_enc_blocks_more_than_3
- cmp $main_end_input_ptr, #32
- mov $ctr7b, $ctr6b
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- mov $ctr6b, $ctr1b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- b.gt .L256_enc_blocks_more_than_2
- mov $ctr7b, $ctr1b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- cmp $main_end_input_ptr, #16
- b.gt .L256_enc_blocks_more_than_1
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- b .L256_enc_blocks_less_than_1
- .L256_enc_blocks_more_than_7: @ blocks left > 7
- st1 { $res1b}, [$output_ptr], #16 @ AES final-7 block - store result
- rev64 $res0b, $res1b @ GHASH final-7 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-6 block - load plaintext
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH final-7 block - high
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-7 block - mid
- ins $acc_m.d[0], $h78k.d[1] @ GHASH final-7 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-7 block - mid
- eor3 $res1b, $ctr_t1b, $ctr1b, $t1.16b @ AES final-6 block - result
- pmull $acc_m.1q, $rk4v.1d, $acc_m.1d @ GHASH final-7 block - mid
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH final-7 block - low
- .L256_enc_blocks_more_than_6: @ blocks left > 6
- st1 { $res1b}, [$output_ptr], #16 @ AES final-6 block - store result
- rev64 $res0b, $res1b @ GHASH final-6 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- pmull $rk3q1, $res0.1d, $h7.1d @ GHASH final-6 block - low
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-6 block - mid
- pmull2 $rk2q1, $res0.2d, $h7.2d @ GHASH final-6 block - high
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-5 block - load plaintext
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-6 block - low
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-6 block - mid
- pmull $rk4v.1q, $rk4v.1d, $h78k.1d @ GHASH final-6 block - mid
- eor3 $res1b, $ctr_t1b, $ctr2b, $t1.16b @ AES final-5 block - result
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-6 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-6 block - high
- .L256_enc_blocks_more_than_5: @ blocks left > 5
- st1 { $res1b}, [$output_ptr], #16 @ AES final-5 block - store result
- rev64 $res0b, $res1b @ GHASH final-5 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-5 block - mid
- pmull2 $rk2q1, $res0.2d, $h6.2d @ GHASH final-5 block - high
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-5 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-5 block - mid
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-5 block - mid
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-4 block - load plaintext
- pmull $rk3q1, $res0.1d, $h6.1d @ GHASH final-5 block - low
- pmull2 $rk4v.1q, $rk4v.2d, $h56k.2d @ GHASH final-5 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-5 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-5 block - mid
- eor3 $res1b, $ctr_t1b, $ctr3b, $t1.16b @ AES final-4 block - result
- .L256_enc_blocks_more_than_4: @ blocks left > 4
- st1 { $res1b}, [$output_ptr], #16 @ AES final-4 block - store result
- rev64 $res0b, $res1b @ GHASH final-4 block
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-3 block - load plaintext
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-4 block - mid
- pmull2 $rk2q1, $res0.2d, $h5.2d @ GHASH final-4 block - high
- eor3 $res1b, $ctr_t1b, $ctr4b, $t1.16b @ AES final-3 block - result
- pmull $rk3q1, $res0.1d, $h5.1d @ GHASH final-4 block - low
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-4 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-4 block - low
- pmull $rk4v.1q, $rk4v.1d, $h56k.1d @ GHASH final-4 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-4 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-4 block - high
- .L256_enc_blocks_more_than_3: @ blocks left > 3
- st1 { $res1b}, [$output_ptr], #16 @ AES final-3 block - store result
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- rev64 $res0b, $res1b @ GHASH final-3 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-3 block - mid
- pmull2 $rk2q1, $res0.2d, $h4.2d @ GHASH final-3 block - high
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-3 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-3 block - mid
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-3 block - mid
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-2 block - load plaintext
- pmull2 $rk4v.1q, $rk4v.2d, $h34k.2d @ GHASH final-3 block - mid
- pmull $rk3q1, $res0.1d, $h4.1d @ GHASH final-3 block - low
- eor3 $res1b, $ctr_t1b, $ctr5b, $t1.16b @ AES final-2 block - result
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-3 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-3 block - low
- .L256_enc_blocks_more_than_2: @ blocks left > 2
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- st1 { $res1b}, [$output_ptr], #16 @ AES final-2 block - store result
- rev64 $res0b, $res1b @ GHASH final-2 block
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final-1 block - load plaintext
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-2 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull2 $rk2q1, $res0.2d, $h3.2d @ GHASH final-2 block - high
- eor3 $res1b, $ctr_t1b, $ctr6b, $t1.16b @ AES final-1 block - result
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-2 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-2 block - high
- pmull $rk4v.1q, $rk4v.1d, $h34k.1d @ GHASH final-2 block - mid
- pmull $rk3q1, $res0.1d, $h3.1d @ GHASH final-2 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-2 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-2 block - low
- .L256_enc_blocks_more_than_1: @ blocks left > 1
- st1 { $res1b}, [$output_ptr], #16 @ AES final-1 block - store result
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- rev64 $res0b, $res1b @ GHASH final-1 block
- ldr $ctr_t1q, [$input_ptr], #16 @ AES final block - load plaintext
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- movi $t0.8b, #0 @ suppress further partial tag feed in
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-1 block - mid
- pmull2 $rk2q1, $res0.2d, $h2.2d @ GHASH final-1 block - high
- eor3 $res1b, $ctr_t1b, $ctr7b, $t1.16b @ AES final block - result
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-1 block - high
- pmull $rk3q1, $res0.1d, $h2.1d @ GHASH final-1 block - low
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-1 block - mid
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-1 block - low
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-1 block - mid
- pmull2 $rk4v.1q, $rk4v.2d, $h12k.2d @ GHASH final-1 block - mid
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-1 block - mid
- .L256_enc_blocks_less_than_1: @ blocks left <= 1
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- sub $bit_length, $bit_length, #128 @ bit_length -= 128
- neg $bit_length, $bit_length @ bit_length = 128 - #bits in input (in range [1,128])
- mvn $temp0_x, xzr @ temp0_x = 0xffffffffffffffff
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- lsr $temp0_x, $temp0_x, $bit_length @ temp0_x is mask for top 64b of last block
- cmp $bit_length, #64
- mvn $temp1_x, xzr @ temp1_x = 0xffffffffffffffff
- csel $temp3_x, $temp0_x, xzr, lt
- csel $temp2_x, $temp1_x, $temp0_x, lt
- mov $ctr0.d[0], $temp2_x @ ctr0b is mask for last block
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ld1 { $rk0}, [$output_ptr] @ load existing bytes where the possibly partial last block is to be stored
- mov $ctr0.d[1], $temp3_x
- and $res1b, $res1b, $ctr0b @ possibly partial last block has zeroes in highest bits
- rev64 $res0b, $res1b @ GHASH final block
- rev32 $rtmp_ctr.16b, $rtmp_ctr.16b
- bif $res1b, $rk0, $ctr0b @ insert existing bytes in top end of result before storing
- str $rtmp_ctrq, [$counter] @ store the updated counter
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- st1 { $res1b}, [$output_ptr] @ store all 16B
- ins $t0.d[0], $res0.d[1] @ GHASH final block - mid
- pmull2 $rk2q1, $res0.2d, $h1.2d @ GHASH final block - high
- pmull $rk3q1, $res0.1d, $h1.1d @ GHASH final block - low
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final block - high
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final block - low
- eor $t0.8b, $t0.8b, $res0.8b @ GHASH final block - mid
- pmull $t0.1q, $t0.1d, $h12k.1d @ GHASH final block - mid
- eor $acc_mb, $acc_mb, $t0.16b @ GHASH final block - mid
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- eor3 $acc_lb, $acc_lb, $acc_hb, $t11.16b @ MODULO - fold into low
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- st1 { $acc_l.16b }, [$current_tag]
- mov x0, $byte_length @ return sizes
- ldp d10, d11, [sp, #16]
- ldp d12, d13, [sp, #32]
- ldp d14, d15, [sp, #48]
- ldp d8, d9, [sp], #80
- ret
- .L256_enc_ret:
- mov w0, #0x0
- ret
- .size unroll8_eor3_aes_gcm_enc_256_kernel,.-unroll8_eor3_aes_gcm_enc_256_kernel
- ___
- {
- #########################################################################################
- # size_t unroll8_eor3_aes_gcm_dec_256_kernel(const uint8_t * ciphertext,
- # uint64_t plaintext_length,
- # uint8_t * plaintext,
- # uint64_t *Xi,
- # unsigned char ivec[16],
- # const void *key);
- #
- $code.=<<___;
- .global unroll8_eor3_aes_gcm_dec_256_kernel
- .type unroll8_eor3_aes_gcm_dec_256_kernel,%function
- .align 4
- unroll8_eor3_aes_gcm_dec_256_kernel:
- AARCH64_VALID_CALL_TARGET
- cbz x1, .L256_dec_ret
- stp d8, d9, [sp, #-80]!
- lsr $byte_length, $bit_length, #3
- mov $counter, x4
- mov $cc, x5
- stp d10, d11, [sp, #16]
- stp d12, d13, [sp, #32]
- stp d14, d15, [sp, #48]
- mov x5, #0xc200000000000000
- stp x5, xzr, [sp, #64]
- add $modulo_constant, sp, #64
- ld1 { $ctr0b}, [$counter] @ CTR block 0
- mov $constant_temp, #0x100000000 @ set up counter increment
- movi $rctr_inc.16b, #0x0
- mov $rctr_inc.d[1], $constant_temp
- mov $main_end_input_ptr, $byte_length
- sub $main_end_input_ptr, $main_end_input_ptr, #1 @ byte_len - 1
- rev32 $rtmp_ctr.16b, $ctr0.16b @ set up reversed counter
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 0
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 1
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 2
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 2
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 3
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 3
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 4
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 4
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 0
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 5
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 5
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 0
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 6
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 6
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 7
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 1
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 1
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 1
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 1
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 2
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 2
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 2
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 2
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 3
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 3
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 3
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 3
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 3
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 3
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 3
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 4
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 4
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 4
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 5
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 5
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 5
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 5
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 5
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 6
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 6
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 6
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 7
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 7
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 7
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 7
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 7
- and $main_end_input_ptr, $main_end_input_ptr, #0xffffffffffffff80 @ number of bytes to be processed in main loop (at least 1 byte must be handled by tail)
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 8
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 8
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 9
- ld1 { $acc_lb}, [$current_tag]
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- add $end_input_ptr, $input_ptr, $bit_length, lsr #3 @ end_input_ptr
- add $main_end_input_ptr, $main_end_input_ptr, $input_ptr
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 9
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 9
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 9
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 9
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 9
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 9
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 9
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 10
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 10
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 10
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 10
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 10
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 10
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 10
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 10
- ldp $rk12q, $rk13q, [$cc, #192] @ load rk12, rk13
- aese $ctr0b, $rk11 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 7
- aese $ctr7b, $rk11 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 11
- aese $ctr3b, $rk11 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 11
- aese $ctr1b, $rk11 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 11
- aese $ctr5b, $rk11 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 11
- aese $ctr4b, $rk11 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 11
- aese $ctr2b, $rk11 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 11
- aese $ctr6b, $rk11 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 11
- ldr $rk14q, [$cc, #224] @ load rk14
- aese $ctr1b, $rk12 \n aesmc $ctr1b, $ctr1b @ AES block 1 - round 12
- aese $ctr4b, $rk12 \n aesmc $ctr4b, $ctr4b @ AES block 4 - round 12
- aese $ctr5b, $rk12 \n aesmc $ctr5b, $ctr5b @ AES block 5 - round 12
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- aese $ctr3b, $rk12 \n aesmc $ctr3b, $ctr3b @ AES block 3 - round 12
- aese $ctr2b, $rk12 \n aesmc $ctr2b, $ctr2b @ AES block 2 - round 12
- aese $ctr6b, $rk12 \n aesmc $ctr6b, $ctr6b @ AES block 6 - round 12
- aese $ctr0b, $rk12 \n aesmc $ctr0b, $ctr0b @ AES block 0 - round 12
- aese $ctr7b, $rk12 \n aesmc $ctr7b, $ctr7b @ AES block 7 - round 12
- aese $ctr5b, $rk13 @ AES block 5 - round 13
- aese $ctr1b, $rk13 @ AES block 1 - round 13
- aese $ctr2b, $rk13 @ AES block 2 - round 13
- aese $ctr0b, $rk13 @ AES block 0 - round 13
- aese $ctr4b, $rk13 @ AES block 4 - round 13
- aese $ctr6b, $rk13 @ AES block 6 - round 13
- aese $ctr3b, $rk13 @ AES block 3 - round 13
- aese $ctr7b, $rk13 @ AES block 7 - round 13
- b.ge .L256_dec_tail @ handle tail
- ldp $res0q, $res1q, [$input_ptr], #32 @ AES block 0, 1 - load ciphertext
- ldp $res2q, $res3q, [$input_ptr], #32 @ AES block 2, 3 - load ciphertext
- ldp $res4q, $res5q, [$input_ptr], #32 @ AES block 4, 5 - load ciphertext
- ldp $res6q, $res7q, [$input_ptr], #32 @ AES block 6, 7 - load ciphertext
- cmp $input_ptr, $main_end_input_ptr @ check if we have <= 8 blocks
- eor3 $ctr1b, $res1b, $ctr1b, $rk14 @ AES block 1 - result
- eor3 $ctr0b, $res0b, $ctr0b, $rk14 @ AES block 0 - result
- stp $ctr0q, $ctr1q, [$output_ptr], #32 @ AES block 0, 1 - store result
- rev32 $ctr0.16b, $rtmp_ctr.16b @ CTR block 8
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8
- eor3 $ctr3b, $res3b, $ctr3b, $rk14 @ AES block 3 - result
- eor3 $ctr5b, $res5b, $ctr5b, $rk14 @ AES block 5 - result
- eor3 $ctr4b, $res4b, $ctr4b, $rk14 @ AES block 4 - result
- rev32 $ctr1.16b, $rtmp_ctr.16b @ CTR block 9
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 9
- eor3 $ctr2b, $res2b, $ctr2b, $rk14 @ AES block 2 - result
- stp $ctr2q, $ctr3q, [$output_ptr], #32 @ AES block 2, 3 - store result
- rev32 $ctr2.16b, $rtmp_ctr.16b @ CTR block 10
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 10
- eor3 $ctr6b, $res6b, $ctr6b, $rk14 @ AES block 6 - result
- rev32 $ctr3.16b, $rtmp_ctr.16b @ CTR block 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 11
- stp $ctr4q, $ctr5q, [$output_ptr], #32 @ AES block 4, 5 - store result
- eor3 $ctr7b, $res7b, $ctr7b, $rk14 @ AES block 7 - result
- stp $ctr6q, $ctr7q, [$output_ptr], #32 @ AES block 6, 7 - store result
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 12
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 12
- b.ge .L256_dec_prepretail @ do prepretail
- .L256_dec_main_loop: @ main loop start
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- rev64 $res1b, $res1b @ GHASH block 8k+1
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- rev64 $res0b, $res0b @ GHASH block 8k
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- rev64 $res4b, $res4b @ GHASH block 8k+4
- rev64 $res3b, $res3b @ GHASH block 8k+3
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- rev64 $res7b, $res7b @ GHASH block 8k+7
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- eor $res0b, $res0b, $acc_lb @ PRE 1
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- rev64 $res2b, $res2b @ GHASH block 8k+2
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- rev64 $res5b, $res5b @ GHASH block 8k+5
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- rev64 $res6b, $res6b @ GHASH block 8k+6
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 9
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 9
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 9
- ldp $res0q, $res1q, [$input_ptr], #32 @ AES block 8k+8, 8k+9 - load ciphertext
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 9
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 9
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 9
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 10
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 10
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 9
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 9
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 10
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 10
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 10
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 10
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 10
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 10
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- rev32 $h1.16b, $rtmp_ctr.16b @ CTR block 8k+16
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+16
- aese $ctr1b, $rk11 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 11
- ldp $rk12q, $rk13q, [$cc, #192] @ load rk12, rk13
- aese $ctr0b, $rk11 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 11
- aese $ctr6b, $rk11 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 11
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- rev32 $h2.16b, $rtmp_ctr.16b @ CTR block 8k+17
- aese $ctr2b, $rk11 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 11
- ldp $res2q, $res3q, [$input_ptr], #32 @ AES block 8k+10, 8k+11 - load ciphertext
- aese $ctr7b, $rk11 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 11
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- aese $ctr5b, $rk11 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 11
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+17
- aese $ctr3b, $rk11 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 11
- aese $ctr2b, $rk12 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 12
- aese $ctr7b, $rk12 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 12
- aese $ctr6b, $rk12 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 12
- rev32 $h3.16b, $rtmp_ctr.16b @ CTR block 8k+18
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+18
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- aese $ctr1b, $rk12 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 12
- aese $ctr4b, $rk11 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 11
- ldr $rk14q, [$cc, #224] @ load rk14
- aese $ctr5b, $rk12 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 12
- aese $ctr3b, $rk12 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 12
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- aese $ctr0b, $rk12 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 12
- aese $ctr4b, $rk12 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 12
- ldp $res4q, $res5q, [$input_ptr], #32 @ AES block 8k+12, 8k+13 - load ciphertext
- aese $ctr1b, $rk13 @ AES block 8k+9 - round 13
- aese $ctr2b, $rk13 @ AES block 8k+10 - round 13
- ldp $res6q, $res7q, [$input_ptr], #32 @ AES block 8k+14, 8k+15 - load ciphertext
- aese $ctr0b, $rk13 @ AES block 8k+8 - round 13
- aese $ctr5b, $rk13 @ AES block 8k+13 - round 13
- rev32 $h4.16b, $rtmp_ctr.16b @ CTR block 8k+19
- eor3 $ctr2b, $res2b, $ctr2b, $rk14 @ AES block 8k+10 - result
- eor3 $ctr1b, $res1b, $ctr1b, $rk14 @ AES block 8k+9 - result
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- aese $ctr7b, $rk13 @ AES block 8k+15 - round 13
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+19
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- aese $ctr4b, $rk13 @ AES block 8k+12 - round 13
- eor3 $ctr5b, $res5b, $ctr5b, $rk14 @ AES block 8k+13 - result
- eor3 $ctr0b, $res0b, $ctr0b, $rk14 @ AES block 8k+8 - result
- aese $ctr3b, $rk13 @ AES block 8k+11 - round 13
- stp $ctr0q, $ctr1q, [$output_ptr], #32 @ AES block 8k+8, 8k+9 - store result
- mov $ctr0.16b, $h1.16b @ CTR block 8k+16
- eor3 $ctr4b, $res4b, $ctr4b, $rk14 @ AES block 8k+12 - result
- eor3 $acc_lb, $acc_lb, $t11.16b, $acc_hb @ MODULO - fold into low
- eor3 $ctr3b, $res3b, $ctr3b, $rk14 @ AES block 8k+11 - result
- stp $ctr2q, $ctr3q, [$output_ptr], #32 @ AES block 8k+10, 8k+11 - store result
- mov $ctr3.16b, $h4.16b @ CTR block 8k+19
- mov $ctr2.16b, $h3.16b @ CTR block 8k+18
- aese $ctr6b, $rk13 @ AES block 8k+14 - round 13
- mov $ctr1.16b, $h2.16b @ CTR block 8k+17
- stp $ctr4q, $ctr5q, [$output_ptr], #32 @ AES block 8k+12, 8k+13 - store result
- eor3 $ctr7b, $res7b, $ctr7b, $rk14 @ AES block 8k+15 - result
- eor3 $ctr6b, $res6b, $ctr6b, $rk14 @ AES block 8k+14 - result
- rev32 $ctr4.16b, $rtmp_ctr.16b @ CTR block 8k+20
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+20
- cmp $input_ptr, $main_end_input_ptr @ LOOP CONTROL
- stp $ctr6q, $ctr7q, [$output_ptr], #32 @ AES block 8k+14, 8k+15 - store result
- b.lt .L256_dec_main_loop
- .L256_dec_prepretail: @ PREPRETAIL
- ldp $rk0q, $rk1q, [$cc, #0] @ load rk0, rk1
- rev32 $ctr5.16b, $rtmp_ctr.16b @ CTR block 8k+13
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+13
- rev64 $res4b, $res4b @ GHASH block 8k+4
- ldr $h56kq, [$current_tag, #144] @ load h6k | h5k
- ldr $h78kq, [$current_tag, #192] @ load h8k | h7k
- rev32 $ctr6.16b, $rtmp_ctr.16b @ CTR block 8k+14
- rev64 $res0b, $res0b @ GHASH block 8k
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+14
- ext $acc_lb, $acc_lb, $acc_lb, #8 @ PRE 0
- ldr $h7q, [$current_tag, #176] @ load h7l | h7h
- ext $h7.16b, $h7.16b, $h7.16b, #8
- ldr $h8q, [$current_tag, #208] @ load h8l | h8h
- ext $h8.16b, $h8.16b, $h8.16b, #8
- rev64 $res1b, $res1b @ GHASH block 8k+1
- rev32 $ctr7.16b, $rtmp_ctr.16b @ CTR block 8k+15
- rev64 $res2b, $res2b @ GHASH block 8k+2
- ldr $h5q, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- ldr $h6q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- aese $ctr0b, $rk0 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 0
- aese $ctr1b, $rk0 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 0
- aese $ctr4b, $rk0 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 0
- aese $ctr3b, $rk0 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 0
- aese $ctr5b, $rk0 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 0
- aese $ctr6b, $rk0 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 0
- aese $ctr4b, $rk1 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 1
- aese $ctr7b, $rk0 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 0
- aese $ctr2b, $rk0 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 0
- ldp $rk2q, $rk3q, [$cc, #32] @ load rk2, rk3
- aese $ctr0b, $rk1 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 1
- eor $res0b, $res0b, $acc_lb @ PRE 1
- aese $ctr7b, $rk1 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 1
- aese $ctr6b, $rk1 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 1
- aese $ctr2b, $rk1 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 1
- aese $ctr3b, $rk1 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 1
- aese $ctr1b, $rk1 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 1
- aese $ctr5b, $rk1 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 1
- pmull2 $t0.1q, $res1.2d, $h7.2d @ GHASH block 8k+1 - high
- trn1 $acc_m.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH block 8k - low
- rev64 $res3b, $res3b @ GHASH block 8k+3
- pmull $h7.1q, $res1.1d, $h7.1d @ GHASH block 8k+1 - low
- aese $ctr5b, $rk2 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 2
- aese $ctr7b, $rk2 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 2
- aese $ctr1b, $rk2 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 2
- aese $ctr3b, $rk2 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 2
- aese $ctr6b, $rk2 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 2
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH block 8k - high
- aese $ctr0b, $rk2 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 2
- aese $ctr7b, $rk3 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 3
- aese $ctr5b, $rk3 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 3
- rev64 $res6b, $res6b @ GHASH block 8k+6
- aese $ctr0b, $rk3 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 3
- aese $ctr2b, $rk2 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 2
- aese $ctr6b, $rk3 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 3
- pmull2 $t1.1q, $res2.2d, $h6.2d @ GHASH block 8k+2 - high
- trn2 $res0.2d, $res1.2d, $res0.2d @ GHASH block 8k, 8k+1 - mid
- aese $ctr4b, $rk2 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 2
- ldp $rk4q, $rk5q, [$cc, #64] @ load rk4, rk5
- aese $ctr1b, $rk3 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 3
- pmull2 $t2.1q, $res3.2d, $h5.2d @ GHASH block 8k+3 - high
- aese $ctr2b, $rk3 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 3
- eor $acc_hb, $acc_hb, $t0.16b @ GHASH block 8k+1 - high
- eor $res0.16b, $res0.16b, $acc_m.16b @ GHASH block 8k, 8k+1 - mid
- aese $ctr4b, $rk3 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 3
- pmull $h6.1q, $res2.1d, $h6.1d @ GHASH block 8k+2 - low
- aese $ctr3b, $rk3 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 3
- eor3 $acc_hb, $acc_hb, $t1.16b, $t2.16b @ GHASH block 8k+2, 8k+3 - high
- trn1 $t3.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- trn2 $res2.2d, $res3.2d, $res2.2d @ GHASH block 8k+2, 8k+3 - mid
- pmull2 $acc_m.1q, $res0.2d, $h78k.2d @ GHASH block 8k - mid
- pmull $h5.1q, $res3.1d, $h5.1d @ GHASH block 8k+3 - low
- eor $acc_lb, $acc_lb, $h7.16b @ GHASH block 8k+1 - low
- pmull $h78k.1q, $res0.1d, $h78k.1d @ GHASH block 8k+1 - mid
- aese $ctr5b, $rk4 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 4
- aese $ctr0b, $rk4 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 4
- eor3 $acc_lb, $acc_lb, $h6.16b, $h5.16b @ GHASH block 8k+2, 8k+3 - low
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- aese $ctr7b, $rk4 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 4
- aese $ctr2b, $rk4 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 4
- aese $ctr6b, $rk4 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 4
- eor $acc_mb, $acc_mb, $h78k.16b @ GHASH block 8k+1 - mid
- eor $res2.16b, $res2.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- aese $ctr7b, $rk5 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 5
- aese $ctr1b, $rk4 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 4
- aese $ctr2b, $rk5 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 5
- aese $ctr3b, $rk4 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 4
- aese $ctr4b, $rk4 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 4
- aese $ctr1b, $rk5 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 5
- pmull2 $t3.1q, $res2.2d, $h56k.2d @ GHASH block 8k+2 - mid
- aese $ctr6b, $rk5 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 5
- aese $ctr4b, $rk5 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 5
- aese $ctr3b, $rk5 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 5
- pmull $h56k.1q, $res2.1d, $h56k.1d @ GHASH block 8k+3 - mid
- aese $ctr0b, $rk5 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 5
- aese $ctr5b, $rk5 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 5
- ldp $rk6q, $rk7q, [$cc, #96] @ load rk6, rk7
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- rev64 $res7b, $res7b @ GHASH block 8k+7
- rev64 $res5b, $res5b @ GHASH block 8k+5
- eor3 $acc_mb, $acc_mb, $h56k.16b, $t3.16b @ GHASH block 8k+2, 8k+3 - mid
- trn1 $t6.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr0b, $rk6 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 6
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- aese $ctr6b, $rk6 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 6
- aese $ctr5b, $rk6 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 6
- aese $ctr7b, $rk6 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 6
- pmull2 $t4.1q, $res4.2d, $h4.2d @ GHASH block 8k+4 - high
- pmull2 $t5.1q, $res5.2d, $h3.2d @ GHASH block 8k+5 - high
- pmull $h4.1q, $res4.1d, $h4.1d @ GHASH block 8k+4 - low
- trn2 $res4.2d, $res5.2d, $res4.2d @ GHASH block 8k+4, 8k+5 - mid
- pmull $h3.1q, $res5.1d, $h3.1d @ GHASH block 8k+5 - low
- trn1 $t9.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr7b, $rk7 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 7
- pmull2 $t7.1q, $res6.2d, $h2.2d @ GHASH block 8k+6 - high
- aese $ctr1b, $rk6 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 6
- aese $ctr2b, $rk6 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 6
- aese $ctr3b, $rk6 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 6
- aese $ctr4b, $rk6 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 6
- ldp $rk8q, $rk9q, [$cc, #128] @ load rk8, rk9
- pmull $h2.1q, $res6.1d, $h2.1d @ GHASH block 8k+6 - low
- aese $ctr5b, $rk7 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 7
- aese $ctr1b, $rk7 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 7
- aese $ctr4b, $rk7 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 7
- aese $ctr6b, $rk7 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 7
- aese $ctr2b, $rk7 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 7
- eor3 $acc_hb, $acc_hb, $t4.16b, $t5.16b @ GHASH block 8k+4, 8k+5 - high
- aese $ctr0b, $rk7 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 7
- trn2 $res6.2d, $res7.2d, $res6.2d @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr3b, $rk7 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 7
- aese $ctr0b, $rk8 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 8
- aese $ctr7b, $rk8 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 8
- aese $ctr4b, $rk8 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 8
- aese $ctr1b, $rk8 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 8
- aese $ctr5b, $rk8 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 8
- aese $ctr6b, $rk8 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 8
- aese $ctr3b, $rk8 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 8
- aese $ctr4b, $rk9 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 9
- eor $res4.16b, $res4.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr0b, $rk9 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 9
- aese $ctr1b, $rk9 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 9
- eor $res6.16b, $res6.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr6b, $rk9 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 9
- aese $ctr7b, $rk9 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 9
- pmull2 $t6.1q, $res4.2d, $h34k.2d @ GHASH block 8k+4 - mid
- aese $ctr2b, $rk8 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 8
- pmull $h34k.1q, $res4.1d, $h34k.1d @ GHASH block 8k+5 - mid
- pmull2 $t8.1q, $res7.2d, $h1.2d @ GHASH block 8k+7 - high
- pmull2 $t9.1q, $res6.2d, $h12k.2d @ GHASH block 8k+6 - mid
- pmull $h12k.1q, $res6.1d, $h12k.1d @ GHASH block 8k+7 - mid
- pmull $h1.1q, $res7.1d, $h1.1d @ GHASH block 8k+7 - low
- ldp $rk10q, $rk11q, [$cc, #160] @ load rk10, rk11
- eor3 $acc_lb, $acc_lb, $h4.16b, $h3.16b @ GHASH block 8k+4, 8k+5 - low
- eor3 $acc_mb, $acc_mb, $h34k.16b, $t6.16b @ GHASH block 8k+4, 8k+5 - mid
- aese $ctr2b, $rk9 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 9
- aese $ctr3b, $rk9 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 9
- aese $ctr5b, $rk9 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 9
- eor3 $acc_hb, $acc_hb, $t7.16b, $t8.16b @ GHASH block 8k+6, 8k+7 - high
- eor3 $acc_lb, $acc_lb, $h2.16b, $h1.16b @ GHASH block 8k+6, 8k+7 - low
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- eor3 $acc_mb, $acc_mb, $h12k.16b, $t9.16b @ GHASH block 8k+6, 8k+7 - mid
- aese $ctr4b, $rk10 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 10
- aese $ctr6b, $rk10 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 10
- aese $ctr5b, $rk10 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 10
- aese $ctr0b, $rk10 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 10
- aese $ctr2b, $rk10 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 10
- aese $ctr3b, $rk10 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 10
- eor3 $acc_mb, $acc_mb, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- aese $ctr7b, $rk10 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 10
- aese $ctr1b, $rk10 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 10
- ldp $rk12q, $rk13q, [$cc, #192] @ load rk12, rk13
- ext $t11.16b, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- aese $ctr2b, $rk11 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 11
- aese $ctr1b, $rk11 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 11
- aese $ctr0b, $rk11 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 11
- pmull $t12.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- aese $ctr3b, $rk11 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 11
- aese $ctr7b, $rk11 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 11
- aese $ctr6b, $rk11 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 11
- aese $ctr4b, $rk11 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 11
- aese $ctr5b, $rk11 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 11
- aese $ctr3b, $rk12 \n aesmc $ctr3b, $ctr3b @ AES block 8k+11 - round 12
- eor3 $acc_mb, $acc_mb, $t12.16b, $t11.16b @ MODULO - fold into mid
- aese $ctr3b, $rk13 @ AES block 8k+11 - round 13
- aese $ctr2b, $rk12 \n aesmc $ctr2b, $ctr2b @ AES block 8k+10 - round 12
- aese $ctr6b, $rk12 \n aesmc $ctr6b, $ctr6b @ AES block 8k+14 - round 12
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- aese $ctr4b, $rk12 \n aesmc $ctr4b, $ctr4b @ AES block 8k+12 - round 12
- aese $ctr7b, $rk12 \n aesmc $ctr7b, $ctr7b @ AES block 8k+15 - round 12
- aese $ctr0b, $rk12 \n aesmc $ctr0b, $ctr0b @ AES block 8k+8 - round 12
- ldr $rk14q, [$cc, #224] @ load rk14
- aese $ctr1b, $rk12 \n aesmc $ctr1b, $ctr1b @ AES block 8k+9 - round 12
- aese $ctr4b, $rk13 @ AES block 8k+12 - round 13
- ext $t11.16b, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- aese $ctr5b, $rk12 \n aesmc $ctr5b, $ctr5b @ AES block 8k+13 - round 12
- aese $ctr6b, $rk13 @ AES block 8k+14 - round 13
- aese $ctr2b, $rk13 @ AES block 8k+10 - round 13
- aese $ctr1b, $rk13 @ AES block 8k+9 - round 13
- aese $ctr5b, $rk13 @ AES block 8k+13 - round 13
- eor3 $acc_lb, $acc_lb, $t11.16b, $acc_hb @ MODULO - fold into low
- add $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s @ CTR block 8k+15
- aese $ctr7b, $rk13 @ AES block 8k+15 - round 13
- aese $ctr0b, $rk13 @ AES block 8k+8 - round 13
- .L256_dec_tail: @ TAIL
- ext $t0.16b, $acc_lb, $acc_lb, #8 @ prepare final partial tag
- sub $main_end_input_ptr, $end_input_ptr, $input_ptr @ main_end_input_ptr is number of bytes left to process
- cmp $main_end_input_ptr, #112
- ldr $res1q, [$input_ptr], #16 @ AES block 8k+8 - load ciphertext
- ldp $h78kq, $h8q, [$current_tag, #192] @ load h8k | h7k
- ext $h8.16b, $h8.16b, $h8.16b, #8
- mov $t1.16b, $rk14
- ldp $h5q, $h56kq, [$current_tag, #128] @ load h5l | h5h
- ext $h5.16b, $h5.16b, $h5.16b, #8
- eor3 $res4b, $res1b, $ctr0b, $t1.16b @ AES block 8k+8 - result
- ldp $h6q, $h7q, [$current_tag, #160] @ load h6l | h6h
- ext $h6.16b, $h6.16b, $h6.16b, #8
- ext $h7.16b, $h7.16b, $h7.16b, #8
- b.gt .L256_dec_blocks_more_than_7
- mov $ctr7b, $ctr6b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr3b
- movi $acc_l.8b, #0
- movi $acc_h.8b, #0
- movi $acc_m.8b, #0
- mov $ctr3b, $ctr2b
- cmp $main_end_input_ptr, #96
- mov $ctr2b, $ctr1b
- b.gt .L256_dec_blocks_more_than_6
- mov $ctr7b, $ctr6b
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- cmp $main_end_input_ptr, #80
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr4b, $ctr3b
- mov $ctr3b, $ctr1b
- b.gt .L256_dec_blocks_more_than_5
- cmp $main_end_input_ptr, #64
- mov $ctr7b, $ctr6b
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr4b
- mov $ctr4b, $ctr1b
- b.gt .L256_dec_blocks_more_than_4
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr6b
- cmp $main_end_input_ptr, #48
- mov $ctr6b, $ctr5b
- mov $ctr5b, $ctr1b
- b.gt .L256_dec_blocks_more_than_3
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr6b
- cmp $main_end_input_ptr, #32
- mov $ctr6b, $ctr1b
- b.gt .L256_dec_blocks_more_than_2
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- mov $ctr7b, $ctr1b
- cmp $main_end_input_ptr, #16
- b.gt .L256_dec_blocks_more_than_1
- sub $rtmp_ctr.4s, $rtmp_ctr.4s, $rctr_inc.4s
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- b .L256_dec_blocks_less_than_1
- .L256_dec_blocks_more_than_7: @ blocks left > 7
- rev64 $res0b, $res1b @ GHASH final-7 block
- ldr $res1q, [$input_ptr], #16 @ AES final-6 block - load ciphertext
- st1 { $res4b}, [$output_ptr], #16 @ AES final-7 block - store result
- ins $acc_m.d[0], $h78k.d[1] @ GHASH final-7 block - mid
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-7 block - mid
- eor3 $res4b, $res1b, $ctr1b, $t1.16b @ AES final-6 block - result
- pmull2 $acc_h.1q, $res0.2d, $h8.2d @ GHASH final-7 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-7 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull $acc_l.1q, $res0.1d, $h8.1d @ GHASH final-7 block - low
- pmull $acc_m.1q, $rk4v.1d, $acc_m.1d @ GHASH final-7 block - mid
- .L256_dec_blocks_more_than_6: @ blocks left > 6
- rev64 $res0b, $res1b @ GHASH final-6 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ldr $res1q, [$input_ptr], #16 @ AES final-5 block - load ciphertext
- movi $t0.8b, #0 @ suppress further partial tag feed in
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-6 block - mid
- st1 { $res4b}, [$output_ptr], #16 @ AES final-6 block - store result
- pmull2 $rk2q1, $res0.2d, $h7.2d @ GHASH final-6 block - high
- pmull $rk3q1, $res0.1d, $h7.1d @ GHASH final-6 block - low
- eor3 $res4b, $res1b, $ctr2b, $t1.16b @ AES final-5 block - result
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-6 block - low
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-6 block - mid
- pmull $rk4v.1q, $rk4v.1d, $h78k.1d @ GHASH final-6 block - mid
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-6 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-6 block - high
- .L256_dec_blocks_more_than_5: @ blocks left > 5
- rev64 $res0b, $res1b @ GHASH final-5 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- pmull2 $rk2q1, $res0.2d, $h6.2d @ GHASH final-5 block - high
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-5 block - mid
- ldr $res1q, [$input_ptr], #16 @ AES final-4 block - load ciphertext
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-5 block - mid
- st1 { $res4b}, [$output_ptr], #16 @ AES final-5 block - store result
- pmull $rk3q1, $res0.1d, $h6.1d @ GHASH final-5 block - low
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-5 block - mid
- pmull2 $rk4v.1q, $rk4v.2d, $h56k.2d @ GHASH final-5 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-5 block - high
- eor3 $res4b, $res1b, $ctr3b, $t1.16b @ AES final-4 block - result
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-5 block - low
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-5 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- .L256_dec_blocks_more_than_4: @ blocks left > 4
- rev64 $res0b, $res1b @ GHASH final-4 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-4 block - mid
- ldr $res1q, [$input_ptr], #16 @ AES final-3 block - load ciphertext
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull $rk3q1, $res0.1d, $h5.1d @ GHASH final-4 block - low
- pmull2 $rk2q1, $res0.2d, $h5.2d @ GHASH final-4 block - high
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-4 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-4 block - high
- pmull $rk4v.1q, $rk4v.1d, $h56k.1d @ GHASH final-4 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-4 block - low
- st1 { $res4b}, [$output_ptr], #16 @ AES final-4 block - store result
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-4 block - mid
- eor3 $res4b, $res1b, $ctr4b, $t1.16b @ AES final-3 block - result
- .L256_dec_blocks_more_than_3: @ blocks left > 3
- ldr $h4q, [$current_tag, #112] @ load h4l | h4h
- ext $h4.16b, $h4.16b, $h4.16b, #8
- rev64 $res0b, $res1b @ GHASH final-3 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ldr $res1q, [$input_ptr], #16 @ AES final-2 block - load ciphertext
- ldr $h34kq, [$current_tag, #96] @ load h4k | h3k
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-3 block - mid
- st1 { $res4b}, [$output_ptr], #16 @ AES final-3 block - store result
- eor3 $res4b, $res1b, $ctr5b, $t1.16b @ AES final-2 block - result
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-3 block - mid
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-3 block - mid
- pmull $rk3q1, $res0.1d, $h4.1d @ GHASH final-3 block - low
- pmull2 $rk2q1, $res0.2d, $h4.2d @ GHASH final-3 block - high
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull2 $rk4v.1q, $rk4v.2d, $h34k.2d @ GHASH final-3 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-3 block - low
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-3 block - high
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-3 block - mid
- .L256_dec_blocks_more_than_2: @ blocks left > 2
- rev64 $res0b, $res1b @ GHASH final-2 block
- ldr $h3q, [$current_tag, #80] @ load h3l | h3h
- ext $h3.16b, $h3.16b, $h3.16b, #8
- ldr $res1q, [$input_ptr], #16 @ AES final-1 block - load ciphertext
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-2 block - mid
- pmull $rk3q1, $res0.1d, $h3.1d @ GHASH final-2 block - low
- st1 { $res4b}, [$output_ptr], #16 @ AES final-2 block - store result
- eor3 $res4b, $res1b, $ctr6b, $t1.16b @ AES final-1 block - result
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-2 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-2 block - low
- movi $t0.8b, #0 @ suppress further partial tag feed in
- pmull $rk4v.1q, $rk4v.1d, $h34k.1d @ GHASH final-2 block - mid
- pmull2 $rk2q1, $res0.2d, $h3.2d @ GHASH final-2 block - high
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-2 block - mid
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-2 block - high
- .L256_dec_blocks_more_than_1: @ blocks left > 1
- rev64 $res0b, $res1b @ GHASH final-1 block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $rk4v.d[0], $res0.d[1] @ GHASH final-1 block - mid
- ldr $h2q, [$current_tag, #64] @ load h2l | h2h
- ext $h2.16b, $h2.16b, $h2.16b, #8
- eor $rk4v.8b, $rk4v.8b, $res0.8b @ GHASH final-1 block - mid
- ldr $res1q, [$input_ptr], #16 @ AES final block - load ciphertext
- st1 { $res4b}, [$output_ptr], #16 @ AES final-1 block - store result
- ldr $h12kq, [$current_tag, #48] @ load h2k | h1k
- pmull $rk3q1, $res0.1d, $h2.1d @ GHASH final-1 block - low
- ins $rk4v.d[1], $rk4v.d[0] @ GHASH final-1 block - mid
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final-1 block - low
- eor3 $res4b, $res1b, $ctr7b, $t1.16b @ AES final block - result
- pmull2 $rk2q1, $res0.2d, $h2.2d @ GHASH final-1 block - high
- pmull2 $rk4v.1q, $rk4v.2d, $h12k.2d @ GHASH final-1 block - mid
- movi $t0.8b, #0 @ suppress further partial tag feed in
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final-1 block - high
- eor $acc_mb, $acc_mb, $rk4v.16b @ GHASH final-1 block - mid
- .L256_dec_blocks_less_than_1: @ blocks left <= 1
- ld1 { $rk0}, [$output_ptr] @ load existing bytes where the possibly partial last block is to be stored
- mvn $temp0_x, xzr @ temp0_x = 0xffffffffffffffff
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- sub $bit_length, $bit_length, #128 @ bit_length -= 128
- rev32 $rtmp_ctr.16b, $rtmp_ctr.16b
- str $rtmp_ctrq, [$counter] @ store the updated counter
- neg $bit_length, $bit_length @ bit_length = 128 - #bits in input (in range [1,128])
- and $bit_length, $bit_length, #127 @ bit_length %= 128
- lsr $temp0_x, $temp0_x, $bit_length @ temp0_x is mask for top 64b of last block
- cmp $bit_length, #64
- mvn $temp1_x, xzr @ temp1_x = 0xffffffffffffffff
- csel $temp3_x, $temp0_x, xzr, lt
- csel $temp2_x, $temp1_x, $temp0_x, lt
- mov $ctr0.d[0], $temp2_x @ ctr0b is mask for last block
- mov $ctr0.d[1], $temp3_x
- and $res1b, $res1b, $ctr0b @ possibly partial last block has zeroes in highest bits
- ldr $h1q, [$current_tag, #32] @ load h1l | h1h
- ext $h1.16b, $h1.16b, $h1.16b, #8
- bif $res4b, $rk0, $ctr0b @ insert existing bytes in top end of result before storing
- rev64 $res0b, $res1b @ GHASH final block
- eor $res0b, $res0b, $t0.16b @ feed in partial tag
- ins $t0.d[0], $res0.d[1] @ GHASH final block - mid
- pmull2 $rk2q1, $res0.2d, $h1.2d @ GHASH final block - high
- eor $t0.8b, $t0.8b, $res0.8b @ GHASH final block - mid
- pmull $rk3q1, $res0.1d, $h1.1d @ GHASH final block - low
- eor $acc_hb, $acc_hb, $rk2 @ GHASH final block - high
- pmull $t0.1q, $t0.1d, $h12k.1d @ GHASH final block - mid
- eor $acc_mb, $acc_mb, $t0.16b @ GHASH final block - mid
- ldr $mod_constantd, [$modulo_constant] @ MODULO - load modulo constant
- eor $acc_lb, $acc_lb, $rk3 @ GHASH final block - low
- pmull $t11.1q, $acc_h.1d, $mod_constant.1d @ MODULO - top 64b align with mid
- eor $t10.16b, $acc_hb, $acc_lb @ MODULO - karatsuba tidy up
- ext $acc_hb, $acc_hb, $acc_hb, #8 @ MODULO - other top alignment
- st1 { $res4b}, [$output_ptr] @ store all 16B
- eor $acc_mb, $acc_mb, $t10.16b @ MODULO - karatsuba tidy up
- eor $t11.16b, $acc_hb, $t11.16b @ MODULO - fold into mid
- eor $acc_mb, $acc_mb, $t11.16b @ MODULO - fold into mid
- pmull $acc_h.1q, $acc_m.1d, $mod_constant.1d @ MODULO - mid 64b align with low
- ext $acc_mb, $acc_mb, $acc_mb, #8 @ MODULO - other mid alignment
- eor $acc_lb, $acc_lb, $acc_hb @ MODULO - fold into low
- eor $acc_lb, $acc_lb, $acc_mb @ MODULO - fold into low
- ext $acc_lb, $acc_lb, $acc_lb, #8
- rev64 $acc_lb, $acc_lb
- st1 { $acc_l.16b }, [$current_tag]
- mov x0, $byte_length
- ldp d10, d11, [sp, #16]
- ldp d12, d13, [sp, #32]
- ldp d14, d15, [sp, #48]
- ldp d8, d9, [sp], #80
- ret
- .L256_dec_ret:
- mov w0, #0x0
- ret
- .size unroll8_eor3_aes_gcm_dec_256_kernel,.-unroll8_eor3_aes_gcm_dec_256_kernel
- ___
- }
- }
- $code.=<<___;
- .asciz "AES GCM module for ARMv8, SPDX BSD-3-Clause by <xiaokang.qian\@arm.com>"
- .align 2
- #endif
- ___
- {
- my %opcode = (
- "rax1" => 0xce608c00, "eor3" => 0xce000000,
- "bcax" => 0xce200000, "xar" => 0xce800000 );
- sub unsha3 {
- my ($mnemonic,$arg)=@_;
- $arg =~ m/[qv]([0-9]+)[^,]*,\s*[qv]([0-9]+)[^,]*(?:,\s*[qv]([0-9]+)[^,]*(?:,\s*[qv#]([0-9\-]+))?)?/
- &&
- sprintf ".inst\t0x%08x\t//%s %s",
- $opcode{$mnemonic}|$1|($2<<5)|($3<<16)|(eval($4)<<10),
- $mnemonic,$arg;
- }
- sub unvmov {
- my $arg=shift;
- $arg =~ m/q([0-9]+)#(lo|hi),\s*q([0-9]+)#(lo|hi)/o &&
- sprintf "ins v%d.d[%d],v%d.d[%d]",$1<8?$1:$1+8,($2 eq "lo")?0:1,
- $3<8?$3:$3+8,($4 eq "lo")?0:1;
- }
- foreach(split("\n",$code)) {
- s/@\s/\/\//o; # old->new style commentary
- s/\`([^\`]*)\`/eval($1)/ge;
- m/\bld1r\b/ and s/\.16b/.2d/g or
- s/\b(eor3|rax1|xar|bcax)\s+(v.*)/unsha3($1,$2)/ge;
- print $_,"\n";
- }
- }
- close STDOUT or die "error closing STDOUT: $!"; # enforce flush
|