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
@@ -18,15 +18,15 @@ known_psk_identity = '2c035d829359ee5ff7af4ec900000000262a6494dc486d2c8a34cb33fa
18
18
  known_psk_secret = '4ecd0eb6ec3b4d87f5d6028f922ca4c5851a277fd41311c9e62d2c9492e1c4f3'
19
19
 
20
20
  # Arbitrary test vectors
21
- PSK_IDENTITY_LIST = [ known_psk_identity, 'psk_identity', 'test_psk_identity' ]
22
- PSK_SECRET_LIST = [ known_psk_secret, 'a6dadae4567876', 'a64dafcd0fc67d2a' ]
21
+ PSK_IDENTITY_LIST = [known_psk_identity, 'psk_identity', 'test_psk_identity']
22
+ PSK_SECRET_LIST = [known_psk_secret, 'a6dadae4567876', 'a64dafcd0fc67d2a']
23
23
  PSK_IDENTITY_NO_MATCH = "PSK_IDENTITY_NO_MATCH"
24
24
  PSK_SECRET_NO_MATCH = "e9492e1c"
25
25
  PSK_IDENTITY_NO_MATCH_2 = "PSK_IDENTITY_NO_MATCH_2"
26
26
  PSK_SECRET_NO_MATCH_2 = "c1e29493fd"
27
27
 
28
- ALL_TEST_CERTS_WITH_EMPTY_CERT = ALL_TEST_CERTS + [ None ]
29
- PSK_PROVIDERS = [ OpenSSL, S2N ]
28
+ ALL_TEST_CERTS_WITH_EMPTY_CERT = ALL_TEST_CERTS + [None]
29
+ PSK_PROVIDERS = [OpenSSL, S2N]
30
30
 
31
31
 
32
32
  class Outcome(Enum):
@@ -36,11 +36,11 @@ class Outcome(Enum):
36
36
 
37
37
 
38
38
  def setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg):
39
- return [ '--psk', psk_identity + ',' + psk_secret + ',' + psk_hash_alg ]
39
+ return ['--psk', psk_identity + ',' + psk_secret + ',' + psk_hash_alg]
40
40
 
41
41
 
42
42
  def setup_openssl_psk_params(psk_identity, psk_secret):
43
- return [ '-psk_identity', psk_identity, '--psk', psk_secret ]
43
+ return ['-psk_identity', psk_identity, '--psk', psk_secret]
44
44
 
45
45
 
46
46
  def setup_provider_options(mode, port, cipher, curve, certificate, data_to_send, client_psk_params):
@@ -65,18 +65,18 @@ def get_psk_hash_alg_from_cipher(cipher):
65
65
  # S2N supports only SHA256 and SHA384 PSK Hash Algorithms
66
66
  if 'SHA256' in cipher.name:
67
67
  return 'SHA256'
68
- elif 'SHA384' in cipher.name:
68
+ elif 'SHA384' in cipher.name:
69
69
  return 'SHA384'
70
70
  else:
71
71
  return None
72
72
 
73
-
73
+
74
74
  def skip_invalid_psk_tests(provider, psk_hash_alg):
75
- # If the PSK hash algorithm is None, it is not supported and we can safely skip the test case.
75
+ # If the PSK hash algorithm is None, it is not supported and we can safely skip the test case.
76
76
  if psk_hash_alg is None:
77
77
  pytest.skip()
78
78
 
79
- # In OpenSSL, PSK works only with TLS1.3 ciphersuites based on SHA256 hash algorithm which includes
79
+ # In OpenSSL, PSK works only with TLS1.3 ciphersuites based on SHA256 hash algorithm which includes
80
80
  # all TLS1.3 ciphersuites supported by S2N except TLS_AES_256_GCM_SHA384.
81
81
  if provider == OpenSSL and psk_hash_alg == 'SHA384':
82
82
  pytest.skip()
@@ -84,63 +84,87 @@ def skip_invalid_psk_tests(provider, psk_hash_alg):
84
84
 
85
85
  def validate_negotiated_psk_s2n(outcome, psk_identity, results):
86
86
  if outcome == Outcome.psk_connection:
87
- assert to_bytes("Negotiated PSK identity: {}".format(psk_identity)) in results.stdout
87
+ assert to_bytes("Negotiated PSK identity: {}".format(
88
+ psk_identity)) in results.stdout
88
89
  elif outcome == Outcome.full_handshake:
89
- assert to_bytes("Negotiated PSK identity: {}".format(psk_identity)) not in results.stdout
90
+ assert to_bytes("Negotiated PSK identity: {}".format(
91
+ psk_identity)) not in results.stdout
90
92
  else:
91
93
  assert results.exit_code != 0
92
- assert to_bytes("Failed to negotiate: 'TLS alert received'") in results.stderr
94
+ assert to_bytes(
95
+ "Failed to negotiate: 'TLS alert received'") in results.stderr
93
96
 
