aws-crt 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (322) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/VERSION +1 -1
  4. data/aws-crt-ffi/CMakeLists.txt +49 -41
  5. data/aws-crt-ffi/crt/aws-c-auth/CMakeLists.txt +0 -10
  6. data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/credentials.h +3 -2
  7. data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/private/credentials_utils.h +4 -4
  8. data/aws-crt-ffi/crt/aws-c-auth/source/auth.c +1 -14
  9. data/aws-crt-ffi/crt/aws-c-auth/source/aws_imds_client.c +206 -68
  10. data/aws-crt-ffi/crt/aws-c-auth/source/aws_signing.c +5 -0
  11. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_cached.c +6 -6
  12. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_default_chain.c +16 -1
  13. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_ecs.c +0 -1
  14. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_process.c +0 -1
  15. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_sts_web_identity.c +0 -1
  16. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_x509.c +10 -7
  17. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_utils.c +35 -26
  18. data/aws-crt-ffi/crt/aws-c-auth/source/signable_chunk.c +3 -2
  19. data/aws-crt-ffi/crt/aws-c-auth/tests/CMakeLists.txt +3 -2
  20. data/aws-crt-ffi/crt/aws-c-auth/tests/aws_imds_client_test.c +1 -0
  21. data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_ecs_tests.c +3 -0
  22. data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_process_tests.c +65 -16
  23. data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_tests.c +125 -0
  24. data/aws-crt-ffi/crt/aws-c-auth/tests/sigv4_signing_tests.c +68 -46
  25. data/aws-crt-ffi/crt/aws-c-cal/CMakeLists.txt +8 -3
  26. data/aws-crt-ffi/crt/aws-c-cal/bin/run_x_platform_fuzz_corpus/main.c +9 -0
  27. data/aws-crt-ffi/crt/aws-c-cal/builder.json +11 -3
  28. data/aws-crt-ffi/crt/aws-c-cal/cmake/aws-c-cal-config.cmake +14 -5
  29. data/aws-crt-ffi/crt/aws-c-cal/source/darwin/securityframework_ecc.c +6 -6
  30. data/aws-crt-ffi/crt/aws-c-cal/source/windows/bcrypt_ecc.c +12 -12
  31. data/aws-crt-ffi/crt/aws-c-cal/tests/test_case_helper.h +14 -14
  32. data/aws-crt-ffi/crt/aws-c-common/CMakeLists.txt +21 -1
  33. data/aws-crt-ffi/crt/aws-c-common/README.md +8 -0
  34. data/aws-crt-ffi/crt/aws-c-common/cmake/AwsCFlags.cmake +20 -5
  35. data/aws-crt-ffi/crt/aws-c-common/cmake/AwsFeatureTests.cmake +7 -1
  36. data/aws-crt-ffi/crt/aws-c-common/format-check.sh +1 -1
  37. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_buf.h +14 -0
  38. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/config.h.in +1 -0
  39. data/aws-crt-ffi/crt/{aws-c-auth/include/aws/auth → aws-c-common/include/aws/common}/external/cJSON.h +82 -74
  40. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/json.h +335 -0
  41. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/logging.h +1 -0
  42. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/math.inl +2 -2
  43. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/private/json_impl.h +22 -0
  44. data/aws-crt-ffi/crt/aws-c-common/include/aws/testing/aws_test_harness.h +2 -0
  45. data/aws-crt-ffi/crt/aws-c-common/source/byte_buf.c +36 -0
  46. data/aws-crt-ffi/crt/aws-c-common/source/common.c +5 -2
  47. data/aws-crt-ffi/crt/aws-c-common/source/external/cJSON.c +3113 -0
  48. data/aws-crt-ffi/crt/aws-c-common/source/file.c +9 -0
  49. data/aws-crt-ffi/crt/aws-c-common/source/json.c +348 -0
  50. data/aws-crt-ffi/crt/aws-c-common/source/logging.c +7 -2
  51. data/aws-crt-ffi/crt/aws-c-common/source/posix/system_info.c +8 -0
  52. data/aws-crt-ffi/crt/aws-c-common/source/ref_count.c +3 -1
  53. data/aws-crt-ffi/crt/aws-c-common/source/windows/file.c +47 -0
  54. data/aws-crt-ffi/crt/aws-c-common/source/windows/system_info.c +2 -1
  55. data/aws-crt-ffi/crt/aws-c-common/tests/CMakeLists.txt +5 -0
  56. data/aws-crt-ffi/crt/aws-c-common/tests/byte_buf_test.c +69 -0
  57. data/aws-crt-ffi/crt/aws-c-common/tests/json_test.c +134 -0
  58. data/aws-crt-ffi/crt/aws-c-common/tests/memtrace_test.c +6 -2
  59. data/aws-crt-ffi/crt/aws-c-event-stream/README.md +18 -35
  60. data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream.h +21 -2
  61. data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc_client.h +14 -2
  62. data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc_server.h +13 -0
  63. data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/private/event_stream_rpc_priv.h +7 -7
  64. data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream.c +257 -141
  65. data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_channel_handler.c +1 -1
  66. data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_rpc_client.c +31 -8
  67. data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_rpc_server.c +63 -10
  68. data/aws-crt-ffi/crt/aws-c-event-stream/tests/CMakeLists.txt +2 -0
  69. data/aws-crt-ffi/crt/aws-c-event-stream/tests/event_stream_rpc_client_connection_test.c +157 -106
  70. data/aws-crt-ffi/crt/aws-c-event-stream/tests/event_stream_rpc_server_connection_test.c +168 -1
  71. data/aws-crt-ffi/crt/aws-c-event-stream/tests/message_deserializer_test.c +4 -2
  72. data/aws-crt-ffi/crt/aws-c-http/CMakeLists.txt +1 -0
  73. data/aws-crt-ffi/crt/aws-c-http/README.md +8 -0
  74. data/aws-crt-ffi/crt/aws-c-http/bin/elasticurl/main.c +1 -1
  75. data/aws-crt-ffi/crt/aws-c-http/builder.json +4 -3
  76. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection.h +8 -1
  77. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection_manager.h +45 -1
  78. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/http2_stream_manager.h +63 -12
  79. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/connection_impl.h +2 -1
  80. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_connection.h +20 -2
  81. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_frames.h +1 -0
  82. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_stream.h +42 -13
  83. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/http2_stream_manager_impl.h +17 -0
  84. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/http_impl.h +3 -0
  85. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/random_access_set.h +10 -3
  86. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/request_response_impl.h +3 -17
  87. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/request_response.h +108 -4
  88. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/statistics.h +22 -0
  89. data/aws-crt-ffi/crt/aws-c-http/source/connection.c +8 -3
  90. data/aws-crt-ffi/crt/aws-c-http/source/connection_manager.c +22 -3
  91. data/aws-crt-ffi/crt/aws-c-http/source/connection_monitor.c +32 -14
  92. data/aws-crt-ffi/crt/aws-c-http/source/h1_connection.c +14 -0
  93. data/aws-crt-ffi/crt/aws-c-http/source/h1_encoder.c +7 -4
  94. data/aws-crt-ffi/crt/aws-c-http/source/h2_connection.c +161 -45
  95. data/aws-crt-ffi/crt/aws-c-http/source/h2_decoder.c +37 -8
  96. data/aws-crt-ffi/crt/aws-c-http/source/h2_frames.c +13 -1
  97. data/aws-crt-ffi/crt/aws-c-http/source/h2_stream.c +345 -87
  98. data/aws-crt-ffi/crt/aws-c-http/source/hpack.c +3 -0
  99. data/aws-crt-ffi/crt/aws-c-http/source/http.c +3 -0
  100. data/aws-crt-ffi/crt/aws-c-http/source/http2_stream_manager.c +266 -39
  101. data/aws-crt-ffi/crt/aws-c-http/source/random_access_set.c +9 -3
  102. data/aws-crt-ffi/crt/aws-c-http/source/request_response.c +80 -20
  103. data/aws-crt-ffi/crt/aws-c-http/source/statistics.c +11 -0
  104. data/aws-crt-ffi/crt/aws-c-http/tests/CMakeLists.txt +28 -1
  105. data/aws-crt-ffi/crt/aws-c-http/tests/fuzz/fuzz_h2_decoder_correct.c +5 -3
  106. data/aws-crt-ffi/crt/aws-c-http/tests/h2_test_helper.c +133 -29
  107. data/aws-crt-ffi/crt/aws-c-http/tests/h2_test_helper.h +6 -0
  108. data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/README.md +40 -0
  109. data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/non_tls_server.py +56 -0
  110. data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/server.py +329 -0
  111. data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_manager.c +1 -1
  112. data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_monitor.c +2 -2
  113. data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_client.c +47 -34
  114. data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_encoder.c +4 -4
  115. data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_server.c +15 -12
  116. data/aws-crt-ffi/crt/aws-c-http/tests/test_h2_client.c +582 -25
  117. data/aws-crt-ffi/crt/aws-c-http/tests/test_h2_encoder.c +3 -3
  118. data/aws-crt-ffi/crt/aws-c-http/tests/test_localhost_integ.c +530 -0
  119. data/aws-crt-ffi/crt/aws-c-http/tests/test_stream_manager.c +459 -67
  120. data/aws-crt-ffi/crt/aws-c-io/CMakeLists.txt +4 -0
  121. data/aws-crt-ffi/crt/aws-c-io/builder.json +3 -2
  122. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/channel.h +21 -0
  123. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/io.h +3 -0
  124. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/socket.h +6 -0
  125. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/stream.h +35 -5
  126. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/tls_channel_handler.h +211 -15
  127. data/aws-crt-ffi/crt/aws-c-io/source/channel.c +56 -30
  128. data/aws-crt-ffi/crt/aws-c-io/source/darwin/secure_transport_tls_channel_handler.c +0 -24
  129. data/aws-crt-ffi/crt/aws-c-io/source/io.c +9 -0
  130. data/aws-crt-ffi/crt/aws-c-io/source/{pkcs11.c → pkcs11_lib.c} +162 -22
  131. data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_private.h +18 -20
  132. data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_tls_op_handler.c +221 -0
  133. data/aws-crt-ffi/crt/aws-c-io/source/posix/socket.c +135 -81
  134. data/aws-crt-ffi/crt/aws-c-io/source/retry_strategy.c +12 -8
  135. data/aws-crt-ffi/crt/aws-c-io/source/s2n/s2n_tls_channel_handler.c +252 -215
  136. data/aws-crt-ffi/crt/aws-c-io/source/stream.c +65 -82
  137. data/aws-crt-ffi/crt/aws-c-io/source/tls_channel_handler.c +188 -57
  138. data/aws-crt-ffi/crt/aws-c-io/source/windows/iocp/socket.c +271 -256
  139. data/aws-crt-ffi/crt/aws-c-io/tests/CMakeLists.txt +21 -12
  140. data/aws-crt-ffi/crt/aws-c-io/tests/channel_test.c +32 -4
  141. data/aws-crt-ffi/crt/aws-c-io/tests/io_lib_test.c +37 -0
  142. data/aws-crt-ffi/crt/aws-c-io/tests/pkcs11_test.c +412 -93
  143. data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.crt +15 -0
  144. data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.key +5 -0
  145. data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.p12 +0 -0
  146. data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.p8 +5 -0
  147. data/aws-crt-ffi/crt/aws-c-io/tests/resources/generateCerts.sh +24 -15
  148. data/aws-crt-ffi/crt/aws-c-io/tests/socket_test.c +72 -1
  149. data/aws-crt-ffi/crt/s2n/CMakeLists.txt +6 -1
  150. data/aws-crt-ffi/crt/s2n/bindings/rust/Cargo.toml +1 -0
  151. data/aws-crt-ffi/crt/s2n/bindings/rust/generate/src/main.rs +105 -82
  152. data/aws-crt-ffi/crt/s2n/bindings/rust/generate.sh +1 -0
  153. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/Cargo.toml +2 -2
  154. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/src/raw/config.rs +1 -1
  155. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/Cargo.toml +1 -1
  156. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/build.rs +84 -30
  157. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/src/lib.rs +4 -0
  158. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/Cargo.toml +21 -0
  159. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/certs/cert.pem +14 -0
  160. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/certs/key.pem +8 -0
  161. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/client.rs +45 -0
  162. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/server.rs +60 -0
  163. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/src/lib.rs +150 -0
  164. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/tests/handshake.rs +51 -0
  165. data/aws-crt-ffi/crt/s2n/crypto/s2n_drbg.c +98 -77
  166. data/aws-crt-ffi/crt/s2n/crypto/s2n_drbg.h +10 -7
  167. data/aws-crt-ffi/crt/s2n/crypto/s2n_openssl.h +2 -0
  168. data/aws-crt-ffi/crt/s2n/error/s2n_errno.c +1 -1
  169. data/aws-crt-ffi/crt/s2n/error/s2n_errno.h +1 -0
  170. data/aws-crt-ffi/crt/s2n/s2n.mk +7 -0
  171. data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/repository.py +233 -0
  172. data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/setup-proof.py +8 -7
  173. data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/setup.py +17 -18
  174. data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/util.py +41 -23
  175. data/aws-crt-ffi/crt/s2n/tests/fuzz/LD_PRELOAD/global_overrides.c +3 -3
  176. data/aws-crt-ffi/crt/s2n/tests/integration/s2n_client_endpoint_handshake_test.py +2 -2
  177. data/aws-crt-ffi/crt/s2n/tests/integrationv2/Makefile +13 -42
  178. data/aws-crt-ffi/crt/s2n/tests/integrationv2/README.md +6 -1
  179. data/aws-crt-ffi/crt/s2n/tests/integrationv2/common.py +118 -53
  180. data/aws-crt-ffi/crt/s2n/tests/integrationv2/configuration.py +108 -88
  181. data/aws-crt-ffi/crt/s2n/tests/integrationv2/conftest.py +6 -3
  182. data/aws-crt-ffi/crt/s2n/tests/integrationv2/constants.py +6 -4
  183. data/aws-crt-ffi/crt/s2n/tests/integrationv2/fixtures.py +21 -12
  184. data/aws-crt-ffi/crt/s2n/tests/integrationv2/global_flags.py +1 -0
  185. data/aws-crt-ffi/crt/s2n/tests/integrationv2/processes.py +62 -19
  186. data/aws-crt-ffi/crt/s2n/tests/integrationv2/providers.py +304 -48
  187. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_client_authentication.py +20 -11
  188. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_cross_compatibility.py +41 -17
  189. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_dynamic_record_sizes.py +6 -3
  190. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_early_data.py +105 -48
  191. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_external_psk.py +160 -76
  192. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_fragmentation.py +59 -26
  193. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_happy_path.py +42 -28
  194. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_hello_retry_requests.py +33 -13
  195. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_key_update.py +29 -11
  196. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_ocsp.py +138 -0
  197. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_pq_handshake.py +103 -36
  198. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_session_resumption.py +52 -25
  199. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_signature_algorithms.py +47 -21
  200. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_sni_match.py +13 -9
  201. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_sslyze.py +88 -17
  202. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_version_negotiation.py +71 -22
  203. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_well_known_endpoints.py +4 -3
  204. data/aws-crt-ffi/crt/s2n/tests/integrationv2/tox.ini +1 -0
  205. data/aws-crt-ffi/crt/s2n/tests/integrationv2/utils.py +50 -15
  206. data/aws-crt-ffi/crt/s2n/tests/litani/CHANGELOG +131 -0
  207. data/aws-crt-ffi/crt/s2n/tests/litani/CONTRIBUTING.md +16 -0
  208. data/aws-crt-ffi/crt/s2n/tests/litani/README.md +36 -14
  209. data/aws-crt-ffi/crt/s2n/tests/litani/THIRD-PARTY +205 -41
  210. data/aws-crt-ffi/crt/s2n/tests/litani/doc/bin/build-html-doc +7 -7
  211. data/aws-crt-ffi/crt/s2n/tests/litani/doc/configure +27 -23
  212. data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-add-job.scdoc +7 -0
  213. data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-dump-run.scdoc +7 -5
  214. data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-transform-jobs.scdoc +248 -0
  215. data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani.scdoc +2 -2
  216. data/aws-crt-ffi/crt/s2n/tests/litani/doc/templates/index.jinja.html +4 -0
  217. data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/README +12 -0
  218. data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/original-run.sh +52 -0
  219. data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/run-all.py +71 -0
  220. data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/README +13 -0
  221. data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-1.sh +34 -0
  222. data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-2.sh +35 -0
  223. data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-3.sh +34 -0
  224. data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-all.py +60 -0
  225. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/README.md +10 -0
  226. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/assumptions.html +42 -0
  227. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/file.dat +7 -0
  228. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/histogram.dat +7 -0
  229. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-1.sh +41 -0
  230. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-2.sh +47 -0
  231. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-3.sh +41 -0
  232. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-all.py +34 -0
  233. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib-table.py +40 -0
  234. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib.plt +5 -0
  235. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib.py +32 -0
  236. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin-output.py +40 -0
  237. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin.plt +5 -0
  238. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin.py +30 -0
  239. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/templates/fib-table.jinja.html +45 -0
  240. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/templates/sin-output.jinja.html +30 -0
  241. data/aws-crt-ffi/crt/s2n/tests/litani/lib/add_job.py +55 -0
  242. data/aws-crt-ffi/crt/s2n/tests/litani/lib/graph.py +2 -2
  243. data/aws-crt-ffi/crt/s2n/tests/litani/lib/litani.py +6 -1
  244. data/aws-crt-ffi/crt/s2n/tests/litani/lib/litani_report.py +18 -21
  245. data/aws-crt-ffi/crt/s2n/tests/litani/lib/ninja.py +2 -0
  246. data/aws-crt-ffi/crt/s2n/tests/litani/lib/run_printer.py +26 -7
  247. data/aws-crt-ffi/crt/s2n/tests/litani/lib/transform_jobs.py +84 -0
  248. data/aws-crt-ffi/crt/s2n/tests/litani/litani +28 -33
  249. data/aws-crt-ffi/crt/s2n/tests/litani/script/release +220 -0
  250. data/aws-crt-ffi/crt/s2n/tests/litani/templates/dashboard.jinja.html +78 -15
  251. data/aws-crt-ffi/crt/s2n/tests/litani/templates/pipeline.jinja.html +21 -5
  252. data/aws-crt-ffi/crt/s2n/tests/litani/test/README +15 -0
  253. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/run +56 -33
  254. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/custom_stages.py +1 -0
  255. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/cwd.py +1 -0
  256. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/dump_run.py +1 -0
  257. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/graph_line_break.py +1 -0
  258. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/html_node.py +1 -0
  259. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/job_id_env.py +1 -0
  260. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/multiproc_dump_run.py +1 -0
  261. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_pool_serialize.py +1 -0
  262. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_pool_serialize_graph.py +1 -0
  263. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out.py +1 -0
  264. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out_timeout_ignored.py +1 -0
  265. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out_timeout_ok.py +1 -0
  266. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pipeline_order.py +53 -0
  267. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pool_serialize.py +1 -0
  268. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pool_serialize_graph.py +1 -0
  269. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/single_pool.py +1 -0
  270. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out.py +1 -0
  271. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess.py +1 -0
  272. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess_multi_shell.py +1 -0
  273. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess_shell.py +1 -0
  274. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_timeout_ignored.py +1 -0
  275. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_timeout_ok.py +1 -0
  276. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_delete_job.py +54 -0
  277. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_modify_job.py +46 -0
  278. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_no_change_job.py +44 -0
  279. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/zero_pool.py +1 -0
  280. data/aws-crt-ffi/crt/s2n/tests/litani/test/run +82 -12
  281. data/aws-crt-ffi/crt/s2n/tests/s2n_test.h +58 -33
  282. data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_key_schedule_testlib.c +18 -6
  283. data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_pq_kat_test_utils.c +4 -4
  284. data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_testlib.h +2 -0
  285. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_hello_retry_test.c +66 -2
  286. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_connection_test.c +1 -1
  287. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_drbg_test.c +34 -14
  288. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_fork_generation_number_test.c +28 -5
  289. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_mem_usage_test.c +6 -0
  290. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_override_openssl_random_test.c +1 -1
  291. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_random_test.c +60 -41
  292. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_self_talk_broken_pipe_test.c +2 -2
  293. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_handshake_early_data_test.c +3 -1
  294. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_hybrid_shared_secret_test.c +9 -1
  295. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_key_schedule_rfc8448_test.c +31 -130
  296. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_key_schedule_test.c +2 -4
  297. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_pq_handshake_test.c +11 -6
  298. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_secrets_rfc8448_test.c +19 -21
  299. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_secrets_test.c +109 -60
  300. data/aws-crt-ffi/crt/s2n/tls/s2n_config.c +1 -0
  301. data/aws-crt-ffi/crt/s2n/tls/s2n_config.h +1 -1
  302. data/aws-crt-ffi/crt/s2n/tls/s2n_connection.c +29 -24
  303. data/aws-crt-ffi/crt/s2n/tls/s2n_connection.h +5 -5
  304. data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_hashes.h +1 -7
  305. data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_io.c +2 -0
  306. data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_transcript.c +0 -44
  307. data/aws-crt-ffi/crt/s2n/tls/s2n_internal.h +0 -1
  308. data/aws-crt-ffi/crt/s2n/tls/s2n_quic_support.h +1 -1
  309. data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_key_schedule.c +1 -2
  310. data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_secrets.c +84 -44
  311. data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_secrets.h +3 -9
  312. data/aws-crt-ffi/crt/s2n/utils/s2n_blob.h +15 -8
  313. data/aws-crt-ffi/crt/s2n/utils/s2n_fork_detection.c +2 -6
  314. data/aws-crt-ffi/crt/s2n/utils/s2n_random.c +9 -9
  315. data/aws-crt-ffi/src/input_stream.c +32 -15
  316. data/ext/compile.rb +13 -5
  317. data/lib/aws-crt/platforms.rb +14 -5
  318. data/lib/aws-crt/string_blob.rb +3 -3
  319. metadata +61 -7
  320. data/aws-crt-ffi/crt/aws-c-auth/source/external/cJSON.c +0 -2987
  321. data/aws-crt-ffi/crt/aws-c-auth/tests/external/cJSON.c +0 -2986
  322. data/aws-crt-ffi/crt/aws-c-io/tests/error_test.c +0 -20
