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
@@ -504,6 +504,20 @@ bool aws_byte_cursor_eq_c_str(const struct aws_byte_cursor *const cursor, const
504
504
  AWS_COMMON_API
505
505
  bool aws_byte_cursor_eq_c_str_ignore_case(const struct aws_byte_cursor *const cursor, const char *const c_str);
506
506
 
507
+ /**
508
+ * Return true if the input starts with the prefix (exact byte comparison).
509
+ */
510
+ AWS_COMMON_API
511
+ bool aws_byte_cursor_starts_with(const struct aws_byte_cursor *input, const struct aws_byte_cursor *prefix);
512
+
513
+ /**
514
+ * Return true if the input starts with the prefix (case-insensitive).
515
+ * The "C" locale is used for comparing upper and lowercase letters.
516
+ * Data is assumed to be ASCII text, UTF-8 will work fine too.
517
+ */
518
+ AWS_COMMON_API
519
+ bool aws_byte_cursor_starts_with_ignore_case(const struct aws_byte_cursor *input, const struct aws_byte_cursor *prefix);
520
+
507
521
  /**
508
522
  * Case-insensitive hash function for array containing ASCII or UTF-8 text.
509
523
  */
@@ -18,5 +18,6 @@
18
18
  #cmakedefine AWS_HAVE_POSIX_LARGE_FILE_SUPPORT
19
19
  #cmakedefine AWS_HAVE_EXECINFO
20
20
  #cmakedefine AWS_HAVE_WINAPI_DESKTOP
21
+ #cmakedefine AWS_HAVE_LINUX_IF_LINK_H
21
22
 
22
23
  #endif
@@ -1,23 +1,23 @@
1
1
  /*
2
- Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in
12
- all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- THE SOFTWARE.
2
+ Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
21
  */
22
22
 
23
23
  /*
@@ -29,8 +29,8 @@
29
29
 
30
30
  /* clang-format off */
31
31
 
32
- #ifndef cJSON__h
33
- #define cJSON__h
32
+ #ifndef AWS_COMMON_EXTERNAL_CJSON_H // NOLINT
33
+ #define AWS_COMMON_EXTERNAL_CJSON_H // NOLINT
34
34
 
35
35
  #ifdef __cplusplus
36
36
  extern "C"
@@ -90,7 +90,7 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ
90
90
  /* project version */
91
91
  #define CJSON_VERSION_MAJOR 1
92
92
  #define CJSON_VERSION_MINOR 7
93
- #define CJSON_VERSION_PATCH 12
93
+ #define CJSON_VERSION_PATCH 15
94
94
 
95
95
  #include <stddef.h>
96
96
 
@@ -111,37 +111,37 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ
111
111
  /* The cJSON structure: */
112
112
  typedef struct cJSON
113
113
  {
114
- /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
115
- struct cJSON *next;
116
- struct cJSON *prev;
117
- /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
118
- struct cJSON *child;
119
-
120
- /* The type of the item, as above. */
121
- int type;
122
-
123
- /* The item's string, if type==cJSON_String and type == cJSON_Raw */
124
- char *valuestring;
125
- /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
126
- int valueint;
127
- /* The item's number, if type==cJSON_Number */
128
- double valuedouble;
129
-
130
- /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
131
- char *string;
114
+ /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
115
+ struct cJSON *next;
116
+ struct cJSON *prev;
117
+ /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
118
+ struct cJSON *child;
119
+
120
+ /* The type of the item, as above. */
121
+ int type;
122
+
123
+ /* The item's string, if type==cJSON_String and type == cJSON_Raw */
124
+ char *valuestring;
125
+ /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
126
+ int valueint;
127
+ /* The item's number, if type==cJSON_Number */
128
+ double valuedouble;
129
+
130
+ /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
131
+ char *string;
132
132
  } cJSON;
133
133
 
134
134
  typedef struct cJSON_Hooks
135
135
  {
136
- /* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
137
- void *(CJSON_CDECL *malloc_fn)(size_t sz);
138
- void (CJSON_CDECL *free_fn)(void *ptr);
136
+ /* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
137
+ void *(CJSON_CDECL *malloc_fn)(size_t sz); // NOLINT
138
+ void (CJSON_CDECL *free_fn)(void *ptr);
139
139
  } cJSON_Hooks;
140
140
 
141
141
  typedef int cJSON_bool;
142
142
 
143
143
  /* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
144
- * This is to prevent stack overflows. */
144
+ * This is to prevent stack overflows. */
145
145
  #ifndef CJSON_NESTING_LIMIT
146
146
  #define CJSON_NESTING_LIMIT 1000
147
147
  #endif
@@ -155,9 +155,11 @@ CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
155
155
  /* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
156
156
  /* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
157
157
  CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
158
+ CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length);
158
159
  /* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
159
160
  /* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
160
161
  CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
162
+ CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated);
161
163
 
162
164
  /* Render a cJSON entity to text for transfer/storage. */
163
165
  CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
@@ -167,7 +169,7 @@ CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
167
169
  CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
168
170
  /* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
169
171
  /* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
170
- CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const int len, const cJSON_bool fmt);
172
+ CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
171
173
  /* Delete a cJSON entity and all subentities. */
172
174
  CJSON_PUBLIC(void) cJSON_Delete(cJSON *item);
173
175
 
@@ -182,8 +184,9 @@ CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *st
182
184
  /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
183
185
  CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
184
186
 
185
- /* Check if the item is a string and return its valuestring */
186
- CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item);
187
+ /* Check item type and return its value */
188
+ CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item);
189
+ CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item);
187
190
 