94
97
 
95
98
  def validate_negotiated_psk_openssl(outcome, results):
96
99
  if outcome == Outcome.psk_connection:
97
100
  assert to_bytes("extension \"psk\"") in results.stdout
98
101
  elif outcome == Outcome.full_handshake:
99
- assert to_bytes("SSL_connect:SSLv3/TLS read server certificate") in results.stderr
102
+ assert to_bytes(
103
+ "SSL_connect:SSLv3/TLS read server certificate") in results.stderr
100
104
  else:
101
105
  assert to_bytes("SSL_accept:error in error") in results.stderr
102
106
 
103
107
 
108
+ def test_nothing():
109
+ """
110
+ Sometimes the external psk test parameters in combination with the s2n libcrypto
111
+ results in no test cases existing. In this case, pass a nothing test to avoid
112
+ marking the entire codebuild run as failed.
113
+ """
114
+ assert True
115
+
116
+
104
117
  """
105
118
  Basic S2N server happy case.
106
119
 
107
120
  Tests a single psk connection with no fallback option.
108
121
  """
122
+
123
+
109
124
  @pytest.mark.uncollect_if(func=invalid_test_parameters)
110
125
  @pytest.mark.parametrize("cipher", TLS13_CIPHERS, ids=get_parameter_name)
111
126
  @pytest.mark.parametrize("curve", ALL_TEST_CURVES, ids=get_parameter_name)
112
127
  @pytest.mark.parametrize("protocol", [Protocols.TLS13], ids=get_parameter_name)
113
128
  @pytest.mark.parametrize("provider", PSK_PROVIDERS, ids=get_parameter_name)
129
+ @pytest.mark.parametrize("other_provider", [S2N], ids=get_parameter_name)
114
130
  @pytest.mark.parametrize("psk_identity", PSK_IDENTITY_LIST, ids=get_parameter_name)
115
131
  @pytest.mark.parametrize("psk_secret", PSK_SECRET_LIST, ids=get_parameter_name)
116
- def test_s2n_server_psk_connection(managed_process, cipher, curve, protocol, provider, psk_identity, psk_secret):
132
+ def test_s2n_server_psk_connection(managed_process, cipher, curve, protocol, provider, other_provider, psk_identity,
133
+ psk_secret):
117
134
  port = next(available_ports)
118
135
  random_bytes = data_bytes(10)
119
136
  psk_hash_alg = get_psk_hash_alg_from_cipher(cipher)
120
137
  skip_invalid_psk_tests(provider, psk_hash_alg)
121
138
 
122
139
  if provider == S2N:
123
- client_psk_params = setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg)
140
+ client_psk_params = setup_s2n_psk_params(
141
+ psk_identity, psk_secret, psk_hash_alg)
124
142
  else:
125
143
  client_psk_params = setup_openssl_psk_params(psk_identity, psk_secret)
126
- client_options = setup_provider_options(provider.ClientMode, port, cipher, curve, None, random_bytes, client_psk_params)
144
+ client_options = setup_provider_options(
145
+ provider.ClientMode, port, cipher, curve, None, random_bytes, client_psk_params)
127
146
 
128
- server_psk_params = setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg)
129
- server_options = setup_provider_options(S2N.ServerMode, port, cipher, curve, None, None, server_psk_params)
147
+ server_psk_params = setup_s2n_psk_params(
148
+ psk_identity, psk_secret, psk_hash_alg)
149
+ server_options = setup_provider_options(
150
+ S2N.ServerMode, port, cipher, curve, None, None, server_psk_params)
130
151
 
131
- server = managed_process(S2N, server_options, timeout=5, close_marker=str(random_bytes))
152
+ server = managed_process(
153
+ S2N, server_options, timeout=5, close_marker=str(random_bytes))
132
154
  client = managed_process(provider, client_options, timeout=5)
133
155
 
134
156
  for results in client.get_results():
135
157
  results.assert_success()
136
158
  if provider == S2N:
137
- validate_negotiated_psk_s2n(Outcome.psk_connection, psk_identity, results)
159
+ validate_negotiated_psk_s2n(
160
+ Outcome.psk_connection, psk_identity, results)
138
161
  else:
139
162
  validate_negotiated_psk_openssl(Outcome.psk_connection, results)
140
163
 
141
164
  for results in server.get_results():
142
165
  results.assert_success()
143
- validate_negotiated_psk_s2n(Outcome.psk_connection, psk_identity, results)
166
+ validate_negotiated_psk_s2n(
167
+ Outcome.psk_connection, psk_identity, results)
144
168
  assert random_bytes in results.stdout
145
169
 
146
170
 
@@ -149,14 +173,18 @@ Tests S2N server's behavior with multiple PSKs and no fallback options.
149
173
 
150
174
  Note that OpenSSL does not support multiple PSKs.
