aws-crt 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (581) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/VERSION +1 -1
  4. data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/auth.h +1 -0
  5. data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/aws_imds_client.h +5 -0
  6. data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/credentials.h +5 -0
  7. data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/private/aws_signing.h +1 -0
  8. data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/private/credentials_utils.h +2 -0
  9. data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/signing_config.h +1 -0
  10. data/aws-crt-ffi/crt/aws-c-auth/source/auth.c +3 -1
  11. data/aws-crt-ffi/crt/aws-c-auth/source/aws_imds_client.c +146 -63
  12. data/aws-crt-ffi/crt/aws-c-auth/source/aws_signing.c +41 -19
  13. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_imds.c +1 -0
  14. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_utils.c +1 -0
  15. data/aws-crt-ffi/crt/aws-c-auth/source/signable_http_request.c +2 -1
  16. data/aws-crt-ffi/crt/aws-c-auth/source/signing_config.c +25 -0
  17. data/aws-crt-ffi/crt/aws-c-auth/tests/CMakeLists.txt +3 -0
  18. data/aws-crt-ffi/crt/aws-c-auth/tests/aws_imds_client_test.c +197 -31
  19. data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_imds_tests.c +16 -18
  20. data/aws-crt-ffi/crt/aws-c-auth/tests/sigv4_signing_tests.c +3 -1
  21. data/aws-crt-ffi/crt/aws-c-cal/include/aws/cal/private/opensslcrypto_common.h +22 -0
  22. data/aws-crt-ffi/crt/aws-c-cal/source/darwin/commoncrypto_aes.c +46 -17
  23. data/aws-crt-ffi/crt/aws-c-cal/source/unix/openssl_aes.c +1 -0
  24. data/aws-crt-ffi/crt/aws-c-cal/source/unix/openssl_platform_init.c +7 -0
  25. data/aws-crt-ffi/crt/aws-c-cal/source/unix/openssl_rsa.c +59 -2
  26. data/aws-crt-ffi/crt/aws-c-cal/source/unix/opensslcrypto_ecc.c +1 -0
  27. data/aws-crt-ffi/crt/aws-c-common/CMakeLists.txt +13 -1
  28. data/aws-crt-ffi/crt/aws-c-common/THIRD-PARTY-LICENSES.txt +28 -7
  29. data/aws-crt-ffi/crt/aws-c-common/bin/system_info/CMakeLists.txt +18 -0
  30. data/aws-crt-ffi/crt/aws-c-common/bin/system_info/print_system_info.c +48 -0
  31. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/allocator.h +23 -0
  32. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_buf.h +12 -0
  33. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/cross_process_lock.h +35 -0
  34. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/hash_table.h +1 -0
  35. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/priority_queue.h +24 -0
  36. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/private/system_info_priv.h +37 -0
  37. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/system_info.h +47 -0
  38. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/system_resource_util.h +30 -0
  39. data/aws-crt-ffi/crt/aws-c-common/include/aws/testing/aws_test_harness.h +3 -2
  40. data/aws-crt-ffi/crt/aws-c-common/source/allocator.c +64 -13
  41. data/aws-crt-ffi/crt/aws-c-common/source/android/logging.c +14 -0
  42. data/aws-crt-ffi/crt/aws-c-common/source/common.c +3 -3
  43. data/aws-crt-ffi/crt/aws-c-common/source/file.c +96 -35
  44. data/aws-crt-ffi/crt/aws-c-common/source/linux/system_info.c +24 -0
  45. data/aws-crt-ffi/crt/aws-c-common/source/memtrace.c +10 -3
  46. data/aws-crt-ffi/crt/aws-c-common/source/platform_fallback_stubs/system_info.c +21 -0
  47. data/aws-crt-ffi/crt/aws-c-common/source/posix/cross_process_lock.c +141 -0
  48. data/aws-crt-ffi/crt/aws-c-common/source/posix/system_info.c +1 -1
  49. data/aws-crt-ffi/crt/aws-c-common/source/posix/system_resource_utils.c +32 -0
  50. data/aws-crt-ffi/crt/aws-c-common/source/priority_queue.c +24 -0
  51. data/aws-crt-ffi/crt/aws-c-common/source/system_info.c +80 -0
  52. data/aws-crt-ffi/crt/aws-c-common/source/task_scheduler.c +2 -2
  53. data/aws-crt-ffi/crt/aws-c-common/source/windows/cross_process_lock.c +93 -0
  54. data/aws-crt-ffi/crt/aws-c-common/source/windows/system_resource_utils.c +31 -0
  55. data/aws-crt-ffi/crt/aws-c-common/tests/CMakeLists.txt +16 -0
  56. data/aws-crt-ffi/crt/aws-c-common/tests/alloc_test.c +83 -22
  57. data/aws-crt-ffi/crt/aws-c-common/tests/cross_process_lock_tests.c +116 -0
  58. data/aws-crt-ffi/crt/aws-c-common/tests/file_test.c +103 -0
  59. data/aws-crt-ffi/crt/aws-c-common/tests/priority_queue_test.c +36 -0
  60. data/aws-crt-ffi/crt/aws-c-common/tests/system_info_tests.c +19 -0
  61. data/aws-crt-ffi/crt/aws-c-common/tests/system_resource_util_test.c +37 -0
  62. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection.h +9 -0
  63. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/http.h +1 -0
  64. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/connection_impl.h +5 -4
  65. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/connection_manager_system_vtable.h +10 -18
  66. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/proxy_impl.h +5 -1
  67. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/request_response_impl.h +5 -0
  68. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/request_response.h +10 -0
  69. data/aws-crt-ffi/crt/aws-c-http/source/connection.c +5 -2
  70. data/aws-crt-ffi/crt/aws-c-http/source/connection_manager.c +22 -21
  71. data/aws-crt-ffi/crt/aws-c-http/source/h1_connection.c +102 -17
  72. data/aws-crt-ffi/crt/aws-c-http/source/h1_stream.c +1 -0
  73. data/aws-crt-ffi/crt/aws-c-http/source/http.c +3 -0
  74. data/aws-crt-ffi/crt/aws-c-http/source/proxy_connection.c +2 -2
  75. data/aws-crt-ffi/crt/aws-c-http/tests/CMakeLists.txt +2 -0
  76. data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_manager.c +18 -18
  77. data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_client.c +111 -1
  78. data/aws-crt-ffi/crt/aws-c-http/tests/test_proxy.c +2 -2
  79. data/aws-crt-ffi/crt/aws-c-http/tests/test_stream_manager.c +2 -2
  80. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/retry_strategy.h +1 -1
  81. data/aws-crt-ffi/crt/aws-c-io/source/exponential_backoff_retry_strategy.c +1 -1
  82. data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_tls_op_handler.c +2 -4
  83. data/aws-crt-ffi/crt/aws-lc/CMakeLists.txt +16 -8
  84. data/aws-crt-ffi/crt/aws-lc/cmake/go.cmake +6 -0
  85. data/aws-crt-ffi/crt/aws-lc/crypto/CMakeLists.txt +6 -9
  86. data/aws-crt-ffi/crt/aws-lc/crypto/asn1/a_time.c +34 -1
  87. data/aws-crt-ffi/crt/aws-lc/crypto/asn1/a_utctm.c +4 -1
  88. data/aws-crt-ffi/crt/aws-lc/crypto/asn1/asn1_test.cc +41 -0
  89. data/aws-crt-ffi/crt/aws-lc/crypto/bio/bio_mem.c +6 -7
  90. data/aws-crt-ffi/crt/aws-lc/crypto/bio/bio_test.cc +152 -16
  91. data/aws-crt-ffi/crt/aws-lc/crypto/bio/connect.c +6 -12
  92. data/aws-crt-ffi/crt/aws-lc/crypto/bio/fd.c +2 -2
  93. data/aws-crt-ffi/crt/aws-lc/crypto/bio/file.c +20 -8
  94. data/aws-crt-ffi/crt/aws-lc/crypto/bio/socket.c +2 -2
  95. data/aws-crt-ffi/crt/aws-lc/crypto/bio/socket_helper.c +2 -2
  96. data/aws-crt-ffi/crt/aws-lc/crypto/blake2/blake2.c +11 -1
  97. data/aws-crt-ffi/crt/aws-lc/crypto/bytestring/cbb.c +13 -3
  98. data/aws-crt-ffi/crt/aws-lc/crypto/bytestring/cbs.c +9 -0
  99. data/aws-crt-ffi/crt/aws-lc/crypto/chacha/asm/chacha-armv8.pl +1 -1
  100. data/aws-crt-ffi/crt/aws-lc/crypto/chacha/chacha.c +49 -8
  101. data/aws-crt-ffi/crt/aws-lc/crypto/chacha/chacha_test.cc +110 -0
  102. data/aws-crt-ffi/crt/aws-lc/crypto/chacha/internal.h +8 -1
  103. data/aws-crt-ffi/crt/aws-lc/crypto/compiler_test.cc +4 -1
  104. data/aws-crt-ffi/crt/aws-lc/crypto/conf/conf_test.cc +1 -0
  105. data/aws-crt-ffi/crt/aws-lc/crypto/crypto_test.cc +9 -0
  106. data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/curve25519.c +189 -108
  107. data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/curve25519_nohw.c +78 -6
  108. data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/ed25519_test.cc +9 -0
  109. data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/internal.h +24 -10
  110. data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/spake25519.c +4 -4
  111. data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/x25519_test.cc +80 -11
  112. data/aws-crt-ffi/crt/aws-lc/crypto/decrepit/evp/evp_do_all.c +2 -0
  113. data/aws-crt-ffi/crt/aws-lc/crypto/digest_extra/digest_extra.c +8 -0
  114. data/aws-crt-ffi/crt/aws-lc/crypto/digest_extra/digest_test.cc +110 -45
  115. data/aws-crt-ffi/crt/aws-lc/crypto/dsa/dsa_test.cc +8 -2
  116. data/aws-crt-ffi/crt/aws-lc/crypto/dsa/internal.h +18 -0
  117. data/aws-crt-ffi/crt/aws-lc/crypto/dynamic_loading_test.c +8 -5
  118. data/aws-crt-ffi/crt/aws-lc/crypto/ec_extra/ec_derive.c +4 -3
  119. data/aws-crt-ffi/crt/aws-lc/crypto/ec_extra/hash_to_curve.c +6 -18
  120. data/aws-crt-ffi/crt/aws-lc/crypto/endian_test.cc +308 -0
  121. data/aws-crt-ffi/crt/aws-lc/crypto/err/ssl.errordata +2 -0
  122. data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/evp_extra_test.cc +2 -0
  123. data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/evp_test.cc +11 -1
  124. data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/evp_tests.txt +25 -0
  125. data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/p_ec_asn1.c +1 -1
  126. data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/p_kem.c +2 -2
  127. data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/p_rsa_asn1.c +1 -0
  128. data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/print.c +7 -6
  129. data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/scrypt.c +13 -1
  130. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/CMakeLists.txt +13 -4
  131. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/aes/aes_nohw.c +18 -6
  132. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bcm.c +12 -4
  133. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/bn_assert_test.cc +77 -0
  134. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/bn_test.cc +30 -0
  135. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/bytes.c +112 -22
  136. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/div.c +12 -5
  137. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/exponentiation.c +54 -1
  138. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/gcd.c +5 -6
  139. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/internal.h +37 -15
  140. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/montgomery.c +4 -11
  141. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/montgomery_inv.c +51 -15
  142. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/cipher/aead.c +2 -2
  143. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/digest/digest.c +29 -6
  144. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/digest/digests.c +89 -0
  145. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/digest/internal.h +4 -0
  146. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/ec.c +19 -36
  147. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/ec_key.c +3 -3
  148. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/ec_montgomery.c +9 -7
  149. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/ec_test.cc +33 -9
  150. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/internal.h +17 -12
  151. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/p224-64.c +5 -8
  152. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/p256-nistz.c +8 -8
  153. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/p256.c +9 -8
  154. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/p384.c +33 -16
  155. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/p521.c +14 -6
  156. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/scalar.c +26 -24
  157. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/simple_mul.c +8 -5
  158. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/wnaf.c +3 -3
  159. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ecdsa/ecdsa.c +9 -3
  160. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/evp/evp.c +43 -12
  161. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/evp/p_ec.c +4 -3
  162. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/hmac/hmac.c +3 -1
  163. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/modes/xts.c +26 -3
  164. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rand/cpu_jitter_test.cc +1 -1
  165. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rand/internal.h +20 -11
  166. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rand/rand.c +10 -10
  167. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rand/urandom.c +2 -2
  168. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rsa/internal.h +59 -0
  169. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rsa/padding.c +9 -3
  170. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rsa/rsa.c +7 -0
  171. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rsa/rsa_impl.c +51 -60
  172. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/service_indicator/service_indicator.c +5 -2
  173. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/service_indicator/service_indicator_test.cc +205 -5
  174. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/asm/sha1-armv8.pl +1 -1
  175. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/asm/sha512-armv8.pl +1 -1
  176. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/internal.h +8 -0
  177. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/sha3.c +37 -15
  178. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/sha3_test.cc +115 -110
  179. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/sha512.c +55 -1
  180. data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sshkdf/sshkdf.c +2 -2
  181. data/aws-crt-ffi/crt/aws-lc/crypto/hmac_extra/hmac_test.cc +12 -0
  182. data/aws-crt-ffi/crt/aws-lc/crypto/hmac_extra/hmac_tests.txt +10 -0
  183. data/aws-crt-ffi/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S +2 -6
  184. data/aws-crt-ffi/crt/aws-lc/crypto/impl_dispatch_test.cc +9 -1
  185. data/aws-crt-ffi/crt/aws-lc/crypto/internal.h +90 -8
  186. data/aws-crt-ffi/crt/aws-lc/crypto/kem/kem.c +28 -27
  187. data/aws-crt-ffi/crt/aws-lc/crypto/kyber/kem_kyber.h +14 -0
  188. data/aws-crt-ffi/crt/aws-lc/crypto/obj/obj_dat.h +52 -2
  189. data/aws-crt-ffi/crt/aws-lc/crypto/obj/obj_mac.num +5 -0
  190. data/aws-crt-ffi/crt/aws-lc/crypto/obj/objects.txt +7 -0
  191. data/aws-crt-ffi/crt/aws-lc/crypto/perlasm/arm-xlate.pl +3 -14
  192. data/aws-crt-ffi/crt/aws-lc/crypto/perlasm/ppc-xlate.pl +1 -5
  193. data/aws-crt-ffi/crt/aws-lc/crypto/perlasm/x86_64-xlate.pl +4 -15
  194. data/aws-crt-ffi/crt/aws-lc/crypto/perlasm/x86asm.pl +4 -13
  195. data/aws-crt-ffi/crt/aws-lc/crypto/poly1305/poly1305_arm_asm.S +3 -13
  196. data/aws-crt-ffi/crt/aws-lc/crypto/rand_extra/deterministic.c +4 -3
  197. data/aws-crt-ffi/crt/aws-lc/crypto/rand_extra/fuchsia.c +4 -4
  198. data/aws-crt-ffi/crt/aws-lc/crypto/rand_extra/rand_test.cc +0 -63
  199. data/aws-crt-ffi/crt/aws-lc/crypto/rand_extra/windows.c +41 -19
  200. data/aws-crt-ffi/crt/aws-lc/crypto/rsa_extra/rsa_test.cc +3 -3
  201. data/aws-crt-ffi/crt/aws-lc/crypto/siphash/siphash.c +12 -5
  202. data/aws-crt-ffi/crt/aws-lc/crypto/siphash/siphash_test.cc +5 -5
  203. data/aws-crt-ffi/crt/aws-lc/crypto/stack/stack.c +68 -46
  204. data/aws-crt-ffi/crt/aws-lc/crypto/trust_token/pmbtoken.c +4 -4
  205. data/aws-crt-ffi/crt/aws-lc/crypto/trust_token/voprf.c +2 -2
  206. data/aws-crt-ffi/crt/aws-lc/crypto/x509/by_dir.c +0 -6
  207. data/aws-crt-ffi/crt/aws-lc/crypto/x509/internal.h +4 -1
  208. data/aws-crt-ffi/crt/aws-lc/crypto/x509/x509_lu.c +33 -9
  209. data/aws-crt-ffi/crt/aws-lc/crypto/x509/x509_test.cc +87 -0
  210. data/aws-crt-ffi/crt/aws-lc/crypto/x509/x509_trs.c +1 -1
  211. data/aws-crt-ffi/crt/aws-lc/crypto/x509/x509_vfy.c +35 -13
  212. data/aws-crt-ffi/crt/aws-lc/crypto/x509v3/v3_lib.c +2 -0
  213. data/aws-crt-ffi/crt/aws-lc/crypto/x509v3/v3_purp.c +4 -6
  214. data/aws-crt-ffi/crt/aws-lc/generated-src/crypto_test_data.cc +179 -151
  215. data/aws-crt-ffi/crt/aws-lc/generated-src/err_data.c +353 -349
  216. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/chacha/chacha-armv8.S +4 -14
  217. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/cipher_extra/chacha20_poly1305_armv8.S +4 -14
  218. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/aesv8-armx.S +3 -13
  219. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/aesv8-gcm-armv8-unroll8.S +3 -13
  220. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/aesv8-gcm-armv8.S +3 -13
  221. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/armv8-mont.S +4 -14
  222. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/bn-armv8.S +4 -14
  223. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/ghash-neon-armv8.S +4 -14
  224. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/ghashv8-armx.S +3 -13
  225. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/keccak1600-armv8.S +3 -13
  226. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/md5-armv8.S +3 -13
  227. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/p256-armv8-asm.S +4 -14
  228. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/p256_beeu-armv8-asm.S +4 -14
  229. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/sha1-armv8.S +4 -14
  230. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/sha256-armv8.S +4 -14
  231. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/sha512-armv8.S +4 -14
  232. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/vpaes-armv8.S +3 -13
  233. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/test/trampoline-armv8.S +4 -14
  234. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/chacha/chacha-armv4.S +3 -13
  235. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/aesv8-armx.S +3 -13
  236. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/armv4-mont.S +3 -13
  237. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/bsaes-armv7.S +3 -13
  238. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/ghash-armv4.S +3 -13
  239. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/ghashv8-armx.S +3 -13
  240. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/sha1-armv4-large.S +3 -13
  241. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/sha256-armv4.S +3 -13
  242. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/sha512-armv4.S +3 -13
  243. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/vpaes-armv7.S +3 -13
  244. data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/test/trampoline-armv4.S +3 -13
  245. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/chacha/chacha-armv8.S +4 -14
  246. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/cipher_extra/chacha20_poly1305_armv8.S +4 -14
  247. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/aesv8-armx.S +3 -13
  248. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/aesv8-gcm-armv8-unroll8.S +3 -13
  249. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/aesv8-gcm-armv8.S +3 -13
  250. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/armv8-mont.S +4 -14
  251. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/bn-armv8.S +3 -13
  252. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/ghash-neon-armv8.S +3 -13
  253. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/ghashv8-armx.S +3 -13
  254. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/keccak1600-armv8.S +3 -13
  255. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/md5-armv8.S +3 -13
  256. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/p256-armv8-asm.S +4 -14
  257. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/p256_beeu-armv8-asm.S +4 -14
  258. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/sha1-armv8.S +4 -14
  259. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/sha256-armv8.S +4 -14
  260. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/sha512-armv8.S +4 -14
  261. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/vpaes-armv8.S +3 -13
  262. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/test/trampoline-armv8.S +3 -13
  263. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/chacha/chacha-armv4.S +3 -13
  264. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/aesv8-armx.S +3 -13
  265. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/armv4-mont.S +3 -13
  266. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/bsaes-armv7.S +3 -13
  267. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/ghash-armv4.S +3 -13
  268. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/ghashv8-armx.S +3 -13
  269. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/sha1-armv4-large.S +3 -13
  270. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/sha256-armv4.S +3 -13
  271. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/sha512-armv4.S +3 -13
  272. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/vpaes-armv7.S +3 -13
  273. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/test/trampoline-armv4.S +3 -13
  274. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-ppc64le/crypto/fipsmodule/aesp8-ppc.S +1 -5
  275. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-ppc64le/crypto/fipsmodule/ghashp8-ppc.S +1 -5
  276. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-ppc64le/crypto/test/trampoline-ppc.S +1 -5
  277. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/chacha/chacha-x86.S +3 -12
  278. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/aesni-x86.S +3 -12
  279. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/bn-586.S +4 -13
  280. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/co-586.S +4 -13
  281. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/ghash-ssse3-x86.S +3 -12
  282. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/ghash-x86.S +3 -12
  283. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/md5-586.S +4 -13
  284. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/sha1-586.S +4 -13
  285. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/sha256-586.S +3 -12
  286. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/sha512-586.S +3 -12
  287. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/vpaes-x86.S +3 -12
  288. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/x86-mont.S +3 -12
  289. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/test/trampoline-x86.S +3 -12
  290. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/chacha/chacha-x86_64.S +2 -11
  291. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S +2 -11
  292. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/cipher_extra/aesni-sha1-x86_64.S +2 -11
  293. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/cipher_extra/aesni-sha256-x86_64.S +2 -11
  294. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S +2 -11
  295. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/aesni-gcm-avx512.S +2 -11
  296. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S +2 -11
  297. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/aesni-x86_64.S +2 -11
  298. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/aesni-xts-avx512.S +2 -11
  299. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S +2 -11
  300. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/ghash-x86_64.S +2 -11
  301. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/md5-x86_64.S +2 -11
  302. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/p256-x86_64-asm.S +2 -11
  303. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S +2 -11
  304. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/rdrand-x86_64.S +2 -11
  305. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/rsaz-avx2.S +2 -11
  306. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/sha1-x86_64.S +2 -11
  307. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/sha256-x86_64.S +2 -11
  308. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/sha512-x86_64.S +2 -11
  309. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/vpaes-x86_64.S +2 -11
  310. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/x86_64-mont.S +2 -11
  311. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/x86_64-mont5.S +2 -11
  312. data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/test/trampoline-x86_64.S +2 -11
  313. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/chacha/chacha-x86.S +3 -12
  314. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/aesni-x86.S +3 -12
  315. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/bn-586.S +3 -12
  316. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/co-586.S +3 -12
  317. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/ghash-ssse3-x86.S +3 -12
  318. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/ghash-x86.S +3 -12
  319. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/md5-586.S +3 -12
  320. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/sha1-586.S +3 -12
  321. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/sha256-586.S +3 -12
  322. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/sha512-586.S +3 -12
  323. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/vpaes-x86.S +3 -12
  324. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/x86-mont.S +3 -12
  325. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/test/trampoline-x86.S +3 -12
  326. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/chacha/chacha-x86_64.S +2 -11
  327. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S +2 -11
  328. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/cipher_extra/aesni-sha1-x86_64.S +2 -11
  329. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/cipher_extra/aesni-sha256-x86_64.S +2 -11
  330. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S +2 -11
  331. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/aesni-gcm-avx512.S +2 -11
  332. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S +2 -11
  333. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/aesni-x86_64.S +2 -11
  334. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/aesni-xts-avx512.S +2 -11
  335. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S +2 -11
  336. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/ghash-x86_64.S +2 -11
  337. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/md5-x86_64.S +2 -11
  338. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/p256-x86_64-asm.S +2 -11
  339. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S +2 -11
  340. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/rdrand-x86_64.S +2 -11
  341. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/rsaz-avx2.S +2 -11
  342. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/sha1-x86_64.S +2 -11
  343. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/sha256-x86_64.S +2 -11
  344. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/sha512-x86_64.S +2 -11
  345. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/vpaes-x86_64.S +2 -11
  346. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/x86_64-mont.S +2 -11
  347. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/x86_64-mont5.S +2 -11
  348. data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/test/trampoline-x86_64.S +2 -11
  349. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/chacha/chacha-armv8.S +4 -14
  350. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/cipher_extra/chacha20_poly1305_armv8.S +4 -14
  351. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/aesv8-armx.S +3 -13
  352. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/aesv8-gcm-armv8-unroll8.S +3 -13
  353. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/aesv8-gcm-armv8.S +3 -13
  354. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/armv8-mont.S +4 -14
  355. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/bn-armv8.S +4 -14
  356. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/ghash-neon-armv8.S +4 -14
  357. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/ghashv8-armx.S +3 -13
  358. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/keccak1600-armv8.S +3 -13
  359. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/md5-armv8.S +3 -13
  360. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/p256-armv8-asm.S +4 -14
  361. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/p256_beeu-armv8-asm.S +4 -14
  362. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/sha1-armv8.S +4 -14
  363. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/sha256-armv8.S +4 -14
  364. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/sha512-armv8.S +4 -14
  365. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/vpaes-armv8.S +3 -13
  366. data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/test/trampoline-armv8.S +4 -14
  367. data/aws-crt-ffi/crt/aws-lc/go.mod +4 -4
  368. data/aws-crt-ffi/crt/aws-lc/go.sum +8 -10
  369. data/aws-crt-ffi/crt/aws-lc/include/openssl/aead.h +2 -2
  370. data/aws-crt-ffi/crt/aws-lc/include/openssl/arm_arch.h +4 -119
  371. data/aws-crt-ffi/crt/aws-lc/include/openssl/asm_base.h +185 -0
  372. data/aws-crt-ffi/crt/aws-lc/include/openssl/asn1.h +5 -0
  373. data/aws-crt-ffi/crt/aws-lc/include/openssl/base.h +31 -134
  374. data/aws-crt-ffi/crt/aws-lc/include/openssl/bio.h +30 -18
  375. data/aws-crt-ffi/crt/aws-lc/include/openssl/bn.h +0 -2
  376. data/aws-crt-ffi/crt/aws-lc/include/openssl/chacha.h +6 -0
  377. data/aws-crt-ffi/crt/aws-lc/include/openssl/cipher.h +2 -2
  378. data/aws-crt-ffi/crt/aws-lc/include/openssl/digest.h +9 -6
  379. data/aws-crt-ffi/crt/aws-lc/include/openssl/dsa.h +0 -21
  380. data/aws-crt-ffi/crt/aws-lc/include/openssl/ec.h +1 -1
  381. data/aws-crt-ffi/crt/aws-lc/include/openssl/err.h +1 -1
  382. data/aws-crt-ffi/crt/aws-lc/include/openssl/evp.h +8 -5
  383. data/aws-crt-ffi/crt/aws-lc/include/openssl/nid.h +21 -0
  384. data/aws-crt-ffi/crt/aws-lc/include/openssl/rsa.h +1 -65
  385. data/aws-crt-ffi/crt/aws-lc/include/openssl/sha.h +22 -1
  386. data/aws-crt-ffi/crt/aws-lc/include/openssl/ssl.h +121 -13
  387. data/aws-crt-ffi/crt/aws-lc/include/openssl/stack.h +229 -208
  388. data/aws-crt-ffi/crt/aws-lc/include/openssl/target.h +166 -0
  389. data/aws-crt-ffi/crt/aws-lc/include/openssl/x509.h +30 -10
  390. data/aws-crt-ffi/crt/aws-lc/include/openssl/x509v3.h +6 -4
  391. data/aws-crt-ffi/crt/aws-lc/sources.cmake +2 -0
  392. data/aws-crt-ffi/crt/aws-lc/ssl/extensions.cc +12 -7
  393. data/aws-crt-ffi/crt/aws-lc/ssl/handshake_server.cc +28 -18
  394. data/aws-crt-ffi/crt/aws-lc/ssl/internal.h +41 -6
  395. data/aws-crt-ffi/crt/aws-lc/ssl/s3_both.cc +9 -17
  396. data/aws-crt-ffi/crt/aws-lc/ssl/ssl_cipher.cc +13 -5
  397. data/aws-crt-ffi/crt/aws-lc/ssl/ssl_key_share.cc +542 -2
  398. data/aws-crt-ffi/crt/aws-lc/ssl/ssl_lib.cc +35 -0
  399. data/aws-crt-ffi/crt/aws-lc/ssl/ssl_test.cc +1847 -14
  400. data/aws-crt-ffi/crt/aws-lc/ssl/ssl_x509.cc +128 -0
  401. data/aws-crt-ffi/crt/aws-lc/ssl/test/PORTING.md +10 -7
  402. data/aws-crt-ffi/crt/aws-lc/ssl/test/bssl_shim.cc +133 -77
  403. data/aws-crt-ffi/crt/aws-lc/ssl/test/handshake_util.cc +3 -3
  404. data/aws-crt-ffi/crt/aws-lc/ssl/test/handshaker.cc +4 -0
  405. data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/handshake_client.go +6 -2
  406. data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/handshake_messages.go +894 -1042
  407. data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/handshake_server.go +24 -23
  408. data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/prf.go +6 -5
  409. data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/runner.go +56 -55
  410. data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/shim_dispatcher.go +188 -0
  411. data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/ticket.go +37 -39
  412. data/aws-crt-ffi/crt/aws-lc/ssl/test/test_config.cc +59 -24
  413. data/aws-crt-ffi/crt/aws-lc/ssl/test/test_config.h +3 -2
  414. data/aws-crt-ffi/crt/aws-lc/ssl/tls13_server.cc +10 -11
  415. data/aws-crt-ffi/crt/aws-lc/tests/ci/cdk/app.py +4 -4
  416. data/aws-crt-ffi/crt/aws-lc/tests/ci/cdk/cdk/{aws_lc_mac_arm_ci_stack.py → aws_lc_ec2_test_framework_ci_stack.py} +13 -29
  417. data/aws-crt-ffi/crt/aws-lc/tests/ci/cdk/cdk/ssm/general_test_run_ssm_document.yaml +43 -0
  418. data/aws-crt-ffi/crt/aws-lc/tests/ci/common_posix_setup.sh +10 -0
  419. data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-aarch/amazonlinux-2023_base/Dockerfile +5 -1
  420. data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-aarch/ubuntu-22.04_base/Dockerfile +19 -3
  421. data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/amazonlinux-2_gcc-7x-intel-sde/Dockerfile +5 -4
  422. data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/build_images.sh +1 -0
  423. data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/push_images.sh +2 -1
  424. data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/ubuntu-20.04_clang-10x_formal-verification/create_image.sh +1 -1
  425. data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/ubuntu-22.04_base/Dockerfile +1 -0
  426. data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/ubuntu-22.04_clang-14x-sde/Dockerfile +42 -0
  427. data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/windows/vs2017/Dockerfile +14 -0
  428. data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/windows/windows_base/Dockerfile +3 -0
  429. data/aws-crt-ffi/crt/aws-lc/tests/ci/integration/README.md +12 -0
  430. data/aws-crt-ffi/crt/aws-lc/tests/ci/integration/nginx_patch/aws-lc-nginx.patch +68 -23
  431. data/aws-crt-ffi/crt/aws-lc/tests/ci/integration/run_crt_integration.sh +27 -0
  432. data/aws-crt-ffi/crt/aws-lc/tests/ci/integration/run_monit_integration.sh +56 -0
  433. data/aws-crt-ffi/crt/aws-lc/tests/ci/integration/sslproxy_patch/aws-lc-sslproxy.patch +2 -2
  434. data/aws-crt-ffi/crt/aws-lc/tests/ci/run_ec2_test_framework.sh +135 -0
  435. data/aws-crt-ffi/crt/aws-lc/tests/ci/run_fips_tests.sh +14 -2
  436. data/aws-crt-ffi/crt/aws-lc/tests/ci/run_tests_with_sde.sh +4 -1
  437. data/aws-crt-ffi/crt/aws-lc/tests/ci/run_tests_with_sde_asan.sh +14 -0
  438. data/aws-crt-ffi/crt/aws-lc/tests/ci/run_windows_tests.bat +39 -3
  439. data/aws-crt-ffi/crt/aws-lc/third_party/fiat/README.md +21 -6
  440. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/bignum_madd_n25519.S +284 -0
  441. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/bignum_madd_n25519_alt.S +210 -0
  442. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/bignum_mod_n25519.S +186 -0
  443. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/bignum_neg_p25519.S +65 -0
  444. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519.S +1043 -352
  445. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519_alt.S +1043 -352
  446. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519_byte.S +1043 -352
  447. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519_byte_alt.S +1043 -352
  448. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519base.S +1042 -352
  449. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519base_alt.S +1042 -352
  450. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519base_byte.S +1042 -352
  451. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519base_byte_alt.S +1043 -354
  452. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_decode.S +700 -0
  453. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_decode_alt.S +563 -0
  454. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_encode.S +131 -0
  455. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_scalarmulbase.S +9626 -0
  456. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_scalarmulbase_alt.S +9468 -0
  457. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_scalarmuldouble.S +3157 -0
  458. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_scalarmuldouble_alt.S +2941 -0
  459. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/p384/Makefile +1 -1
  460. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/p521/Makefile +1 -1
  461. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/include/s2n-bignum_aws-lc.h +34 -0
  462. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/bignum_madd_n25519.S +219 -0
  463. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/bignum_madd_n25519_alt.S +245 -0
  464. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/bignum_mod_n25519.S +228 -0
  465. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/bignum_neg_p25519.S +86 -0
  466. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/curve25519_x25519.S +1350 -407
  467. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/curve25519_x25519_alt.S +1350 -407
  468. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/curve25519_x25519base.S +1344 -400
  469. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/curve25519_x25519base_alt.S +1348 -402
  470. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_decode.S +670 -0
  471. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_decode_alt.S +751 -0
  472. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_encode.S +81 -0
  473. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_scalarmulbase.S +9910 -0
  474. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_scalarmulbase_alt.S +9986 -0
  475. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_scalarmuldouble.S +3619 -0
  476. data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_scalarmuldouble_alt.S +3736 -0
  477. data/aws-crt-ffi/crt/aws-lc/third_party/wycheproof_testvectors/hmac_sha512_224_test.json +1978 -0
  478. data/aws-crt-ffi/crt/aws-lc/third_party/wycheproof_testvectors/hmac_sha512_224_test.txt +1403 -0
  479. data/aws-crt-ffi/crt/aws-lc/third_party/wycheproof_testvectors/hmac_sha512_256_test.json +1993 -0
  480. data/aws-crt-ffi/crt/aws-lc/third_party/wycheproof_testvectors/hmac_sha512_256_test.txt +1416 -0
  481. data/aws-crt-ffi/crt/aws-lc/tool/digest.cc +4 -0
  482. data/aws-crt-ffi/crt/aws-lc/tool/internal.h +1 -0
  483. data/aws-crt-ffi/crt/aws-lc/tool/speed.cc +53 -6
  484. data/aws-crt-ffi/crt/aws-lc/util/all_tests.go +43 -12
  485. data/aws-crt-ffi/crt/aws-lc/util/all_tests.json +13 -5
  486. data/aws-crt-ffi/crt/aws-lc/util/bot/DEPS +4 -4
  487. data/aws-crt-ffi/crt/aws-lc/util/bot/update_clang.py +8 -2
  488. data/aws-crt-ffi/crt/aws-lc/util/codecov-ci.sh +82 -0
  489. data/aws-crt-ffi/crt/aws-lc/util/convert_wycheproof/convert_wycheproof.go +7 -5
  490. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/ACVP.md +7 -0
  491. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/subprocess/hash.go +24 -9
  492. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/subprocess/rsa.go +3 -4
  493. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/subprocess/subprocess.go +15 -10
  494. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/expected/HMAC-SHA2-512-224.bz2 +0 -0
  495. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/expected/SHA2-512-224.bz2 +0 -0
  496. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/expected/SHAKE-128.bz2 +0 -0
  497. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/expected/SHAKE-256.bz2 +0 -0
  498. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/sha-tests/sha512-224-tests.json +1 -0
  499. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/sha-tests/shake-128-tests.json +1 -0
  500. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/sha-tests/shake-256-tests.json +1 -0
  501. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/tests.json +1 -0
  502. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/vectors/HMAC-SHA2-512-224.bz2 +0 -0
  503. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/vectors/SHA2-512-224.bz2 +0 -0
  504. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/vectors/SHAKE-128.bz2 +0 -0
  505. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/vectors/SHAKE-256.bz2 +0 -0
  506. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/modulewrapper/main.cc +4 -0
  507. data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/modulewrapper/modulewrapper.cc +144 -1
  508. data/aws-crt-ffi/crt/aws-lc/util/fipstools/delocate/delocate.go +9 -3
  509. data/aws-crt-ffi/crt/aws-lc/util/fipstools/delocate/testdata/aarch64-Basic/in.s +4 -0
  510. data/aws-crt-ffi/crt/aws-lc/util/fipstools/delocate/testdata/aarch64-Basic/out.s +11 -0
  511. data/aws-crt-ffi/crt/aws-lc/util/fipstools/inject_hash/inject_hash.go +13 -4
  512. data/aws-crt-ffi/crt/aws-lc/util/fipstools/test-break-kat.sh +2 -0
  513. data/aws-crt-ffi/crt/aws-lc/util/testconfig/testconfig.go +2 -1
  514. data/aws-crt-ffi/crt/s2n/api/s2n.h +9 -5
  515. data/aws-crt-ffi/crt/s2n/bindings/rust/bench/benches/handshake.rs +9 -6
  516. data/aws-crt-ffi/crt/s2n/bindings/rust/bench/benches/resumption.rs +14 -14
  517. data/aws-crt-ffi/crt/s2n/bindings/rust/bench/benches/throughput.rs +9 -6
  518. data/aws-crt-ffi/crt/s2n/bindings/rust/bench/src/harness.rs +106 -102
  519. data/aws-crt-ffi/crt/s2n/bindings/rust/bench/src/openssl.rs +24 -20
  520. data/aws-crt-ffi/crt/s2n/bindings/rust/bench/src/rustls.rs +28 -24
  521. data/aws-crt-ffi/crt/s2n/bindings/rust/bench/src/s2n_tls.rs +52 -50
  522. data/aws-crt-ffi/crt/s2n/bindings/rust/generate/Cargo.toml +1 -0
  523. data/aws-crt-ffi/crt/s2n/bindings/rust/integration/Cargo.toml +3 -0
  524. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/Cargo.toml +2 -2
  525. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/src/connection.rs +9 -0
  526. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/templates/Cargo.template +2 -1
  527. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/Cargo.toml +2 -2
  528. data/aws-crt-ffi/crt/s2n/tests/cbmc/sources/make_common_datastructures.c +9 -2
  529. data/aws-crt-ffi/crt/s2n/tests/fuzz/s2n_client_cert_verify_recv_test.c +1 -1
  530. data/aws-crt-ffi/crt/s2n/tests/fuzz/s2n_hybrid_ecdhe_kyber_r3_fuzz_test.c +1 -1
  531. data/aws-crt-ffi/crt/s2n/tests/fuzz/s2n_tls13_cert_verify_recv_test.c +1 -1
  532. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_version_negotiation.py +4 -4
  533. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_auth_selection_test.c +19 -9
  534. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_auth_handshake_test.c +3 -3
  535. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_cert_verify_test.c +1 -1
  536. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_hello_recv_test.c +1 -1
  537. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_hello_test.c +4 -4
  538. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_signature_algorithms_extension_test.c +4 -5
  539. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_connection_protocol_versions_test.c +390 -0
  540. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_connection_test.c +8 -4
  541. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_handshake_test.c +2 -1
  542. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_quic_support_io_test.c +106 -0
  543. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_security_policies_test.c +6 -2
  544. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_self_talk_offload_signing_test.c +3 -3
  545. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_self_talk_session_resumption_test.c +135 -0
  546. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_server_new_session_ticket_test.c +32 -0
  547. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_server_signature_algorithms_extension_test.c +1 -1
  548. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_signature_algorithms_test.c +307 -283
  549. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_cert_request_test.c +1 -1
  550. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_cert_verify_test.c +18 -17
  551. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_x509_validator_test.c +125 -0
  552. data/aws-crt-ffi/crt/s2n/tls/extensions/s2n_client_signature_algorithms.c +8 -1
  553. data/aws-crt-ffi/crt/s2n/tls/extensions/s2n_client_supported_versions.c +43 -11
  554. data/aws-crt-ffi/crt/s2n/tls/extensions/s2n_client_supported_versions.h +3 -0
  555. data/aws-crt-ffi/crt/s2n/tls/extensions/s2n_server_signature_algorithms.c +8 -1
  556. data/aws-crt-ffi/crt/s2n/tls/s2n_auth_selection.c +4 -2
  557. data/aws-crt-ffi/crt/s2n/tls/s2n_client_cert_verify.c +7 -10
  558. data/aws-crt-ffi/crt/s2n/tls/s2n_client_hello.c +2 -2
  559. data/aws-crt-ffi/crt/s2n/tls/s2n_connection.c +75 -14
  560. data/aws-crt-ffi/crt/s2n/tls/s2n_handshake.h +2 -2
  561. data/aws-crt-ffi/crt/s2n/tls/s2n_post_handshake.c +1 -1
  562. data/aws-crt-ffi/crt/s2n/tls/s2n_post_handshake.h +1 -0
  563. data/aws-crt-ffi/crt/s2n/tls/s2n_quic_support.c +29 -0
  564. data/aws-crt-ffi/crt/s2n/tls/s2n_quic_support.h +5 -0
  565. data/aws-crt-ffi/crt/s2n/tls/s2n_security_policies.c +40 -0
  566. data/aws-crt-ffi/crt/s2n/tls/s2n_security_policies.h +4 -0
  567. data/aws-crt-ffi/crt/s2n/tls/s2n_server_cert_request.c +1 -1
  568. data/aws-crt-ffi/crt/s2n/tls/s2n_server_hello.c +0 -3
  569. data/aws-crt-ffi/crt/s2n/tls/s2n_server_key_exchange.c +8 -9
  570. data/aws-crt-ffi/crt/s2n/tls/s2n_server_new_session_ticket.c +8 -0
  571. data/aws-crt-ffi/crt/s2n/tls/s2n_signature_algorithms.c +111 -72
  572. data/aws-crt-ffi/crt/s2n/tls/s2n_signature_algorithms.h +11 -9
  573. data/aws-crt-ffi/crt/s2n/tls/s2n_signature_scheme.c +9 -0
  574. data/aws-crt-ffi/crt/s2n/tls/s2n_signature_scheme.h +2 -0
  575. data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_certificate_verify.c +12 -18
  576. data/aws-crt-ffi/crt/s2n/tls/s2n_x509_validator.c +7 -7
  577. data/aws-crt-ffi/src/api.h +1 -0
  578. data/lib/aws-crt/native.rb +1 -1
  579. metadata +68 -5
  580. data/aws-crt-ffi/crt/aws-lc/tests/ci/cdk/cdk/ssm/m1_tests_ssm_document.yaml +0 -34
  581. data/aws-crt-ffi/crt/aws-lc/tests/ci/run_m1_ec2_instance.sh +0 -96
