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
@@ -437,7 +437,8 @@ static void ecp_nistz256_points_mul_public(const EC_GROUP *group,
437
437
  static int ecp_nistz256_get_affine(const EC_GROUP *group,
438
438
  const EC_JACOBIAN *point, EC_FELEM *x,
439
439
  EC_FELEM *y) {
440
- if (ec_GFp_simple_is_at_infinity(group, point)) {
440
+ if (constant_time_declassify_int(
441
+ ec_GFp_simple_is_at_infinity(group, point))) {
441
442
  OPENSSL_PUT_ERROR(EC, EC_R_POINT_AT_INFINITY);
442
443
  return 0;
443
444
  }
@@ -582,8 +583,8 @@ static int ecp_nistz256_scalar_to_montgomery_inv_vartime(const EC_GROUP *group,
582
583
  }
583
584
  #endif
584
585
 
585
- assert(group->order.width == P256_LIMBS);
586
- if (!beeu_mod_inverse_vartime(out->words, in->words, group->order.d)) {
586
+ assert(group->order->N.width == P256_LIMBS);
587
+ if (!beeu_mod_inverse_vartime(out->words, in->words, group->order->N.d)) {
587
588
  return 0;
588
589
  }
589
590
 
@@ -601,7 +602,7 @@ static int ecp_nistz256_cmp_x_coordinate(const EC_GROUP *group,
601
602
  return 0;
602
603
  }
603
604
 
604
- assert(group->order.width == P256_LIMBS);
605
+ assert(group->order->N.width == P256_LIMBS);
605
606
  assert(group->field.width == P256_LIMBS);
606
607
 
607
608
  // We wish to compare X/Z^2 with r. This is equivalent to comparing X with
@@ -620,10 +621,9 @@ static int ecp_nistz256_cmp_x_coordinate(const EC_GROUP *group,
620
621
  // Therefore there is a small possibility, less than 1/2^128, that group_order
621
622
  // < p.x < P. in that case we need not only to compare against |r| but also to
622
623
  // compare against r+group_order.
623
- if (bn_less_than_words(r->words, group->field_minus_order.words,
624
- P256_LIMBS)) {
625
- // We can ignore the carry because: r + group_order < p < 2^256.
626
- bn_add_words(r_Z2, r->words, group->order.d, P256_LIMBS);
624
+ BN_ULONG carry = bn_add_words(r_Z2, r->words, group->order->N.d, P256_LIMBS);
625
+ if (carry == 0 && bn_less_than_words(r_Z2, group->field.d, P256_LIMBS)) {
626
+ // r + group_order < p, so compare (r + group_order) * Z^2 against X.
627
627
  ecp_nistz256_mul_mont(r_Z2, r_Z2, Z2_mont);
628
628
  if (OPENSSL_memcmp(r_Z2, X, sizeof(r_Z2)) == 0) {
629
629
  return 1;
@@ -324,7 +324,7 @@ static void fiat_p256_point_add(fiat_p256_felem x3, fiat_p256_felem y3,
324
324
  fiat_p256_limb_t is_nontrivial_double = constant_time_is_zero_w(xneq | yneq) &
325
325
  ~constant_time_is_zero_w(z1nz) &
326
326
  ~constant_time_is_zero_w(z2nz);
327
- if (is_nontrivial_double) {
327
+ if (constant_time_declassify_w(is_nontrivial_double)) {
328
328
  fiat_p256_point_double(x3, y3, z3, x1, y1, z1);
329
329
  return;
330
330
  }
@@ -416,7 +416,8 @@ static crypto_word_t fiat_p256_get_bit(const EC_SCALAR *in, int i) {
416
416
  static int ec_GFp_nistp256_point_get_affine_coordinates(
417
417
  const EC_GROUP *group, const EC_JACOBIAN *point, EC_FELEM *x_out,
418
418
  EC_FELEM *y_out) {
419
- if (ec_GFp_simple_is_at_infinity(group, point)) {
419
+ if (constant_time_declassify_int(
420
+ ec_GFp_simple_is_at_infinity(group, point))) {
420
421
  OPENSSL_PUT_ERROR(EC, EC_R_POINT_AT_INFINITY);
421
422
  return 0;
422
423
  }
@@ -709,12 +710,12 @@ static int ec_GFp_nistp256_cmp_x_coordinate(const EC_GROUP *group,
709
710
  // Therefore there is a small possibility, less than 1/2^128, that group_order
710
711
  // < p.x < P. in that case we need not only to compare against |r| but also to
711
712
  // compare against r+group_order.
712
- assert(group->field.width == group->order.width);
713
- if (bn_less_than_words(r->words, group->field_minus_order.words,
714
- group->field.width)) {
715
- // We can ignore the carry because: r + group_order < p < 2^256.
716
- EC_FELEM tmp;
717
- bn_add_words(tmp.words, r->words, group->order.d, group->order.width);
713
+ assert(group->field.width == group->order->N.width);
714
+ EC_FELEM tmp;
715
+ BN_ULONG carry =
716
+ bn_add_words(tmp.words, r->words, group->order->N.d, group->field.width);
717
+ if (carry == 0 &&
718
+ bn_less_than_words(tmp.words, group->field.d, group->field.width)) {
718
719
  fiat_p256_from_generic(r_Z2, &tmp);
719
720
  fiat_p256_mul(r_Z2, r_Z2, Z2_mont);
720
721
  if (OPENSSL_memcmp(&r_Z2, &X, sizeof(r_Z2)) == 0) {
@@ -98,9 +98,7 @@ static inline uint8_t p384_use_s2n_bignum_alt(void) {
98
98
  #define p384_felem_add(out, in0, in1) bignum_add_p384(out, in0, in1)
99
99
  #define p384_felem_sub(out, in0, in1) bignum_sub_p384(out, in0, in1)
100
100
  #define p384_felem_opp(out, in0) bignum_neg_p384(out, in0)
101
- // TODO: convert to p384_felem_to_words
102
101
  #define p384_felem_to_bytes(out, in0) bignum_tolebytes_6(out, in0)
103
- // TODO: convert to p384_felem_from_words
104
102
  #define p384_felem_from_bytes(out, in0) bignum_fromlebytes_6(out, in0)
105
103
 
106
104
  // The following four functions need bmi2 and adx support.
@@ -134,9 +132,7 @@ static p384_limb_t p384_felem_nz(const p384_limb_t in1[P384_NLIMBS]) {
134
132
  #define p384_felem_sqr(out, in0) fiat_p384_square(out, in0)
135
133
  #define p384_felem_to_mont(out, in0) fiat_p384_to_montgomery(out, in0)
136
134
  #define p384_felem_from_mont(out, in0) fiat_p384_from_montgomery(out, in0)
137
- // TODO: convert to p384_felem_to_words
138
135
  #define p384_felem_to_bytes(out, in0) fiat_p384_to_bytes(out, in0)
139
- // TODO: convert to p384_felem_from_words
140
136
  #define p384_felem_from_bytes(out, in0) fiat_p384_from_bytes(out, in0)
141
137
 
142
138
  static p384_limb_t p384_felem_nz(const p384_limb_t in1[P384_NLIMBS]) {
@@ -147,6 +143,7 @@ static p384_limb_t p384_felem_nz(const p384_limb_t in1[P384_NLIMBS]) {
147
143
 
148
144
  #endif // P384_USE_S2N_BIGNUM_FIELD_ARITH
149
145
 
146
+
150
147
  static void p384_felem_copy(p384_limb_t out[P384_NLIMBS],
151
148
  const p384_limb_t in1[P384_NLIMBS]) {
152
149
  for (size_t i = 0; i < P384_NLIMBS; i++) {
@@ -164,19 +161,39 @@ static void p384_felem_cmovznz(p384_limb_t out[P384_NLIMBS],
164
161
  }
165
162
  }
166
163
 
167
- // NOTE: the input and output are in little-endian representation.
168
164
  static void p384_from_generic(p384_felem out, const EC_FELEM *in) {
165
+ #ifdef OPENSSL_BIG_ENDIAN
166
+ uint8_t tmp[P384_EC_FELEM_BYTES];
167
+ bn_words_to_little_endian(tmp, P384_EC_FELEM_BYTES, in->words, P384_EC_FELEM_WORDS);
168
+ p384_felem_from_bytes(out, tmp);
169
+ #else
169
170
  p384_felem_from_bytes(out, (const uint8_t *)in->words);
171
+ #endif
170
172
  }
171
173
 
172
- // NOTE: the input and output are in little-endian representation.
173
174
  static void p384_to_generic(EC_FELEM *out, const p384_felem in) {
174
175
  // This works because 384 is a multiple of 64, so there are no excess bytes to
175
176
  // zero when rounding up to |BN_ULONG|s.
176
177
  OPENSSL_STATIC_ASSERT(
177
178
  384 / 8 == sizeof(BN_ULONG) * ((384 + BN_BITS2 - 1) / BN_BITS2),
178
179
  p384_felem_to_bytes_leaves_bytes_uninitialized);
180
+ #ifdef OPENSSL_BIG_ENDIAN
181
+ uint8_t tmp[P384_EC_FELEM_BYTES];
182
+ p384_felem_to_bytes(tmp, in);
183
+ bn_little_endian_to_words(out->words, P384_EC_FELEM_WORDS, tmp, P384_EC_FELEM_BYTES);
184
+ #else
179
185
  p384_felem_to_bytes((uint8_t *)out->words, in);
186
+ #endif
187
+ }
188
+
189
+ static void p384_from_scalar(p384_felem out, const EC_SCALAR *in) {
190
+ #ifdef OPENSSL_BIG_ENDIAN
191
+ uint8_t tmp[P384_EC_FELEM_BYTES];
192
+ bn_words_to_little_endian(tmp, P384_EC_FELEM_BYTES, in->words, P384_EC_FELEM_WORDS);
193
+ p384_felem_from_bytes(out, tmp);
194
+ #else
195
+ p384_felem_from_bytes(out, (const uint8_t *)in->words);
196
+ #endif
180
197
  }
181
198
 
182
199
  // p384_inv_square calculates |out| = |in|^{-2}
@@ -435,7 +452,7 @@ static void p384_point_add(p384_felem x3, p384_felem y3, p384_felem z3,
435
452
  p384_limb_t is_nontrivial_double = constant_time_is_zero_w(xneq | yneq) &
436
453
  ~constant_time_is_zero_w(z1nz) &
437
454
  ~constant_time_is_zero_w(z2nz);
438
- if (is_nontrivial_double) {
455
+ if (constant_time_declassify_w(is_nontrivial_double)) {
439
456
  p384_point_double(x3, y3, z3, x1, y1, z1);
440
457
  return;
441
458
  }
@@ -483,7 +500,7 @@ static int ec_GFp_nistp384_point_get_affine_coordinates(
483
500
  const EC_GROUP *group, const EC_JACOBIAN *point,
484
501
  EC_FELEM *x_out, EC_FELEM *y_out) {
485
502
 
486
- if (ec_GFp_simple_is_at_infinity(group, point)) {
503
+ if (constant_time_declassify_w(ec_GFp_simple_is_at_infinity(group, point))) {
487
504
  OPENSSL_PUT_ERROR(EC, EC_R_POINT_AT_INFINITY);
488
505
  return 0;
489
506
  }
@@ -551,7 +568,7 @@ static void ec_GFp_nistp384_mont_felem_to_bytes(
551
568
  p384_felem_from_mont(tmp, tmp);
552
569
  p384_to_generic(&felem_tmp, tmp);
553
570
 
554
- bn_words_to_big_endian(out, len, felem_tmp.words, group->order.width);
571
+ bn_words_to_big_endian(out, len, felem_tmp.words, group->order->N.width);
555
572
 
556
573
  *out_len = len;
557
574
  }
@@ -586,7 +603,7 @@ static int ec_GFp_nistp384_cmp_x_coordinate(const EC_GROUP *group,
586
603
  p384_felem_mul(Z2_mont, Z2_mont, Z2_mont);
587
604
 
588
605
  p384_felem r_Z2;
589
- p384_felem_from_bytes(r_Z2, (const uint8_t*)r->words); // r < order < p, so this is valid.
606
+ p384_from_scalar(r_Z2, r); // r < order < p, so this is valid.
590
607
  p384_felem_mul(r_Z2, r_Z2, Z2_mont);
591
608
 
592
609
  p384_felem X;
@@ -602,12 +619,12 @@ static int ec_GFp_nistp384_cmp_x_coordinate(const EC_GROUP *group,
602
619
  // that group_order < p.x < p.
603
620
  // In that case, we need not only to compare against |r| but also to
604
621
  // compare against r+group_order.
605
- assert(group->field.width == group->order.width);
606
- if (bn_less_than_words(r->words, group->field_minus_order.words,
607
- group->field.width)) {
608
- // We can ignore the carry because: r + group_order < p < 2^384.
609
- EC_FELEM tmp;
610
- bn_add_words(tmp.words, r->words, group->order.d, group->order.width);
622
+ assert(group->field.width == group->order->N.width);
623
+ EC_FELEM tmp;
624
+ BN_ULONG carry =
625
+ bn_add_words(tmp.words, r->words, group->order->N.d, group->field.width);
626
+ if (carry == 0 &&
627
+ bn_less_than_words(tmp.words, group->field.d, group->field.width)) {
611
628
  p384_from_generic(r_Z2, &tmp);
612
629
  p384_felem_mul(r_Z2, r_Z2, Z2_mont);
613
630
  if (OPENSSL_memcmp(&r_Z2, &X, sizeof(r_Z2)) == 0) {
@@ -100,9 +100,7 @@ static inline uint8_t p521_use_s2n_bignum_alt(void) {
100
100
  #define p521_felem_add(out, in0, in1) bignum_add_p521(out, in0, in1)
101
101
  #define p521_felem_sub(out, in0, in1) bignum_sub_p521(out, in0, in1)
102
102
  #define p521_felem_opp(out, in0) bignum_neg_p521(out, in0)
103
- // TODO: Convert to p521_felem_to_words
104
103
  #define p521_felem_to_bytes(out, in0) bignum_tolebytes_p521(out, in0)
105
- // TODO: Convert to p521_felem_from_words
106
104
  #define p521_felem_from_bytes(out, in0) bignum_fromlebytes_p521(out, in0)
107
105
 
108
106
  // The following two functions need bmi2 and adx support.
@@ -173,9 +171,7 @@ static const p521_limb_t p521_felem_p[P521_NLIMBS] = {
173
171
  #define p521_felem_opp(out, in0) fiat_secp521r1_carry_opp(out, in0)
174
172
  #define p521_felem_mul(out, in0, in1) fiat_secp521r1_carry_mul(out, in0, in1)
175
173
  #define p521_felem_sqr(out, in0) fiat_secp521r1_carry_square(out, in0)
176
- // TODO: Convert to p521_felem_to_words
177
174
  #define p521_felem_to_bytes(out, in0) fiat_secp521r1_to_bytes(out, in0)
178
- // TODO: Convert to p521_felem_from_words
179
175
  #define p521_felem_from_bytes(out, in0) fiat_secp521r1_from_bytes(out, in0)
180
176
 
181
177
  #endif // P521_USE_S2N_BIGNUM_FIELD_ARITH
@@ -220,7 +216,13 @@ static void p521_felem_cmovznz(p521_limb_t out[P521_NLIMBS],
220
216
 
221
217
  // NOTE: the input and output are in little-endian representation.
222
218
  static void p521_from_generic(p521_felem out, const EC_FELEM *in) {
219
+ #ifdef OPENSSL_BIG_ENDIAN
220
+ uint8_t tmp[P521_EC_FELEM_BYTES];
221
+ bn_words_to_little_endian(tmp, P521_EC_FELEM_BYTES, in->words, P521_EC_FELEM_WORDS);
222
+ p521_felem_from_bytes(out, tmp);
223
+ #else
223
224
  p521_felem_from_bytes(out, (const uint8_t *)in->words);
225
+ #endif
224
226
  }
225
227
 
226
228
  // NOTE: the input and output are in little-endian representation.
@@ -233,9 +235,15 @@ static void p521_to_generic(EC_FELEM *out, const p521_felem in) {
233
235
  // translate to 72 bytes, which means that we have to make sure that the
234
236
  // extra 6 bytes are zeroed out. To avoid confusion over 32 vs. 64 bit
235
237
  // systems and Fiat's vs. ours representation we zero out the whole element.
238
+ #ifdef OPENSSL_BIG_ENDIAN
239
+ uint8_t tmp[P521_EC_FELEM_BYTES];
240
+ p521_felem_to_bytes(tmp, in);
241
+ bn_little_endian_to_words(out->words, P521_EC_FELEM_WORDS, tmp, P521_EC_FELEM_BYTES);
242
+ #else
236
243
  OPENSSL_memset((uint8_t*)out->words, 0, sizeof(out->words));
237
244
  // Convert the element to bytes.
238
245
  p521_felem_to_bytes((uint8_t *)out->words, in);
246
+ #endif
239
247
  }
240
248
 
241
249
  // Finite field inversion using Fermat Little Theorem.
@@ -451,7 +459,7 @@ static void p521_point_add(p521_felem x3, p521_felem y3, p521_felem z3,
451
459
  p521_limb_t is_nontrivial_double = constant_time_is_zero_w(xneq | yneq) &
452
460
  ~constant_time_is_zero_w(z1nz) &
453
461
  ~constant_time_is_zero_w(z2nz);
454
- if (is_nontrivial_double) {
462
+ if (constant_time_declassify_w(is_nontrivial_double)) {
455
463
  p521_point_double(x3, y3, z3, x1, y1, z1);
456
464
  return;
457
465
  }
@@ -499,7 +507,7 @@ static int ec_GFp_nistp521_point_get_affine_coordinates(
499
507
  const EC_GROUP *group, const EC_JACOBIAN *point,
500
508
  EC_FELEM *x_out, EC_FELEM *y_out) {
501
509
 
502
- if (ec_GFp_simple_is_at_infinity(group, point)) {
510
+ if (constant_time_declassify_w(ec_GFp_simple_is_at_infinity(group, point))) {
503
511
  OPENSSL_PUT_ERROR(EC, EC_R_POINT_AT_INFINITY);
504
512
  return 0;
505
513
  }
@@ -23,8 +23,9 @@
23
23
 
24
24
  int ec_bignum_to_scalar(const EC_GROUP *group, EC_SCALAR *out,
25
25
  const BIGNUM *in) {
26
- if (!bn_copy_words(out->words, group->order.width, in) ||
27
- !bn_less_than_words(out->words, group->order.d, group->order.width)) {
26
+ if (!bn_copy_words(out->words, group->order->N.width, in) ||
27
+ !bn_less_than_words(out->words, group->order->N.d,
28
+ group->order->N.width)) {
28
29
  OPENSSL_PUT_ERROR(EC, EC_R_INVALID_SCALAR);
29
30
  return 0;
30
31
  }
@@ -34,12 +35,12 @@ int ec_bignum_to_scalar(const EC_GROUP *group, EC_SCALAR *out,
34
35
  int ec_scalar_equal_vartime(const EC_GROUP *group, const EC_SCALAR *a,
35
36
  const EC_SCALAR *b) {
36
37
  return OPENSSL_memcmp(a->words, b->words,
37
- group->order.width * sizeof(BN_ULONG)) == 0;
38
+ group->order->N.width * sizeof(BN_ULONG)) == 0;
38
39
  }
39
40
 
40
41
  int ec_scalar_is_zero(const EC_GROUP *group, const EC_SCALAR *a) {
41
42
  BN_ULONG mask = 0;
42
- for (int i = 0; i < group->order.width; i++) {
43
+ for (int i = 0; i < group->order->N.width; i++) {
43
44
  mask |= a->words[i];
44
45
  }
45
46
  return mask == 0;
@@ -47,27 +48,28 @@ int ec_scalar_is_zero(const EC_GROUP *group, const EC_SCALAR *a) {
47
48
 
48
49
  int ec_random_nonzero_scalar(const EC_GROUP *group, EC_SCALAR *out,
49
50
  const uint8_t additional_data[32]) {
50
- return bn_rand_range_words(out->words, 1, group->order.d, group->order.width,
51
- additional_data);
51
+ return bn_rand_range_words(out->words, 1, group->order->N.d,
52
+ group->order->N.width, additional_data);
52
53
  }
53
54
 
54
55
  void ec_scalar_to_bytes(const EC_GROUP *group, uint8_t *out, size_t *out_len,
55
56
  const EC_SCALAR *in) {
56
- size_t len = BN_num_bytes(&group->order);
57
- bn_words_to_big_endian(out, len, in->words, group->order.width);
57
+ size_t len = BN_num_bytes(&group->order->N);
58
+ bn_words_to_big_endian(out, len, in->words, group->order->N.width);
58
59
  *out_len = len;
59
60
  }
60
61
 
61
62
  int ec_scalar_from_bytes(const EC_GROUP *group, EC_SCALAR *out,
62
63
  const uint8_t *in, size_t len) {
63
- if (len != BN_num_bytes(&group->order)) {
64
+ if (len != BN_num_bytes(&group->order->N)) {
64
65
  OPENSSL_PUT_ERROR(EC, EC_R_INVALID_SCALAR);
65
66
  return 0;
66
67
  }
67
68
 
68
- bn_big_endian_to_words(out->words, group->order.width, in, len);
69
+ bn_big_endian_to_words(out->words, group->order->N.width, in, len);
69
70
 
70
- if (!bn_less_than_words(out->words, group->order.d, group->order.width)) {
71
+ if (!bn_less_than_words(out->words, group->order->N.d,
72
+ group->order->N.width)) {
71
73
  OPENSSL_PUT_ERROR(EC, EC_R_INVALID_SCALAR);
72
74
  return 0;
73
75
  }
@@ -78,15 +80,15 @@ int ec_scalar_from_bytes(const EC_GROUP *group, EC_SCALAR *out,
78
80
  void ec_scalar_reduce(const EC_GROUP *group, EC_SCALAR *out,
79
81
  const BN_ULONG *words, size_t num) {
80
82
  // Convert "from" Montgomery form so the value is reduced modulo the order.
81
- bn_from_montgomery_small(out->words, group->order.width, words, num,
82
- group->order_mont);
83
+ bn_from_montgomery_small(out->words, group->order->N.width, words, num,
84
+ group->order);
83
85
  // Convert "to" Montgomery form to remove the R^-1 factor added.
84
86
  ec_scalar_to_montgomery(group, out, out);
85
87
  }
86
88
 
87
89
  void ec_scalar_add(const EC_GROUP *group, EC_SCALAR *r, const EC_SCALAR *a,
88
90
  const EC_SCALAR *b) {
89
- const BIGNUM *order = &group->order;
91
+ const BIGNUM *order = &group->order->N;
90
92
  BN_ULONG tmp[EC_MAX_WORDS];
91
93
  bn_mod_add_words(r->words, a->words, b->words, order->d, tmp, order->width);
92
94
  OPENSSL_cleanse(tmp, sizeof(tmp));
@@ -94,7 +96,7 @@ void ec_scalar_add(const EC_GROUP *group, EC_SCALAR *r, const EC_SCALAR *a,
94
96
 
95
97
  void ec_scalar_sub(const EC_GROUP *group, EC_SCALAR *r, const EC_SCALAR *a,
96
98
  const EC_SCALAR *b) {
97
- const BIGNUM *order = &group->order;
99
+ const BIGNUM *order = &group->order->N;
98
100
  BN_ULONG tmp[EC_MAX_WORDS];
99
101
  bn_mod_sub_words(r->words, a->words, b->words, order->d, tmp, order->width);
100
102
  OPENSSL_cleanse(tmp, sizeof(tmp));
@@ -108,35 +110,35 @@ void ec_scalar_neg(const EC_GROUP *group, EC_SCALAR *r, const EC_SCALAR *a) {
108
110
 
109
111
  void ec_scalar_select(const EC_GROUP *group, EC_SCALAR *out, BN_ULONG mask,
110
112
  const EC_SCALAR *a, const EC_SCALAR *b) {
111
- const BIGNUM *order = &group->order;
113
+ const BIGNUM *order = &group->order->N;
112
114
  bn_select_words(out->words, mask, a->words, b->words, order->width);
113
115
  }
114
116
 
115
117
  void ec_scalar_to_montgomery(const EC_GROUP *group, EC_SCALAR *r,
116
118
  const EC_SCALAR *a) {
117
- const BIGNUM *order = &group->order;
118
- bn_to_montgomery_small(r->words, a->words, order->width, group->order_mont);
119
+ const BIGNUM *order = &group->order->N;
120
+ bn_to_montgomery_small(r->words, a->words, order->width, group->order);
119
121
  }
120
122
 
121
123
  void ec_scalar_from_montgomery(const EC_GROUP *group, EC_SCALAR *r,
122
124
  const EC_SCALAR *a) {
123
- const BIGNUM *order = &group->order;
125
+ const BIGNUM *order = &group->order->N;
124
126
  bn_from_montgomery_small(r->words, order->width, a->words, order->width,
125
- group->order_mont);
127
+ group->order);
126
128
  }
127
129
 
128
130
  void ec_scalar_mul_montgomery(const EC_GROUP *group, EC_SCALAR *r,
129
131
  const EC_SCALAR *a, const EC_SCALAR *b) {
130
- const BIGNUM *order = &group->order;
132
+ const BIGNUM *order = &group->order->N;
131
133
  bn_mod_mul_montgomery_small(r->words, a->words, b->words, order->width,
132
- group->order_mont);
134
+ group->order);
133
135
  }
134
136
 
135
137
  void ec_simple_scalar_inv0_montgomery(const EC_GROUP *group, EC_SCALAR *r,
136
138
  const EC_SCALAR *a) {
137
- const BIGNUM *order = &group->order;
139
+ const BIGNUM *order = &group->order->N;
138
140
  bn_mod_inverse0_prime_mont_small(r->words, a->words, order->width,
139
- group->order_mont);
141
+ group->order);
140
142
  }
141
143
 
142
144
  int ec_simple_scalar_to_montgomery_inv_vartime(const EC_GROUP *group,
@@ -40,7 +40,7 @@ void ec_GFp_mont_mul(const EC_GROUP *group, EC_JACOBIAN *r,
40
40
  }
41
41
 
42
42
  // Divide bits in |scalar| into windows.
43
- unsigned bits = BN_num_bits(&group->order);
43
+ unsigned bits = EC_GROUP_order_bits(group);
44
44
  int r_is_at_infinity = 1;
45
45
  for (unsigned i = bits - 1; i < bits; i--) {
46
46
  if (!r_is_at_infinity) {
@@ -48,7 +48,7 @@ void ec_GFp_mont_mul(const EC_GROUP *group, EC_JACOBIAN *r,
48
48
  }
49
49
  if (i % 5 == 0) {
50
50
  // Compute the next window value.
51
- const size_t width = group->order.width;
51
+ const size_t width = group->order->N.width;
52
52
  uint8_t window = bn_is_bit_set_words(scalar->words, width, i + 4) << 4;
53
53
  window |= bn_is_bit_set_words(scalar->words, width, i + 3) << 3;
54
54
  window |= bn_is_bit_set_words(scalar->words, width, i + 2) << 2;
@@ -99,7 +99,7 @@ static void ec_GFp_mont_batch_get_window(const EC_GROUP *group,
99
99
  EC_JACOBIAN *out,
100
100
  const EC_JACOBIAN precomp[17],
101
101
  const EC_SCALAR *scalar, unsigned i) {
102
- const size_t width = group->order.width;
102
+ const size_t width = group->order->N.width;
103
103
  uint8_t window = bn_is_bit_set_words(scalar->words, width, i + 4) << 5;
104
104
  window |= bn_is_bit_set_words(scalar->words, width, i + 3) << 4;
105
105
  window |= bn_is_bit_set_words(scalar->words, width, i + 2) << 3;
@@ -120,6 +120,9 @@ static void ec_GFp_mont_batch_get_window(const EC_GROUP *group,
120
120
 
121
121
  // Negate if necessary.
122
122
  EC_FELEM neg_Y;
123
+ // Initialize |out| to avoid "may be used uninitialized" warning below.
124
+ // https://github.com/aws/aws-lc/issues/1185
125
+ OPENSSL_memset(&neg_Y, 0, sizeof(EC_FELEM));
123
126
  ec_felem_neg(group, &neg_Y, &out->Y);
124
127
  crypto_word_t sign_mask = sign;
125
128
  sign_mask = 0u - sign_mask;
@@ -138,7 +141,7 @@ void ec_GFp_mont_mul_batch(const EC_GROUP *group, EC_JACOBIAN *r,
138
141
  }
139
142
 
140
143
  // Divide bits in |scalar| into windows.
141
- unsigned bits = BN_num_bits(&group->order);
144
+ unsigned bits = EC_GROUP_order_bits(group);
142
145
  int r_is_at_infinity = 1;
143
146
  for (unsigned i = bits; i <= bits; i--) {
144
147
  if (!r_is_at_infinity) {
@@ -213,7 +216,7 @@ static void ec_GFp_mont_get_comb_window(const EC_GROUP *group,
213
216
  EC_JACOBIAN *out,
214
217
  const EC_PRECOMP *precomp,
215
218
  const EC_SCALAR *scalar, unsigned i) {
216
- const size_t width = group->order.width;
219
+ const size_t width = group->order->N.width;
217
220
  unsigned stride = ec_GFp_mont_comb_stride(group);
218
221
  // Select the bits corresponding to the comb shifted up by |i|.
219
222
  unsigned window = 0;
@@ -138,8 +138,8 @@ void ec_compute_wNAF(const EC_GROUP *group, int8_t *out,
138
138
  // we shift and add at most one copy of |bit|, this will continue to hold
139
139
  // afterwards.
140
140
  window_val >>= 1;
141
- window_val +=
142
- bit * bn_is_bit_set_words(scalar->words, group->order.width, j + w + 1);
141
+ window_val += bit * bn_is_bit_set_words(scalar->words,
142
+ group->order->N.width, j + w + 1);
143
143
  assert(window_val <= next_bit);
144
144
  }
145
145
 
@@ -183,7 +183,7 @@ int ec_GFp_mont_mul_public_batch(const EC_GROUP *group, EC_JACOBIAN *r,
183
183
  const EC_SCALAR *g_scalar,
184
184
  const EC_JACOBIAN *points,
185
185
  const EC_SCALAR *scalars, size_t num) {
186
- size_t bits = BN_num_bits(&group->order);
186
+ size_t bits = EC_GROUP_order_bits(group);
187
187
  size_t wNAF_len = bits + 1;
188
188
 
189
189
  int ret = 0;
@@ -72,7 +72,7 @@
72
72
  // ECDSA.
73
73
  static void digest_to_scalar(const EC_GROUP *group, EC_SCALAR *out,
74
74
  const uint8_t *digest, size_t digest_len) {
75
- const BIGNUM *order = &group->order;
75
+ const BIGNUM *order = EC_GROUP_get0_order(group);
76
76
  size_t num_bits = BN_num_bits(order);
77
77
  // Need to truncate digest if it is too long: first truncate whole bytes.
78
78
  size_t num_bytes = (num_bits + 7) / 8;
@@ -224,7 +224,7 @@ static ECDSA_SIG *ecdsa_sign_impl(const EC_GROUP *group, int *out_retry,
224
224
  return NULL;
225
225
  }
226
226
 
227
- if (ec_scalar_is_zero(group, &r)) {
227
+ if (constant_time_declassify_int(ec_scalar_is_zero(group, &r))) {
228
228
  *out_retry = 1;
229
229
  return NULL;
230
230
  }
@@ -251,11 +251,13 @@ static ECDSA_SIG *ecdsa_sign_impl(const EC_GROUP *group, int *out_retry,
251
251
  ec_scalar_inv0_montgomery(group, &tmp, k); // tmp = k^-1 R^2
252
252
  ec_scalar_from_montgomery(group, &tmp, &tmp); // tmp = k^-1 R
253
253
  ec_scalar_mul_montgomery(group, &s, &s, &tmp);
254
- if (ec_scalar_is_zero(group, &s)) {
254
+ if (constant_time_declassify_int(ec_scalar_is_zero(group, &s))) {
255
255
  *out_retry = 1;
256
256
  return NULL;
257
257
  }
258
258
 
259
+ CONSTTIME_DECLASSIFY(r.words, sizeof(r.words));
260
+ CONSTTIME_DECLASSIFY(s.words, sizeof(r.words));
259
261
  ECDSA_SIG *ret = ECDSA_SIG_new();
260
262
  if (ret == NULL || //
261
263
  !bn_set_words(ret->r, r.words, order->width) ||
@@ -348,6 +350,10 @@ ECDSA_SIG *ECDSA_do_sign(const uint8_t *digest, size_t digest_len,
348
350
  return NULL;
349
351
  }
350
352
 
353
+ // TODO(davidben): Move this inside |ec_random_nonzero_scalar| or lower, so
354
+ // that all scalars we generate are, by default, secret.
355
+ CONSTTIME_SECRET(k.words, sizeof(k.words));
356
+
351
357
  int retry;
352
358
  ECDSA_SIG *sig =
353
359
  ecdsa_sign_impl(group, &retry, priv_key, &k, digest, digest_len);
@@ -227,6 +227,13 @@ static const EVP_PKEY_ASN1_METHOD *evp_pkey_asn1_find(int nid) {
227
227
  return NULL;
228
228
  }
229
229
 
230
+ static void evp_pkey_set_method(EVP_PKEY *pkey,
231
+ const EVP_PKEY_ASN1_METHOD *method) {
232
+ free_it(pkey);
233
+ pkey->ameth = method;
234
+ pkey->type = pkey->ameth->pkey_id;
235
+ }
236
+
230
237
  int EVP_PKEY_type(int nid) {
231
238
  const EVP_PKEY_ASN1_METHOD *meth = evp_pkey_asn1_find(nid);
232
239
  if (meth == NULL) {
@@ -244,7 +251,11 @@ int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key) {
244
251
  }
245
252
 
246
253
  int EVP_PKEY_assign_RSA(EVP_PKEY *pkey, RSA *key) {
247
- return EVP_PKEY_assign(pkey, EVP_PKEY_RSA, key);
254
+ const EVP_PKEY_ASN1_METHOD *meth = evp_pkey_asn1_find(EVP_PKEY_RSA);
255
+ assert(meth != NULL);
256
+ evp_pkey_set_method(pkey, meth);
257
+ pkey->pkey.ptr = key;
258
+ return key != NULL;
248
259
  }
249
260
 
250
261
  RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey) {
@@ -272,7 +283,11 @@ int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key) {
272
283
  }
273
284
 
274
285
  int EVP_PKEY_assign_DSA(EVP_PKEY *pkey, DSA *key) {
275
- return EVP_PKEY_assign(pkey, EVP_PKEY_DSA, key);
286
+ const EVP_PKEY_ASN1_METHOD *meth = evp_pkey_asn1_find(EVP_PKEY_DSA);
287
+ assert(meth != NULL);
288
+ evp_pkey_set_method(pkey, meth);
289
+ pkey->pkey.ptr = key;
290
+ return key != NULL;
276
291
  }
277
292
 
278
293
  DSA *EVP_PKEY_get0_DSA(const EVP_PKEY *pkey) {
@@ -300,7 +315,11 @@ int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key) {
300
315
  }
301
316
 
302
317
  int EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey, EC_KEY *key) {
303
- return EVP_PKEY_assign(pkey, EVP_PKEY_EC, key);
318
+ const EVP_PKEY_ASN1_METHOD *meth = evp_pkey_asn1_find(EVP_PKEY_EC);
319
+ assert(meth != NULL);
320
+ evp_pkey_set_method(pkey, meth);
321
+ pkey->pkey.ptr = key;
322
+ return key != NULL;
304
323
  }
305
324
 
306
325
  EC_KEY *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey) {
@@ -323,21 +342,34 @@ DH *EVP_PKEY_get0_DH(const EVP_PKEY *pkey) { return NULL; }
323
342
  DH *EVP_PKEY_get1_DH(const EVP_PKEY *pkey) { return NULL; }
324
343
 
325
344
  int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) {
326
- if (!EVP_PKEY_set_type(pkey, type)) {
327
- return 0;
345
+ // This function can only be used to assign RSA, DSA, and EC keys. Other key
346
+ // types have internal representations which are not exposed through the
347
+ // public API.
348
+ switch (type) {
349
+ case EVP_PKEY_RSA:
350
+ return EVP_PKEY_assign_RSA(pkey, key);
351
+ case EVP_PKEY_DSA:
352
+ return EVP_PKEY_assign_DSA(pkey, key);
353
+ case EVP_PKEY_EC:
354
+ return EVP_PKEY_assign_EC_KEY(pkey, key);
355
+ default:
356
+ if (!EVP_PKEY_set_type(pkey, type)) {
357
+ return 0;
358
+ }
359
+ pkey->pkey.ptr = key;
360
+ return key != NULL;
328
361
  }
329
- pkey->pkey.ptr = key;
330
- return key != NULL;
331
362
  }
332
363
 
333
364
  int EVP_PKEY_set_type(EVP_PKEY *pkey, int type) {
334
- const EVP_PKEY_ASN1_METHOD *ameth;
335
-
336
365
  if (pkey && pkey->pkey.ptr) {
366
+ // This isn't strictly necessary, but historically |EVP_PKEY_set_type| would
367
+ // clear |pkey| even if |evp_pkey_asn1_find| failed, so we preserve that
368
+ // behavior.
337
369
  free_it(pkey);
338
370
  }
339
371
 
340
- ameth = evp_pkey_asn1_find(type);
372
+ const EVP_PKEY_ASN1_METHOD *ameth = evp_pkey_asn1_find(type);
341
373
  if (ameth == NULL) {
342
374
  OPENSSL_PUT_ERROR(EVP, EVP_R_UNSUPPORTED_ALGORITHM);
343
375
  ERR_add_error_dataf("algorithm %d", type);
@@ -345,8 +377,7 @@ int EVP_PKEY_set_type(EVP_PKEY *pkey, int type) {
345
377
  }
346
378
 
347
379
  if (pkey) {
348
- pkey->ameth = ameth;
349
- pkey->type = pkey->ameth->pkey_id;
380
+ evp_pkey_set_method(pkey, ameth);
350
381
  }
351
382
 
352
383
  return 1;
@@ -193,9 +193,10 @@ static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) {
193
193
  int md_type = EVP_MD_type(md);
194
194
  if (md_type != NID_sha1 && md_type != NID_sha224 &&
195
195
  md_type != NID_sha256 && md_type != NID_sha384 &&
196
- md_type != NID_sha512 && md_type != NID_sha512_256 &&
197
- md_type != NID_sha3_224 && md_type != NID_sha3_256 &&
198
- md_type != NID_sha3_384 && md_type != NID_sha3_512
196
+ md_type != NID_sha512 && md_type != NID_sha512_224 &&
197
+ md_type != NID_sha512_256 && md_type != NID_sha3_224 &&
198
+ md_type != NID_sha3_256 && md_type != NID_sha3_384 &&
199
+ md_type != NID_sha3_512
199
200
  ) {
200
201
  OPENSSL_PUT_ERROR(EVP, EVP_R_INVALID_DIGEST_TYPE);
201
202
  return 0;