151
175
  """
176
+
177
+
152
178
  @pytest.mark.uncollect_if(func=invalid_test_parameters)
153
179
  @pytest.mark.parametrize("cipher", TLS13_CIPHERS, ids=get_parameter_name)
154
180
  @pytest.mark.parametrize("curve", ALL_TEST_CURVES, ids=get_parameter_name)
155
181
  @pytest.mark.parametrize("protocol", [Protocols.TLS13], ids=get_parameter_name)
156
182
  @pytest.mark.parametrize("provider", PSK_PROVIDERS, ids=get_parameter_name)
183
+ @pytest.mark.parametrize("other_provider", [S2N], ids=get_parameter_name)
157
184
  @pytest.mark.parametrize("psk_identity", PSK_IDENTITY_LIST, ids=get_parameter_name)
158
185
  @pytest.mark.parametrize("psk_secret", PSK_SECRET_LIST, ids=get_parameter_name)
159
- def test_s2n_server_multiple_psks(managed_process, cipher, curve, protocol, provider, psk_identity, psk_secret):
186
+ def test_s2n_server_multiple_psks(managed_process, cipher, curve, protocol, provider, other_provider, psk_identity,
187
+ psk_secret):
160
188
  port = next(available_ports)
161
189
  random_bytes = data_bytes(10)
162
190
  psk_hash_alg = get_psk_hash_alg_from_cipher(cipher)
@@ -168,30 +196,41 @@ def test_s2n_server_multiple_psks(managed_process, cipher, curve, protocol, prov
168
196
  OpenSSL Provider does not support multiple PSKs in the same connection,
169
197
  the last psk parameter is the psk parameter used in the connection.
170
198
  """
171
- client_psk_params.extend(setup_openssl_psk_params(PSK_IDENTITY_NO_MATCH, PSK_SECRET_NO_MATCH))
172
- client_psk_params.extend(setup_openssl_psk_params(psk_identity, psk_secret))
199
+ client_psk_params.extend(setup_openssl_psk_params(
200
+ PSK_IDENTITY_NO_MATCH, PSK_SECRET_NO_MATCH))
201
+ client_psk_params.extend(
202
+ setup_openssl_psk_params(psk_identity, psk_secret))
173
203
  else:
174
- client_psk_params.extend(setup_s2n_psk_params(PSK_IDENTITY_NO_MATCH, PSK_SECRET_NO_MATCH, psk_hash_alg))
175
- client_psk_params.extend(setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg))
176
- client_options = setup_provider_options(provider.ClientMode, port, cipher, curve, None, random_bytes, client_psk_params)
177
-
178
- server_psk_params = setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg)
179
- server_psk_params.extend(setup_s2n_psk_params(PSK_IDENTITY_NO_MATCH_2, PSK_SECRET_NO_MATCH_2, psk_hash_alg))
180
- server_options = setup_provider_options(S2N.ServerMode, port, cipher, curve, None, None, server_psk_params)
181
-
182
- server = managed_process(S2N, server_options, timeout=5, close_marker=str(random_bytes))
204
+ client_psk_params.extend(setup_s2n_psk_params(
205
+ PSK_IDENTITY_NO_MATCH, PSK_SECRET_NO_MATCH, psk_hash_alg))
206
+ client_psk_params.extend(setup_s2n_psk_params(
207
+ psk_identity, psk_secret, psk_hash_alg))
208
+ client_options = setup_provider_options(
209
+ provider.ClientMode, port, cipher, curve, None, random_bytes, client_psk_params)
210
+
211
+ server_psk_params = setup_s2n_psk_params(
212
+ psk_identity, psk_secret, psk_hash_alg)
213
+ server_psk_params.extend(setup_s2n_psk_params(
214
+ PSK_IDENTITY_NO_MATCH_2, PSK_SECRET_NO_MATCH_2, psk_hash_alg))
215
+ server_options = setup_provider_options(
216
+ S2N.ServerMode, port, cipher, curve, None, None, server_psk_params)
217
+
218
+ server = managed_process(
219
+ S2N, server_options, timeout=5, close_marker=str(random_bytes))
183
220
  client = managed_process(provider, client_options, timeout=5)
184
221
 
185
222
  for results in client.get_results():
186
223
  results.assert_success()
187
224
  if provider == S2N:
188
- validate_negotiated_psk_s2n(Outcome.psk_connection, psk_identity, results)
225
+ validate_negotiated_psk_s2n(
226
+ Outcome.psk_connection, psk_identity, results)
189
227
  else:
190
228
  validate_negotiated_psk_openssl(Outcome.psk_connection, results)
191
229
 
192
230
  for results in server.get_results():
193
231
  results.assert_success()
194
- validate_negotiated_psk_s2n(Outcome.psk_connection, psk_identity, results)
232
+ validate_negotiated_psk_s2n(
233
+ Outcome.psk_connection, psk_identity, results)
195
234
  assert random_bytes in results.stdout