@@ -16,6 +16,8 @@
16
16
  #include <aws/io/socket.h>
17
17
  #include <ctype.h>
18
18
 
19
+ #include <aws/common/json.h>
20
+
19
21
  #if defined(_MSC_VER)
20
22
  # pragma warning(disable : 4204)
21
23
  # pragma warning(disable : 4232)
@@ -1059,32 +1061,46 @@ on_finish:
1059
1061
  "InstanceProfileId" : "AIPAQOHATHEGTGNQ5THQB"
1060
1062
  }
1061
1063
  */
1062
- static int s_parse_iam_profile(cJSON *document_root, struct aws_imds_iam_profile *dest) {
1064
+ static int s_parse_iam_profile(struct aws_json_value *document_root, struct aws_imds_iam_profile *dest) {
1063
1065
 
1064
1066
  bool success = false;
1065
1067
 
1066
- cJSON *last_updated = cJSON_GetObjectItemCaseSensitive(document_root, "LastUpdated");
1067
- if (!cJSON_IsString(last_updated) || (last_updated->valuestring == NULL)) {
1068
+ struct aws_byte_cursor last_updated_cursor;
1069
+ struct aws_json_value *last_updated =
1070
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("LastUpdated"));
1071
+ if (last_updated == NULL) {
1072
+ last_updated = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("lastupdated"));
1073
+ }
1074
+ if (!aws_json_value_is_string(last_updated) ||
1075
+ (aws_json_value_get_string(last_updated, &last_updated_cursor) == AWS_OP_ERR)) {
1068
1076
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse LastUpdated from Json document for iam profile.");
1069
1077
  goto done;
1070
1078
  }
1071
1079
 
1072
- cJSON *profile_arn = cJSON_GetObjectItemCaseSensitive(document_root, "InstanceProfileArn");
1073
- if (!cJSON_IsString(profile_arn) || (profile_arn->valuestring == NULL)) {
1080
+ struct aws_byte_cursor profile_arn_cursor;
1081
+ struct aws_json_value *profile_arn =
1082
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("InstanceProfileArn"));
1083
+ if (profile_arn == NULL) {
1084
+ profile_arn = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instanceprofilearn"));
1085
+ }
1086
+ if (!aws_json_value_is_string(profile_arn) ||
1087
+ (aws_json_value_get_string(profile_arn, &profile_arn_cursor) == AWS_OP_ERR)) {
1074
1088
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse InstanceProfileArn from Json document for iam profile.");
1075
1089
  goto done;
1076
1090
  }
1077
1091
 
1078
- cJSON *profile_id = cJSON_GetObjectItemCaseSensitive(document_root, "InstanceProfileId");
1079
- if (!cJSON_IsString(profile_id) || (profile_id->valuestring == NULL)) {
1092
+ struct aws_byte_cursor profile_id_cursor;
1093
+ struct aws_json_value *profile_id =
1094
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("InstanceProfileId"));
1095
+ if (profile_id == NULL) {
1096
+ profile_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instanceprofileid"));
1097
+ }
1098
+ if (!aws_json_value_is_string(profile_id) ||
1099
+ (aws_json_value_get_string(profile_id, &profile_id_cursor) == AWS_OP_ERR)) {
1080
1100
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse InstanceProfileId from Json document for iam profile.");
1081
1101
  goto done;
1082
1102
  }
1083
1103
 
1084
- struct aws_byte_cursor last_updated_cursor = aws_byte_cursor_from_c_str(last_updated->valuestring);
1085
- struct aws_byte_cursor profile_arn_cursor = aws_byte_cursor_from_c_str(profile_arn->valuestring);
1086
- struct aws_byte_cursor profile_id_cursor = aws_byte_cursor_from_c_str(profile_id->valuestring);
1087
-
1088
1104
  if (last_updated_cursor.len == 0 || profile_arn_cursor.len == 0 || profile_id_cursor.len == 0) {
1089
1105
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Parsed an unexpected Json document fro iam profile.");
1090
1106
  goto done;
@@ -1107,7 +1123,7 @@ done:
1107
1123
 
1108
1124
  static void s_process_iam_profile(const struct aws_byte_buf *resource, int error_code, void *user_data) {
1109
1125
  struct imds_get_iam_user_data *wrapped_user_data = user_data;
1110
- cJSON *document_root = NULL;
1126
+ struct aws_json_value *document_root = NULL;
1111
1127
  struct aws_imds_iam_profile iam;
1112
1128
  AWS_ZERO_STRUCT(iam);
1113
1129
 
@@ -1126,7 +1142,8 @@ static void s_process_iam_profile(const struct aws_byte_buf *resource, int error
1126
1142
  goto on_finish;
1127
1143
  }
1128
1144
 
1129
- document_root = cJSON_Parse((const char *)json_data.buffer);
1145
+ struct aws_byte_cursor json_data_cursor = aws_byte_cursor_from_buf(&json_data);
1146
+ document_root = aws_json_value_new_from_string(aws_default_allocator(), json_data_cursor);
1130
1147
  if (document_root == NULL) {
1131
1148
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse document as Json document for iam profile.");
1132
1149
  goto on_finish;
@@ -1141,7 +1158,7 @@ on_finish:
1141
1158
  aws_byte_buf_clean_up_secure(&json_data);
1142
1159
  aws_mem_release(wrapped_user_data->allocator, wrapped_user_data);
1143
1160
  if (document_root != NULL) {
1144
- cJSON_Delete(document_root);
1161
+ aws_json_value_destroy(document_root);
1145
1162
  }
1146
1163
  }
1147
1164
 
@@ -1164,108 +1181,228 @@ on_finish:
1164
1181
  "version" : "2017-09-30"
1165
1182
  }
1166
1183
  */
1167
- static int s_parse_instance_info(cJSON *document_root, struct aws_imds_instance_info *dest) {
1184
+ static int s_parse_instance_info(struct aws_json_value *document_root, struct aws_imds_instance_info *dest) {
1168
1185
 
1169
1186
  bool success = false;
1170
- cJSON *account_id = cJSON_GetObjectItemCaseSensitive(document_root, "accountId");
1171
- if (!cJSON_IsString(account_id) || (account_id->valuestring == NULL)) {
1187
+
1188
+ struct aws_byte_cursor account_id_cursor;
1189
+ struct aws_json_value *account_id =
1190
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("accountId"));
1191
+ if (account_id == NULL) {
1192
+ account_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("accountid"));
1193
+ if (account_id == NULL) {
1194
+ account_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("AccountId"));
1195
+ }
1196
+ }
1197
+ if (!aws_json_value_is_string(account_id) ||
1198
+ (aws_json_value_get_string(account_id, &account_id_cursor) == AWS_OP_ERR)) {
1172
1199
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse accountId from Json document for ec2 instance info.");
1173
1200
  goto done;
1174
1201
  }
1175
- dest->account_id = aws_byte_cursor_from_c_str(account_id->valuestring);
1202
+ dest->account_id = account_id_cursor;
1176
1203
 
1177
- cJSON *architecture = cJSON_GetObjectItemCaseSensitive(document_root, "architecture");
1178
- if (!cJSON_IsString(architecture) || (architecture->valuestring == NULL)) {
1204
+ struct aws_byte_cursor architecture_cursor;
1205
+ struct aws_json_value *architecture =
1206
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("architecture"));
1207
+ if (architecture == NULL) {
1208
+ architecture = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("Architecture"));
1209
+ }
1210
+ if (!aws_json_value_is_string(architecture) ||
1211
+ (aws_json_value_get_string(architecture, &architecture_cursor) == AWS_OP_ERR)) {
1179
1212
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse architecture from Json document for ec2 instance info.");
1180
1213
  goto done;
1181
1214
  }
1182
- dest->architecture = aws_byte_cursor_from_c_str(architecture->valuestring);
1183
-
1184
- cJSON *availability_zone = cJSON_GetObjectItemCaseSensitive(document_root, "availabilityZone");
1185
- if (!cJSON_IsString(availability_zone) || (availability_zone->valuestring == NULL)) {
1215
+ dest->architecture = architecture_cursor;
1216
+
1217
+ struct aws_byte_cursor availability_zone_cursor;
1218
+ struct aws_json_value *availability_zone =
1219
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("availabilityZone"));
1220
+ if (availability_zone == NULL) {
1221
+ availability_zone =
1222
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("availabilityzone"));
1223
+ if (availability_zone == NULL) {
1224
+ availability_zone =
1225
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("AvailabilityZone"));
1226
+ }
1227
+ }
1228
+ if (!aws_json_value_is_string(availability_zone) ||
1229
+ (aws_json_value_get_string(availability_zone, &availability_zone_cursor) == AWS_OP_ERR)) {
1186
1230
  AWS_LOGF_ERROR(
1187
1231
  AWS_LS_IMDS_CLIENT, "Failed to parse availabilityZone from Json document for ec2 instance info.");
1188
1232
  goto done;
1189
1233
  }
