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
@@ -13,7 +13,8 @@
13
13
  // this returns the X coordinate of n * P = (X, Y), or 0 when n * P is the
14
14
  // point at infinity. Both n and X inputs are first slightly modified/mangled
15
15
  // as specified in the relevant RFC (https://www.rfc-editor.org/rfc/rfc7748);
16
- // in particular the lower three bits of n are set to zero.
16
+ // in particular the lower three bits of n are set to zero. Does not implement
17
+ // the zero-check specified in Section 6.1.
17
18
  //
18
19
  // Standard ARM ABI: X0 = res, X1 = scalar, X2 = point
19
20
  // ----------------------------------------------------------------------------
@@ -751,356 +752,1046 @@ curve25519_x25519_byte_alt_scalarloop:
751
752
  mul_p25519(zn,p,e)
752
753
 
753
754
  // The projective result of the scalar multiplication is now (xn,zn).
754
- // First set up the constant sn = 2^255 - 19 for the modular inverse.
755
-
756
- mov x0, #-19
757
- mov x1, #-1
758
- mov x2, #0x7fffffffffffffff
759
- stp x0, x1, [sn]
760
- stp x1, x2, [sn+16]
761
-
762
- // Prepare to call the modular inverse function to get zm = 1/zn
763
-
764
- mov x0, #4
765
- add x1, zm
766
- add x2, zn
767
- add x3, sn
768
- add x4, p
769
-
770
- // Inline copy of bignum_modinv, identical except for stripping out the
771
- // prologue and epilogue saving and restoring registers and the initial
772
- // test for k = 0 (which is trivially false here since k = 4). For more
773
- // details and explanations see "arm/generic/bignum_modinv.S".
774
-
775
- lsl x10, x0, #3
776
- add x21, x4, x10
777
- add x22, x21, x10
778
- mov x10, xzr
779
- curve25519_x25519_byte_alt_copyloop:
780
- ldr x11, [x2, x10, lsl #3]
781
- ldr x12, [x3, x10, lsl #3]
782
- str x11, [x21, x10, lsl #3]
783
- str x12, [x22, x10, lsl #3]
784
- str x12, [x4, x10, lsl #3]
785
- str xzr, [x1, x10, lsl #3]
786
- add x10, x10, #0x1
787
- cmp x10, x0
788
- b.cc curve25519_x25519_byte_alt_copyloop
789
- ldr x11, [x4]
790
- sub x12, x11, #0x1
791
- str x12, [x4]
792
- lsl x20, x11, #2
793
- sub x20, x11, x20
794
- eor x20, x20, #0x2
795
- mov x12, #0x1
796
- madd x12, x11, x20, x12
797
- mul x11, x12, x12
798
- madd x20, x12, x20, x20
799
- mul x12, x11, x11
800
- madd x20, x11, x20, x20
801
- mul x11, x12, x12
802
- madd x20, x12, x20, x20
803
- madd x20, x11, x20, x20
804
- lsl x2, x0, #7
805
- curve25519_x25519_byte_alt_outerloop:
806
- add x10, x2, #0x3f
807
- lsr x5, x10, #6
808
- cmp x5, x0
809
- csel x5, x0, x5, cs
810
- mov x13, xzr
811
- mov x15, xzr
812
- mov x14, xzr
813
- mov x16, xzr
814
- mov x19, xzr
815
- mov x10, xzr
816
- curve25519_x25519_byte_alt_toploop:
817
- ldr x11, [x21, x10, lsl #3]
818
- ldr x12, [x22, x10, lsl #3]
819
- orr x17, x11, x12
820
- cmp x17, xzr
821
- and x17, x19, x13
822
- csel x15, x17, x15, ne
823
- and x17, x19, x14
824
- csel x16, x17, x16, ne
825
- csel x13, x11, x13, ne
826
- csel x14, x12, x14, ne
827
- csetm x19, ne
828
- add x10, x10, #0x1
829
- cmp x10, x5
830
- b.cc curve25519_x25519_byte_alt_toploop
831
- orr x11, x13, x14
832
- clz x12, x11
833
- negs x17, x12
834
- lsl x13, x13, x12
835
- csel x15, x15, xzr, ne
836
- lsl x14, x14, x12
837
- csel x16, x16, xzr, ne
838
- lsr x15, x15, x17
839
- lsr x16, x16, x17
840
- orr x13, x13, x15
841
- orr x14, x14, x16
842
- ldr x15, [x21]
843
- ldr x16, [x22]
844
- mov x6, #0x1
845
- mov x7, xzr
846
- mov x8, xzr
847
- mov x9, #0x1
848
- mov x10, #0x3a
849
- tst x15, #0x1
850
- curve25519_x25519_byte_alt_innerloop:
851
- csel x11, x14, xzr, ne
852
- csel x12, x16, xzr, ne
853
- csel x17, x8, xzr, ne
854
- csel x19, x9, xzr, ne
855
- ccmp x13, x14, #0x2, ne
856
- sub x11, x13, x11
857
- sub x12, x15, x12
858
- csel x14, x14, x13, cs
859
- cneg x11, x11, cc
860
- csel x16, x16, x15, cs
861
- cneg x15, x12, cc
862
- csel x8, x8, x6, cs
863
- csel x9, x9, x7, cs
864
- tst x12, #0x2
865
- add x6, x6, x17
866
- add x7, x7, x19
867
- lsr x13, x11, #1
868
- lsr x15, x15, #1
869
- add x8, x8, x8
870
- add x9, x9, x9
871
- sub x10, x10, #0x1
872
- cbnz x10, curve25519_x25519_byte_alt_innerloop
873
- mov x13, xzr
874
- mov x14, xzr
875
- mov x17, xzr
876
- mov x19, xzr
877
- mov x10, xzr
878
- curve25519_x25519_byte_alt_congloop:
879
- ldr x11, [x4, x10, lsl #3]
880
- ldr x12, [x1, x10, lsl #3]
881
- mul x15, x6, x11
882
- mul x16, x7, x12
883
- adds x15, x15, x13
884
- umulh x13, x6, x11
885
- adc x13, x13, xzr
886
- adds x15, x15, x16
887
- extr x17, x15, x17, #58
888
- str x17, [x4, x10, lsl #3]
889
- mov x17, x15
890
- umulh x15, x7, x12
891
- adc x13, x13, x15
892
- mul x15, x8, x11
893
- mul x16, x9, x12
894
- adds x15, x15, x14
895
- umulh x14, x8, x11
896
- adc x14, x14, xzr
897
- adds x15, x15, x16
898
- extr x19, x15, x19, #58
899
- str x19, [x1, x10, lsl #3]
900
- mov x19, x15
901
- umulh x15, x9, x12
902
- adc x14, x14, x15
903
- add x10, x10, #0x1
904
- cmp x10, x0
905
- b.cc curve25519_x25519_byte_alt_congloop
906
- extr x13, x13, x17, #58
907
- extr x14, x14, x19, #58
908
- ldr x11, [x4]
909
- mul x17, x11, x20
910
- ldr x12, [x3]
911
- mul x15, x17, x12
912
- umulh x16, x17, x12
913
- adds x11, x11, x15
914
- mov x10, #0x1
915
- sub x11, x0, #0x1
916
- cbz x11, curve25519_x25519_byte_alt_wmontend
917
- curve25519_x25519_byte_alt_wmontloop:
918
- ldr x11, [x3, x10, lsl #3]
919
- ldr x12, [x4, x10, lsl #3]
920
- mul x15, x17, x11
921
- adcs x12, x12, x16
922
- umulh x16, x17, x11
923
- adc x16, x16, xzr
924
- adds x12, x12, x15
925
- sub x15, x10, #0x1
926
- str x12, [x4, x15, lsl #3]
927
- add x10, x10, #0x1
928
- sub x11, x10, x0
929
- cbnz x11, curve25519_x25519_byte_alt_wmontloop
930
- curve25519_x25519_byte_alt_wmontend:
931
- adcs x16, x16, x13
932
- adc x13, xzr, xzr
933
- sub x15, x10, #0x1
934
- str x16, [x4, x15, lsl #3]
935
- negs x10, xzr
936
- curve25519_x25519_byte_alt_wcmploop:
937
- ldr x11, [x4, x10, lsl #3]
938
- ldr x12, [x3, x10, lsl #3]
939
- sbcs xzr, x11, x12
940
- add x10, x10, #0x1
941
- sub x11, x10, x0
942
- cbnz x11, curve25519_x25519_byte_alt_wcmploop
943
- sbcs xzr, x13, xzr
944
- csetm x13, cs
945
- negs x10, xzr
946
- curve25519_x25519_byte_alt_wcorrloop:
947
- ldr x11, [x4, x10, lsl #3]
948
- ldr x12, [x3, x10, lsl #3]
949
- and x12, x12, x13
950
- sbcs x11, x11, x12
951
- str x11, [x4, x10, lsl #3]
952
- add x10, x10, #0x1
953
- sub x11, x10, x0
954
- cbnz x11, curve25519_x25519_byte_alt_wcorrloop
955
- ldr x11, [x1]
956
- mul x17, x11, x20
957
- ldr x12, [x3]
958
- mul x15, x17, x12
959
- umulh x16, x17, x12
960
- adds x11, x11, x15
961
- mov x10, #0x1
962
- sub x11, x0, #0x1
963
- cbz x11, curve25519_x25519_byte_alt_zmontend
964
- curve25519_x25519_byte_alt_zmontloop:
965
- ldr x11, [x3, x10, lsl #3]
966
- ldr x12, [x1, x10, lsl #3]
967
- mul x15, x17, x11
968
- adcs x12, x12, x16
969
- umulh x16, x17, x11
970
- adc x16, x16, xzr
971
- adds x12, x12, x15
972
- sub x15, x10, #0x1
973
- str x12, [x1, x15, lsl #3]
974
- add x10, x10, #0x1
975
- sub x11, x10, x0
976
- cbnz x11, curve25519_x25519_byte_alt_zmontloop
977
- curve25519_x25519_byte_alt_zmontend:
978
- adcs x16, x16, x14
979
- adc x14, xzr, xzr
980
- sub x15, x10, #0x1
981
- str x16, [x1, x15, lsl #3]
982
- negs x10, xzr
983
- curve25519_x25519_byte_alt_zcmploop:
984
- ldr x11, [x1, x10, lsl #3]
985
- ldr x12, [x3, x10, lsl #3]
986
- sbcs xzr, x11, x12
987
- add x10, x10, #0x1
988
- sub x11, x10, x0
989
- cbnz x11, curve25519_x25519_byte_alt_zcmploop
990
- sbcs xzr, x14, xzr
991
- csetm x14, cs
992
- negs x10, xzr
993
- curve25519_x25519_byte_alt_zcorrloop:
994
- ldr x11, [x1, x10, lsl #3]
995
- ldr x12, [x3, x10, lsl #3]
996
- and x12, x12, x14
997
- sbcs x11, x11, x12
998
- str x11, [x1, x10, lsl #3]
999
- add x10, x10, #0x1
1000
- sub x11, x10, x0
1001
- cbnz x11, curve25519_x25519_byte_alt_zcorrloop
1002
- mov x13, xzr
1003
- mov x14, xzr
1004
- mov x17, xzr
1005
- mov x19, xzr
1006
- mov x10, xzr
1007
- curve25519_x25519_byte_alt_crossloop:
1008
- ldr x11, [x21, x10, lsl #3]
1009
- ldr x12, [x22, x10, lsl #3]
1010
- mul x15, x6, x11
1011
- mul x16, x7, x12
1012
- adds x15, x15, x13
1013
- umulh x13, x6, x11
1014
- adc x13, x13, xzr
1015
- subs x15, x15, x16
1016
- str x15, [x21, x10, lsl #3]
1017
- umulh x15, x7, x12
1018
- sub x17, x15, x17
1019
- sbcs x13, x13, x17
1020
- csetm x17, cc
1021
- mul x15, x8, x11
1022
- mul x16, x9, x12
1023
- adds x15, x15, x14
1024
- umulh x14, x8, x11
1025
- adc x14, x14, xzr
1026
- subs x15, x15, x16
1027
- str x15, [x22, x10, lsl #3]
1028
- umulh x15, x9, x12
1029
- sub x19, x15, x19
1030
- sbcs x14, x14, x19
1031
- csetm x19, cc
1032
- add x10, x10, #0x1
1033
- cmp x10, x5
1034
- b.cc curve25519_x25519_byte_alt_crossloop
1035
- cmn x17, x17
1036
- ldr x15, [x21]
1037
- mov x10, xzr
1038
- sub x6, x5, #0x1
1039
- cbz x6, curve25519_x25519_byte_alt_negskip1
1040
- curve25519_x25519_byte_alt_negloop1:
1041
- add x11, x10, #0x8
1042
- ldr x12, [x21, x11]
1043
- extr x15, x12, x15, #58
1044
- eor x15, x15, x17
1045
- adcs x15, x15, xzr
1046
- str x15, [x21, x10]
1047
- mov x15, x12
1048
- add x10, x10, #0x8
1049
- sub x6, x6, #0x1
1050
- cbnz x6, curve25519_x25519_byte_alt_negloop1
1051
- curve25519_x25519_byte_alt_negskip1:
1052
- extr x15, x13, x15, #58
1053
- eor x15, x15, x17
1054
- adcs x15, x15, xzr
1055
- str x15, [x21, x10]
1056
- cmn x19, x19
1057
- ldr x15, [x22]
1058
- mov x10, xzr
1059
- sub x6, x5, #0x1
1060
- cbz x6, curve25519_x25519_byte_alt_negskip2
1061
- curve25519_x25519_byte_alt_negloop2:
1062
- add x11, x10, #0x8
1063
- ldr x12, [x22, x11]
1064
- extr x15, x12, x15, #58
1065
- eor x15, x15, x19
1066
- adcs x15, x15, xzr
1067
- str x15, [x22, x10]
1068
- mov x15, x12
1069
- add x10, x10, #0x8
1070
- sub x6, x6, #0x1
1071
- cbnz x6, curve25519_x25519_byte_alt_negloop2
1072
- curve25519_x25519_byte_alt_negskip2:
1073
- extr x15, x14, x15, #58
1074
- eor x15, x15, x19
1075
- adcs x15, x15, xzr
1076
- str x15, [x22, x10]
1077
- mov x10, xzr
1078
- cmn x17, x17
1079
- curve25519_x25519_byte_alt_wfliploop:
1080
- ldr x11, [x3, x10, lsl #3]
1081
- ldr x12, [x4, x10, lsl #3]
1082
- and x11, x11, x17
1083
- eor x12, x12, x17
1084
- adcs x11, x11, x12
1085
- str x11, [x4, x10, lsl #3]
1086
- add x10, x10, #0x1
1087
- sub x11, x10, x0
1088
- cbnz x11, curve25519_x25519_byte_alt_wfliploop
1089
- mvn x19, x19
1090
- mov x10, xzr
1091
- cmn x19, x19
1092
- curve25519_x25519_byte_alt_zfliploop:
1093
- ldr x11, [x3, x10, lsl #3]
1094
- ldr x12, [x1, x10, lsl #3]
1095
- and x11, x11, x19
1096
- eor x12, x12, x19
1097
- adcs x11, x11, x12
1098
- str x11, [x1, x10, lsl #3]
1099
- add x10, x10, #0x1
1100
- sub x11, x10, x0
1101
- cbnz x11, curve25519_x25519_byte_alt_zfliploop
1102
- subs x2, x2, #0x3a
1103
- b.hi curve25519_x25519_byte_alt_outerloop
755
+ // Prepare to call the modular inverse function to get xm = 1/zn
756
+
757
+ add x0, xm
758
+ add x1, zn
759
+
760
+ // Inline copy of bignum_inv_p25519, identical except for stripping out
761
+ // the prologue and epilogue saving and restoring registers and making
762
+ // and reclaiming room on the stack. For more details and explanations see
763
+ // "arm/curve25519/bignum_inv_p25519.S". Note that the stack it uses for
764
+ // its own temporaries is 128 bytes, so it has no effect on variables
765
+ // that are needed in the rest of our computation here: res, xm and zn.
766
+
767
+ mov x20, x0
768
+ mov x10, #0xffffffffffffffed
769
+ mov x11, #0xffffffffffffffff
770
+ stp x10, x11, [sp]
771
+ mov x12, #0x7fffffffffffffff
772
+ stp x11, x12, [sp, #16]
773
+ ldp x2, x3, [x1]
774
+ ldp x4, x5, [x1, #16]
775
+ mov x7, #0x13
776
+ lsr x6, x5, #63
777
+ madd x6, x7, x6, x7
778
+ adds x2, x2, x6
779
+ adcs x3, x3, xzr
780
+ adcs x4, x4, xzr
781
+ orr x5, x5, #0x8000000000000000
782
+ adcs x5, x5, xzr
783
+ csel x6, x7, xzr, cc
784
+ subs x2, x2, x6
785
+ sbcs x3, x3, xzr
786
+ sbcs x4, x4, xzr
787
+ sbc x5, x5, xzr
788
+ and x5, x5, #0x7fffffffffffffff
789
+ stp x2, x3, [sp, #32]
790
+ stp x4, x5, [sp, #48]
791
+ stp xzr, xzr, [sp, #64]
792
+ stp xzr, xzr, [sp, #80]
793
+ mov x10, #0x2099
794
+ movk x10, #0x7502, lsl #16
795
+ movk x10, #0x9e23, lsl #32
796
+ movk x10, #0xa0f9, lsl #48
797
+ mov x11, #0x2595
798
+ movk x11, #0x1d13, lsl #16
799
+ movk x11, #0x8f3f, lsl #32
800
+ movk x11, #0xa8c6, lsl #48
801
+ mov x12, #0x5242
802
+ movk x12, #0x5ac, lsl #16
803
+ movk x12, #0x8938, lsl #32
804
+ movk x12, #0x6c6c, lsl #48
805
+ mov x13, #0x615
806
+ movk x13, #0x4177, lsl #16
807
+ movk x13, #0x8b2, lsl #32
808
+ movk x13, #0x2765, lsl #48
809
+ stp x10, x11, [sp, #96]
810
+ stp x12, x13, [sp, #112]
811
+ mov x21, #0xa
812
+ mov x22, #0x1
813
+ b curve25519_x25519_byte_alt_invmidloop
814
+ curve25519_x25519_byte_alt_invloop:
815
+ cmp x10, xzr
816
+ csetm x14, mi
817
+ cneg x10, x10, mi
818
+ cmp x11, xzr
819
+ csetm x15, mi
820
+ cneg x11, x11, mi
821
+ cmp x12, xzr
822
+ csetm x16, mi
823
+ cneg x12, x12, mi
824
+ cmp x13, xzr
825
+ csetm x17, mi
826
+ cneg x13, x13, mi
827
+ and x0, x10, x14
828
+ and x1, x11, x15
829
+ add x9, x0, x1
830
+ and x0, x12, x16
831
+ and x1, x13, x17
832
+ add x19, x0, x1
833
+ ldr x7, [sp]
834
+ eor x1, x7, x14
835
+ mul x0, x1, x10
836
+ umulh x1, x1, x10
837
+ adds x4, x9, x0
838
+ adc x2, xzr, x1
839
+ ldr x8, [sp, #32]
840
+ eor x1, x8, x15
841
+ mul x0, x1, x11
842
+ umulh x1, x1, x11
843
+ adds x4, x4, x0
844
+ adc x2, x2, x1
845
+ eor x1, x7, x16
846
+ mul x0, x1, x12
847
+ umulh x1, x1, x12
848
+ adds x5, x19, x0
849
+ adc x3, xzr, x1
850
+ eor x1, x8, x17
851
+ mul x0, x1, x13
852
+ umulh x1, x1, x13
853
+ adds x5, x5, x0
854
+ adc x3, x3, x1
855
+ ldr x7, [sp, #8]
856
+ eor x1, x7, x14
857
+ mul x0, x1, x10
858
+ umulh x1, x1, x10
859
+ adds x2, x2, x0
860
+ adc x6, xzr, x1
861
+ ldr x8, [sp, #40]
862
+ eor x1, x8, x15
863
+ mul x0, x1, x11
864
+ umulh x1, x1, x11
865
+ adds x2, x2, x0
866
+ adc x6, x6, x1
867
+ extr x4, x2, x4, #59
868
+ str x4, [sp]
869
+ eor x1, x7, x16
870
+ mul x0, x1, x12
871
+ umulh x1, x1, x12
872
+ adds x3, x3, x0
873
+ adc x4, xzr, x1
874
+ eor x1, x8, x17
875
+ mul x0, x1, x13
876
+ umulh x1, x1, x13
877
+ adds x3, x3, x0
878
+ adc x4, x4, x1
879
+ extr x5, x3, x5, #59
880
+ str x5, [sp, #32]
881
+ ldr x7, [sp, #16]
882
+ eor x1, x7, x14
883
+ mul x0, x1, x10
884
+ umulh x1, x1, x10
885
+ adds x6, x6, x0
886
+ adc x5, xzr, x1
887
+ ldr x8, [sp, #48]
888
+ eor x1, x8, x15
889
+ mul x0, x1, x11
890
+ umulh x1, x1, x11
891
+ adds x6, x6, x0
892
+ adc x5, x5, x1
893
+ extr x2, x6, x2, #59
894
+ str x2, [sp, #8]
895
+ eor x1, x7, x16
896
+ mul x0, x1, x12
897
+ umulh x1, x1, x12
898
+ adds x4, x4, x0
899
+ adc x2, xzr, x1
900
+ eor x1, x8, x17
901
+ mul x0, x1, x13
902
+ umulh x1, x1, x13
903
+ adds x4, x4, x0
904
+ adc x2, x2, x1
905
+ extr x3, x4, x3, #59
906
+ str x3, [sp, #40]
907
+ ldr x7, [sp, #24]
908
+ eor x1, x7, x14
909
+ asr x3, x1, #63
910
+ and x3, x3, x10
911
+ neg x3, x3
912
+ mul x0, x1, x10
913
+ umulh x1, x1, x10
914
+ adds x5, x5, x0
915
+ adc x3, x3, x1
916
+ ldr x8, [sp, #56]
917
+ eor x1, x8, x15
918
+ asr x0, x1, #63
919
+ and x0, x0, x11
920
+ sub x3, x3, x0
921
+ mul x0, x1, x11
922
+ umulh x1, x1, x11
923
+ adds x5, x5, x0
924
+ adc x3, x3, x1
925
+ extr x6, x5, x6, #59
926
+ str x6, [sp, #16]
927
+ extr x5, x3, x5, #59
928
+ str x5, [sp, #24]
929
+ eor x1, x7, x16
930
+ asr x5, x1, #63
931
+ and x5, x5, x12
932
+ neg x5, x5
933
+ mul x0, x1, x12
934
+ umulh x1, x1, x12
935
+ adds x2, x2, x0
936
+ adc x5, x5, x1
937
+ eor x1, x8, x17
938
+ asr x0, x1, #63
939
+ and x0, x0, x13
940
+ sub x5, x5, x0
941
+ mul x0, x1, x13
942
+ umulh x1, x1, x13
943
+ adds x2, x2, x0
944
+ adc x5, x5, x1
945
+ extr x4, x2, x4, #59
946
+ str x4, [sp, #48]
947
+ extr x2, x5, x2, #59
948
+ str x2, [sp, #56]
949
+ ldr x7, [sp, #64]
950
+ eor x1, x7, x14
951
+ mul x0, x1, x10
952
+ umulh x1, x1, x10
953
+ adds x4, x9, x0
954
+ adc x2, xzr, x1
955
+ ldr x8, [sp, #96]
956
+ eor x1, x8, x15
957
+ mul x0, x1, x11
958
+ umulh x1, x1, x11
959
+ adds x4, x4, x0
960
+ str x4, [sp, #64]
961
+ adc x2, x2, x1
962
+ eor x1, x7, x16
963
+ mul x0, x1, x12
964
+ umulh x1, x1, x12
965
+ adds x5, x19, x0
966
+ adc x3, xzr, x1
967
+ eor x1, x8, x17
968
+ mul x0, x1, x13
969
+ umulh x1, x1, x13
970
+ adds x5, x5, x0
971
+ str x5, [sp, #96]
972
+ adc x3, x3, x1
973
+ ldr x7, [sp, #72]
974
+ eor x1, x7, x14
975
+ mul x0, x1, x10
976
+ umulh x1, x1, x10
977
+ adds x2, x2, x0
978
+ adc x6, xzr, x1
979
+ ldr x8, [sp, #104]
980
+ eor x1, x8, x15
981
+ mul x0, x1, x11
982
+ umulh x1, x1, x11
983
+ adds x2, x2, x0
984
+ str x2, [sp, #72]
985
+ adc x6, x6, x1
986
+ eor x1, x7, x16
987
+ mul x0, x1, x12
988
+ umulh x1, x1, x12
989
+ adds x3, x3, x0
990
+ adc x4, xzr, x1
991
+ eor x1, x8, x17
992
+ mul x0, x1, x13
993
+ umulh x1, x1, x13
994
+ adds x3, x3, x0
995
+ str x3, [sp, #104]
996
+ adc x4, x4, x1
997
+ ldr x7, [sp, #80]
998
+ eor x1, x7, x14
999
+ mul x0, x1, x10
1000
+ umulh x1, x1, x10
1001
+ adds x6, x6, x0
1002
+ adc x5, xzr, x1
1003
+ ldr x8, [sp, #112]
1004
+ eor x1, x8, x15
1005
+ mul x0, x1, x11
1006
+ umulh x1, x1, x11
1007
+ adds x6, x6, x0
1008
+ str x6, [sp, #80]
1009
+ adc x5, x5, x1
1010
+ eor x1, x7, x16
1011
+ mul x0, x1, x12
1012
+ umulh x1, x1, x12
1013
+ adds x4, x4, x0
1014
+ adc x2, xzr, x1
1015
+ eor x1, x8, x17
1016
+ mul x0, x1, x13
1017
+ umulh x1, x1, x13
1018
+ adds x4, x4, x0
1019
+ str x4, [sp, #112]
1020
+ adc x2, x2, x1
1021
+ ldr x7, [sp, #88]
1022
+ eor x1, x7, x14
1023
+ and x3, x14, x10
1024
+ neg x3, x3
1025
+ mul x0, x1, x10
1026
+ umulh x1, x1, x10
1027
+ adds x5, x5, x0
1028
+ adc x3, x3, x1
1029
+ ldr x8, [sp, #120]
1030
+ eor x1, x8, x15
1031
+ and x0, x15, x11
1032
+ sub x3, x3, x0
1033
+ mul x0, x1, x11
1034
+ umulh x1, x1, x11
1035
+ adds x5, x5, x0
1036
+ adc x3, x3, x1
1037
+ extr x6, x3, x5, #63
1038
+ ldp x0, x1, [sp, #64]
1039
+ add x6, x6, x3, asr #63
1040
+ mov x3, #0x13
1041
+ mul x4, x6, x3
1042
+ add x5, x5, x6, lsl #63
1043
+ smulh x3, x6, x3
1044
+ ldr x6, [sp, #80]
1045
+ adds x0, x0, x4
1046
+ adcs x1, x1, x3
1047
+ asr x3, x3, #63
1048
+ adcs x6, x6, x3
1049
+ adc x5, x5, x3
1050
+ stp x0, x1, [sp, #64]
1051
+ stp x6, x5, [sp, #80]
1052
+ eor x1, x7, x16
1053
+ and x5, x16, x12
1054
+ neg x5, x5
1055
+ mul x0, x1, x12
1056
+ umulh x1, x1, x12
1057
+ adds x2, x2, x0
1058
+ adc x5, x5, x1
1059
+ eor x1, x8, x17
1060
+ and x0, x17, x13
1061
+ sub x5, x5, x0
1062
+ mul x0, x1, x13
1063
+ umulh x1, x1, x13
1064
+ adds x2, x2, x0
1065
+ adc x5, x5, x1
1066
+ extr x6, x5, x2, #63
1067
+ ldp x0, x1, [sp, #96]
1068
+ add x6, x6, x5, asr #63
1069
+ mov x5, #0x13
1070
+ mul x4, x6, x5
1071
+ add x2, x2, x6, lsl #63
1072
+ smulh x5, x6, x5
1073
+ ldr x3, [sp, #112]
1074
+ adds x0, x0, x4
1075
+ adcs x1, x1, x5
1076
+ asr x5, x5, #63
1077
+ adcs x3, x3, x5
1078
+ adc x2, x2, x5
1079
+ stp x0, x1, [sp, #96]
1080
+ stp x3, x2, [sp, #112]
1081
+ curve25519_x25519_byte_alt_invmidloop:
1082
+ mov x1, x22
1083
+ ldr x2, [sp]
1084
+ ldr x3, [sp, #32]
1085
+ and x4, x2, #0xfffff
1086
+ orr x4, x4, #0xfffffe0000000000
1087
+ and x5, x3, #0xfffff
1088
+ orr x5, x5, #0xc000000000000000
1089
+ tst x5, #0x1
1090
+ csel x6, x4, xzr, ne
1091
+ ccmp x1, xzr, #0x8, ne
1092
+ cneg x1, x1, ge
1093
+ cneg x6, x6, ge
1094
+ csel x4, x5, x4, ge
1095
+ add x5, x5, x6
1096
+ add x1, x1, #0x2
1097
+ tst x5, #0x2
1098
+ asr x5, x5, #1
1099
+ csel x6, x4, xzr, ne
1100
+ ccmp x1, xzr, #0x8, ne
1101
+ cneg x1, x1, ge
1102
+ cneg x6, x6, ge
1103
+ csel x4, x5, x4, ge
1104
+ add x5, x5, x6
1105
+ add x1, x1, #0x2
1106
+ tst x5, #0x2
1107
+ asr x5, x5, #1
1108
+ csel x6, x4, xzr, ne
1109
+ ccmp x1, xzr, #0x8, ne
1110
+ cneg x1, x1, ge
1111
+ cneg x6, x6, ge
1112
+ csel x4, x5, x4, ge
1113
+ add x5, x5, x6
1114
+ add x1, x1, #0x2
1115
+ tst x5, #0x2
1116
+ asr x5, x5, #1
1117
+ csel x6, x4, xzr, ne
1118
+ ccmp x1, xzr, #0x8, ne
1119
+ cneg x1, x1, ge
1120
+ cneg x6, x6, ge
1121
+ csel x4, x5, x4, ge
1122
+ add x5, x5, x6
1123
+ add x1, x1, #0x2
1124
+ tst x5, #0x2
1125
+ asr x5, x5, #1
1126
+ csel x6, x4, xzr, ne
1127
+ ccmp x1, xzr, #0x8, ne
1128
+ cneg x1, x1, ge
1129
+ cneg x6, x6, ge
1130
+ csel x4, x5, x4, ge
1131
+ add x5, x5, x6
1132
+ add x1, x1, #0x2
1133
+ tst x5, #0x2
1134
+ asr x5, x5, #1
1135
+ csel x6, x4, xzr, ne
1136
+ ccmp x1, xzr, #0x8, ne
1137
+ cneg x1, x1, ge
1138
+ cneg x6, x6, ge
1139
+ csel x4, x5, x4, ge
1140
+ add x5, x5, x6
1141
+ add x1, x1, #0x2
1142
+ tst x5, #0x2
1143
+ asr x5, x5, #1
1144
+ csel x6, x4, xzr, ne
1145
+ ccmp x1, xzr, #0x8, ne
1146
+ cneg x1, x1, ge
1147
+ cneg x6, x6, ge
1148
+ csel x4, x5, x4, ge
1149
+ add x5, x5, x6
1150
+ add x1, x1, #0x2
1151
+ tst x5, #0x2
1152
+ asr x5, x5, #1
1153
+ csel x6, x4, xzr, ne
1154
+ ccmp x1, xzr, #0x8, ne
1155
+ cneg x1, x1, ge
1156
+ cneg x6, x6, ge
1157
+ csel x4, x5, x4, ge
1158
+ add x5, x5, x6
1159
+ add x1, x1, #0x2
1160
+ tst x5, #0x2
1161
+ asr x5, x5, #1
1162
+ csel x6, x4, xzr, ne
1163
+ ccmp x1, xzr, #0x8, ne
1164
+ cneg x1, x1, ge
1165
+ cneg x6, x6, ge
1166
+ csel x4, x5, x4, ge
1167
+ add x5, x5, x6
1168
+ add x1, x1, #0x2
1169
+ tst x5, #0x2
1170
+ asr x5, x5, #1
1171
+ csel x6, x4, xzr, ne
1172
+ ccmp x1, xzr, #0x8, ne
1173
+ cneg x1, x1, ge
1174
+ cneg x6, x6, ge
1175
+ csel x4, x5, x4, ge
1176
+ add x5, x5, x6
1177
+ add x1, x1, #0x2
1178
+ tst x5, #0x2
1179
+ asr x5, x5, #1
1180
+ csel x6, x4, xzr, ne
1181
+ ccmp x1, xzr, #0x8, ne
1182
+ cneg x1, x1, ge
1183
+ cneg x6, x6, ge
1184
+ csel x4, x5, x4, ge
1185
+ add x5, x5, x6
1186
+ add x1, x1, #0x2
1187
+ tst x5, #0x2
1188
+ asr x5, x5, #1
1189
+ csel x6, x4, xzr, ne
1190
+ ccmp x1, xzr, #0x8, ne
1191
+ cneg x1, x1, ge
1192
+ cneg x6, x6, ge
1193
+ csel x4, x5, x4, ge
1194
+ add x5, x5, x6
1195
+ add x1, x1, #0x2
1196
+ tst x5, #0x2
1197
+ asr x5, x5, #1
1198
+ csel x6, x4, xzr, ne
1199
+ ccmp x1, xzr, #0x8, ne
1200
+ cneg x1, x1, ge
1201
+ cneg x6, x6, ge
1202
+ csel x4, x5, x4, ge
1203
+ add x5, x5, x6
1204
+ add x1, x1, #0x2
1205
+ tst x5, #0x2
1206
+ asr x5, x5, #1
1207
+ csel x6, x4, xzr, ne
1208
+ ccmp x1, xzr, #0x8, ne
1209
+ cneg x1, x1, ge
1210
+ cneg x6, x6, ge
1211
+ csel x4, x5, x4, ge
1212
+ add x5, x5, x6
1213
+ add x1, x1, #0x2
1214
+ tst x5, #0x2
1215
+ asr x5, x5, #1
1216
+ csel x6, x4, xzr, ne
1217
+ ccmp x1, xzr, #0x8, ne
1218
+ cneg x1, x1, ge
1219
+ cneg x6, x6, ge
1220
+ csel x4, x5, x4, ge
1221
+ add x5, x5, x6
1222
+ add x1, x1, #0x2
1223
+ tst x5, #0x2
1224
+ asr x5, x5, #1
1225
+ csel x6, x4, xzr, ne
1226
+ ccmp x1, xzr, #0x8, ne
1227
+ cneg x1, x1, ge
1228
+ cneg x6, x6, ge
1229
+ csel x4, x5, x4, ge
1230
+ add x5, x5, x6
1231
+ add x1, x1, #0x2
1232
+ tst x5, #0x2
1233
+ asr x5, x5, #1
1234
+ csel x6, x4, xzr, ne
1235
+ ccmp x1, xzr, #0x8, ne
1236
+ cneg x1, x1, ge
1237
+ cneg x6, x6, ge
1238
+ csel x4, x5, x4, ge
1239
+ add x5, x5, x6
1240
+ add x1, x1, #0x2
1241
+ tst x5, #0x2
1242
+ asr x5, x5, #1
1243
+ csel x6, x4, xzr, ne
1244
+ ccmp x1, xzr, #0x8, ne
1245
+ cneg x1, x1, ge
1246
+ cneg x6, x6, ge
1247
+ csel x4, x5, x4, ge
1248
+ add x5, x5, x6
1249
+ add x1, x1, #0x2
1250
+ tst x5, #0x2
1251
+ asr x5, x5, #1
1252
+ csel x6, x4, xzr, ne
1253
+ ccmp x1, xzr, #0x8, ne
1254
+ cneg x1, x1, ge
1255
+ cneg x6, x6, ge
1256
+ csel x4, x5, x4, ge
1257
+ add x5, x5, x6
1258
+ add x1, x1, #0x2
1259
+ tst x5, #0x2
1260
+ asr x5, x5, #1
1261
+ csel x6, x4, xzr, ne
1262
+ ccmp x1, xzr, #0x8, ne
1263
+ cneg x1, x1, ge
1264
+ cneg x6, x6, ge
1265
+ csel x4, x5, x4, ge
1266
+ add x5, x5, x6
1267
+ add x1, x1, #0x2
1268
+ asr x5, x5, #1
1269
+ add x8, x4, #0x100, lsl #12
1270
+ sbfx x8, x8, #21, #21
1271
+ mov x11, #0x100000
1272
+ add x11, x11, x11, lsl #21
1273
+ add x9, x4, x11
1274
+ asr x9, x9, #42
1275
+ add x10, x5, #0x100, lsl #12
1276
+ sbfx x10, x10, #21, #21
1277
+ add x11, x5, x11
1278
+ asr x11, x11, #42
1279
+ mul x6, x8, x2
1280
+ mul x7, x9, x3
1281
+ mul x2, x10, x2
1282
+ mul x3, x11, x3
1283
+ add x4, x6, x7
1284
+ add x5, x2, x3
1285
+ asr x2, x4, #20
1286
+ asr x3, x5, #20
1287
+ and x4, x2, #0xfffff
1288
+ orr x4, x4, #0xfffffe0000000000
1289
+ and x5, x3, #0xfffff
1290
+ orr x5, x5, #0xc000000000000000
1291
+ tst x5, #0x1
1292
+ csel x6, x4, xzr, ne
1293
+ ccmp x1, xzr, #0x8, ne
1294
+ cneg x1, x1, ge
1295
+ cneg x6, x6, ge
1296
+ csel x4, x5, x4, ge
1297
+ add x5, x5, x6
1298
+ add x1, x1, #0x2
1299
+ tst x5, #0x2
1300
+ asr x5, x5, #1
1301
+ csel x6, x4, xzr, ne
1302
+ ccmp x1, xzr, #0x8, ne
1303
+ cneg x1, x1, ge
1304
+ cneg x6, x6, ge
1305
+ csel x4, x5, x4, ge
1306
+ add x5, x5, x6
1307
+ add x1, x1, #0x2
1308
+ tst x5, #0x2
1309
+ asr x5, x5, #1
1310
+ csel x6, x4, xzr, ne
1311
+ ccmp x1, xzr, #0x8, ne
1312
+ cneg x1, x1, ge
1313
+ cneg x6, x6, ge
1314
+ csel x4, x5, x4, ge
1315
+ add x5, x5, x6
1316
+ add x1, x1, #0x2
1317
+ tst x5, #0x2
1318
+ asr x5, x5, #1
1319
+ csel x6, x4, xzr, ne
1320
+ ccmp x1, xzr, #0x8, ne
1321
+ cneg x1, x1, ge
1322
+ cneg x6, x6, ge
1323
+ csel x4, x5, x4, ge
1324
+ add x5, x5, x6
1325
+ add x1, x1, #0x2
1326
+ tst x5, #0x2
1327
+ asr x5, x5, #1
1328
+ csel x6, x4, xzr, ne
1329
+ ccmp x1, xzr, #0x8, ne
1330
+ cneg x1, x1, ge
1331
+ cneg x6, x6, ge
1332
+ csel x4, x5, x4, ge
1333
+ add x5, x5, x6
1334
+ add x1, x1, #0x2
1335
+ tst x5, #0x2
1336
+ asr x5, x5, #1
1337
+ csel x6, x4, xzr, ne
1338
+ ccmp x1, xzr, #0x8, ne
1339
+ cneg x1, x1, ge
1340
+ cneg x6, x6, ge
1341
+ csel x4, x5, x4, ge
1342
+ add x5, x5, x6
1343
+ add x1, x1, #0x2
1344
+ tst x5, #0x2
1345
+ asr x5, x5, #1
1346
+ csel x6, x4, xzr, ne
1347
+ ccmp x1, xzr, #0x8, ne
1348
+ cneg x1, x1, ge
1349
+ cneg x6, x6, ge
1350
+ csel x4, x5, x4, ge
1351
+ add x5, x5, x6
1352
+ add x1, x1, #0x2
1353
+ tst x5, #0x2
1354
+ asr x5, x5, #1
1355
+ csel x6, x4, xzr, ne
1356
+ ccmp x1, xzr, #0x8, ne
1357
+ cneg x1, x1, ge
1358
+ cneg x6, x6, ge
1359
+ csel x4, x5, x4, ge
1360
+ add x5, x5, x6
1361
+ add x1, x1, #0x2
1362
+ tst x5, #0x2
1363
+ asr x5, x5, #1
1364
+ csel x6, x4, xzr, ne
1365
+ ccmp x1, xzr, #0x8, ne
1366
+ cneg x1, x1, ge
1367
+ cneg x6, x6, ge
1368
+ csel x4, x5, x4, ge
1369
+ add x5, x5, x6
1370
+ add x1, x1, #0x2
1371
+ tst x5, #0x2
1372
+ asr x5, x5, #1
1373
+ csel x6, x4, xzr, ne
1374
+ ccmp x1, xzr, #0x8, ne
1375
+ cneg x1, x1, ge
1376
+ cneg x6, x6, ge
1377
+ csel x4, x5, x4, ge
1378
+ add x5, x5, x6
1379
+ add x1, x1, #0x2
1380
+ tst x5, #0x2
1381
+ asr x5, x5, #1
1382
+ csel x6, x4, xzr, ne
1383
+ ccmp x1, xzr, #0x8, ne
1384
+ cneg x1, x1, ge
1385
+ cneg x6, x6, ge
1386
+ csel x4, x5, x4, ge
1387
+ add x5, x5, x6
1388
+ add x1, x1, #0x2
1389
+ tst x5, #0x2
1390
+ asr x5, x5, #1
1391
+ csel x6, x4, xzr, ne
1392
+ ccmp x1, xzr, #0x8, ne
1393
+ cneg x1, x1, ge
1394
+ cneg x6, x6, ge
1395
+ csel x4, x5, x4, ge
1396
+ add x5, x5, x6
1397
+ add x1, x1, #0x2
1398
+ tst x5, #0x2
1399
+ asr x5, x5, #1
1400
+ csel x6, x4, xzr, ne
1401
+ ccmp x1, xzr, #0x8, ne
1402
+ cneg x1, x1, ge
1403
+ cneg x6, x6, ge
1404
+ csel x4, x5, x4, ge
1405
+ add x5, x5, x6
1406
+ add x1, x1, #0x2
1407
+ tst x5, #0x2
1408
+ asr x5, x5, #1
1409
+ csel x6, x4, xzr, ne
1410
+ ccmp x1, xzr, #0x8, ne
1411
+ cneg x1, x1, ge
1412
+ cneg x6, x6, ge
1413
+ csel x4, x5, x4, ge
1414
+ add x5, x5, x6
1415
+ add x1, x1, #0x2
1416
+ tst x5, #0x2
1417
+ asr x5, x5, #1
1418
+ csel x6, x4, xzr, ne
1419
+ ccmp x1, xzr, #0x8, ne
1420
+ cneg x1, x1, ge
1421
+ cneg x6, x6, ge
1422
+ csel x4, x5, x4, ge
1423
+ add x5, x5, x6
1424
+ add x1, x1, #0x2
1425
+ tst x5, #0x2
1426
+ asr x5, x5, #1
1427
+ csel x6, x4, xzr, ne
1428
+ ccmp x1, xzr, #0x8, ne
1429
+ cneg x1, x1, ge
1430
+ cneg x6, x6, ge
1431
+ csel x4, x5, x4, ge
1432
+ add x5, x5, x6
1433
+ add x1, x1, #0x2
1434
+ tst x5, #0x2
1435
+ asr x5, x5, #1
1436
+ csel x6, x4, xzr, ne
1437
+ ccmp x1, xzr, #0x8, ne
1438
+ cneg x1, x1, ge
1439
+ cneg x6, x6, ge
1440
+ csel x4, x5, x4, ge
1441
+ add x5, x5, x6
1442
+ add x1, x1, #0x2
1443
+ tst x5, #0x2
1444
+ asr x5, x5, #1
1445
+ csel x6, x4, xzr, ne
1446
+ ccmp x1, xzr, #0x8, ne
1447
+ cneg x1, x1, ge
1448
+ cneg x6, x6, ge
1449
+ csel x4, x5, x4, ge
1450
+ add x5, x5, x6
1451
+ add x1, x1, #0x2
1452
+ tst x5, #0x2
1453
+ asr x5, x5, #1
1454
+ csel x6, x4, xzr, ne
1455
+ ccmp x1, xzr, #0x8, ne
1456
+ cneg x1, x1, ge
1457
+ cneg x6, x6, ge
1458
+ csel x4, x5, x4, ge
1459
+ add x5, x5, x6
1460
+ add x1, x1, #0x2
1461
+ tst x5, #0x2
1462
+ asr x5, x5, #1
1463
+ csel x6, x4, xzr, ne
1464
+ ccmp x1, xzr, #0x8, ne
1465
+ cneg x1, x1, ge
1466
+ cneg x6, x6, ge
1467
+ csel x4, x5, x4, ge
1468
+ add x5, x5, x6
1469
+ add x1, x1, #0x2
1470
+ asr x5, x5, #1
1471
+ add x12, x4, #0x100, lsl #12
1472
+ sbfx x12, x12, #21, #21
1473
+ mov x15, #0x100000
1474
+ add x15, x15, x15, lsl #21
1475
+ add x13, x4, x15
1476
+ asr x13, x13, #42
1477
+ add x14, x5, #0x100, lsl #12
1478
+ sbfx x14, x14, #21, #21
1479
+ add x15, x5, x15
1480
+ asr x15, x15, #42
1481
+ mul x6, x12, x2
1482
+ mul x7, x13, x3
1483
+ mul x2, x14, x2
1484
+ mul x3, x15, x3
1485
+ add x4, x6, x7
1486
+ add x5, x2, x3
1487
+ asr x2, x4, #20
1488
+ asr x3, x5, #20
1489
+ and x4, x2, #0xfffff
1490
+ orr x4, x4, #0xfffffe0000000000
1491
+ and x5, x3, #0xfffff
1492
+ orr x5, x5, #0xc000000000000000
1493
+ tst x5, #0x1
1494
+ csel x6, x4, xzr, ne
1495
+ ccmp x1, xzr, #0x8, ne
1496
+ cneg x1, x1, ge
1497
+ cneg x6, x6, ge
1498
+ csel x4, x5, x4, ge
1499
+ add x5, x5, x6
1500
+ add x1, x1, #0x2
1501
+ tst x5, #0x2
1502
+ asr x5, x5, #1
1503
+ csel x6, x4, xzr, ne
1504
+ ccmp x1, xzr, #0x8, ne
1505
+ cneg x1, x1, ge
1506
+ cneg x6, x6, ge
1507
+ csel x4, x5, x4, ge
1508
+ add x5, x5, x6
1509
+ add x1, x1, #0x2
1510
+ tst x5, #0x2
1511
+ asr x5, x5, #1
1512
+ csel x6, x4, xzr, ne
1513
+ ccmp x1, xzr, #0x8, ne
1514
+ cneg x1, x1, ge
1515
+ cneg x6, x6, ge
1516
+ csel x4, x5, x4, ge
1517
+ add x5, x5, x6
1518
+ add x1, x1, #0x2
1519
+ tst x5, #0x2
1520
+ asr x5, x5, #1
1521
+ csel x6, x4, xzr, ne
1522
+ ccmp x1, xzr, #0x8, ne
1523
+ cneg x1, x1, ge
1524
+ cneg x6, x6, ge
1525
+ csel x4, x5, x4, ge
1526
+ add x5, x5, x6
1527
+ add x1, x1, #0x2
1528
+ tst x5, #0x2
1529
+ asr x5, x5, #1
1530
+ csel x6, x4, xzr, ne
1531
+ ccmp x1, xzr, #0x8, ne
1532
+ cneg x1, x1, ge
1533
+ cneg x6, x6, ge
1534
+ csel x4, x5, x4, ge
1535
+ add x5, x5, x6
1536
+ add x1, x1, #0x2
1537
+ tst x5, #0x2
1538
+ asr x5, x5, #1
1539
+ csel x6, x4, xzr, ne
1540
+ ccmp x1, xzr, #0x8, ne
1541
+ cneg x1, x1, ge
1542
+ cneg x6, x6, ge
1543
+ csel x4, x5, x4, ge
1544
+ add x5, x5, x6
1545
+ add x1, x1, #0x2
1546
+ tst x5, #0x2
1547
+ asr x5, x5, #1
1548
+ csel x6, x4, xzr, ne
1549
+ ccmp x1, xzr, #0x8, ne
1550
+ cneg x1, x1, ge
1551
+ cneg x6, x6, ge
1552
+ csel x4, x5, x4, ge
1553
+ add x5, x5, x6
1554
+ add x1, x1, #0x2
1555
+ tst x5, #0x2
1556
+ asr x5, x5, #1
1557
+ csel x6, x4, xzr, ne
1558
+ ccmp x1, xzr, #0x8, ne
1559
+ cneg x1, x1, ge
1560
+ cneg x6, x6, ge
1561
+ csel x4, x5, x4, ge
1562
+ add x5, x5, x6
1563
+ add x1, x1, #0x2
1564
+ tst x5, #0x2
1565
+ asr x5, x5, #1
1566
+ csel x6, x4, xzr, ne
1567
+ ccmp x1, xzr, #0x8, ne
1568
+ cneg x1, x1, ge
1569
+ cneg x6, x6, ge
1570
+ csel x4, x5, x4, ge
1571
+ add x5, x5, x6
1572
+ add x1, x1, #0x2
1573
+ tst x5, #0x2
1574
+ asr x5, x5, #1
1575
+ csel x6, x4, xzr, ne
1576
+ ccmp x1, xzr, #0x8, ne
1577
+ cneg x1, x1, ge
1578
+ cneg x6, x6, ge
1579
+ csel x4, x5, x4, ge
1580
+ add x5, x5, x6
1581
+ add x1, x1, #0x2
1582
+ tst x5, #0x2
1583
+ asr x5, x5, #1
1584
+ mul x2, x12, x8
1585
+ mul x3, x12, x9
1586
+ mul x6, x14, x8
1587
+ mul x7, x14, x9
1588
+ madd x8, x13, x10, x2
1589
+ madd x9, x13, x11, x3
1590
+ madd x16, x15, x10, x6
1591
+ madd x17, x15, x11, x7
1592
+ csel x6, x4, xzr, ne
1593
+ ccmp x1, xzr, #0x8, ne
1594
+ cneg x1, x1, ge
1595
+ cneg x6, x6, ge
1596
+ csel x4, x5, x4, ge
1597
+ add x5, x5, x6
1598
+ add x1, x1, #0x2
1599
+ tst x5, #0x2
1600
+ asr x5, x5, #1
1601
+ csel x6, x4, xzr, ne
1602
+ ccmp x1, xzr, #0x8, ne
1603
+ cneg x1, x1, ge
1604
+ cneg x6, x6, ge
1605
+ csel x4, x5, x4, ge
1606
+ add x5, x5, x6
1607
+ add x1, x1, #0x2
1608
+ tst x5, #0x2
1609
+ asr x5, x5, #1
1610
+ csel x6, x4, xzr, ne
1611
+ ccmp x1, xzr, #0x8, ne
1612
+ cneg x1, x1, ge
1613
+ cneg x6, x6, ge
1614
+ csel x4, x5, x4, ge
1615
+ add x5, x5, x6
1616
+ add x1, x1, #0x2
1617
+ tst x5, #0x2
1618
+ asr x5, x5, #1
1619
+ csel x6, x4, xzr, ne
1620
+ ccmp x1, xzr, #0x8, ne
1621
+ cneg x1, x1, ge
1622
+ cneg x6, x6, ge
1623
+ csel x4, x5, x4, ge
1624
+ add x5, x5, x6
1625
+ add x1, x1, #0x2
1626
+ tst x5, #0x2
1627
+ asr x5, x5, #1
1628
+ csel x6, x4, xzr, ne
1629
+ ccmp x1, xzr, #0x8, ne
1630
+ cneg x1, x1, ge
1631
+ cneg x6, x6, ge
1632
+ csel x4, x5, x4, ge
1633
+ add x5, x5, x6
1634
+ add x1, x1, #0x2
1635
+ tst x5, #0x2
1636
+ asr x5, x5, #1
1637
+ csel x6, x4, xzr, ne
1638
+ ccmp x1, xzr, #0x8, ne
1639
+ cneg x1, x1, ge
1640
+ cneg x6, x6, ge
1641
+ csel x4, x5, x4, ge
1642
+ add x5, x5, x6
1643
+ add x1, x1, #0x2
1644
+ tst x5, #0x2
1645
+ asr x5, x5, #1
1646
+ csel x6, x4, xzr, ne
1647
+ ccmp x1, xzr, #0x8, ne
1648
+ cneg x1, x1, ge
1649
+ cneg x6, x6, ge
1650
+ csel x4, x5, x4, ge
1651
+ add x5, x5, x6
1652
+ add x1, x1, #0x2
1653
+ tst x5, #0x2
1654
+ asr x5, x5, #1
1655
+ csel x6, x4, xzr, ne
1656
+ ccmp x1, xzr, #0x8, ne
1657
+ cneg x1, x1, ge
1658
+ cneg x6, x6, ge
1659
+ csel x4, x5, x4, ge
1660
+ add x5, x5, x6
1661
+ add x1, x1, #0x2
1662
+ tst x5, #0x2
1663
+ asr x5, x5, #1
1664
+ csel x6, x4, xzr, ne
1665
+ ccmp x1, xzr, #0x8, ne
1666
+ cneg x1, x1, ge
1667
+ cneg x6, x6, ge
1668
+ csel x4, x5, x4, ge
1669
+ add x5, x5, x6
1670
+ add x1, x1, #0x2
1671
+ asr x5, x5, #1
1672
+ add x12, x4, #0x100, lsl #12
1673
+ sbfx x12, x12, #22, #21
1674
+ mov x15, #0x100000
1675
+ add x15, x15, x15, lsl #21
1676
+ add x13, x4, x15
1677
+ asr x13, x13, #43
1678
+ add x14, x5, #0x100, lsl #12
1679
+ sbfx x14, x14, #22, #21
1680
+ add x15, x5, x15
1681
+ asr x15, x15, #43
1682
+ mneg x2, x12, x8
1683
+ mneg x3, x12, x9
1684
+ mneg x4, x14, x8
1685
+ mneg x5, x14, x9
1686
+ msub x10, x13, x16, x2
1687
+ msub x11, x13, x17, x3
1688
+ msub x12, x15, x16, x4
1689
+ msub x13, x15, x17, x5
1690
+ mov x22, x1
1691
+ subs x21, x21, #0x1
1692
+ b.ne curve25519_x25519_byte_alt_invloop
1693
+ ldr x0, [sp]
1694
+ ldr x1, [sp, #32]
1695
+ mul x0, x0, x10
1696
+ madd x1, x1, x11, x0
1697
+ asr x0, x1, #63
1698
+ cmp x10, xzr
1699
+ csetm x14, mi
1700
+ cneg x10, x10, mi
1701
+ eor x14, x14, x0
1702
+ cmp x11, xzr
1703
+ csetm x15, mi
1704
+ cneg x11, x11, mi
1705
+ eor x15, x15, x0
1706
+ cmp x12, xzr
1707
+ csetm x16, mi
1708
+ cneg x12, x12, mi
1709
+ eor x16, x16, x0
1710
+ cmp x13, xzr
1711
+ csetm x17, mi
1712
+ cneg x13, x13, mi
1713
+ eor x17, x17, x0
1714
+ and x0, x10, x14
1715
+ and x1, x11, x15
1716
+ add x9, x0, x1
1717
+ ldr x7, [sp, #64]
1718
+ eor x1, x7, x14
1719
+ mul x0, x1, x10
1720
+ umulh x1, x1, x10
1721
+ adds x4, x9, x0
1722
+ adc x2, xzr, x1
1723
+ ldr x8, [sp, #96]
1724
+ eor x1, x8, x15
1725
+ mul x0, x1, x11
1726
+ umulh x1, x1, x11
1727
+ adds x4, x4, x0
1728
+ str x4, [sp, #64]
1729
+ adc x2, x2, x1
1730
+ ldr x7, [sp, #72]
1731
+ eor x1, x7, x14
1732
+ mul x0, x1, x10
1733
+ umulh x1, x1, x10
1734
+ adds x2, x2, x0
1735
+ adc x6, xzr, x1
1736
+ ldr x8, [sp, #104]
1737
+ eor x1, x8, x15
1738
+ mul x0, x1, x11
1739
+ umulh x1, x1, x11
1740
+ adds x2, x2, x0
1741
+ str x2, [sp, #72]
1742
+ adc x6, x6, x1
1743
+ ldr x7, [sp, #80]
1744
+ eor x1, x7, x14
1745
+ mul x0, x1, x10
1746
+ umulh x1, x1, x10
1747
+ adds x6, x6, x0
1748
+ adc x5, xzr, x1
1749
+ ldr x8, [sp, #112]
1750
+ eor x1, x8, x15
1751
+ mul x0, x1, x11
1752
+ umulh x1, x1, x11
1753
+ adds x6, x6, x0
1754
+ str x6, [sp, #80]
1755
+ adc x5, x5, x1
1756
+ ldr x7, [sp, #88]
1757
+ eor x1, x7, x14
1758
+ and x3, x14, x10
1759
+ neg x3, x3
1760
+ mul x0, x1, x10
1761
+ umulh x1, x1, x10
1762
+ adds x5, x5, x0
1763
+ adc x3, x3, x1
1764
+ ldr x8, [sp, #120]
1765
+ eor x1, x8, x15
1766
+ and x0, x15, x11
1767
+ sub x3, x3, x0
1768
+ mul x0, x1, x11
1769
+ umulh x1, x1, x11
1770
+ adds x5, x5, x0
1771
+ adc x3, x3, x1
1772
+ extr x6, x3, x5, #63
1773
+ ldp x0, x1, [sp, #64]
1774
+ tst x3, x3
1775
+ cinc x6, x6, pl
1776
+ mov x3, #0x13
1777
+ mul x4, x6, x3
1778
+ add x5, x5, x6, lsl #63
1779
+ smulh x6, x6, x3
1780
+ ldr x2, [sp, #80]
1781
+ adds x0, x0, x4
1782
+ adcs x1, x1, x6
1783
+ asr x6, x6, #63
1784
+ adcs x2, x2, x6
1785
+ adcs x5, x5, x6
1786
+ csel x3, x3, xzr, mi
1787
+ subs x0, x0, x3
1788
+ sbcs x1, x1, xzr
1789
+ sbcs x2, x2, xzr
1790
+ sbc x5, x5, xzr
1791
+ and x5, x5, #0x7fffffffffffffff
1792
+ mov x4, x20
1793
+ stp x0, x1, [x4]
1794
+ stp x2, x5, [x4, #16]
1104
1795
 
1105
1796
  // Since we eventually want to return 0 when the result is the point at
1106
1797
  // infinity, we force xn = 0 whenever zn = 0. This avoids building in a
@@ -1123,7 +1814,7 @@ curve25519_x25519_byte_alt_zfliploop:
1123
1814
 
1124
1815
  // Now the result is xn * (1/zn), fully reduced modulo p.
1125
1816
 
1126
- mul_p25519(zn,xn,zm)
1817
+ mul_p25519(zn,xn,xm)
1127
1818
 
1128
1819
  ldp x10, x11, [zn]
1129
1820
  strb w10, [resx]