196
235
 
197
236
 
@@ -204,42 +243,53 @@ Note that S2N Server succeeds with a full handshake when an invalid PSK paramete
204
243
  certificate is provided as the input, as S2N Server uses a default certificate if a certificate is not provided
205
244
  as the input.
206
245
  """
246
+
247
+
207
248
  @pytest.mark.uncollect_if(func=invalid_test_parameters)
208
249
  @pytest.mark.parametrize("cipher", TLS13_CIPHERS, ids=get_parameter_name)
209
250
  @pytest.mark.parametrize("curve", ALL_TEST_CURVES, ids=get_parameter_name)
210
251
  @pytest.mark.parametrize("protocol", [Protocols.TLS13], ids=get_parameter_name)
211
252
  @pytest.mark.parametrize("provider", PSK_PROVIDERS, ids=get_parameter_name)
253
+ @pytest.mark.parametrize("other_provider", [S2N], ids=get_parameter_name)
212
254
  @pytest.mark.parametrize("psk_identity", PSK_IDENTITY_LIST, ids=get_parameter_name)
213
255
  @pytest.mark.parametrize("psk_secret", PSK_SECRET_LIST, ids=get_parameter_name)
214
256
  @pytest.mark.parametrize("certificate", ALL_TEST_CERTS_WITH_EMPTY_CERT, ids=get_parameter_name)
215
- def test_s2n_server_full_handshake(managed_process, cipher, curve, protocol, provider, psk_identity, psk_secret, certificate):
257
+ def test_s2n_server_full_handshake(managed_process, cipher, curve, protocol, provider, other_provider, psk_identity,
258
+ psk_secret, certificate):
216
259
  port = next(available_ports)
217
260
  random_bytes = data_bytes(10)
218
261
  psk_hash_alg = get_psk_hash_alg_from_cipher(cipher)
219
262
  skip_invalid_psk_tests(provider, psk_hash_alg)
220
263
 
221
264
  if provider == S2N:
222
- client_psk_params = setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg)
265
+ client_psk_params = setup_s2n_psk_params(
266
+ psk_identity, psk_secret, psk_hash_alg)
223
267
  else:
224
268
  client_psk_params = setup_openssl_psk_params(psk_identity, psk_secret)
225
- client_options = setup_provider_options(provider.ClientMode, port, cipher, curve, certificate, random_bytes, client_psk_params)
269
+ client_options = setup_provider_options(
270
+ provider.ClientMode, port, cipher, curve, certificate, random_bytes, client_psk_params)
226
271
 
227
- server_psk_params = setup_s2n_psk_params(PSK_IDENTITY_NO_MATCH, PSK_SECRET_NO_MATCH, psk_hash_alg)
228
- server_options = setup_provider_options(S2N.ServerMode, port, cipher, curve, certificate, None, server_psk_params)
272
+ server_psk_params = setup_s2n_psk_params(
273
+ PSK_IDENTITY_NO_MATCH, PSK_SECRET_NO_MATCH, psk_hash_alg)
274
+ server_options = setup_provider_options(
275
+ S2N.ServerMode, port, cipher, curve, certificate, None, server_psk_params)
229
276
 
230
- server = managed_process(S2N, server_options, timeout=5, close_marker=str(random_bytes))
277
+ server = managed_process(
278
+ S2N, server_options, timeout=5, close_marker=str(random_bytes))
231
279
  client = managed_process(provider, client_options, timeout=5)
232
280
 
233
281
  for results in client.get_results():
234
282
  results.assert_success()
235
283
  if provider == S2N:
236
- validate_negotiated_psk_s2n(Outcome.full_handshake, psk_identity, results)
284
+ validate_negotiated_psk_s2n(
285
+ Outcome.full_handshake, psk_identity, results)
237
286
  else:
238
287
  validate_negotiated_psk_openssl(Outcome.full_handshake, results)
239
288
 
240
289
  for results in server.get_results():
241
290
  results.assert_success()
242
- validate_negotiated_psk_s2n(Outcome.full_handshake, PSK_IDENTITY_NO_MATCH, results)
291
+ validate_negotiated_psk_s2n(
292
+ Outcome.full_handshake, PSK_IDENTITY_NO_MATCH, results)
243
293
  assert random_bytes in results.stdout
244
294
 
245
295
 
@@ -248,40 +298,51 @@ Basic S2N client happy case.
248
298
 
249
299
  Tests a single psk connection with no fallback option.
250
300
  """
301
+
302
+
251
303
  @pytest.mark.uncollect_if(func=invalid_test_parameters)
252
304
  @pytest.mark.parametrize("cipher", TLS13_CIPHERS, ids=get_parameter_name)
253
305
  @pytest.mark.parametrize("curve", ALL_TEST_CURVES, ids=get_parameter_name)
254
306
  @pytest.mark.parametrize("protocol", [Protocols.TLS13], ids=get_parameter_name)