1190
- dest->availability_zone = aws_byte_cursor_from_c_str(availability_zone->valuestring);
1234
+ dest->availability_zone = availability_zone_cursor;
1191
1235
 
1192
- cJSON *billing_products = cJSON_GetObjectItemCaseSensitive(document_root, "billingProducts");
1193
- if (cJSON_IsArray(billing_products)) {
1194
- cJSON *element;
1195
- cJSON_ArrayForEach(element, billing_products) {
1196
- if (cJSON_IsString(element) && (element->valuestring != NULL)) {
1197
- struct aws_byte_cursor item = aws_byte_cursor_from_c_str(element->valuestring);
1236
+ struct aws_byte_cursor billing_products_cursor;
1237
+ struct aws_json_value *billing_products =
1238
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("billingProducts"));
1239
+ if (billing_products == NULL) {
1240
+ billing_products = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("billingproducts"));
1241
+ if (billing_products == NULL) {
1242
+ billing_products =
1243
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("BillingProducts"));
1244
+ }
1245
+ }
1246
+ if (aws_json_value_is_array(billing_products)) {
1247
+ struct aws_json_value *element;
1248
+ for (size_t i = 0; i < aws_json_get_array_size(billing_products); i++) {
1249
+ element = aws_json_get_array_element(billing_products, i);
1250
+ if (aws_json_value_is_string(element) &&
1251
+ aws_json_value_get_string(element, &billing_products_cursor) != AWS_OP_ERR) {
1252
+ struct aws_byte_cursor item = billing_products_cursor;
1198
1253
  aws_array_list_push_back(&dest->billing_products, (const void *)&item);
1199
1254
  }
1200
1255
  }
1201
1256
  }
