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
@@ -52,7 +52,7 @@ ALL_TEST_CERTS = [
52
52
  Certificates.RSA_4096_SHA512,
53
53
  Certificates.ECDSA_256,
54
54
  Certificates.ECDSA_384,
55
- Certificates.RSA_PSS_2048_SHA256,
55
+ Certificates.RSA_PSS_2048_SHA256
56
56
  ]
57
57
 
58
58
 
@@ -107,105 +107,105 @@ available_ports = AvailablePorts()
107
107
  # Server certificates used to test matching domain names client with server_name
108
108
  # ( cert_path, private_key_path, domains[] )
109
109
  SNI_CERTS = {
110
- "alligator" : (
110
+ "alligator": (
111
111
  TEST_SNI_CERT_DIRECTORY + "alligator_cert.pem",
112
112
  TEST_SNI_CERT_DIRECTORY + "alligator_key.pem",
113
113
  ["www.alligator.com"]
114
114
  ),
115
- "second_alligator_rsa" : (
115
+ "second_alligator_rsa": (
116
116
  TEST_SNI_CERT_DIRECTORY + "second_alligator_rsa_cert.pem",
117
117
  TEST_SNI_CERT_DIRECTORY + "second_alligator_rsa_key.pem",
118
118
  ["www.alligator.com"]
119
119
  ),
120
- "alligator_ecdsa" : (
120
+ "alligator_ecdsa": (
121
121
  TEST_SNI_CERT_DIRECTORY + "alligator_ecdsa_cert.pem",
122
122
  TEST_SNI_CERT_DIRECTORY + "alligator_ecdsa_key.pem",
123
123
  ["www.alligator.com"]
124
124
  ),
125
- "beaver" : (
125
+ "beaver": (
126
126
  TEST_SNI_CERT_DIRECTORY + "beaver_cert.pem",
127
127
  TEST_SNI_CERT_DIRECTORY + "beaver_key.pem",
128
128
  ["www.beaver.com"]
129
129
  ),
130
- "many_animals" : (
130
+ "many_animals": (
131
131
  TEST_SNI_CERT_DIRECTORY + "many_animal_sans_rsa_cert.pem",
132
132
  TEST_SNI_CERT_DIRECTORY + "many_animal_sans_rsa_key.pem",
133
133
  ["www.catfish.com",
134
- "www.dolphin.com",
135
- "www.elephant.com",
136
- "www.falcon.com",
137
- "www.gorilla.com",
138
- "www.horse.com",
139
- "www.impala.com",
140
- # "Simple hostname"
141
- "Jackal",
142
- "k.e.e.l.b.i.l.l.e.d.t.o.u.c.a.n",
143
- # SAN on this cert is actually "ladybug.ladybug"
144
- # Verify case insensitivity works as expected.
145
- "LADYBUG.LADYBUG",
146
- "com.penguin.macaroni"]
134
+ "www.dolphin.com",
135
+ "www.elephant.com",
136
+ "www.falcon.com",
137
+ "www.gorilla.com",
138
+ "www.horse.com",
139
+ "www.impala.com",
140
+ # "Simple hostname"
141
+ "Jackal",
142
+ "k.e.e.l.b.i.l.l.e.d.t.o.u.c.a.n",
143
+ # SAN on this cert is actually "ladybug.ladybug"
144
+ # Verify case insensitivity works as expected.
145
+ "LADYBUG.LADYBUG",
146
+ "com.penguin.macaroni"]
147
147
  ),
148
- "narwhal_cn" : (
148
+ "narwhal_cn": (
149
149
  TEST_SNI_CERT_DIRECTORY + "narwhal_cn_cert.pem",
150
150
  TEST_SNI_CERT_DIRECTORY + "narwhal_cn_key.pem",
151
151
  ["www.narwhal.com"]
152
152
  ),
153
- "octopus_cn_platypus_san" : (
153
+ "octopus_cn_platypus_san": (
154
154
  TEST_SNI_CERT_DIRECTORY + "octopus_cn_platypus_san_cert.pem",
155
155
  TEST_SNI_CERT_DIRECTORY + "octopus_cn_platypus_san_key.pem",
156
156
  ["www.platypus.com"]
157
157
  ),
158
- "quail_cn_rattlesnake_cn" : (
158
+ "quail_cn_rattlesnake_cn": (
159
159
  TEST_SNI_CERT_DIRECTORY + "quail_cn_rattlesnake_cn_cert.pem",
160
160
  TEST_SNI_CERT_DIRECTORY + "quail_cn_rattlesnake_cn_key.pem",
161
161
  ["www.quail.com", "www.rattlesnake.com"]
162
162
  ),
163
- "many_animals_mixed_case" : (
163
+ "many_animals_mixed_case": (
164
164
  TEST_SNI_CERT_DIRECTORY + "many_animal_sans_mixed_case_rsa_cert.pem",
165
165
  TEST_SNI_CERT_DIRECTORY + "many_animal_sans_mixed_case_rsa_key.pem",
166
166
  ["alligator.com",
167
- "beaver.com",
168
- "catFish.com",
169
- "WWW.dolphin.COM",
170
- "www.ELEPHANT.com",
171
- "www.Falcon.Com",
172
- "WWW.gorilla.COM",
173
- "www.horse.com",
174
- "WWW.IMPALA.COM",
175
- "WwW.jAcKaL.cOm"]
167
+ "beaver.com",
168
+ "catFish.com",
169
+ "WWW.dolphin.COM",
170
+ "www.ELEPHANT.com",
171
+ "www.Falcon.Com",
172
+ "WWW.gorilla.COM",
173
+ "www.horse.com",
174
+ "WWW.IMPALA.COM",
175
+ "WwW.jAcKaL.cOm"]
176
176
  ),
177
- "embedded_wildcard" : (
177
+ "embedded_wildcard": (
178
178
  TEST_SNI_CERT_DIRECTORY + "embedded_wildcard_rsa_cert.pem",
179
179
  TEST_SNI_CERT_DIRECTORY + "embedded_wildcard_rsa_key.pem",
180
180
  ["www.labelstart*labelend.com"]
181
181
  ),
182
- "non_empty_label_wildcard" : (
182
+ "non_empty_label_wildcard": (
183
183
  TEST_SNI_CERT_DIRECTORY + "non_empty_label_wildcard_rsa_cert.pem",
184
184
  TEST_SNI_CERT_DIRECTORY + "non_empty_label_wildcard_rsa_key.pem",
185
185
  ["WILD*.middle.end"]
186
186
  ),
187
- "trailing_wildcard" : (
187
+ "trailing_wildcard": (
188
188
  TEST_SNI_CERT_DIRECTORY + "trailing_wildcard_rsa_cert.pem",
189
189
  TEST_SNI_CERT_DIRECTORY + "trailing_wildcard_rsa_key.pem",
190
190
  ["the.prefix.*"]
191
191
  ),
192
- "wildcard_insect" : (
192
+ "wildcard_insect": (
193
193
  TEST_SNI_CERT_DIRECTORY + "wildcard_insect_rsa_cert.pem",
194
194
  TEST_SNI_CERT_DIRECTORY + "wildcard_insect_rsa_key.pem",
195
195
  ["ant.insect.hexapod",
196
- "BEE.insect.hexapod",
197
- "wasp.INSECT.hexapod",
198
- "butterfly.insect.hexapod"]
196
+ "BEE.insect.hexapod",
197
+ "wasp.INSECT.hexapod",
198
+ "butterfly.insect.hexapod"]
199
199
  ),
200
- "termite" : (
200
+ "termite": (
201
201
  TEST_SNI_CERT_DIRECTORY + "termite_rsa_cert.pem",
202
202
  TEST_SNI_CERT_DIRECTORY + "termite_rsa_key.pem",
203
- [ "termite.insect.hexapod" ]
203
+ ["termite.insect.hexapod"]
204
204
  ),
205
- "underwing" : (
205
+ "underwing": (
206
206
  TEST_SNI_CERT_DIRECTORY + "underwing_ecdsa_cert.pem",
207
207
  TEST_SNI_CERT_DIRECTORY + "underwing_ecdsa_key.pem",
208
- [ "underwing.insect.hexapod" ]
208
+ ["underwing.insect.hexapod"]
209
209
  )
210
210
  }
211
211
 
@@ -213,105 +213,117 @@ SNI_CERTS = {
213
213
  # Test cases for certificate selection.
214
214
  # Test inputs: server certificates to load into s2nd, client SNI and capabilities, outputs are selected server cert
215
215
  # and negotiated cipher.
216
- MultiCertTest = collections.namedtuple('MultiCertTest', 'description server_certs client_sni client_ciphers expected_cert expect_matching_hostname')
217
- MULTI_CERT_TEST_CASES= [
216
+ MultiCertTest = collections.namedtuple(
217
+ 'MultiCertTest', 'description server_certs client_sni client_ciphers expected_cert expect_matching_hostname')
218
+ MULTI_CERT_TEST_CASES = [
218
219
  MultiCertTest(
219
220
  description="Test basic SNI match for default cert.",
220
- server_certs=[SNI_CERTS["alligator"], SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
221
+ server_certs=[SNI_CERTS["alligator"],
222
+ SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
221
223
  client_sni="www.alligator.com",
222
224
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
223
225
  expected_cert=SNI_CERTS["alligator"],
224
226
  expect_matching_hostname=True),
225
227
  MultiCertTest(
226
228
  description="Test basic SNI matches for non-default cert.",
227
- server_certs=[SNI_CERTS["alligator"], SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
229
+ server_certs=[SNI_CERTS["alligator"],
230
+ SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
228
231
  client_sni="www.beaver.com",
229
232
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
230
233
  expected_cert=SNI_CERTS["beaver"],
231
234
  expect_matching_hostname=True),
232
235
  MultiCertTest(
233
236
  description="Test default cert is selected when there are no SNI matches.",
234
- server_certs=[SNI_CERTS["alligator"], SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
237
+ server_certs=[SNI_CERTS["alligator"],
238
+ SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
235
239
  client_sni="not.a.match",
236
240
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
237
241
  expected_cert=SNI_CERTS["alligator"],
238
242
  expect_matching_hostname=False),
239
243
  MultiCertTest(
240
244
  description="Test default cert is selected when no SNI is sent.",
241
- server_certs=[SNI_CERTS["alligator"], SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
245
+ server_certs=[SNI_CERTS["alligator"],
246
+ SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
242
247
  client_sni=None,
243
248
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
244
249
  expected_cert=SNI_CERTS["alligator"],
245
250
  expect_matching_hostname=False),
246
251
  MultiCertTest(
247
252
  description="Test ECDSA cert is selected with matching domain and client only supports ECDSA.",
248
- server_certs=[SNI_CERTS["alligator"], SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
253
+ server_certs=[SNI_CERTS["alligator"],
254
+ SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
249
255
  client_sni="www.alligator.com",
250
256
  client_ciphers=[Ciphers.ECDHE_ECDSA_AES128_SHA],
251
257
  expected_cert=SNI_CERTS["alligator_ecdsa"],
252
258
  expect_matching_hostname=True),
253
259
  MultiCertTest(
254
- description="Test ECDSA cert selected when: domain matches for both ECDSA+RSA, client supports ECDSA+RSA "\
260
+ description="Test ECDSA cert selected when: domain matches for both ECDSA+RSA, client supports ECDSA+RSA "
255
261
  " ciphers, ECDSA is higher priority on server side.",
256
- server_certs=[SNI_CERTS["alligator"], SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
262
+ server_certs=[SNI_CERTS["alligator"],
263
+ SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
257
264
  client_sni="www.alligator.com",
258
- client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA, Ciphers.ECDHE_ECDSA_AES128_SHA],
265
+ client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA,
266
+ Ciphers.ECDHE_ECDSA_AES128_SHA],
259
267
  expected_cert=SNI_CERTS["alligator_ecdsa"],
260
268
  expect_matching_hostname=True),
261
269
  MultiCertTest(
262
- description="Test domain match is highest priority. Domain matching ECDSA certificate should be selected"\
270
+ description="Test domain match is highest priority. Domain matching ECDSA certificate should be selected"
263
271
  " even if domain mismatched RSA certificate is available and RSA cipher is higher priority.",
264
272
  server_certs=[SNI_CERTS["beaver"], SNI_CERTS["alligator_ecdsa"]],
265
273
  client_sni="www.alligator.com",
266
- client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA256, Ciphers.ECDHE_ECDSA_AES128_SHA256],
274
+ client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA256,
275
+ Ciphers.ECDHE_ECDSA_AES128_SHA256],
267
276
  expected_cert=SNI_CERTS["alligator_ecdsa"],
268
277
  expect_matching_hostname=True),
269
278
  MultiCertTest(
270
279
  description="Test certificate with single SAN entry matching is selected before mismatched multi SAN cert",
271
- server_certs=[SNI_CERTS["many_animals"] , SNI_CERTS["alligator"]],
280
+ server_certs=[SNI_CERTS["many_animals"], SNI_CERTS["alligator"]],
272
281
  client_sni="www.alligator.com",
273
282
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
274
283
  expected_cert=SNI_CERTS["alligator"],
275
284
  expect_matching_hostname=True),
276
- # many_animals was the first cert added
285
+ # many_animals was the first cert added
277
286
  MultiCertTest(
278
287
  description="Test default cert with multiple sans and no SNI sent.",
279
- server_certs=[SNI_CERTS["many_animals"] , SNI_CERTS["alligator"]],
288
+ server_certs=[SNI_CERTS["many_animals"], SNI_CERTS["alligator"]],
280
289
  client_sni=None,
281
290
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
282
291
  expected_cert=SNI_CERTS["many_animals"],
283
292
  expect_matching_hostname=False),
284
293
  MultiCertTest(
285
294
  description="Test certificate match with CN",
286
- server_certs=[ SNI_CERTS["alligator"], SNI_CERTS["narwhal_cn"] ],
295
+ server_certs=[SNI_CERTS["alligator"], SNI_CERTS["narwhal_cn"]],
287
296
  client_sni="www.narwhal.com",
288
297
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
289
298
  expected_cert=SNI_CERTS["narwhal_cn"],
290
299
  expect_matching_hostname=True),
291
300
  MultiCertTest(
292
301
  description="Test SAN+CN cert can match using SAN.",
293
- server_certs=[ SNI_CERTS["alligator"], SNI_CERTS["octopus_cn_platypus_san"] ],
302
+ server_certs=[SNI_CERTS["alligator"],
303
+ SNI_CERTS["octopus_cn_platypus_san"]],
294
304
  client_sni="www.platypus.com",
295
305
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
296
306
  expected_cert=SNI_CERTS["octopus_cn_platypus_san"],
297
307
  expect_matching_hostname=True),
298
308
  MultiCertTest(
299
309
  description="Test that CN is not considered for matching if the certificate contains SANs.",
300
- server_certs=[ SNI_CERTS["alligator"], SNI_CERTS["octopus_cn_platypus_san"] ],
310
+ server_certs=[SNI_CERTS["alligator"],
311
+ SNI_CERTS["octopus_cn_platypus_san"]],
301
312
  client_sni="www.octopus.com",
302
313
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
303
314
  expected_cert=SNI_CERTS["alligator"],
304
315
  expect_matching_hostname=False),
305
316
  MultiCertTest(
306
317
  description="Test certificate with multiple CNs can match.",
307
- server_certs=[ SNI_CERTS["alligator"], SNI_CERTS["quail_cn_rattlesnake_cn"] ],
318
+ server_certs=[SNI_CERTS["alligator"],
319
+ SNI_CERTS["quail_cn_rattlesnake_cn"]],
308
320
  client_sni="www.rattlesnake.com",
309
321
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
310
322
  expected_cert=SNI_CERTS["quail_cn_rattlesnake_cn"],
311
323
  expect_matching_hostname=False),
312
324
  MultiCertTest(
313
325
  description="Test cert with embedded wildcard is not treated as a wildcard.",
314
- server_certs=[ SNI_CERTS["alligator"], SNI_CERTS["embedded_wildcard"] ],
326
+ server_certs=[SNI_CERTS["alligator"], SNI_CERTS["embedded_wildcard"]],
315
327
  client_sni="www.labelstartWILDCARDlabelend.com",
316
328
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
317
329
  expected_cert=SNI_CERTS["alligator"],
@@ -319,14 +331,15 @@ MULTI_CERT_TEST_CASES= [
319
331
  MultiCertTest(
320
332
  description="Test non empty left label wildcard cert is not treated as a wildcard."\
321
333
  " s2n only supports wildcards with a single * as the left label",
322
- server_certs=[ SNI_CERTS["alligator"], SNI_CERTS["non_empty_label_wildcard"] ],
334
+ server_certs=[SNI_CERTS["alligator"],
335
+ SNI_CERTS["non_empty_label_wildcard"]],
323
336
  client_sni="WILDCARD.middle.end",
324
337
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
325
338
  expected_cert=SNI_CERTS["alligator"],
326
339
  expect_matching_hostname=False),
327
340
  MultiCertTest(
328
341
  description="Test cert with trailing * is not treated as wildcard.",
329
- server_certs=[ SNI_CERTS["alligator"], SNI_CERTS["trailing_wildcard"] ],
342
+ server_certs=[SNI_CERTS["alligator"], SNI_CERTS["trailing_wildcard"]],
330
343
  client_sni="the.prefix.WILDCARD",
331
344
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
332
345
  expected_cert=SNI_CERTS["alligator"],
@@ -334,7 +347,8 @@ MULTI_CERT_TEST_CASES= [
334
347
  MultiCertTest(
335
348
  description="Certificate with exact sni match(termite.insect.hexapod) is preferred over wildcard"\
336
349
  " *.insect.hexapod",
337
- server_certs=[ SNI_CERTS["wildcard_insect"], SNI_CERTS["alligator"], SNI_CERTS["termite"] ],
350
+ server_certs=[SNI_CERTS["wildcard_insect"],
351
+ SNI_CERTS["alligator"], SNI_CERTS["termite"]],
338
352
  client_sni="termite.insect.hexapod",
339
353
  client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
340
354
  expected_cert=SNI_CERTS["termite"],
@@ -342,46 +356,52 @@ MULTI_CERT_TEST_CASES= [
342
356
  MultiCertTest(
343
357
  description="ECDSA Certificate with exact sni match(underwing.insect.hexapod) is preferred over RSA wildcard"\
344
358
  " *.insect.hexapod when RSA ciphers are higher priority than ECDSA in server preferences.",
345
- server_certs=[ SNI_CERTS["wildcard_insect"], SNI_CERTS["alligator"], SNI_CERTS["underwing"] ],
359
+ server_certs=[SNI_CERTS["wildcard_insect"],
360
+ SNI_CERTS["alligator"], SNI_CERTS["underwing"]],
346
361
  client_sni="underwing.insect.hexapod",
347
- client_ciphers=[Ciphers.ECDHE_RSA_AES128_GCM_SHA256, Ciphers.ECDHE_ECDSA_AES128_GCM_SHA256],
362
+ client_ciphers=[Ciphers.ECDHE_RSA_AES128_GCM_SHA256,
363
+ Ciphers.ECDHE_ECDSA_AES128_GCM_SHA256],
348
364
  expected_cert=SNI_CERTS["underwing"],
349
365
  expect_matching_hostname=True),
350
366
  MultiCertTest(
351
367
  description="Firstly loaded matching certificate should be selected among certificates with the same domain names",
352
- server_certs=[ SNI_CERTS["alligator"], SNI_CERTS["second_alligator_rsa"] ],
368
+ server_certs=[SNI_CERTS["alligator"],
369
+ SNI_CERTS["second_alligator_rsa"]],
353
370
  client_sni="www.alligator.com",
354
371
  client_ciphers=[Ciphers.AES128_GCM_SHA256],
355
372
  expected_cert=SNI_CERTS["alligator"],
356
373
  expect_matching_hostname=True),
357
374
  MultiCertTest(
358
375
  description="Firstly loaded matching certificate should be selected among matching+non-matching certificates",
359
- server_certs=[ SNI_CERTS["beaver"], SNI_CERTS["alligator"], SNI_CERTS["second_alligator_rsa"] ],
376
+ server_certs=[SNI_CERTS["beaver"], SNI_CERTS["alligator"],
377
+ SNI_CERTS["second_alligator_rsa"]],
360
378
  client_sni="www.alligator.com",
361
379
  client_ciphers=[Ciphers.AES128_GCM_SHA256],
362
380
  expected_cert=SNI_CERTS["alligator"],
363
381
  expect_matching_hostname=True)]
364
382
  # Positive test for wildcard matches
365
383
  MULTI_CERT_TEST_CASES.extend([MultiCertTest(
366
- description="Test wildcard *.insect.hexapod matches subdomain " + specific_insect_domain,
367
- server_certs=[ SNI_CERTS["alligator"], SNI_CERTS["wildcard_insect"] ],
368
- client_sni=specific_insect_domain,
369
- client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
370
- expected_cert=SNI_CERTS["wildcard_insect"],
371
- expect_matching_hostname=True) for specific_insect_domain in SNI_CERTS["wildcard_insect"][2]])
384
+ description="Test wildcard *.insect.hexapod matches subdomain " + specific_insect_domain,
385
+ server_certs=[SNI_CERTS["alligator"], SNI_CERTS["wildcard_insect"]],
386
+ client_sni=specific_insect_domain,
387
+ client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
388
+ expected_cert=SNI_CERTS["wildcard_insect"],
389
+ expect_matching_hostname=True) for specific_insect_domain in SNI_CERTS["wildcard_insect"][2]])
372
390
  # Positive test for basic SAN matches
373
391
  MULTI_CERT_TEST_CASES.extend([MultiCertTest(
374
- description="Match SAN " + many_animal_domain + " in many_animals cert",
375
- server_certs= [ SNI_CERTS["alligator"], SNI_CERTS["many_animals"] ],
376
- client_sni=many_animal_domain,
377
- client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
378
- expected_cert=SNI_CERTS["many_animals"],
379
- expect_matching_hostname=True) for many_animal_domain in SNI_CERTS["many_animals"][2]])
392
+ description="Match SAN " + many_animal_domain + " in many_animals cert",
393
+ server_certs=[SNI_CERTS["alligator"], SNI_CERTS["many_animals"]],
394
+ client_sni=many_animal_domain,
395
+ client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
396
+ expected_cert=SNI_CERTS["many_animals"],
397
+ expect_matching_hostname=True) for many_animal_domain in SNI_CERTS["many_animals"][2]])
380
398
  # Positive test for mixed cased SAN matches
381
399
  MULTI_CERT_TEST_CASES.extend([MultiCertTest(
382
- description="Match SAN " + many_animal_domain + " in many_animals_mixed_case cert",
383
- server_certs= [SNI_CERTS["alligator"] , SNI_CERTS["many_animals_mixed_case"]],
384
- client_sni=many_animal_domain,
385
- client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
386
- expected_cert=SNI_CERTS["many_animals_mixed_case"],
387
- expect_matching_hostname=True) for many_animal_domain in SNI_CERTS["many_animals_mixed_case"][2]])
400
+ description="Match SAN " + many_animal_domain +
401
+ " in many_animals_mixed_case cert",
402
+ server_certs=[SNI_CERTS["alligator"],
403
+ SNI_CERTS["many_animals_mixed_case"]],
404
+ client_sni=many_animal_domain,
405
+ client_ciphers=[Ciphers.ECDHE_RSA_AES128_SHA],
406
+ expected_cert=SNI_CERTS["many_animals_mixed_case"],
407
+ expect_matching_hostname=True) for many_animal_domain in SNI_CERTS["many_animals_mixed_case"][2]])
@@ -3,9 +3,12 @@ from global_flags import set_flag, S2N_PROVIDER_VERSION, S2N_FIPS_MODE, S2N_NO_P
3
3
 
4
4
 
5
5
  def pytest_addoption(parser):
6
- parser.addoption("--provider-version", action="store", dest="provider-version", default=None, type=str, help="Set the version of the TLS provider")
7
- parser.addoption("--fips-mode", action="store", dest="fips-mode", default=False, type=int, help="S2N is running in FIPS mode")
8
- parser.addoption("--no-pq", action="store", dest="no-pq", default=False, type=int, help="Turn off PQ support")
6
+ parser.addoption("--provider-version", action="store", dest="provider-version",
7
+ default=None, type=str, help="Set the version of the TLS provider")
8
+ parser.addoption("--fips-mode", action="store", dest="fips-mode",
9
+ default=False, type=int, help="S2N is running in FIPS mode")
10
+ parser.addoption("--no-pq", action="store", dest="no-pq",
11
+ default=False, type=int, help="Turn off PQ support")
9
12
 
10
13
 
11
14
  def pytest_configure(config):
@@ -1,5 +1,7 @@
1
- TEST_CERT_DIRECTORY="../pems/"
2
- TEST_SNI_CERT_DIRECTORY="../pems/sni/"
1
+ TEST_CERT_DIRECTORY = "../pems/"
2
+ TEST_SNI_CERT_DIRECTORY = "../pems/sni/"
3
+ TEST_OCSP_DIRECTORY = "../pems/ocsp/"
3
4
 
4
- TRUST_STORE_BUNDLE=TEST_CERT_DIRECTORY + 'trust-store/ca-bundle.crt'
5
- TRUST_STORE_TRUSTED_BUNDLE=TEST_CERT_DIRECTORY + 'trust-store/ca-bundle.trust.crt'
5
+ TRUST_STORE_BUNDLE = TEST_CERT_DIRECTORY + 'trust-store/ca-bundle.crt'
6
+ TRUST_STORE_TRUSTED_BUNDLE = TEST_CERT_DIRECTORY + \
7
+ 'trust-store/ca-bundle.trust.crt'
@@ -21,7 +21,8 @@ def managed_process():
21
21
  """
22
22
  processes = []
23
23
 
24
- def _fn(provider_class: Provider, options: ProviderOptions, timeout=5, send_marker=None, close_marker=None, expect_stderr=None):
24
+ def _fn(provider_class: Provider, options: ProviderOptions, timeout=5, send_marker=None, close_marker=None,
25
+ expect_stderr=None, kill_marker=None, send_with_newline=None):
25
26
  provider = provider_class(options)
26
27
  cmd_line = provider.get_cmd_line()
27
28
  # The process will default to send markers in the providers.py file
@@ -30,22 +31,29 @@ def managed_process():
30
31
  provider.ready_to_send_input_marker = send_marker
31
32
  if expect_stderr is None:
32
33
  expect_stderr = provider.expect_stderr
33
- p = ManagedProcess(cmd_line,
34
- provider.set_provider_ready,
35
- wait_for_marker=provider.ready_to_test_marker,
36
- send_marker_list=provider.ready_to_send_input_marker,
37
- close_marker=close_marker,
38
- data_source=options.data_to_send,
39
- timeout=timeout,
40
- env_overrides=options.env_overrides,
41
- expect_stderr=expect_stderr)
34
+ if send_with_newline is None:
35
+ send_with_newline = provider.send_with_newline
36
+ p = ManagedProcess(
37
+ cmd_line,
38
+ provider.set_provider_ready,
39
+ wait_for_marker=provider.ready_to_test_marker,
40
+ send_marker_list=provider.ready_to_send_input_marker,
41
+ close_marker=close_marker,
42
+ data_source=options.data_to_send,
43
+ timeout=timeout,
44
+ env_overrides=options.env_overrides,
45
+ expect_stderr=expect_stderr,
46
+ kill_marker=kill_marker,
47
+ send_with_newline=send_with_newline
48
+ )
42
49
 
43
50
  processes.append(p)
44
51
  with p.ready_condition:
45
52
  p.start()
46
53
  with provider._provider_ready_condition:
47
54
  # Don't continue processing until the provider has indicated it is ready.
48
- provider._provider_ready_condition.wait_for(provider.is_provider_ready, timeout)
55
+ provider._provider_ready_condition.wait_for(
56
+ provider.is_provider_ready, timeout)
49
57
  return p
50
58
 
51
59
  try:
@@ -66,7 +74,8 @@ def _swap_mtu(device, new_mtu):
66
74
  Return the original MTU so it can be reset later.
67
75
  """
68
76
  cmd = ["ip", "link", "show", device]
69
- p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
77
+ p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
78
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
70
79
  mtu = 65536
71
80
  for line in p.stdout.readlines():
72
81
  s = line.decode("utf-8")
@@ -14,6 +14,7 @@ S2N_PROVIDER_VERSION = 's2n_provider_version'
14
14
 
15
15
  _flags = {}
16
16
 
17
+
17
18
  def get_flag(name, default=None):
18
19
  """Return the value of a flag"""
19
20
  return _flags.get(name, default)