188
191
  /* These functions check the type of an item */
189
192
  CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
@@ -201,7 +204,7 @@ CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
201
204
  CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
202
205
  CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
203
206
  CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
204
- CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool b);
207
+ CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
205
208
  CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
206
209
  CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
207
210
  /* raw json */
@@ -210,31 +213,32 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
210
213
  CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
211
214
 
212
215
  /* Create a string where valuestring references a string so
213
- * it will not be freed by cJSON_Delete */
216
+ * it will not be freed by cJSON_Delete */
214
217
  CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
215
- /* Create an object/arrray that only references it's elements so
216
- * they will not be freed by cJSON_Delete */
218
+ /* Create an object/array that only references it's elements so
219
+ * they will not be freed by cJSON_Delete */
217
220
  CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
218
221
  CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
219
222
 
220
- /* These utilities create an Array of count items. */
223
+ /* These utilities create an Array of count items.
224
+ * The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/
221
225
  CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
222
226
  CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
223
227
  CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
224
- CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count);
228
+ CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count);
225
229
 
226
230
  /* Append item to the specified array/object. */
227
- CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item);
228
- CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
231
+ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item);
232
+ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
229
233
  /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
230
- * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
231
- * writing to `item->string` */
232
- CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
234
+ * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
235
+ * writing to `item->string` */
236
+ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
233
237
  /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
234
- CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
235
- CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
238
+ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
239
+ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
236
240
 
237
- /* Remove/Detatch items from Arrays/Objects. */
241
+ /* Remove/Detach items from Arrays/Objects. */
238
242
  CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
239
243
  CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
240
244
  CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
@@ -244,26 +248,28 @@ CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string)
244
248
  CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
245
249
 
246
250
  /* Update array items. */
247
- CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
251
+ CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
248
252
  CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
249
- CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
250
- CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
251
- CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
253
+ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
254
+ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
255
+ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
252
256
 
253
257
  /* Duplicate a cJSON item */
254
258
  CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
255
259
  /* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
256
- need to be released. With recurse!=0, it will duplicate any children connected to the item.
257
- The item->next and ->prev pointers are always zero on return from Duplicate. */
260
+ * need to be released. With recurse!=0, it will duplicate any children connected to the item.
261
+ * The item->next and ->prev pointers are always zero on return from Duplicate. */
258
262
  /* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
259
- * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
260
- CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
261
-
263
+ * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
264
+ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive); // NOLINT
262
265
 
266
+ /* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings.
267
+ * The input pointer json cannot point to a read-only address area, such as a string constant,
268
+ * but should point to a readable and writable address area. */
263
269
  CJSON_PUBLIC(void) cJSON_Minify(char *json);
264
270
 
265
271
  /* Helper functions for creating and adding items to an object at the same time.
266
- * They return the added item or NULL on failure. */
272
+ * They return the added item or NULL on failure. */
267
273
  CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
268
274
  CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
269
275
  CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
@@ -275,13 +281,15 @@ CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char *
275
281
  CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
276
282
 
277
283
  /* When assigning an integer value, it needs to be propagated to valuedouble too. */