1202
1257
 
1203
- cJSON *marketplace_product_codes = cJSON_GetObjectItemCaseSensitive(document_root, "marketplaceProductCodes");
1204
- if (cJSON_IsArray(marketplace_product_codes)) {
1205
- cJSON *element;
1206
- cJSON_ArrayForEach(element, marketplace_product_codes) {
1207
- if (cJSON_IsString(element) && (element->valuestring != NULL)) {
1208
- struct aws_byte_cursor item = aws_byte_cursor_from_c_str(element->valuestring);
1209
- aws_array_list_push_back(&dest->marketplace_product_codes, (const void *)&item);
1258
+ struct aws_byte_cursor marketplace_product_codes_cursor;
1259
+ struct aws_json_value *marketplace_product_codes =
1260
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("marketplaceProductCodes"));
1261
+ if (marketplace_product_codes == NULL) {
1262
+ marketplace_product_codes =
1263
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("marketplaceproductcodes"));
1264
+ if (marketplace_product_codes == NULL) {
1265
+ marketplace_product_codes =
1266
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("MarketplaceProductCodes"));
1267
+ }
1268
+ }
1269
+ if (aws_json_value_is_array(marketplace_product_codes)) {
1270
+ struct aws_json_value *element;
1271
+ for (size_t i = 0; i < aws_json_get_array_size(marketplace_product_codes); i++) {
1272
+ element = aws_json_get_array_element(marketplace_product_codes, i);
1273
+ if (aws_json_value_is_string(element) &&
1274
+ aws_json_value_get_string(element, &marketplace_product_codes_cursor) != AWS_OP_ERR) {
1275
+ struct aws_byte_cursor item = marketplace_product_codes_cursor;
1276
+ aws_array_list_push_back(&dest->billing_products, (const void *)&item);
1210
1277
  }
1211
1278
  }
1212
1279
  }
