aesni-x86.masm 73 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224
  1. IF @Version LT 800
  2. ECHO MASM version 8.00 or later is strongly recommended.
  3. ENDIF
  4. .686
  5. .XMM
  6. IF @Version LT 800
  7. XMMWORD STRUCT 16
  8. DQ 2 dup (?)
  9. XMMWORD ENDS
  10. ENDIF
  11. .MODEL FLAT
  12. OPTION DOTNAME
  13. IF @Version LT 800
  14. .text$ SEGMENT PAGE 'CODE'
  15. ELSE
  16. .text$ SEGMENT ALIGN(64) 'CODE'
  17. ENDIF
  18. ;EXTERN _OPENSSL_ia32cap_P:NEAR
  19. ALIGN 16
  20. _aesni_encrypt PROC PUBLIC
  21. $L_aesni_encrypt_begin::
  22. mov eax,DWORD PTR 4[esp]
  23. mov edx,DWORD PTR 12[esp]
  24. movups xmm2,XMMWORD PTR [eax]
  25. mov ecx,DWORD PTR 240[edx]
  26. mov eax,DWORD PTR 8[esp]
  27. movups xmm0,XMMWORD PTR [edx]
  28. movups xmm1,XMMWORD PTR 16[edx]
  29. lea edx,DWORD PTR 32[edx]
  30. xorps xmm2,xmm0
  31. $L000enc1_loop_1:
  32. DB 102,15,56,220,209
  33. dec ecx
  34. movups xmm1,XMMWORD PTR [edx]
  35. lea edx,DWORD PTR 16[edx]
  36. jnz $L000enc1_loop_1
  37. DB 102,15,56,221,209
  38. pxor xmm0,xmm0
  39. pxor xmm1,xmm1
  40. movups XMMWORD PTR [eax],xmm2
  41. pxor xmm2,xmm2
  42. ret
  43. _aesni_encrypt ENDP
  44. ALIGN 16
  45. _aesni_decrypt PROC PUBLIC
  46. $L_aesni_decrypt_begin::
  47. mov eax,DWORD PTR 4[esp]
  48. mov edx,DWORD PTR 12[esp]
  49. movups xmm2,XMMWORD PTR [eax]
  50. mov ecx,DWORD PTR 240[edx]
  51. mov eax,DWORD PTR 8[esp]
  52. movups xmm0,XMMWORD PTR [edx]
  53. movups xmm1,XMMWORD PTR 16[edx]
  54. lea edx,DWORD PTR 32[edx]
  55. xorps xmm2,xmm0
  56. $L001dec1_loop_2:
  57. DB 102,15,56,222,209
  58. dec ecx
  59. movups xmm1,XMMWORD PTR [edx]
  60. lea edx,DWORD PTR 16[edx]
  61. jnz $L001dec1_loop_2
  62. DB 102,15,56,223,209
  63. pxor xmm0,xmm0
  64. pxor xmm1,xmm1
  65. movups XMMWORD PTR [eax],xmm2
  66. pxor xmm2,xmm2
  67. ret
  68. _aesni_decrypt ENDP
  69. ALIGN 16
  70. __aesni_encrypt2 PROC PRIVATE
  71. movups xmm0,XMMWORD PTR [edx]
  72. shl ecx,4
  73. movups xmm1,XMMWORD PTR 16[edx]
  74. xorps xmm2,xmm0
  75. pxor xmm3,xmm0
  76. movups xmm0,XMMWORD PTR 32[edx]
  77. lea edx,DWORD PTR 32[ecx*1+edx]
  78. neg ecx
  79. add ecx,16
  80. $L002enc2_loop:
  81. DB 102,15,56,220,209
  82. DB 102,15,56,220,217
  83. movups xmm1,XMMWORD PTR [ecx*1+edx]
  84. add ecx,32
  85. DB 102,15,56,220,208
  86. DB 102,15,56,220,216
  87. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  88. jnz $L002enc2_loop
  89. DB 102,15,56,220,209
  90. DB 102,15,56,220,217
  91. DB 102,15,56,221,208
  92. DB 102,15,56,221,216
  93. ret
  94. __aesni_encrypt2 ENDP
  95. ALIGN 16
  96. __aesni_decrypt2 PROC PRIVATE
  97. movups xmm0,XMMWORD PTR [edx]
  98. shl ecx,4
  99. movups xmm1,XMMWORD PTR 16[edx]
  100. xorps xmm2,xmm0
  101. pxor xmm3,xmm0
  102. movups xmm0,XMMWORD PTR 32[edx]
  103. lea edx,DWORD PTR 32[ecx*1+edx]
  104. neg ecx
  105. add ecx,16
  106. $L003dec2_loop:
  107. DB 102,15,56,222,209
  108. DB 102,15,56,222,217
  109. movups xmm1,XMMWORD PTR [ecx*1+edx]
  110. add ecx,32
  111. DB 102,15,56,222,208
  112. DB 102,15,56,222,216
  113. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  114. jnz $L003dec2_loop
  115. DB 102,15,56,222,209
  116. DB 102,15,56,222,217
  117. DB 102,15,56,223,208
  118. DB 102,15,56,223,216
  119. ret
  120. __aesni_decrypt2 ENDP
  121. ALIGN 16
  122. __aesni_encrypt3 PROC PRIVATE
  123. movups xmm0,XMMWORD PTR [edx]
  124. shl ecx,4
  125. movups xmm1,XMMWORD PTR 16[edx]
  126. xorps xmm2,xmm0
  127. pxor xmm3,xmm0
  128. pxor xmm4,xmm0
  129. movups xmm0,XMMWORD PTR 32[edx]
  130. lea edx,DWORD PTR 32[ecx*1+edx]
  131. neg ecx
  132. add ecx,16
  133. $L004enc3_loop:
  134. DB 102,15,56,220,209
  135. DB 102,15,56,220,217
  136. DB 102,15,56,220,225
  137. movups xmm1,XMMWORD PTR [ecx*1+edx]
  138. add ecx,32
  139. DB 102,15,56,220,208
  140. DB 102,15,56,220,216
  141. DB 102,15,56,220,224
  142. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  143. jnz $L004enc3_loop
  144. DB 102,15,56,220,209
  145. DB 102,15,56,220,217
  146. DB 102,15,56,220,225
  147. DB 102,15,56,221,208
  148. DB 102,15,56,221,216
  149. DB 102,15,56,221,224
  150. ret
  151. __aesni_encrypt3 ENDP
  152. ALIGN 16
  153. __aesni_decrypt3 PROC PRIVATE
  154. movups xmm0,XMMWORD PTR [edx]
  155. shl ecx,4
  156. movups xmm1,XMMWORD PTR 16[edx]
  157. xorps xmm2,xmm0
  158. pxor xmm3,xmm0
  159. pxor xmm4,xmm0
  160. movups xmm0,XMMWORD PTR 32[edx]
  161. lea edx,DWORD PTR 32[ecx*1+edx]
  162. neg ecx
  163. add ecx,16
  164. $L005dec3_loop:
  165. DB 102,15,56,222,209
  166. DB 102,15,56,222,217
  167. DB 102,15,56,222,225
  168. movups xmm1,XMMWORD PTR [ecx*1+edx]
  169. add ecx,32
  170. DB 102,15,56,222,208
  171. DB 102,15,56,222,216
  172. DB 102,15,56,222,224
  173. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  174. jnz $L005dec3_loop
  175. DB 102,15,56,222,209
  176. DB 102,15,56,222,217
  177. DB 102,15,56,222,225
  178. DB 102,15,56,223,208
  179. DB 102,15,56,223,216
  180. DB 102,15,56,223,224
  181. ret
  182. __aesni_decrypt3 ENDP
  183. ALIGN 16
  184. __aesni_encrypt4 PROC PRIVATE
  185. movups xmm0,XMMWORD PTR [edx]
  186. movups xmm1,XMMWORD PTR 16[edx]
  187. shl ecx,4
  188. xorps xmm2,xmm0
  189. pxor xmm3,xmm0
  190. pxor xmm4,xmm0
  191. pxor xmm5,xmm0
  192. movups xmm0,XMMWORD PTR 32[edx]
  193. lea edx,DWORD PTR 32[ecx*1+edx]
  194. neg ecx
  195. DB 15,31,64,0
  196. add ecx,16
  197. $L006enc4_loop:
  198. DB 102,15,56,220,209
  199. DB 102,15,56,220,217
  200. DB 102,15,56,220,225
  201. DB 102,15,56,220,233
  202. movups xmm1,XMMWORD PTR [ecx*1+edx]
  203. add ecx,32
  204. DB 102,15,56,220,208
  205. DB 102,15,56,220,216
  206. DB 102,15,56,220,224
  207. DB 102,15,56,220,232
  208. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  209. jnz $L006enc4_loop
  210. DB 102,15,56,220,209
  211. DB 102,15,56,220,217
  212. DB 102,15,56,220,225
  213. DB 102,15,56,220,233
  214. DB 102,15,56,221,208
  215. DB 102,15,56,221,216
  216. DB 102,15,56,221,224
  217. DB 102,15,56,221,232
  218. ret
  219. __aesni_encrypt4 ENDP
  220. ALIGN 16
  221. __aesni_decrypt4 PROC PRIVATE
  222. movups xmm0,XMMWORD PTR [edx]
  223. movups xmm1,XMMWORD PTR 16[edx]
  224. shl ecx,4
  225. xorps xmm2,xmm0
  226. pxor xmm3,xmm0
  227. pxor xmm4,xmm0
  228. pxor xmm5,xmm0
  229. movups xmm0,XMMWORD PTR 32[edx]
  230. lea edx,DWORD PTR 32[ecx*1+edx]
  231. neg ecx
  232. DB 15,31,64,0
  233. add ecx,16
  234. $L007dec4_loop:
  235. DB 102,15,56,222,209
  236. DB 102,15,56,222,217
  237. DB 102,15,56,222,225
  238. DB 102,15,56,222,233
  239. movups xmm1,XMMWORD PTR [ecx*1+edx]
  240. add ecx,32
  241. DB 102,15,56,222,208
  242. DB 102,15,56,222,216
  243. DB 102,15,56,222,224
  244. DB 102,15,56,222,232
  245. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  246. jnz $L007dec4_loop
  247. DB 102,15,56,222,209
  248. DB 102,15,56,222,217
  249. DB 102,15,56,222,225
  250. DB 102,15,56,222,233
  251. DB 102,15,56,223,208
  252. DB 102,15,56,223,216
  253. DB 102,15,56,223,224
  254. DB 102,15,56,223,232
  255. ret
  256. __aesni_decrypt4 ENDP
  257. ALIGN 16
  258. __aesni_encrypt6 PROC PRIVATE
  259. movups xmm0,XMMWORD PTR [edx]
  260. shl ecx,4
  261. movups xmm1,XMMWORD PTR 16[edx]
  262. xorps xmm2,xmm0
  263. pxor xmm3,xmm0
  264. pxor xmm4,xmm0
  265. DB 102,15,56,220,209
  266. pxor xmm5,xmm0
  267. pxor xmm6,xmm0
  268. DB 102,15,56,220,217
  269. lea edx,DWORD PTR 32[ecx*1+edx]
  270. neg ecx
  271. DB 102,15,56,220,225
  272. pxor xmm7,xmm0
  273. movups xmm0,XMMWORD PTR [ecx*1+edx]
  274. add ecx,16
  275. jmp $L008_aesni_encrypt6_inner
  276. ALIGN 16
  277. $L009enc6_loop:
  278. DB 102,15,56,220,209
  279. DB 102,15,56,220,217
  280. DB 102,15,56,220,225
  281. $L008_aesni_encrypt6_inner:
  282. DB 102,15,56,220,233
  283. DB 102,15,56,220,241
  284. DB 102,15,56,220,249
  285. $L_aesni_encrypt6_enter::
  286. movups xmm1,XMMWORD PTR [ecx*1+edx]
  287. add ecx,32
  288. DB 102,15,56,220,208
  289. DB 102,15,56,220,216
  290. DB 102,15,56,220,224
  291. DB 102,15,56,220,232
  292. DB 102,15,56,220,240
  293. DB 102,15,56,220,248
  294. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  295. jnz $L009enc6_loop
  296. DB 102,15,56,220,209
  297. DB 102,15,56,220,217
  298. DB 102,15,56,220,225
  299. DB 102,15,56,220,233
  300. DB 102,15,56,220,241
  301. DB 102,15,56,220,249
  302. DB 102,15,56,221,208
  303. DB 102,15,56,221,216
  304. DB 102,15,56,221,224
  305. DB 102,15,56,221,232
  306. DB 102,15,56,221,240
  307. DB 102,15,56,221,248
  308. ret
  309. __aesni_encrypt6 ENDP
  310. ALIGN 16
  311. __aesni_decrypt6 PROC PRIVATE
  312. movups xmm0,XMMWORD PTR [edx]
  313. shl ecx,4
  314. movups xmm1,XMMWORD PTR 16[edx]
  315. xorps xmm2,xmm0
  316. pxor xmm3,xmm0
  317. pxor xmm4,xmm0
  318. DB 102,15,56,222,209
  319. pxor xmm5,xmm0
  320. pxor xmm6,xmm0
  321. DB 102,15,56,222,217
  322. lea edx,DWORD PTR 32[ecx*1+edx]
  323. neg ecx
  324. DB 102,15,56,222,225
  325. pxor xmm7,xmm0
  326. movups xmm0,XMMWORD PTR [ecx*1+edx]
  327. add ecx,16
  328. jmp $L010_aesni_decrypt6_inner
  329. ALIGN 16
  330. $L011dec6_loop:
  331. DB 102,15,56,222,209
  332. DB 102,15,56,222,217
  333. DB 102,15,56,222,225
  334. $L010_aesni_decrypt6_inner:
  335. DB 102,15,56,222,233
  336. DB 102,15,56,222,241
  337. DB 102,15,56,222,249
  338. $L_aesni_decrypt6_enter::
  339. movups xmm1,XMMWORD PTR [ecx*1+edx]
  340. add ecx,32
  341. DB 102,15,56,222,208
  342. DB 102,15,56,222,216
  343. DB 102,15,56,222,224
  344. DB 102,15,56,222,232
  345. DB 102,15,56,222,240
  346. DB 102,15,56,222,248
  347. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  348. jnz $L011dec6_loop
  349. DB 102,15,56,222,209
  350. DB 102,15,56,222,217
  351. DB 102,15,56,222,225
  352. DB 102,15,56,222,233
  353. DB 102,15,56,222,241
  354. DB 102,15,56,222,249
  355. DB 102,15,56,223,208
  356. DB 102,15,56,223,216
  357. DB 102,15,56,223,224
  358. DB 102,15,56,223,232
  359. DB 102,15,56,223,240
  360. DB 102,15,56,223,248
  361. ret
  362. __aesni_decrypt6 ENDP
  363. ALIGN 16
  364. _aesni_ecb_encrypt PROC PUBLIC
  365. $L_aesni_ecb_encrypt_begin::
  366. push ebp
  367. push ebx
  368. push esi
  369. push edi
  370. mov esi,DWORD PTR 20[esp]
  371. mov edi,DWORD PTR 24[esp]
  372. mov eax,DWORD PTR 28[esp]
  373. mov edx,DWORD PTR 32[esp]
  374. mov ebx,DWORD PTR 36[esp]
  375. and eax,-16
  376. jz $L012ecb_ret
  377. mov ecx,DWORD PTR 240[edx]
  378. test ebx,ebx
  379. jz $L013ecb_decrypt
  380. mov ebp,edx
  381. mov ebx,ecx
  382. cmp eax,96
  383. jb $L014ecb_enc_tail
  384. movdqu xmm2,XMMWORD PTR [esi]
  385. movdqu xmm3,XMMWORD PTR 16[esi]
  386. movdqu xmm4,XMMWORD PTR 32[esi]
  387. movdqu xmm5,XMMWORD PTR 48[esi]
  388. movdqu xmm6,XMMWORD PTR 64[esi]
  389. movdqu xmm7,XMMWORD PTR 80[esi]
  390. lea esi,DWORD PTR 96[esi]
  391. sub eax,96
  392. jmp $L015ecb_enc_loop6_enter
  393. ALIGN 16
  394. $L016ecb_enc_loop6:
  395. movups XMMWORD PTR [edi],xmm2
  396. movdqu xmm2,XMMWORD PTR [esi]
  397. movups XMMWORD PTR 16[edi],xmm3
  398. movdqu xmm3,XMMWORD PTR 16[esi]
  399. movups XMMWORD PTR 32[edi],xmm4
  400. movdqu xmm4,XMMWORD PTR 32[esi]
  401. movups XMMWORD PTR 48[edi],xmm5
  402. movdqu xmm5,XMMWORD PTR 48[esi]
  403. movups XMMWORD PTR 64[edi],xmm6
  404. movdqu xmm6,XMMWORD PTR 64[esi]
  405. movups XMMWORD PTR 80[edi],xmm7
  406. lea edi,DWORD PTR 96[edi]
  407. movdqu xmm7,XMMWORD PTR 80[esi]
  408. lea esi,DWORD PTR 96[esi]
  409. $L015ecb_enc_loop6_enter:
  410. call __aesni_encrypt6
  411. mov edx,ebp
  412. mov ecx,ebx
  413. sub eax,96
  414. jnc $L016ecb_enc_loop6
  415. movups XMMWORD PTR [edi],xmm2
  416. movups XMMWORD PTR 16[edi],xmm3
  417. movups XMMWORD PTR 32[edi],xmm4
  418. movups XMMWORD PTR 48[edi],xmm5
  419. movups XMMWORD PTR 64[edi],xmm6
  420. movups XMMWORD PTR 80[edi],xmm7
  421. lea edi,DWORD PTR 96[edi]
  422. add eax,96
  423. jz $L012ecb_ret
  424. $L014ecb_enc_tail:
  425. movups xmm2,XMMWORD PTR [esi]
  426. cmp eax,32
  427. jb $L017ecb_enc_one
  428. movups xmm3,XMMWORD PTR 16[esi]
  429. je $L018ecb_enc_two
  430. movups xmm4,XMMWORD PTR 32[esi]
  431. cmp eax,64
  432. jb $L019ecb_enc_three
  433. movups xmm5,XMMWORD PTR 48[esi]
  434. je $L020ecb_enc_four
  435. movups xmm6,XMMWORD PTR 64[esi]
  436. xorps xmm7,xmm7
  437. call __aesni_encrypt6
  438. movups XMMWORD PTR [edi],xmm2
  439. movups XMMWORD PTR 16[edi],xmm3
  440. movups XMMWORD PTR 32[edi],xmm4
  441. movups XMMWORD PTR 48[edi],xmm5
  442. movups XMMWORD PTR 64[edi],xmm6
  443. jmp $L012ecb_ret
  444. ALIGN 16
  445. $L017ecb_enc_one:
  446. movups xmm0,XMMWORD PTR [edx]
  447. movups xmm1,XMMWORD PTR 16[edx]
  448. lea edx,DWORD PTR 32[edx]
  449. xorps xmm2,xmm0
  450. $L021enc1_loop_3:
  451. DB 102,15,56,220,209
  452. dec ecx
  453. movups xmm1,XMMWORD PTR [edx]
  454. lea edx,DWORD PTR 16[edx]
  455. jnz $L021enc1_loop_3
  456. DB 102,15,56,221,209
  457. movups XMMWORD PTR [edi],xmm2
  458. jmp $L012ecb_ret
  459. ALIGN 16
  460. $L018ecb_enc_two:
  461. call __aesni_encrypt2
  462. movups XMMWORD PTR [edi],xmm2
  463. movups XMMWORD PTR 16[edi],xmm3
  464. jmp $L012ecb_ret
  465. ALIGN 16
  466. $L019ecb_enc_three:
  467. call __aesni_encrypt3
  468. movups XMMWORD PTR [edi],xmm2
  469. movups XMMWORD PTR 16[edi],xmm3
  470. movups XMMWORD PTR 32[edi],xmm4
  471. jmp $L012ecb_ret
  472. ALIGN 16
  473. $L020ecb_enc_four:
  474. call __aesni_encrypt4
  475. movups XMMWORD PTR [edi],xmm2
  476. movups XMMWORD PTR 16[edi],xmm3
  477. movups XMMWORD PTR 32[edi],xmm4
  478. movups XMMWORD PTR 48[edi],xmm5
  479. jmp $L012ecb_ret
  480. ALIGN 16
  481. $L013ecb_decrypt:
  482. mov ebp,edx
  483. mov ebx,ecx
  484. cmp eax,96
  485. jb $L022ecb_dec_tail
  486. movdqu xmm2,XMMWORD PTR [esi]
  487. movdqu xmm3,XMMWORD PTR 16[esi]
  488. movdqu xmm4,XMMWORD PTR 32[esi]
  489. movdqu xmm5,XMMWORD PTR 48[esi]
  490. movdqu xmm6,XMMWORD PTR 64[esi]
  491. movdqu xmm7,XMMWORD PTR 80[esi]
  492. lea esi,DWORD PTR 96[esi]
  493. sub eax,96
  494. jmp $L023ecb_dec_loop6_enter
  495. ALIGN 16
  496. $L024ecb_dec_loop6:
  497. movups XMMWORD PTR [edi],xmm2
  498. movdqu xmm2,XMMWORD PTR [esi]
  499. movups XMMWORD PTR 16[edi],xmm3
  500. movdqu xmm3,XMMWORD PTR 16[esi]
  501. movups XMMWORD PTR 32[edi],xmm4
  502. movdqu xmm4,XMMWORD PTR 32[esi]
  503. movups XMMWORD PTR 48[edi],xmm5
  504. movdqu xmm5,XMMWORD PTR 48[esi]
  505. movups XMMWORD PTR 64[edi],xmm6
  506. movdqu xmm6,XMMWORD PTR 64[esi]
  507. movups XMMWORD PTR 80[edi],xmm7
  508. lea edi,DWORD PTR 96[edi]
  509. movdqu xmm7,XMMWORD PTR 80[esi]
  510. lea esi,DWORD PTR 96[esi]
  511. $L023ecb_dec_loop6_enter:
  512. call __aesni_decrypt6
  513. mov edx,ebp
  514. mov ecx,ebx
  515. sub eax,96
  516. jnc $L024ecb_dec_loop6
  517. movups XMMWORD PTR [edi],xmm2
  518. movups XMMWORD PTR 16[edi],xmm3
  519. movups XMMWORD PTR 32[edi],xmm4
  520. movups XMMWORD PTR 48[edi],xmm5
  521. movups XMMWORD PTR 64[edi],xmm6
  522. movups XMMWORD PTR 80[edi],xmm7
  523. lea edi,DWORD PTR 96[edi]
  524. add eax,96
  525. jz $L012ecb_ret
  526. $L022ecb_dec_tail:
  527. movups xmm2,XMMWORD PTR [esi]
  528. cmp eax,32
  529. jb $L025ecb_dec_one
  530. movups xmm3,XMMWORD PTR 16[esi]
  531. je $L026ecb_dec_two
  532. movups xmm4,XMMWORD PTR 32[esi]
  533. cmp eax,64
  534. jb $L027ecb_dec_three
  535. movups xmm5,XMMWORD PTR 48[esi]
  536. je $L028ecb_dec_four
  537. movups xmm6,XMMWORD PTR 64[esi]
  538. xorps xmm7,xmm7
  539. call __aesni_decrypt6
  540. movups XMMWORD PTR [edi],xmm2
  541. movups XMMWORD PTR 16[edi],xmm3
  542. movups XMMWORD PTR 32[edi],xmm4
  543. movups XMMWORD PTR 48[edi],xmm5
  544. movups XMMWORD PTR 64[edi],xmm6
  545. jmp $L012ecb_ret
  546. ALIGN 16
  547. $L025ecb_dec_one:
  548. movups xmm0,XMMWORD PTR [edx]
  549. movups xmm1,XMMWORD PTR 16[edx]
  550. lea edx,DWORD PTR 32[edx]
  551. xorps xmm2,xmm0
  552. $L029dec1_loop_4:
  553. DB 102,15,56,222,209
  554. dec ecx
  555. movups xmm1,XMMWORD PTR [edx]
  556. lea edx,DWORD PTR 16[edx]
  557. jnz $L029dec1_loop_4
  558. DB 102,15,56,223,209
  559. movups XMMWORD PTR [edi],xmm2
  560. jmp $L012ecb_ret
  561. ALIGN 16
  562. $L026ecb_dec_two:
  563. call __aesni_decrypt2
  564. movups XMMWORD PTR [edi],xmm2
  565. movups XMMWORD PTR 16[edi],xmm3
  566. jmp $L012ecb_ret
  567. ALIGN 16
  568. $L027ecb_dec_three:
  569. call __aesni_decrypt3
  570. movups XMMWORD PTR [edi],xmm2
  571. movups XMMWORD PTR 16[edi],xmm3
  572. movups XMMWORD PTR 32[edi],xmm4
  573. jmp $L012ecb_ret
  574. ALIGN 16
  575. $L028ecb_dec_four:
  576. call __aesni_decrypt4
  577. movups XMMWORD PTR [edi],xmm2
  578. movups XMMWORD PTR 16[edi],xmm3
  579. movups XMMWORD PTR 32[edi],xmm4
  580. movups XMMWORD PTR 48[edi],xmm5
  581. $L012ecb_ret:
  582. pxor xmm0,xmm0
  583. pxor xmm1,xmm1
  584. pxor xmm2,xmm2
  585. pxor xmm3,xmm3
  586. pxor xmm4,xmm4
  587. pxor xmm5,xmm5
  588. pxor xmm6,xmm6
  589. pxor xmm7,xmm7
  590. pop edi
  591. pop esi
  592. pop ebx
  593. pop ebp
  594. ret
  595. _aesni_ecb_encrypt ENDP
  596. ALIGN 16
  597. _aesni_ccm64_encrypt_blocks PROC PUBLIC
  598. $L_aesni_ccm64_encrypt_blocks_begin::
  599. push ebp
  600. push ebx
  601. push esi
  602. push edi
  603. mov esi,DWORD PTR 20[esp]
  604. mov edi,DWORD PTR 24[esp]
  605. mov eax,DWORD PTR 28[esp]
  606. mov edx,DWORD PTR 32[esp]
  607. mov ebx,DWORD PTR 36[esp]
  608. mov ecx,DWORD PTR 40[esp]
  609. mov ebp,esp
  610. sub esp,60
  611. and esp,-16
  612. mov DWORD PTR 48[esp],ebp
  613. movdqu xmm7,XMMWORD PTR [ebx]
  614. movdqu xmm3,XMMWORD PTR [ecx]
  615. mov ecx,DWORD PTR 240[edx]
  616. mov DWORD PTR [esp],202182159
  617. mov DWORD PTR 4[esp],134810123
  618. mov DWORD PTR 8[esp],67438087
  619. mov DWORD PTR 12[esp],66051
  620. mov ebx,1
  621. xor ebp,ebp
  622. mov DWORD PTR 16[esp],ebx
  623. mov DWORD PTR 20[esp],ebp
  624. mov DWORD PTR 24[esp],ebp
  625. mov DWORD PTR 28[esp],ebp
  626. shl ecx,4
  627. mov ebx,16
  628. lea ebp,DWORD PTR [edx]
  629. movdqa xmm5,XMMWORD PTR [esp]
  630. movdqa xmm2,xmm7
  631. lea edx,DWORD PTR 32[ecx*1+edx]
  632. sub ebx,ecx
  633. DB 102,15,56,0,253
  634. $L030ccm64_enc_outer:
  635. movups xmm0,XMMWORD PTR [ebp]
  636. mov ecx,ebx
  637. movups xmm6,XMMWORD PTR [esi]
  638. xorps xmm2,xmm0
  639. movups xmm1,XMMWORD PTR 16[ebp]
  640. xorps xmm0,xmm6
  641. xorps xmm3,xmm0
  642. movups xmm0,XMMWORD PTR 32[ebp]
  643. $L031ccm64_enc2_loop:
  644. DB 102,15,56,220,209
  645. DB 102,15,56,220,217
  646. movups xmm1,XMMWORD PTR [ecx*1+edx]
  647. add ecx,32
  648. DB 102,15,56,220,208
  649. DB 102,15,56,220,216
  650. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  651. jnz $L031ccm64_enc2_loop
  652. DB 102,15,56,220,209
  653. DB 102,15,56,220,217
  654. paddq xmm7,XMMWORD PTR 16[esp]
  655. dec eax
  656. DB 102,15,56,221,208
  657. DB 102,15,56,221,216
  658. lea esi,DWORD PTR 16[esi]
  659. xorps xmm6,xmm2
  660. movdqa xmm2,xmm7
  661. movups XMMWORD PTR [edi],xmm6
  662. DB 102,15,56,0,213
  663. lea edi,DWORD PTR 16[edi]
  664. jnz $L030ccm64_enc_outer
  665. mov esp,DWORD PTR 48[esp]
  666. mov edi,DWORD PTR 40[esp]
  667. movups XMMWORD PTR [edi],xmm3
  668. pxor xmm0,xmm0
  669. pxor xmm1,xmm1
  670. pxor xmm2,xmm2
  671. pxor xmm3,xmm3
  672. pxor xmm4,xmm4
  673. pxor xmm5,xmm5
  674. pxor xmm6,xmm6
  675. pxor xmm7,xmm7
  676. pop edi
  677. pop esi
  678. pop ebx
  679. pop ebp
  680. ret
  681. _aesni_ccm64_encrypt_blocks ENDP
  682. ALIGN 16
  683. _aesni_ccm64_decrypt_blocks PROC PUBLIC
  684. $L_aesni_ccm64_decrypt_blocks_begin::
  685. push ebp
  686. push ebx
  687. push esi
  688. push edi
  689. mov esi,DWORD PTR 20[esp]
  690. mov edi,DWORD PTR 24[esp]
  691. mov eax,DWORD PTR 28[esp]
  692. mov edx,DWORD PTR 32[esp]
  693. mov ebx,DWORD PTR 36[esp]
  694. mov ecx,DWORD PTR 40[esp]
  695. mov ebp,esp
  696. sub esp,60
  697. and esp,-16
  698. mov DWORD PTR 48[esp],ebp
  699. movdqu xmm7,XMMWORD PTR [ebx]
  700. movdqu xmm3,XMMWORD PTR [ecx]
  701. mov ecx,DWORD PTR 240[edx]
  702. mov DWORD PTR [esp],202182159
  703. mov DWORD PTR 4[esp],134810123
  704. mov DWORD PTR 8[esp],67438087
  705. mov DWORD PTR 12[esp],66051
  706. mov ebx,1
  707. xor ebp,ebp
  708. mov DWORD PTR 16[esp],ebx
  709. mov DWORD PTR 20[esp],ebp
  710. mov DWORD PTR 24[esp],ebp
  711. mov DWORD PTR 28[esp],ebp
  712. movdqa xmm5,XMMWORD PTR [esp]
  713. movdqa xmm2,xmm7
  714. mov ebp,edx
  715. mov ebx,ecx
  716. DB 102,15,56,0,253
  717. movups xmm0,XMMWORD PTR [edx]
  718. movups xmm1,XMMWORD PTR 16[edx]
  719. lea edx,DWORD PTR 32[edx]
  720. xorps xmm2,xmm0
  721. $L032enc1_loop_5:
  722. DB 102,15,56,220,209
  723. dec ecx
  724. movups xmm1,XMMWORD PTR [edx]
  725. lea edx,DWORD PTR 16[edx]
  726. jnz $L032enc1_loop_5
  727. DB 102,15,56,221,209
  728. shl ebx,4
  729. mov ecx,16
  730. movups xmm6,XMMWORD PTR [esi]
  731. paddq xmm7,XMMWORD PTR 16[esp]
  732. lea esi,QWORD PTR 16[esi]
  733. sub ecx,ebx
  734. lea edx,DWORD PTR 32[ebx*1+ebp]
  735. mov ebx,ecx
  736. jmp $L033ccm64_dec_outer
  737. ALIGN 16
  738. $L033ccm64_dec_outer:
  739. xorps xmm6,xmm2
  740. movdqa xmm2,xmm7
  741. movups XMMWORD PTR [edi],xmm6
  742. lea edi,DWORD PTR 16[edi]
  743. DB 102,15,56,0,213
  744. sub eax,1
  745. jz $L034ccm64_dec_break
  746. movups xmm0,XMMWORD PTR [ebp]
  747. mov ecx,ebx
  748. movups xmm1,XMMWORD PTR 16[ebp]
  749. xorps xmm6,xmm0
  750. xorps xmm2,xmm0
  751. xorps xmm3,xmm6
  752. movups xmm0,XMMWORD PTR 32[ebp]
  753. $L035ccm64_dec2_loop:
  754. DB 102,15,56,220,209
  755. DB 102,15,56,220,217
  756. movups xmm1,XMMWORD PTR [ecx*1+edx]
  757. add ecx,32
  758. DB 102,15,56,220,208
  759. DB 102,15,56,220,216
  760. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  761. jnz $L035ccm64_dec2_loop
  762. movups xmm6,XMMWORD PTR [esi]
  763. paddq xmm7,XMMWORD PTR 16[esp]
  764. DB 102,15,56,220,209
  765. DB 102,15,56,220,217
  766. DB 102,15,56,221,208
  767. DB 102,15,56,221,216
  768. lea esi,QWORD PTR 16[esi]
  769. jmp $L033ccm64_dec_outer
  770. ALIGN 16
  771. $L034ccm64_dec_break:
  772. mov ecx,DWORD PTR 240[ebp]
  773. mov edx,ebp
  774. movups xmm0,XMMWORD PTR [edx]
  775. movups xmm1,XMMWORD PTR 16[edx]
  776. xorps xmm6,xmm0
  777. lea edx,DWORD PTR 32[edx]
  778. xorps xmm3,xmm6
  779. $L036enc1_loop_6:
  780. DB 102,15,56,220,217
  781. dec ecx
  782. movups xmm1,XMMWORD PTR [edx]
  783. lea edx,DWORD PTR 16[edx]
  784. jnz $L036enc1_loop_6
  785. DB 102,15,56,221,217
  786. mov esp,DWORD PTR 48[esp]
  787. mov edi,DWORD PTR 40[esp]
  788. movups XMMWORD PTR [edi],xmm3
  789. pxor xmm0,xmm0
  790. pxor xmm1,xmm1
  791. pxor xmm2,xmm2
  792. pxor xmm3,xmm3
  793. pxor xmm4,xmm4
  794. pxor xmm5,xmm5
  795. pxor xmm6,xmm6
  796. pxor xmm7,xmm7
  797. pop edi
  798. pop esi
  799. pop ebx
  800. pop ebp
  801. ret
  802. _aesni_ccm64_decrypt_blocks ENDP
  803. ALIGN 16
  804. _aesni_ctr32_encrypt_blocks PROC PUBLIC
  805. $L_aesni_ctr32_encrypt_blocks_begin::
  806. push ebp
  807. push ebx
  808. push esi
  809. push edi
  810. mov esi,DWORD PTR 20[esp]
  811. mov edi,DWORD PTR 24[esp]
  812. mov eax,DWORD PTR 28[esp]
  813. mov edx,DWORD PTR 32[esp]
  814. mov ebx,DWORD PTR 36[esp]
  815. mov ebp,esp
  816. sub esp,88
  817. and esp,-16
  818. mov DWORD PTR 80[esp],ebp
  819. cmp eax,1
  820. je $L037ctr32_one_shortcut
  821. movdqu xmm7,XMMWORD PTR [ebx]
  822. mov DWORD PTR [esp],202182159
  823. mov DWORD PTR 4[esp],134810123
  824. mov DWORD PTR 8[esp],67438087
  825. mov DWORD PTR 12[esp],66051
  826. mov ecx,6
  827. xor ebp,ebp
  828. mov DWORD PTR 16[esp],ecx
  829. mov DWORD PTR 20[esp],ecx
  830. mov DWORD PTR 24[esp],ecx
  831. mov DWORD PTR 28[esp],ebp
  832. DB 102,15,58,22,251,3
  833. DB 102,15,58,34,253,3
  834. mov ecx,DWORD PTR 240[edx]
  835. bswap ebx
  836. pxor xmm0,xmm0
  837. pxor xmm1,xmm1
  838. movdqa xmm2,XMMWORD PTR [esp]
  839. DB 102,15,58,34,195,0
  840. lea ebp,DWORD PTR 3[ebx]
  841. DB 102,15,58,34,205,0
  842. inc ebx
  843. DB 102,15,58,34,195,1
  844. inc ebp
  845. DB 102,15,58,34,205,1
  846. inc ebx
  847. DB 102,15,58,34,195,2
  848. inc ebp
  849. DB 102,15,58,34,205,2
  850. movdqa XMMWORD PTR 48[esp],xmm0
  851. DB 102,15,56,0,194
  852. movdqu xmm6,XMMWORD PTR [edx]
  853. movdqa XMMWORD PTR 64[esp],xmm1
  854. DB 102,15,56,0,202
  855. pshufd xmm2,xmm0,192
  856. pshufd xmm3,xmm0,128
  857. cmp eax,6
  858. jb $L038ctr32_tail
  859. pxor xmm7,xmm6
  860. shl ecx,4
  861. mov ebx,16
  862. movdqa XMMWORD PTR 32[esp],xmm7
  863. mov ebp,edx
  864. sub ebx,ecx
  865. lea edx,DWORD PTR 32[ecx*1+edx]
  866. sub eax,6
  867. jmp $L039ctr32_loop6
  868. ALIGN 16
  869. $L039ctr32_loop6:
  870. pshufd xmm4,xmm0,64
  871. movdqa xmm0,XMMWORD PTR 32[esp]
  872. pshufd xmm5,xmm1,192
  873. pxor xmm2,xmm0
  874. pshufd xmm6,xmm1,128
  875. pxor xmm3,xmm0
  876. pshufd xmm7,xmm1,64
  877. movups xmm1,XMMWORD PTR 16[ebp]
  878. pxor xmm4,xmm0
  879. pxor xmm5,xmm0
  880. DB 102,15,56,220,209
  881. pxor xmm6,xmm0
  882. pxor xmm7,xmm0
  883. DB 102,15,56,220,217
  884. movups xmm0,XMMWORD PTR 32[ebp]
  885. mov ecx,ebx
  886. DB 102,15,56,220,225
  887. DB 102,15,56,220,233
  888. DB 102,15,56,220,241
  889. DB 102,15,56,220,249
  890. call $L_aesni_encrypt6_enter
  891. movups xmm1,XMMWORD PTR [esi]
  892. movups xmm0,XMMWORD PTR 16[esi]
  893. xorps xmm2,xmm1
  894. movups xmm1,XMMWORD PTR 32[esi]
  895. xorps xmm3,xmm0
  896. movups XMMWORD PTR [edi],xmm2
  897. movdqa xmm0,XMMWORD PTR 16[esp]
  898. xorps xmm4,xmm1
  899. movdqa xmm1,XMMWORD PTR 64[esp]
  900. movups XMMWORD PTR 16[edi],xmm3
  901. movups XMMWORD PTR 32[edi],xmm4
  902. paddd xmm1,xmm0
  903. paddd xmm0,XMMWORD PTR 48[esp]
  904. movdqa xmm2,XMMWORD PTR [esp]
  905. movups xmm3,XMMWORD PTR 48[esi]
  906. movups xmm4,XMMWORD PTR 64[esi]
  907. xorps xmm5,xmm3
  908. movups xmm3,XMMWORD PTR 80[esi]
  909. lea esi,DWORD PTR 96[esi]
  910. movdqa XMMWORD PTR 48[esp],xmm0
  911. DB 102,15,56,0,194
  912. xorps xmm6,xmm4
  913. movups XMMWORD PTR 48[edi],xmm5
  914. xorps xmm7,xmm3
  915. movdqa XMMWORD PTR 64[esp],xmm1
  916. DB 102,15,56,0,202
  917. movups XMMWORD PTR 64[edi],xmm6
  918. pshufd xmm2,xmm0,192
  919. movups XMMWORD PTR 80[edi],xmm7
  920. lea edi,DWORD PTR 96[edi]
  921. pshufd xmm3,xmm0,128
  922. sub eax,6
  923. jnc $L039ctr32_loop6
  924. add eax,6
  925. jz $L040ctr32_ret
  926. movdqu xmm7,XMMWORD PTR [ebp]
  927. mov edx,ebp
  928. pxor xmm7,XMMWORD PTR 32[esp]
  929. mov ecx,DWORD PTR 240[ebp]
  930. $L038ctr32_tail:
  931. por xmm2,xmm7
  932. cmp eax,2
  933. jb $L041ctr32_one
  934. pshufd xmm4,xmm0,64
  935. por xmm3,xmm7
  936. je $L042ctr32_two
  937. pshufd xmm5,xmm1,192
  938. por xmm4,xmm7
  939. cmp eax,4
  940. jb $L043ctr32_three
  941. pshufd xmm6,xmm1,128
  942. por xmm5,xmm7
  943. je $L044ctr32_four
  944. por xmm6,xmm7
  945. call __aesni_encrypt6
  946. movups xmm1,XMMWORD PTR [esi]
  947. movups xmm0,XMMWORD PTR 16[esi]
  948. xorps xmm2,xmm1
  949. movups xmm1,XMMWORD PTR 32[esi]
  950. xorps xmm3,xmm0
  951. movups xmm0,XMMWORD PTR 48[esi]
  952. xorps xmm4,xmm1
  953. movups xmm1,XMMWORD PTR 64[esi]
  954. xorps xmm5,xmm0
  955. movups XMMWORD PTR [edi],xmm2
  956. xorps xmm6,xmm1
  957. movups XMMWORD PTR 16[edi],xmm3
  958. movups XMMWORD PTR 32[edi],xmm4
  959. movups XMMWORD PTR 48[edi],xmm5
  960. movups XMMWORD PTR 64[edi],xmm6
  961. jmp $L040ctr32_ret
  962. ALIGN 16
  963. $L037ctr32_one_shortcut:
  964. movups xmm2,XMMWORD PTR [ebx]
  965. mov ecx,DWORD PTR 240[edx]
  966. $L041ctr32_one:
  967. movups xmm0,XMMWORD PTR [edx]
  968. movups xmm1,XMMWORD PTR 16[edx]
  969. lea edx,DWORD PTR 32[edx]
  970. xorps xmm2,xmm0
  971. $L045enc1_loop_7:
  972. DB 102,15,56,220,209
  973. dec ecx
  974. movups xmm1,XMMWORD PTR [edx]
  975. lea edx,DWORD PTR 16[edx]
  976. jnz $L045enc1_loop_7
  977. DB 102,15,56,221,209
  978. movups xmm6,XMMWORD PTR [esi]
  979. xorps xmm6,xmm2
  980. movups XMMWORD PTR [edi],xmm6
  981. jmp $L040ctr32_ret
  982. ALIGN 16
  983. $L042ctr32_two:
  984. call __aesni_encrypt2
  985. movups xmm5,XMMWORD PTR [esi]
  986. movups xmm6,XMMWORD PTR 16[esi]
  987. xorps xmm2,xmm5
  988. xorps xmm3,xmm6
  989. movups XMMWORD PTR [edi],xmm2
  990. movups XMMWORD PTR 16[edi],xmm3
  991. jmp $L040ctr32_ret
  992. ALIGN 16
  993. $L043ctr32_three:
  994. call __aesni_encrypt3
  995. movups xmm5,XMMWORD PTR [esi]
  996. movups xmm6,XMMWORD PTR 16[esi]
  997. xorps xmm2,xmm5
  998. movups xmm7,XMMWORD PTR 32[esi]
  999. xorps xmm3,xmm6
  1000. movups XMMWORD PTR [edi],xmm2
  1001. xorps xmm4,xmm7
  1002. movups XMMWORD PTR 16[edi],xmm3
  1003. movups XMMWORD PTR 32[edi],xmm4
  1004. jmp $L040ctr32_ret
  1005. ALIGN 16
  1006. $L044ctr32_four:
  1007. call __aesni_encrypt4
  1008. movups xmm6,XMMWORD PTR [esi]
  1009. movups xmm7,XMMWORD PTR 16[esi]
  1010. movups xmm1,XMMWORD PTR 32[esi]
  1011. xorps xmm2,xmm6
  1012. movups xmm0,XMMWORD PTR 48[esi]
  1013. xorps xmm3,xmm7
  1014. movups XMMWORD PTR [edi],xmm2
  1015. xorps xmm4,xmm1
  1016. movups XMMWORD PTR 16[edi],xmm3
  1017. xorps xmm5,xmm0
  1018. movups XMMWORD PTR 32[edi],xmm4
  1019. movups XMMWORD PTR 48[edi],xmm5
  1020. $L040ctr32_ret:
  1021. pxor xmm0,xmm0
  1022. pxor xmm1,xmm1
  1023. pxor xmm2,xmm2
  1024. pxor xmm3,xmm3
  1025. pxor xmm4,xmm4
  1026. movdqa XMMWORD PTR 32[esp],xmm0
  1027. pxor xmm5,xmm5
  1028. movdqa XMMWORD PTR 48[esp],xmm0
  1029. pxor xmm6,xmm6
  1030. movdqa XMMWORD PTR 64[esp],xmm0
  1031. pxor xmm7,xmm7
  1032. mov esp,DWORD PTR 80[esp]
  1033. pop edi
  1034. pop esi
  1035. pop ebx
  1036. pop ebp
  1037. ret
  1038. _aesni_ctr32_encrypt_blocks ENDP
  1039. ALIGN 16
  1040. _aesni_xts_encrypt PROC PUBLIC
  1041. $L_aesni_xts_encrypt_begin::
  1042. push ebp
  1043. push ebx
  1044. push esi
  1045. push edi
  1046. mov edx,DWORD PTR 36[esp]
  1047. mov esi,DWORD PTR 40[esp]
  1048. mov ecx,DWORD PTR 240[edx]
  1049. movups xmm2,XMMWORD PTR [esi]
  1050. movups xmm0,XMMWORD PTR [edx]
  1051. movups xmm1,XMMWORD PTR 16[edx]
  1052. lea edx,DWORD PTR 32[edx]
  1053. xorps xmm2,xmm0
  1054. $L046enc1_loop_8:
  1055. DB 102,15,56,220,209
  1056. dec ecx
  1057. movups xmm1,XMMWORD PTR [edx]
  1058. lea edx,DWORD PTR 16[edx]
  1059. jnz $L046enc1_loop_8
  1060. DB 102,15,56,221,209
  1061. mov esi,DWORD PTR 20[esp]
  1062. mov edi,DWORD PTR 24[esp]
  1063. mov eax,DWORD PTR 28[esp]
  1064. mov edx,DWORD PTR 32[esp]
  1065. mov ebp,esp
  1066. sub esp,120
  1067. mov ecx,DWORD PTR 240[edx]
  1068. and esp,-16
  1069. mov DWORD PTR 96[esp],135
  1070. mov DWORD PTR 100[esp],0
  1071. mov DWORD PTR 104[esp],1
  1072. mov DWORD PTR 108[esp],0
  1073. mov DWORD PTR 112[esp],eax
  1074. mov DWORD PTR 116[esp],ebp
  1075. movdqa xmm1,xmm2
  1076. pxor xmm0,xmm0
  1077. movdqa xmm3,XMMWORD PTR 96[esp]
  1078. pcmpgtd xmm0,xmm1
  1079. and eax,-16
  1080. mov ebp,edx
  1081. mov ebx,ecx
  1082. sub eax,96
  1083. jc $L047xts_enc_short
  1084. shl ecx,4
  1085. mov ebx,16
  1086. sub ebx,ecx
  1087. lea edx,DWORD PTR 32[ecx*1+edx]
  1088. jmp $L048xts_enc_loop6
  1089. ALIGN 16
  1090. $L048xts_enc_loop6:
  1091. pshufd xmm2,xmm0,19
  1092. pxor xmm0,xmm0
  1093. movdqa XMMWORD PTR [esp],xmm1
  1094. paddq xmm1,xmm1
  1095. pand xmm2,xmm3
  1096. pcmpgtd xmm0,xmm1
  1097. pxor xmm1,xmm2
  1098. pshufd xmm2,xmm0,19
  1099. pxor xmm0,xmm0
  1100. movdqa XMMWORD PTR 16[esp],xmm1
  1101. paddq xmm1,xmm1
  1102. pand xmm2,xmm3
  1103. pcmpgtd xmm0,xmm1
  1104. pxor xmm1,xmm2
  1105. pshufd xmm2,xmm0,19
  1106. pxor xmm0,xmm0
  1107. movdqa XMMWORD PTR 32[esp],xmm1
  1108. paddq xmm1,xmm1
  1109. pand xmm2,xmm3
  1110. pcmpgtd xmm0,xmm1
  1111. pxor xmm1,xmm2
  1112. pshufd xmm2,xmm0,19
  1113. pxor xmm0,xmm0
  1114. movdqa XMMWORD PTR 48[esp],xmm1
  1115. paddq xmm1,xmm1
  1116. pand xmm2,xmm3
  1117. pcmpgtd xmm0,xmm1
  1118. pxor xmm1,xmm2
  1119. pshufd xmm7,xmm0,19
  1120. movdqa XMMWORD PTR 64[esp],xmm1
  1121. paddq xmm1,xmm1
  1122. movups xmm0,XMMWORD PTR [ebp]
  1123. pand xmm7,xmm3
  1124. movups xmm2,XMMWORD PTR [esi]
  1125. pxor xmm7,xmm1
  1126. mov ecx,ebx
  1127. movdqu xmm3,XMMWORD PTR 16[esi]
  1128. xorps xmm2,xmm0
  1129. movdqu xmm4,XMMWORD PTR 32[esi]
  1130. pxor xmm3,xmm0
  1131. movdqu xmm5,XMMWORD PTR 48[esi]
  1132. pxor xmm4,xmm0
  1133. movdqu xmm6,XMMWORD PTR 64[esi]
  1134. pxor xmm5,xmm0
  1135. movdqu xmm1,XMMWORD PTR 80[esi]
  1136. pxor xmm6,xmm0
  1137. lea esi,DWORD PTR 96[esi]
  1138. pxor xmm2,XMMWORD PTR [esp]
  1139. movdqa XMMWORD PTR 80[esp],xmm7
  1140. pxor xmm7,xmm1
  1141. movups xmm1,XMMWORD PTR 16[ebp]
  1142. pxor xmm3,XMMWORD PTR 16[esp]
  1143. pxor xmm4,XMMWORD PTR 32[esp]
  1144. DB 102,15,56,220,209
  1145. pxor xmm5,XMMWORD PTR 48[esp]
  1146. pxor xmm6,XMMWORD PTR 64[esp]
  1147. DB 102,15,56,220,217
  1148. pxor xmm7,xmm0
  1149. movups xmm0,XMMWORD PTR 32[ebp]
  1150. DB 102,15,56,220,225
  1151. DB 102,15,56,220,233
  1152. DB 102,15,56,220,241
  1153. DB 102,15,56,220,249
  1154. call $L_aesni_encrypt6_enter
  1155. movdqa xmm1,XMMWORD PTR 80[esp]
  1156. pxor xmm0,xmm0
  1157. xorps xmm2,XMMWORD PTR [esp]
  1158. pcmpgtd xmm0,xmm1
  1159. xorps xmm3,XMMWORD PTR 16[esp]
  1160. movups XMMWORD PTR [edi],xmm2
  1161. xorps xmm4,XMMWORD PTR 32[esp]
  1162. movups XMMWORD PTR 16[edi],xmm3
  1163. xorps xmm5,XMMWORD PTR 48[esp]
  1164. movups XMMWORD PTR 32[edi],xmm4
  1165. xorps xmm6,XMMWORD PTR 64[esp]
  1166. movups XMMWORD PTR 48[edi],xmm5
  1167. xorps xmm7,xmm1
  1168. movups XMMWORD PTR 64[edi],xmm6
  1169. pshufd xmm2,xmm0,19
  1170. movups XMMWORD PTR 80[edi],xmm7
  1171. lea edi,DWORD PTR 96[edi]
  1172. movdqa xmm3,XMMWORD PTR 96[esp]
  1173. pxor xmm0,xmm0
  1174. paddq xmm1,xmm1
  1175. pand xmm2,xmm3
  1176. pcmpgtd xmm0,xmm1
  1177. pxor xmm1,xmm2
  1178. sub eax,96
  1179. jnc $L048xts_enc_loop6
  1180. mov ecx,DWORD PTR 240[ebp]
  1181. mov edx,ebp
  1182. mov ebx,ecx
  1183. $L047xts_enc_short:
  1184. add eax,96
  1185. jz $L049xts_enc_done6x
  1186. movdqa xmm5,xmm1
  1187. cmp eax,32
  1188. jb $L050xts_enc_one
  1189. pshufd xmm2,xmm0,19
  1190. pxor xmm0,xmm0
  1191. paddq xmm1,xmm1
  1192. pand xmm2,xmm3
  1193. pcmpgtd xmm0,xmm1
  1194. pxor xmm1,xmm2
  1195. je $L051xts_enc_two
  1196. pshufd xmm2,xmm0,19
  1197. pxor xmm0,xmm0
  1198. movdqa xmm6,xmm1
  1199. paddq xmm1,xmm1
  1200. pand xmm2,xmm3
  1201. pcmpgtd xmm0,xmm1
  1202. pxor xmm1,xmm2
  1203. cmp eax,64
  1204. jb $L052xts_enc_three
  1205. pshufd xmm2,xmm0,19
  1206. pxor xmm0,xmm0
  1207. movdqa xmm7,xmm1
  1208. paddq xmm1,xmm1
  1209. pand xmm2,xmm3
  1210. pcmpgtd xmm0,xmm1
  1211. pxor xmm1,xmm2
  1212. movdqa XMMWORD PTR [esp],xmm5
  1213. movdqa XMMWORD PTR 16[esp],xmm6
  1214. je $L053xts_enc_four
  1215. movdqa XMMWORD PTR 32[esp],xmm7
  1216. pshufd xmm7,xmm0,19
  1217. movdqa XMMWORD PTR 48[esp],xmm1
  1218. paddq xmm1,xmm1
  1219. pand xmm7,xmm3
  1220. pxor xmm7,xmm1
  1221. movdqu xmm2,XMMWORD PTR [esi]
  1222. movdqu xmm3,XMMWORD PTR 16[esi]
  1223. movdqu xmm4,XMMWORD PTR 32[esi]
  1224. pxor xmm2,XMMWORD PTR [esp]
  1225. movdqu xmm5,XMMWORD PTR 48[esi]
  1226. pxor xmm3,XMMWORD PTR 16[esp]
  1227. movdqu xmm6,XMMWORD PTR 64[esi]
  1228. pxor xmm4,XMMWORD PTR 32[esp]
  1229. lea esi,DWORD PTR 80[esi]
  1230. pxor xmm5,XMMWORD PTR 48[esp]
  1231. movdqa XMMWORD PTR 64[esp],xmm7
  1232. pxor xmm6,xmm7
  1233. call __aesni_encrypt6
  1234. movaps xmm1,XMMWORD PTR 64[esp]
  1235. xorps xmm2,XMMWORD PTR [esp]
  1236. xorps xmm3,XMMWORD PTR 16[esp]
  1237. xorps xmm4,XMMWORD PTR 32[esp]
  1238. movups XMMWORD PTR [edi],xmm2
  1239. xorps xmm5,XMMWORD PTR 48[esp]
  1240. movups XMMWORD PTR 16[edi],xmm3
  1241. xorps xmm6,xmm1
  1242. movups XMMWORD PTR 32[edi],xmm4
  1243. movups XMMWORD PTR 48[edi],xmm5
  1244. movups XMMWORD PTR 64[edi],xmm6
  1245. lea edi,DWORD PTR 80[edi]
  1246. jmp $L054xts_enc_done
  1247. ALIGN 16
  1248. $L050xts_enc_one:
  1249. movups xmm2,XMMWORD PTR [esi]
  1250. lea esi,DWORD PTR 16[esi]
  1251. xorps xmm2,xmm5
  1252. movups xmm0,XMMWORD PTR [edx]
  1253. movups xmm1,XMMWORD PTR 16[edx]
  1254. lea edx,DWORD PTR 32[edx]
  1255. xorps xmm2,xmm0
  1256. $L055enc1_loop_9:
  1257. DB 102,15,56,220,209
  1258. dec ecx
  1259. movups xmm1,XMMWORD PTR [edx]
  1260. lea edx,DWORD PTR 16[edx]
  1261. jnz $L055enc1_loop_9
  1262. DB 102,15,56,221,209
  1263. xorps xmm2,xmm5
  1264. movups XMMWORD PTR [edi],xmm2
  1265. lea edi,DWORD PTR 16[edi]
  1266. movdqa xmm1,xmm5
  1267. jmp $L054xts_enc_done
  1268. ALIGN 16
  1269. $L051xts_enc_two:
  1270. movaps xmm6,xmm1
  1271. movups xmm2,XMMWORD PTR [esi]
  1272. movups xmm3,XMMWORD PTR 16[esi]
  1273. lea esi,DWORD PTR 32[esi]
  1274. xorps xmm2,xmm5
  1275. xorps xmm3,xmm6
  1276. call __aesni_encrypt2
  1277. xorps xmm2,xmm5
  1278. xorps xmm3,xmm6
  1279. movups XMMWORD PTR [edi],xmm2
  1280. movups XMMWORD PTR 16[edi],xmm3
  1281. lea edi,DWORD PTR 32[edi]
  1282. movdqa xmm1,xmm6
  1283. jmp $L054xts_enc_done
  1284. ALIGN 16
  1285. $L052xts_enc_three:
  1286. movaps xmm7,xmm1
  1287. movups xmm2,XMMWORD PTR [esi]
  1288. movups xmm3,XMMWORD PTR 16[esi]
  1289. movups xmm4,XMMWORD PTR 32[esi]
  1290. lea esi,DWORD PTR 48[esi]
  1291. xorps xmm2,xmm5
  1292. xorps xmm3,xmm6
  1293. xorps xmm4,xmm7
  1294. call __aesni_encrypt3
  1295. xorps xmm2,xmm5
  1296. xorps xmm3,xmm6
  1297. xorps xmm4,xmm7
  1298. movups XMMWORD PTR [edi],xmm2
  1299. movups XMMWORD PTR 16[edi],xmm3
  1300. movups XMMWORD PTR 32[edi],xmm4
  1301. lea edi,DWORD PTR 48[edi]
  1302. movdqa xmm1,xmm7
  1303. jmp $L054xts_enc_done
  1304. ALIGN 16
  1305. $L053xts_enc_four:
  1306. movaps xmm6,xmm1
  1307. movups xmm2,XMMWORD PTR [esi]
  1308. movups xmm3,XMMWORD PTR 16[esi]
  1309. movups xmm4,XMMWORD PTR 32[esi]
  1310. xorps xmm2,XMMWORD PTR [esp]
  1311. movups xmm5,XMMWORD PTR 48[esi]
  1312. lea esi,DWORD PTR 64[esi]
  1313. xorps xmm3,XMMWORD PTR 16[esp]
  1314. xorps xmm4,xmm7
  1315. xorps xmm5,xmm6
  1316. call __aesni_encrypt4
  1317. xorps xmm2,XMMWORD PTR [esp]
  1318. xorps xmm3,XMMWORD PTR 16[esp]
  1319. xorps xmm4,xmm7
  1320. movups XMMWORD PTR [edi],xmm2
  1321. xorps xmm5,xmm6
  1322. movups XMMWORD PTR 16[edi],xmm3
  1323. movups XMMWORD PTR 32[edi],xmm4
  1324. movups XMMWORD PTR 48[edi],xmm5
  1325. lea edi,DWORD PTR 64[edi]
  1326. movdqa xmm1,xmm6
  1327. jmp $L054xts_enc_done
  1328. ALIGN 16
  1329. $L049xts_enc_done6x:
  1330. mov eax,DWORD PTR 112[esp]
  1331. and eax,15
  1332. jz $L056xts_enc_ret
  1333. movdqa xmm5,xmm1
  1334. mov DWORD PTR 112[esp],eax
  1335. jmp $L057xts_enc_steal
  1336. ALIGN 16
  1337. $L054xts_enc_done:
  1338. mov eax,DWORD PTR 112[esp]
  1339. pxor xmm0,xmm0
  1340. and eax,15
  1341. jz $L056xts_enc_ret
  1342. pcmpgtd xmm0,xmm1
  1343. mov DWORD PTR 112[esp],eax
  1344. pshufd xmm5,xmm0,19
  1345. paddq xmm1,xmm1
  1346. pand xmm5,XMMWORD PTR 96[esp]
  1347. pxor xmm5,xmm1
  1348. $L057xts_enc_steal:
  1349. movzx ecx,BYTE PTR [esi]
  1350. movzx edx,BYTE PTR [edi-16]
  1351. lea esi,DWORD PTR 1[esi]
  1352. mov BYTE PTR [edi-16],cl
  1353. mov BYTE PTR [edi],dl
  1354. lea edi,DWORD PTR 1[edi]
  1355. sub eax,1
  1356. jnz $L057xts_enc_steal
  1357. sub edi,DWORD PTR 112[esp]
  1358. mov edx,ebp
  1359. mov ecx,ebx
  1360. movups xmm2,XMMWORD PTR [edi-16]
  1361. xorps xmm2,xmm5
  1362. movups xmm0,XMMWORD PTR [edx]
  1363. movups xmm1,XMMWORD PTR 16[edx]
  1364. lea edx,DWORD PTR 32[edx]
  1365. xorps xmm2,xmm0
  1366. $L058enc1_loop_10:
  1367. DB 102,15,56,220,209
  1368. dec ecx
  1369. movups xmm1,XMMWORD PTR [edx]
  1370. lea edx,DWORD PTR 16[edx]
  1371. jnz $L058enc1_loop_10
  1372. DB 102,15,56,221,209
  1373. xorps xmm2,xmm5
  1374. movups XMMWORD PTR [edi-16],xmm2
  1375. $L056xts_enc_ret:
  1376. pxor xmm0,xmm0
  1377. pxor xmm1,xmm1
  1378. pxor xmm2,xmm2
  1379. movdqa XMMWORD PTR [esp],xmm0
  1380. pxor xmm3,xmm3
  1381. movdqa XMMWORD PTR 16[esp],xmm0
  1382. pxor xmm4,xmm4
  1383. movdqa XMMWORD PTR 32[esp],xmm0
  1384. pxor xmm5,xmm5
  1385. movdqa XMMWORD PTR 48[esp],xmm0
  1386. pxor xmm6,xmm6
  1387. movdqa XMMWORD PTR 64[esp],xmm0
  1388. pxor xmm7,xmm7
  1389. movdqa XMMWORD PTR 80[esp],xmm0
  1390. mov esp,DWORD PTR 116[esp]
  1391. pop edi
  1392. pop esi
  1393. pop ebx
  1394. pop ebp
  1395. ret
  1396. _aesni_xts_encrypt ENDP
  1397. ALIGN 16
  1398. _aesni_xts_decrypt PROC PUBLIC
  1399. $L_aesni_xts_decrypt_begin::
  1400. push ebp
  1401. push ebx
  1402. push esi
  1403. push edi
  1404. mov edx,DWORD PTR 36[esp]
  1405. mov esi,DWORD PTR 40[esp]
  1406. mov ecx,DWORD PTR 240[edx]
  1407. movups xmm2,XMMWORD PTR [esi]
  1408. movups xmm0,XMMWORD PTR [edx]
  1409. movups xmm1,XMMWORD PTR 16[edx]
  1410. lea edx,DWORD PTR 32[edx]
  1411. xorps xmm2,xmm0
  1412. $L059enc1_loop_11:
  1413. DB 102,15,56,220,209
  1414. dec ecx
  1415. movups xmm1,XMMWORD PTR [edx]
  1416. lea edx,DWORD PTR 16[edx]
  1417. jnz $L059enc1_loop_11
  1418. DB 102,15,56,221,209
  1419. mov esi,DWORD PTR 20[esp]
  1420. mov edi,DWORD PTR 24[esp]
  1421. mov eax,DWORD PTR 28[esp]
  1422. mov edx,DWORD PTR 32[esp]
  1423. mov ebp,esp
  1424. sub esp,120
  1425. and esp,-16
  1426. xor ebx,ebx
  1427. test eax,15
  1428. setnz bl
  1429. shl ebx,4
  1430. sub eax,ebx
  1431. mov DWORD PTR 96[esp],135
  1432. mov DWORD PTR 100[esp],0
  1433. mov DWORD PTR 104[esp],1
  1434. mov DWORD PTR 108[esp],0
  1435. mov DWORD PTR 112[esp],eax
  1436. mov DWORD PTR 116[esp],ebp
  1437. mov ecx,DWORD PTR 240[edx]
  1438. mov ebp,edx
  1439. mov ebx,ecx
  1440. movdqa xmm1,xmm2
  1441. pxor xmm0,xmm0
  1442. movdqa xmm3,XMMWORD PTR 96[esp]
  1443. pcmpgtd xmm0,xmm1
  1444. and eax,-16
  1445. sub eax,96
  1446. jc $L060xts_dec_short
  1447. shl ecx,4
  1448. mov ebx,16
  1449. sub ebx,ecx
  1450. lea edx,DWORD PTR 32[ecx*1+edx]
  1451. jmp $L061xts_dec_loop6
  1452. ALIGN 16
  1453. $L061xts_dec_loop6:
  1454. pshufd xmm2,xmm0,19
  1455. pxor xmm0,xmm0
  1456. movdqa XMMWORD PTR [esp],xmm1
  1457. paddq xmm1,xmm1
  1458. pand xmm2,xmm3
  1459. pcmpgtd xmm0,xmm1
  1460. pxor xmm1,xmm2
  1461. pshufd xmm2,xmm0,19
  1462. pxor xmm0,xmm0
  1463. movdqa XMMWORD PTR 16[esp],xmm1
  1464. paddq xmm1,xmm1
  1465. pand xmm2,xmm3
  1466. pcmpgtd xmm0,xmm1
  1467. pxor xmm1,xmm2
  1468. pshufd xmm2,xmm0,19
  1469. pxor xmm0,xmm0
  1470. movdqa XMMWORD PTR 32[esp],xmm1
  1471. paddq xmm1,xmm1
  1472. pand xmm2,xmm3
  1473. pcmpgtd xmm0,xmm1
  1474. pxor xmm1,xmm2
  1475. pshufd xmm2,xmm0,19
  1476. pxor xmm0,xmm0
  1477. movdqa XMMWORD PTR 48[esp],xmm1
  1478. paddq xmm1,xmm1
  1479. pand xmm2,xmm3
  1480. pcmpgtd xmm0,xmm1
  1481. pxor xmm1,xmm2
  1482. pshufd xmm7,xmm0,19
  1483. movdqa XMMWORD PTR 64[esp],xmm1
  1484. paddq xmm1,xmm1
  1485. movups xmm0,XMMWORD PTR [ebp]
  1486. pand xmm7,xmm3
  1487. movups xmm2,XMMWORD PTR [esi]
  1488. pxor xmm7,xmm1
  1489. mov ecx,ebx
  1490. movdqu xmm3,XMMWORD PTR 16[esi]
  1491. xorps xmm2,xmm0
  1492. movdqu xmm4,XMMWORD PTR 32[esi]
  1493. pxor xmm3,xmm0
  1494. movdqu xmm5,XMMWORD PTR 48[esi]
  1495. pxor xmm4,xmm0
  1496. movdqu xmm6,XMMWORD PTR 64[esi]
  1497. pxor xmm5,xmm0
  1498. movdqu xmm1,XMMWORD PTR 80[esi]
  1499. pxor xmm6,xmm0
  1500. lea esi,DWORD PTR 96[esi]
  1501. pxor xmm2,XMMWORD PTR [esp]
  1502. movdqa XMMWORD PTR 80[esp],xmm7
  1503. pxor xmm7,xmm1
  1504. movups xmm1,XMMWORD PTR 16[ebp]
  1505. pxor xmm3,XMMWORD PTR 16[esp]
  1506. pxor xmm4,XMMWORD PTR 32[esp]
  1507. DB 102,15,56,222,209
  1508. pxor xmm5,XMMWORD PTR 48[esp]
  1509. pxor xmm6,XMMWORD PTR 64[esp]
  1510. DB 102,15,56,222,217
  1511. pxor xmm7,xmm0
  1512. movups xmm0,XMMWORD PTR 32[ebp]
  1513. DB 102,15,56,222,225
  1514. DB 102,15,56,222,233
  1515. DB 102,15,56,222,241
  1516. DB 102,15,56,222,249
  1517. call $L_aesni_decrypt6_enter
  1518. movdqa xmm1,XMMWORD PTR 80[esp]
  1519. pxor xmm0,xmm0
  1520. xorps xmm2,XMMWORD PTR [esp]
  1521. pcmpgtd xmm0,xmm1
  1522. xorps xmm3,XMMWORD PTR 16[esp]
  1523. movups XMMWORD PTR [edi],xmm2
  1524. xorps xmm4,XMMWORD PTR 32[esp]
  1525. movups XMMWORD PTR 16[edi],xmm3
  1526. xorps xmm5,XMMWORD PTR 48[esp]
  1527. movups XMMWORD PTR 32[edi],xmm4
  1528. xorps xmm6,XMMWORD PTR 64[esp]
  1529. movups XMMWORD PTR 48[edi],xmm5
  1530. xorps xmm7,xmm1
  1531. movups XMMWORD PTR 64[edi],xmm6
  1532. pshufd xmm2,xmm0,19
  1533. movups XMMWORD PTR 80[edi],xmm7
  1534. lea edi,DWORD PTR 96[edi]
  1535. movdqa xmm3,XMMWORD PTR 96[esp]
  1536. pxor xmm0,xmm0
  1537. paddq xmm1,xmm1
  1538. pand xmm2,xmm3
  1539. pcmpgtd xmm0,xmm1
  1540. pxor xmm1,xmm2
  1541. sub eax,96
  1542. jnc $L061xts_dec_loop6
  1543. mov ecx,DWORD PTR 240[ebp]
  1544. mov edx,ebp
  1545. mov ebx,ecx
  1546. $L060xts_dec_short:
  1547. add eax,96
  1548. jz $L062xts_dec_done6x
  1549. movdqa xmm5,xmm1
  1550. cmp eax,32
  1551. jb $L063xts_dec_one
  1552. pshufd xmm2,xmm0,19
  1553. pxor xmm0,xmm0
  1554. paddq xmm1,xmm1
  1555. pand xmm2,xmm3
  1556. pcmpgtd xmm0,xmm1
  1557. pxor xmm1,xmm2
  1558. je $L064xts_dec_two
  1559. pshufd xmm2,xmm0,19
  1560. pxor xmm0,xmm0
  1561. movdqa xmm6,xmm1
  1562. paddq xmm1,xmm1
  1563. pand xmm2,xmm3
  1564. pcmpgtd xmm0,xmm1
  1565. pxor xmm1,xmm2
  1566. cmp eax,64
  1567. jb $L065xts_dec_three
  1568. pshufd xmm2,xmm0,19
  1569. pxor xmm0,xmm0
  1570. movdqa xmm7,xmm1
  1571. paddq xmm1,xmm1
  1572. pand xmm2,xmm3
  1573. pcmpgtd xmm0,xmm1
  1574. pxor xmm1,xmm2
  1575. movdqa XMMWORD PTR [esp],xmm5
  1576. movdqa XMMWORD PTR 16[esp],xmm6
  1577. je $L066xts_dec_four
  1578. movdqa XMMWORD PTR 32[esp],xmm7
  1579. pshufd xmm7,xmm0,19
  1580. movdqa XMMWORD PTR 48[esp],xmm1
  1581. paddq xmm1,xmm1
  1582. pand xmm7,xmm3
  1583. pxor xmm7,xmm1
  1584. movdqu xmm2,XMMWORD PTR [esi]
  1585. movdqu xmm3,XMMWORD PTR 16[esi]
  1586. movdqu xmm4,XMMWORD PTR 32[esi]
  1587. pxor xmm2,XMMWORD PTR [esp]
  1588. movdqu xmm5,XMMWORD PTR 48[esi]
  1589. pxor xmm3,XMMWORD PTR 16[esp]
  1590. movdqu xmm6,XMMWORD PTR 64[esi]
  1591. pxor xmm4,XMMWORD PTR 32[esp]
  1592. lea esi,DWORD PTR 80[esi]
  1593. pxor xmm5,XMMWORD PTR 48[esp]
  1594. movdqa XMMWORD PTR 64[esp],xmm7
  1595. pxor xmm6,xmm7
  1596. call __aesni_decrypt6
  1597. movaps xmm1,XMMWORD PTR 64[esp]
  1598. xorps xmm2,XMMWORD PTR [esp]
  1599. xorps xmm3,XMMWORD PTR 16[esp]
  1600. xorps xmm4,XMMWORD PTR 32[esp]
  1601. movups XMMWORD PTR [edi],xmm2
  1602. xorps xmm5,XMMWORD PTR 48[esp]
  1603. movups XMMWORD PTR 16[edi],xmm3
  1604. xorps xmm6,xmm1
  1605. movups XMMWORD PTR 32[edi],xmm4
  1606. movups XMMWORD PTR 48[edi],xmm5
  1607. movups XMMWORD PTR 64[edi],xmm6
  1608. lea edi,DWORD PTR 80[edi]
  1609. jmp $L067xts_dec_done
  1610. ALIGN 16
  1611. $L063xts_dec_one:
  1612. movups xmm2,XMMWORD PTR [esi]
  1613. lea esi,DWORD PTR 16[esi]
  1614. xorps xmm2,xmm5
  1615. movups xmm0,XMMWORD PTR [edx]
  1616. movups xmm1,XMMWORD PTR 16[edx]
  1617. lea edx,DWORD PTR 32[edx]
  1618. xorps xmm2,xmm0
  1619. $L068dec1_loop_12:
  1620. DB 102,15,56,222,209
  1621. dec ecx
  1622. movups xmm1,XMMWORD PTR [edx]
  1623. lea edx,DWORD PTR 16[edx]
  1624. jnz $L068dec1_loop_12
  1625. DB 102,15,56,223,209
  1626. xorps xmm2,xmm5
  1627. movups XMMWORD PTR [edi],xmm2
  1628. lea edi,DWORD PTR 16[edi]
  1629. movdqa xmm1,xmm5
  1630. jmp $L067xts_dec_done
  1631. ALIGN 16
  1632. $L064xts_dec_two:
  1633. movaps xmm6,xmm1
  1634. movups xmm2,XMMWORD PTR [esi]
  1635. movups xmm3,XMMWORD PTR 16[esi]
  1636. lea esi,DWORD PTR 32[esi]
  1637. xorps xmm2,xmm5
  1638. xorps xmm3,xmm6
  1639. call __aesni_decrypt2
  1640. xorps xmm2,xmm5
  1641. xorps xmm3,xmm6
  1642. movups XMMWORD PTR [edi],xmm2
  1643. movups XMMWORD PTR 16[edi],xmm3
  1644. lea edi,DWORD PTR 32[edi]
  1645. movdqa xmm1,xmm6
  1646. jmp $L067xts_dec_done
  1647. ALIGN 16
  1648. $L065xts_dec_three:
  1649. movaps xmm7,xmm1
  1650. movups xmm2,XMMWORD PTR [esi]
  1651. movups xmm3,XMMWORD PTR 16[esi]
  1652. movups xmm4,XMMWORD PTR 32[esi]
  1653. lea esi,DWORD PTR 48[esi]
  1654. xorps xmm2,xmm5
  1655. xorps xmm3,xmm6
  1656. xorps xmm4,xmm7
  1657. call __aesni_decrypt3
  1658. xorps xmm2,xmm5
  1659. xorps xmm3,xmm6
  1660. xorps xmm4,xmm7
  1661. movups XMMWORD PTR [edi],xmm2
  1662. movups XMMWORD PTR 16[edi],xmm3
  1663. movups XMMWORD PTR 32[edi],xmm4
  1664. lea edi,DWORD PTR 48[edi]
  1665. movdqa xmm1,xmm7
  1666. jmp $L067xts_dec_done
  1667. ALIGN 16
  1668. $L066xts_dec_four:
  1669. movaps xmm6,xmm1
  1670. movups xmm2,XMMWORD PTR [esi]
  1671. movups xmm3,XMMWORD PTR 16[esi]
  1672. movups xmm4,XMMWORD PTR 32[esi]
  1673. xorps xmm2,XMMWORD PTR [esp]
  1674. movups xmm5,XMMWORD PTR 48[esi]
  1675. lea esi,DWORD PTR 64[esi]
  1676. xorps xmm3,XMMWORD PTR 16[esp]
  1677. xorps xmm4,xmm7
  1678. xorps xmm5,xmm6
  1679. call __aesni_decrypt4
  1680. xorps xmm2,XMMWORD PTR [esp]
  1681. xorps xmm3,XMMWORD PTR 16[esp]
  1682. xorps xmm4,xmm7
  1683. movups XMMWORD PTR [edi],xmm2
  1684. xorps xmm5,xmm6
  1685. movups XMMWORD PTR 16[edi],xmm3
  1686. movups XMMWORD PTR 32[edi],xmm4
  1687. movups XMMWORD PTR 48[edi],xmm5
  1688. lea edi,DWORD PTR 64[edi]
  1689. movdqa xmm1,xmm6
  1690. jmp $L067xts_dec_done
  1691. ALIGN 16
  1692. $L062xts_dec_done6x:
  1693. mov eax,DWORD PTR 112[esp]
  1694. and eax,15
  1695. jz $L069xts_dec_ret
  1696. mov DWORD PTR 112[esp],eax
  1697. jmp $L070xts_dec_only_one_more
  1698. ALIGN 16
  1699. $L067xts_dec_done:
  1700. mov eax,DWORD PTR 112[esp]
  1701. pxor xmm0,xmm0
  1702. and eax,15
  1703. jz $L069xts_dec_ret
  1704. pcmpgtd xmm0,xmm1
  1705. mov DWORD PTR 112[esp],eax
  1706. pshufd xmm2,xmm0,19
  1707. pxor xmm0,xmm0
  1708. movdqa xmm3,XMMWORD PTR 96[esp]
  1709. paddq xmm1,xmm1
  1710. pand xmm2,xmm3
  1711. pcmpgtd xmm0,xmm1
  1712. pxor xmm1,xmm2
  1713. $L070xts_dec_only_one_more:
  1714. pshufd xmm5,xmm0,19
  1715. movdqa xmm6,xmm1
  1716. paddq xmm1,xmm1
  1717. pand xmm5,xmm3
  1718. pxor xmm5,xmm1
  1719. mov edx,ebp
  1720. mov ecx,ebx
  1721. movups xmm2,XMMWORD PTR [esi]
  1722. xorps xmm2,xmm5
  1723. movups xmm0,XMMWORD PTR [edx]
  1724. movups xmm1,XMMWORD PTR 16[edx]
  1725. lea edx,DWORD PTR 32[edx]
  1726. xorps xmm2,xmm0
  1727. $L071dec1_loop_13:
  1728. DB 102,15,56,222,209
  1729. dec ecx
  1730. movups xmm1,XMMWORD PTR [edx]
  1731. lea edx,DWORD PTR 16[edx]
  1732. jnz $L071dec1_loop_13
  1733. DB 102,15,56,223,209
  1734. xorps xmm2,xmm5
  1735. movups XMMWORD PTR [edi],xmm2
  1736. $L072xts_dec_steal:
  1737. movzx ecx,BYTE PTR 16[esi]
  1738. movzx edx,BYTE PTR [edi]
  1739. lea esi,DWORD PTR 1[esi]
  1740. mov BYTE PTR [edi],cl
  1741. mov BYTE PTR 16[edi],dl
  1742. lea edi,DWORD PTR 1[edi]
  1743. sub eax,1
  1744. jnz $L072xts_dec_steal
  1745. sub edi,DWORD PTR 112[esp]
  1746. mov edx,ebp
  1747. mov ecx,ebx
  1748. movups xmm2,XMMWORD PTR [edi]
  1749. xorps xmm2,xmm6
  1750. movups xmm0,XMMWORD PTR [edx]
  1751. movups xmm1,XMMWORD PTR 16[edx]
  1752. lea edx,DWORD PTR 32[edx]
  1753. xorps xmm2,xmm0
  1754. $L073dec1_loop_14:
  1755. DB 102,15,56,222,209
  1756. dec ecx
  1757. movups xmm1,XMMWORD PTR [edx]
  1758. lea edx,DWORD PTR 16[edx]
  1759. jnz $L073dec1_loop_14
  1760. DB 102,15,56,223,209
  1761. xorps xmm2,xmm6
  1762. movups XMMWORD PTR [edi],xmm2
  1763. $L069xts_dec_ret:
  1764. pxor xmm0,xmm0
  1765. pxor xmm1,xmm1
  1766. pxor xmm2,xmm2
  1767. movdqa XMMWORD PTR [esp],xmm0
  1768. pxor xmm3,xmm3
  1769. movdqa XMMWORD PTR 16[esp],xmm0
  1770. pxor xmm4,xmm4
  1771. movdqa XMMWORD PTR 32[esp],xmm0
  1772. pxor xmm5,xmm5
  1773. movdqa XMMWORD PTR 48[esp],xmm0
  1774. pxor xmm6,xmm6
  1775. movdqa XMMWORD PTR 64[esp],xmm0
  1776. pxor xmm7,xmm7
  1777. movdqa XMMWORD PTR 80[esp],xmm0
  1778. mov esp,DWORD PTR 116[esp]
  1779. pop edi
  1780. pop esi
  1781. pop ebx
  1782. pop ebp
  1783. ret
  1784. _aesni_xts_decrypt ENDP
  1785. ALIGN 16
  1786. _aesni_ocb_encrypt PROC PUBLIC
  1787. $L_aesni_ocb_encrypt_begin::
  1788. push ebp
  1789. push ebx
  1790. push esi
  1791. push edi
  1792. mov ecx,DWORD PTR 40[esp]
  1793. mov ebx,DWORD PTR 48[esp]
  1794. mov esi,DWORD PTR 20[esp]
  1795. mov edi,DWORD PTR 24[esp]
  1796. mov eax,DWORD PTR 28[esp]
  1797. mov edx,DWORD PTR 32[esp]
  1798. movdqu xmm0,XMMWORD PTR [ecx]
  1799. mov ebp,DWORD PTR 36[esp]
  1800. movdqu xmm1,XMMWORD PTR [ebx]
  1801. mov ebx,DWORD PTR 44[esp]
  1802. mov ecx,esp
  1803. sub esp,132
  1804. and esp,-16
  1805. sub edi,esi
  1806. shl eax,4
  1807. lea eax,DWORD PTR [eax*1+esi-96]
  1808. mov DWORD PTR 120[esp],edi
  1809. mov DWORD PTR 124[esp],eax
  1810. mov DWORD PTR 128[esp],ecx
  1811. mov ecx,DWORD PTR 240[edx]
  1812. test ebp,1
  1813. jnz $L074odd
  1814. bsf eax,ebp
  1815. add ebp,1
  1816. shl eax,4
  1817. movdqu xmm7,XMMWORD PTR [eax*1+ebx]
  1818. mov eax,edx
  1819. movdqu xmm2,XMMWORD PTR [esi]
  1820. lea esi,DWORD PTR 16[esi]
  1821. pxor xmm7,xmm0
  1822. pxor xmm1,xmm2
  1823. pxor xmm2,xmm7
  1824. movdqa xmm6,xmm1
  1825. movups xmm0,XMMWORD PTR [edx]
  1826. movups xmm1,XMMWORD PTR 16[edx]
  1827. lea edx,DWORD PTR 32[edx]
  1828. xorps xmm2,xmm0
  1829. $L075enc1_loop_15:
  1830. DB 102,15,56,220,209
  1831. dec ecx
  1832. movups xmm1,XMMWORD PTR [edx]
  1833. lea edx,DWORD PTR 16[edx]
  1834. jnz $L075enc1_loop_15
  1835. DB 102,15,56,221,209
  1836. xorps xmm2,xmm7
  1837. movdqa xmm0,xmm7
  1838. movdqa xmm1,xmm6
  1839. movups XMMWORD PTR [esi*1+edi-16],xmm2
  1840. mov ecx,DWORD PTR 240[eax]
  1841. mov edx,eax
  1842. mov eax,DWORD PTR 124[esp]
  1843. $L074odd:
  1844. shl ecx,4
  1845. mov edi,16
  1846. sub edi,ecx
  1847. mov DWORD PTR 112[esp],edx
  1848. lea edx,DWORD PTR 32[ecx*1+edx]
  1849. mov DWORD PTR 116[esp],edi
  1850. cmp esi,eax
  1851. ja $L076short
  1852. jmp $L077grandloop
  1853. ALIGN 32
  1854. $L077grandloop:
  1855. lea ecx,DWORD PTR 1[ebp]
  1856. lea eax,DWORD PTR 3[ebp]
  1857. lea edi,DWORD PTR 5[ebp]
  1858. add ebp,6
  1859. bsf ecx,ecx
  1860. bsf eax,eax
  1861. bsf edi,edi
  1862. shl ecx,4
  1863. shl eax,4
  1864. shl edi,4
  1865. movdqu xmm2,XMMWORD PTR [ebx]
  1866. movdqu xmm3,XMMWORD PTR [ecx*1+ebx]
  1867. mov ecx,DWORD PTR 116[esp]
  1868. movdqa xmm4,xmm2
  1869. movdqu xmm5,XMMWORD PTR [eax*1+ebx]
  1870. movdqa xmm6,xmm2
  1871. movdqu xmm7,XMMWORD PTR [edi*1+ebx]
  1872. pxor xmm2,xmm0
  1873. pxor xmm3,xmm2
  1874. movdqa XMMWORD PTR [esp],xmm2
  1875. pxor xmm4,xmm3
  1876. movdqa XMMWORD PTR 16[esp],xmm3
  1877. pxor xmm5,xmm4
  1878. movdqa XMMWORD PTR 32[esp],xmm4
  1879. pxor xmm6,xmm5
  1880. movdqa XMMWORD PTR 48[esp],xmm5
  1881. pxor xmm7,xmm6
  1882. movdqa XMMWORD PTR 64[esp],xmm6
  1883. movdqa XMMWORD PTR 80[esp],xmm7
  1884. movups xmm0,XMMWORD PTR [ecx*1+edx-48]
  1885. movdqu xmm2,XMMWORD PTR [esi]
  1886. movdqu xmm3,XMMWORD PTR 16[esi]
  1887. movdqu xmm4,XMMWORD PTR 32[esi]
  1888. movdqu xmm5,XMMWORD PTR 48[esi]
  1889. movdqu xmm6,XMMWORD PTR 64[esi]
  1890. movdqu xmm7,XMMWORD PTR 80[esi]
  1891. lea esi,DWORD PTR 96[esi]
  1892. pxor xmm1,xmm2
  1893. pxor xmm2,xmm0
  1894. pxor xmm1,xmm3
  1895. pxor xmm3,xmm0
  1896. pxor xmm1,xmm4
  1897. pxor xmm4,xmm0
  1898. pxor xmm1,xmm5
  1899. pxor xmm5,xmm0
  1900. pxor xmm1,xmm6
  1901. pxor xmm6,xmm0
  1902. pxor xmm1,xmm7
  1903. pxor xmm7,xmm0
  1904. movdqa XMMWORD PTR 96[esp],xmm1
  1905. movups xmm1,XMMWORD PTR [ecx*1+edx-32]
  1906. pxor xmm2,XMMWORD PTR [esp]
  1907. pxor xmm3,XMMWORD PTR 16[esp]
  1908. pxor xmm4,XMMWORD PTR 32[esp]
  1909. pxor xmm5,XMMWORD PTR 48[esp]
  1910. pxor xmm6,XMMWORD PTR 64[esp]
  1911. pxor xmm7,XMMWORD PTR 80[esp]
  1912. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  1913. DB 102,15,56,220,209
  1914. DB 102,15,56,220,217
  1915. DB 102,15,56,220,225
  1916. DB 102,15,56,220,233
  1917. DB 102,15,56,220,241
  1918. DB 102,15,56,220,249
  1919. mov edi,DWORD PTR 120[esp]
  1920. mov eax,DWORD PTR 124[esp]
  1921. call $L_aesni_encrypt6_enter
  1922. movdqa xmm0,XMMWORD PTR 80[esp]
  1923. pxor xmm2,XMMWORD PTR [esp]
  1924. pxor xmm3,XMMWORD PTR 16[esp]
  1925. pxor xmm4,XMMWORD PTR 32[esp]
  1926. pxor xmm5,XMMWORD PTR 48[esp]
  1927. pxor xmm6,XMMWORD PTR 64[esp]
  1928. pxor xmm7,xmm0
  1929. movdqa xmm1,XMMWORD PTR 96[esp]
  1930. movdqu XMMWORD PTR [esi*1+edi-96],xmm2
  1931. movdqu XMMWORD PTR [esi*1+edi-80],xmm3
  1932. movdqu XMMWORD PTR [esi*1+edi-64],xmm4
  1933. movdqu XMMWORD PTR [esi*1+edi-48],xmm5
  1934. movdqu XMMWORD PTR [esi*1+edi-32],xmm6
  1935. movdqu XMMWORD PTR [esi*1+edi-16],xmm7
  1936. cmp esi,eax
  1937. jb $L077grandloop
  1938. $L076short:
  1939. add eax,96
  1940. sub eax,esi
  1941. jz $L078done
  1942. cmp eax,32
  1943. jb $L079one
  1944. je $L080two
  1945. cmp eax,64
  1946. jb $L081three
  1947. je $L082four
  1948. lea ecx,DWORD PTR 1[ebp]
  1949. lea eax,DWORD PTR 3[ebp]
  1950. bsf ecx,ecx
  1951. bsf eax,eax
  1952. shl ecx,4
  1953. shl eax,4
  1954. movdqu xmm2,XMMWORD PTR [ebx]
  1955. movdqu xmm3,XMMWORD PTR [ecx*1+ebx]
  1956. mov ecx,DWORD PTR 116[esp]
  1957. movdqa xmm4,xmm2
  1958. movdqu xmm5,XMMWORD PTR [eax*1+ebx]
  1959. movdqa xmm6,xmm2
  1960. pxor xmm2,xmm0
  1961. pxor xmm3,xmm2
  1962. movdqa XMMWORD PTR [esp],xmm2
  1963. pxor xmm4,xmm3
  1964. movdqa XMMWORD PTR 16[esp],xmm3
  1965. pxor xmm5,xmm4
  1966. movdqa XMMWORD PTR 32[esp],xmm4
  1967. pxor xmm6,xmm5
  1968. movdqa XMMWORD PTR 48[esp],xmm5
  1969. pxor xmm7,xmm6
  1970. movdqa XMMWORD PTR 64[esp],xmm6
  1971. movups xmm0,XMMWORD PTR [ecx*1+edx-48]
  1972. movdqu xmm2,XMMWORD PTR [esi]
  1973. movdqu xmm3,XMMWORD PTR 16[esi]
  1974. movdqu xmm4,XMMWORD PTR 32[esi]
  1975. movdqu xmm5,XMMWORD PTR 48[esi]
  1976. movdqu xmm6,XMMWORD PTR 64[esi]
  1977. pxor xmm7,xmm7
  1978. pxor xmm1,xmm2
  1979. pxor xmm2,xmm0
  1980. pxor xmm1,xmm3
  1981. pxor xmm3,xmm0
  1982. pxor xmm1,xmm4
  1983. pxor xmm4,xmm0
  1984. pxor xmm1,xmm5
  1985. pxor xmm5,xmm0
  1986. pxor xmm1,xmm6
  1987. pxor xmm6,xmm0
  1988. movdqa XMMWORD PTR 96[esp],xmm1
  1989. movups xmm1,XMMWORD PTR [ecx*1+edx-32]
  1990. pxor xmm2,XMMWORD PTR [esp]
  1991. pxor xmm3,XMMWORD PTR 16[esp]
  1992. pxor xmm4,XMMWORD PTR 32[esp]
  1993. pxor xmm5,XMMWORD PTR 48[esp]
  1994. pxor xmm6,XMMWORD PTR 64[esp]
  1995. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  1996. DB 102,15,56,220,209
  1997. DB 102,15,56,220,217
  1998. DB 102,15,56,220,225
  1999. DB 102,15,56,220,233
  2000. DB 102,15,56,220,241
  2001. DB 102,15,56,220,249
  2002. mov edi,DWORD PTR 120[esp]
  2003. call $L_aesni_encrypt6_enter
  2004. movdqa xmm0,XMMWORD PTR 64[esp]
  2005. pxor xmm2,XMMWORD PTR [esp]
  2006. pxor xmm3,XMMWORD PTR 16[esp]
  2007. pxor xmm4,XMMWORD PTR 32[esp]
  2008. pxor xmm5,XMMWORD PTR 48[esp]
  2009. pxor xmm6,xmm0
  2010. movdqa xmm1,XMMWORD PTR 96[esp]
  2011. movdqu XMMWORD PTR [esi*1+edi],xmm2
  2012. movdqu XMMWORD PTR 16[esi*1+edi],xmm3
  2013. movdqu XMMWORD PTR 32[esi*1+edi],xmm4
  2014. movdqu XMMWORD PTR 48[esi*1+edi],xmm5
  2015. movdqu XMMWORD PTR 64[esi*1+edi],xmm6
  2016. jmp $L078done
  2017. ALIGN 16
  2018. $L079one:
  2019. movdqu xmm7,XMMWORD PTR [ebx]
  2020. mov edx,DWORD PTR 112[esp]
  2021. movdqu xmm2,XMMWORD PTR [esi]
  2022. mov ecx,DWORD PTR 240[edx]
  2023. pxor xmm7,xmm0
  2024. pxor xmm1,xmm2
  2025. pxor xmm2,xmm7
  2026. movdqa xmm6,xmm1
  2027. mov edi,DWORD PTR 120[esp]
  2028. movups xmm0,XMMWORD PTR [edx]
  2029. movups xmm1,XMMWORD PTR 16[edx]
  2030. lea edx,DWORD PTR 32[edx]
  2031. xorps xmm2,xmm0
  2032. $L083enc1_loop_16:
  2033. DB 102,15,56,220,209
  2034. dec ecx
  2035. movups xmm1,XMMWORD PTR [edx]
  2036. lea edx,DWORD PTR 16[edx]
  2037. jnz $L083enc1_loop_16
  2038. DB 102,15,56,221,209
  2039. xorps xmm2,xmm7
  2040. movdqa xmm0,xmm7
  2041. movdqa xmm1,xmm6
  2042. movups XMMWORD PTR [esi*1+edi],xmm2
  2043. jmp $L078done
  2044. ALIGN 16
  2045. $L080two:
  2046. lea ecx,DWORD PTR 1[ebp]
  2047. mov edx,DWORD PTR 112[esp]
  2048. bsf ecx,ecx
  2049. shl ecx,4
  2050. movdqu xmm6,XMMWORD PTR [ebx]
  2051. movdqu xmm7,XMMWORD PTR [ecx*1+ebx]
  2052. movdqu xmm2,XMMWORD PTR [esi]
  2053. movdqu xmm3,XMMWORD PTR 16[esi]
  2054. mov ecx,DWORD PTR 240[edx]
  2055. pxor xmm6,xmm0
  2056. pxor xmm7,xmm6
  2057. pxor xmm1,xmm2
  2058. pxor xmm2,xmm6
  2059. pxor xmm1,xmm3
  2060. pxor xmm3,xmm7
  2061. movdqa xmm5,xmm1
  2062. mov edi,DWORD PTR 120[esp]
  2063. call __aesni_encrypt2
  2064. xorps xmm2,xmm6
  2065. xorps xmm3,xmm7
  2066. movdqa xmm0,xmm7
  2067. movdqa xmm1,xmm5
  2068. movups XMMWORD PTR [esi*1+edi],xmm2
  2069. movups XMMWORD PTR 16[esi*1+edi],xmm3
  2070. jmp $L078done
  2071. ALIGN 16
  2072. $L081three:
  2073. lea ecx,DWORD PTR 1[ebp]
  2074. mov edx,DWORD PTR 112[esp]
  2075. bsf ecx,ecx
  2076. shl ecx,4
  2077. movdqu xmm5,XMMWORD PTR [ebx]
  2078. movdqu xmm6,XMMWORD PTR [ecx*1+ebx]
  2079. movdqa xmm7,xmm5
  2080. movdqu xmm2,XMMWORD PTR [esi]
  2081. movdqu xmm3,XMMWORD PTR 16[esi]
  2082. movdqu xmm4,XMMWORD PTR 32[esi]
  2083. mov ecx,DWORD PTR 240[edx]
  2084. pxor xmm5,xmm0
  2085. pxor xmm6,xmm5
  2086. pxor xmm7,xmm6
  2087. pxor xmm1,xmm2
  2088. pxor xmm2,xmm5
  2089. pxor xmm1,xmm3
  2090. pxor xmm3,xmm6
  2091. pxor xmm1,xmm4
  2092. pxor xmm4,xmm7
  2093. movdqa XMMWORD PTR 96[esp],xmm1
  2094. mov edi,DWORD PTR 120[esp]
  2095. call __aesni_encrypt3
  2096. xorps xmm2,xmm5
  2097. xorps xmm3,xmm6
  2098. xorps xmm4,xmm7
  2099. movdqa xmm0,xmm7
  2100. movdqa xmm1,XMMWORD PTR 96[esp]
  2101. movups XMMWORD PTR [esi*1+edi],xmm2
  2102. movups XMMWORD PTR 16[esi*1+edi],xmm3
  2103. movups XMMWORD PTR 32[esi*1+edi],xmm4
  2104. jmp $L078done
  2105. ALIGN 16
  2106. $L082four:
  2107. lea ecx,DWORD PTR 1[ebp]
  2108. lea eax,DWORD PTR 3[ebp]
  2109. bsf ecx,ecx
  2110. bsf eax,eax
  2111. mov edx,DWORD PTR 112[esp]
  2112. shl ecx,4
  2113. shl eax,4
  2114. movdqu xmm4,XMMWORD PTR [ebx]
  2115. movdqu xmm5,XMMWORD PTR [ecx*1+ebx]
  2116. movdqa xmm6,xmm4
  2117. movdqu xmm7,XMMWORD PTR [eax*1+ebx]
  2118. pxor xmm4,xmm0
  2119. movdqu xmm2,XMMWORD PTR [esi]
  2120. pxor xmm5,xmm4
  2121. movdqu xmm3,XMMWORD PTR 16[esi]
  2122. pxor xmm6,xmm5
  2123. movdqa XMMWORD PTR [esp],xmm4
  2124. pxor xmm7,xmm6
  2125. movdqa XMMWORD PTR 16[esp],xmm5
  2126. movdqu xmm4,XMMWORD PTR 32[esi]
  2127. movdqu xmm5,XMMWORD PTR 48[esi]
  2128. mov ecx,DWORD PTR 240[edx]
  2129. pxor xmm1,xmm2
  2130. pxor xmm2,XMMWORD PTR [esp]
  2131. pxor xmm1,xmm3
  2132. pxor xmm3,XMMWORD PTR 16[esp]
  2133. pxor xmm1,xmm4
  2134. pxor xmm4,xmm6
  2135. pxor xmm1,xmm5
  2136. pxor xmm5,xmm7
  2137. movdqa XMMWORD PTR 96[esp],xmm1
  2138. mov edi,DWORD PTR 120[esp]
  2139. call __aesni_encrypt4
  2140. xorps xmm2,XMMWORD PTR [esp]
  2141. xorps xmm3,XMMWORD PTR 16[esp]
  2142. xorps xmm4,xmm6
  2143. movups XMMWORD PTR [esi*1+edi],xmm2
  2144. xorps xmm5,xmm7
  2145. movups XMMWORD PTR 16[esi*1+edi],xmm3
  2146. movdqa xmm0,xmm7
  2147. movups XMMWORD PTR 32[esi*1+edi],xmm4
  2148. movdqa xmm1,XMMWORD PTR 96[esp]
  2149. movups XMMWORD PTR 48[esi*1+edi],xmm5
  2150. $L078done:
  2151. mov edx,DWORD PTR 128[esp]
  2152. pxor xmm2,xmm2
  2153. pxor xmm3,xmm3
  2154. movdqa XMMWORD PTR [esp],xmm2
  2155. pxor xmm4,xmm4
  2156. movdqa XMMWORD PTR 16[esp],xmm2
  2157. pxor xmm5,xmm5
  2158. movdqa XMMWORD PTR 32[esp],xmm2
  2159. pxor xmm6,xmm6
  2160. movdqa XMMWORD PTR 48[esp],xmm2
  2161. pxor xmm7,xmm7
  2162. movdqa XMMWORD PTR 64[esp],xmm2
  2163. movdqa XMMWORD PTR 80[esp],xmm2
  2164. movdqa XMMWORD PTR 96[esp],xmm2
  2165. lea esp,DWORD PTR [edx]
  2166. mov ecx,DWORD PTR 40[esp]
  2167. mov ebx,DWORD PTR 48[esp]
  2168. movdqu XMMWORD PTR [ecx],xmm0
  2169. pxor xmm0,xmm0
  2170. movdqu XMMWORD PTR [ebx],xmm1
  2171. pxor xmm1,xmm1
  2172. pop edi
  2173. pop esi
  2174. pop ebx
  2175. pop ebp
  2176. ret
  2177. _aesni_ocb_encrypt ENDP
  2178. ALIGN 16
  2179. _aesni_ocb_decrypt PROC PUBLIC
  2180. $L_aesni_ocb_decrypt_begin::
  2181. push ebp
  2182. push ebx
  2183. push esi
  2184. push edi
  2185. mov ecx,DWORD PTR 40[esp]
  2186. mov ebx,DWORD PTR 48[esp]
  2187. mov esi,DWORD PTR 20[esp]
  2188. mov edi,DWORD PTR 24[esp]
  2189. mov eax,DWORD PTR 28[esp]
  2190. mov edx,DWORD PTR 32[esp]
  2191. movdqu xmm0,XMMWORD PTR [ecx]
  2192. mov ebp,DWORD PTR 36[esp]
  2193. movdqu xmm1,XMMWORD PTR [ebx]
  2194. mov ebx,DWORD PTR 44[esp]
  2195. mov ecx,esp
  2196. sub esp,132
  2197. and esp,-16
  2198. sub edi,esi
  2199. shl eax,4
  2200. lea eax,DWORD PTR [eax*1+esi-96]
  2201. mov DWORD PTR 120[esp],edi
  2202. mov DWORD PTR 124[esp],eax
  2203. mov DWORD PTR 128[esp],ecx
  2204. mov ecx,DWORD PTR 240[edx]
  2205. test ebp,1
  2206. jnz $L084odd
  2207. bsf eax,ebp
  2208. add ebp,1
  2209. shl eax,4
  2210. movdqu xmm7,XMMWORD PTR [eax*1+ebx]
  2211. mov eax,edx
  2212. movdqu xmm2,XMMWORD PTR [esi]
  2213. lea esi,DWORD PTR 16[esi]
  2214. pxor xmm7,xmm0
  2215. pxor xmm2,xmm7
  2216. movdqa xmm6,xmm1
  2217. movups xmm0,XMMWORD PTR [edx]
  2218. movups xmm1,XMMWORD PTR 16[edx]
  2219. lea edx,DWORD PTR 32[edx]
  2220. xorps xmm2,xmm0
  2221. $L085dec1_loop_17:
  2222. DB 102,15,56,222,209
  2223. dec ecx
  2224. movups xmm1,XMMWORD PTR [edx]
  2225. lea edx,DWORD PTR 16[edx]
  2226. jnz $L085dec1_loop_17
  2227. DB 102,15,56,223,209
  2228. xorps xmm2,xmm7
  2229. movaps xmm1,xmm6
  2230. movdqa xmm0,xmm7
  2231. xorps xmm1,xmm2
  2232. movups XMMWORD PTR [esi*1+edi-16],xmm2
  2233. mov ecx,DWORD PTR 240[eax]
  2234. mov edx,eax
  2235. mov eax,DWORD PTR 124[esp]
  2236. $L084odd:
  2237. shl ecx,4
  2238. mov edi,16
  2239. sub edi,ecx
  2240. mov DWORD PTR 112[esp],edx
  2241. lea edx,DWORD PTR 32[ecx*1+edx]
  2242. mov DWORD PTR 116[esp],edi
  2243. cmp esi,eax
  2244. ja $L086short
  2245. jmp $L087grandloop
  2246. ALIGN 32
  2247. $L087grandloop:
  2248. lea ecx,DWORD PTR 1[ebp]
  2249. lea eax,DWORD PTR 3[ebp]
  2250. lea edi,DWORD PTR 5[ebp]
  2251. add ebp,6
  2252. bsf ecx,ecx
  2253. bsf eax,eax
  2254. bsf edi,edi
  2255. shl ecx,4
  2256. shl eax,4
  2257. shl edi,4
  2258. movdqu xmm2,XMMWORD PTR [ebx]
  2259. movdqu xmm3,XMMWORD PTR [ecx*1+ebx]
  2260. mov ecx,DWORD PTR 116[esp]
  2261. movdqa xmm4,xmm2
  2262. movdqu xmm5,XMMWORD PTR [eax*1+ebx]
  2263. movdqa xmm6,xmm2
  2264. movdqu xmm7,XMMWORD PTR [edi*1+ebx]
  2265. pxor xmm2,xmm0
  2266. pxor xmm3,xmm2
  2267. movdqa XMMWORD PTR [esp],xmm2
  2268. pxor xmm4,xmm3
  2269. movdqa XMMWORD PTR 16[esp],xmm3
  2270. pxor xmm5,xmm4
  2271. movdqa XMMWORD PTR 32[esp],xmm4
  2272. pxor xmm6,xmm5
  2273. movdqa XMMWORD PTR 48[esp],xmm5
  2274. pxor xmm7,xmm6
  2275. movdqa XMMWORD PTR 64[esp],xmm6
  2276. movdqa XMMWORD PTR 80[esp],xmm7
  2277. movups xmm0,XMMWORD PTR [ecx*1+edx-48]
  2278. movdqu xmm2,XMMWORD PTR [esi]
  2279. movdqu xmm3,XMMWORD PTR 16[esi]
  2280. movdqu xmm4,XMMWORD PTR 32[esi]
  2281. movdqu xmm5,XMMWORD PTR 48[esi]
  2282. movdqu xmm6,XMMWORD PTR 64[esi]
  2283. movdqu xmm7,XMMWORD PTR 80[esi]
  2284. lea esi,DWORD PTR 96[esi]
  2285. movdqa XMMWORD PTR 96[esp],xmm1
  2286. pxor xmm2,xmm0
  2287. pxor xmm3,xmm0
  2288. pxor xmm4,xmm0
  2289. pxor xmm5,xmm0
  2290. pxor xmm6,xmm0
  2291. pxor xmm7,xmm0
  2292. movups xmm1,XMMWORD PTR [ecx*1+edx-32]
  2293. pxor xmm2,XMMWORD PTR [esp]
  2294. pxor xmm3,XMMWORD PTR 16[esp]
  2295. pxor xmm4,XMMWORD PTR 32[esp]
  2296. pxor xmm5,XMMWORD PTR 48[esp]
  2297. pxor xmm6,XMMWORD PTR 64[esp]
  2298. pxor xmm7,XMMWORD PTR 80[esp]
  2299. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  2300. DB 102,15,56,222,209
  2301. DB 102,15,56,222,217
  2302. DB 102,15,56,222,225
  2303. DB 102,15,56,222,233
  2304. DB 102,15,56,222,241
  2305. DB 102,15,56,222,249
  2306. mov edi,DWORD PTR 120[esp]
  2307. mov eax,DWORD PTR 124[esp]
  2308. call $L_aesni_decrypt6_enter
  2309. movdqa xmm0,XMMWORD PTR 80[esp]
  2310. pxor xmm2,XMMWORD PTR [esp]
  2311. movdqa xmm1,XMMWORD PTR 96[esp]
  2312. pxor xmm3,XMMWORD PTR 16[esp]
  2313. pxor xmm4,XMMWORD PTR 32[esp]
  2314. pxor xmm5,XMMWORD PTR 48[esp]
  2315. pxor xmm6,XMMWORD PTR 64[esp]
  2316. pxor xmm7,xmm0
  2317. pxor xmm1,xmm2
  2318. movdqu XMMWORD PTR [esi*1+edi-96],xmm2
  2319. pxor xmm1,xmm3
  2320. movdqu XMMWORD PTR [esi*1+edi-80],xmm3
  2321. pxor xmm1,xmm4
  2322. movdqu XMMWORD PTR [esi*1+edi-64],xmm4
  2323. pxor xmm1,xmm5
  2324. movdqu XMMWORD PTR [esi*1+edi-48],xmm5
  2325. pxor xmm1,xmm6
  2326. movdqu XMMWORD PTR [esi*1+edi-32],xmm6
  2327. pxor xmm1,xmm7
  2328. movdqu XMMWORD PTR [esi*1+edi-16],xmm7
  2329. cmp esi,eax
  2330. jb $L087grandloop
  2331. $L086short:
  2332. add eax,96
  2333. sub eax,esi
  2334. jz $L088done
  2335. cmp eax,32
  2336. jb $L089one
  2337. je $L090two
  2338. cmp eax,64
  2339. jb $L091three
  2340. je $L092four
  2341. lea ecx,DWORD PTR 1[ebp]
  2342. lea eax,DWORD PTR 3[ebp]
  2343. bsf ecx,ecx
  2344. bsf eax,eax
  2345. shl ecx,4
  2346. shl eax,4
  2347. movdqu xmm2,XMMWORD PTR [ebx]
  2348. movdqu xmm3,XMMWORD PTR [ecx*1+ebx]
  2349. mov ecx,DWORD PTR 116[esp]
  2350. movdqa xmm4,xmm2
  2351. movdqu xmm5,XMMWORD PTR [eax*1+ebx]
  2352. movdqa xmm6,xmm2
  2353. pxor xmm2,xmm0
  2354. pxor xmm3,xmm2
  2355. movdqa XMMWORD PTR [esp],xmm2
  2356. pxor xmm4,xmm3
  2357. movdqa XMMWORD PTR 16[esp],xmm3
  2358. pxor xmm5,xmm4
  2359. movdqa XMMWORD PTR 32[esp],xmm4
  2360. pxor xmm6,xmm5
  2361. movdqa XMMWORD PTR 48[esp],xmm5
  2362. pxor xmm7,xmm6
  2363. movdqa XMMWORD PTR 64[esp],xmm6
  2364. movups xmm0,XMMWORD PTR [ecx*1+edx-48]
  2365. movdqu xmm2,XMMWORD PTR [esi]
  2366. movdqu xmm3,XMMWORD PTR 16[esi]
  2367. movdqu xmm4,XMMWORD PTR 32[esi]
  2368. movdqu xmm5,XMMWORD PTR 48[esi]
  2369. movdqu xmm6,XMMWORD PTR 64[esi]
  2370. pxor xmm7,xmm7
  2371. movdqa XMMWORD PTR 96[esp],xmm1
  2372. pxor xmm2,xmm0
  2373. pxor xmm3,xmm0
  2374. pxor xmm4,xmm0
  2375. pxor xmm5,xmm0
  2376. pxor xmm6,xmm0
  2377. movups xmm1,XMMWORD PTR [ecx*1+edx-32]
  2378. pxor xmm2,XMMWORD PTR [esp]
  2379. pxor xmm3,XMMWORD PTR 16[esp]
  2380. pxor xmm4,XMMWORD PTR 32[esp]
  2381. pxor xmm5,XMMWORD PTR 48[esp]
  2382. pxor xmm6,XMMWORD PTR 64[esp]
  2383. movups xmm0,XMMWORD PTR [ecx*1+edx-16]
  2384. DB 102,15,56,222,209
  2385. DB 102,15,56,222,217
  2386. DB 102,15,56,222,225
  2387. DB 102,15,56,222,233
  2388. DB 102,15,56,222,241
  2389. DB 102,15,56,222,249
  2390. mov edi,DWORD PTR 120[esp]
  2391. call $L_aesni_decrypt6_enter
  2392. movdqa xmm0,XMMWORD PTR 64[esp]
  2393. pxor xmm2,XMMWORD PTR [esp]
  2394. movdqa xmm1,XMMWORD PTR 96[esp]
  2395. pxor xmm3,XMMWORD PTR 16[esp]
  2396. pxor xmm4,XMMWORD PTR 32[esp]
  2397. pxor xmm5,XMMWORD PTR 48[esp]
  2398. pxor xmm6,xmm0
  2399. pxor xmm1,xmm2
  2400. movdqu XMMWORD PTR [esi*1+edi],xmm2
  2401. pxor xmm1,xmm3
  2402. movdqu XMMWORD PTR 16[esi*1+edi],xmm3
  2403. pxor xmm1,xmm4
  2404. movdqu XMMWORD PTR 32[esi*1+edi],xmm4
  2405. pxor xmm1,xmm5
  2406. movdqu XMMWORD PTR 48[esi*1+edi],xmm5
  2407. pxor xmm1,xmm6
  2408. movdqu XMMWORD PTR 64[esi*1+edi],xmm6
  2409. jmp $L088done
  2410. ALIGN 16
  2411. $L089one:
  2412. movdqu xmm7,XMMWORD PTR [ebx]
  2413. mov edx,DWORD PTR 112[esp]
  2414. movdqu xmm2,XMMWORD PTR [esi]
  2415. mov ecx,DWORD PTR 240[edx]
  2416. pxor xmm7,xmm0
  2417. pxor xmm2,xmm7
  2418. movdqa xmm6,xmm1
  2419. mov edi,DWORD PTR 120[esp]
  2420. movups xmm0,XMMWORD PTR [edx]
  2421. movups xmm1,XMMWORD PTR 16[edx]
  2422. lea edx,DWORD PTR 32[edx]
  2423. xorps xmm2,xmm0
  2424. $L093dec1_loop_18:
  2425. DB 102,15,56,222,209
  2426. dec ecx
  2427. movups xmm1,XMMWORD PTR [edx]
  2428. lea edx,DWORD PTR 16[edx]
  2429. jnz $L093dec1_loop_18
  2430. DB 102,15,56,223,209
  2431. xorps xmm2,xmm7
  2432. movaps xmm1,xmm6
  2433. movdqa xmm0,xmm7
  2434. xorps xmm1,xmm2
  2435. movups XMMWORD PTR [esi*1+edi],xmm2
  2436. jmp $L088done
  2437. ALIGN 16
  2438. $L090two:
  2439. lea ecx,DWORD PTR 1[ebp]
  2440. mov edx,DWORD PTR 112[esp]
  2441. bsf ecx,ecx
  2442. shl ecx,4
  2443. movdqu xmm6,XMMWORD PTR [ebx]
  2444. movdqu xmm7,XMMWORD PTR [ecx*1+ebx]
  2445. movdqu xmm2,XMMWORD PTR [esi]
  2446. movdqu xmm3,XMMWORD PTR 16[esi]
  2447. mov ecx,DWORD PTR 240[edx]
  2448. movdqa xmm5,xmm1
  2449. pxor xmm6,xmm0
  2450. pxor xmm7,xmm6
  2451. pxor xmm2,xmm6
  2452. pxor xmm3,xmm7
  2453. mov edi,DWORD PTR 120[esp]
  2454. call __aesni_decrypt2
  2455. xorps xmm2,xmm6
  2456. xorps xmm3,xmm7
  2457. movdqa xmm0,xmm7
  2458. xorps xmm5,xmm2
  2459. movups XMMWORD PTR [esi*1+edi],xmm2
  2460. xorps xmm5,xmm3
  2461. movups XMMWORD PTR 16[esi*1+edi],xmm3
  2462. movaps xmm1,xmm5
  2463. jmp $L088done
  2464. ALIGN 16
  2465. $L091three:
  2466. lea ecx,DWORD PTR 1[ebp]
  2467. mov edx,DWORD PTR 112[esp]
  2468. bsf ecx,ecx
  2469. shl ecx,4
  2470. movdqu xmm5,XMMWORD PTR [ebx]
  2471. movdqu xmm6,XMMWORD PTR [ecx*1+ebx]
  2472. movdqa xmm7,xmm5
  2473. movdqu xmm2,XMMWORD PTR [esi]
  2474. movdqu xmm3,XMMWORD PTR 16[esi]
  2475. movdqu xmm4,XMMWORD PTR 32[esi]
  2476. mov ecx,DWORD PTR 240[edx]
  2477. movdqa XMMWORD PTR 96[esp],xmm1
  2478. pxor xmm5,xmm0
  2479. pxor xmm6,xmm5
  2480. pxor xmm7,xmm6
  2481. pxor xmm2,xmm5
  2482. pxor xmm3,xmm6
  2483. pxor xmm4,xmm7
  2484. mov edi,DWORD PTR 120[esp]
  2485. call __aesni_decrypt3
  2486. movdqa xmm1,XMMWORD PTR 96[esp]
  2487. xorps xmm2,xmm5
  2488. xorps xmm3,xmm6
  2489. xorps xmm4,xmm7
  2490. movups XMMWORD PTR [esi*1+edi],xmm2
  2491. pxor xmm1,xmm2
  2492. movdqa xmm0,xmm7
  2493. movups XMMWORD PTR 16[esi*1+edi],xmm3
  2494. pxor xmm1,xmm3
  2495. movups XMMWORD PTR 32[esi*1+edi],xmm4
  2496. pxor xmm1,xmm4
  2497. jmp $L088done
  2498. ALIGN 16
  2499. $L092four:
  2500. lea ecx,DWORD PTR 1[ebp]
  2501. lea eax,DWORD PTR 3[ebp]
  2502. bsf ecx,ecx
  2503. bsf eax,eax
  2504. mov edx,DWORD PTR 112[esp]
  2505. shl ecx,4
  2506. shl eax,4
  2507. movdqu xmm4,XMMWORD PTR [ebx]
  2508. movdqu xmm5,XMMWORD PTR [ecx*1+ebx]
  2509. movdqa xmm6,xmm4
  2510. movdqu xmm7,XMMWORD PTR [eax*1+ebx]
  2511. pxor xmm4,xmm0
  2512. movdqu xmm2,XMMWORD PTR [esi]
  2513. pxor xmm5,xmm4
  2514. movdqu xmm3,XMMWORD PTR 16[esi]
  2515. pxor xmm6,xmm5
  2516. movdqa XMMWORD PTR [esp],xmm4
  2517. pxor xmm7,xmm6
  2518. movdqa XMMWORD PTR 16[esp],xmm5
  2519. movdqu xmm4,XMMWORD PTR 32[esi]
  2520. movdqu xmm5,XMMWORD PTR 48[esi]
  2521. mov ecx,DWORD PTR 240[edx]
  2522. movdqa XMMWORD PTR 96[esp],xmm1
  2523. pxor xmm2,XMMWORD PTR [esp]
  2524. pxor xmm3,XMMWORD PTR 16[esp]
  2525. pxor xmm4,xmm6
  2526. pxor xmm5,xmm7
  2527. mov edi,DWORD PTR 120[esp]
  2528. call __aesni_decrypt4
  2529. movdqa xmm1,XMMWORD PTR 96[esp]
  2530. xorps xmm2,XMMWORD PTR [esp]
  2531. xorps xmm3,XMMWORD PTR 16[esp]
  2532. xorps xmm4,xmm6
  2533. movups XMMWORD PTR [esi*1+edi],xmm2
  2534. pxor xmm1,xmm2
  2535. xorps xmm5,xmm7
  2536. movups XMMWORD PTR 16[esi*1+edi],xmm3
  2537. pxor xmm1,xmm3
  2538. movdqa xmm0,xmm7
  2539. movups XMMWORD PTR 32[esi*1+edi],xmm4
  2540. pxor xmm1,xmm4
  2541. movups XMMWORD PTR 48[esi*1+edi],xmm5
  2542. pxor xmm1,xmm5
  2543. $L088done:
  2544. mov edx,DWORD PTR 128[esp]
  2545. pxor xmm2,xmm2
  2546. pxor xmm3,xmm3
  2547. movdqa XMMWORD PTR [esp],xmm2
  2548. pxor xmm4,xmm4
  2549. movdqa XMMWORD PTR 16[esp],xmm2
  2550. pxor xmm5,xmm5
  2551. movdqa XMMWORD PTR 32[esp],xmm2
  2552. pxor xmm6,xmm6
  2553. movdqa XMMWORD PTR 48[esp],xmm2
  2554. pxor xmm7,xmm7
  2555. movdqa XMMWORD PTR 64[esp],xmm2
  2556. movdqa XMMWORD PTR 80[esp],xmm2
  2557. movdqa XMMWORD PTR 96[esp],xmm2
  2558. lea esp,DWORD PTR [edx]
  2559. mov ecx,DWORD PTR 40[esp]
  2560. mov ebx,DWORD PTR 48[esp]
  2561. movdqu XMMWORD PTR [ecx],xmm0
  2562. pxor xmm0,xmm0
  2563. movdqu XMMWORD PTR [ebx],xmm1
  2564. pxor xmm1,xmm1
  2565. pop edi
  2566. pop esi
  2567. pop ebx
  2568. pop ebp
  2569. ret
  2570. _aesni_ocb_decrypt ENDP
  2571. ALIGN 16
  2572. _aesni_cbc_encrypt PROC PUBLIC
  2573. $L_aesni_cbc_encrypt_begin::
  2574. push ebp
  2575. push ebx
  2576. push esi
  2577. push edi
  2578. mov esi,DWORD PTR 20[esp]
  2579. mov ebx,esp
  2580. mov edi,DWORD PTR 24[esp]
  2581. sub ebx,24
  2582. mov eax,DWORD PTR 28[esp]
  2583. and ebx,-16
  2584. mov edx,DWORD PTR 32[esp]
  2585. mov ebp,DWORD PTR 36[esp]
  2586. test eax,eax
  2587. jz $L094cbc_abort
  2588. cmp DWORD PTR 40[esp],0
  2589. xchg ebx,esp
  2590. movups xmm7,XMMWORD PTR [ebp]
  2591. mov ecx,DWORD PTR 240[edx]
  2592. mov ebp,edx
  2593. mov DWORD PTR 16[esp],ebx
  2594. mov ebx,ecx
  2595. je $L095cbc_decrypt
  2596. movaps xmm2,xmm7
  2597. cmp eax,16
  2598. jb $L096cbc_enc_tail
  2599. sub eax,16
  2600. jmp $L097cbc_enc_loop
  2601. ALIGN 16
  2602. $L097cbc_enc_loop:
  2603. movups xmm7,XMMWORD PTR [esi]
  2604. lea esi,DWORD PTR 16[esi]
  2605. movups xmm0,XMMWORD PTR [edx]
  2606. movups xmm1,XMMWORD PTR 16[edx]
  2607. xorps xmm7,xmm0
  2608. lea edx,DWORD PTR 32[edx]
  2609. xorps xmm2,xmm7
  2610. $L098enc1_loop_19:
  2611. DB 102,15,56,220,209
  2612. dec ecx
  2613. movups xmm1,XMMWORD PTR [edx]
  2614. lea edx,DWORD PTR 16[edx]
  2615. jnz $L098enc1_loop_19
  2616. DB 102,15,56,221,209
  2617. mov ecx,ebx
  2618. mov edx,ebp
  2619. movups XMMWORD PTR [edi],xmm2
  2620. lea edi,DWORD PTR 16[edi]
  2621. sub eax,16
  2622. jnc $L097cbc_enc_loop
  2623. add eax,16
  2624. jnz $L096cbc_enc_tail
  2625. movaps xmm7,xmm2
  2626. pxor xmm2,xmm2
  2627. jmp $L099cbc_ret
  2628. $L096cbc_enc_tail:
  2629. mov ecx,eax
  2630. DD 2767451785
  2631. mov ecx,16
  2632. sub ecx,eax
  2633. xor eax,eax
  2634. DD 2868115081
  2635. lea edi,DWORD PTR [edi-16]
  2636. mov ecx,ebx
  2637. mov esi,edi
  2638. mov edx,ebp
  2639. jmp $L097cbc_enc_loop
  2640. ALIGN 16
  2641. $L095cbc_decrypt:
  2642. cmp eax,80
  2643. jbe $L100cbc_dec_tail
  2644. movaps XMMWORD PTR [esp],xmm7
  2645. sub eax,80
  2646. jmp $L101cbc_dec_loop6_enter
  2647. ALIGN 16
  2648. $L102cbc_dec_loop6:
  2649. movaps XMMWORD PTR [esp],xmm0
  2650. movups XMMWORD PTR [edi],xmm7
  2651. lea edi,DWORD PTR 16[edi]
  2652. $L101cbc_dec_loop6_enter:
  2653. movdqu xmm2,XMMWORD PTR [esi]
  2654. movdqu xmm3,XMMWORD PTR 16[esi]
  2655. movdqu xmm4,XMMWORD PTR 32[esi]
  2656. movdqu xmm5,XMMWORD PTR 48[esi]
  2657. movdqu xmm6,XMMWORD PTR 64[esi]
  2658. movdqu xmm7,XMMWORD PTR 80[esi]
  2659. call __aesni_decrypt6
  2660. movups xmm1,XMMWORD PTR [esi]
  2661. movups xmm0,XMMWORD PTR 16[esi]
  2662. xorps xmm2,XMMWORD PTR [esp]
  2663. xorps xmm3,xmm1
  2664. movups xmm1,XMMWORD PTR 32[esi]
  2665. xorps xmm4,xmm0
  2666. movups xmm0,XMMWORD PTR 48[esi]
  2667. xorps xmm5,xmm1
  2668. movups xmm1,XMMWORD PTR 64[esi]
  2669. xorps xmm6,xmm0
  2670. movups xmm0,XMMWORD PTR 80[esi]
  2671. xorps xmm7,xmm1
  2672. movups XMMWORD PTR [edi],xmm2
  2673. movups XMMWORD PTR 16[edi],xmm3
  2674. lea esi,DWORD PTR 96[esi]
  2675. movups XMMWORD PTR 32[edi],xmm4
  2676. mov ecx,ebx
  2677. movups XMMWORD PTR 48[edi],xmm5
  2678. mov edx,ebp
  2679. movups XMMWORD PTR 64[edi],xmm6
  2680. lea edi,DWORD PTR 80[edi]
  2681. sub eax,96
  2682. ja $L102cbc_dec_loop6
  2683. movaps xmm2,xmm7
  2684. movaps xmm7,xmm0
  2685. add eax,80
  2686. jle $L103cbc_dec_clear_tail_collected
  2687. movups XMMWORD PTR [edi],xmm2
  2688. lea edi,DWORD PTR 16[edi]
  2689. $L100cbc_dec_tail:
  2690. movups xmm2,XMMWORD PTR [esi]
  2691. movaps xmm6,xmm2
  2692. cmp eax,16
  2693. jbe $L104cbc_dec_one
  2694. movups xmm3,XMMWORD PTR 16[esi]
  2695. movaps xmm5,xmm3
  2696. cmp eax,32
  2697. jbe $L105cbc_dec_two
  2698. movups xmm4,XMMWORD PTR 32[esi]
  2699. cmp eax,48
  2700. jbe $L106cbc_dec_three
  2701. movups xmm5,XMMWORD PTR 48[esi]
  2702. cmp eax,64
  2703. jbe $L107cbc_dec_four
  2704. movups xmm6,XMMWORD PTR 64[esi]
  2705. movaps XMMWORD PTR [esp],xmm7
  2706. movups xmm2,XMMWORD PTR [esi]
  2707. xorps xmm7,xmm7
  2708. call __aesni_decrypt6
  2709. movups xmm1,XMMWORD PTR [esi]
  2710. movups xmm0,XMMWORD PTR 16[esi]
  2711. xorps xmm2,XMMWORD PTR [esp]
  2712. xorps xmm3,xmm1
  2713. movups xmm1,XMMWORD PTR 32[esi]
  2714. xorps xmm4,xmm0
  2715. movups xmm0,XMMWORD PTR 48[esi]
  2716. xorps xmm5,xmm1
  2717. movups xmm7,XMMWORD PTR 64[esi]
  2718. xorps xmm6,xmm0
  2719. movups XMMWORD PTR [edi],xmm2
  2720. movups XMMWORD PTR 16[edi],xmm3
  2721. pxor xmm3,xmm3
  2722. movups XMMWORD PTR 32[edi],xmm4
  2723. pxor xmm4,xmm4
  2724. movups XMMWORD PTR 48[edi],xmm5
  2725. pxor xmm5,xmm5
  2726. lea edi,DWORD PTR 64[edi]
  2727. movaps xmm2,xmm6
  2728. pxor xmm6,xmm6
  2729. sub eax,80
  2730. jmp $L108cbc_dec_tail_collected
  2731. ALIGN 16
  2732. $L104cbc_dec_one:
  2733. movups xmm0,XMMWORD PTR [edx]
  2734. movups xmm1,XMMWORD PTR 16[edx]
  2735. lea edx,DWORD PTR 32[edx]
  2736. xorps xmm2,xmm0
  2737. $L109dec1_loop_20:
  2738. DB 102,15,56,222,209
  2739. dec ecx
  2740. movups xmm1,XMMWORD PTR [edx]
  2741. lea edx,DWORD PTR 16[edx]
  2742. jnz $L109dec1_loop_20
  2743. DB 102,15,56,223,209
  2744. xorps xmm2,xmm7
  2745. movaps xmm7,xmm6
  2746. sub eax,16
  2747. jmp $L108cbc_dec_tail_collected
  2748. ALIGN 16
  2749. $L105cbc_dec_two:
  2750. call __aesni_decrypt2
  2751. xorps xmm2,xmm7
  2752. xorps xmm3,xmm6
  2753. movups XMMWORD PTR [edi],xmm2
  2754. movaps xmm2,xmm3
  2755. pxor xmm3,xmm3
  2756. lea edi,DWORD PTR 16[edi]
  2757. movaps xmm7,xmm5
  2758. sub eax,32
  2759. jmp $L108cbc_dec_tail_collected
  2760. ALIGN 16
  2761. $L106cbc_dec_three:
  2762. call __aesni_decrypt3
  2763. xorps xmm2,xmm7
  2764. xorps xmm3,xmm6
  2765. xorps xmm4,xmm5
  2766. movups XMMWORD PTR [edi],xmm2
  2767. movaps xmm2,xmm4
  2768. pxor xmm4,xmm4
  2769. movups XMMWORD PTR 16[edi],xmm3
  2770. pxor xmm3,xmm3
  2771. lea edi,DWORD PTR 32[edi]
  2772. movups xmm7,XMMWORD PTR 32[esi]
  2773. sub eax,48
  2774. jmp $L108cbc_dec_tail_collected
  2775. ALIGN 16
  2776. $L107cbc_dec_four:
  2777. call __aesni_decrypt4
  2778. movups xmm1,XMMWORD PTR 16[esi]
  2779. movups xmm0,XMMWORD PTR 32[esi]
  2780. xorps xmm2,xmm7
  2781. movups xmm7,XMMWORD PTR 48[esi]
  2782. xorps xmm3,xmm6
  2783. movups XMMWORD PTR [edi],xmm2
  2784. xorps xmm4,xmm1
  2785. movups XMMWORD PTR 16[edi],xmm3
  2786. pxor xmm3,xmm3
  2787. xorps xmm5,xmm0
  2788. movups XMMWORD PTR 32[edi],xmm4
  2789. pxor xmm4,xmm4
  2790. lea edi,DWORD PTR 48[edi]
  2791. movaps xmm2,xmm5
  2792. pxor xmm5,xmm5
  2793. sub eax,64
  2794. jmp $L108cbc_dec_tail_collected
  2795. ALIGN 16
  2796. $L103cbc_dec_clear_tail_collected:
  2797. pxor xmm3,xmm3
  2798. pxor xmm4,xmm4
  2799. pxor xmm5,xmm5
  2800. pxor xmm6,xmm6
  2801. $L108cbc_dec_tail_collected:
  2802. and eax,15
  2803. jnz $L110cbc_dec_tail_partial
  2804. movups XMMWORD PTR [edi],xmm2
  2805. pxor xmm0,xmm0
  2806. jmp $L099cbc_ret
  2807. ALIGN 16
  2808. $L110cbc_dec_tail_partial:
  2809. movaps XMMWORD PTR [esp],xmm2
  2810. pxor xmm0,xmm0
  2811. mov ecx,16
  2812. mov esi,esp
  2813. sub ecx,eax
  2814. DD 2767451785
  2815. movdqa XMMWORD PTR [esp],xmm2
  2816. $L099cbc_ret:
  2817. mov esp,DWORD PTR 16[esp]
  2818. mov ebp,DWORD PTR 36[esp]
  2819. pxor xmm2,xmm2
  2820. pxor xmm1,xmm1
  2821. movups XMMWORD PTR [ebp],xmm7
  2822. pxor xmm7,xmm7
  2823. $L094cbc_abort:
  2824. pop edi
  2825. pop esi
  2826. pop ebx
  2827. pop ebp
  2828. ret
  2829. _aesni_cbc_encrypt ENDP
  2830. ALIGN 16
  2831. __aesni_set_encrypt_key PROC PRIVATE
  2832. push ebp
  2833. push ebx
  2834. test eax,eax
  2835. jz $L111bad_pointer
  2836. test edx,edx
  2837. jz $L111bad_pointer
  2838. call $L112pic
  2839. $L112pic:
  2840. pop ebx
  2841. lea ebx,DWORD PTR ($Lkey_const-$L112pic)[ebx]
  2842. lea ebp,DWORD PTR _OPENSSL_ia32cap_P
  2843. movups xmm0,XMMWORD PTR [eax]
  2844. xorps xmm4,xmm4
  2845. mov ebp,DWORD PTR 4[ebp]
  2846. lea edx,DWORD PTR 16[edx]
  2847. and ebp,268437504
  2848. cmp ecx,256
  2849. je $L11314rounds
  2850. cmp ecx,192
  2851. je $L11412rounds
  2852. cmp ecx,128
  2853. jne $L115bad_keybits
  2854. ALIGN 16
  2855. $L11610rounds:
  2856. cmp ebp,268435456
  2857. je $L11710rounds_alt
  2858. mov ecx,9
  2859. movups XMMWORD PTR [edx-16],xmm0
  2860. DB 102,15,58,223,200,1
  2861. call $L118key_128_cold
  2862. DB 102,15,58,223,200,2
  2863. call $L119key_128
  2864. DB 102,15,58,223,200,4
  2865. call $L119key_128
  2866. DB 102,15,58,223,200,8
  2867. call $L119key_128
  2868. DB 102,15,58,223,200,16
  2869. call $L119key_128
  2870. DB 102,15,58,223,200,32
  2871. call $L119key_128
  2872. DB 102,15,58,223,200,64
  2873. call $L119key_128
  2874. DB 102,15,58,223,200,128
  2875. call $L119key_128
  2876. DB 102,15,58,223,200,27
  2877. call $L119key_128
  2878. DB 102,15,58,223,200,54
  2879. call $L119key_128
  2880. movups XMMWORD PTR [edx],xmm0
  2881. mov DWORD PTR 80[edx],ecx
  2882. jmp $L120good_key
  2883. ALIGN 16
  2884. $L119key_128:
  2885. movups XMMWORD PTR [edx],xmm0
  2886. lea edx,DWORD PTR 16[edx]
  2887. $L118key_128_cold:
  2888. shufps xmm4,xmm0,16
  2889. xorps xmm0,xmm4
  2890. shufps xmm4,xmm0,140
  2891. xorps xmm0,xmm4
  2892. shufps xmm1,xmm1,255
  2893. xorps xmm0,xmm1
  2894. ret
  2895. ALIGN 16
  2896. $L11710rounds_alt:
  2897. movdqa xmm5,XMMWORD PTR [ebx]
  2898. mov ecx,8
  2899. movdqa xmm4,XMMWORD PTR 32[ebx]
  2900. movdqa xmm2,xmm0
  2901. movdqu XMMWORD PTR [edx-16],xmm0
  2902. $L121loop_key128:
  2903. DB 102,15,56,0,197
  2904. DB 102,15,56,221,196
  2905. pslld xmm4,1
  2906. lea edx,DWORD PTR 16[edx]
  2907. movdqa xmm3,xmm2
  2908. pslldq xmm2,4
  2909. pxor xmm3,xmm2
  2910. pslldq xmm2,4
  2911. pxor xmm3,xmm2
  2912. pslldq xmm2,4
  2913. pxor xmm2,xmm3
  2914. pxor xmm0,xmm2
  2915. movdqu XMMWORD PTR [edx-16],xmm0
  2916. movdqa xmm2,xmm0
  2917. dec ecx
  2918. jnz $L121loop_key128
  2919. movdqa xmm4,XMMWORD PTR 48[ebx]
  2920. DB 102,15,56,0,197
  2921. DB 102,15,56,221,196
  2922. pslld xmm4,1
  2923. movdqa xmm3,xmm2
  2924. pslldq xmm2,4
  2925. pxor xmm3,xmm2
  2926. pslldq xmm2,4
  2927. pxor xmm3,xmm2
  2928. pslldq xmm2,4
  2929. pxor xmm2,xmm3
  2930. pxor xmm0,xmm2
  2931. movdqu XMMWORD PTR [edx],xmm0
  2932. movdqa xmm2,xmm0
  2933. DB 102,15,56,0,197
  2934. DB 102,15,56,221,196
  2935. movdqa xmm3,xmm2
  2936. pslldq xmm2,4
  2937. pxor xmm3,xmm2
  2938. pslldq xmm2,4
  2939. pxor xmm3,xmm2
  2940. pslldq xmm2,4
  2941. pxor xmm2,xmm3
  2942. pxor xmm0,xmm2
  2943. movdqu XMMWORD PTR 16[edx],xmm0
  2944. mov ecx,9
  2945. mov DWORD PTR 96[edx],ecx
  2946. jmp $L120good_key
  2947. ALIGN 16
  2948. $L11412rounds:
  2949. movq xmm2,QWORD PTR 16[eax]
  2950. cmp ebp,268435456
  2951. je $L12212rounds_alt
  2952. mov ecx,11
  2953. movups XMMWORD PTR [edx-16],xmm0
  2954. DB 102,15,58,223,202,1
  2955. call $L123key_192a_cold
  2956. DB 102,15,58,223,202,2
  2957. call $L124key_192b
  2958. DB 102,15,58,223,202,4
  2959. call $L125key_192a
  2960. DB 102,15,58,223,202,8
  2961. call $L124key_192b
  2962. DB 102,15,58,223,202,16
  2963. call $L125key_192a
  2964. DB 102,15,58,223,202,32
  2965. call $L124key_192b
  2966. DB 102,15,58,223,202,64
  2967. call $L125key_192a
  2968. DB 102,15,58,223,202,128
  2969. call $L124key_192b
  2970. movups XMMWORD PTR [edx],xmm0
  2971. mov DWORD PTR 48[edx],ecx
  2972. jmp $L120good_key
  2973. ALIGN 16
  2974. $L125key_192a:
  2975. movups XMMWORD PTR [edx],xmm0
  2976. lea edx,DWORD PTR 16[edx]
  2977. ALIGN 16
  2978. $L123key_192a_cold:
  2979. movaps xmm5,xmm2
  2980. $L126key_192b_warm:
  2981. shufps xmm4,xmm0,16
  2982. movdqa xmm3,xmm2
  2983. xorps xmm0,xmm4
  2984. shufps xmm4,xmm0,140
  2985. pslldq xmm3,4
  2986. xorps xmm0,xmm4
  2987. pshufd xmm1,xmm1,85
  2988. pxor xmm2,xmm3
  2989. pxor xmm0,xmm1
  2990. pshufd xmm3,xmm0,255
  2991. pxor xmm2,xmm3
  2992. ret
  2993. ALIGN 16
  2994. $L124key_192b:
  2995. movaps xmm3,xmm0
  2996. shufps xmm5,xmm0,68
  2997. movups XMMWORD PTR [edx],xmm5
  2998. shufps xmm3,xmm2,78
  2999. movups XMMWORD PTR 16[edx],xmm3
  3000. lea edx,DWORD PTR 32[edx]
  3001. jmp $L126key_192b_warm
  3002. ALIGN 16
  3003. $L12212rounds_alt:
  3004. movdqa xmm5,XMMWORD PTR 16[ebx]
  3005. movdqa xmm4,XMMWORD PTR 32[ebx]
  3006. mov ecx,8
  3007. movdqu XMMWORD PTR [edx-16],xmm0
  3008. $L127loop_key192:
  3009. movq QWORD PTR [edx],xmm2
  3010. movdqa xmm1,xmm2
  3011. DB 102,15,56,0,213
  3012. DB 102,15,56,221,212
  3013. pslld xmm4,1
  3014. lea edx,DWORD PTR 24[edx]
  3015. movdqa xmm3,xmm0
  3016. pslldq xmm0,4
  3017. pxor xmm3,xmm0
  3018. pslldq xmm0,4
  3019. pxor xmm3,xmm0
  3020. pslldq xmm0,4
  3021. pxor xmm0,xmm3
  3022. pshufd xmm3,xmm0,255
  3023. pxor xmm3,xmm1
  3024. pslldq xmm1,4
  3025. pxor xmm3,xmm1
  3026. pxor xmm0,xmm2
  3027. pxor xmm2,xmm3
  3028. movdqu XMMWORD PTR [edx-16],xmm0
  3029. dec ecx
  3030. jnz $L127loop_key192
  3031. mov ecx,11
  3032. mov DWORD PTR 32[edx],ecx
  3033. jmp $L120good_key
  3034. ALIGN 16
  3035. $L11314rounds:
  3036. movups xmm2,XMMWORD PTR 16[eax]
  3037. lea edx,DWORD PTR 16[edx]
  3038. cmp ebp,268435456
  3039. je $L12814rounds_alt
  3040. mov ecx,13
  3041. movups XMMWORD PTR [edx-32],xmm0
  3042. movups XMMWORD PTR [edx-16],xmm2
  3043. DB 102,15,58,223,202,1
  3044. call $L129key_256a_cold
  3045. DB 102,15,58,223,200,1
  3046. call $L130key_256b
  3047. DB 102,15,58,223,202,2
  3048. call $L131key_256a
  3049. DB 102,15,58,223,200,2
  3050. call $L130key_256b
  3051. DB 102,15,58,223,202,4
  3052. call $L131key_256a
  3053. DB 102,15,58,223,200,4
  3054. call $L130key_256b
  3055. DB 102,15,58,223,202,8
  3056. call $L131key_256a
  3057. DB 102,15,58,223,200,8
  3058. call $L130key_256b
  3059. DB 102,15,58,223,202,16
  3060. call $L131key_256a
  3061. DB 102,15,58,223,200,16
  3062. call $L130key_256b
  3063. DB 102,15,58,223,202,32
  3064. call $L131key_256a
  3065. DB 102,15,58,223,200,32
  3066. call $L130key_256b
  3067. DB 102,15,58,223,202,64
  3068. call $L131key_256a
  3069. movups XMMWORD PTR [edx],xmm0
  3070. mov DWORD PTR 16[edx],ecx
  3071. xor eax,eax
  3072. jmp $L120good_key
  3073. ALIGN 16
  3074. $L131key_256a:
  3075. movups XMMWORD PTR [edx],xmm2
  3076. lea edx,DWORD PTR 16[edx]
  3077. $L129key_256a_cold:
  3078. shufps xmm4,xmm0,16
  3079. xorps xmm0,xmm4
  3080. shufps xmm4,xmm0,140
  3081. xorps xmm0,xmm4
  3082. shufps xmm1,xmm1,255
  3083. xorps xmm0,xmm1
  3084. ret
  3085. ALIGN 16
  3086. $L130key_256b:
  3087. movups XMMWORD PTR [edx],xmm0
  3088. lea edx,DWORD PTR 16[edx]
  3089. shufps xmm4,xmm2,16
  3090. xorps xmm2,xmm4
  3091. shufps xmm4,xmm2,140
  3092. xorps xmm2,xmm4
  3093. shufps xmm1,xmm1,170
  3094. xorps xmm2,xmm1
  3095. ret
  3096. ALIGN 16
  3097. $L12814rounds_alt:
  3098. movdqa xmm5,XMMWORD PTR [ebx]
  3099. movdqa xmm4,XMMWORD PTR 32[ebx]
  3100. mov ecx,7
  3101. movdqu XMMWORD PTR [edx-32],xmm0
  3102. movdqa xmm1,xmm2
  3103. movdqu XMMWORD PTR [edx-16],xmm2
  3104. $L132loop_key256:
  3105. DB 102,15,56,0,213
  3106. DB 102,15,56,221,212
  3107. movdqa xmm3,xmm0
  3108. pslldq xmm0,4
  3109. pxor xmm3,xmm0
  3110. pslldq xmm0,4
  3111. pxor xmm3,xmm0
  3112. pslldq xmm0,4
  3113. pxor xmm0,xmm3
  3114. pslld xmm4,1
  3115. pxor xmm0,xmm2
  3116. movdqu XMMWORD PTR [edx],xmm0
  3117. dec ecx
  3118. jz $L133done_key256
  3119. pshufd xmm2,xmm0,255
  3120. pxor xmm3,xmm3
  3121. DB 102,15,56,221,211
  3122. movdqa xmm3,xmm1
  3123. pslldq xmm1,4
  3124. pxor xmm3,xmm1
  3125. pslldq xmm1,4
  3126. pxor xmm3,xmm1
  3127. pslldq xmm1,4
  3128. pxor xmm1,xmm3
  3129. pxor xmm2,xmm1
  3130. movdqu XMMWORD PTR 16[edx],xmm2
  3131. lea edx,DWORD PTR 32[edx]
  3132. movdqa xmm1,xmm2
  3133. jmp $L132loop_key256
  3134. $L133done_key256:
  3135. mov ecx,13
  3136. mov DWORD PTR 16[edx],ecx
  3137. $L120good_key:
  3138. pxor xmm0,xmm0
  3139. pxor xmm1,xmm1
  3140. pxor xmm2,xmm2
  3141. pxor xmm3,xmm3
  3142. pxor xmm4,xmm4
  3143. pxor xmm5,xmm5
  3144. xor eax,eax
  3145. pop ebx
  3146. pop ebp
  3147. ret
  3148. ALIGN 4
  3149. $L111bad_pointer:
  3150. mov eax,-1
  3151. pop ebx
  3152. pop ebp
  3153. ret
  3154. ALIGN 4
  3155. $L115bad_keybits:
  3156. pxor xmm0,xmm0
  3157. mov eax,-2
  3158. pop ebx
  3159. pop ebp
  3160. ret
  3161. __aesni_set_encrypt_key ENDP
  3162. ALIGN 16
  3163. _aesni_set_encrypt_key PROC PUBLIC
  3164. $L_aesni_set_encrypt_key_begin::
  3165. mov eax,DWORD PTR 4[esp]
  3166. mov ecx,DWORD PTR 8[esp]
  3167. mov edx,DWORD PTR 12[esp]
  3168. call __aesni_set_encrypt_key
  3169. ret
  3170. _aesni_set_encrypt_key ENDP
  3171. ALIGN 16
  3172. _aesni_set_decrypt_key PROC PUBLIC
  3173. $L_aesni_set_decrypt_key_begin::
  3174. mov eax,DWORD PTR 4[esp]
  3175. mov ecx,DWORD PTR 8[esp]
  3176. mov edx,DWORD PTR 12[esp]
  3177. call __aesni_set_encrypt_key
  3178. mov edx,DWORD PTR 12[esp]
  3179. shl ecx,4
  3180. test eax,eax
  3181. jnz $L134dec_key_ret
  3182. lea eax,DWORD PTR 16[ecx*1+edx]
  3183. movups xmm0,XMMWORD PTR [edx]
  3184. movups xmm1,XMMWORD PTR [eax]
  3185. movups XMMWORD PTR [eax],xmm0
  3186. movups XMMWORD PTR [edx],xmm1
  3187. lea edx,DWORD PTR 16[edx]
  3188. lea eax,DWORD PTR [eax-16]
  3189. $L135dec_key_inverse:
  3190. movups xmm0,XMMWORD PTR [edx]
  3191. movups xmm1,XMMWORD PTR [eax]
  3192. DB 102,15,56,219,192
  3193. DB 102,15,56,219,201
  3194. lea edx,DWORD PTR 16[edx]
  3195. lea eax,DWORD PTR [eax-16]
  3196. movups XMMWORD PTR 16[eax],xmm0
  3197. movups XMMWORD PTR [edx-16],xmm1
  3198. cmp eax,edx
  3199. ja $L135dec_key_inverse
  3200. movups xmm0,XMMWORD PTR [edx]
  3201. DB 102,15,56,219,192
  3202. movups XMMWORD PTR [edx],xmm0
  3203. pxor xmm0,xmm0
  3204. pxor xmm1,xmm1
  3205. xor eax,eax
  3206. $L134dec_key_ret:
  3207. ret
  3208. _aesni_set_decrypt_key ENDP
  3209. ALIGN 64
  3210. $Lkey_const::
  3211. DD 202313229,202313229,202313229,202313229
  3212. DD 67569157,67569157,67569157,67569157
  3213. DD 1,1,1,1
  3214. DD 27,27,27,27
  3215. DB 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69
  3216. DB 83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83
  3217. DB 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115
  3218. DB 115,108,46,111,114,103,62,0
  3219. .text$ ENDS
  3220. .bss SEGMENT 'BSS'
  3221. COMM _OPENSSL_ia32cap_P:DWORD:4
  3222. .bss ENDS
  3223. END