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
@@ -6,7 +6,6 @@
6
6
  #include <aws/testing/aws_test_harness.h>
7
7
 
8
8
  #include <aws/auth/credentials.h>
9
- #include <aws/auth/external/cJSON.h>
10
9
  #include <aws/auth/private/aws_signing.h>
11
10
  #include <aws/auth/signable.h>
12
11
  #include <aws/auth/signing.h>
@@ -15,6 +14,7 @@
15
14
  #include <aws/common/condition_variable.h>
16
15
  #include <aws/common/encoding.h>
17
16
  #include <aws/common/environment.h>
17
+ #include <aws/common/json.h>
18
18
  #include <aws/common/string.h>
19
19
  #include <aws/http/request_response.h>
20
20
  #include <aws/io/file_utils.h>
@@ -270,7 +270,7 @@ AWS_STATIC_STRING_FROM_LITERAL(s_omit_token_name, "omit_session_token");
270
270
 
271
271
  static int s_v4_test_context_parse_context_file(struct v4_test_context *context) {
272
272
  struct aws_byte_buf *document = &context->test_case_data.context;
273
- cJSON *document_root = NULL;
273
+ struct aws_json_value *document_root = NULL;
274
274
  int result = AWS_OP_ERR;
275
275
 
276
276
  struct aws_byte_cursor null_terminator_cursor = aws_byte_cursor_from_string(s_empty_empty_string);
@@ -278,38 +278,42 @@ static int s_v4_test_context_parse_context_file(struct v4_test_context *context)
278
278
  goto done;
279
279
  }
280
280
 
281
- document_root = cJSON_Parse((const char *)document->buffer);
281
+ struct aws_byte_cursor document_buffer_cursor = aws_byte_cursor_from_buf(document);
282
+ document_root = aws_json_value_new_from_string(aws_default_allocator(), document_buffer_cursor);
282
283
  if (document_root == NULL) {
283
284
  goto done;
284
285
  }
285
286
 
286
- cJSON *credentials_node = cJSON_GetObjectItemCaseSensitive(document_root, aws_string_c_str(s_credentials_name));
287
+ struct aws_json_value *credentials_node =
288
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_string(s_credentials_name));
287
289
  AWS_FATAL_ASSERT(credentials_node != NULL);
288
290
 
289
291
  /*
290
292
  * Pull out the three credentials components
291
293
  */