1213
1280
 
1214
- cJSON *image_id = cJSON_GetObjectItemCaseSensitive(document_root, "imageId");
1215
- if (cJSON_IsString(image_id) && (image_id->valuestring != NULL)) {
1216
- dest->image_id = aws_byte_cursor_from_c_str(image_id->valuestring);
1281
+ struct aws_byte_cursor image_id_cursor;
1282
+ struct aws_json_value *image_id =
1283
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("imageId"));
1284
+ if (image_id == NULL) {
1285
+ image_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("imageid"));
1286
+ if (image_id == NULL) {
1287
+ image_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("ImageId"));
1288
+ }
1289
+ }
1290
+ if (aws_json_value_is_string(image_id) && (aws_json_value_get_string(image_id, &image_id_cursor) != AWS_OP_ERR)) {
1291
+ dest->image_id = image_id_cursor;
1217
1292
  }
1218
1293
 
1219
- cJSON *instance_id = cJSON_GetObjectItemCaseSensitive(document_root, "instanceId");
1220
- if (!cJSON_IsString(instance_id) || (instance_id->valuestring == NULL)) {
1294
+ struct aws_byte_cursor instance_id_cursor;
1295
+ struct aws_json_value *instance_id =
1296
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instanceId"));
1297
+ if (instance_id == NULL) {
1298
+ instance_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instanceid"));
1299
+ if (instance_id == NULL) {
1300
+ instance_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("InstanceId"));
1301
+ }
1302
+ }
1303
+ if (!aws_json_value_is_string(instance_id) ||
1304
+ (aws_json_value_get_string(instance_id, &instance_id_cursor) == AWS_OP_ERR)) {
1221
1305
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse instanceId from Json document for ec2 instance info.");
1222
1306
  goto done;
1223
1307
  }
