You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
2.7 KiB

  1. From 39bd2609ca730b3b628003b3f938aed7d49132ab Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= <peterke@gmail.com>
  3. Date: Thu, 28 Feb 2019 14:53:44 +0200
  4. Subject: [PATCH] crypto/bn256/cloudflare: pull in upstream fix for Go 1.12 R18
  5. ---
  6. crypto/bn256/cloudflare/mul_arm64.h | 32 ++++++++++++++---------------
  7. 1 file changed, 16 insertions(+), 16 deletions(-)
  8. diff --git a/crypto/bn256/cloudflare/mul_arm64.h b/crypto/bn256/cloudflare/mul_arm64.h
  9. index 75d52217311..d405eb8f728 100644
  10. --- a/crypto/bn256/cloudflare/mul_arm64.h
  11. +++ b/crypto/bn256/cloudflare/mul_arm64.h
  12. @@ -12,7 +12,7 @@
  13. UMULH R1, R8, c4 \
  14. ADCS ZR, c4 \
  15. \
  16. - MUL R2, R5, R25 \
  17. + MUL R2, R5, R1 \
  18. UMULH R2, R5, R26 \
  19. MUL R2, R6, R0 \
  20. ADDS R0, R26 \
  21. @@ -24,13 +24,13 @@
  22. ADCS R0, R29 \
  23. UMULH R2, R8, c5 \
  24. ADCS ZR, c5 \
  25. - ADDS R25, c1 \
  26. + ADDS R1, c1 \
  27. ADCS R26, c2 \
  28. ADCS R27, c3 \
  29. ADCS R29, c4 \
  30. ADCS ZR, c5 \
  31. \
  32. - MUL R3, R5, R25 \
  33. + MUL R3, R5, R1 \
  34. UMULH R3, R5, R26 \
  35. MUL R3, R6, R0 \
  36. ADDS R0, R26 \
  37. @@ -42,13 +42,13 @@
  38. ADCS R0, R29 \
  39. UMULH R3, R8, c6 \
  40. ADCS ZR, c6 \
  41. - ADDS R25, c2 \
  42. + ADDS R1, c2 \
  43. ADCS R26, c3 \
  44. ADCS R27, c4 \
  45. ADCS R29, c5 \
  46. ADCS ZR, c6 \
  47. \
  48. - MUL R4, R5, R25 \
  49. + MUL R4, R5, R1 \
  50. UMULH R4, R5, R26 \
  51. MUL R4, R6, R0 \
  52. ADDS R0, R26 \
  53. @@ -60,7 +60,7 @@
  54. ADCS R0, R29 \
  55. UMULH R4, R8, c7 \
  56. ADCS ZR, c7 \
  57. - ADDS R25, c3 \
  58. + ADDS R1, c3 \
  59. ADCS R26, c4 \
  60. ADCS R27, c5 \
  61. ADCS R29, c6 \
  62. @@ -69,15 +69,15 @@
  63. #define gfpReduce() \
  64. \ // m = (T * N') mod R, store m in R1:R2:R3:R4
  65. MOVD ·np+0(SB), R17 \
  66. - MOVD ·np+8(SB), R18 \
  67. + MOVD ·np+8(SB), R25 \
  68. MOVD ·np+16(SB), R19 \
  69. MOVD ·np+24(SB), R20 \
  70. \
  71. MUL R9, R17, R1 \
  72. UMULH R9, R17, R2 \
  73. - MUL R9, R18, R0 \
  74. + MUL R9, R25, R0 \
  75. ADDS R0, R2 \
  76. - UMULH R9, R18, R3 \
  77. + UMULH R9, R25, R3 \
  78. MUL R9, R19, R0 \
  79. ADCS R0, R3 \
  80. UMULH R9, R19, R4 \
  81. @@ -86,9 +86,9 @@
  82. \
  83. MUL R10, R17, R21 \
  84. UMULH R10, R17, R22 \
  85. - MUL R10, R18, R0 \
  86. + MUL R10, R25, R0 \
  87. ADDS R0, R22 \
  88. - UMULH R10, R18, R23 \
  89. + UMULH R10, R25, R23 \
  90. MUL R10, R19, R0 \
  91. ADCS R0, R23 \
  92. ADDS R21, R2 \
  93. @@ -97,7 +97,7 @@
  94. \
  95. MUL R11, R17, R21 \
  96. UMULH R11, R17, R22 \
  97. - MUL R11, R18, R0 \
  98. + MUL R11, R25, R0 \
  99. ADDS R0, R22 \
  100. ADDS R21, R3 \
  101. ADCS R22, R4 \
  102. @@ -107,19 +107,19 @@
  103. \
  104. \ // m * N
  105. loadModulus(R5,R6,R7,R8) \
  106. - mul(R17,R18,R19,R20,R21,R22,R23,R24) \
  107. + mul(R17,R25,R19,R20,R21,R22,R23,R24) \
  108. \
  109. \ // Add the 512-bit intermediate to m*N
  110. - MOVD ZR, R25 \
  111. + MOVD ZR, R0 \
  112. ADDS R9, R17 \
  113. - ADCS R10, R18 \
  114. + ADCS R10, R25 \
  115. ADCS R11, R19 \
  116. ADCS R12, R20 \
  117. ADCS R13, R21 \
  118. ADCS R14, R22 \
  119. ADCS R15, R23 \
  120. ADCS R16, R24 \
  121. - ADCS ZR, R25 \
  122. + ADCS ZR, R0 \
  123. \
  124. \ // Our output is R21:R22:R23:R24. Reduce mod p if necessary.
  125. SUBS R5, R21, R10 \