255
307
  @pytest.mark.parametrize("provider", PSK_PROVIDERS, ids=get_parameter_name)
308
+ @pytest.mark.parametrize("other_provider", [S2N], ids=get_parameter_name)
256
309
  @pytest.mark.parametrize("psk_identity", PSK_IDENTITY_LIST, ids=get_parameter_name)
257
310
  @pytest.mark.parametrize("psk_secret", PSK_SECRET_LIST, ids=get_parameter_name)
258
- def test_s2n_client_psk_connection(managed_process, cipher, curve, protocol, provider, psk_identity, psk_secret):
311
+ def test_s2n_client_psk_connection(managed_process, cipher, curve, protocol, provider, other_provider, psk_identity,
312
+ psk_secret):
259
313
  port = next(available_ports)
260
314
  random_bytes = data_bytes(10)
261
315
  psk_hash_alg = get_psk_hash_alg_from_cipher(cipher)
262
316
  skip_invalid_psk_tests(provider, psk_hash_alg)
263
317
 
264
- client_psk_params = setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg)
265
- client_options = setup_provider_options(S2N.ClientMode, port, cipher, curve, None, random_bytes, client_psk_params)
318
+ client_psk_params = setup_s2n_psk_params(
319
+ psk_identity, psk_secret, psk_hash_alg)
320
+ client_options = setup_provider_options(
321
+ S2N.ClientMode, port, cipher, curve, None, random_bytes, client_psk_params)
266
322
 
267
323
  if provider == S2N:
268
- server_psk_params = setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg)
324
+ server_psk_params = setup_s2n_psk_params(
325
+ psk_identity, psk_secret, psk_hash_alg)
269
326
  else:
270
327
  server_psk_params = setup_openssl_psk_params(psk_identity, psk_secret)
271
- server_psk_params += [ '-nocert' ]
272
- server_options = setup_provider_options(provider.ServerMode, port, cipher, curve, None, None, server_psk_params)
328
+ server_psk_params += ['-nocert']
329
+ server_options = setup_provider_options(
330
+ provider.ServerMode, port, cipher, curve, None, None, server_psk_params)
273
331
 
274
- server = managed_process(provider, server_options, timeout=5, close_marker=str(random_bytes))
332
+ server = managed_process(provider, server_options,
333
+ timeout=5, close_marker=str(random_bytes))
275
334
  client = managed_process(S2N, client_options, timeout=5)
276
335
 
277
336
  for results in client.get_results():
278
337
  results.assert_success()
279
- validate_negotiated_psk_s2n(Outcome.psk_connection, psk_identity, results)
338
+ validate_negotiated_psk_s2n(
339
+ Outcome.psk_connection, psk_identity, results)
280
340
 
281
341
  for results in server.get_results():
282
342
  results.assert_success()
283
343
  if provider == S2N:
284
- validate_negotiated_psk_s2n(Outcome.psk_connection, psk_identity, results)
344
+ validate_negotiated_psk_s2n(
345
+ Outcome.psk_connection, psk_identity, results)
285
346
  else:
286
347
  validate_negotiated_psk_openssl(Outcome.psk_connection, results)
287
348
  assert random_bytes in results.stdout
@@ -292,22 +353,29 @@ Tests S2N client's behavior with multiple PSKs and no fallback option.
292
353
 
293
354
  Note that OpenSSL does not support multiple PSKs.
294
355
  """
356
+
357
+
295
358
  @pytest.mark.uncollect_if(func=invalid_test_parameters)
296
359
  @pytest.mark.parametrize("cipher", TLS13_CIPHERS, ids=get_parameter_name)
297
360
  @pytest.mark.parametrize("curve", ALL_TEST_CURVES, ids=get_parameter_name)
298
361
  @pytest.mark.parametrize("protocol", [Protocols.TLS13], ids=get_parameter_name)
299
362
  @pytest.mark.parametrize("provider", PSK_PROVIDERS, ids=get_parameter_name)
363
+ @pytest.mark.parametrize("other_provider", [S2N], ids=get_parameter_name)
300
364
  @pytest.mark.parametrize("psk_identity", PSK_IDENTITY_LIST, ids=get_parameter_name)
301
365
  @pytest.mark.parametrize("psk_secret", PSK_SECRET_LIST, ids=get_parameter_name)
302
- def test_s2n_client_multiple_psks(managed_process, cipher, curve, protocol, provider, psk_identity, psk_secret):
366
+ def test_s2n_client_multiple_psks(managed_process, cipher, curve, protocol, provider, other_provider, psk_identity,
367
+ psk_secret):
303
368
  port = next(available_ports)
304
369
  random_bytes = data_bytes(10)
305
370
  psk_hash_alg = get_psk_hash_alg_from_cipher(cipher)
306
371
  skip_invalid_psk_tests(provider, psk_hash_alg)
307
372
 
308
- client_psk_params = setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg)
309
- client_psk_params.extend(setup_s2n_psk_params(PSK_IDENTITY_NO_MATCH, PSK_SECRET_NO_MATCH, psk_hash_alg))
310
- client_options = setup_provider_options(S2N.ClientMode, port, cipher, curve, None, random_bytes, client_psk_params)
373
+ client_psk_params = setup_s2n_psk_params(
374
+ psk_identity, psk_secret, psk_hash_alg)
375
+ client_psk_params.extend(setup_s2n_psk_params(
376
+ PSK_IDENTITY_NO_MATCH, PSK_SECRET_NO_MATCH, psk_hash_alg))
377
+ client_options = setup_provider_options(
378
+ S2N.ClientMode, port, cipher, curve, None, random_bytes, client_psk_params)
311
379
 
312
380
  server_psk_params = []
313
381
  if provider == OpenSSL:
@@ -315,25 +383,33 @@ def test_s2n_client_multiple_psks(managed_process, cipher, curve, protocol, prov
315
383
  OpenSSL Provider does not support multiple PSKs in the same connection,
316
384
  the last psk params is the final psk used in the connection.
317
385
  """