1224
- dest->instance_id = aws_byte_cursor_from_c_str(instance_id->valuestring);
1308
+ dest->instance_id = instance_id_cursor;
1225
1309
 
1226
- cJSON *instance_type = cJSON_GetObjectItemCaseSensitive(document_root, "instanceType");
1227
- if (!cJSON_IsString(instance_type) || (instance_type->valuestring == NULL)) {
1310
+ struct aws_byte_cursor instance_type_cursor;
1311
+ struct aws_json_value *instance_type =
1312
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instanceType"));
1313
+ if (instance_type == NULL) {
1314
+ instance_type = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instancetype"));
1315
+ if (instance_type == NULL) {
1316
+ instance_type = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("InstanceType"));
1317
+ }
1318
+ }
1319
+ if (!aws_json_value_is_string(instance_type) ||
1320
+ (aws_json_value_get_string(instance_type, &instance_type_cursor) == AWS_OP_ERR)) {
1228
1321
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse instanceType from Json document for ec2 instance info.");
1229
1322
  goto done;
1230
1323
  }
1231
- dest->instance_type = aws_byte_cursor_from_c_str(instance_type->valuestring);
1324
+ dest->instance_type = instance_type_cursor;
1232
1325
 
1233
- cJSON *kernel_id = cJSON_GetObjectItemCaseSensitive(document_root, "kernelId");
1234
- if (cJSON_IsString(kernel_id) && (kernel_id->valuestring != NULL)) {
1235
- dest->kernel_id = aws_byte_cursor_from_c_str(kernel_id->valuestring);
1326
+ struct aws_byte_cursor kernel_id_cursor;
1327
+ struct aws_json_value *kernel_id =
1328
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("kernelId"));
1329
+ if (kernel_id == NULL) {
1330
+ kernel_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("kernelid"));
1331
+ if (kernel_id == NULL) {
1332
+ kernel_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("KernelId"));
1333
+ }
1334
+ }
1335
+ if (aws_json_value_is_string(kernel_id) &&
1336
+ (aws_json_value_get_string(kernel_id, &kernel_id_cursor) != AWS_OP_ERR)) {
1337
+ dest->kernel_id = kernel_id_cursor;
1236
1338
  }
1237
1339
 
1238
- cJSON *private_ip = cJSON_GetObjectItemCaseSensitive(document_root, "privateIp");
1239
- if (cJSON_IsString(private_ip) && (private_ip->valuestring != NULL)) {
1240
- dest->private_ip = aws_byte_cursor_from_c_str(private_ip->valuestring);
1340
+ struct aws_byte_cursor private_ip_cursor;
1341
+ struct aws_json_value *private_ip =
1342
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("privateIp"));
1343
+ if (private_ip == NULL) {
1344
+ private_ip = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("privateip"));
1345
+ if (private_ip == NULL) {
1346
+ private_ip = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("PrivateIp"));
1347
+ }
1348
+ }
1349
+ if (aws_json_value_is_string(private_ip) &&
1350
+ (aws_json_value_get_string(private_ip, &private_ip_cursor) != AWS_OP_ERR)) {
1351
+ dest->private_ip = private_ip_cursor;
1241
1352
  }
1242
1353
 
1243
- cJSON *ramdisk_id = cJSON_GetObjectItemCaseSensitive(document_root, "ramdiskId");
1244
- if (cJSON_IsString(ramdisk_id) && (ramdisk_id->valuestring != NULL)) {
1245
- dest->ramdisk_id = aws_byte_cursor_from_c_str(ramdisk_id->valuestring);
1354
+ struct aws_byte_cursor ramdisk_id_cursor;
1355
+ struct aws_json_value *ramdisk_id =
1356
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("ramdiskId"));
1357
+ if (ramdisk_id == NULL) {
1358
+ ramdisk_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("ramdiskid"));
1359
+ if (ramdisk_id == NULL) {
1360
+ ramdisk_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("RamdiskId"));
1361
+ }
1362
+ }
1363
+ if (aws_json_value_is_string(ramdisk_id) &&
1364
+ (aws_json_value_get_string(ramdisk_id, &ramdisk_id_cursor) != AWS_OP_ERR)) {
1365
+ dest->ramdisk_id = ramdisk_id_cursor;
1246
1366
  }
1247
1367
 
1248
- cJSON *region = cJSON_GetObjectItemCaseSensitive(document_root, "region");
1249
- if (!cJSON_IsString(region) || (region->valuestring == NULL)) {
1368
+ struct aws_byte_cursor region_cursor;
1369
+ struct aws_json_value *region = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("region"));
1370
+ if (region == NULL) {
1371
+ region = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("Region"));
1372
+ }
1373
+ if (!aws_json_value_is_string(region) || (aws_json_value_get_string(region, &region_cursor) == AWS_OP_ERR)) {
1250
1374
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse region from Json document for ec2 instance info.");
1251
1375
  goto done;
1252
1376
  }