292
- cJSON *access_key_id = cJSON_GetObjectItemCaseSensitive(credentials_node, aws_string_c_str(s_access_key_id_name));
293
- cJSON *secret_access_key =
294
- cJSON_GetObjectItemCaseSensitive(credentials_node, aws_string_c_str(s_secret_access_key_name));
295
- cJSON *session_token = cJSON_GetObjectItemCaseSensitive(credentials_node, aws_string_c_str(s_session_token_name));
296
-
297
- if (!cJSON_IsString(access_key_id) || (access_key_id->valuestring == NULL)) {
294
+ struct aws_json_value *access_key_id =
295
+ aws_json_value_get_from_object(credentials_node, aws_byte_cursor_from_string(s_access_key_id_name));
296
+ struct aws_json_value *secret_access_key =
297
+ aws_json_value_get_from_object(credentials_node, aws_byte_cursor_from_string(s_secret_access_key_name));
298
+ struct aws_json_value *session_token =
299
+ aws_json_value_get_from_object(credentials_node, aws_byte_cursor_from_string(s_session_token_name));
300
+
301
+ struct aws_byte_cursor access_key_id_cursor;
302
+ if (!aws_json_value_is_string(access_key_id) ||
303
+ aws_json_value_get_string(access_key_id, &access_key_id_cursor) == AWS_OP_ERR) {
298
304
  goto done;
299
305
  }
300
306
 
301
- struct aws_byte_cursor access_key_id_cursor = aws_byte_cursor_from_c_str(access_key_id->valuestring);
302
307
  struct aws_byte_cursor secret_access_key_cursor;
303
308
  AWS_ZERO_STRUCT(secret_access_key_cursor);
304
309
  struct aws_byte_cursor session_token_cursor;
305
310
  AWS_ZERO_STRUCT(session_token_cursor);
306
311
 
307
- if (cJSON_IsString(session_token) && session_token->valuestring != NULL) {
308
- session_token_cursor = aws_byte_cursor_from_c_str(session_token->valuestring);
312
+ if (aws_json_value_is_string(session_token)) {
313
+ aws_json_value_get_string(session_token, &session_token_cursor);
309
314
  }
310
-
311
- if (cJSON_IsString(secret_access_key) && secret_access_key->valuestring != NULL) {
312
- secret_access_key_cursor = aws_byte_cursor_from_c_str(secret_access_key->valuestring);
315
+ if (aws_json_value_is_string(secret_access_key)) {
316
+ aws_json_value_get_string(secret_access_key, &secret_access_key_cursor);
313
317
  }
314
318
 
315
319
  if (context->signing_key == NULL) {
@@ -326,60 +330,75 @@ static int s_v4_test_context_parse_context_file(struct v4_test_context *context)
326
330
 
327
331
  AWS_FATAL_ASSERT(context->credentials != NULL);
328
332
 
329
- cJSON *region_node = cJSON_GetObjectItemCaseSensitive(document_root, aws_string_c_str(s_region_name));
330
- if (region_node == NULL || !cJSON_IsString(region_node) || (region_node->valuestring == NULL)) {
333
+ struct aws_json_value *region_node =
334
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_string(s_region_name));
335
+ struct aws_byte_cursor region_node_cursor;
336
+ if (region_node == NULL || !aws_json_value_is_string(region_node) ||
337
+ aws_json_value_get_string(region_node, &region_node_cursor) == AWS_OP_ERR) {
331
338
  goto done;
332
339
  }
333
340
 
334
- context->region_config = aws_string_new_from_c_str(context->allocator, region_node->valuestring);
341
+ context->region_config = aws_string_new_from_cursor(context->allocator, &region_node_cursor);
335
342
  if (context->region_config == NULL) {
336
343
  goto done;
337
344
  }
338
345
 
339
- cJSON *service_node = cJSON_GetObjectItemCaseSensitive(document_root, aws_string_c_str(s_service_name));
340
- if (service_node == NULL || !cJSON_IsString(service_node) || (service_node->valuestring == NULL)) {
346
+ struct aws_json_value *service_node =
347
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_string(s_service_name));
348
+ struct aws_byte_cursor service_node_cursor;
349
+ if (service_node == NULL || !aws_json_value_is_string(service_node) ||
350
+ aws_json_value_get_string(service_node, &service_node_cursor) == AWS_OP_ERR) {
341
351
  goto done;
342
352
  }
343
353
 
344
- context->service = aws_string_new_from_c_str(context->allocator, service_node->valuestring);
354
+ context->service = aws_string_new_from_cursor(context->allocator, &service_node_cursor);
345
355
  if (context->service == NULL) {
346
356
  goto done;
347
357
  }
348
358
 
349
- cJSON *timestamp_node = cJSON_GetObjectItemCaseSensitive(document_root, aws_string_c_str(s_timestamp_name));
350
- if (timestamp_node == NULL || !cJSON_IsString(timestamp_node) || (timestamp_node->valuestring == NULL)) {
359
+ struct aws_json_value *timestamp_node =
360
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_string(s_timestamp_name));
361
+ struct aws_byte_cursor timestamp_node_cursor;
362
+ if (timestamp_node == NULL || !aws_json_value_is_string(timestamp_node) ||
363
+ aws_json_value_get_string(timestamp_node, &timestamp_node_cursor) == AWS_OP_ERR) {
351
364
  goto done;
352
365
  }
353
366
 
354
- context->timestamp = aws_string_new_from_c_str(context->allocator, timestamp_node->valuestring);
367
+ context->timestamp = aws_string_new_from_cursor(context->allocator, &timestamp_node_cursor);
355
368
  if (context->timestamp == NULL) {
356
369
  goto done;
357
370
  }
358
371
 
359
- cJSON *normalize_node = cJSON_GetObjectItemCaseSensitive(document_root, aws_string_c_str(s_normalize_name));
360
- if (normalize_node == NULL || !cJSON_IsBool(normalize_node)) {
372
+ struct aws_json_value *normalize_node =
373
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_string(s_normalize_name));
374
+ if (normalize_node == NULL || !aws_json_value_is_boolean(normalize_node)) {
361
375
  goto done;
362
376
  }
363
377
 
364
- context->should_normalize = cJSON_IsTrue(normalize_node);
378
+ aws_json_value_get_boolean(normalize_node, &context->should_normalize);
365
379
 
366
- cJSON *body_node = cJSON_GetObjectItemCaseSensitive(document_root, aws_string_c_str(s_body_name));
367
- if (body_node == NULL || !cJSON_IsBool(body_node)) {
380
+ struct aws_json_value *body_node =
381
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_string(s_body_name));
382
+ if (body_node == NULL || !aws_json_value_is_boolean(body_node)) {
368
383
  goto done;
369
384
  }
370
385
 
371
- context->should_sign_body = cJSON_IsTrue(body_node);
386
+ aws_json_value_get_boolean(body_node, &context->should_sign_body);
372
387
 
373
- cJSON *expiration_node = cJSON_GetObjectItemCaseSensitive(document_root, aws_string_c_str(s_expiration_name));
374
- if (expiration_node == NULL || !cJSON_IsNumber(expiration_node)) {
388
+ struct aws_json_value *expiration_node =
389
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_string(s_expiration_name));
390
+ if (expiration_node == NULL || !aws_json_value_is_number(expiration_node)) {
375
391
  goto done;
376
392
  }
377
393
 
378
- context->expiration_in_seconds = expiration_node->valueint;
394
+ double expiration_in_seconds_double = 0;
395
+ aws_json_value_get_number(expiration_node, &expiration_in_seconds_double);
396
+ context->expiration_in_seconds = (uint64_t)expiration_in_seconds_double;
379
397
 
380
- cJSON *omit_token_node = cJSON_GetObjectItemCaseSensitive(document_root, aws_string_c_str(s_omit_token_name));
381
- if (omit_token_node != NULL && cJSON_IsBool(omit_token_node)) {
382
- context->omit_session_token = cJSON_IsTrue(omit_token_node);
398
+ struct aws_json_value *omit_token_node =
399
+ aws_json_value_get_from_object(document_root, aws_byte_cursor_from_string(s_omit_token_name));
400
+ if (omit_token_node != NULL && aws_json_value_is_boolean(omit_token_node)) {
401
+ aws_json_value_get_boolean(omit_token_node, &context->omit_session_token);
383
402
  }
384
403
 
385
404
  result = AWS_OP_SUCCESS;
@@ -387,7 +406,7 @@ static int s_v4_test_context_parse_context_file(struct v4_test_context *context)
387
406
  done:
388
407
 
389
408
  if (document_root != NULL) {
390
- cJSON_Delete(document_root);
409
+ aws_json_value_destroy(document_root);
391
410
  }
392
411
 
393
412
  return result;
@@ -601,7 +620,7 @@ static int s_v4_test_context_parse_verification_key(struct v4_test_context *cont
601
620
  AWS_ZERO_STRUCT(pub_y_buffer);
602
621
 
603
622
  struct aws_byte_buf *document = &context->test_case_data.public_key;
604
- cJSON *document_root = NULL;
623
+ struct aws_json_value *document_root = NULL;
605
624
  int result = AWS_OP_ERR;
606
625
 
607
626
  struct aws_byte_cursor null_terminator_cursor = aws_byte_cursor_from_string(s_empty_empty_string);
@@ -609,7 +628,8 @@ static int s_v4_test_context_parse_verification_key(struct v4_test_context *cont
609
628
  goto done;
610
629
  }
611
630
 
612
- document_root = cJSON_Parse((const char *)document->buffer);
631
+ struct aws_byte_cursor document_cursor = aws_byte_cursor_from_buf(document);
632
+ document_root = aws_json_value_new_from_string(aws_default_allocator(), document_cursor);
613
633
  if (document_root == NULL) {
614
634
  goto done;
615
635
  }
@@ -617,14 +637,16 @@ static int s_v4_test_context_parse_verification_key(struct v4_test_context *cont
617
637
  /*
618
638
  * Pull out the three credentials components
619
639
  */
620
- cJSON *pub_x = cJSON_GetObjectItemCaseSensitive(document_root, "X");
621
- cJSON *pub_y = cJSON_GetObjectItemCaseSensitive(document_root, "Y");
622
- if (!cJSON_IsString(pub_x) || !cJSON_IsString(pub_y)) {
640
+ struct aws_json_value *pub_x = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("X"));
641
+ struct aws_json_value *pub_y = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("Y"));
642
+ if (!aws_json_value_is_string(pub_x) || !aws_json_value_is_string(pub_y)) {
623
643
  goto done;
624
644
  }
625
645
 
626
- struct aws_byte_cursor pub_x_hex_cursor = aws_byte_cursor_from_c_str(pub_x->valuestring);
627
- struct aws_byte_cursor pub_y_hex_cursor = aws_byte_cursor_from_c_str(pub_y->valuestring);
646
+ struct aws_byte_cursor pub_x_hex_cursor;
647
+ struct aws_byte_cursor pub_y_hex_cursor;
648
+ aws_json_value_get_string(pub_x, &pub_x_hex_cursor);
649
+ aws_json_value_get_string(pub_y, &pub_y_hex_cursor);
628
650
 
629
651
  size_t pub_x_length = 0;
630
652
  size_t pub_y_length = 0;
@@ -655,7 +677,7 @@ static int s_v4_test_context_parse_verification_key(struct v4_test_context *cont
655
677
  done:
656
678
 
657
679
  if (document_root) {
658
- cJSON_Delete(document_root);
680
+ aws_json_value_destroy(document_root);
659
681
  }
660
682
 
661
683
  aws_byte_buf_clean_up(&pub_x_buffer);
@@ -98,9 +98,14 @@ else ()
98
98
  endif()
99
99
  set(PLATFORM_LIBS crypto dl)
100
100
  else()
101
- find_package(crypto REQUIRED)
102
- message(STATUS "Using libcrypto from cmake path")
103
- set(PLATFORM_LIBS AWS::crypto dl)
101
+ # note aws_use_package() does this for you, except it appends to the public link targets
102
+ # which we probably don't want for this case where we want the crypto dependency private
103
+ if (IN_SOURCE_BUILD)
104
+ set(PLATFORM_LIBS crypto dl)
105
+ else()
106
+ find_package(crypto REQUIRED)
107
+ set(PLATFORM_LIBS AWS::crypto dl)
108
+ endif()
104
109
  endif()
105
110
  endif()
106
111
  endif()
@@ -146,6 +146,8 @@ int main(int argc, char *argv[]) {
146
146
 
147
147
  aws_directory_entry_iterator_destroy(potential_corpus_dir);
148
148
  }
149
+
150
+ aws_string_destroy(potential_corpus_path);
149
151
  }
150
152
 
151
153
  if (corpus_file) {
@@ -224,10 +226,15 @@ int main(int argc, char *argv[]) {
224
226
  (int)signatures_processed);
225
227
 
226
228
  aws_byte_buf_clean_up(&hex_decoded_buf);
229
+ aws_byte_buf_clean_up(&to_hash);
230
+ aws_byte_buf_clean_up(&signed_value);
231
+
227
232
  fclose(corpus_input_file);
228
233
  aws_string_destroy(mode);
229
234
  }
230
235
 
236
+ aws_string_destroy(corpus_file);
237
+
231
238
  if (aws_directory_entry_iterator_next(dir_iter)) {
232
239
  break;
233
240
  }
@@ -237,6 +244,8 @@ int main(int argc, char *argv[]) {
237
244
  aws_directory_entry_iterator_destroy(dir_iter);
238
245
  aws_string_destroy(scan_path_str);
239
246
 
247
+ aws_byte_buf_clean_up(&scan_path);
248
+
240
249
  aws_ecc_key_pair_release(verifying_key);
241
250
 
242
251
  aws_cal_library_clean_up();
@@ -7,12 +7,18 @@
7
7
  "targets": {
8
8
  "linux": {
9
9
  "upstream": [
10
- { "name": "aws-lc" }
10
+ {
11
+ "name": "aws-lc",
12
+ "revision": "v1.0.2"
13
+ }
11
14
  ]
12
15
  },
13
16
  "android": {
14
17
  "upstream": [
15
- { "name": "aws-lc" }
18
+ {
19
+ "name": "aws-lc",
20
+ "revision": "v1.0.2"
21
+ }
16
22
  ]
17
23
  }
18
24
  },
@@ -38,6 +44,8 @@
38
44
  "test",
39
45
  [
40
46
  "{install_dir}/bin/sha256_profile"
41
- ]
47
+ ],
48
+ "{install_dir}/bin/run_x_platform_fuzz_corpus --corpus-path {source_dir}/ecdsa-fuzz-corpus"
49
+
42
50
  ]
43
51
  }
@@ -2,14 +2,23 @@ include(CMakeFindDependencyMacro)
2
2
 
3
3
  find_dependency(aws-c-common)
4
4
 
5
- if (NOT BYO_CRYPTO AND NOT WIN32 AND NOT APPLE)
6
- list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
7
- find_dependency(crypto)
8
- endif()
9
-
10
5
  if (BUILD_SHARED_LIBS)
11
6
  include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake)
12
7
  else()
13
8
  include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake)
14
9
  endif()
15
10
 
11
+ if (NOT BYO_CRYPTO AND NOT WIN32 AND NOT APPLE)
12
+ get_target_property(AWS_C_CAL_DEPS AWS::aws-c-cal INTERFACE_LINK_LIBRARIES)
13
+ # pre-cmake 3.3 IN_LIST search approach
14
+ list (FIND AWS_C_CAL_DEPS "OpenSSL::Crypto" _index)
15
+ if (${_index} GREATER -1) # if USE_OPENSSL AND NOT ANDROID
16
+ # aws-c-cal has been built with a dependency on OpenSSL::Crypto,
17
+ # therefore consumers of this library have a dependency on OpenSSL and must have it found
18
+ find_dependency(OpenSSL REQUIRED)
19
+ find_dependency(Threads REQUIRED)
20
+ else()
21
+ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
22
+ find_dependency(crypto)
23
+ endif()
24
+ endif()
@@ -189,15 +189,15 @@ static struct commoncrypto_ecc_key_pair *s_alloc_pair_and_init_buffers(
189
189
  }
190
190
 
191
191
  if (pub_x.ptr) {
192
- cc_key_pair->key_pair.pub_x.buffer = cc_key_pair->key_pair.key_buf.buffer + 1;
193
- cc_key_pair->key_pair.pub_x.len = s_key_coordinate_size;
192
+ cc_key_pair->key_pair.pub_x =
193
+ aws_byte_buf_from_array(cc_key_pair->key_pair.key_buf.buffer + 1, s_key_coordinate_size);
194
194
 
195
- cc_key_pair->key_pair.pub_y.buffer = cc_key_pair->key_pair.pub_x.buffer + s_key_coordinate_size;
196
- cc_key_pair->key_pair.pub_y.len = s_key_coordinate_size;
195
+ cc_key_pair->key_pair.pub_y =
196
+ aws_byte_buf_from_array(cc_key_pair->key_pair.pub_x.buffer + s_key_coordinate_size, s_key_coordinate_size);
197
197
  }
198
198
 
199
- cc_key_pair->key_pair.priv_d.buffer = cc_key_pair->key_pair.key_buf.buffer + 1 + (s_key_coordinate_size * 2);
200
- cc_key_pair->key_pair.priv_d.len = s_key_coordinate_size;
199
+ cc_key_pair->key_pair.priv_d = aws_byte_buf_from_array(
200
+ cc_key_pair->key_pair.key_buf.buffer + 1 + (s_key_coordinate_size * 2), s_key_coordinate_size);
201
201
  cc_key_pair->key_pair.vtable = &s_key_pair_vtable;
202
202
  cc_key_pair->key_pair.curve_name = curve_name;
203
203
 
@@ -333,14 +333,14 @@ static struct aws_ecc_key_pair *s_alloc_pair_and_init_buffers(
333
333
  aws_byte_buf_append(&key_impl->key_pair.key_buf, &priv_key);
334
334
  }
335
335
 
336
- key_impl->key_pair.pub_x.buffer = key_impl->key_pair.key_buf.buffer + sizeof(key_blob);
337
- key_impl->key_pair.pub_x.len = key_impl->key_pair.pub_x.capacity = s_key_coordinate_size;
336
+ key_impl->key_pair.pub_x =
337
+ aws_byte_buf_from_array(key_impl->key_pair.key_buf.buffer + sizeof(key_blob), s_key_coordinate_size);
338
338
 
339
- key_impl->key_pair.pub_y.buffer = key_impl->key_pair.pub_x.buffer + s_key_coordinate_size;
340
- key_impl->key_pair.pub_y.len = key_impl->key_pair.pub_y.capacity = s_key_coordinate_size;
339
+ key_impl->key_pair.pub_y =
340
+ aws_byte_buf_from_array(key_impl->key_pair.pub_x.buffer + s_key_coordinate_size, s_key_coordinate_size);
341
341
 
342
- key_impl->key_pair.priv_d.buffer = key_impl->key_pair.pub_y.buffer + s_key_coordinate_size;
343
- key_impl->key_pair.priv_d.len = key_impl->key_pair.priv_d.capacity = s_key_coordinate_size;
342
+ key_impl->key_pair.priv_d =
343
+ aws_byte_buf_from_array(key_impl->key_pair.pub_y.buffer + s_key_coordinate_size, s_key_coordinate_size);
344
344
 
345
345
  BCRYPT_ALG_HANDLE alg_handle = s_key_alg_handle_from_curve_name(curve_name);
346
346
  NTSTATUS status = BCryptImportKeyPair(
@@ -434,14 +434,14 @@ struct aws_ecc_key_pair *aws_ecc_key_pair_new_generate_random(
434
434
 
435
435
  aws_byte_buf_secure_zero(&key_impl->key_pair.key_buf);
436
436
 
437
- key_impl->key_pair.pub_x.buffer = key_impl->key_pair.key_buf.buffer + sizeof(BCRYPT_ECCKEY_BLOB);
438
- key_impl->key_pair.pub_x.len = key_impl->key_pair.pub_x.capacity = key_coordinate_size;
437
+ key_impl->key_pair.pub_x =
438
+ aws_byte_buf_from_array(key_impl->key_pair.key_buf.buffer + sizeof(BCRYPT_ECCKEY_BLOB), key_coordinate_size);
439
439
 
440
- key_impl->key_pair.pub_y.buffer = key_impl->key_pair.pub_x.buffer + key_coordinate_size;
441
- key_impl->key_pair.pub_y.len = key_impl->key_pair.pub_y.capacity = key_coordinate_size;
440
+ key_impl->key_pair.pub_y =
441
+ aws_byte_buf_from_array(key_impl->key_pair.pub_x.buffer + key_coordinate_size, key_coordinate_size);
442
442
 
443
- key_impl->key_pair.priv_d.buffer = key_impl->key_pair.pub_y.buffer + key_coordinate_size;
444
- key_impl->key_pair.priv_d.len = key_impl->key_pair.priv_d.capacity = key_coordinate_size;
443
+ key_impl->key_pair.priv_d =
444
+ aws_byte_buf_from_array(key_impl->key_pair.pub_y.buffer + key_coordinate_size, key_coordinate_size);
445
445
 
446
446
  if (s_derive_public_key(&key_impl->key_pair)) {
447
447
  goto error;
@@ -16,11 +16,11 @@ static inline int s_verify_hmac_test_case(
16
16
  aws_cal_library_init(allocator);
17
17
 
18
18
  /* test all possible segmentation lengths from 1 byte at a time to the entire
19
- * input. */
20
- for (size_t i = 1; i < input->len; ++i) {
19
+ * input. Using a do-while so that we still do 1 pass on 0-length input */
20
+ size_t advance_i = 1;
21
+ do {
21
22
  uint8_t output[128] = {0};
22
- struct aws_byte_buf output_buf = aws_byte_buf_from_array(output, expected->len);
23
- output_buf.len = 0;
23
+ struct aws_byte_buf output_buf = aws_byte_buf_from_empty_array(output, AWS_ARRAY_SIZE(output));
24
24
 
25
25
  struct aws_hmac *hmac = new_fn(allocator, secret);
26
26
  ASSERT_NOT_NULL(hmac);
@@ -28,19 +28,19 @@ static inline int s_verify_hmac_test_case(
28
28
  struct aws_byte_cursor input_cpy = *input;
29
29
 
30
30
  while (input_cpy.len) {
31
- size_t max_advance = input_cpy.len > i ? i : input_cpy.len;
31
+ size_t max_advance = aws_min_size(input_cpy.len, advance_i);
32
32
  struct aws_byte_cursor segment = aws_byte_cursor_from_array(input_cpy.ptr, max_advance);
33
33
  ASSERT_SUCCESS(aws_hmac_update(hmac, &segment));
34
34
  aws_byte_cursor_advance(&input_cpy, max_advance);
35
35
  }
36
36
 
37
- size_t truncation_size = hmac->digest_size - expected->len;
37
+ size_t truncation_size = expected->len;
38
38
 
39
39
  ASSERT_SUCCESS(aws_hmac_finalize(hmac, &output_buf, truncation_size));
40
40
  ASSERT_BIN_ARRAYS_EQUALS(expected->ptr, expected->len, output_buf.buffer, output_buf.len);
41
41
 
42
42
  aws_hmac_destroy(hmac);
43
- }
43
+ } while (++advance_i <= input->len);
44
44
 
45
45
  aws_cal_library_clean_up();
46
46
 
@@ -56,11 +56,11 @@ static inline int s_verify_hash_test_case(
56
56
  aws_cal_library_init(allocator);
57
57
 
58
58
  /* test all possible segmentation lengths from 1 byte at a time to the entire
59
- * input. */
60
- for (size_t i = 1; i < input->len; ++i) {
59
+ * input. Using a do-while so that we still do 1 pass on 0-length input */
60
+ size_t advance_i = 1;
61
+ do {
61
62
  uint8_t output[128] = {0};
62
- struct aws_byte_buf output_buf = aws_byte_buf_from_array(output, expected->len);
63
- output_buf.len = 0;
63
+ struct aws_byte_buf output_buf = aws_byte_buf_from_empty_array(output, AWS_ARRAY_SIZE(output));
64
64
 
65
65
  struct aws_hash *hash = new_fn(allocator);
66
66
  ASSERT_NOT_NULL(hash);
@@ -68,19 +68,19 @@ static inline int s_verify_hash_test_case(
68
68
  struct aws_byte_cursor input_cpy = *input;
69
69
 
70
70
  while (input_cpy.len) {
71
- size_t max_advance = input_cpy.len > i ? i : input_cpy.len;
71
+ size_t max_advance = aws_min_size(input_cpy.len, advance_i);
72
72
  struct aws_byte_cursor segment = aws_byte_cursor_from_array(input_cpy.ptr, max_advance);
73
73
  ASSERT_SUCCESS(aws_hash_update(hash, &segment));
74
74
  aws_byte_cursor_advance(&input_cpy, max_advance);
75
75
  }
76
76
 
77
- size_t truncation_size = hash->digest_size - expected->len;
77
+ size_t truncation_size = expected->len;
78
78
 
79
79
  ASSERT_SUCCESS(aws_hash_finalize(hash, &output_buf, truncation_size));
80
80
  ASSERT_BIN_ARRAYS_EQUALS(expected->ptr, expected->len, output_buf.buffer, output_buf.len);
81
81
 
82
82
  aws_hash_destroy(hash);
83
- }
83
+ } while (++advance_i <= input->len);
84
84
 
85
85
  aws_cal_library_clean_up();
86
86
 
@@ -37,6 +37,9 @@ file(GLOB AWS_COMMON_HEADERS
37
37
  "include/aws/common/*.inl"
38
38
  )
39
39
 
40
+ file (GLOB AWS_COMMON_EXTERNAL_HEADERS
41
+ "include/aws/common/external/*.h")
42
+
40
43
  file(GLOB AWS_TEST_HEADERS
41
44
  "include/aws/testing/*.h"
42
45
  )
@@ -50,6 +53,9 @@ file(GLOB AWS_COMMON_SRC
50
53
  "source/*.c"
51
54
  )
52
55
 
56
+ file (GLOB AWS_COMMON_EXTERNAL_SRC
57
+ "source/external/*.c")
58
+
53
59
  option(AWS_NUM_CPU_CORES "Number of CPU cores of the target machine. Useful when cross-compiling." 0)
54
60
 
55
61
  if (WIN32)
@@ -85,13 +91,23 @@ else ()
85
91
 
86
92
  if (UNIX OR APPLE)
87
93
  find_package(Threads REQUIRED)
88
- endif ()
94
+
95
+ if (NOT ANDROID AND NOT CMAKE_THREAD_LIBS_INIT)
96
+ check_symbol_exists(pthread_mutexattr_init "<pthread.h>" HAVE_PTHREAD_MUTEXATTR_INIT)
97
+ if (NOT HAVE_PTHREAD_MUTEXATTR_INIT)
98
+ # fsanitize=... results in GLIBC library to provide some pthread APIs but not all
99
+ list(APPEND PLATFORM_LIBS pthread)
100
+ endif()
101
+ endif()
102
+ endif()
89
103
 
90
104
  if (APPLE)
91
105
  # Don't add the exact path to CoreFoundation as this would hardcode the SDK version
92
106
  list(APPEND PLATFORM_LIBS dl Threads::Threads "-framework CoreFoundation")
107
+ list (APPEND AWS_COMMON_OS_SRC "source/darwin/*.c") # OS specific includes
93
108
  elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") # Android does not link to libpthread nor librt, so this is fine
94
109
  list(APPEND PLATFORM_LIBS dl m Threads::Threads rt)
110
+ list (APPEND AWS_COMMON_OS_SRC "source/linux/*.c") # OS specific includes
95
111
  elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
96
112
  list(APPEND PLATFORM_LIBS dl m thr execinfo)
97
113
  elseif(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
@@ -142,6 +158,7 @@ file(GLOB COMMON_HEADERS
142
158
  ${AWS_COMMON_HEADERS}
143
159
  ${AWS_COMMON_OS_HEADERS}
144
160
  ${AWS_COMMON_PRIV_HEADERS}
161
+ ${AWS_COMMON_EXTERNAL_HEADERS}
145
162
  ${AWS_TEST_HEADERS}
146
163
  )
147
164
 
@@ -149,6 +166,7 @@ file(GLOB COMMON_SRC
149
166
  ${AWS_COMMON_SRC}
150
167
  ${AWS_COMMON_OS_SRC}
151
168
  ${AWS_COMMON_ARCH_SRC}
169
+ ${AWS_COMMON_EXTERNAL_SRC}
152
170
  )
153
171
 
154
172
 
@@ -187,6 +205,8 @@ target_include_directories(${PROJECT_NAME} PUBLIC
187
205
  target_include_directories(${PROJECT_NAME} PUBLIC
188
206
  $<BUILD_INTERFACE:${GENERATED_INCLUDE_DIR}>)
189
207
 
208
+ target_compile_definitions(${PROJECT_NAME} PRIVATE -DCJSON_HIDE_SYMBOLS)
209
+
190
210
  # Enable SIMD encoder if the compiler supports the right features
191
211
  simd_add_definitions(${PROJECT_NAME})
192
212
 
@@ -253,3 +253,11 @@ Not:
253
253
  AWS_LOGF_ERROR(AWS_LS_SOME_SUBJECT, "Invalid options - something is null");
254
254
  return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
255
255
  }
256
+
257
+ ## CBMC
258
+
259
+ To learn more about CBMC and proofs specifically, review the training material [here](https://model-checking.github.io/cbmc-training).
260
+
261
+ The `verification/cbmc/proofs` directory contains CBMC proofs.
262
+
263
+ In order to run these proofs you will need to install CBMC and other tools by following the instructions [here](https://model-checking.github.io/cbmc-training/installation.html).
@@ -120,11 +120,26 @@ function(aws_set_common_properties target)
120
120
  list(APPEND AWS_C_FLAGS -Wno-strict-aliasing)
121
121
  endif()
122
122
 
123
- # -moutline-atomics generates code for both older load/store exclusive atomics and also
124
- # Arm's Large System Extensions (LSE) which scale substantially better on large core count systems
125
- check_c_compiler_flag("-moutline-atomics -Werror" HAS_MOUTLINE_ATOMICS)
126
- if (HAS_MOUTLINE_ATOMICS AND AWS_ARCH_ARM64)
127
- list(APPEND AWS_C_FLAGS -moutline-atomics)
123
+ # -moutline-atomics generates code for both older load/store exclusive atomics and also
124
+ # Arm's Large System Extensions (LSE) which scale substantially better on large core count systems.
125
+ #
126
+ # Test by compiling a program that actually uses atomics.
127
+ # Previously we'd simply used check_c_compiler_flag() but that wasn't detecting
128
+ # some real-world problems (see https://github.com/awslabs/aws-c-common/issues/902).
129
+ if (AWS_ARCH_ARM64)
130
+ set(old_flags "${CMAKE_REQUIRED_FLAGS}")
131
+ set(CMAKE_REQUIRED_FLAGS "-moutline-atomics -Werror")
132
+ check_c_source_compiles("
133
+ int main() {
134
+ int x = 1;
135
+ __atomic_fetch_add(&x, -1, __ATOMIC_SEQ_CST);
136
+ return x;
137
+ }" HAS_MOUTLINE_ATOMICS)
138
+ set(CMAKE_REQUIRED_FLAGS "${old_flags}")
139
+
140
+ if (HAS_MOUTLINE_ATOMICS)
141
+ list(APPEND AWS_C_FLAGS -moutline-atomics)
142
+ endif()
128
143
  endif()
129
144
 
130
145
  # Check for Posix Large File Support (LFS).
@@ -7,7 +7,7 @@ include(AwsCFlags)
7
7
  option(USE_CPU_EXTENSIONS "Whenever possible, use functions optimized for CPUs with specific extensions (ex: SSE, AVX)." ON)
8
8
 
9
9
  # In the current (11/2/21) state of mingw64, the packaged gcc is not capable of emitting properly aligned avx2 instructions under certain circumstances.
10
- # This leads to crashes for windows builds using mingw64 when invoking the avx2-enabled versions of certain functions. Until we can find a better
10
+ # This leads to crashes for windows builds using mingw64 when invoking the avx2-enabled versions of certain functions. Until we can find a better
11
11
  # work-around, disable avx2 (and all other extensions) in mingw builds.
12
12
  #
13
13
  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
@@ -106,3 +106,9 @@ if(NOT LEGACY_COMPILER_SUPPORT OR ARM_CPU)
106
106
  return 0;
107
107
  }" AWS_HAVE_EXECINFO)
108
108
  endif()
109
+
110
+ check_c_source_compiles("
111
+ #include <linux/if_link.h>
112
+ int main() {
113
+ return 1;
114
+ }" AWS_HAVE_LINUX_IF_LINK_H)
@@ -4,7 +4,7 @@ if [[ -z $CLANG_FORMAT ]] ; then
4
4
  CLANG_FORMAT=clang-format
5
5
  fi
6
6
 
7
- if NOT type $CLANG_FORMAT 2> /dev/null ; then
7
+ if ! type $CLANG_FORMAT 2> /dev/null ; then
8
8
  echo "No appropriate clang-format found."
9
9
  exit 1
10
10
  fi