318
- server_psk_params.extend(setup_openssl_psk_params(PSK_IDENTITY_NO_MATCH_2, PSK_SECRET_NO_MATCH_2))
319
- server_psk_params.extend(setup_openssl_psk_params(psk_identity, psk_secret))
320
- server_psk_params += [ '-nocert' ]
386
+ server_psk_params.extend(setup_openssl_psk_params(
387
+ PSK_IDENTITY_NO_MATCH_2, PSK_SECRET_NO_MATCH_2))
388
+ server_psk_params.extend(
389
+ setup_openssl_psk_params(psk_identity, psk_secret))
390
+ server_psk_params += ['-nocert']
321
391
  else:
322
- server_psk_params.extend(setup_s2n_psk_params(PSK_IDENTITY_NO_MATCH_2, PSK_SECRET_NO_MATCH_2, psk_hash_alg))
323
- server_psk_params.extend(setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg))
324
- server_options = setup_provider_options(provider.ServerMode, port, cipher, curve, None, None, server_psk_params)
325
-
326
- server = managed_process(provider, server_options, timeout=5, close_marker=str(random_bytes))
392
+ server_psk_params.extend(setup_s2n_psk_params(
393
+ PSK_IDENTITY_NO_MATCH_2, PSK_SECRET_NO_MATCH_2, psk_hash_alg))
394
+ server_psk_params.extend(setup_s2n_psk_params(
395
+ psk_identity, psk_secret, psk_hash_alg))
396
+ server_options = setup_provider_options(
397
+ provider.ServerMode, port, cipher, curve, None, None, server_psk_params)
398
+
399
+ server = managed_process(provider, server_options,
400
+ timeout=5, close_marker=str(random_bytes))
327
401
  client = managed_process(S2N, client_options, timeout=5)
328
402
 
329
403
  for results in client.get_results():
330
404
  results.assert_success()
331
- validate_negotiated_psk_s2n(Outcome.psk_connection, psk_identity, results)
405
+ validate_negotiated_psk_s2n(
406
+ Outcome.psk_connection, psk_identity, results)
332
407
 
333
408
  for results in server.get_results():
334
409
  results.assert_success()
335
410
  if provider == S2N:
336
- validate_negotiated_psk_s2n(Outcome.psk_connection, psk_identity, results)
411
+ validate_negotiated_psk_s2n(
412
+ Outcome.psk_connection, psk_identity, results)
337
413
  else:
338
414
  validate_negotiated_psk_openssl(Outcome.psk_connection, results)
339
415
  assert random_bytes in results.stdout
@@ -346,6 +422,8 @@ and an invalid certificate is provided as the input.
346
422
  Note that we cannot use S2N Server as a provider input for this test as S2N Server
347
423
  uses a default certificate if a certificate is not provided as the input.