1253
- dest->region = aws_byte_cursor_from_c_str(region->valuestring);
1377
+ dest->region = region_cursor;
1254
1378
 
1255
- cJSON *version = cJSON_GetObjectItemCaseSensitive(document_root, "version");
1256
- if (!cJSON_IsString(version) || (version->valuestring == NULL)) {
1379
+ struct aws_byte_cursor version_cursor;
1380
+ struct aws_json_value *version =
1381
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("version"));
1382
+ if (version == NULL) {
1383
+ version = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("Version"));
1384
+ }
1385
+ if (!aws_json_value_is_string(version) || (aws_json_value_get_string(version, &version_cursor) == AWS_OP_ERR)) {
1257
1386
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse version from Json document for ec2 instance info.");
1258
1387
  goto done;
1259
1388
  }
1260
- dest->version = aws_byte_cursor_from_c_str(version->valuestring);
1389
+ dest->version = version_cursor;
1261
1390
 
1262
- cJSON *pending_time = cJSON_GetObjectItemCaseSensitive(document_root, "pendingTime");
1263
- if (!cJSON_IsString(pending_time) || (pending_time->valuestring == NULL)) {
1391
+ struct aws_byte_cursor pending_time_cursor;
1392
+ struct aws_json_value *pending_time =
1393
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("pendingTime"));
1394
+ if (pending_time == NULL) {
1395
+ pending_time = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("pendingtime"));
1396
+ if (pending_time == NULL) {
1397
+ pending_time = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("PendingTime"));
1398
+ }
1399
+ }
1400
+ if (!aws_json_value_is_string(pending_time) ||
1401
+ (aws_json_value_get_string(pending_time, &pending_time_cursor) == AWS_OP_ERR)) {
1264
1402
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse pendingTime from Json document for ec2 instance info.");
1265
1403
  goto done;
1266
1404
  }
1267
1405
 