@@ -805,363 +805,1059 @@ curve25519_x25519base_byte_alt_scalarloop:
805
805
  // the Montgomery point at infinity, and Edwards (0,-1) which maps to
806
806
  // Montgomery (0,0) [this is the 2-torsion point] are both by definition
807
807
  // mapped to 0 by the X coordinate mapping used to define curve25519.
808
- //
809
- // First the addition and subtraction:
810
808
 
811
- add_twice4(y_3,x_3,w_3)
812
- sub_twice4(z_3,x_3,w_3)
809
+ add_twice4(t1,x_3,w_3)
810
+ sub_twice4(t2,x_3,w_3)
813
811
 
814
- // Prepare to call the modular inverse function to get x_3 = 1/z_3
812
+ // Prepare to call the modular inverse function to get t0 = 1/t2
815
813
  // Note that this works for the weakly normalized z_3 equally well.
816
814
  // The non-coprime case z_3 == 0 (mod p_25519) cannot arise anyway.
817
815
 
818
- mov x0, 4
819
- add x1, x_3
820
- add x2, z_3
821
- adr x3, curve25519_x25519base_byte_alt_p_25519
822
- add x4, tmpspace
823
-
824
- // Inline copy of bignum_modinv, identical except for stripping out the
825
- // prologue and epilogue saving and restoring registers and the initial
826
- // test for k = 0 (which is trivially false here since k = 4). For more
827
- // details and explanations see "arm/generic/bignum_modinv.S".
828
-
829
- lsl x10, x0, #3
830
- add x21, x4, x10
831
- add x22, x21, x10
832
- mov x10, xzr
833
- curve25519_x25519base_byte_alt_copyloop:
834
- ldr x11, [x2, x10, lsl #3]
835
- ldr x12, [x3, x10, lsl #3]
836
- str x11, [x21, x10, lsl #3]
837
- str x12, [x22, x10, lsl #3]
838
- str x12, [x4, x10, lsl #3]
839
- str xzr, [x1, x10, lsl #3]
840
- add x10, x10, #0x1
841
- cmp x10, x0
842
- b.cc curve25519_x25519base_byte_alt_copyloop
843
- ldr x11, [x4]
844
- sub x12, x11, #0x1
845
- str x12, [x4]
846
- lsl x20, x11, #2
847
- sub x20, x11, x20
848
- eor x20, x20, #0x2
849
- mov x12, #0x1
850
- madd x12, x11, x20, x12
851
- mul x11, x12, x12
852
- madd x20, x12, x20, x20
853
- mul x12, x11, x11
854
- madd x20, x11, x20, x20
855
- mul x11, x12, x12
856
- madd x20, x12, x20, x20
857
- madd x20, x11, x20, x20
858
- lsl x2, x0, #7
859
- curve25519_x25519base_byte_alt_outerloop:
860
- add x10, x2, #0x3f
861
- lsr x5, x10, #6
862
- cmp x5, x0
863
- csel x5, x0, x5, cs
864
- mov x13, xzr
865
- mov x15, xzr
866
- mov x14, xzr
867
- mov x16, xzr
868
- mov x19, xzr
869
- mov x10, xzr
870
- curve25519_x25519base_byte_alt_toploop:
871
- ldr x11, [x21, x10, lsl #3]
872
- ldr x12, [x22, x10, lsl #3]
873
- orr x17, x11, x12
874
- cmp x17, xzr
875
- and x17, x19, x13
876
- csel x15, x17, x15, ne
877
- and x17, x19, x14
878
- csel x16, x17, x16, ne
879
- csel x13, x11, x13, ne
880
- csel x14, x12, x14, ne
881
- csetm x19, ne
882
- add x10, x10, #0x1
883
- cmp x10, x5
884
- b.cc curve25519_x25519base_byte_alt_toploop
885
- orr x11, x13, x14
886
- clz x12, x11
887
- negs x17, x12
888
- lsl x13, x13, x12
889
- csel x15, x15, xzr, ne
890
- lsl x14, x14, x12
891
- csel x16, x16, xzr, ne
892
- lsr x15, x15, x17
893
- lsr x16, x16, x17
894
- orr x13, x13, x15
895
- orr x14, x14, x16
896
- ldr x15, [x21]
897
- ldr x16, [x22]
898
- mov x6, #0x1
899
- mov x7, xzr
900
- mov x8, xzr
901
- mov x9, #0x1
902
- mov x10, #0x3a
903
- tst x15, #0x1
904
- curve25519_x25519base_byte_alt_innerloop:
905
- csel x11, x14, xzr, ne
906
- csel x12, x16, xzr, ne
907
- csel x17, x8, xzr, ne
908
- csel x19, x9, xzr, ne
909
- ccmp x13, x14, #0x2, ne
910
- sub x11, x13, x11
911
- sub x12, x15, x12
912
- csel x14, x14, x13, cs
913
- cneg x11, x11, cc
914
- csel x16, x16, x15, cs
915
- cneg x15, x12, cc
916
- csel x8, x8, x6, cs
917
- csel x9, x9, x7, cs
918
- tst x12, #0x2
919
- add x6, x6, x17
920
- add x7, x7, x19
921
- lsr x13, x11, #1
922
- lsr x15, x15, #1
923
- add x8, x8, x8
924
- add x9, x9, x9
925
- sub x10, x10, #0x1
926
- cbnz x10, curve25519_x25519base_byte_alt_innerloop
927
- mov x13, xzr
928
- mov x14, xzr
929
- mov x17, xzr
930
- mov x19, xzr
931
- mov x10, xzr
932
- curve25519_x25519base_byte_alt_congloop:
933
- ldr x11, [x4, x10, lsl #3]
934
- ldr x12, [x1, x10, lsl #3]
935
- mul x15, x6, x11
936
- mul x16, x7, x12
937
- adds x15, x15, x13
938
- umulh x13, x6, x11
939
- adc x13, x13, xzr
940
- adds x15, x15, x16
941
- extr x17, x15, x17, #58
942
- str x17, [x4, x10, lsl #3]
943
- mov x17, x15
944
- umulh x15, x7, x12
945
- adc x13, x13, x15
946
- mul x15, x8, x11
947
- mul x16, x9, x12
948
- adds x15, x15, x14
949
- umulh x14, x8, x11
950
- adc x14, x14, xzr
951
- adds x15, x15, x16
952
- extr x19, x15, x19, #58
953
- str x19, [x1, x10, lsl #3]
954
- mov x19, x15
955
- umulh x15, x9, x12
956
- adc x14, x14, x15
957
- add x10, x10, #0x1
958
- cmp x10, x0
959
- b.cc curve25519_x25519base_byte_alt_congloop
960
- extr x13, x13, x17, #58
961
- extr x14, x14, x19, #58
962
- ldr x11, [x4]
963
- mul x17, x11, x20
964
- ldr x12, [x3]
965
- mul x15, x17, x12
966
- umulh x16, x17, x12
967
- adds x11, x11, x15
968
- mov x10, #0x1
969
- sub x11, x0, #0x1
970
- cbz x11, curve25519_x25519base_byte_alt_wmontend
971
- curve25519_x25519base_byte_alt_wmontloop:
972
- ldr x11, [x3, x10, lsl #3]
973
- ldr x12, [x4, x10, lsl #3]
974
- mul x15, x17, x11
975
- adcs x12, x12, x16
976
- umulh x16, x17, x11
977
- adc x16, x16, xzr
978
- adds x12, x12, x15
979
- sub x15, x10, #0x1
980
- str x12, [x4, x15, lsl #3]
981
- add x10, x10, #0x1
982
- sub x11, x10, x0
983
- cbnz x11, curve25519_x25519base_byte_alt_wmontloop
984
- curve25519_x25519base_byte_alt_wmontend:
985
- adcs x16, x16, x13
986
- adc x13, xzr, xzr
987
- sub x15, x10, #0x1
988
- str x16, [x4, x15, lsl #3]
989
- negs x10, xzr
990
- curve25519_x25519base_byte_alt_wcmploop:
991
- ldr x11, [x4, x10, lsl #3]
992
- ldr x12, [x3, x10, lsl #3]
993
- sbcs xzr, x11, x12
994
- add x10, x10, #0x1
995
- sub x11, x10, x0
996
- cbnz x11, curve25519_x25519base_byte_alt_wcmploop
997
- sbcs xzr, x13, xzr
998
- csetm x13, cs
999
- negs x10, xzr
1000
- curve25519_x25519base_byte_alt_wcorrloop:
1001
- ldr x11, [x4, x10, lsl #3]
1002
- ldr x12, [x3, x10, lsl #3]
1003
- and x12, x12, x13
1004
- sbcs x11, x11, x12
1005
- str x11, [x4, x10, lsl #3]
1006
- add x10, x10, #0x1
1007
- sub x11, x10, x0
1008
- cbnz x11, curve25519_x25519base_byte_alt_wcorrloop
1009
- ldr x11, [x1]
1010
- mul x17, x11, x20
1011
- ldr x12, [x3]
1012
- mul x15, x17, x12
1013
- umulh x16, x17, x12
1014
- adds x11, x11, x15
1015
- mov x10, #0x1
1016
- sub x11, x0, #0x1
1017
- cbz x11, curve25519_x25519base_byte_alt_zmontend
1018
- curve25519_x25519base_byte_alt_zmontloop:
1019
- ldr x11, [x3, x10, lsl #3]
1020
- ldr x12, [x1, x10, lsl #3]
1021
- mul x15, x17, x11
1022
- adcs x12, x12, x16
1023
- umulh x16, x17, x11
1024
- adc x16, x16, xzr
1025
- adds x12, x12, x15
1026
- sub x15, x10, #0x1
1027
- str x12, [x1, x15, lsl #3]
1028
- add x10, x10, #0x1
1029
- sub x11, x10, x0
1030
- cbnz x11, curve25519_x25519base_byte_alt_zmontloop
1031
- curve25519_x25519base_byte_alt_zmontend:
1032
- adcs x16, x16, x14
1033
- adc x14, xzr, xzr
1034
- sub x15, x10, #0x1
1035
- str x16, [x1, x15, lsl #3]
1036
- negs x10, xzr
1037
- curve25519_x25519base_byte_alt_zcmploop:
1038
- ldr x11, [x1, x10, lsl #3]
1039
- ldr x12, [x3, x10, lsl #3]
1040
- sbcs xzr, x11, x12
1041
- add x10, x10, #0x1
1042
- sub x11, x10, x0
1043
- cbnz x11, curve25519_x25519base_byte_alt_zcmploop
1044
- sbcs xzr, x14, xzr
1045
- csetm x14, cs
1046
- negs x10, xzr
1047
- curve25519_x25519base_byte_alt_zcorrloop:
1048
- ldr x11, [x1, x10, lsl #3]
1049
- ldr x12, [x3, x10, lsl #3]
1050
- and x12, x12, x14
1051
- sbcs x11, x11, x12
1052
- str x11, [x1, x10, lsl #3]
1053
- add x10, x10, #0x1
1054
- sub x11, x10, x0
1055
- cbnz x11, curve25519_x25519base_byte_alt_zcorrloop
1056
- mov x13, xzr
1057
- mov x14, xzr
1058
- mov x17, xzr
1059
- mov x19, xzr
1060
- mov x10, xzr
1061
- curve25519_x25519base_byte_alt_crossloop:
1062
- ldr x11, [x21, x10, lsl #3]
1063
- ldr x12, [x22, x10, lsl #3]
1064
- mul x15, x6, x11
1065
- mul x16, x7, x12
1066
- adds x15, x15, x13
1067
- umulh x13, x6, x11
1068
- adc x13, x13, xzr
1069
- subs x15, x15, x16
1070
- str x15, [x21, x10, lsl #3]
1071
- umulh x15, x7, x12
1072
- sub x17, x15, x17
1073
- sbcs x13, x13, x17
1074
- csetm x17, cc
1075
- mul x15, x8, x11
1076
- mul x16, x9, x12
1077
- adds x15, x15, x14
1078
- umulh x14, x8, x11
1079
- adc x14, x14, xzr
1080
- subs x15, x15, x16
1081
- str x15, [x22, x10, lsl #3]
1082
- umulh x15, x9, x12
1083
- sub x19, x15, x19
1084
- sbcs x14, x14, x19
1085
- csetm x19, cc
1086
- add x10, x10, #0x1
1087
- cmp x10, x5
1088
- b.cc curve25519_x25519base_byte_alt_crossloop
1089
- cmn x17, x17
1090
- ldr x15, [x21]
1091
- mov x10, xzr
1092
- sub x6, x5, #0x1
1093
- cbz x6, curve25519_x25519base_byte_alt_negskip1
1094
- curve25519_x25519base_byte_alt_negloop1:
1095
- add x11, x10, #0x8
1096
- ldr x12, [x21, x11]
1097
- extr x15, x12, x15, #58
1098
- eor x15, x15, x17
1099
- adcs x15, x15, xzr
1100
- str x15, [x21, x10]
1101
- mov x15, x12
1102
- add x10, x10, #0x8
1103
- sub x6, x6, #0x1
1104
- cbnz x6, curve25519_x25519base_byte_alt_negloop1
1105
- curve25519_x25519base_byte_alt_negskip1:
1106
- extr x15, x13, x15, #58
1107
- eor x15, x15, x17
1108
- adcs x15, x15, xzr
1109
- str x15, [x21, x10]
1110
- cmn x19, x19
1111
- ldr x15, [x22]
1112
- mov x10, xzr
1113
- sub x6, x5, #0x1
1114
- cbz x6, curve25519_x25519base_byte_alt_negskip2
1115
- curve25519_x25519base_byte_alt_negloop2:
1116
- add x11, x10, #0x8
1117
- ldr x12, [x22, x11]
1118
- extr x15, x12, x15, #58
1119
- eor x15, x15, x19
1120
- adcs x15, x15, xzr
1121
- str x15, [x22, x10]
1122
- mov x15, x12
1123
- add x10, x10, #0x8
1124
- sub x6, x6, #0x1
1125
- cbnz x6, curve25519_x25519base_byte_alt_negloop2
1126
- curve25519_x25519base_byte_alt_negskip2:
1127
- extr x15, x14, x15, #58
1128
- eor x15, x15, x19
1129
- adcs x15, x15, xzr
1130
- str x15, [x22, x10]
1131
- mov x10, xzr
1132
- cmn x17, x17
1133
- curve25519_x25519base_byte_alt_wfliploop:
1134
- ldr x11, [x3, x10, lsl #3]
1135
- ldr x12, [x4, x10, lsl #3]
1136
- and x11, x11, x17
1137
- eor x12, x12, x17
1138
- adcs x11, x11, x12
1139
- str x11, [x4, x10, lsl #3]
1140
- add x10, x10, #0x1
1141
- sub x11, x10, x0
1142
- cbnz x11, curve25519_x25519base_byte_alt_wfliploop
1143
- mvn x19, x19
1144
- mov x10, xzr
1145
- cmn x19, x19
1146
- curve25519_x25519base_byte_alt_zfliploop:
1147
- ldr x11, [x3, x10, lsl #3]
1148
- ldr x12, [x1, x10, lsl #3]
1149
- and x11, x11, x19
1150
- eor x12, x12, x19
1151
- adcs x11, x11, x12
1152
- str x11, [x1, x10, lsl #3]
1153
- add x10, x10, #0x1
1154
- sub x11, x10, x0
1155
- cbnz x11, curve25519_x25519base_byte_alt_zfliploop
1156
- subs x2, x2, #0x3a
1157
- b.hi curve25519_x25519base_byte_alt_outerloop
816
+ add x0, t0
817
+ add x1, t2
818
+
819
+ // Inline copy of bignum_inv_p25519, identical except for stripping out
820
+ // the prologue and epilogue saving and restoring registers and making
821
+ // and reclaiming room on the stack. For more details and explanations see
822
+ // "arm/curve25519/bignum_inv_p25519.S". Note that the stack it uses for
823
+ // its own temporaries is 128 bytes, so it has no effect on variables
824
+ // that are needed in the rest of our computation here: res, t0, t1, t2.
825
+
826
+ mov x20, x0
827
+ mov x10, #0xffffffffffffffed
828
+ mov x11, #0xffffffffffffffff
829
+ stp x10, x11, [sp]
830
+ mov x12, #0x7fffffffffffffff
831
+ stp x11, x12, [sp, #16]
832
+ ldp x2, x3, [x1]
833
+ ldp x4, x5, [x1, #16]
834
+ mov x7, #0x13
835
+ lsr x6, x5, #63
836
+ madd x6, x7, x6, x7
837
+ adds x2, x2, x6
838
+ adcs x3, x3, xzr
839
+ adcs x4, x4, xzr
840
+ orr x5, x5, #0x8000000000000000
841
+ adcs x5, x5, xzr
842
+ csel x6, x7, xzr, cc
843
+ subs x2, x2, x6
844
+ sbcs x3, x3, xzr
845
+ sbcs x4, x4, xzr
846
+ sbc x5, x5, xzr
847
+ and x5, x5, #0x7fffffffffffffff
848
+ stp x2, x3, [sp, #32]
849
+ stp x4, x5, [sp, #48]
850
+ stp xzr, xzr, [sp, #64]
851
+ stp xzr, xzr, [sp, #80]
852
+ mov x10, #0x2099
853
+ movk x10, #0x7502, lsl #16
854
+ movk x10, #0x9e23, lsl #32
855
+ movk x10, #0xa0f9, lsl #48
856
+ mov x11, #0x2595
857
+ movk x11, #0x1d13, lsl #16
858
+ movk x11, #0x8f3f, lsl #32
859
+ movk x11, #0xa8c6, lsl #48
860
+ mov x12, #0x5242
861
+ movk x12, #0x5ac, lsl #16
862
+ movk x12, #0x8938, lsl #32
863
+ movk x12, #0x6c6c, lsl #48
864
+ mov x13, #0x615
865
+ movk x13, #0x4177, lsl #16
866
+ movk x13, #0x8b2, lsl #32
867
+ movk x13, #0x2765, lsl #48
868
+ stp x10, x11, [sp, #96]
869
+ stp x12, x13, [sp, #112]
870
+ mov x21, #0xa
871
+ mov x22, #0x1
872
+ b curve25519_x25519base_byte_alt_invmidloop
873
+ curve25519_x25519base_byte_alt_invloop:
874
+ cmp x10, xzr
875
+ csetm x14, mi
876
+ cneg x10, x10, mi
877
+ cmp x11, xzr
878
+ csetm x15, mi
879
+ cneg x11, x11, mi
880
+ cmp x12, xzr
881
+ csetm x16, mi
882
+ cneg x12, x12, mi
883
+ cmp x13, xzr
884
+ csetm x17, mi
885
+ cneg x13, x13, mi
886
+ and x0, x10, x14
887
+ and x1, x11, x15
888
+ add x9, x0, x1
889
+ and x0, x12, x16
890
+ and x1, x13, x17
891
+ add x19, x0, x1
892
+ ldr x7, [sp]
893
+ eor x1, x7, x14
894
+ mul x0, x1, x10
895
+ umulh x1, x1, x10
896
+ adds x4, x9, x0
897
+ adc x2, xzr, x1
898
+ ldr x8, [sp, #32]
899
+ eor x1, x8, x15
900
+ mul x0, x1, x11
901
+ umulh x1, x1, x11
902
+ adds x4, x4, x0
903
+ adc x2, x2, x1
904
+ eor x1, x7, x16
905
+ mul x0, x1, x12
906
+ umulh x1, x1, x12
907
+ adds x5, x19, x0
908
+ adc x3, xzr, x1
909
+ eor x1, x8, x17
910
+ mul x0, x1, x13
911
+ umulh x1, x1, x13
912
+ adds x5, x5, x0
913
+ adc x3, x3, x1
914
+ ldr x7, [sp, #8]
915
+ eor x1, x7, x14
916
+ mul x0, x1, x10
917
+ umulh x1, x1, x10
918
+ adds x2, x2, x0
919
+ adc x6, xzr, x1
920
+ ldr x8, [sp, #40]
921
+ eor x1, x8, x15
922
+ mul x0, x1, x11
923
+ umulh x1, x1, x11
924
+ adds x2, x2, x0
925
+ adc x6, x6, x1
926
+ extr x4, x2, x4, #59
927
+ str x4, [sp]
928
+ eor x1, x7, x16
929
+ mul x0, x1, x12
930
+ umulh x1, x1, x12
931
+ adds x3, x3, x0
932
+ adc x4, xzr, x1
933
+ eor x1, x8, x17
934
+ mul x0, x1, x13
935
+ umulh x1, x1, x13
936
+ adds x3, x3, x0
937
+ adc x4, x4, x1
938
+ extr x5, x3, x5, #59
939
+ str x5, [sp, #32]
940
+ ldr x7, [sp, #16]
941
+ eor x1, x7, x14
942
+ mul x0, x1, x10
943
+ umulh x1, x1, x10
944
+ adds x6, x6, x0
945
+ adc x5, xzr, x1
946
+ ldr x8, [sp, #48]
947
+ eor x1, x8, x15
948
+ mul x0, x1, x11
949
+ umulh x1, x1, x11
950
+ adds x6, x6, x0
951
+ adc x5, x5, x1
952
+ extr x2, x6, x2, #59
953
+ str x2, [sp, #8]
954
+ eor x1, x7, x16
955
+ mul x0, x1, x12
956
+ umulh x1, x1, x12
957
+ adds x4, x4, x0
958
+ adc x2, xzr, x1
959
+ eor x1, x8, x17
960
+ mul x0, x1, x13
961
+ umulh x1, x1, x13
962
+ adds x4, x4, x0
963
+ adc x2, x2, x1
964
+ extr x3, x4, x3, #59
965
+ str x3, [sp, #40]
966
+ ldr x7, [sp, #24]
967
+ eor x1, x7, x14
968
+ asr x3, x1, #63
969
+ and x3, x3, x10
970
+ neg x3, x3
971
+ mul x0, x1, x10
972
+ umulh x1, x1, x10
973
+ adds x5, x5, x0
974
+ adc x3, x3, x1
975
+ ldr x8, [sp, #56]
976
+ eor x1, x8, x15
977
+ asr x0, x1, #63
978
+ and x0, x0, x11
979
+ sub x3, x3, x0
980
+ mul x0, x1, x11
981
+ umulh x1, x1, x11
982
+ adds x5, x5, x0
983
+ adc x3, x3, x1
984
+ extr x6, x5, x6, #59
985
+ str x6, [sp, #16]
986
+ extr x5, x3, x5, #59
987
+ str x5, [sp, #24]
988
+ eor x1, x7, x16
989
+ asr x5, x1, #63
990
+ and x5, x5, x12
991
+ neg x5, x5
992
+ mul x0, x1, x12
993
+ umulh x1, x1, x12
994
+ adds x2, x2, x0
995
+ adc x5, x5, x1
996
+ eor x1, x8, x17
997
+ asr x0, x1, #63
998
+ and x0, x0, x13
999
+ sub x5, x5, x0
1000
+ mul x0, x1, x13
1001
+ umulh x1, x1, x13
1002
+ adds x2, x2, x0
1003
+ adc x5, x5, x1
1004
+ extr x4, x2, x4, #59
1005
+ str x4, [sp, #48]
1006
+ extr x2, x5, x2, #59
1007
+ str x2, [sp, #56]
1008
+ ldr x7, [sp, #64]
1009
+ eor x1, x7, x14
1010
+ mul x0, x1, x10
1011
+ umulh x1, x1, x10
1012
+ adds x4, x9, x0
1013
+ adc x2, xzr, x1
1014
+ ldr x8, [sp, #96]
1015
+ eor x1, x8, x15
1016
+ mul x0, x1, x11
1017
+ umulh x1, x1, x11
1018
+ adds x4, x4, x0
1019
+ str x4, [sp, #64]
1020
+ adc x2, x2, x1
1021
+ eor x1, x7, x16
1022
+ mul x0, x1, x12
1023
+ umulh x1, x1, x12
1024
+ adds x5, x19, x0
1025
+ adc x3, xzr, x1
1026
+ eor x1, x8, x17
1027
+ mul x0, x1, x13
1028
+ umulh x1, x1, x13
1029
+ adds x5, x5, x0
1030
+ str x5, [sp, #96]
1031
+ adc x3, x3, x1
1032
+ ldr x7, [sp, #72]
1033
+ eor x1, x7, x14
1034
+ mul x0, x1, x10
1035
+ umulh x1, x1, x10
1036
+ adds x2, x2, x0
1037
+ adc x6, xzr, x1
1038
+ ldr x8, [sp, #104]
1039
+ eor x1, x8, x15
1040
+ mul x0, x1, x11
1041
+ umulh x1, x1, x11
1042
+ adds x2, x2, x0
1043
+ str x2, [sp, #72]
1044
+ adc x6, x6, x1
1045
+ eor x1, x7, x16
1046
+ mul x0, x1, x12
1047
+ umulh x1, x1, x12
1048
+ adds x3, x3, x0
1049
+ adc x4, xzr, x1
1050
+ eor x1, x8, x17
1051
+ mul x0, x1, x13
1052
+ umulh x1, x1, x13
1053
+ adds x3, x3, x0
1054
+ str x3, [sp, #104]
1055
+ adc x4, x4, x1
1056
+ ldr x7, [sp, #80]
1057
+ eor x1, x7, x14
1058
+ mul x0, x1, x10
1059
+ umulh x1, x1, x10
1060
+ adds x6, x6, x0
1061
+ adc x5, xzr, x1
1062
+ ldr x8, [sp, #112]
1063
+ eor x1, x8, x15
1064
+ mul x0, x1, x11
1065
+ umulh x1, x1, x11
1066
+ adds x6, x6, x0
1067
+ str x6, [sp, #80]
1068
+ adc x5, x5, x1
1069
+ eor x1, x7, x16
1070
+ mul x0, x1, x12
1071
+ umulh x1, x1, x12
1072
+ adds x4, x4, x0
1073
+ adc x2, xzr, x1
1074
+ eor x1, x8, x17
1075
+ mul x0, x1, x13
1076
+ umulh x1, x1, x13
1077
+ adds x4, x4, x0
1078
+ str x4, [sp, #112]
1079
+ adc x2, x2, x1
1080
+ ldr x7, [sp, #88]
1081
+ eor x1, x7, x14
1082
+ and x3, x14, x10
1083
+ neg x3, x3
1084
+ mul x0, x1, x10
1085
+ umulh x1, x1, x10
1086
+ adds x5, x5, x0
1087
+ adc x3, x3, x1
1088
+ ldr x8, [sp, #120]
1089
+ eor x1, x8, x15
1090
+ and x0, x15, x11
1091
+ sub x3, x3, x0
1092
+ mul x0, x1, x11
1093
+ umulh x1, x1, x11
1094
+ adds x5, x5, x0
1095
+ adc x3, x3, x1
1096
+ extr x6, x3, x5, #63
1097
+ ldp x0, x1, [sp, #64]
1098
+ add x6, x6, x3, asr #63
1099
+ mov x3, #0x13
1100
+ mul x4, x6, x3
1101
+ add x5, x5, x6, lsl #63
1102
+ smulh x3, x6, x3
1103
+ ldr x6, [sp, #80]
1104
+ adds x0, x0, x4
1105
+ adcs x1, x1, x3
1106
+ asr x3, x3, #63
1107
+ adcs x6, x6, x3
1108
+ adc x5, x5, x3
1109
+ stp x0, x1, [sp, #64]
1110
+ stp x6, x5, [sp, #80]
1111
+ eor x1, x7, x16
1112
+ and x5, x16, x12
1113
+ neg x5, x5
1114
+ mul x0, x1, x12
1115
+ umulh x1, x1, x12
1116
+ adds x2, x2, x0
1117
+ adc x5, x5, x1
1118
+ eor x1, x8, x17
1119
+ and x0, x17, x13
1120
+ sub x5, x5, x0
1121
+ mul x0, x1, x13
1122
+ umulh x1, x1, x13
1123
+ adds x2, x2, x0
1124
+ adc x5, x5, x1
1125
+ extr x6, x5, x2, #63
1126
+ ldp x0, x1, [sp, #96]
1127
+ add x6, x6, x5, asr #63
1128
+ mov x5, #0x13
1129
+ mul x4, x6, x5
1130
+ add x2, x2, x6, lsl #63
1131
+ smulh x5, x6, x5
1132
+ ldr x3, [sp, #112]
1133
+ adds x0, x0, x4
1134
+ adcs x1, x1, x5
1135
+ asr x5, x5, #63
1136
+ adcs x3, x3, x5
1137
+ adc x2, x2, x5
1138
+ stp x0, x1, [sp, #96]
1139
+ stp x3, x2, [sp, #112]
1140
+ curve25519_x25519base_byte_alt_invmidloop:
1141
+ mov x1, x22
1142
+ ldr x2, [sp]
1143
+ ldr x3, [sp, #32]
1144
+ and x4, x2, #0xfffff
1145
+ orr x4, x4, #0xfffffe0000000000
1146
+ and x5, x3, #0xfffff
1147
+ orr x5, x5, #0xc000000000000000
1148
+ tst x5, #0x1
1149
+ csel x6, x4, xzr, ne
1150
+ ccmp x1, xzr, #0x8, ne
1151
+ cneg x1, x1, ge
1152
+ cneg x6, x6, ge
1153
+ csel x4, x5, x4, ge
1154
+ add x5, x5, x6
1155
+ add x1, x1, #0x2
1156
+ tst x5, #0x2
1157
+ asr x5, x5, #1
1158
+ csel x6, x4, xzr, ne
1159
+ ccmp x1, xzr, #0x8, ne
1160
+ cneg x1, x1, ge
1161
+ cneg x6, x6, ge
1162
+ csel x4, x5, x4, ge
1163
+ add x5, x5, x6
1164
+ add x1, x1, #0x2
1165
+ tst x5, #0x2
1166
+ asr x5, x5, #1
1167
+ csel x6, x4, xzr, ne
1168
+ ccmp x1, xzr, #0x8, ne
1169
+ cneg x1, x1, ge
1170
+ cneg x6, x6, ge
1171
+ csel x4, x5, x4, ge
1172
+ add x5, x5, x6
1173
+ add x1, x1, #0x2
1174
+ tst x5, #0x2
1175
+ asr x5, x5, #1
1176
+ csel x6, x4, xzr, ne
1177
+ ccmp x1, xzr, #0x8, ne
1178
+ cneg x1, x1, ge
1179
+ cneg x6, x6, ge
1180
+ csel x4, x5, x4, ge
1181
+ add x5, x5, x6
1182
+ add x1, x1, #0x2
1183
+ tst x5, #0x2
1184
+ asr x5, x5, #1
1185
+ csel x6, x4, xzr, ne
1186
+ ccmp x1, xzr, #0x8, ne
1187
+ cneg x1, x1, ge
1188
+ cneg x6, x6, ge
1189
+ csel x4, x5, x4, ge
1190
+ add x5, x5, x6
1191
+ add x1, x1, #0x2
1192
+ tst x5, #0x2
1193
+ asr x5, x5, #1
1194
+ csel x6, x4, xzr, ne
1195
+ ccmp x1, xzr, #0x8, ne
1196
+ cneg x1, x1, ge
1197
+ cneg x6, x6, ge
1198
+ csel x4, x5, x4, ge
1199
+ add x5, x5, x6
1200
+ add x1, x1, #0x2
1201
+ tst x5, #0x2
1202
+ asr x5, x5, #1
1203
+ csel x6, x4, xzr, ne
1204
+ ccmp x1, xzr, #0x8, ne
1205
+ cneg x1, x1, ge
1206
+ cneg x6, x6, ge
1207
+ csel x4, x5, x4, ge
1208
+ add x5, x5, x6
1209
+ add x1, x1, #0x2
1210
+ tst x5, #0x2
1211
+ asr x5, x5, #1
1212
+ csel x6, x4, xzr, ne
1213
+ ccmp x1, xzr, #0x8, ne
1214
+ cneg x1, x1, ge
1215
+ cneg x6, x6, ge
1216
+ csel x4, x5, x4, ge
1217
+ add x5, x5, x6
1218
+ add x1, x1, #0x2
1219
+ tst x5, #0x2
1220
+ asr x5, x5, #1
1221
+ csel x6, x4, xzr, ne
1222
+ ccmp x1, xzr, #0x8, ne
1223
+ cneg x1, x1, ge
1224
+ cneg x6, x6, ge
1225
+ csel x4, x5, x4, ge
1226
+ add x5, x5, x6
1227
+ add x1, x1, #0x2
1228
+ tst x5, #0x2
1229
+ asr x5, x5, #1
1230
+ csel x6, x4, xzr, ne
1231
+ ccmp x1, xzr, #0x8, ne
1232
+ cneg x1, x1, ge
1233
+ cneg x6, x6, ge
1234
+ csel x4, x5, x4, ge
1235
+ add x5, x5, x6
1236
+ add x1, x1, #0x2
1237
+ tst x5, #0x2
1238
+ asr x5, x5, #1
1239
+ csel x6, x4, xzr, ne
1240
+ ccmp x1, xzr, #0x8, ne
1241
+ cneg x1, x1, ge
1242
+ cneg x6, x6, ge
1243
+ csel x4, x5, x4, ge
1244
+ add x5, x5, x6
1245
+ add x1, x1, #0x2
1246
+ tst x5, #0x2
1247
+ asr x5, x5, #1
1248
+ csel x6, x4, xzr, ne
1249
+ ccmp x1, xzr, #0x8, ne
1250
+ cneg x1, x1, ge
1251
+ cneg x6, x6, ge
1252
+ csel x4, x5, x4, ge
1253
+ add x5, x5, x6
1254
+ add x1, x1, #0x2
1255
+ tst x5, #0x2
1256
+ asr x5, x5, #1
1257
+ csel x6, x4, xzr, ne
1258
+ ccmp x1, xzr, #0x8, ne
1259
+ cneg x1, x1, ge
1260
+ cneg x6, x6, ge
1261
+ csel x4, x5, x4, ge
1262
+ add x5, x5, x6
1263
+ add x1, x1, #0x2
1264
+ tst x5, #0x2
1265
+ asr x5, x5, #1
1266
+ csel x6, x4, xzr, ne
1267
+ ccmp x1, xzr, #0x8, ne
1268
+ cneg x1, x1, ge
1269
+ cneg x6, x6, ge
1270
+ csel x4, x5, x4, ge
1271
+ add x5, x5, x6
1272
+ add x1, x1, #0x2
1273
+ tst x5, #0x2
1274
+ asr x5, x5, #1
1275
+ csel x6, x4, xzr, ne
1276
+ ccmp x1, xzr, #0x8, ne
1277
+ cneg x1, x1, ge
1278
+ cneg x6, x6, ge
1279
+ csel x4, x5, x4, ge
1280
+ add x5, x5, x6
1281
+ add x1, x1, #0x2
1282
+ tst x5, #0x2
1283
+ asr x5, x5, #1
1284
+ csel x6, x4, xzr, ne
1285
+ ccmp x1, xzr, #0x8, ne
1286
+ cneg x1, x1, ge
1287
+ cneg x6, x6, ge
1288
+ csel x4, x5, x4, ge
1289
+ add x5, x5, x6
1290
+ add x1, x1, #0x2
1291
+ tst x5, #0x2
1292
+ asr x5, x5, #1
1293
+ csel x6, x4, xzr, ne
1294
+ ccmp x1, xzr, #0x8, ne
1295
+ cneg x1, x1, ge
1296
+ cneg x6, x6, ge
1297
+ csel x4, x5, x4, ge
1298
+ add x5, x5, x6
1299
+ add x1, x1, #0x2
1300
+ tst x5, #0x2
1301
+ asr x5, x5, #1
1302
+ csel x6, x4, xzr, ne
1303
+ ccmp x1, xzr, #0x8, ne
1304
+ cneg x1, x1, ge
1305
+ cneg x6, x6, ge
1306
+ csel x4, x5, x4, ge
1307
+ add x5, x5, x6
1308
+ add x1, x1, #0x2
1309
+ tst x5, #0x2
1310
+ asr x5, x5, #1
1311
+ csel x6, x4, xzr, ne
1312
+ ccmp x1, xzr, #0x8, ne
1313
+ cneg x1, x1, ge
1314
+ cneg x6, x6, ge
1315
+ csel x4, x5, x4, ge
1316
+ add x5, x5, x6
1317
+ add x1, x1, #0x2
1318
+ tst x5, #0x2
1319
+ asr x5, x5, #1
1320
+ csel x6, x4, xzr, ne
1321
+ ccmp x1, xzr, #0x8, ne
1322
+ cneg x1, x1, ge
1323
+ cneg x6, x6, ge
1324
+ csel x4, x5, x4, ge
1325
+ add x5, x5, x6
1326
+ add x1, x1, #0x2
1327
+ asr x5, x5, #1
1328
+ add x8, x4, #0x100, lsl #12
1329
+ sbfx x8, x8, #21, #21
1330
+ mov x11, #0x100000
1331
+ add x11, x11, x11, lsl #21
1332
+ add x9, x4, x11
1333
+ asr x9, x9, #42
1334
+ add x10, x5, #0x100, lsl #12
1335
+ sbfx x10, x10, #21, #21
1336
+ add x11, x5, x11
1337
+ asr x11, x11, #42
1338
+ mul x6, x8, x2
1339
+ mul x7, x9, x3
1340
+ mul x2, x10, x2
1341
+ mul x3, x11, x3
1342
+ add x4, x6, x7
1343
+ add x5, x2, x3
1344
+ asr x2, x4, #20
1345
+ asr x3, x5, #20
1346
+ and x4, x2, #0xfffff
1347
+ orr x4, x4, #0xfffffe0000000000
1348
+ and x5, x3, #0xfffff
1349
+ orr x5, x5, #0xc000000000000000
1350
+ tst x5, #0x1
1351
+ csel x6, x4, xzr, ne
1352
+ ccmp x1, xzr, #0x8, ne
1353
+ cneg x1, x1, ge
1354
+ cneg x6, x6, ge
1355
+ csel x4, x5, x4, ge
1356
+ add x5, x5, x6
1357
+ add x1, x1, #0x2
1358
+ tst x5, #0x2
1359
+ asr x5, x5, #1
1360
+ csel x6, x4, xzr, ne
1361
+ ccmp x1, xzr, #0x8, ne
1362
+ cneg x1, x1, ge
1363
+ cneg x6, x6, ge
1364
+ csel x4, x5, x4, ge
1365
+ add x5, x5, x6
1366
+ add x1, x1, #0x2
1367
+ tst x5, #0x2
1368
+ asr x5, x5, #1
1369
+ csel x6, x4, xzr, ne
1370
+ ccmp x1, xzr, #0x8, ne
1371
+ cneg x1, x1, ge
1372
+ cneg x6, x6, ge
1373
+ csel x4, x5, x4, ge
1374
+ add x5, x5, x6
1375
+ add x1, x1, #0x2
1376
+ tst x5, #0x2
1377
+ asr x5, x5, #1
1378
+ csel x6, x4, xzr, ne
1379
+ ccmp x1, xzr, #0x8, ne
1380
+ cneg x1, x1, ge
1381
+ cneg x6, x6, ge
1382
+ csel x4, x5, x4, ge
1383
+ add x5, x5, x6
1384
+ add x1, x1, #0x2
1385
+ tst x5, #0x2
1386
+ asr x5, x5, #1
1387
+ csel x6, x4, xzr, ne
1388
+ ccmp x1, xzr, #0x8, ne
1389
+ cneg x1, x1, ge
1390
+ cneg x6, x6, ge
1391
+ csel x4, x5, x4, ge
1392
+ add x5, x5, x6
1393
+ add x1, x1, #0x2
1394
+ tst x5, #0x2
1395
+ asr x5, x5, #1
1396
+ csel x6, x4, xzr, ne
1397
+ ccmp x1, xzr, #0x8, ne
1398
+ cneg x1, x1, ge
1399
+ cneg x6, x6, ge
1400
+ csel x4, x5, x4, ge
1401
+ add x5, x5, x6
1402
+ add x1, x1, #0x2
1403
+ tst x5, #0x2
1404
+ asr x5, x5, #1
1405
+ csel x6, x4, xzr, ne
1406
+ ccmp x1, xzr, #0x8, ne
1407
+ cneg x1, x1, ge
1408
+ cneg x6, x6, ge
1409
+ csel x4, x5, x4, ge
1410
+ add x5, x5, x6
1411
+ add x1, x1, #0x2
1412
+ tst x5, #0x2
1413
+ asr x5, x5, #1
1414
+ csel x6, x4, xzr, ne
1415
+ ccmp x1, xzr, #0x8, ne
1416
+ cneg x1, x1, ge
1417
+ cneg x6, x6, ge
1418
+ csel x4, x5, x4, ge
1419
+ add x5, x5, x6
1420
+ add x1, x1, #0x2
1421
+ tst x5, #0x2
1422
+ asr x5, x5, #1
1423
+ csel x6, x4, xzr, ne
1424
+ ccmp x1, xzr, #0x8, ne
1425
+ cneg x1, x1, ge
1426
+ cneg x6, x6, ge
1427
+ csel x4, x5, x4, ge
1428
+ add x5, x5, x6
1429
+ add x1, x1, #0x2
1430
+ tst x5, #0x2
1431
+ asr x5, x5, #1
1432
+ csel x6, x4, xzr, ne
1433
+ ccmp x1, xzr, #0x8, ne
1434
+ cneg x1, x1, ge
1435
+ cneg x6, x6, ge
1436
+ csel x4, x5, x4, ge
1437
+ add x5, x5, x6
1438
+ add x1, x1, #0x2
1439
+ tst x5, #0x2
1440
+ asr x5, x5, #1
1441
+ csel x6, x4, xzr, ne
1442
+ ccmp x1, xzr, #0x8, ne
1443
+ cneg x1, x1, ge
1444
+ cneg x6, x6, ge
1445
+ csel x4, x5, x4, ge
1446
+ add x5, x5, x6
1447
+ add x1, x1, #0x2
1448
+ tst x5, #0x2
1449
+ asr x5, x5, #1
1450
+ csel x6, x4, xzr, ne
1451
+ ccmp x1, xzr, #0x8, ne
1452
+ cneg x1, x1, ge
1453
+ cneg x6, x6, ge
1454
+ csel x4, x5, x4, ge
1455
+ add x5, x5, x6
1456
+ add x1, x1, #0x2
1457
+ tst x5, #0x2
1458
+ asr x5, x5, #1
1459
+ csel x6, x4, xzr, ne
1460
+ ccmp x1, xzr, #0x8, ne
1461
+ cneg x1, x1, ge
1462
+ cneg x6, x6, ge
1463
+ csel x4, x5, x4, ge
1464
+ add x5, x5, x6
1465
+ add x1, x1, #0x2
1466
+ tst x5, #0x2
1467
+ asr x5, x5, #1
1468
+ csel x6, x4, xzr, ne
1469
+ ccmp x1, xzr, #0x8, ne
1470
+ cneg x1, x1, ge
1471
+ cneg x6, x6, ge
1472
+ csel x4, x5, x4, ge
1473
+ add x5, x5, x6
1474
+ add x1, x1, #0x2
1475
+ tst x5, #0x2
1476
+ asr x5, x5, #1
1477
+ csel x6, x4, xzr, ne
1478
+ ccmp x1, xzr, #0x8, ne
1479
+ cneg x1, x1, ge
1480
+ cneg x6, x6, ge
1481
+ csel x4, x5, x4, ge
1482
+ add x5, x5, x6
1483
+ add x1, x1, #0x2
1484
+ tst x5, #0x2
1485
+ asr x5, x5, #1
1486
+ csel x6, x4, xzr, ne
1487
+ ccmp x1, xzr, #0x8, ne
1488
+ cneg x1, x1, ge
1489
+ cneg x6, x6, ge
1490
+ csel x4, x5, x4, ge
1491
+ add x5, x5, x6
1492
+ add x1, x1, #0x2
1493
+ tst x5, #0x2
1494
+ asr x5, x5, #1
1495
+ csel x6, x4, xzr, ne
1496
+ ccmp x1, xzr, #0x8, ne
1497
+ cneg x1, x1, ge
1498
+ cneg x6, x6, ge
1499
+ csel x4, x5, x4, ge
1500
+ add x5, x5, x6
1501
+ add x1, x1, #0x2
1502
+ tst x5, #0x2
1503
+ asr x5, x5, #1
1504
+ csel x6, x4, xzr, ne
1505
+ ccmp x1, xzr, #0x8, ne
1506
+ cneg x1, x1, ge
1507
+ cneg x6, x6, ge
1508
+ csel x4, x5, x4, ge
1509
+ add x5, x5, x6
1510
+ add x1, x1, #0x2
1511
+ tst x5, #0x2
1512
+ asr x5, x5, #1
1513
+ csel x6, x4, xzr, ne
1514
+ ccmp x1, xzr, #0x8, ne
1515
+ cneg x1, x1, ge
1516
+ cneg x6, x6, ge
1517
+ csel x4, x5, x4, ge
1518
+ add x5, x5, x6
1519
+ add x1, x1, #0x2
1520
+ tst x5, #0x2
1521
+ asr x5, x5, #1
1522
+ csel x6, x4, xzr, ne
1523
+ ccmp x1, xzr, #0x8, ne
1524
+ cneg x1, x1, ge
1525
+ cneg x6, x6, ge
1526
+ csel x4, x5, x4, ge
1527
+ add x5, x5, x6
1528
+ add x1, x1, #0x2
1529
+ asr x5, x5, #1
1530
+ add x12, x4, #0x100, lsl #12
1531
+ sbfx x12, x12, #21, #21
1532
+ mov x15, #0x100000
1533
+ add x15, x15, x15, lsl #21
1534
+ add x13, x4, x15
1535
+ asr x13, x13, #42
1536
+ add x14, x5, #0x100, lsl #12
1537
+ sbfx x14, x14, #21, #21
1538
+ add x15, x5, x15
1539
+ asr x15, x15, #42
1540
+ mul x6, x12, x2
1541
+ mul x7, x13, x3
1542
+ mul x2, x14, x2
1543
+ mul x3, x15, x3
1544
+ add x4, x6, x7
1545
+ add x5, x2, x3
1546
+ asr x2, x4, #20
1547
+ asr x3, x5, #20
1548
+ and x4, x2, #0xfffff
1549
+ orr x4, x4, #0xfffffe0000000000
1550
+ and x5, x3, #0xfffff
1551
+ orr x5, x5, #0xc000000000000000
1552
+ tst x5, #0x1
1553
+ csel x6, x4, xzr, ne
1554
+ ccmp x1, xzr, #0x8, ne
1555
+ cneg x1, x1, ge
1556
+ cneg x6, x6, ge
1557
+ csel x4, x5, x4, ge
1558
+ add x5, x5, x6
1559
+ add x1, x1, #0x2
1560
+ tst x5, #0x2
1561
+ asr x5, x5, #1
1562
+ csel x6, x4, xzr, ne
1563
+ ccmp x1, xzr, #0x8, ne
1564
+ cneg x1, x1, ge
1565
+ cneg x6, x6, ge
1566
+ csel x4, x5, x4, ge
1567
+ add x5, x5, x6
1568
+ add x1, x1, #0x2
1569
+ tst x5, #0x2
1570
+ asr x5, x5, #1
1571
+ csel x6, x4, xzr, ne
1572
+ ccmp x1, xzr, #0x8, ne
1573
+ cneg x1, x1, ge
1574
+ cneg x6, x6, ge
1575
+ csel x4, x5, x4, ge
1576
+ add x5, x5, x6
1577
+ add x1, x1, #0x2
1578
+ tst x5, #0x2
1579
+ asr x5, x5, #1
1580
+ csel x6, x4, xzr, ne
1581
+ ccmp x1, xzr, #0x8, ne
1582
+ cneg x1, x1, ge
1583
+ cneg x6, x6, ge
1584
+ csel x4, x5, x4, ge
1585
+ add x5, x5, x6
1586
+ add x1, x1, #0x2
1587
+ tst x5, #0x2
1588
+ asr x5, x5, #1
1589
+ csel x6, x4, xzr, ne
1590
+ ccmp x1, xzr, #0x8, ne
1591
+ cneg x1, x1, ge
1592
+ cneg x6, x6, ge
1593
+ csel x4, x5, x4, ge
1594
+ add x5, x5, x6
1595
+ add x1, x1, #0x2
1596
+ tst x5, #0x2
1597
+ asr x5, x5, #1
1598
+ csel x6, x4, xzr, ne
1599
+ ccmp x1, xzr, #0x8, ne
1600
+ cneg x1, x1, ge
1601
+ cneg x6, x6, ge
1602
+ csel x4, x5, x4, ge
1603
+ add x5, x5, x6
1604
+ add x1, x1, #0x2
1605
+ tst x5, #0x2
1606
+ asr x5, x5, #1
1607
+ csel x6, x4, xzr, ne
1608
+ ccmp x1, xzr, #0x8, ne
1609
+ cneg x1, x1, ge
1610
+ cneg x6, x6, ge
1611
+ csel x4, x5, x4, ge
1612
+ add x5, x5, x6
1613
+ add x1, x1, #0x2
1614
+ tst x5, #0x2
1615
+ asr x5, x5, #1
1616
+ csel x6, x4, xzr, ne
1617
+ ccmp x1, xzr, #0x8, ne
1618
+ cneg x1, x1, ge
1619
+ cneg x6, x6, ge
1620
+ csel x4, x5, x4, ge
1621
+ add x5, x5, x6
1622
+ add x1, x1, #0x2
1623
+ tst x5, #0x2
1624
+ asr x5, x5, #1
1625
+ csel x6, x4, xzr, ne
1626
+ ccmp x1, xzr, #0x8, ne
1627
+ cneg x1, x1, ge
1628
+ cneg x6, x6, ge
1629
+ csel x4, x5, x4, ge
1630
+ add x5, x5, x6
1631
+ add x1, x1, #0x2
1632
+ tst x5, #0x2
1633
+ asr x5, x5, #1
1634
+ csel x6, x4, xzr, ne
1635
+ ccmp x1, xzr, #0x8, ne
1636
+ cneg x1, x1, ge
1637
+ cneg x6, x6, ge
1638
+ csel x4, x5, x4, ge
1639
+ add x5, x5, x6
1640
+ add x1, x1, #0x2
1641
+ tst x5, #0x2
1642
+ asr x5, x5, #1
1643
+ mul x2, x12, x8
1644
+ mul x3, x12, x9
1645
+ mul x6, x14, x8
1646
+ mul x7, x14, x9
1647
+ madd x8, x13, x10, x2
1648
+ madd x9, x13, x11, x3
1649
+ madd x16, x15, x10, x6
1650
+ madd x17, x15, x11, x7
1651
+ csel x6, x4, xzr, ne
1652
+ ccmp x1, xzr, #0x8, ne
1653
+ cneg x1, x1, ge
1654
+ cneg x6, x6, ge
1655
+ csel x4, x5, x4, ge
1656
+ add x5, x5, x6
1657
+ add x1, x1, #0x2
1658
+ tst x5, #0x2
1659
+ asr x5, x5, #1
1660
+ csel x6, x4, xzr, ne
1661
+ ccmp x1, xzr, #0x8, ne
1662
+ cneg x1, x1, ge
1663
+ cneg x6, x6, ge
1664
+ csel x4, x5, x4, ge
1665
+ add x5, x5, x6
1666
+ add x1, x1, #0x2
1667
+ tst x5, #0x2
1668
+ asr x5, x5, #1
1669
+ csel x6, x4, xzr, ne
1670
+ ccmp x1, xzr, #0x8, ne
1671
+ cneg x1, x1, ge
1672
+ cneg x6, x6, ge
1673
+ csel x4, x5, x4, ge
1674
+ add x5, x5, x6
1675
+ add x1, x1, #0x2
1676
+ tst x5, #0x2
1677
+ asr x5, x5, #1
1678
+ csel x6, x4, xzr, ne
1679
+ ccmp x1, xzr, #0x8, ne
1680
+ cneg x1, x1, ge
1681
+ cneg x6, x6, ge
1682
+ csel x4, x5, x4, ge
1683
+ add x5, x5, x6
1684
+ add x1, x1, #0x2
1685
+ tst x5, #0x2
1686
+ asr x5, x5, #1
1687
+ csel x6, x4, xzr, ne
1688
+ ccmp x1, xzr, #0x8, ne
1689
+ cneg x1, x1, ge
1690
+ cneg x6, x6, ge
1691
+ csel x4, x5, x4, ge
1692
+ add x5, x5, x6
1693
+ add x1, x1, #0x2
1694
+ tst x5, #0x2
1695
+ asr x5, x5, #1
1696
+ csel x6, x4, xzr, ne
1697
+ ccmp x1, xzr, #0x8, ne
1698
+ cneg x1, x1, ge
1699
+ cneg x6, x6, ge
1700
+ csel x4, x5, x4, ge
1701
+ add x5, x5, x6
1702
+ add x1, x1, #0x2
1703
+ tst x5, #0x2
1704
+ asr x5, x5, #1
1705
+ csel x6, x4, xzr, ne
1706
+ ccmp x1, xzr, #0x8, ne
1707
+ cneg x1, x1, ge
1708
+ cneg x6, x6, ge
1709
+ csel x4, x5, x4, ge
1710
+ add x5, x5, x6
1711
+ add x1, x1, #0x2
1712
+ tst x5, #0x2
1713
+ asr x5, x5, #1
1714
+ csel x6, x4, xzr, ne
1715
+ ccmp x1, xzr, #0x8, ne
1716
+ cneg x1, x1, ge
1717
+ cneg x6, x6, ge
1718
+ csel x4, x5, x4, ge
1719
+ add x5, x5, x6
1720
+ add x1, x1, #0x2
1721
+ tst x5, #0x2
1722
+ asr x5, x5, #1
1723
+ csel x6, x4, xzr, ne
1724
+ ccmp x1, xzr, #0x8, ne
1725
+ cneg x1, x1, ge
1726
+ cneg x6, x6, ge
1727
+ csel x4, x5, x4, ge
1728
+ add x5, x5, x6
1729
+ add x1, x1, #0x2
1730
+ asr x5, x5, #1
1731
+ add x12, x4, #0x100, lsl #12
1732
+ sbfx x12, x12, #22, #21
1733
+ mov x15, #0x100000
1734
+ add x15, x15, x15, lsl #21
1735
+ add x13, x4, x15
1736
+ asr x13, x13, #43
1737
+ add x14, x5, #0x100, lsl #12
1738
+ sbfx x14, x14, #22, #21
1739
+ add x15, x5, x15
1740
+ asr x15, x15, #43
1741
+ mneg x2, x12, x8
1742
+ mneg x3, x12, x9
1743
+ mneg x4, x14, x8
1744
+ mneg x5, x14, x9
1745
+ msub x10, x13, x16, x2
1746
+ msub x11, x13, x17, x3
1747
+ msub x12, x15, x16, x4
1748
+ msub x13, x15, x17, x5
1749
+ mov x22, x1
1750
+ subs x21, x21, #0x1
1751
+ b.ne curve25519_x25519base_byte_alt_invloop
1752
+ ldr x0, [sp]
1753
+ ldr x1, [sp, #32]
1754
+ mul x0, x0, x10
1755
+ madd x1, x1, x11, x0
1756
+ asr x0, x1, #63
1757
+ cmp x10, xzr
1758
+ csetm x14, mi
1759
+ cneg x10, x10, mi
1760
+ eor x14, x14, x0
1761
+ cmp x11, xzr
1762
+ csetm x15, mi
1763
+ cneg x11, x11, mi
1764
+ eor x15, x15, x0
1765
+ cmp x12, xzr
1766
+ csetm x16, mi
1767
+ cneg x12, x12, mi
1768
+ eor x16, x16, x0
1769
+ cmp x13, xzr
1770
+ csetm x17, mi
1771
+ cneg x13, x13, mi
1772
+ eor x17, x17, x0
1773
+ and x0, x10, x14
1774
+ and x1, x11, x15
1775
+ add x9, x0, x1
1776
+ ldr x7, [sp, #64]
1777
+ eor x1, x7, x14
1778
+ mul x0, x1, x10
1779
+ umulh x1, x1, x10
1780
+ adds x4, x9, x0
1781
+ adc x2, xzr, x1
1782
+ ldr x8, [sp, #96]
1783
+ eor x1, x8, x15
1784
+ mul x0, x1, x11
1785
+ umulh x1, x1, x11
1786
+ adds x4, x4, x0
1787
+ str x4, [sp, #64]
1788
+ adc x2, x2, x1
1789
+ ldr x7, [sp, #72]
1790
+ eor x1, x7, x14
1791
+ mul x0, x1, x10
1792
+ umulh x1, x1, x10
1793
+ adds x2, x2, x0
1794
+ adc x6, xzr, x1
1795
+ ldr x8, [sp, #104]
1796
+ eor x1, x8, x15
1797
+ mul x0, x1, x11
1798
+ umulh x1, x1, x11
1799
+ adds x2, x2, x0
1800
+ str x2, [sp, #72]
1801
+ adc x6, x6, x1
1802
+ ldr x7, [sp, #80]
1803
+ eor x1, x7, x14
1804
+ mul x0, x1, x10
1805
+ umulh x1, x1, x10
1806
+ adds x6, x6, x0
1807
+ adc x5, xzr, x1
1808
+ ldr x8, [sp, #112]
1809
+ eor x1, x8, x15
1810
+ mul x0, x1, x11
1811
+ umulh x1, x1, x11
1812
+ adds x6, x6, x0
1813
+ str x6, [sp, #80]
1814
+ adc x5, x5, x1
1815
+ ldr x7, [sp, #88]
1816
+ eor x1, x7, x14
1817
+ and x3, x14, x10
1818
+ neg x3, x3
1819
+ mul x0, x1, x10
1820
+ umulh x1, x1, x10
1821
+ adds x5, x5, x0
1822
+ adc x3, x3, x1
1823
+ ldr x8, [sp, #120]
1824
+ eor x1, x8, x15
1825
+ and x0, x15, x11
1826
+ sub x3, x3, x0
1827
+ mul x0, x1, x11
1828
+ umulh x1, x1, x11
1829
+ adds x5, x5, x0
1830
+ adc x3, x3, x1
1831
+ extr x6, x3, x5, #63
1832
+ ldp x0, x1, [sp, #64]
1833
+ tst x3, x3
1834
+ cinc x6, x6, pl
1835
+ mov x3, #0x13
1836
+ mul x4, x6, x3
1837
+ add x5, x5, x6, lsl #63
1838
+ smulh x6, x6, x3
1839
+ ldr x2, [sp, #80]
1840
+ adds x0, x0, x4
1841
+ adcs x1, x1, x6
1842
+ asr x6, x6, #63
1843
+ adcs x2, x2, x6
1844
+ adcs x5, x5, x6
1845
+ csel x3, x3, xzr, mi
1846
+ subs x0, x0, x3
1847
+ sbcs x1, x1, xzr
1848
+ sbcs x2, x2, xzr
1849
+ sbc x5, x5, xzr
1850
+ and x5, x5, #0x7fffffffffffffff
1851
+ mov x4, x20
1852
+ stp x0, x1, [x4]
1853
+ stp x2, x5, [x4, #16]
1158
1854
 
1159
1855
  // The final result is (X + T) / (X - T)
1160
1856
  // This is the only operation in the whole computation that
1161
1857
  // fully reduces modulo p_25519 since now we want the canonical
1162
1858
  // answer as output.
1163
1859
 
1164
- mul_p25519(x_1,y_3,x_3)
1860
+ mul_p25519(x_1,t1,t0)
1165
1861
 
1166
1862
  ldp x10, x11, [x_1]
1167
1863
  strb w10, [resx]
@@ -1229,6 +1925,7 @@ curve25519_x25519base_byte_alt_zfliploop:
1229
1925
  lsr x13, x13, #8
1230
1926
  strb w13, [resx+31]
1231
1927
 
1928
+
1232
1929
  // Restore stack and registers
1233
1930
 
1234
1931
  add sp, sp, #NSPACE
@@ -1246,14 +1943,6 @@ curve25519_x25519base_byte_alt_zfliploop:
1246
1943
  // .section .rodata
1247
1944
  // ****************************************************************************
1248
1945
 
1249
- // The modulus p_25519 = 2^255 - 19, for the modular inverse
1250
-
1251
- curve25519_x25519base_byte_alt_p_25519:
1252
- .quad 0xffffffffffffffed
1253
- .quad 0xffffffffffffffff
1254
- .quad 0xffffffffffffffff
1255
- .quad 0x7fffffffffffffff
1256
-
1257
1946
  // 2^254 * G and (2^254 + 8) * G in extended-projective coordinates
1258
1947
  // but with Z = 1 assumed and hence left out, so they are (X,Y,T) only.
1259
1948