sha256-core.S_shipped 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809
  1. @ ====================================================================
  2. @ Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
  3. @ project. The module is, however, dual licensed under OpenSSL and
  4. @ CRYPTOGAMS licenses depending on where you obtain it. For further
  5. @ details see http://www.openssl.org/~appro/cryptogams/.
  6. @
  7. @ Permission to use under GPL terms is granted.
  8. @ ====================================================================
  9. @ SHA256 block procedure for ARMv4. May 2007.
  10. @ Performance is ~2x better than gcc 3.4 generated code and in "abso-
  11. @ lute" terms is ~2250 cycles per 64-byte block or ~35 cycles per
  12. @ byte [on single-issue Xscale PXA250 core].
  13. @ July 2010.
  14. @
  15. @ Rescheduling for dual-issue pipeline resulted in 22% improvement on
  16. @ Cortex A8 core and ~20 cycles per processed byte.
  17. @ February 2011.
  18. @
  19. @ Profiler-assisted and platform-specific optimization resulted in 16%
  20. @ improvement on Cortex A8 core and ~15.4 cycles per processed byte.
  21. @ September 2013.
  22. @
  23. @ Add NEON implementation. On Cortex A8 it was measured to process one
  24. @ byte in 12.5 cycles or 23% faster than integer-only code. Snapdragon
  25. @ S4 does it in 12.5 cycles too, but it's 50% faster than integer-only
  26. @ code (meaning that latter performs sub-optimally, nothing was done
  27. @ about it).
  28. @ May 2014.
  29. @
  30. @ Add ARMv8 code path performing at 2.0 cpb on Apple A7.
  31. #ifndef __KERNEL__
  32. # include "arm_arch.h"
  33. #else
  34. # define __ARM_ARCH__ __LINUX_ARM_ARCH__
  35. # define __ARM_MAX_ARCH__ 7
  36. #endif
  37. .text
  38. #if __ARM_ARCH__<7
  39. .code 32
  40. #else
  41. .syntax unified
  42. # ifdef __thumb2__
  43. # define adrl adr
  44. .thumb
  45. # else
  46. .code 32
  47. # endif
  48. #endif
  49. .type K256,%object
  50. .align 5
  51. K256:
  52. .word 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
  53. .word 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
  54. .word 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
  55. .word 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
  56. .word 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
  57. .word 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
  58. .word 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
  59. .word 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
  60. .word 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
  61. .word 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
  62. .word 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
  63. .word 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
  64. .word 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
  65. .word 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
  66. .word 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
  67. .word 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
  68. .size K256,.-K256
  69. .word 0 @ terminator
  70. #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
  71. .LOPENSSL_armcap:
  72. .word OPENSSL_armcap_P-sha256_block_data_order
  73. #endif
  74. .align 5
  75. .global sha256_block_data_order
  76. .type sha256_block_data_order,%function
  77. sha256_block_data_order:
  78. #if __ARM_ARCH__<7
  79. sub r3,pc,#8 @ sha256_block_data_order
  80. #else
  81. adr r3,sha256_block_data_order
  82. #endif
  83. #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
  84. ldr r12,.LOPENSSL_armcap
  85. ldr r12,[r3,r12] @ OPENSSL_armcap_P
  86. tst r12,#ARMV8_SHA256
  87. bne .LARMv8
  88. tst r12,#ARMV7_NEON
  89. bne .LNEON
  90. #endif
  91. add r2,r1,r2,lsl#6 @ len to point at the end of inp
  92. stmdb sp!,{r0,r1,r2,r4-r11,lr}
  93. ldmia r0,{r4,r5,r6,r7,r8,r9,r10,r11}
  94. sub r14,r3,#256+32 @ K256
  95. sub sp,sp,#16*4 @ alloca(X[16])
  96. .Loop:
  97. # if __ARM_ARCH__>=7
  98. ldr r2,[r1],#4
  99. # else
  100. ldrb r2,[r1,#3]
  101. # endif
  102. eor r3,r5,r6 @ magic
  103. eor r12,r12,r12
  104. #if __ARM_ARCH__>=7
  105. @ ldr r2,[r1],#4 @ 0
  106. # if 0==15
  107. str r1,[sp,#17*4] @ make room for r1
  108. # endif
  109. eor r0,r8,r8,ror#5
  110. add r4,r4,r12 @ h+=Maj(a,b,c) from the past
  111. eor r0,r0,r8,ror#19 @ Sigma1(e)
  112. # ifndef __ARMEB__
  113. rev r2,r2
  114. # endif
  115. #else
  116. @ ldrb r2,[r1,#3] @ 0
  117. add r4,r4,r12 @ h+=Maj(a,b,c) from the past
  118. ldrb r12,[r1,#2]
  119. ldrb r0,[r1,#1]
  120. orr r2,r2,r12,lsl#8
  121. ldrb r12,[r1],#4
  122. orr r2,r2,r0,lsl#16
  123. # if 0==15
  124. str r1,[sp,#17*4] @ make room for r1
  125. # endif
  126. eor r0,r8,r8,ror#5
  127. orr r2,r2,r12,lsl#24
  128. eor r0,r0,r8,ror#19 @ Sigma1(e)
  129. #endif
  130. ldr r12,[r14],#4 @ *K256++
  131. add r11,r11,r2 @ h+=X[i]
  132. str r2,[sp,#0*4]
  133. eor r2,r9,r10
  134. add r11,r11,r0,ror#6 @ h+=Sigma1(e)
  135. and r2,r2,r8
  136. add r11,r11,r12 @ h+=K256[i]
  137. eor r2,r2,r10 @ Ch(e,f,g)
  138. eor r0,r4,r4,ror#11
  139. add r11,r11,r2 @ h+=Ch(e,f,g)
  140. #if 0==31
  141. and r12,r12,#0xff
  142. cmp r12,#0xf2 @ done?
  143. #endif
  144. #if 0<15
  145. # if __ARM_ARCH__>=7
  146. ldr r2,[r1],#4 @ prefetch
  147. # else
  148. ldrb r2,[r1,#3]
  149. # endif
  150. eor r12,r4,r5 @ a^b, b^c in next round
  151. #else
  152. ldr r2,[sp,#2*4] @ from future BODY_16_xx
  153. eor r12,r4,r5 @ a^b, b^c in next round
  154. ldr r1,[sp,#15*4] @ from future BODY_16_xx
  155. #endif
  156. eor r0,r0,r4,ror#20 @ Sigma0(a)
  157. and r3,r3,r12 @ (b^c)&=(a^b)
  158. add r7,r7,r11 @ d+=h
  159. eor r3,r3,r5 @ Maj(a,b,c)
  160. add r11,r11,r0,ror#2 @ h+=Sigma0(a)
  161. @ add r11,r11,r3 @ h+=Maj(a,b,c)
  162. #if __ARM_ARCH__>=7
  163. @ ldr r2,[r1],#4 @ 1
  164. # if 1==15
  165. str r1,[sp,#17*4] @ make room for r1
  166. # endif
  167. eor r0,r7,r7,ror#5
  168. add r11,r11,r3 @ h+=Maj(a,b,c) from the past
  169. eor r0,r0,r7,ror#19 @ Sigma1(e)
  170. # ifndef __ARMEB__
  171. rev r2,r2
  172. # endif
  173. #else
  174. @ ldrb r2,[r1,#3] @ 1
  175. add r11,r11,r3 @ h+=Maj(a,b,c) from the past
  176. ldrb r3,[r1,#2]
  177. ldrb r0,[r1,#1]
  178. orr r2,r2,r3,lsl#8
  179. ldrb r3,[r1],#4
  180. orr r2,r2,r0,lsl#16
  181. # if 1==15
  182. str r1,[sp,#17*4] @ make room for r1
  183. # endif
  184. eor r0,r7,r7,ror#5
  185. orr r2,r2,r3,lsl#24
  186. eor r0,r0,r7,ror#19 @ Sigma1(e)
  187. #endif
  188. ldr r3,[r14],#4 @ *K256++
  189. add r10,r10,r2 @ h+=X[i]
  190. str r2,[sp,#1*4]
  191. eor r2,r8,r9
  192. add r10,r10,r0,ror#6 @ h+=Sigma1(e)
  193. and r2,r2,r7
  194. add r10,r10,r3 @ h+=K256[i]
  195. eor r2,r2,r9 @ Ch(e,f,g)
  196. eor r0,r11,r11,ror#11
  197. add r10,r10,r2 @ h+=Ch(e,f,g)
  198. #if 1==31
  199. and r3,r3,#0xff
  200. cmp r3,#0xf2 @ done?
  201. #endif
  202. #if 1<15
  203. # if __ARM_ARCH__>=7
  204. ldr r2,[r1],#4 @ prefetch
  205. # else
  206. ldrb r2,[r1,#3]
  207. # endif
  208. eor r3,r11,r4 @ a^b, b^c in next round
  209. #else
  210. ldr r2,[sp,#3*4] @ from future BODY_16_xx
  211. eor r3,r11,r4 @ a^b, b^c in next round
  212. ldr r1,[sp,#0*4] @ from future BODY_16_xx
  213. #endif
  214. eor r0,r0,r11,ror#20 @ Sigma0(a)
  215. and r12,r12,r3 @ (b^c)&=(a^b)
  216. add r6,r6,r10 @ d+=h
  217. eor r12,r12,r4 @ Maj(a,b,c)
  218. add r10,r10,r0,ror#2 @ h+=Sigma0(a)
  219. @ add r10,r10,r12 @ h+=Maj(a,b,c)
  220. #if __ARM_ARCH__>=7
  221. @ ldr r2,[r1],#4 @ 2
  222. # if 2==15
  223. str r1,[sp,#17*4] @ make room for r1
  224. # endif
  225. eor r0,r6,r6,ror#5
  226. add r10,r10,r12 @ h+=Maj(a,b,c) from the past
  227. eor r0,r0,r6,ror#19 @ Sigma1(e)
  228. # ifndef __ARMEB__
  229. rev r2,r2
  230. # endif
  231. #else
  232. @ ldrb r2,[r1,#3] @ 2
  233. add r10,r10,r12 @ h+=Maj(a,b,c) from the past
  234. ldrb r12,[r1,#2]
  235. ldrb r0,[r1,#1]
  236. orr r2,r2,r12,lsl#8
  237. ldrb r12,[r1],#4
  238. orr r2,r2,r0,lsl#16
  239. # if 2==15
  240. str r1,[sp,#17*4] @ make room for r1
  241. # endif
  242. eor r0,r6,r6,ror#5
  243. orr r2,r2,r12,lsl#24
  244. eor r0,r0,r6,ror#19 @ Sigma1(e)
  245. #endif
  246. ldr r12,[r14],#4 @ *K256++
  247. add r9,r9,r2 @ h+=X[i]
  248. str r2,[sp,#2*4]
  249. eor r2,r7,r8
  250. add r9,r9,r0,ror#6 @ h+=Sigma1(e)
  251. and r2,r2,r6
  252. add r9,r9,r12 @ h+=K256[i]
  253. eor r2,r2,r8 @ Ch(e,f,g)
  254. eor r0,r10,r10,ror#11
  255. add r9,r9,r2 @ h+=Ch(e,f,g)
  256. #if 2==31
  257. and r12,r12,#0xff
  258. cmp r12,#0xf2 @ done?
  259. #endif
  260. #if 2<15
  261. # if __ARM_ARCH__>=7
  262. ldr r2,[r1],#4 @ prefetch
  263. # else
  264. ldrb r2,[r1,#3]
  265. # endif
  266. eor r12,r10,r11 @ a^b, b^c in next round
  267. #else
  268. ldr r2,[sp,#4*4] @ from future BODY_16_xx
  269. eor r12,r10,r11 @ a^b, b^c in next round
  270. ldr r1,[sp,#1*4] @ from future BODY_16_xx
  271. #endif
  272. eor r0,r0,r10,ror#20 @ Sigma0(a)
  273. and r3,r3,r12 @ (b^c)&=(a^b)
  274. add r5,r5,r9 @ d+=h
  275. eor r3,r3,r11 @ Maj(a,b,c)
  276. add r9,r9,r0,ror#2 @ h+=Sigma0(a)
  277. @ add r9,r9,r3 @ h+=Maj(a,b,c)
  278. #if __ARM_ARCH__>=7
  279. @ ldr r2,[r1],#4 @ 3
  280. # if 3==15
  281. str r1,[sp,#17*4] @ make room for r1
  282. # endif
  283. eor r0,r5,r5,ror#5
  284. add r9,r9,r3 @ h+=Maj(a,b,c) from the past
  285. eor r0,r0,r5,ror#19 @ Sigma1(e)
  286. # ifndef __ARMEB__
  287. rev r2,r2
  288. # endif
  289. #else
  290. @ ldrb r2,[r1,#3] @ 3
  291. add r9,r9,r3 @ h+=Maj(a,b,c) from the past
  292. ldrb r3,[r1,#2]
  293. ldrb r0,[r1,#1]
  294. orr r2,r2,r3,lsl#8
  295. ldrb r3,[r1],#4
  296. orr r2,r2,r0,lsl#16
  297. # if 3==15
  298. str r1,[sp,#17*4] @ make room for r1
  299. # endif
  300. eor r0,r5,r5,ror#5
  301. orr r2,r2,r3,lsl#24
  302. eor r0,r0,r5,ror#19 @ Sigma1(e)
  303. #endif
  304. ldr r3,[r14],#4 @ *K256++
  305. add r8,r8,r2 @ h+=X[i]
  306. str r2,[sp,#3*4]
  307. eor r2,r6,r7
  308. add r8,r8,r0,ror#6 @ h+=Sigma1(e)
  309. and r2,r2,r5
  310. add r8,r8,r3 @ h+=K256[i]
  311. eor r2,r2,r7 @ Ch(e,f,g)
  312. eor r0,r9,r9,ror#11
  313. add r8,r8,r2 @ h+=Ch(e,f,g)
  314. #if 3==31
  315. and r3,r3,#0xff
  316. cmp r3,#0xf2 @ done?
  317. #endif
  318. #if 3<15
  319. # if __ARM_ARCH__>=7
  320. ldr r2,[r1],#4 @ prefetch
  321. # else
  322. ldrb r2,[r1,#3]
  323. # endif
  324. eor r3,r9,r10 @ a^b, b^c in next round
  325. #else
  326. ldr r2,[sp,#5*4] @ from future BODY_16_xx
  327. eor r3,r9,r10 @ a^b, b^c in next round
  328. ldr r1,[sp,#2*4] @ from future BODY_16_xx
  329. #endif
  330. eor r0,r0,r9,ror#20 @ Sigma0(a)
  331. and r12,r12,r3 @ (b^c)&=(a^b)
  332. add r4,r4,r8 @ d+=h
  333. eor r12,r12,r10 @ Maj(a,b,c)
  334. add r8,r8,r0,ror#2 @ h+=Sigma0(a)
  335. @ add r8,r8,r12 @ h+=Maj(a,b,c)
  336. #if __ARM_ARCH__>=7
  337. @ ldr r2,[r1],#4 @ 4
  338. # if 4==15
  339. str r1,[sp,#17*4] @ make room for r1
  340. # endif
  341. eor r0,r4,r4,ror#5
  342. add r8,r8,r12 @ h+=Maj(a,b,c) from the past
  343. eor r0,r0,r4,ror#19 @ Sigma1(e)
  344. # ifndef __ARMEB__
  345. rev r2,r2
  346. # endif
  347. #else
  348. @ ldrb r2,[r1,#3] @ 4
  349. add r8,r8,r12 @ h+=Maj(a,b,c) from the past
  350. ldrb r12,[r1,#2]
  351. ldrb r0,[r1,#1]
  352. orr r2,r2,r12,lsl#8
  353. ldrb r12,[r1],#4
  354. orr r2,r2,r0,lsl#16
  355. # if 4==15
  356. str r1,[sp,#17*4] @ make room for r1
  357. # endif
  358. eor r0,r4,r4,ror#5
  359. orr r2,r2,r12,lsl#24
  360. eor r0,r0,r4,ror#19 @ Sigma1(e)
  361. #endif
  362. ldr r12,[r14],#4 @ *K256++
  363. add r7,r7,r2 @ h+=X[i]
  364. str r2,[sp,#4*4]
  365. eor r2,r5,r6
  366. add r7,r7,r0,ror#6 @ h+=Sigma1(e)
  367. and r2,r2,r4
  368. add r7,r7,r12 @ h+=K256[i]
  369. eor r2,r2,r6 @ Ch(e,f,g)
  370. eor r0,r8,r8,ror#11
  371. add r7,r7,r2 @ h+=Ch(e,f,g)
  372. #if 4==31
  373. and r12,r12,#0xff
  374. cmp r12,#0xf2 @ done?
  375. #endif
  376. #if 4<15
  377. # if __ARM_ARCH__>=7
  378. ldr r2,[r1],#4 @ prefetch
  379. # else
  380. ldrb r2,[r1,#3]
  381. # endif
  382. eor r12,r8,r9 @ a^b, b^c in next round
  383. #else
  384. ldr r2,[sp,#6*4] @ from future BODY_16_xx
  385. eor r12,r8,r9 @ a^b, b^c in next round
  386. ldr r1,[sp,#3*4] @ from future BODY_16_xx
  387. #endif
  388. eor r0,r0,r8,ror#20 @ Sigma0(a)
  389. and r3,r3,r12 @ (b^c)&=(a^b)
  390. add r11,r11,r7 @ d+=h
  391. eor r3,r3,r9 @ Maj(a,b,c)
  392. add r7,r7,r0,ror#2 @ h+=Sigma0(a)
  393. @ add r7,r7,r3 @ h+=Maj(a,b,c)
  394. #if __ARM_ARCH__>=7
  395. @ ldr r2,[r1],#4 @ 5
  396. # if 5==15
  397. str r1,[sp,#17*4] @ make room for r1
  398. # endif
  399. eor r0,r11,r11,ror#5
  400. add r7,r7,r3 @ h+=Maj(a,b,c) from the past
  401. eor r0,r0,r11,ror#19 @ Sigma1(e)
  402. # ifndef __ARMEB__
  403. rev r2,r2
  404. # endif
  405. #else
  406. @ ldrb r2,[r1,#3] @ 5
  407. add r7,r7,r3 @ h+=Maj(a,b,c) from the past
  408. ldrb r3,[r1,#2]
  409. ldrb r0,[r1,#1]
  410. orr r2,r2,r3,lsl#8
  411. ldrb r3,[r1],#4
  412. orr r2,r2,r0,lsl#16
  413. # if 5==15
  414. str r1,[sp,#17*4] @ make room for r1
  415. # endif
  416. eor r0,r11,r11,ror#5
  417. orr r2,r2,r3,lsl#24
  418. eor r0,r0,r11,ror#19 @ Sigma1(e)
  419. #endif
  420. ldr r3,[r14],#4 @ *K256++
  421. add r6,r6,r2 @ h+=X[i]
  422. str r2,[sp,#5*4]
  423. eor r2,r4,r5
  424. add r6,r6,r0,ror#6 @ h+=Sigma1(e)
  425. and r2,r2,r11
  426. add r6,r6,r3 @ h+=K256[i]
  427. eor r2,r2,r5 @ Ch(e,f,g)
  428. eor r0,r7,r7,ror#11
  429. add r6,r6,r2 @ h+=Ch(e,f,g)
  430. #if 5==31
  431. and r3,r3,#0xff
  432. cmp r3,#0xf2 @ done?
  433. #endif
  434. #if 5<15
  435. # if __ARM_ARCH__>=7
  436. ldr r2,[r1],#4 @ prefetch
  437. # else
  438. ldrb r2,[r1,#3]
  439. # endif
  440. eor r3,r7,r8 @ a^b, b^c in next round
  441. #else
  442. ldr r2,[sp,#7*4] @ from future BODY_16_xx
  443. eor r3,r7,r8 @ a^b, b^c in next round
  444. ldr r1,[sp,#4*4] @ from future BODY_16_xx
  445. #endif
  446. eor r0,r0,r7,ror#20 @ Sigma0(a)
  447. and r12,r12,r3 @ (b^c)&=(a^b)
  448. add r10,r10,r6 @ d+=h
  449. eor r12,r12,r8 @ Maj(a,b,c)
  450. add r6,r6,r0,ror#2 @ h+=Sigma0(a)
  451. @ add r6,r6,r12 @ h+=Maj(a,b,c)
  452. #if __ARM_ARCH__>=7
  453. @ ldr r2,[r1],#4 @ 6
  454. # if 6==15
  455. str r1,[sp,#17*4] @ make room for r1
  456. # endif
  457. eor r0,r10,r10,ror#5
  458. add r6,r6,r12 @ h+=Maj(a,b,c) from the past
  459. eor r0,r0,r10,ror#19 @ Sigma1(e)
  460. # ifndef __ARMEB__
  461. rev r2,r2
  462. # endif
  463. #else
  464. @ ldrb r2,[r1,#3] @ 6
  465. add r6,r6,r12 @ h+=Maj(a,b,c) from the past
  466. ldrb r12,[r1,#2]
  467. ldrb r0,[r1,#1]
  468. orr r2,r2,r12,lsl#8
  469. ldrb r12,[r1],#4
  470. orr r2,r2,r0,lsl#16
  471. # if 6==15
  472. str r1,[sp,#17*4] @ make room for r1
  473. # endif
  474. eor r0,r10,r10,ror#5
  475. orr r2,r2,r12,lsl#24
  476. eor r0,r0,r10,ror#19 @ Sigma1(e)
  477. #endif
  478. ldr r12,[r14],#4 @ *K256++
  479. add r5,r5,r2 @ h+=X[i]
  480. str r2,[sp,#6*4]
  481. eor r2,r11,r4
  482. add r5,r5,r0,ror#6 @ h+=Sigma1(e)
  483. and r2,r2,r10
  484. add r5,r5,r12 @ h+=K256[i]
  485. eor r2,r2,r4 @ Ch(e,f,g)
  486. eor r0,r6,r6,ror#11
  487. add r5,r5,r2 @ h+=Ch(e,f,g)
  488. #if 6==31
  489. and r12,r12,#0xff
  490. cmp r12,#0xf2 @ done?
  491. #endif
  492. #if 6<15
  493. # if __ARM_ARCH__>=7
  494. ldr r2,[r1],#4 @ prefetch
  495. # else
  496. ldrb r2,[r1,#3]
  497. # endif
  498. eor r12,r6,r7 @ a^b, b^c in next round
  499. #else
  500. ldr r2,[sp,#8*4] @ from future BODY_16_xx
  501. eor r12,r6,r7 @ a^b, b^c in next round
  502. ldr r1,[sp,#5*4] @ from future BODY_16_xx
  503. #endif
  504. eor r0,r0,r6,ror#20 @ Sigma0(a)
  505. and r3,r3,r12 @ (b^c)&=(a^b)
  506. add r9,r9,r5 @ d+=h
  507. eor r3,r3,r7 @ Maj(a,b,c)
  508. add r5,r5,r0,ror#2 @ h+=Sigma0(a)
  509. @ add r5,r5,r3 @ h+=Maj(a,b,c)
  510. #if __ARM_ARCH__>=7
  511. @ ldr r2,[r1],#4 @ 7
  512. # if 7==15
  513. str r1,[sp,#17*4] @ make room for r1
  514. # endif
  515. eor r0,r9,r9,ror#5
  516. add r5,r5,r3 @ h+=Maj(a,b,c) from the past
  517. eor r0,r0,r9,ror#19 @ Sigma1(e)
  518. # ifndef __ARMEB__
  519. rev r2,r2
  520. # endif
  521. #else
  522. @ ldrb r2,[r1,#3] @ 7
  523. add r5,r5,r3 @ h+=Maj(a,b,c) from the past
  524. ldrb r3,[r1,#2]
  525. ldrb r0,[r1,#1]
  526. orr r2,r2,r3,lsl#8
  527. ldrb r3,[r1],#4
  528. orr r2,r2,r0,lsl#16
  529. # if 7==15
  530. str r1,[sp,#17*4] @ make room for r1
  531. # endif
  532. eor r0,r9,r9,ror#5
  533. orr r2,r2,r3,lsl#24
  534. eor r0,r0,r9,ror#19 @ Sigma1(e)
  535. #endif
  536. ldr r3,[r14],#4 @ *K256++
  537. add r4,r4,r2 @ h+=X[i]
  538. str r2,[sp,#7*4]
  539. eor r2,r10,r11
  540. add r4,r4,r0,ror#6 @ h+=Sigma1(e)
  541. and r2,r2,r9
  542. add r4,r4,r3 @ h+=K256[i]
  543. eor r2,r2,r11 @ Ch(e,f,g)
  544. eor r0,r5,r5,ror#11
  545. add r4,r4,r2 @ h+=Ch(e,f,g)
  546. #if 7==31
  547. and r3,r3,#0xff
  548. cmp r3,#0xf2 @ done?
  549. #endif
  550. #if 7<15
  551. # if __ARM_ARCH__>=7
  552. ldr r2,[r1],#4 @ prefetch
  553. # else
  554. ldrb r2,[r1,#3]
  555. # endif
  556. eor r3,r5,r6 @ a^b, b^c in next round
  557. #else
  558. ldr r2,[sp,#9*4] @ from future BODY_16_xx
  559. eor r3,r5,r6 @ a^b, b^c in next round
  560. ldr r1,[sp,#6*4] @ from future BODY_16_xx
  561. #endif
  562. eor r0,r0,r5,ror#20 @ Sigma0(a)
  563. and r12,r12,r3 @ (b^c)&=(a^b)
  564. add r8,r8,r4 @ d+=h
  565. eor r12,r12,r6 @ Maj(a,b,c)
  566. add r4,r4,r0,ror#2 @ h+=Sigma0(a)
  567. @ add r4,r4,r12 @ h+=Maj(a,b,c)
  568. #if __ARM_ARCH__>=7
  569. @ ldr r2,[r1],#4 @ 8
  570. # if 8==15
  571. str r1,[sp,#17*4] @ make room for r1
  572. # endif
  573. eor r0,r8,r8,ror#5
  574. add r4,r4,r12 @ h+=Maj(a,b,c) from the past
  575. eor r0,r0,r8,ror#19 @ Sigma1(e)
  576. # ifndef __ARMEB__
  577. rev r2,r2
  578. # endif
  579. #else
  580. @ ldrb r2,[r1,#3] @ 8
  581. add r4,r4,r12 @ h+=Maj(a,b,c) from the past
  582. ldrb r12,[r1,#2]
  583. ldrb r0,[r1,#1]
  584. orr r2,r2,r12,lsl#8
  585. ldrb r12,[r1],#4
  586. orr r2,r2,r0,lsl#16
  587. # if 8==15
  588. str r1,[sp,#17*4] @ make room for r1
  589. # endif
  590. eor r0,r8,r8,ror#5
  591. orr r2,r2,r12,lsl#24
  592. eor r0,r0,r8,ror#19 @ Sigma1(e)
  593. #endif
  594. ldr r12,[r14],#4 @ *K256++
  595. add r11,r11,r2 @ h+=X[i]
  596. str r2,[sp,#8*4]
  597. eor r2,r9,r10
  598. add r11,r11,r0,ror#6 @ h+=Sigma1(e)
  599. and r2,r2,r8
  600. add r11,r11,r12 @ h+=K256[i]
  601. eor r2,r2,r10 @ Ch(e,f,g)
  602. eor r0,r4,r4,ror#11
  603. add r11,r11,r2 @ h+=Ch(e,f,g)
  604. #if 8==31
  605. and r12,r12,#0xff
  606. cmp r12,#0xf2 @ done?
  607. #endif
  608. #if 8<15
  609. # if __ARM_ARCH__>=7
  610. ldr r2,[r1],#4 @ prefetch
  611. # else
  612. ldrb r2,[r1,#3]
  613. # endif
  614. eor r12,r4,r5 @ a^b, b^c in next round
  615. #else
  616. ldr r2,[sp,#10*4] @ from future BODY_16_xx
  617. eor r12,r4,r5 @ a^b, b^c in next round
  618. ldr r1,[sp,#7*4] @ from future BODY_16_xx
  619. #endif
  620. eor r0,r0,r4,ror#20 @ Sigma0(a)
  621. and r3,r3,r12 @ (b^c)&=(a^b)
  622. add r7,r7,r11 @ d+=h
  623. eor r3,r3,r5 @ Maj(a,b,c)
  624. add r11,r11,r0,ror#2 @ h+=Sigma0(a)
  625. @ add r11,r11,r3 @ h+=Maj(a,b,c)
  626. #if __ARM_ARCH__>=7
  627. @ ldr r2,[r1],#4 @ 9
  628. # if 9==15
  629. str r1,[sp,#17*4] @ make room for r1
  630. # endif
  631. eor r0,r7,r7,ror#5
  632. add r11,r11,r3 @ h+=Maj(a,b,c) from the past
  633. eor r0,r0,r7,ror#19 @ Sigma1(e)
  634. # ifndef __ARMEB__
  635. rev r2,r2
  636. # endif
  637. #else
  638. @ ldrb r2,[r1,#3] @ 9
  639. add r11,r11,r3 @ h+=Maj(a,b,c) from the past
  640. ldrb r3,[r1,#2]
  641. ldrb r0,[r1,#1]
  642. orr r2,r2,r3,lsl#8
  643. ldrb r3,[r1],#4
  644. orr r2,r2,r0,lsl#16
  645. # if 9==15
  646. str r1,[sp,#17*4] @ make room for r1
  647. # endif
  648. eor r0,r7,r7,ror#5
  649. orr r2,r2,r3,lsl#24
  650. eor r0,r0,r7,ror#19 @ Sigma1(e)
  651. #endif
  652. ldr r3,[r14],#4 @ *K256++
  653. add r10,r10,r2 @ h+=X[i]
  654. str r2,[sp,#9*4]
  655. eor r2,r8,r9
  656. add r10,r10,r0,ror#6 @ h+=Sigma1(e)
  657. and r2,r2,r7
  658. add r10,r10,r3 @ h+=K256[i]
  659. eor r2,r2,r9 @ Ch(e,f,g)
  660. eor r0,r11,r11,ror#11
  661. add r10,r10,r2 @ h+=Ch(e,f,g)
  662. #if 9==31
  663. and r3,r3,#0xff
  664. cmp r3,#0xf2 @ done?
  665. #endif
  666. #if 9<15
  667. # if __ARM_ARCH__>=7
  668. ldr r2,[r1],#4 @ prefetch
  669. # else
  670. ldrb r2,[r1,#3]
  671. # endif
  672. eor r3,r11,r4 @ a^b, b^c in next round
  673. #else
  674. ldr r2,[sp,#11*4] @ from future BODY_16_xx
  675. eor r3,r11,r4 @ a^b, b^c in next round
  676. ldr r1,[sp,#8*4] @ from future BODY_16_xx
  677. #endif
  678. eor r0,r0,r11,ror#20 @ Sigma0(a)
  679. and r12,r12,r3 @ (b^c)&=(a^b)
  680. add r6,r6,r10 @ d+=h
  681. eor r12,r12,r4 @ Maj(a,b,c)
  682. add r10,r10,r0,ror#2 @ h+=Sigma0(a)
  683. @ add r10,r10,r12 @ h+=Maj(a,b,c)
  684. #if __ARM_ARCH__>=7
  685. @ ldr r2,[r1],#4 @ 10
  686. # if 10==15
  687. str r1,[sp,#17*4] @ make room for r1
  688. # endif
  689. eor r0,r6,r6,ror#5
  690. add r10,r10,r12 @ h+=Maj(a,b,c) from the past
  691. eor r0,r0,r6,ror#19 @ Sigma1(e)
  692. # ifndef __ARMEB__
  693. rev r2,r2
  694. # endif
  695. #else
  696. @ ldrb r2,[r1,#3] @ 10
  697. add r10,r10,r12 @ h+=Maj(a,b,c) from the past
  698. ldrb r12,[r1,#2]
  699. ldrb r0,[r1,#1]
  700. orr r2,r2,r12,lsl#8
  701. ldrb r12,[r1],#4
  702. orr r2,r2,r0,lsl#16
  703. # if 10==15
  704. str r1,[sp,#17*4] @ make room for r1
  705. # endif
  706. eor r0,r6,r6,ror#5
  707. orr r2,r2,r12,lsl#24
  708. eor r0,r0,r6,ror#19 @ Sigma1(e)
  709. #endif
  710. ldr r12,[r14],#4 @ *K256++
  711. add r9,r9,r2 @ h+=X[i]
  712. str r2,[sp,#10*4]
  713. eor r2,r7,r8
  714. add r9,r9,r0,ror#6 @ h+=Sigma1(e)
  715. and r2,r2,r6
  716. add r9,r9,r12 @ h+=K256[i]
  717. eor r2,r2,r8 @ Ch(e,f,g)
  718. eor r0,r10,r10,ror#11
  719. add r9,r9,r2 @ h+=Ch(e,f,g)
  720. #if 10==31
  721. and r12,r12,#0xff
  722. cmp r12,#0xf2 @ done?
  723. #endif
  724. #if 10<15
  725. # if __ARM_ARCH__>=7
  726. ldr r2,[r1],#4 @ prefetch
  727. # else
  728. ldrb r2,[r1,#3]
  729. # endif
  730. eor r12,r10,r11 @ a^b, b^c in next round
  731. #else
  732. ldr r2,[sp,#12*4] @ from future BODY_16_xx
  733. eor r12,r10,r11 @ a^b, b^c in next round
  734. ldr r1,[sp,#9*4] @ from future BODY_16_xx
  735. #endif
  736. eor r0,r0,r10,ror#20 @ Sigma0(a)
  737. and r3,r3,r12 @ (b^c)&=(a^b)
  738. add r5,r5,r9 @ d+=h
  739. eor r3,r3,r11 @ Maj(a,b,c)
  740. add r9,r9,r0,ror#2 @ h+=Sigma0(a)
  741. @ add r9,r9,r3 @ h+=Maj(a,b,c)
  742. #if __ARM_ARCH__>=7
  743. @ ldr r2,[r1],#4 @ 11
  744. # if 11==15
  745. str r1,[sp,#17*4] @ make room for r1
  746. # endif
  747. eor r0,r5,r5,ror#5
  748. add r9,r9,r3 @ h+=Maj(a,b,c) from the past
  749. eor r0,r0,r5,ror#19 @ Sigma1(e)
  750. # ifndef __ARMEB__
  751. rev r2,r2
  752. # endif
  753. #else
  754. @ ldrb r2,[r1,#3] @ 11
  755. add r9,r9,r3 @ h+=Maj(a,b,c) from the past
  756. ldrb r3,[r1,#2]
  757. ldrb r0,[r1,#1]
  758. orr r2,r2,r3,lsl#8
  759. ldrb r3,[r1],#4
  760. orr r2,r2,r0,lsl#16
  761. # if 11==15
  762. str r1,[sp,#17*4] @ make room for r1
  763. # endif
  764. eor r0,r5,r5,ror#5
  765. orr r2,r2,r3,lsl#24
  766. eor r0,r0,r5,ror#19 @ Sigma1(e)
  767. #endif
  768. ldr r3,[r14],#4 @ *K256++
  769. add r8,r8,r2 @ h+=X[i]
  770. str r2,[sp,#11*4]
  771. eor r2,r6,r7
  772. add r8,r8,r0,ror#6 @ h+=Sigma1(e)
  773. and r2,r2,r5
  774. add r8,r8,r3 @ h+=K256[i]
  775. eor r2,r2,r7 @ Ch(e,f,g)
  776. eor r0,r9,r9,ror#11
  777. add r8,r8,r2 @ h+=Ch(e,f,g)
  778. #if 11==31
  779. and r3,r3,#0xff
  780. cmp r3,#0xf2 @ done?
  781. #endif
  782. #if 11<15
  783. # if __ARM_ARCH__>=7
  784. ldr r2,[r1],#4 @ prefetch
  785. # else
  786. ldrb r2,[r1,#3]
  787. # endif
  788. eor r3,r9,r10 @ a^b, b^c in next round
  789. #else
  790. ldr r2,[sp,#13*4] @ from future BODY_16_xx
  791. eor r3,r9,r10 @ a^b, b^c in next round
  792. ldr r1,[sp,#10*4] @ from future BODY_16_xx
  793. #endif
  794. eor r0,r0,r9,ror#20 @ Sigma0(a)
  795. and r12,r12,r3 @ (b^c)&=(a^b)
  796. add r4,r4,r8 @ d+=h
  797. eor r12,r12,r10 @ Maj(a,b,c)
  798. add r8,r8,r0,ror#2 @ h+=Sigma0(a)
  799. @ add r8,r8,r12 @ h+=Maj(a,b,c)
  800. #if __ARM_ARCH__>=7
  801. @ ldr r2,[r1],#4 @ 12
  802. # if 12==15
  803. str r1,[sp,#17*4] @ make room for r1
  804. # endif
  805. eor r0,r4,r4,ror#5
  806. add r8,r8,r12 @ h+=Maj(a,b,c) from the past
  807. eor r0,r0,r4,ror#19 @ Sigma1(e)
  808. # ifndef __ARMEB__
  809. rev r2,r2
  810. # endif
  811. #else
  812. @ ldrb r2,[r1,#3] @ 12
  813. add r8,r8,r12 @ h+=Maj(a,b,c) from the past
  814. ldrb r12,[r1,#2]
  815. ldrb r0,[r1,#1]
  816. orr r2,r2,r12,lsl#8
  817. ldrb r12,[r1],#4
  818. orr r2,r2,r0,lsl#16
  819. # if 12==15
  820. str r1,[sp,#17*4] @ make room for r1
  821. # endif
  822. eor r0,r4,r4,ror#5
  823. orr r2,r2,r12,lsl#24
  824. eor r0,r0,r4,ror#19 @ Sigma1(e)
  825. #endif
  826. ldr r12,[r14],#4 @ *K256++
  827. add r7,r7,r2 @ h+=X[i]
  828. str r2,[sp,#12*4]
  829. eor r2,r5,r6
  830. add r7,r7,r0,ror#6 @ h+=Sigma1(e)
  831. and r2,r2,r4
  832. add r7,r7,r12 @ h+=K256[i]
  833. eor r2,r2,r6 @ Ch(e,f,g)
  834. eor r0,r8,r8,ror#11
  835. add r7,r7,r2 @ h+=Ch(e,f,g)
  836. #if 12==31
  837. and r12,r12,#0xff
  838. cmp r12,#0xf2 @ done?
  839. #endif
  840. #if 12<15
  841. # if __ARM_ARCH__>=7
  842. ldr r2,[r1],#4 @ prefetch
  843. # else
  844. ldrb r2,[r1,#3]
  845. # endif
  846. eor r12,r8,r9 @ a^b, b^c in next round
  847. #else
  848. ldr r2,[sp,#14*4] @ from future BODY_16_xx
  849. eor r12,r8,r9 @ a^b, b^c in next round
  850. ldr r1,[sp,#11*4] @ from future BODY_16_xx
  851. #endif
  852. eor r0,r0,r8,ror#20 @ Sigma0(a)
  853. and r3,r3,r12 @ (b^c)&=(a^b)
  854. add r11,r11,r7 @ d+=h
  855. eor r3,r3,r9 @ Maj(a,b,c)
  856. add r7,r7,r0,ror#2 @ h+=Sigma0(a)
  857. @ add r7,r7,r3 @ h+=Maj(a,b,c)
  858. #if __ARM_ARCH__>=7
  859. @ ldr r2,[r1],#4 @ 13
  860. # if 13==15
  861. str r1,[sp,#17*4] @ make room for r1
  862. # endif
  863. eor r0,r11,r11,ror#5
  864. add r7,r7,r3 @ h+=Maj(a,b,c) from the past
  865. eor r0,r0,r11,ror#19 @ Sigma1(e)
  866. # ifndef __ARMEB__
  867. rev r2,r2
  868. # endif
  869. #else
  870. @ ldrb r2,[r1,#3] @ 13
  871. add r7,r7,r3 @ h+=Maj(a,b,c) from the past
  872. ldrb r3,[r1,#2]
  873. ldrb r0,[r1,#1]
  874. orr r2,r2,r3,lsl#8
  875. ldrb r3,[r1],#4
  876. orr r2,r2,r0,lsl#16
  877. # if 13==15
  878. str r1,[sp,#17*4] @ make room for r1
  879. # endif
  880. eor r0,r11,r11,ror#5
  881. orr r2,r2,r3,lsl#24
  882. eor r0,r0,r11,ror#19 @ Sigma1(e)
  883. #endif
  884. ldr r3,[r14],#4 @ *K256++
  885. add r6,r6,r2 @ h+=X[i]
  886. str r2,[sp,#13*4]
  887. eor r2,r4,r5
  888. add r6,r6,r0,ror#6 @ h+=Sigma1(e)
  889. and r2,r2,r11
  890. add r6,r6,r3 @ h+=K256[i]
  891. eor r2,r2,r5 @ Ch(e,f,g)
  892. eor r0,r7,r7,ror#11
  893. add r6,r6,r2 @ h+=Ch(e,f,g)
  894. #if 13==31
  895. and r3,r3,#0xff
  896. cmp r3,#0xf2 @ done?
  897. #endif
  898. #if 13<15
  899. # if __ARM_ARCH__>=7
  900. ldr r2,[r1],#4 @ prefetch
  901. # else
  902. ldrb r2,[r1,#3]
  903. # endif
  904. eor r3,r7,r8 @ a^b, b^c in next round
  905. #else
  906. ldr r2,[sp,#15*4] @ from future BODY_16_xx
  907. eor r3,r7,r8 @ a^b, b^c in next round
  908. ldr r1,[sp,#12*4] @ from future BODY_16_xx
  909. #endif
  910. eor r0,r0,r7,ror#20 @ Sigma0(a)
  911. and r12,r12,r3 @ (b^c)&=(a^b)
  912. add r10,r10,r6 @ d+=h
  913. eor r12,r12,r8 @ Maj(a,b,c)
  914. add r6,r6,r0,ror#2 @ h+=Sigma0(a)
  915. @ add r6,r6,r12 @ h+=Maj(a,b,c)
  916. #if __ARM_ARCH__>=7
  917. @ ldr r2,[r1],#4 @ 14
  918. # if 14==15
  919. str r1,[sp,#17*4] @ make room for r1
  920. # endif
  921. eor r0,r10,r10,ror#5
  922. add r6,r6,r12 @ h+=Maj(a,b,c) from the past
  923. eor r0,r0,r10,ror#19 @ Sigma1(e)
  924. # ifndef __ARMEB__
  925. rev r2,r2
  926. # endif
  927. #else
  928. @ ldrb r2,[r1,#3] @ 14
  929. add r6,r6,r12 @ h+=Maj(a,b,c) from the past
  930. ldrb r12,[r1,#2]
  931. ldrb r0,[r1,#1]
  932. orr r2,r2,r12,lsl#8
  933. ldrb r12,[r1],#4
  934. orr r2,r2,r0,lsl#16
  935. # if 14==15
  936. str r1,[sp,#17*4] @ make room for r1
  937. # endif
  938. eor r0,r10,r10,ror#5
  939. orr r2,r2,r12,lsl#24
  940. eor r0,r0,r10,ror#19 @ Sigma1(e)
  941. #endif
  942. ldr r12,[r14],#4 @ *K256++
  943. add r5,r5,r2 @ h+=X[i]
  944. str r2,[sp,#14*4]
  945. eor r2,r11,r4
  946. add r5,r5,r0,ror#6 @ h+=Sigma1(e)
  947. and r2,r2,r10
  948. add r5,r5,r12 @ h+=K256[i]
  949. eor r2,r2,r4 @ Ch(e,f,g)
  950. eor r0,r6,r6,ror#11
  951. add r5,r5,r2 @ h+=Ch(e,f,g)
  952. #if 14==31
  953. and r12,r12,#0xff
  954. cmp r12,#0xf2 @ done?
  955. #endif
  956. #if 14<15
  957. # if __ARM_ARCH__>=7
  958. ldr r2,[r1],#4 @ prefetch
  959. # else
  960. ldrb r2,[r1,#3]
  961. # endif
  962. eor r12,r6,r7 @ a^b, b^c in next round
  963. #else
  964. ldr r2,[sp,#0*4] @ from future BODY_16_xx
  965. eor r12,r6,r7 @ a^b, b^c in next round
  966. ldr r1,[sp,#13*4] @ from future BODY_16_xx
  967. #endif
  968. eor r0,r0,r6,ror#20 @ Sigma0(a)
  969. and r3,r3,r12 @ (b^c)&=(a^b)
  970. add r9,r9,r5 @ d+=h
  971. eor r3,r3,r7 @ Maj(a,b,c)
  972. add r5,r5,r0,ror#2 @ h+=Sigma0(a)
  973. @ add r5,r5,r3 @ h+=Maj(a,b,c)
  974. #if __ARM_ARCH__>=7
  975. @ ldr r2,[r1],#4 @ 15
  976. # if 15==15
  977. str r1,[sp,#17*4] @ make room for r1
  978. # endif
  979. eor r0,r9,r9,ror#5
  980. add r5,r5,r3 @ h+=Maj(a,b,c) from the past
  981. eor r0,r0,r9,ror#19 @ Sigma1(e)
  982. # ifndef __ARMEB__
  983. rev r2,r2
  984. # endif
  985. #else
  986. @ ldrb r2,[r1,#3] @ 15
  987. add r5,r5,r3 @ h+=Maj(a,b,c) from the past
  988. ldrb r3,[r1,#2]
  989. ldrb r0,[r1,#1]
  990. orr r2,r2,r3,lsl#8
  991. ldrb r3,[r1],#4
  992. orr r2,r2,r0,lsl#16
  993. # if 15==15
  994. str r1,[sp,#17*4] @ make room for r1
  995. # endif
  996. eor r0,r9,r9,ror#5
  997. orr r2,r2,r3,lsl#24
  998. eor r0,r0,r9,ror#19 @ Sigma1(e)
  999. #endif
  1000. ldr r3,[r14],#4 @ *K256++
  1001. add r4,r4,r2 @ h+=X[i]
  1002. str r2,[sp,#15*4]
  1003. eor r2,r10,r11
  1004. add r4,r4,r0,ror#6 @ h+=Sigma1(e)
  1005. and r2,r2,r9
  1006. add r4,r4,r3 @ h+=K256[i]
  1007. eor r2,r2,r11 @ Ch(e,f,g)
  1008. eor r0,r5,r5,ror#11
  1009. add r4,r4,r2 @ h+=Ch(e,f,g)
  1010. #if 15==31
  1011. and r3,r3,#0xff
  1012. cmp r3,#0xf2 @ done?
  1013. #endif
  1014. #if 15<15
  1015. # if __ARM_ARCH__>=7
  1016. ldr r2,[r1],#4 @ prefetch
  1017. # else
  1018. ldrb r2,[r1,#3]
  1019. # endif
  1020. eor r3,r5,r6 @ a^b, b^c in next round
  1021. #else
  1022. ldr r2,[sp,#1*4] @ from future BODY_16_xx
  1023. eor r3,r5,r6 @ a^b, b^c in next round
  1024. ldr r1,[sp,#14*4] @ from future BODY_16_xx
  1025. #endif
  1026. eor r0,r0,r5,ror#20 @ Sigma0(a)
  1027. and r12,r12,r3 @ (b^c)&=(a^b)
  1028. add r8,r8,r4 @ d+=h
  1029. eor r12,r12,r6 @ Maj(a,b,c)
  1030. add r4,r4,r0,ror#2 @ h+=Sigma0(a)
  1031. @ add r4,r4,r12 @ h+=Maj(a,b,c)
  1032. .Lrounds_16_xx:
  1033. @ ldr r2,[sp,#1*4] @ 16
  1034. @ ldr r1,[sp,#14*4]
  1035. mov r0,r2,ror#7
  1036. add r4,r4,r12 @ h+=Maj(a,b,c) from the past
  1037. mov r12,r1,ror#17
  1038. eor r0,r0,r2,ror#18
  1039. eor r12,r12,r1,ror#19
  1040. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1041. ldr r2,[sp,#0*4]
  1042. eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
  1043. ldr r1,[sp,#9*4]
  1044. add r12,r12,r0
  1045. eor r0,r8,r8,ror#5 @ from BODY_00_15
  1046. add r2,r2,r12
  1047. eor r0,r0,r8,ror#19 @ Sigma1(e)
  1048. add r2,r2,r1 @ X[i]
  1049. ldr r12,[r14],#4 @ *K256++
  1050. add r11,r11,r2 @ h+=X[i]
  1051. str r2,[sp,#0*4]
  1052. eor r2,r9,r10
  1053. add r11,r11,r0,ror#6 @ h+=Sigma1(e)
  1054. and r2,r2,r8
  1055. add r11,r11,r12 @ h+=K256[i]
  1056. eor r2,r2,r10 @ Ch(e,f,g)
  1057. eor r0,r4,r4,ror#11
  1058. add r11,r11,r2 @ h+=Ch(e,f,g)
  1059. #if 16==31
  1060. and r12,r12,#0xff
  1061. cmp r12,#0xf2 @ done?
  1062. #endif
  1063. #if 16<15
  1064. # if __ARM_ARCH__>=7
  1065. ldr r2,[r1],#4 @ prefetch
  1066. # else
  1067. ldrb r2,[r1,#3]
  1068. # endif
  1069. eor r12,r4,r5 @ a^b, b^c in next round
  1070. #else
  1071. ldr r2,[sp,#2*4] @ from future BODY_16_xx
  1072. eor r12,r4,r5 @ a^b, b^c in next round
  1073. ldr r1,[sp,#15*4] @ from future BODY_16_xx
  1074. #endif
  1075. eor r0,r0,r4,ror#20 @ Sigma0(a)
  1076. and r3,r3,r12 @ (b^c)&=(a^b)
  1077. add r7,r7,r11 @ d+=h
  1078. eor r3,r3,r5 @ Maj(a,b,c)
  1079. add r11,r11,r0,ror#2 @ h+=Sigma0(a)
  1080. @ add r11,r11,r3 @ h+=Maj(a,b,c)
  1081. @ ldr r2,[sp,#2*4] @ 17
  1082. @ ldr r1,[sp,#15*4]
  1083. mov r0,r2,ror#7
  1084. add r11,r11,r3 @ h+=Maj(a,b,c) from the past
  1085. mov r3,r1,ror#17
  1086. eor r0,r0,r2,ror#18
  1087. eor r3,r3,r1,ror#19
  1088. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1089. ldr r2,[sp,#1*4]
  1090. eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
  1091. ldr r1,[sp,#10*4]
  1092. add r3,r3,r0
  1093. eor r0,r7,r7,ror#5 @ from BODY_00_15
  1094. add r2,r2,r3
  1095. eor r0,r0,r7,ror#19 @ Sigma1(e)
  1096. add r2,r2,r1 @ X[i]
  1097. ldr r3,[r14],#4 @ *K256++
  1098. add r10,r10,r2 @ h+=X[i]
  1099. str r2,[sp,#1*4]
  1100. eor r2,r8,r9
  1101. add r10,r10,r0,ror#6 @ h+=Sigma1(e)
  1102. and r2,r2,r7
  1103. add r10,r10,r3 @ h+=K256[i]
  1104. eor r2,r2,r9 @ Ch(e,f,g)
  1105. eor r0,r11,r11,ror#11
  1106. add r10,r10,r2 @ h+=Ch(e,f,g)
  1107. #if 17==31
  1108. and r3,r3,#0xff
  1109. cmp r3,#0xf2 @ done?
  1110. #endif
  1111. #if 17<15
  1112. # if __ARM_ARCH__>=7
  1113. ldr r2,[r1],#4 @ prefetch
  1114. # else
  1115. ldrb r2,[r1,#3]
  1116. # endif
  1117. eor r3,r11,r4 @ a^b, b^c in next round
  1118. #else
  1119. ldr r2,[sp,#3*4] @ from future BODY_16_xx
  1120. eor r3,r11,r4 @ a^b, b^c in next round
  1121. ldr r1,[sp,#0*4] @ from future BODY_16_xx
  1122. #endif
  1123. eor r0,r0,r11,ror#20 @ Sigma0(a)
  1124. and r12,r12,r3 @ (b^c)&=(a^b)
  1125. add r6,r6,r10 @ d+=h
  1126. eor r12,r12,r4 @ Maj(a,b,c)
  1127. add r10,r10,r0,ror#2 @ h+=Sigma0(a)
  1128. @ add r10,r10,r12 @ h+=Maj(a,b,c)
  1129. @ ldr r2,[sp,#3*4] @ 18
  1130. @ ldr r1,[sp,#0*4]
  1131. mov r0,r2,ror#7
  1132. add r10,r10,r12 @ h+=Maj(a,b,c) from the past
  1133. mov r12,r1,ror#17
  1134. eor r0,r0,r2,ror#18
  1135. eor r12,r12,r1,ror#19
  1136. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1137. ldr r2,[sp,#2*4]
  1138. eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
  1139. ldr r1,[sp,#11*4]
  1140. add r12,r12,r0
  1141. eor r0,r6,r6,ror#5 @ from BODY_00_15
  1142. add r2,r2,r12
  1143. eor r0,r0,r6,ror#19 @ Sigma1(e)
  1144. add r2,r2,r1 @ X[i]
  1145. ldr r12,[r14],#4 @ *K256++
  1146. add r9,r9,r2 @ h+=X[i]
  1147. str r2,[sp,#2*4]
  1148. eor r2,r7,r8
  1149. add r9,r9,r0,ror#6 @ h+=Sigma1(e)
  1150. and r2,r2,r6
  1151. add r9,r9,r12 @ h+=K256[i]
  1152. eor r2,r2,r8 @ Ch(e,f,g)
  1153. eor r0,r10,r10,ror#11
  1154. add r9,r9,r2 @ h+=Ch(e,f,g)
  1155. #if 18==31
  1156. and r12,r12,#0xff
  1157. cmp r12,#0xf2 @ done?
  1158. #endif
  1159. #if 18<15
  1160. # if __ARM_ARCH__>=7
  1161. ldr r2,[r1],#4 @ prefetch
  1162. # else
  1163. ldrb r2,[r1,#3]
  1164. # endif
  1165. eor r12,r10,r11 @ a^b, b^c in next round
  1166. #else
  1167. ldr r2,[sp,#4*4] @ from future BODY_16_xx
  1168. eor r12,r10,r11 @ a^b, b^c in next round
  1169. ldr r1,[sp,#1*4] @ from future BODY_16_xx
  1170. #endif
  1171. eor r0,r0,r10,ror#20 @ Sigma0(a)
  1172. and r3,r3,r12 @ (b^c)&=(a^b)
  1173. add r5,r5,r9 @ d+=h
  1174. eor r3,r3,r11 @ Maj(a,b,c)
  1175. add r9,r9,r0,ror#2 @ h+=Sigma0(a)
  1176. @ add r9,r9,r3 @ h+=Maj(a,b,c)
  1177. @ ldr r2,[sp,#4*4] @ 19
  1178. @ ldr r1,[sp,#1*4]
  1179. mov r0,r2,ror#7
  1180. add r9,r9,r3 @ h+=Maj(a,b,c) from the past
  1181. mov r3,r1,ror#17
  1182. eor r0,r0,r2,ror#18
  1183. eor r3,r3,r1,ror#19
  1184. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1185. ldr r2,[sp,#3*4]
  1186. eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
  1187. ldr r1,[sp,#12*4]
  1188. add r3,r3,r0
  1189. eor r0,r5,r5,ror#5 @ from BODY_00_15
  1190. add r2,r2,r3
  1191. eor r0,r0,r5,ror#19 @ Sigma1(e)
  1192. add r2,r2,r1 @ X[i]
  1193. ldr r3,[r14],#4 @ *K256++
  1194. add r8,r8,r2 @ h+=X[i]
  1195. str r2,[sp,#3*4]
  1196. eor r2,r6,r7
  1197. add r8,r8,r0,ror#6 @ h+=Sigma1(e)
  1198. and r2,r2,r5
  1199. add r8,r8,r3 @ h+=K256[i]
  1200. eor r2,r2,r7 @ Ch(e,f,g)
  1201. eor r0,r9,r9,ror#11
  1202. add r8,r8,r2 @ h+=Ch(e,f,g)
  1203. #if 19==31
  1204. and r3,r3,#0xff
  1205. cmp r3,#0xf2 @ done?
  1206. #endif
  1207. #if 19<15
  1208. # if __ARM_ARCH__>=7
  1209. ldr r2,[r1],#4 @ prefetch
  1210. # else
  1211. ldrb r2,[r1,#3]
  1212. # endif
  1213. eor r3,r9,r10 @ a^b, b^c in next round
  1214. #else
  1215. ldr r2,[sp,#5*4] @ from future BODY_16_xx
  1216. eor r3,r9,r10 @ a^b, b^c in next round
  1217. ldr r1,[sp,#2*4] @ from future BODY_16_xx
  1218. #endif
  1219. eor r0,r0,r9,ror#20 @ Sigma0(a)
  1220. and r12,r12,r3 @ (b^c)&=(a^b)
  1221. add r4,r4,r8 @ d+=h
  1222. eor r12,r12,r10 @ Maj(a,b,c)
  1223. add r8,r8,r0,ror#2 @ h+=Sigma0(a)
  1224. @ add r8,r8,r12 @ h+=Maj(a,b,c)
  1225. @ ldr r2,[sp,#5*4] @ 20
  1226. @ ldr r1,[sp,#2*4]
  1227. mov r0,r2,ror#7
  1228. add r8,r8,r12 @ h+=Maj(a,b,c) from the past
  1229. mov r12,r1,ror#17
  1230. eor r0,r0,r2,ror#18
  1231. eor r12,r12,r1,ror#19
  1232. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1233. ldr r2,[sp,#4*4]
  1234. eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
  1235. ldr r1,[sp,#13*4]
  1236. add r12,r12,r0
  1237. eor r0,r4,r4,ror#5 @ from BODY_00_15
  1238. add r2,r2,r12
  1239. eor r0,r0,r4,ror#19 @ Sigma1(e)
  1240. add r2,r2,r1 @ X[i]
  1241. ldr r12,[r14],#4 @ *K256++
  1242. add r7,r7,r2 @ h+=X[i]
  1243. str r2,[sp,#4*4]
  1244. eor r2,r5,r6
  1245. add r7,r7,r0,ror#6 @ h+=Sigma1(e)
  1246. and r2,r2,r4
  1247. add r7,r7,r12 @ h+=K256[i]
  1248. eor r2,r2,r6 @ Ch(e,f,g)
  1249. eor r0,r8,r8,ror#11
  1250. add r7,r7,r2 @ h+=Ch(e,f,g)
  1251. #if 20==31
  1252. and r12,r12,#0xff
  1253. cmp r12,#0xf2 @ done?
  1254. #endif
  1255. #if 20<15
  1256. # if __ARM_ARCH__>=7
  1257. ldr r2,[r1],#4 @ prefetch
  1258. # else
  1259. ldrb r2,[r1,#3]
  1260. # endif
  1261. eor r12,r8,r9 @ a^b, b^c in next round
  1262. #else
  1263. ldr r2,[sp,#6*4] @ from future BODY_16_xx
  1264. eor r12,r8,r9 @ a^b, b^c in next round
  1265. ldr r1,[sp,#3*4] @ from future BODY_16_xx
  1266. #endif
  1267. eor r0,r0,r8,ror#20 @ Sigma0(a)
  1268. and r3,r3,r12 @ (b^c)&=(a^b)
  1269. add r11,r11,r7 @ d+=h
  1270. eor r3,r3,r9 @ Maj(a,b,c)
  1271. add r7,r7,r0,ror#2 @ h+=Sigma0(a)
  1272. @ add r7,r7,r3 @ h+=Maj(a,b,c)
  1273. @ ldr r2,[sp,#6*4] @ 21
  1274. @ ldr r1,[sp,#3*4]
  1275. mov r0,r2,ror#7
  1276. add r7,r7,r3 @ h+=Maj(a,b,c) from the past
  1277. mov r3,r1,ror#17
  1278. eor r0,r0,r2,ror#18
  1279. eor r3,r3,r1,ror#19
  1280. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1281. ldr r2,[sp,#5*4]
  1282. eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
  1283. ldr r1,[sp,#14*4]
  1284. add r3,r3,r0
  1285. eor r0,r11,r11,ror#5 @ from BODY_00_15
  1286. add r2,r2,r3
  1287. eor r0,r0,r11,ror#19 @ Sigma1(e)
  1288. add r2,r2,r1 @ X[i]
  1289. ldr r3,[r14],#4 @ *K256++
  1290. add r6,r6,r2 @ h+=X[i]
  1291. str r2,[sp,#5*4]
  1292. eor r2,r4,r5
  1293. add r6,r6,r0,ror#6 @ h+=Sigma1(e)
  1294. and r2,r2,r11
  1295. add r6,r6,r3 @ h+=K256[i]
  1296. eor r2,r2,r5 @ Ch(e,f,g)
  1297. eor r0,r7,r7,ror#11
  1298. add r6,r6,r2 @ h+=Ch(e,f,g)
  1299. #if 21==31
  1300. and r3,r3,#0xff
  1301. cmp r3,#0xf2 @ done?
  1302. #endif
  1303. #if 21<15
  1304. # if __ARM_ARCH__>=7
  1305. ldr r2,[r1],#4 @ prefetch
  1306. # else
  1307. ldrb r2,[r1,#3]
  1308. # endif
  1309. eor r3,r7,r8 @ a^b, b^c in next round
  1310. #else
  1311. ldr r2,[sp,#7*4] @ from future BODY_16_xx
  1312. eor r3,r7,r8 @ a^b, b^c in next round
  1313. ldr r1,[sp,#4*4] @ from future BODY_16_xx
  1314. #endif
  1315. eor r0,r0,r7,ror#20 @ Sigma0(a)
  1316. and r12,r12,r3 @ (b^c)&=(a^b)
  1317. add r10,r10,r6 @ d+=h
  1318. eor r12,r12,r8 @ Maj(a,b,c)
  1319. add r6,r6,r0,ror#2 @ h+=Sigma0(a)
  1320. @ add r6,r6,r12 @ h+=Maj(a,b,c)
  1321. @ ldr r2,[sp,#7*4] @ 22
  1322. @ ldr r1,[sp,#4*4]
  1323. mov r0,r2,ror#7
  1324. add r6,r6,r12 @ h+=Maj(a,b,c) from the past
  1325. mov r12,r1,ror#17
  1326. eor r0,r0,r2,ror#18
  1327. eor r12,r12,r1,ror#19
  1328. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1329. ldr r2,[sp,#6*4]
  1330. eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
  1331. ldr r1,[sp,#15*4]
  1332. add r12,r12,r0
  1333. eor r0,r10,r10,ror#5 @ from BODY_00_15
  1334. add r2,r2,r12
  1335. eor r0,r0,r10,ror#19 @ Sigma1(e)
  1336. add r2,r2,r1 @ X[i]
  1337. ldr r12,[r14],#4 @ *K256++
  1338. add r5,r5,r2 @ h+=X[i]
  1339. str r2,[sp,#6*4]
  1340. eor r2,r11,r4
  1341. add r5,r5,r0,ror#6 @ h+=Sigma1(e)
  1342. and r2,r2,r10
  1343. add r5,r5,r12 @ h+=K256[i]
  1344. eor r2,r2,r4 @ Ch(e,f,g)
  1345. eor r0,r6,r6,ror#11
  1346. add r5,r5,r2 @ h+=Ch(e,f,g)
  1347. #if 22==31
  1348. and r12,r12,#0xff
  1349. cmp r12,#0xf2 @ done?
  1350. #endif
  1351. #if 22<15
  1352. # if __ARM_ARCH__>=7
  1353. ldr r2,[r1],#4 @ prefetch
  1354. # else
  1355. ldrb r2,[r1,#3]
  1356. # endif
  1357. eor r12,r6,r7 @ a^b, b^c in next round
  1358. #else
  1359. ldr r2,[sp,#8*4] @ from future BODY_16_xx
  1360. eor r12,r6,r7 @ a^b, b^c in next round
  1361. ldr r1,[sp,#5*4] @ from future BODY_16_xx
  1362. #endif
  1363. eor r0,r0,r6,ror#20 @ Sigma0(a)
  1364. and r3,r3,r12 @ (b^c)&=(a^b)
  1365. add r9,r9,r5 @ d+=h
  1366. eor r3,r3,r7 @ Maj(a,b,c)
  1367. add r5,r5,r0,ror#2 @ h+=Sigma0(a)
  1368. @ add r5,r5,r3 @ h+=Maj(a,b,c)
  1369. @ ldr r2,[sp,#8*4] @ 23
  1370. @ ldr r1,[sp,#5*4]
  1371. mov r0,r2,ror#7
  1372. add r5,r5,r3 @ h+=Maj(a,b,c) from the past
  1373. mov r3,r1,ror#17
  1374. eor r0,r0,r2,ror#18
  1375. eor r3,r3,r1,ror#19
  1376. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1377. ldr r2,[sp,#7*4]
  1378. eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
  1379. ldr r1,[sp,#0*4]
  1380. add r3,r3,r0
  1381. eor r0,r9,r9,ror#5 @ from BODY_00_15
  1382. add r2,r2,r3
  1383. eor r0,r0,r9,ror#19 @ Sigma1(e)
  1384. add r2,r2,r1 @ X[i]
  1385. ldr r3,[r14],#4 @ *K256++
  1386. add r4,r4,r2 @ h+=X[i]
  1387. str r2,[sp,#7*4]
  1388. eor r2,r10,r11
  1389. add r4,r4,r0,ror#6 @ h+=Sigma1(e)
  1390. and r2,r2,r9
  1391. add r4,r4,r3 @ h+=K256[i]
  1392. eor r2,r2,r11 @ Ch(e,f,g)
  1393. eor r0,r5,r5,ror#11
  1394. add r4,r4,r2 @ h+=Ch(e,f,g)
  1395. #if 23==31
  1396. and r3,r3,#0xff
  1397. cmp r3,#0xf2 @ done?
  1398. #endif
  1399. #if 23<15
  1400. # if __ARM_ARCH__>=7
  1401. ldr r2,[r1],#4 @ prefetch
  1402. # else
  1403. ldrb r2,[r1,#3]
  1404. # endif
  1405. eor r3,r5,r6 @ a^b, b^c in next round
  1406. #else
  1407. ldr r2,[sp,#9*4] @ from future BODY_16_xx
  1408. eor r3,r5,r6 @ a^b, b^c in next round
  1409. ldr r1,[sp,#6*4] @ from future BODY_16_xx
  1410. #endif
  1411. eor r0,r0,r5,ror#20 @ Sigma0(a)
  1412. and r12,r12,r3 @ (b^c)&=(a^b)
  1413. add r8,r8,r4 @ d+=h
  1414. eor r12,r12,r6 @ Maj(a,b,c)
  1415. add r4,r4,r0,ror#2 @ h+=Sigma0(a)
  1416. @ add r4,r4,r12 @ h+=Maj(a,b,c)
  1417. @ ldr r2,[sp,#9*4] @ 24
  1418. @ ldr r1,[sp,#6*4]
  1419. mov r0,r2,ror#7
  1420. add r4,r4,r12 @ h+=Maj(a,b,c) from the past
  1421. mov r12,r1,ror#17
  1422. eor r0,r0,r2,ror#18
  1423. eor r12,r12,r1,ror#19
  1424. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1425. ldr r2,[sp,#8*4]
  1426. eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
  1427. ldr r1,[sp,#1*4]
  1428. add r12,r12,r0
  1429. eor r0,r8,r8,ror#5 @ from BODY_00_15
  1430. add r2,r2,r12
  1431. eor r0,r0,r8,ror#19 @ Sigma1(e)
  1432. add r2,r2,r1 @ X[i]
  1433. ldr r12,[r14],#4 @ *K256++
  1434. add r11,r11,r2 @ h+=X[i]
  1435. str r2,[sp,#8*4]
  1436. eor r2,r9,r10
  1437. add r11,r11,r0,ror#6 @ h+=Sigma1(e)
  1438. and r2,r2,r8
  1439. add r11,r11,r12 @ h+=K256[i]
  1440. eor r2,r2,r10 @ Ch(e,f,g)
  1441. eor r0,r4,r4,ror#11
  1442. add r11,r11,r2 @ h+=Ch(e,f,g)
  1443. #if 24==31
  1444. and r12,r12,#0xff
  1445. cmp r12,#0xf2 @ done?
  1446. #endif
  1447. #if 24<15
  1448. # if __ARM_ARCH__>=7
  1449. ldr r2,[r1],#4 @ prefetch
  1450. # else
  1451. ldrb r2,[r1,#3]
  1452. # endif
  1453. eor r12,r4,r5 @ a^b, b^c in next round
  1454. #else
  1455. ldr r2,[sp,#10*4] @ from future BODY_16_xx
  1456. eor r12,r4,r5 @ a^b, b^c in next round
  1457. ldr r1,[sp,#7*4] @ from future BODY_16_xx
  1458. #endif
  1459. eor r0,r0,r4,ror#20 @ Sigma0(a)
  1460. and r3,r3,r12 @ (b^c)&=(a^b)
  1461. add r7,r7,r11 @ d+=h
  1462. eor r3,r3,r5 @ Maj(a,b,c)
  1463. add r11,r11,r0,ror#2 @ h+=Sigma0(a)
  1464. @ add r11,r11,r3 @ h+=Maj(a,b,c)
  1465. @ ldr r2,[sp,#10*4] @ 25
  1466. @ ldr r1,[sp,#7*4]
  1467. mov r0,r2,ror#7
  1468. add r11,r11,r3 @ h+=Maj(a,b,c) from the past
  1469. mov r3,r1,ror#17
  1470. eor r0,r0,r2,ror#18
  1471. eor r3,r3,r1,ror#19
  1472. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1473. ldr r2,[sp,#9*4]
  1474. eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
  1475. ldr r1,[sp,#2*4]
  1476. add r3,r3,r0
  1477. eor r0,r7,r7,ror#5 @ from BODY_00_15
  1478. add r2,r2,r3
  1479. eor r0,r0,r7,ror#19 @ Sigma1(e)
  1480. add r2,r2,r1 @ X[i]
  1481. ldr r3,[r14],#4 @ *K256++
  1482. add r10,r10,r2 @ h+=X[i]
  1483. str r2,[sp,#9*4]
  1484. eor r2,r8,r9
  1485. add r10,r10,r0,ror#6 @ h+=Sigma1(e)
  1486. and r2,r2,r7
  1487. add r10,r10,r3 @ h+=K256[i]
  1488. eor r2,r2,r9 @ Ch(e,f,g)
  1489. eor r0,r11,r11,ror#11
  1490. add r10,r10,r2 @ h+=Ch(e,f,g)
  1491. #if 25==31
  1492. and r3,r3,#0xff
  1493. cmp r3,#0xf2 @ done?
  1494. #endif
  1495. #if 25<15
  1496. # if __ARM_ARCH__>=7
  1497. ldr r2,[r1],#4 @ prefetch
  1498. # else
  1499. ldrb r2,[r1,#3]
  1500. # endif
  1501. eor r3,r11,r4 @ a^b, b^c in next round
  1502. #else
  1503. ldr r2,[sp,#11*4] @ from future BODY_16_xx
  1504. eor r3,r11,r4 @ a^b, b^c in next round
  1505. ldr r1,[sp,#8*4] @ from future BODY_16_xx
  1506. #endif
  1507. eor r0,r0,r11,ror#20 @ Sigma0(a)
  1508. and r12,r12,r3 @ (b^c)&=(a^b)
  1509. add r6,r6,r10 @ d+=h
  1510. eor r12,r12,r4 @ Maj(a,b,c)
  1511. add r10,r10,r0,ror#2 @ h+=Sigma0(a)
  1512. @ add r10,r10,r12 @ h+=Maj(a,b,c)
  1513. @ ldr r2,[sp,#11*4] @ 26
  1514. @ ldr r1,[sp,#8*4]
  1515. mov r0,r2,ror#7
  1516. add r10,r10,r12 @ h+=Maj(a,b,c) from the past
  1517. mov r12,r1,ror#17
  1518. eor r0,r0,r2,ror#18
  1519. eor r12,r12,r1,ror#19
  1520. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1521. ldr r2,[sp,#10*4]
  1522. eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
  1523. ldr r1,[sp,#3*4]
  1524. add r12,r12,r0
  1525. eor r0,r6,r6,ror#5 @ from BODY_00_15
  1526. add r2,r2,r12
  1527. eor r0,r0,r6,ror#19 @ Sigma1(e)
  1528. add r2,r2,r1 @ X[i]
  1529. ldr r12,[r14],#4 @ *K256++
  1530. add r9,r9,r2 @ h+=X[i]
  1531. str r2,[sp,#10*4]
  1532. eor r2,r7,r8
  1533. add r9,r9,r0,ror#6 @ h+=Sigma1(e)
  1534. and r2,r2,r6
  1535. add r9,r9,r12 @ h+=K256[i]
  1536. eor r2,r2,r8 @ Ch(e,f,g)
  1537. eor r0,r10,r10,ror#11
  1538. add r9,r9,r2 @ h+=Ch(e,f,g)
  1539. #if 26==31
  1540. and r12,r12,#0xff
  1541. cmp r12,#0xf2 @ done?
  1542. #endif
  1543. #if 26<15
  1544. # if __ARM_ARCH__>=7
  1545. ldr r2,[r1],#4 @ prefetch
  1546. # else
  1547. ldrb r2,[r1,#3]
  1548. # endif
  1549. eor r12,r10,r11 @ a^b, b^c in next round
  1550. #else
  1551. ldr r2,[sp,#12*4] @ from future BODY_16_xx
  1552. eor r12,r10,r11 @ a^b, b^c in next round
  1553. ldr r1,[sp,#9*4] @ from future BODY_16_xx
  1554. #endif
  1555. eor r0,r0,r10,ror#20 @ Sigma0(a)
  1556. and r3,r3,r12 @ (b^c)&=(a^b)
  1557. add r5,r5,r9 @ d+=h
  1558. eor r3,r3,r11 @ Maj(a,b,c)
  1559. add r9,r9,r0,ror#2 @ h+=Sigma0(a)
  1560. @ add r9,r9,r3 @ h+=Maj(a,b,c)
  1561. @ ldr r2,[sp,#12*4] @ 27
  1562. @ ldr r1,[sp,#9*4]
  1563. mov r0,r2,ror#7
  1564. add r9,r9,r3 @ h+=Maj(a,b,c) from the past
  1565. mov r3,r1,ror#17
  1566. eor r0,r0,r2,ror#18
  1567. eor r3,r3,r1,ror#19
  1568. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1569. ldr r2,[sp,#11*4]
  1570. eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
  1571. ldr r1,[sp,#4*4]
  1572. add r3,r3,r0
  1573. eor r0,r5,r5,ror#5 @ from BODY_00_15
  1574. add r2,r2,r3
  1575. eor r0,r0,r5,ror#19 @ Sigma1(e)
  1576. add r2,r2,r1 @ X[i]
  1577. ldr r3,[r14],#4 @ *K256++
  1578. add r8,r8,r2 @ h+=X[i]
  1579. str r2,[sp,#11*4]
  1580. eor r2,r6,r7
  1581. add r8,r8,r0,ror#6 @ h+=Sigma1(e)
  1582. and r2,r2,r5
  1583. add r8,r8,r3 @ h+=K256[i]
  1584. eor r2,r2,r7 @ Ch(e,f,g)
  1585. eor r0,r9,r9,ror#11
  1586. add r8,r8,r2 @ h+=Ch(e,f,g)
  1587. #if 27==31
  1588. and r3,r3,#0xff
  1589. cmp r3,#0xf2 @ done?
  1590. #endif
  1591. #if 27<15
  1592. # if __ARM_ARCH__>=7
  1593. ldr r2,[r1],#4 @ prefetch
  1594. # else
  1595. ldrb r2,[r1,#3]
  1596. # endif
  1597. eor r3,r9,r10 @ a^b, b^c in next round
  1598. #else
  1599. ldr r2,[sp,#13*4] @ from future BODY_16_xx
  1600. eor r3,r9,r10 @ a^b, b^c in next round
  1601. ldr r1,[sp,#10*4] @ from future BODY_16_xx
  1602. #endif
  1603. eor r0,r0,r9,ror#20 @ Sigma0(a)
  1604. and r12,r12,r3 @ (b^c)&=(a^b)
  1605. add r4,r4,r8 @ d+=h
  1606. eor r12,r12,r10 @ Maj(a,b,c)
  1607. add r8,r8,r0,ror#2 @ h+=Sigma0(a)
  1608. @ add r8,r8,r12 @ h+=Maj(a,b,c)
  1609. @ ldr r2,[sp,#13*4] @ 28
  1610. @ ldr r1,[sp,#10*4]
  1611. mov r0,r2,ror#7
  1612. add r8,r8,r12 @ h+=Maj(a,b,c) from the past
  1613. mov r12,r1,ror#17
  1614. eor r0,r0,r2,ror#18
  1615. eor r12,r12,r1,ror#19
  1616. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1617. ldr r2,[sp,#12*4]
  1618. eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
  1619. ldr r1,[sp,#5*4]
  1620. add r12,r12,r0
  1621. eor r0,r4,r4,ror#5 @ from BODY_00_15
  1622. add r2,r2,r12
  1623. eor r0,r0,r4,ror#19 @ Sigma1(e)
  1624. add r2,r2,r1 @ X[i]
  1625. ldr r12,[r14],#4 @ *K256++
  1626. add r7,r7,r2 @ h+=X[i]
  1627. str r2,[sp,#12*4]
  1628. eor r2,r5,r6
  1629. add r7,r7,r0,ror#6 @ h+=Sigma1(e)
  1630. and r2,r2,r4
  1631. add r7,r7,r12 @ h+=K256[i]
  1632. eor r2,r2,r6 @ Ch(e,f,g)
  1633. eor r0,r8,r8,ror#11
  1634. add r7,r7,r2 @ h+=Ch(e,f,g)
  1635. #if 28==31
  1636. and r12,r12,#0xff
  1637. cmp r12,#0xf2 @ done?
  1638. #endif
  1639. #if 28<15
  1640. # if __ARM_ARCH__>=7
  1641. ldr r2,[r1],#4 @ prefetch
  1642. # else
  1643. ldrb r2,[r1,#3]
  1644. # endif
  1645. eor r12,r8,r9 @ a^b, b^c in next round
  1646. #else
  1647. ldr r2,[sp,#14*4] @ from future BODY_16_xx
  1648. eor r12,r8,r9 @ a^b, b^c in next round
  1649. ldr r1,[sp,#11*4] @ from future BODY_16_xx
  1650. #endif
  1651. eor r0,r0,r8,ror#20 @ Sigma0(a)
  1652. and r3,r3,r12 @ (b^c)&=(a^b)
  1653. add r11,r11,r7 @ d+=h
  1654. eor r3,r3,r9 @ Maj(a,b,c)
  1655. add r7,r7,r0,ror#2 @ h+=Sigma0(a)
  1656. @ add r7,r7,r3 @ h+=Maj(a,b,c)
  1657. @ ldr r2,[sp,#14*4] @ 29
  1658. @ ldr r1,[sp,#11*4]
  1659. mov r0,r2,ror#7
  1660. add r7,r7,r3 @ h+=Maj(a,b,c) from the past
  1661. mov r3,r1,ror#17
  1662. eor r0,r0,r2,ror#18
  1663. eor r3,r3,r1,ror#19
  1664. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1665. ldr r2,[sp,#13*4]
  1666. eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
  1667. ldr r1,[sp,#6*4]
  1668. add r3,r3,r0
  1669. eor r0,r11,r11,ror#5 @ from BODY_00_15
  1670. add r2,r2,r3
  1671. eor r0,r0,r11,ror#19 @ Sigma1(e)
  1672. add r2,r2,r1 @ X[i]
  1673. ldr r3,[r14],#4 @ *K256++
  1674. add r6,r6,r2 @ h+=X[i]
  1675. str r2,[sp,#13*4]
  1676. eor r2,r4,r5
  1677. add r6,r6,r0,ror#6 @ h+=Sigma1(e)
  1678. and r2,r2,r11
  1679. add r6,r6,r3 @ h+=K256[i]
  1680. eor r2,r2,r5 @ Ch(e,f,g)
  1681. eor r0,r7,r7,ror#11
  1682. add r6,r6,r2 @ h+=Ch(e,f,g)
  1683. #if 29==31
  1684. and r3,r3,#0xff
  1685. cmp r3,#0xf2 @ done?
  1686. #endif
  1687. #if 29<15
  1688. # if __ARM_ARCH__>=7
  1689. ldr r2,[r1],#4 @ prefetch
  1690. # else
  1691. ldrb r2,[r1,#3]
  1692. # endif
  1693. eor r3,r7,r8 @ a^b, b^c in next round
  1694. #else
  1695. ldr r2,[sp,#15*4] @ from future BODY_16_xx
  1696. eor r3,r7,r8 @ a^b, b^c in next round
  1697. ldr r1,[sp,#12*4] @ from future BODY_16_xx
  1698. #endif
  1699. eor r0,r0,r7,ror#20 @ Sigma0(a)
  1700. and r12,r12,r3 @ (b^c)&=(a^b)
  1701. add r10,r10,r6 @ d+=h
  1702. eor r12,r12,r8 @ Maj(a,b,c)
  1703. add r6,r6,r0,ror#2 @ h+=Sigma0(a)
  1704. @ add r6,r6,r12 @ h+=Maj(a,b,c)
  1705. @ ldr r2,[sp,#15*4] @ 30
  1706. @ ldr r1,[sp,#12*4]
  1707. mov r0,r2,ror#7
  1708. add r6,r6,r12 @ h+=Maj(a,b,c) from the past
  1709. mov r12,r1,ror#17
  1710. eor r0,r0,r2,ror#18
  1711. eor r12,r12,r1,ror#19
  1712. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1713. ldr r2,[sp,#14*4]
  1714. eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
  1715. ldr r1,[sp,#7*4]
  1716. add r12,r12,r0
  1717. eor r0,r10,r10,ror#5 @ from BODY_00_15
  1718. add r2,r2,r12
  1719. eor r0,r0,r10,ror#19 @ Sigma1(e)
  1720. add r2,r2,r1 @ X[i]
  1721. ldr r12,[r14],#4 @ *K256++
  1722. add r5,r5,r2 @ h+=X[i]
  1723. str r2,[sp,#14*4]
  1724. eor r2,r11,r4
  1725. add r5,r5,r0,ror#6 @ h+=Sigma1(e)
  1726. and r2,r2,r10
  1727. add r5,r5,r12 @ h+=K256[i]
  1728. eor r2,r2,r4 @ Ch(e,f,g)
  1729. eor r0,r6,r6,ror#11
  1730. add r5,r5,r2 @ h+=Ch(e,f,g)
  1731. #if 30==31
  1732. and r12,r12,#0xff
  1733. cmp r12,#0xf2 @ done?
  1734. #endif
  1735. #if 30<15
  1736. # if __ARM_ARCH__>=7
  1737. ldr r2,[r1],#4 @ prefetch
  1738. # else
  1739. ldrb r2,[r1,#3]
  1740. # endif
  1741. eor r12,r6,r7 @ a^b, b^c in next round
  1742. #else
  1743. ldr r2,[sp,#0*4] @ from future BODY_16_xx
  1744. eor r12,r6,r7 @ a^b, b^c in next round
  1745. ldr r1,[sp,#13*4] @ from future BODY_16_xx
  1746. #endif
  1747. eor r0,r0,r6,ror#20 @ Sigma0(a)
  1748. and r3,r3,r12 @ (b^c)&=(a^b)
  1749. add r9,r9,r5 @ d+=h
  1750. eor r3,r3,r7 @ Maj(a,b,c)
  1751. add r5,r5,r0,ror#2 @ h+=Sigma0(a)
  1752. @ add r5,r5,r3 @ h+=Maj(a,b,c)
  1753. @ ldr r2,[sp,#0*4] @ 31
  1754. @ ldr r1,[sp,#13*4]
  1755. mov r0,r2,ror#7
  1756. add r5,r5,r3 @ h+=Maj(a,b,c) from the past
  1757. mov r3,r1,ror#17
  1758. eor r0,r0,r2,ror#18
  1759. eor r3,r3,r1,ror#19
  1760. eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
  1761. ldr r2,[sp,#15*4]
  1762. eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
  1763. ldr r1,[sp,#8*4]
  1764. add r3,r3,r0
  1765. eor r0,r9,r9,ror#5 @ from BODY_00_15
  1766. add r2,r2,r3
  1767. eor r0,r0,r9,ror#19 @ Sigma1(e)
  1768. add r2,r2,r1 @ X[i]
  1769. ldr r3,[r14],#4 @ *K256++
  1770. add r4,r4,r2 @ h+=X[i]
  1771. str r2,[sp,#15*4]
  1772. eor r2,r10,r11
  1773. add r4,r4,r0,ror#6 @ h+=Sigma1(e)
  1774. and r2,r2,r9
  1775. add r4,r4,r3 @ h+=K256[i]
  1776. eor r2,r2,r11 @ Ch(e,f,g)
  1777. eor r0,r5,r5,ror#11
  1778. add r4,r4,r2 @ h+=Ch(e,f,g)
  1779. #if 31==31
  1780. and r3,r3,#0xff
  1781. cmp r3,#0xf2 @ done?
  1782. #endif
  1783. #if 31<15
  1784. # if __ARM_ARCH__>=7
  1785. ldr r2,[r1],#4 @ prefetch
  1786. # else
  1787. ldrb r2,[r1,#3]
  1788. # endif
  1789. eor r3,r5,r6 @ a^b, b^c in next round
  1790. #else
  1791. ldr r2,[sp,#1*4] @ from future BODY_16_xx
  1792. eor r3,r5,r6 @ a^b, b^c in next round
  1793. ldr r1,[sp,#14*4] @ from future BODY_16_xx
  1794. #endif
  1795. eor r0,r0,r5,ror#20 @ Sigma0(a)
  1796. and r12,r12,r3 @ (b^c)&=(a^b)
  1797. add r8,r8,r4 @ d+=h
  1798. eor r12,r12,r6 @ Maj(a,b,c)
  1799. add r4,r4,r0,ror#2 @ h+=Sigma0(a)
  1800. @ add r4,r4,r12 @ h+=Maj(a,b,c)
  1801. #if __ARM_ARCH__>=7
  1802. ite eq @ Thumb2 thing, sanity check in ARM
  1803. #endif
  1804. ldreq r3,[sp,#16*4] @ pull ctx
  1805. bne .Lrounds_16_xx
  1806. add r4,r4,r12 @ h+=Maj(a,b,c) from the past
  1807. ldr r0,[r3,#0]
  1808. ldr r2,[r3,#4]
  1809. ldr r12,[r3,#8]
  1810. add r4,r4,r0
  1811. ldr r0,[r3,#12]
  1812. add r5,r5,r2
  1813. ldr r2,[r3,#16]
  1814. add r6,r6,r12
  1815. ldr r12,[r3,#20]
  1816. add r7,r7,r0
  1817. ldr r0,[r3,#24]
  1818. add r8,r8,r2
  1819. ldr r2,[r3,#28]
  1820. add r9,r9,r12
  1821. ldr r1,[sp,#17*4] @ pull inp
  1822. ldr r12,[sp,#18*4] @ pull inp+len
  1823. add r10,r10,r0
  1824. add r11,r11,r2
  1825. stmia r3,{r4,r5,r6,r7,r8,r9,r10,r11}
  1826. cmp r1,r12
  1827. sub r14,r14,#256 @ rewind Ktbl
  1828. bne .Loop
  1829. add sp,sp,#19*4 @ destroy frame
  1830. #if __ARM_ARCH__>=5
  1831. ldmia sp!,{r4-r11,pc}
  1832. #else
  1833. ldmia sp!,{r4-r11,lr}
  1834. tst lr,#1
  1835. moveq pc,lr @ be binary compatible with V4, yet
  1836. .word 0xe12fff1e @ interoperable with Thumb ISA:-)
  1837. #endif
  1838. .size sha256_block_data_order,.-sha256_block_data_order
  1839. #if __ARM_MAX_ARCH__>=7
  1840. .arch armv7-a
  1841. .fpu neon
  1842. .global sha256_block_data_order_neon
  1843. .type sha256_block_data_order_neon,%function
  1844. .align 4
  1845. sha256_block_data_order_neon:
  1846. .LNEON:
  1847. stmdb sp!,{r4-r12,lr}
  1848. sub r11,sp,#16*4+16
  1849. adrl r14,K256
  1850. bic r11,r11,#15 @ align for 128-bit stores
  1851. mov r12,sp
  1852. mov sp,r11 @ alloca
  1853. add r2,r1,r2,lsl#6 @ len to point at the end of inp
  1854. vld1.8 {q0},[r1]!
  1855. vld1.8 {q1},[r1]!
  1856. vld1.8 {q2},[r1]!
  1857. vld1.8 {q3},[r1]!
  1858. vld1.32 {q8},[r14,:128]!
  1859. vld1.32 {q9},[r14,:128]!
  1860. vld1.32 {q10},[r14,:128]!
  1861. vld1.32 {q11},[r14,:128]!
  1862. vrev32.8 q0,q0 @ yes, even on
  1863. str r0,[sp,#64]
  1864. vrev32.8 q1,q1 @ big-endian
  1865. str r1,[sp,#68]
  1866. mov r1,sp
  1867. vrev32.8 q2,q2
  1868. str r2,[sp,#72]
  1869. vrev32.8 q3,q3
  1870. str r12,[sp,#76] @ save original sp
  1871. vadd.i32 q8,q8,q0
  1872. vadd.i32 q9,q9,q1
  1873. vst1.32 {q8},[r1,:128]!
  1874. vadd.i32 q10,q10,q2
  1875. vst1.32 {q9},[r1,:128]!
  1876. vadd.i32 q11,q11,q3
  1877. vst1.32 {q10},[r1,:128]!
  1878. vst1.32 {q11},[r1,:128]!
  1879. ldmia r0,{r4-r11}
  1880. sub r1,r1,#64
  1881. ldr r2,[sp,#0]
  1882. eor r12,r12,r12
  1883. eor r3,r5,r6
  1884. b .L_00_48
  1885. .align 4
  1886. .L_00_48:
  1887. vext.8 q8,q0,q1,#4
  1888. add r11,r11,r2
  1889. eor r2,r9,r10
  1890. eor r0,r8,r8,ror#5
  1891. vext.8 q9,q2,q3,#4
  1892. add r4,r4,r12
  1893. and r2,r2,r8
  1894. eor r12,r0,r8,ror#19
  1895. vshr.u32 q10,q8,#7
  1896. eor r0,r4,r4,ror#11
  1897. eor r2,r2,r10
  1898. vadd.i32 q0,q0,q9
  1899. add r11,r11,r12,ror#6
  1900. eor r12,r4,r5
  1901. vshr.u32 q9,q8,#3
  1902. eor r0,r0,r4,ror#20
  1903. add r11,r11,r2
  1904. vsli.32 q10,q8,#25
  1905. ldr r2,[sp,#4]
  1906. and r3,r3,r12
  1907. vshr.u32 q11,q8,#18
  1908. add r7,r7,r11
  1909. add r11,r11,r0,ror#2
  1910. eor r3,r3,r5
  1911. veor q9,q9,q10
  1912. add r10,r10,r2
  1913. vsli.32 q11,q8,#14
  1914. eor r2,r8,r9
  1915. eor r0,r7,r7,ror#5
  1916. vshr.u32 d24,d7,#17
  1917. add r11,r11,r3
  1918. and r2,r2,r7
  1919. veor q9,q9,q11
  1920. eor r3,r0,r7,ror#19
  1921. eor r0,r11,r11,ror#11
  1922. vsli.32 d24,d7,#15
  1923. eor r2,r2,r9
  1924. add r10,r10,r3,ror#6
  1925. vshr.u32 d25,d7,#10
  1926. eor r3,r11,r4
  1927. eor r0,r0,r11,ror#20
  1928. vadd.i32 q0,q0,q9
  1929. add r10,r10,r2
  1930. ldr r2,[sp,#8]
  1931. veor d25,d25,d24
  1932. and r12,r12,r3
  1933. add r6,r6,r10
  1934. vshr.u32 d24,d7,#19
  1935. add r10,r10,r0,ror#2
  1936. eor r12,r12,r4
  1937. vsli.32 d24,d7,#13
  1938. add r9,r9,r2
  1939. eor r2,r7,r8
  1940. veor d25,d25,d24
  1941. eor r0,r6,r6,ror#5
  1942. add r10,r10,r12
  1943. vadd.i32 d0,d0,d25
  1944. and r2,r2,r6
  1945. eor r12,r0,r6,ror#19
  1946. vshr.u32 d24,d0,#17
  1947. eor r0,r10,r10,ror#11
  1948. eor r2,r2,r8
  1949. vsli.32 d24,d0,#15
  1950. add r9,r9,r12,ror#6
  1951. eor r12,r10,r11
  1952. vshr.u32 d25,d0,#10
  1953. eor r0,r0,r10,ror#20
  1954. add r9,r9,r2
  1955. veor d25,d25,d24
  1956. ldr r2,[sp,#12]
  1957. and r3,r3,r12
  1958. vshr.u32 d24,d0,#19
  1959. add r5,r5,r9
  1960. add r9,r9,r0,ror#2
  1961. eor r3,r3,r11
  1962. vld1.32 {q8},[r14,:128]!
  1963. add r8,r8,r2
  1964. vsli.32 d24,d0,#13
  1965. eor r2,r6,r7
  1966. eor r0,r5,r5,ror#5
  1967. veor d25,d25,d24
  1968. add r9,r9,r3
  1969. and r2,r2,r5
  1970. vadd.i32 d1,d1,d25
  1971. eor r3,r0,r5,ror#19
  1972. eor r0,r9,r9,ror#11
  1973. vadd.i32 q8,q8,q0
  1974. eor r2,r2,r7
  1975. add r8,r8,r3,ror#6
  1976. eor r3,r9,r10
  1977. eor r0,r0,r9,ror#20
  1978. add r8,r8,r2
  1979. ldr r2,[sp,#16]
  1980. and r12,r12,r3
  1981. add r4,r4,r8
  1982. vst1.32 {q8},[r1,:128]!
  1983. add r8,r8,r0,ror#2
  1984. eor r12,r12,r10
  1985. vext.8 q8,q1,q2,#4
  1986. add r7,r7,r2
  1987. eor r2,r5,r6
  1988. eor r0,r4,r4,ror#5
  1989. vext.8 q9,q3,q0,#4
  1990. add r8,r8,r12
  1991. and r2,r2,r4
  1992. eor r12,r0,r4,ror#19
  1993. vshr.u32 q10,q8,#7
  1994. eor r0,r8,r8,ror#11
  1995. eor r2,r2,r6
  1996. vadd.i32 q1,q1,q9
  1997. add r7,r7,r12,ror#6
  1998. eor r12,r8,r9
  1999. vshr.u32 q9,q8,#3
  2000. eor r0,r0,r8,ror#20
  2001. add r7,r7,r2
  2002. vsli.32 q10,q8,#25
  2003. ldr r2,[sp,#20]
  2004. and r3,r3,r12
  2005. vshr.u32 q11,q8,#18
  2006. add r11,r11,r7
  2007. add r7,r7,r0,ror#2
  2008. eor r3,r3,r9
  2009. veor q9,q9,q10
  2010. add r6,r6,r2
  2011. vsli.32 q11,q8,#14
  2012. eor r2,r4,r5
  2013. eor r0,r11,r11,ror#5
  2014. vshr.u32 d24,d1,#17
  2015. add r7,r7,r3
  2016. and r2,r2,r11
  2017. veor q9,q9,q11
  2018. eor r3,r0,r11,ror#19
  2019. eor r0,r7,r7,ror#11
  2020. vsli.32 d24,d1,#15
  2021. eor r2,r2,r5
  2022. add r6,r6,r3,ror#6
  2023. vshr.u32 d25,d1,#10
  2024. eor r3,r7,r8
  2025. eor r0,r0,r7,ror#20
  2026. vadd.i32 q1,q1,q9
  2027. add r6,r6,r2
  2028. ldr r2,[sp,#24]
  2029. veor d25,d25,d24
  2030. and r12,r12,r3
  2031. add r10,r10,r6
  2032. vshr.u32 d24,d1,#19
  2033. add r6,r6,r0,ror#2
  2034. eor r12,r12,r8
  2035. vsli.32 d24,d1,#13
  2036. add r5,r5,r2
  2037. eor r2,r11,r4
  2038. veor d25,d25,d24
  2039. eor r0,r10,r10,ror#5
  2040. add r6,r6,r12
  2041. vadd.i32 d2,d2,d25
  2042. and r2,r2,r10
  2043. eor r12,r0,r10,ror#19
  2044. vshr.u32 d24,d2,#17
  2045. eor r0,r6,r6,ror#11
  2046. eor r2,r2,r4
  2047. vsli.32 d24,d2,#15
  2048. add r5,r5,r12,ror#6
  2049. eor r12,r6,r7
  2050. vshr.u32 d25,d2,#10
  2051. eor r0,r0,r6,ror#20
  2052. add r5,r5,r2
  2053. veor d25,d25,d24
  2054. ldr r2,[sp,#28]
  2055. and r3,r3,r12
  2056. vshr.u32 d24,d2,#19
  2057. add r9,r9,r5
  2058. add r5,r5,r0,ror#2
  2059. eor r3,r3,r7
  2060. vld1.32 {q8},[r14,:128]!
  2061. add r4,r4,r2
  2062. vsli.32 d24,d2,#13
  2063. eor r2,r10,r11
  2064. eor r0,r9,r9,ror#5
  2065. veor d25,d25,d24
  2066. add r5,r5,r3
  2067. and r2,r2,r9
  2068. vadd.i32 d3,d3,d25
  2069. eor r3,r0,r9,ror#19
  2070. eor r0,r5,r5,ror#11
  2071. vadd.i32 q8,q8,q1
  2072. eor r2,r2,r11
  2073. add r4,r4,r3,ror#6
  2074. eor r3,r5,r6
  2075. eor r0,r0,r5,ror#20
  2076. add r4,r4,r2
  2077. ldr r2,[sp,#32]
  2078. and r12,r12,r3
  2079. add r8,r8,r4
  2080. vst1.32 {q8},[r1,:128]!
  2081. add r4,r4,r0,ror#2
  2082. eor r12,r12,r6
  2083. vext.8 q8,q2,q3,#4
  2084. add r11,r11,r2
  2085. eor r2,r9,r10
  2086. eor r0,r8,r8,ror#5
  2087. vext.8 q9,q0,q1,#4
  2088. add r4,r4,r12
  2089. and r2,r2,r8
  2090. eor r12,r0,r8,ror#19
  2091. vshr.u32 q10,q8,#7
  2092. eor r0,r4,r4,ror#11
  2093. eor r2,r2,r10
  2094. vadd.i32 q2,q2,q9
  2095. add r11,r11,r12,ror#6
  2096. eor r12,r4,r5
  2097. vshr.u32 q9,q8,#3
  2098. eor r0,r0,r4,ror#20
  2099. add r11,r11,r2
  2100. vsli.32 q10,q8,#25
  2101. ldr r2,[sp,#36]
  2102. and r3,r3,r12
  2103. vshr.u32 q11,q8,#18
  2104. add r7,r7,r11
  2105. add r11,r11,r0,ror#2
  2106. eor r3,r3,r5
  2107. veor q9,q9,q10
  2108. add r10,r10,r2
  2109. vsli.32 q11,q8,#14
  2110. eor r2,r8,r9
  2111. eor r0,r7,r7,ror#5
  2112. vshr.u32 d24,d3,#17
  2113. add r11,r11,r3
  2114. and r2,r2,r7
  2115. veor q9,q9,q11
  2116. eor r3,r0,r7,ror#19
  2117. eor r0,r11,r11,ror#11
  2118. vsli.32 d24,d3,#15
  2119. eor r2,r2,r9
  2120. add r10,r10,r3,ror#6
  2121. vshr.u32 d25,d3,#10
  2122. eor r3,r11,r4
  2123. eor r0,r0,r11,ror#20
  2124. vadd.i32 q2,q2,q9
  2125. add r10,r10,r2
  2126. ldr r2,[sp,#40]
  2127. veor d25,d25,d24
  2128. and r12,r12,r3
  2129. add r6,r6,r10
  2130. vshr.u32 d24,d3,#19
  2131. add r10,r10,r0,ror#2
  2132. eor r12,r12,r4
  2133. vsli.32 d24,d3,#13
  2134. add r9,r9,r2
  2135. eor r2,r7,r8
  2136. veor d25,d25,d24
  2137. eor r0,r6,r6,ror#5
  2138. add r10,r10,r12
  2139. vadd.i32 d4,d4,d25
  2140. and r2,r2,r6
  2141. eor r12,r0,r6,ror#19
  2142. vshr.u32 d24,d4,#17
  2143. eor r0,r10,r10,ror#11
  2144. eor r2,r2,r8
  2145. vsli.32 d24,d4,#15
  2146. add r9,r9,r12,ror#6
  2147. eor r12,r10,r11
  2148. vshr.u32 d25,d4,#10
  2149. eor r0,r0,r10,ror#20
  2150. add r9,r9,r2
  2151. veor d25,d25,d24
  2152. ldr r2,[sp,#44]
  2153. and r3,r3,r12
  2154. vshr.u32 d24,d4,#19
  2155. add r5,r5,r9
  2156. add r9,r9,r0,ror#2
  2157. eor r3,r3,r11
  2158. vld1.32 {q8},[r14,:128]!
  2159. add r8,r8,r2
  2160. vsli.32 d24,d4,#13
  2161. eor r2,r6,r7
  2162. eor r0,r5,r5,ror#5
  2163. veor d25,d25,d24
  2164. add r9,r9,r3
  2165. and r2,r2,r5
  2166. vadd.i32 d5,d5,d25
  2167. eor r3,r0,r5,ror#19
  2168. eor r0,r9,r9,ror#11
  2169. vadd.i32 q8,q8,q2
  2170. eor r2,r2,r7
  2171. add r8,r8,r3,ror#6
  2172. eor r3,r9,r10
  2173. eor r0,r0,r9,ror#20
  2174. add r8,r8,r2
  2175. ldr r2,[sp,#48]
  2176. and r12,r12,r3
  2177. add r4,r4,r8
  2178. vst1.32 {q8},[r1,:128]!
  2179. add r8,r8,r0,ror#2
  2180. eor r12,r12,r10
  2181. vext.8 q8,q3,q0,#4
  2182. add r7,r7,r2
  2183. eor r2,r5,r6
  2184. eor r0,r4,r4,ror#5
  2185. vext.8 q9,q1,q2,#4
  2186. add r8,r8,r12
  2187. and r2,r2,r4
  2188. eor r12,r0,r4,ror#19
  2189. vshr.u32 q10,q8,#7
  2190. eor r0,r8,r8,ror#11
  2191. eor r2,r2,r6
  2192. vadd.i32 q3,q3,q9
  2193. add r7,r7,r12,ror#6
  2194. eor r12,r8,r9
  2195. vshr.u32 q9,q8,#3
  2196. eor r0,r0,r8,ror#20
  2197. add r7,r7,r2
  2198. vsli.32 q10,q8,#25
  2199. ldr r2,[sp,#52]
  2200. and r3,r3,r12
  2201. vshr.u32 q11,q8,#18
  2202. add r11,r11,r7
  2203. add r7,r7,r0,ror#2
  2204. eor r3,r3,r9
  2205. veor q9,q9,q10
  2206. add r6,r6,r2
  2207. vsli.32 q11,q8,#14
  2208. eor r2,r4,r5
  2209. eor r0,r11,r11,ror#5
  2210. vshr.u32 d24,d5,#17
  2211. add r7,r7,r3
  2212. and r2,r2,r11
  2213. veor q9,q9,q11
  2214. eor r3,r0,r11,ror#19
  2215. eor r0,r7,r7,ror#11
  2216. vsli.32 d24,d5,#15
  2217. eor r2,r2,r5
  2218. add r6,r6,r3,ror#6
  2219. vshr.u32 d25,d5,#10
  2220. eor r3,r7,r8
  2221. eor r0,r0,r7,ror#20
  2222. vadd.i32 q3,q3,q9
  2223. add r6,r6,r2
  2224. ldr r2,[sp,#56]
  2225. veor d25,d25,d24
  2226. and r12,r12,r3
  2227. add r10,r10,r6
  2228. vshr.u32 d24,d5,#19
  2229. add r6,r6,r0,ror#2
  2230. eor r12,r12,r8
  2231. vsli.32 d24,d5,#13
  2232. add r5,r5,r2
  2233. eor r2,r11,r4
  2234. veor d25,d25,d24
  2235. eor r0,r10,r10,ror#5
  2236. add r6,r6,r12
  2237. vadd.i32 d6,d6,d25
  2238. and r2,r2,r10
  2239. eor r12,r0,r10,ror#19
  2240. vshr.u32 d24,d6,#17
  2241. eor r0,r6,r6,ror#11
  2242. eor r2,r2,r4
  2243. vsli.32 d24,d6,#15
  2244. add r5,r5,r12,ror#6
  2245. eor r12,r6,r7
  2246. vshr.u32 d25,d6,#10
  2247. eor r0,r0,r6,ror#20
  2248. add r5,r5,r2
  2249. veor d25,d25,d24
  2250. ldr r2,[sp,#60]
  2251. and r3,r3,r12
  2252. vshr.u32 d24,d6,#19
  2253. add r9,r9,r5
  2254. add r5,r5,r0,ror#2
  2255. eor r3,r3,r7
  2256. vld1.32 {q8},[r14,:128]!
  2257. add r4,r4,r2
  2258. vsli.32 d24,d6,#13
  2259. eor r2,r10,r11
  2260. eor r0,r9,r9,ror#5
  2261. veor d25,d25,d24
  2262. add r5,r5,r3
  2263. and r2,r2,r9
  2264. vadd.i32 d7,d7,d25
  2265. eor r3,r0,r9,ror#19
  2266. eor r0,r5,r5,ror#11
  2267. vadd.i32 q8,q8,q3
  2268. eor r2,r2,r11
  2269. add r4,r4,r3,ror#6
  2270. eor r3,r5,r6
  2271. eor r0,r0,r5,ror#20
  2272. add r4,r4,r2
  2273. ldr r2,[r14]
  2274. and r12,r12,r3
  2275. add r8,r8,r4
  2276. vst1.32 {q8},[r1,:128]!
  2277. add r4,r4,r0,ror#2
  2278. eor r12,r12,r6
  2279. teq r2,#0 @ check for K256 terminator
  2280. ldr r2,[sp,#0]
  2281. sub r1,r1,#64
  2282. bne .L_00_48
  2283. ldr r1,[sp,#68]
  2284. ldr r0,[sp,#72]
  2285. sub r14,r14,#256 @ rewind r14
  2286. teq r1,r0
  2287. it eq
  2288. subeq r1,r1,#64 @ avoid SEGV
  2289. vld1.8 {q0},[r1]! @ load next input block
  2290. vld1.8 {q1},[r1]!
  2291. vld1.8 {q2},[r1]!
  2292. vld1.8 {q3},[r1]!
  2293. it ne
  2294. strne r1,[sp,#68]
  2295. mov r1,sp
  2296. add r11,r11,r2
  2297. eor r2,r9,r10
  2298. eor r0,r8,r8,ror#5
  2299. add r4,r4,r12
  2300. vld1.32 {q8},[r14,:128]!
  2301. and r2,r2,r8
  2302. eor r12,r0,r8,ror#19
  2303. eor r0,r4,r4,ror#11
  2304. eor r2,r2,r10
  2305. vrev32.8 q0,q0
  2306. add r11,r11,r12,ror#6
  2307. eor r12,r4,r5
  2308. eor r0,r0,r4,ror#20
  2309. add r11,r11,r2
  2310. vadd.i32 q8,q8,q0
  2311. ldr r2,[sp,#4]
  2312. and r3,r3,r12
  2313. add r7,r7,r11
  2314. add r11,r11,r0,ror#2
  2315. eor r3,r3,r5
  2316. add r10,r10,r2
  2317. eor r2,r8,r9
  2318. eor r0,r7,r7,ror#5
  2319. add r11,r11,r3
  2320. and r2,r2,r7
  2321. eor r3,r0,r7,ror#19
  2322. eor r0,r11,r11,ror#11
  2323. eor r2,r2,r9
  2324. add r10,r10,r3,ror#6
  2325. eor r3,r11,r4
  2326. eor r0,r0,r11,ror#20
  2327. add r10,r10,r2
  2328. ldr r2,[sp,#8]
  2329. and r12,r12,r3
  2330. add r6,r6,r10
  2331. add r10,r10,r0,ror#2
  2332. eor r12,r12,r4
  2333. add r9,r9,r2
  2334. eor r2,r7,r8
  2335. eor r0,r6,r6,ror#5
  2336. add r10,r10,r12
  2337. and r2,r2,r6
  2338. eor r12,r0,r6,ror#19
  2339. eor r0,r10,r10,ror#11
  2340. eor r2,r2,r8
  2341. add r9,r9,r12,ror#6
  2342. eor r12,r10,r11
  2343. eor r0,r0,r10,ror#20
  2344. add r9,r9,r2
  2345. ldr r2,[sp,#12]
  2346. and r3,r3,r12
  2347. add r5,r5,r9
  2348. add r9,r9,r0,ror#2
  2349. eor r3,r3,r11
  2350. add r8,r8,r2
  2351. eor r2,r6,r7
  2352. eor r0,r5,r5,ror#5
  2353. add r9,r9,r3
  2354. and r2,r2,r5
  2355. eor r3,r0,r5,ror#19
  2356. eor r0,r9,r9,ror#11
  2357. eor r2,r2,r7
  2358. add r8,r8,r3,ror#6
  2359. eor r3,r9,r10
  2360. eor r0,r0,r9,ror#20
  2361. add r8,r8,r2
  2362. ldr r2,[sp,#16]
  2363. and r12,r12,r3
  2364. add r4,r4,r8
  2365. add r8,r8,r0,ror#2
  2366. eor r12,r12,r10
  2367. vst1.32 {q8},[r1,:128]!
  2368. add r7,r7,r2
  2369. eor r2,r5,r6
  2370. eor r0,r4,r4,ror#5
  2371. add r8,r8,r12
  2372. vld1.32 {q8},[r14,:128]!
  2373. and r2,r2,r4
  2374. eor r12,r0,r4,ror#19
  2375. eor r0,r8,r8,ror#11
  2376. eor r2,r2,r6
  2377. vrev32.8 q1,q1
  2378. add r7,r7,r12,ror#6
  2379. eor r12,r8,r9
  2380. eor r0,r0,r8,ror#20
  2381. add r7,r7,r2
  2382. vadd.i32 q8,q8,q1
  2383. ldr r2,[sp,#20]
  2384. and r3,r3,r12
  2385. add r11,r11,r7
  2386. add r7,r7,r0,ror#2
  2387. eor r3,r3,r9
  2388. add r6,r6,r2
  2389. eor r2,r4,r5
  2390. eor r0,r11,r11,ror#5
  2391. add r7,r7,r3
  2392. and r2,r2,r11
  2393. eor r3,r0,r11,ror#19
  2394. eor r0,r7,r7,ror#11
  2395. eor r2,r2,r5
  2396. add r6,r6,r3,ror#6
  2397. eor r3,r7,r8
  2398. eor r0,r0,r7,ror#20
  2399. add r6,r6,r2
  2400. ldr r2,[sp,#24]
  2401. and r12,r12,r3
  2402. add r10,r10,r6
  2403. add r6,r6,r0,ror#2
  2404. eor r12,r12,r8
  2405. add r5,r5,r2
  2406. eor r2,r11,r4
  2407. eor r0,r10,r10,ror#5
  2408. add r6,r6,r12
  2409. and r2,r2,r10
  2410. eor r12,r0,r10,ror#19
  2411. eor r0,r6,r6,ror#11
  2412. eor r2,r2,r4
  2413. add r5,r5,r12,ror#6
  2414. eor r12,r6,r7
  2415. eor r0,r0,r6,ror#20
  2416. add r5,r5,r2
  2417. ldr r2,[sp,#28]
  2418. and r3,r3,r12
  2419. add r9,r9,r5
  2420. add r5,r5,r0,ror#2
  2421. eor r3,r3,r7
  2422. add r4,r4,r2
  2423. eor r2,r10,r11
  2424. eor r0,r9,r9,ror#5
  2425. add r5,r5,r3
  2426. and r2,r2,r9
  2427. eor r3,r0,r9,ror#19
  2428. eor r0,r5,r5,ror#11
  2429. eor r2,r2,r11
  2430. add r4,r4,r3,ror#6
  2431. eor r3,r5,r6
  2432. eor r0,r0,r5,ror#20
  2433. add r4,r4,r2
  2434. ldr r2,[sp,#32]
  2435. and r12,r12,r3
  2436. add r8,r8,r4
  2437. add r4,r4,r0,ror#2
  2438. eor r12,r12,r6
  2439. vst1.32 {q8},[r1,:128]!
  2440. add r11,r11,r2
  2441. eor r2,r9,r10
  2442. eor r0,r8,r8,ror#5
  2443. add r4,r4,r12
  2444. vld1.32 {q8},[r14,:128]!
  2445. and r2,r2,r8
  2446. eor r12,r0,r8,ror#19
  2447. eor r0,r4,r4,ror#11
  2448. eor r2,r2,r10
  2449. vrev32.8 q2,q2
  2450. add r11,r11,r12,ror#6
  2451. eor r12,r4,r5
  2452. eor r0,r0,r4,ror#20
  2453. add r11,r11,r2
  2454. vadd.i32 q8,q8,q2
  2455. ldr r2,[sp,#36]
  2456. and r3,r3,r12
  2457. add r7,r7,r11
  2458. add r11,r11,r0,ror#2
  2459. eor r3,r3,r5
  2460. add r10,r10,r2
  2461. eor r2,r8,r9
  2462. eor r0,r7,r7,ror#5
  2463. add r11,r11,r3
  2464. and r2,r2,r7
  2465. eor r3,r0,r7,ror#19
  2466. eor r0,r11,r11,ror#11
  2467. eor r2,r2,r9
  2468. add r10,r10,r3,ror#6
  2469. eor r3,r11,r4
  2470. eor r0,r0,r11,ror#20
  2471. add r10,r10,r2
  2472. ldr r2,[sp,#40]
  2473. and r12,r12,r3
  2474. add r6,r6,r10
  2475. add r10,r10,r0,ror#2
  2476. eor r12,r12,r4
  2477. add r9,r9,r2
  2478. eor r2,r7,r8
  2479. eor r0,r6,r6,ror#5
  2480. add r10,r10,r12
  2481. and r2,r2,r6
  2482. eor r12,r0,r6,ror#19
  2483. eor r0,r10,r10,ror#11
  2484. eor r2,r2,r8
  2485. add r9,r9,r12,ror#6
  2486. eor r12,r10,r11
  2487. eor r0,r0,r10,ror#20
  2488. add r9,r9,r2
  2489. ldr r2,[sp,#44]
  2490. and r3,r3,r12
  2491. add r5,r5,r9
  2492. add r9,r9,r0,ror#2
  2493. eor r3,r3,r11
  2494. add r8,r8,r2
  2495. eor r2,r6,r7
  2496. eor r0,r5,r5,ror#5
  2497. add r9,r9,r3
  2498. and r2,r2,r5
  2499. eor r3,r0,r5,ror#19
  2500. eor r0,r9,r9,ror#11
  2501. eor r2,r2,r7
  2502. add r8,r8,r3,ror#6
  2503. eor r3,r9,r10
  2504. eor r0,r0,r9,ror#20
  2505. add r8,r8,r2
  2506. ldr r2,[sp,#48]
  2507. and r12,r12,r3
  2508. add r4,r4,r8
  2509. add r8,r8,r0,ror#2
  2510. eor r12,r12,r10
  2511. vst1.32 {q8},[r1,:128]!
  2512. add r7,r7,r2
  2513. eor r2,r5,r6
  2514. eor r0,r4,r4,ror#5
  2515. add r8,r8,r12
  2516. vld1.32 {q8},[r14,:128]!
  2517. and r2,r2,r4
  2518. eor r12,r0,r4,ror#19
  2519. eor r0,r8,r8,ror#11
  2520. eor r2,r2,r6
  2521. vrev32.8 q3,q3
  2522. add r7,r7,r12,ror#6
  2523. eor r12,r8,r9
  2524. eor r0,r0,r8,ror#20
  2525. add r7,r7,r2
  2526. vadd.i32 q8,q8,q3
  2527. ldr r2,[sp,#52]
  2528. and r3,r3,r12
  2529. add r11,r11,r7
  2530. add r7,r7,r0,ror#2
  2531. eor r3,r3,r9
  2532. add r6,r6,r2
  2533. eor r2,r4,r5
  2534. eor r0,r11,r11,ror#5
  2535. add r7,r7,r3
  2536. and r2,r2,r11
  2537. eor r3,r0,r11,ror#19
  2538. eor r0,r7,r7,ror#11
  2539. eor r2,r2,r5
  2540. add r6,r6,r3,ror#6
  2541. eor r3,r7,r8
  2542. eor r0,r0,r7,ror#20
  2543. add r6,r6,r2
  2544. ldr r2,[sp,#56]
  2545. and r12,r12,r3
  2546. add r10,r10,r6
  2547. add r6,r6,r0,ror#2
  2548. eor r12,r12,r8
  2549. add r5,r5,r2
  2550. eor r2,r11,r4
  2551. eor r0,r10,r10,ror#5
  2552. add r6,r6,r12
  2553. and r2,r2,r10
  2554. eor r12,r0,r10,ror#19
  2555. eor r0,r6,r6,ror#11
  2556. eor r2,r2,r4
  2557. add r5,r5,r12,ror#6
  2558. eor r12,r6,r7
  2559. eor r0,r0,r6,ror#20
  2560. add r5,r5,r2
  2561. ldr r2,[sp,#60]
  2562. and r3,r3,r12
  2563. add r9,r9,r5
  2564. add r5,r5,r0,ror#2
  2565. eor r3,r3,r7
  2566. add r4,r4,r2
  2567. eor r2,r10,r11
  2568. eor r0,r9,r9,ror#5
  2569. add r5,r5,r3
  2570. and r2,r2,r9
  2571. eor r3,r0,r9,ror#19
  2572. eor r0,r5,r5,ror#11
  2573. eor r2,r2,r11
  2574. add r4,r4,r3,ror#6
  2575. eor r3,r5,r6
  2576. eor r0,r0,r5,ror#20
  2577. add r4,r4,r2
  2578. ldr r2,[sp,#64]
  2579. and r12,r12,r3
  2580. add r8,r8,r4
  2581. add r4,r4,r0,ror#2
  2582. eor r12,r12,r6
  2583. vst1.32 {q8},[r1,:128]!
  2584. ldr r0,[r2,#0]
  2585. add r4,r4,r12 @ h+=Maj(a,b,c) from the past
  2586. ldr r12,[r2,#4]
  2587. ldr r3,[r2,#8]
  2588. ldr r1,[r2,#12]
  2589. add r4,r4,r0 @ accumulate
  2590. ldr r0,[r2,#16]
  2591. add r5,r5,r12
  2592. ldr r12,[r2,#20]
  2593. add r6,r6,r3
  2594. ldr r3,[r2,#24]
  2595. add r7,r7,r1
  2596. ldr r1,[r2,#28]
  2597. add r8,r8,r0
  2598. str r4,[r2],#4
  2599. add r9,r9,r12
  2600. str r5,[r2],#4
  2601. add r10,r10,r3
  2602. str r6,[r2],#4
  2603. add r11,r11,r1
  2604. str r7,[r2],#4
  2605. stmia r2,{r8-r11}
  2606. ittte ne
  2607. movne r1,sp
  2608. ldrne r2,[sp,#0]
  2609. eorne r12,r12,r12
  2610. ldreq sp,[sp,#76] @ restore original sp
  2611. itt ne
  2612. eorne r3,r5,r6
  2613. bne .L_00_48
  2614. ldmia sp!,{r4-r12,pc}
  2615. .size sha256_block_data_order_neon,.-sha256_block_data_order_neon
  2616. #endif
  2617. #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
  2618. # ifdef __thumb2__
  2619. # define INST(a,b,c,d) .byte c,d|0xc,a,b
  2620. # else
  2621. # define INST(a,b,c,d) .byte a,b,c,d
  2622. # endif
  2623. .type sha256_block_data_order_armv8,%function
  2624. .align 5
  2625. sha256_block_data_order_armv8:
  2626. .LARMv8:
  2627. vld1.32 {q0,q1},[r0]
  2628. # ifdef __thumb2__
  2629. adr r3,.LARMv8
  2630. sub r3,r3,#.LARMv8-K256
  2631. # else
  2632. adrl r3,K256
  2633. # endif
  2634. add r2,r1,r2,lsl#6 @ len to point at the end of inp
  2635. .Loop_v8:
  2636. vld1.8 {q8-q9},[r1]!
  2637. vld1.8 {q10-q11},[r1]!
  2638. vld1.32 {q12},[r3]!
  2639. vrev32.8 q8,q8
  2640. vrev32.8 q9,q9
  2641. vrev32.8 q10,q10
  2642. vrev32.8 q11,q11
  2643. vmov q14,q0 @ offload
  2644. vmov q15,q1
  2645. teq r1,r2
  2646. vld1.32 {q13},[r3]!
  2647. vadd.i32 q12,q12,q8
  2648. INST(0xe2,0x03,0xfa,0xf3) @ sha256su0 q8,q9
  2649. vmov q2,q0
  2650. INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
  2651. INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
  2652. INST(0xe6,0x0c,0x64,0xf3) @ sha256su1 q8,q10,q11
  2653. vld1.32 {q12},[r3]!
  2654. vadd.i32 q13,q13,q9
  2655. INST(0xe4,0x23,0xfa,0xf3) @ sha256su0 q9,q10
  2656. vmov q2,q0
  2657. INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
  2658. INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
  2659. INST(0xe0,0x2c,0x66,0xf3) @ sha256su1 q9,q11,q8
  2660. vld1.32 {q13},[r3]!
  2661. vadd.i32 q12,q12,q10
  2662. INST(0xe6,0x43,0xfa,0xf3) @ sha256su0 q10,q11
  2663. vmov q2,q0
  2664. INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
  2665. INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
  2666. INST(0xe2,0x4c,0x60,0xf3) @ sha256su1 q10,q8,q9
  2667. vld1.32 {q12},[r3]!
  2668. vadd.i32 q13,q13,q11
  2669. INST(0xe0,0x63,0xfa,0xf3) @ sha256su0 q11,q8
  2670. vmov q2,q0
  2671. INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
  2672. INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
  2673. INST(0xe4,0x6c,0x62,0xf3) @ sha256su1 q11,q9,q10
  2674. vld1.32 {q13},[r3]!
  2675. vadd.i32 q12,q12,q8
  2676. INST(0xe2,0x03,0xfa,0xf3) @ sha256su0 q8,q9
  2677. vmov q2,q0
  2678. INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
  2679. INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
  2680. INST(0xe6,0x0c,0x64,0xf3) @ sha256su1 q8,q10,q11
  2681. vld1.32 {q12},[r3]!
  2682. vadd.i32 q13,q13,q9
  2683. INST(0xe4,0x23,0xfa,0xf3) @ sha256su0 q9,q10
  2684. vmov q2,q0
  2685. INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
  2686. INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
  2687. INST(0xe0,0x2c,0x66,0xf3) @ sha256su1 q9,q11,q8
  2688. vld1.32 {q13},[r3]!
  2689. vadd.i32 q12,q12,q10
  2690. INST(0xe6,0x43,0xfa,0xf3) @ sha256su0 q10,q11
  2691. vmov q2,q0
  2692. INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
  2693. INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
  2694. INST(0xe2,0x4c,0x60,0xf3) @ sha256su1 q10,q8,q9
  2695. vld1.32 {q12},[r3]!
  2696. vadd.i32 q13,q13,q11
  2697. INST(0xe0,0x63,0xfa,0xf3) @ sha256su0 q11,q8
  2698. vmov q2,q0
  2699. INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
  2700. INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
  2701. INST(0xe4,0x6c,0x62,0xf3) @ sha256su1 q11,q9,q10
  2702. vld1.32 {q13},[r3]!
  2703. vadd.i32 q12,q12,q8
  2704. INST(0xe2,0x03,0xfa,0xf3) @ sha256su0 q8,q9
  2705. vmov q2,q0
  2706. INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
  2707. INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
  2708. INST(0xe6,0x0c,0x64,0xf3) @ sha256su1 q8,q10,q11
  2709. vld1.32 {q12},[r3]!
  2710. vadd.i32 q13,q13,q9
  2711. INST(0xe4,0x23,0xfa,0xf3) @ sha256su0 q9,q10
  2712. vmov q2,q0
  2713. INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
  2714. INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
  2715. INST(0xe0,0x2c,0x66,0xf3) @ sha256su1 q9,q11,q8
  2716. vld1.32 {q13},[r3]!
  2717. vadd.i32 q12,q12,q10
  2718. INST(0xe6,0x43,0xfa,0xf3) @ sha256su0 q10,q11
  2719. vmov q2,q0
  2720. INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
  2721. INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
  2722. INST(0xe2,0x4c,0x60,0xf3) @ sha256su1 q10,q8,q9
  2723. vld1.32 {q12},[r3]!
  2724. vadd.i32 q13,q13,q11
  2725. INST(0xe0,0x63,0xfa,0xf3) @ sha256su0 q11,q8
  2726. vmov q2,q0
  2727. INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
  2728. INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
  2729. INST(0xe4,0x6c,0x62,0xf3) @ sha256su1 q11,q9,q10
  2730. vld1.32 {q13},[r3]!
  2731. vadd.i32 q12,q12,q8
  2732. vmov q2,q0
  2733. INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
  2734. INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
  2735. vld1.32 {q12},[r3]!
  2736. vadd.i32 q13,q13,q9
  2737. vmov q2,q0
  2738. INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
  2739. INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
  2740. vld1.32 {q13},[r3]
  2741. vadd.i32 q12,q12,q10
  2742. sub r3,r3,#256-16 @ rewind
  2743. vmov q2,q0
  2744. INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
  2745. INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
  2746. vadd.i32 q13,q13,q11
  2747. vmov q2,q0
  2748. INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
  2749. INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
  2750. vadd.i32 q0,q0,q14
  2751. vadd.i32 q1,q1,q15
  2752. it ne
  2753. bne .Loop_v8
  2754. vst1.32 {q0,q1},[r0]
  2755. bx lr @ bx lr
  2756. .size sha256_block_data_order_armv8,.-sha256_block_data_order_armv8
  2757. #endif
  2758. .asciz "SHA256 block transform for ARMv4/NEON/ARMv8, CRYPTOGAMS by <appro@openssl.org>"
  2759. .align 2
  2760. #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
  2761. .comm OPENSSL_armcap_P,4,4
  2762. #endif