278
- #define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
284
+ #define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) //NOLINT
279
285
  /* helper for the cJSON_SetNumberValue macro */
280
286
  CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
281
- #define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
287
+ #define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number)) //NOLINT
288
+ /* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */
289
+ CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring);
282
290
 
283
291
  /* Macro for iterating over an array or object */
284
- #define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
292
+ #define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next) //NOLINT
285
293
 
286
294
  /* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
287
295
  CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
@@ -0,0 +1,335 @@
1
+ #ifndef AWS_COMMON_JSON_H
2
+ #define AWS_COMMON_JSON_H
3
+
4
+ /**
5
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
+ * SPDX-License-Identifier: Apache-2.0.
7
+ */
8
+
9
+ #include <aws/common/byte_buf.h>
10
+ #include <aws/common/common.h>
11
+
12
+ struct aws_json_value;
13
+
14
+ // ====================
15
+ // Create and pass type
16
+
17
+ /**
18
+ * Creates a new string aws_json_value with the given string and returns a pointer to it.
19
+ *
20
+ * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or
21
+ * on the object/array containing the aws_json_value.
22
+ * @param string A byte pointer to the string you want to store in the aws_json_value
23
+ * @param allocator The allocator to use when creating the value
24
+ * @return A new string aws_json_value
25
+ */
26
+ AWS_COMMON_API
27
+ struct aws_json_value *aws_json_value_new_string(struct aws_allocator *allocator, struct aws_byte_cursor string);
28
+
29
+ /**
30
+ * Creates a new number aws_json_value with the given number and returns a pointer to it.
31
+ *
32
+ * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or
33
+ * on the object/array containing the aws_json_value.
34
+ * @param number The number you want to store in the aws_json_value
35
+ * @param allocator The allocator to use when creating the value
36
+ * @return A new number aws_json_value
37
+ */
38
+ AWS_COMMON_API
39
+ struct aws_json_value *aws_json_value_new_number(struct aws_allocator *allocator, double number);
40
+
41
+ /**
42
+ * Creates a new array aws_json_value and returns a pointer to it.
43
+ *
44
+ * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or
45
+ * on the object/array containing the aws_json_value.
46
+ * Deleting this array will also destroy any aws_json_values it contains.
47
+ * @param allocator The allocator to use when creating the value
48
+ * @return A new array aws_json_value
49
+ */
50
+ AWS_COMMON_API
51
+ struct aws_json_value *aws_json_value_new_array(struct aws_allocator *allocator);
52
+
53
+ /**
54
+ * Creates a new boolean aws_json_value with the given boolean and returns a pointer to it.
55
+ *
56
+ * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or
57
+ * on the object/array containing the aws_json_value.
58
+ * @param boolean The boolean you want to store in the aws_json_value
59
+ * @param allocator The allocator to use when creating the value
60
+ * @return A new boolean aws_json_value
61
+ */
62
+ AWS_COMMON_API
63
+ struct aws_json_value *aws_json_value_new_boolean(struct aws_allocator *allocator, bool boolean);
64
+
65
+ /**
66
+ * Creates a new null aws_json_value and returns a pointer to it.
67
+ *
68
+ * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or
69
+ * on the object/array containing the aws_json_value.
70
+ * @param allocator The allocator to use when creating the value
71
+ * @return A new null aws_json_value
72
+ */
73
+ AWS_COMMON_API
74
+ struct aws_json_value *aws_json_value_new_null(struct aws_allocator *allocator);
75
+
76
+ /**
77
+ * Creates a new object aws_json_value and returns a pointer to it.
78
+ *
79
+ * Note: You will need to free the memory for the aws_json_value using aws_json_destroy on the aws_json_value or
80
+ * on the object/array containing the aws_json_value.
81
+ * Deleting this object will also destroy any aws_json_values it contains.
82
+ * @param allocator The allocator to use when creating the value
83
+ * @return A new object aws_json_value
84
+ */
85
+ AWS_COMMON_API
86
+ struct aws_json_value *aws_json_value_new_object(struct aws_allocator *allocator);
87
+ // ====================
88
+
89
+ // ====================
90
+ // Value getters
91
+
92
+ /**
93
+ * Gets the string of a string aws_json_value.
94
+ * @param value The string aws_json_value.
95
+ * @param output The string
96
+ * @return AWS_OP_SUCESS if the value is a string, otherwise AWS_OP_ERR.
97
+ */
98
+ AWS_COMMON_API
99
+ int aws_json_value_get_string(const struct aws_json_value *value, struct aws_byte_cursor *output);
100
+
101
+ /**
102
+ * Gets the number of a number aws_json_value.
103
+ * @param value The number aws_json_value.
104
+ * @param output The number
105
+ * @return AWS_OP_SUCESS if the value is a number, otherwise AWS_OP_ERR.
106
+ */
107
+ AWS_COMMON_API
108
+ int aws_json_value_get_number(const struct aws_json_value *value, double *output);
109
+
110
+ /**
111
+ * Gets the boolean of a boolean aws_json_value.
112
+ * @param value The boolean aws_json_value.
113
+ * @param output The boolean
114
+ * @return AWS_OP_SUCESS if the value is a boolean, otherwise AWS_OP_ERR.
115
+ */
116
+ AWS_COMMON_API
117
+ int aws_json_value_get_boolean(const struct aws_json_value *value, bool *output);
118
+ // ====================
119
+
120
+ // ====================
121
+ // Object API
122
+
123
+ /**
124
+ * Adds a aws_json_value to a object aws_json_value.
125
+ *
126
+ * Note that the aws_json_value will be destroyed when the aws_json_value object is destroyed
127
+ * by calling "aws_json_destroy()"
128
+ * @param object The object aws_json_value you want to add a value to.
129
+ * @param key The key to add the aws_json_value at.
130
+ * @param value The aws_json_value you want to add.
131
+ * @return AWS_OP_SUCCESS if adding was successful.
132
+ * Will return AWS_OP_ERROR if the object passed is invalid or if the passed key
133
+ * is already in use in the object.
134
+ */
135
+ AWS_COMMON_API
136
+ int aws_json_value_add_to_object(
137
+ struct aws_json_value *object,
138
+ struct aws_byte_cursor key,
139
+ struct aws_json_value *value);
140
+
141
+ /**
142
+ * Returns the aws_json_value at the given key.
143
+ * @param object The object aws_json_value you want to get the value from.
144
+ * @param key The key that the aws_json_value is at. Is case sensitive.
145
+ * @return The aws_json_value at the given key, otherwise NULL.
146
+ */
147
+ AWS_COMMON_API
148
+ struct aws_json_value *aws_json_value_get_from_object(const struct aws_json_value *object, struct aws_byte_cursor key);
149
+
150
+ /**
151
+ * Checks if there is a aws_json_value at the given key.
152
+ * @param object The value aws_json_value you want to check a key in.
153
+ * @param key The key that you want to check. Is case sensitive.
154
+ * @return True if a aws_json_value is found.
155
+ */
156
+ AWS_COMMON_API
157
+ bool aws_json_value_has_key(const struct aws_json_value *object, struct aws_byte_cursor key);
158
+
159
+ /**
160
+ * Removes the aws_json_value at the given key.
161
+ * @param object The object aws_json_value you want to remove a aws_json_value in.
162
+ * @param key The key that the aws_json_value is at. Is case sensitive.
163
+ * @return AWS_OP_SUCCESS if the aws_json_value was removed.
164
+ * Will return AWS_OP_ERR if the object passed is invalid or if the value
165
+ * at the key cannot be found.
166
+ */
167
+ AWS_COMMON_API
168
+ int aws_json_value_remove_from_object(struct aws_json_value *object, struct aws_byte_cursor key);
169
+ // ====================
170
+
171
+ // ====================
172
+ // Array API
173
+
174
+ /**
175
+ * Adds a aws_json_value to the given array aws_json_value.
176
+ *
177
+ * Note that the aws_json_value will be destroyed when the aws_json_value array is destroyed
178
+ * by calling "aws_json_destroy()"
179
+ * @param array The array aws_json_value you want to add an aws_json_value to.
180
+ * @param value The aws_json_value you want to add.
181
+ * @return AWS_OP_SUCCESS if adding the aws_json_value was successful.
182
+ * Will return AWS_OP_ERR if the array passed is invalid.
183
+ */
184
+ AWS_COMMON_API
185
+ int aws_json_value_add_array_element(struct aws_json_value *array, const struct aws_json_value *value);
186
+
187
+ /**
188
+ * Returns the aws_json_value at the given index in the array aws_json_value.
189
+ * @param array The array aws_json_value.
190
+ * @param index The index of the aws_json_value you want to access.
191
+ * @return A pointer to the aws_json_value at the given index in the array, otherwise NULL.
192
+ */
193
+ AWS_COMMON_API
194
+ struct aws_json_value *aws_json_get_array_element(const struct aws_json_value *array, size_t index);
195
+
196
+ /**
197
+ * Returns the number of items in the array aws_json_value.
198
+ * @param array The array aws_json_value.
199
+ * @return The number of items in the array_json_value.
200
+ */
201
+ AWS_COMMON_API
202
+ size_t aws_json_get_array_size(const struct aws_json_value *array);
203
+
204
+ /**
205
+ * Removes the aws_json_value at the given index in the array aws_json_value.
206
+ * @param array The array aws_json_value.
207
+ * @param index The index containing the aws_json_value you want to remove.
208
+ * @return AWS_OP_SUCCESS if the aws_json_value at the index was removed.
209
+ * Will return AWS_OP_ERR if the array passed is invalid or if the index
210
+ * passed is out of range.
211
+ */
212
+ AWS_COMMON_API
213
+ int aws_json_value_remove_array_element(struct aws_json_value *array, size_t index);
214
+ // ====================
215
+
216
+ // ====================
217
+ // Checks
218
+
219
+ /**
220
+ * Checks if the aws_json_value is a string.
221
+ * @param value The aws_json_value to check.
222
+ * @return True if the aws_json_value is a string aws_json_value, otherwise false.
223
+ */
224
+ AWS_COMMON_API
225
+ bool aws_json_value_is_string(const struct aws_json_value *value);
226
+
227
+ /**
228
+ * Checks if the aws_json_value is a number.
229
+ * @param value The aws_json_value to check.
230
+ * @return True if the aws_json_value is a number aws_json_value, otherwise false.
231
+ */
232
+ AWS_COMMON_API
233
+ bool aws_json_value_is_number(const struct aws_json_value *value);
234
+
235
+ /**
236
+ * Checks if the aws_json_value is a array.
237
+ * @param value The aws_json_value to check.
238
+ * @return True if the aws_json_value is a array aws_json_value, otherwise false.
239
+ */
240
+ AWS_COMMON_API
241
+ bool aws_json_value_is_array(const struct aws_json_value *value);
242
+
243
+ /**
244
+ * Checks if the aws_json_value is a boolean.
245
+ * @param value The aws_json_value to check.
246
+ * @return True if the aws_json_value is a boolean aws_json_value, otherwise false.
247
+ */
248
+ AWS_COMMON_API
249
+ bool aws_json_value_is_boolean(const struct aws_json_value *value);
250
+
251
+ /**
252
+ * Checks if the aws_json_value is a null aws_json_value.
253
+ * @param value The aws_json_value to check.
254
+ * @return True if the aws_json_value is a null aws_json_value, otherwise false.
255
+ */
256
+ AWS_COMMON_API
257
+ bool aws_json_value_is_null(const struct aws_json_value *value);
258
+
259
+ /**
260
+ * Checks if the aws_json_value is a object aws_json_value.
261
+ * @param value The aws_json_value to check.
262
+ * @return True if the aws_json_value is a object aws_json_value, otherwise false.
263
+ */
264
+ AWS_COMMON_API
265
+ bool aws_json_value_is_object(const struct aws_json_value *value);
266
+ // ====================
267
+
268
+ // ====================
269
+ // Memory Management
270
+
271
+ /**
272
+ * Removes the aws_json_value from memory. If the aws_json_value is a object or array, it will also destroy
273
+ * attached aws_json_values as well.
274
+ *
275
+ * For example, if you called "aws_json_array_add(b, a)" to add an object "a" to an array "b", if you call
276
+ * "aws_json_destroy(b)" then it will also free "a" automatically. All children/attached aws_json_values are freed
277
+ * when the parent/root aws_json_value is destroyed.
278
+ * @param value The aws_json_value to destroy.
279
+ */
280
+ AWS_COMMON_API
281
+ void aws_json_value_destroy(struct aws_json_value *value);
282
+ // ====================
283
+
284
+ // ====================
285
+ // Utility
286
+
287
+ /**
288
+ * Appends a unformatted JSON string representation of the aws_json_value into the passed byte buffer.
289
+ * The byte buffer is expected to be already initialized so the function can append the JSON into it.
290
+ *
291
+ * Note: The byte buffer will automatically have its size extended if the JSON string is over the byte
292
+ * buffer capacity AND the byte buffer has an allocator associated with it. If the byte buffer does not
293
+ * have an allocator associated and the JSON string is over capacity, AWS_OP_ERR will be returned.
294
+ *
295
+ * Note: When you are finished with the aws_byte_buf, you must call "aws_byte_buf_clean_up_secure" to free
296
+ * the memory used, as it will NOT be called automatically.
297
+ * @param value The aws_json_value to format.
298
+ * @param output The destination for the JSON string
299
+ * @return AWS_OP_SUCCESS if the JSON string was allocated to output without any errors
300
+ * Will return AWS_OP_ERR if the value passed is not an aws_json_value or if there
301
+ * was an error appending the JSON into the byte buffer.
302
+ */
303
+ AWS_COMMON_API
304
+ int aws_byte_buf_append_json_string(const struct aws_json_value *value, struct aws_byte_buf *output);
305
+
306
+ /**
307
+ * Appends a formatted JSON string representation of the aws_json_value into the passed byte buffer.
308
+ * The byte buffer is expected to already be initialized so the function can append the JSON into it.
309
+ *
310
+ * Note: The byte buffer will automatically have its size extended if the JSON string is over the byte
311
+ * buffer capacity AND the byte buffer has an allocator associated with it. If the byte buffer does not
312
+ * have an allocator associated and the JSON string is over capacity, AWS_OP_ERR will be returned.
313
+ *
314
+ * Note: When you are finished with the aws_byte_buf, you must call "aws_byte_buf_clean_up_secure" to free
315
+ * the memory used, as it will NOT be called automatically.
316
+ * @param value The aws_json_value to format.
317
+ * @param output The destination for the JSON string
318
+ * @return AWS_OP_SUCCESS if the JSON string was allocated to output without any errors
319
+ * Will return AWS_ERROR_INVALID_ARGUMENT if the value passed is not an aws_json_value or if there
320
+ * aws an error appending the JSON into the byte buffer.
321
+ */
322
+ AWS_COMMON_API
323
+ int aws_byte_buf_append_json_string_formatted(const struct aws_json_value *value, struct aws_byte_buf *output);
324
+
325
+ /**
326
+ * Parses the JSON string and returns a aws_json_value containing the root of the JSON.
327
+ * @param allocator The allocator used to create the value
328
+ * @param string The string containing the JSON.
329
+ * @return The root aws_json_value of the JSON.
330
+ */
331
+ AWS_COMMON_API
332
+ struct aws_json_value *aws_json_value_new_from_string(struct aws_allocator *allocator, struct aws_byte_cursor string);
333
+ // ====================
334
+
335
+ #endif // AWS_COMMON_JSON_H
@@ -314,6 +314,7 @@ extern struct aws_logger_vtable g_pipeline_logger_owned_vtable;
314
314
  /*
315
315
  * Initializes a logger that does not perform any allocation during logging. Log lines larger than the internal
316
316
  * constant are truncated. Formatting matches the standard logger. Used for memory tracing logging.
317
+ * If no file or filename is set in the aws_logger_standard_options, then it will use stderr.
317
318
  */
318
319
  AWS_COMMON_API
319
320
  int aws_logger_init_noalloc(
@@ -48,7 +48,7 @@ AWS_EXTERN_C_BEGIN
48
48
  # include <aws/common/math.gcc_builtin.inl>
49
49
  #endif
50
50
 
51
- #if _MSC_VER
51
+ #ifdef _MSC_VER
52
52
  # pragma warning(push)
53
53
  # pragma warning(disable : 4127) /*Disable "conditional expression is constant" */
54
54
  #endif /* _MSC_VER */
@@ -188,7 +188,7 @@ AWS_STATIC_IMPL int aws_round_up_to_power_of_two(size_t n, size_t *result) {
188
188
  return AWS_OP_SUCCESS;
189
189
  }
190
190
 
191
- #if _MSC_VER
191
+ #ifdef _MSC_VER
192
192
  # pragma warning(pop)
193
193
  #endif /* _MSC_VER */
194
194