348
424
  """
425
+
426
+
349
427
  @pytest.mark.uncollect_if(func=invalid_test_parameters)
350
428
  @pytest.mark.parametrize("cipher", TLS13_CIPHERS, ids=get_parameter_name)
351
429
  @pytest.mark.parametrize("curve", ALL_TEST_CURVES, ids=get_parameter_name)
@@ -359,22 +437,28 @@ def test_s2n_client_psk_handshake_failure(managed_process, cipher, curve, protoc
359
437
  psk_hash_alg = get_psk_hash_alg_from_cipher(cipher)
360
438
  skip_invalid_psk_tests(provider, psk_hash_alg)
361
439
 
362
- client_psk_params = setup_s2n_psk_params(psk_identity, psk_secret, psk_hash_alg)
363
- client_options = setup_provider_options(S2N.ClientMode, port, cipher, curve, None, random_bytes, client_psk_params)
440
+ client_psk_params = setup_s2n_psk_params(
441
+ psk_identity, psk_secret, psk_hash_alg)
442
+ client_options = setup_provider_options(
443
+ S2N.ClientMode, port, cipher, curve, None, random_bytes, client_psk_params)
364
444
 
365
- server_psk_params = setup_openssl_psk_params(PSK_IDENTITY_NO_MATCH, PSK_SECRET_NO_MATCH)
366
- server_psk_params += [ '-nocert' ]
367
- server_options = setup_provider_options(provider.ServerMode, port, cipher, curve, None, None, server_psk_params)
445
+ server_psk_params = setup_openssl_psk_params(
446
+ PSK_IDENTITY_NO_MATCH, PSK_SECRET_NO_MATCH)
447
+ server_psk_params += ['-nocert']
448
+ server_options = setup_provider_options(
449
+ provider.ServerMode, port, cipher, curve, None, None, server_psk_params)
368
450
 
369
- server = managed_process(provider, server_options, timeout=5, close_marker=str(random_bytes))
451
+ server = managed_process(provider, server_options,
452
+ timeout=5, close_marker=str(random_bytes))
370
453
  client = managed_process(S2N, client_options, timeout=5)
371
454
 
372
455
  for results in client.get_results():
373
- assert to_bytes("Failed to negotiate: 'TLS alert received'") in results.stderr
374
- validate_negotiated_psk_s2n(Outcome.handshake_failed, psk_identity, results)
456
+ assert to_bytes(
457
+ "Failed to negotiate: 'TLS alert received'") in results.stderr
458
+ validate_negotiated_psk_s2n(
459
+ Outcome.handshake_failed, psk_identity, results)
375
460
 
376
461
  for results in server.get_results():
377
462
  assert to_bytes("SSL_accept:error in error") in results.stderr
378
463
  validate_negotiated_psk_openssl(Outcome.handshake_failed, results)
379
464
  assert random_bytes not in results.stdout
380
-
@@ -4,23 +4,32 @@ import pytest
4
4
  from configuration import available_ports, PROTOCOLS
5
5
  from common import ProviderOptions, Ciphers, Certificates, data_bytes
6
6
  from fixtures import managed_process
7
- from providers import Provider, S2N, OpenSSL
7
+ from providers import Provider, S2N, OpenSSL, GnuTLS
8
8
  from utils import invalid_test_parameters, get_parameter_name, get_expected_s2n_version, to_bytes
9
9
 
10
10
 
11
- def multi_cipher_name(c):
12
- return ':'.join([x.name for x in c])
11
+ CIPHERS_TO_TEST = [
12
+ Ciphers.AES256_SHA,
13
+ Ciphers.ECDHE_ECDSA_AES256_SHA,
14
+ Ciphers.AES256_GCM_SHA384
15
+ ]
16
+
17
+ CERTIFICATES_TO_TEST = [
18
+ Certificates.RSA_4096_SHA384,
19
+ Certificates.ECDSA_384
20
+ ]
13
21
 
14
22
 
15
- multi_cipher = [Ciphers.AES256_SHA, Ciphers.ECDHE_ECDSA_AES256_SHA]
16
23
  @pytest.mark.uncollect_if(func=invalid_test_parameters)
17
- @pytest.mark.parametrize("multi_cipher", [multi_cipher], ids=multi_cipher_name)
18
- @pytest.mark.parametrize("provider", [OpenSSL])
24
+ @pytest.mark.parametrize("cipher", CIPHERS_TO_TEST, ids=get_parameter_name)
25
+ @pytest.mark.parametrize("provider", [OpenSSL, GnuTLS], ids=get_parameter_name)
26
+ @pytest.mark.parametrize("other_provider", [S2N], ids=get_parameter_name)
19
27
  @pytest.mark.parametrize("protocol", PROTOCOLS, ids=get_parameter_name)
20
- @pytest.mark.parametrize("certificate", [Certificates.RSA_4096_SHA384, Certificates.ECDSA_384], ids=get_parameter_name)
21
- def test_s2n_server_low_latency(managed_process, multi_cipher, provider, protocol, certificate):
28
+ @pytest.mark.parametrize("certificate", CERTIFICATES_TO_TEST, ids=get_parameter_name)
29
+ def test_s2n_server_low_latency(managed_process, cipher, provider, other_provider, protocol, certificate):
22
30
  if provider is OpenSSL and 'openssl-1.0.2' in provider.get_version():
23
- pytest.skip('{} does not allow setting max fragmentation for packets'.format(provider))
31
+ pytest.skip(
32
+ '{} does not allow setting max fragmentation for packets'.format(provider))
24
33
 
25
34
  port = next(available_ports)
26
35
 
@@ -28,7 +37,7 @@ def test_s2n_server_low_latency(managed_process, multi_cipher, provider, protoco
28
37
  client_options = ProviderOptions(
29
38
  mode=Provider.ClientMode,
30
39
  port=port,
31
- cipher=multi_cipher,
40
+ cipher=cipher,
32
41
  data_to_send=random_bytes,
33
42
  insecure=True,
34
43
  protocol=protocol)
@@ -51,19 +60,35 @@ def test_s2n_server_low_latency(managed_process, multi_cipher, provider, protoco
51
60
 
52
61
  for results in server.get_results():
53
62
  results.assert_success()
54
- assert to_bytes("Actual protocol version: {}".format(expected_version)) in results.stdout
63
+ assert to_bytes("Actual protocol version: {}".format(
64
+ expected_version)) in results.stdout
55
65
  assert random_bytes in results.stdout
56
66
 
57
67
 
58
- @pytest.mark.uncollect_if(func=invalid_test_parameters)
59
- @pytest.mark.parametrize("multi_cipher", [multi_cipher], ids=multi_cipher_name)
60
- @pytest.mark.parametrize("provider", [OpenSSL])
68
+ def invalid_test_parameters_frag_len(*args, **kwargs):
69
+ provider = kwargs.get("provider")
70
+ frag_len = kwargs.get("frag_len")
71
+
72
+ # Check to make sure frag_len is compatible with gnutls.
73
+ if provider == GnuTLS:
74
+ if frag_len > 4096:
75
+ return True
76
+
77
+ return invalid_test_parameters(*args, **kwargs)
78
+
79
+
80
+ @pytest.mark.uncollect_if(func=invalid_test_parameters_frag_len)
81
+ @pytest.mark.parametrize("cipher", CIPHERS_TO_TEST, ids=get_parameter_name)
82
+ @pytest.mark.parametrize("provider", [OpenSSL, GnuTLS], ids=get_parameter_name)
83
+ @pytest.mark.parametrize("other_provider", [S2N], ids=get_parameter_name)
61
84
  @pytest.mark.parametrize("protocol", PROTOCOLS, ids=get_parameter_name)
62
- @pytest.mark.parametrize("certificate", [Certificates.RSA_4096_SHA384, Certificates.ECDSA_384], ids=get_parameter_name)
85
+ @pytest.mark.parametrize("certificate", CERTIFICATES_TO_TEST, ids=get_parameter_name)
63
86
  @pytest.mark.parametrize("frag_len", [512, 2048, 8192, 12345, 16384], ids=get_parameter_name)
64
- def test_s2n_server_framented_data(managed_process, multi_cipher, provider, protocol, frag_len, certificate):
87
+ def test_s2n_server_framented_data(managed_process, cipher, provider, other_provider, protocol, certificate,
88
+ frag_len):
65
89
  if provider is OpenSSL and 'openssl-1.0.2' in provider.get_version():
66
- pytest.skip('{} does not allow setting max fragmentation for packets'.format(provider))
90
+ pytest.skip(
91
+ '{} does not allow setting max fragmentation for packets'.format(provider))
67
92
 
68
93
  port = next(available_ports)
69
94
 
@@ -71,11 +96,12 @@ def test_s2n_server_framented_data(managed_process, multi_cipher, provider, prot
71
96
  client_options = ProviderOptions(
72
97
  mode=Provider.ClientMode,
73
98
  port=port,
74
- cipher=multi_cipher,
99
+ cipher=cipher,
75
100
  data_to_send=random_bytes,
76
101
  insecure=True,
77
- extra_flags=['-max_send_frag', str(frag_len)],
78
- protocol=protocol)
102
+ record_size=frag_len,
103
+ protocol=protocol
104
+ )
79
105
 
80
106
  server_options = copy.copy(client_options)
81
107
  server_options.extra_flags = None
@@ -88,12 +114,19 @@ def test_s2n_server_framented_data(managed_process, multi_cipher, provider, prot
88
114
  server = managed_process(S2N, server_options, timeout=5)
89
115
  client = managed_process(provider, client_options, timeout=5)
90
116
 
91
- for results in client.get_results():
92
- results.assert_success()
117
+ for client_results in client.get_results():
118
+ client_results.assert_success()
93
119
 
94
120
  expected_version = get_expected_s2n_version(protocol, provider)
95
121
 
96
- for results in server.get_results():
97
- results.assert_success()
98
- assert to_bytes("Actual protocol version: {}".format(expected_version)) in results.stdout
99
- assert random_bytes in results.stdout
122
+ for server_results in server.get_results():
123
+ server_results.assert_success()
124
+ assert to_bytes("Actual protocol version: {}".format(
125
+ expected_version)) in server_results.stdout
126
+
127
+ if provider == GnuTLS:
128
+ # GnuTLS ignores data sent through stdin past frag_len up to the application data
129
+ # packet length of 4096. so, just check to make sure data up to frag_len was received.
130
+ assert random_bytes[:frag_len] in server_results.stdout
131
+ else:
132
+ assert random_bytes in server_results.stdout