1268
- struct aws_byte_cursor pending_time_cursor = aws_byte_cursor_from_c_str(pending_time->valuestring);
1269
1406
  if (aws_date_time_init_from_str_cursor(&dest->pending_time, &pending_time_cursor, AWS_DATE_FORMAT_ISO_8601)) {
1270
1407
  AWS_LOGF_ERROR(
1271
1408
  AWS_LS_IMDS_CLIENT, "pendingTime in instance info Json document is not a valid ISO_8601 date string.");
@@ -1285,7 +1422,7 @@ static void s_process_instance_info(const struct aws_byte_buf *resource, int err
1285
1422
  struct aws_byte_buf json_data;
1286
1423
  AWS_ZERO_STRUCT(json_data);
1287
1424
 
1288
- cJSON *document_root = NULL;
1425
+ struct aws_json_value *document_root = NULL;
1289
1426
 
1290
1427
  if (aws_array_list_init_dynamic(
1291
1428
  &instance_info.billing_products, wrapped_user_data->allocator, 10, sizeof(struct aws_byte_cursor))) {
@@ -1312,7 +1449,8 @@ static void s_process_instance_info(const struct aws_byte_buf *resource, int err
1312
1449
  goto on_finish;
1313
1450
  }
1314
1451
 
1315
- document_root = cJSON_Parse((const char *)json_data.buffer);
1452
+ struct aws_byte_cursor json_data_cursor = aws_byte_cursor_from_buf(&json_data);
1453
+ document_root = aws_json_value_new_from_string(aws_default_allocator(), json_data_cursor);
1316
1454
  if (document_root == NULL) {
1317
1455
  AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse document as Json document for ec2 instance info.");
1318
1456
  goto on_finish;
@@ -1329,7 +1467,7 @@ on_finish:
1329
1467
  aws_byte_buf_clean_up_secure(&json_data);
1330
1468
  aws_mem_release(wrapped_user_data->allocator, wrapped_user_data);
1331
1469
  if (document_root != NULL) {
1332
- cJSON_Delete(document_root);
1470
+ aws_json_value_destroy(document_root);
1333
1471
  }
1334
1472
  }
1335
1473
 
@@ -130,6 +130,11 @@ int aws_signing_init_signing_tables(struct aws_allocator *allocator) {
130
130
  return AWS_OP_ERR;
131
131
  }
132
132
 
133
+ s_connection_header_name = aws_byte_cursor_from_c_str("expect");
134
+ if (aws_hash_table_put(&s_skipped_headers, &s_connection_header_name, NULL, NULL)) {
135
+ return AWS_OP_ERR;
136
+ }
137
+
133
138
  s_sec_websocket_key_header_name = aws_byte_cursor_from_c_str("sec-websocket-key");
134
139
  if (aws_hash_table_put(&s_skipped_headers, &s_sec_websocket_key_header_name, NULL, NULL)) {
135
140
  return AWS_OP_ERR;
@@ -101,6 +101,10 @@ static void s_cached_credentials_provider_get_credentials_async_callback(
101
101
  credentials_expiration_timepoint_seconds = aws_credentials_get_expiration_timepoint_seconds(credentials);
102
102
  }
103
103
 
104
+ /*
105
+ * If the sourced credentials have an explicit expiration time, we should always use that time
106
+ * rather than the much cruder, mechanical refresh setting on the caching wrapper.
107
+ */
104
108
  if (credentials_expiration_timepoint_seconds < UINT64_MAX) {
105
109
  uint64_t system_now = 0;
106
110
  if (!impl->system_clock_fn(&system_now)) {
@@ -109,17 +113,13 @@ static void s_cached_credentials_provider_get_credentials_async_callback(
109
113
  aws_timestamp_convert(system_now, AWS_TIMESTAMP_NANOS, AWS_TIMESTAMP_SECS, NULL);
110
114
  if (credentials_expiration_timepoint_seconds >=
111
115
  system_now_seconds + REFRESH_CREDENTIALS_EARLY_DURATION_SECONDS) {
112
- uint64_t early_refresh_time_ns = high_res_now;
113
- early_refresh_time_ns += aws_timestamp_convert(
116
+ next_refresh_time_in_ns = high_res_now;
117
+ next_refresh_time_in_ns += aws_timestamp_convert(
114
118
  credentials_expiration_timepoint_seconds - system_now_seconds -
115
119
  REFRESH_CREDENTIALS_EARLY_DURATION_SECONDS,
116
120
  AWS_TIMESTAMP_SECS,
117
121
  AWS_TIMESTAMP_NANOS,
118
122
  NULL);
119
-
120
- if (early_refresh_time_ns < next_refresh_time_in_ns) {
121
- next_refresh_time_in_ns = early_refresh_time_ns;
122
- }
123
123
  }
124
124
  }
125
125
  }
@@ -273,6 +273,7 @@ struct aws_credentials_provider *aws_credentials_provider_new_chain_default(
273
273
  struct aws_tls_ctx *tls_ctx = NULL;
274
274
  struct aws_credentials_provider *environment_provider = NULL;
275
275
  struct aws_credentials_provider *profile_provider = NULL;
276
+ struct aws_credentials_provider *sts_provider = NULL;
276
277
  struct aws_credentials_provider *ecs_or_imds_provider = NULL;
277
278
  struct aws_credentials_provider *chain_provider = NULL;
278
279
  struct aws_credentials_provider *cached_provider = NULL;
@@ -304,7 +305,7 @@ struct aws_credentials_provider *aws_credentials_provider_new_chain_default(
304
305
  #endif /* BYO_CRYPTO */
305
306
  }
306
307
 
307
- enum { providers_size = 3 };
308
+ enum { providers_size = 4 };
308
309
  struct aws_credentials_provider *providers[providers_size];
309
310
  AWS_ZERO_ARRAY(providers);
310
311
  size_t index = 0;
@@ -330,6 +331,18 @@ struct aws_credentials_provider *aws_credentials_provider_new_chain_default(
330
331
  aws_atomic_fetch_add(&impl->shutdowns_remaining, 1);
331
332
  }
332
333
 
334
+ struct aws_credentials_provider_sts_web_identity_options sts_options;
335
+ AWS_ZERO_STRUCT(sts_options);
336
+ sts_options.bootstrap = options->bootstrap;
337
+ sts_options.tls_ctx = tls_ctx;
338
+ sts_options.shutdown_options = sub_provider_shutdown_options;
339
+ sts_provider = aws_credentials_provider_new_sts_web_identity(allocator, &sts_options);
340
+ if (sts_provider != NULL) {
341
+ providers[index++] = sts_provider;
342
+ /* 1 shutdown call from the web identity provider's shutdown */
343
+ aws_atomic_fetch_add(&impl->shutdowns_remaining, 1);
344
+ }
345
+
333
346
  ecs_or_imds_provider = s_aws_credentials_provider_new_ecs_or_imds(
334
347
  allocator, &sub_provider_shutdown_options, options->bootstrap, tls_ctx);
335
348
  if (ecs_or_imds_provider != NULL) {
@@ -355,6 +368,7 @@ struct aws_credentials_provider *aws_credentials_provider_new_chain_default(
355
368
  */
356
369
  aws_credentials_provider_release(environment_provider);
357
370
  aws_credentials_provider_release(profile_provider);
371
+ aws_credentials_provider_release(sts_provider);
358
372
  aws_credentials_provider_release(ecs_or_imds_provider);
359
373
 
360
374
  struct aws_credentials_provider_cached_options cached_options = {
@@ -395,6 +409,7 @@ on_error:
395
409
  } else {
396
410
  aws_credentials_provider_release(ecs_or_imds_provider);
397
411
  aws_credentials_provider_release(profile_provider);
412
+ aws_credentials_provider_release(sts_provider);
398
413
  aws_credentials_provider_release(environment_provider);
399
414
  }
400
415
 
@@ -5,7 +5,6 @@
5
5
 
6
6
  #include <aws/auth/credentials.h>
7
7
 
8
- #include <aws/auth/external/cJSON.h>
9
8
  #include <aws/auth/private/credentials_utils.h>
10
9
  #include <aws/common/clock.h>
11
10
  #include <aws/common/date_time.h>
@@ -4,7 +4,6 @@
4
4
  */
5
5
 
6
6
  #include <aws/auth/credentials.h>
7
- #include <aws/auth/external/cJSON.h>
8
7
  #include <aws/auth/private/aws_profile.h>
9
8
  #include <aws/auth/private/credentials_utils.h>
10
9
  #include <aws/common/clock.h>
@@ -5,7 +5,6 @@
5
5
 
6
6
  #include <aws/auth/credentials.h>
7
7
 
8
- #include <aws/auth/external/cJSON.h>
9
8
  #include <aws/auth/private/aws_profile.h>
10
9
  #include <aws/auth/private/credentials_utils.h>
11
10
  #include <aws/common/clock.h>
@@ -5,7 +5,6 @@
5
5
 
6
6
  #include <aws/auth/credentials.h>
7
7
 
8
- #include <aws/auth/external/cJSON.h>
9
8
  #include <aws/auth/private/credentials_utils.h>
10
9
  #include <aws/common/clock.h>
11
10
  #include <aws/common/date_time.h>
@@ -19,6 +18,8 @@
19
18
  #include <aws/io/tls_channel_handler.h>
20
19
  #include <aws/io/uri.h>
21
20
 
21
+ #include <aws/common/json.h>
22
+
22
23
  #if defined(_MSC_VER)
23
24
  # pragma warning(disable : 4204)
24
25
  # pragma warning(disable : 4232)
@@ -146,13 +147,14 @@ static struct aws_credentials *s_parse_credentials_from_iot_core_document(
146
147
  struct aws_byte_buf *document) {
147
148
 
148
149
  struct aws_credentials *credentials = NULL;
149
- cJSON *document_root = NULL;
150
+ struct aws_json_value *document_root = NULL;
150
151
 
151
152
  if (aws_byte_buf_append_null_terminator(document)) {
152
153
  goto done;
153
154
  }
154
155
 
155
- document_root = cJSON_Parse((const char *)document->buffer);
156
+ struct aws_byte_cursor document_cursor = aws_byte_cursor_from_buf(document);
157
+ document_root = aws_json_value_new_from_string(allocator, document_cursor);
156
158
  if (document_root == NULL) {
157
159
  AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Failed to parse IoT Core response as Json document.");
158
160
  goto done;
@@ -161,8 +163,9 @@ static struct aws_credentials *s_parse_credentials_from_iot_core_document(
161
163
  /*
162
164
  * pull out the root "Credentials" components
163
165
  */
164
- cJSON *creds = cJSON_GetObjectItem(document_root, "credentials");
165
- if (!cJSON_IsObject(creds)) {
166
+ struct aws_json_value *creds =
167
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("credentials"));
168
+ if (!aws_json_value_is_object(creds)) {
166
169
  AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Failed to parse credentials from IoT Core response.");
167
170
  goto done;
168
171
  }
@@ -176,7 +179,7 @@ static struct aws_credentials *s_parse_credentials_from_iot_core_document(
176
179
  .expiration_required = false,
177
180
  };
178
181
 
179
- credentials = aws_parse_credentials_from_cjson_object(allocator, creds, &parse_options);
182
+ credentials = aws_parse_credentials_from_aws_json_object(allocator, creds, &parse_options);
180
183
  if (!credentials) {
181
184
  AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "X509 credentials provider failed to parse credentials");
182
185
  }
@@ -184,7 +187,7 @@ static struct aws_credentials *s_parse_credentials_from_iot_core_document(
184
187
  done:
185
188
 
186
189
  if (document_root != NULL) {
187
- cJSON_Delete(document_root);
190
+ aws_json_value_destroy(document_root);
188
191
  }
189
192
 
190
193
  return credentials;