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
@@ -1,12 +1,14 @@
1
1
  import pytest
2
2
  import sslyze
3
3
  import abc
4
+ from enum import Enum, auto
4
5
 
5
6
  from configuration import available_ports, ALL_TEST_CIPHERS, ALL_TEST_CERTS
6
7
  from common import ProviderOptions, Protocols, Cipher, Ciphers, Certificates, Curves
7
8
  from fixtures import managed_process
8
9
  from providers import S2N
9
10
  from utils import get_parameter_name, invalid_test_parameters
11
+ from global_flags import get_flag, S2N_PROVIDER_VERSION, S2N_FIPS_MODE
10
12
 
11
13
  HOST = "127.0.0.1"
12
14
 
@@ -31,7 +33,7 @@ SSLYZE_SCANS_TO_TEST = {
31
33
 
32
34
  CERTS_TO_TEST = [
33
35
  cert for cert in ALL_TEST_CERTS if cert.name not in {
34
- "RSA_PSS_2048_SHA256" # sslyze errors when given an RSA PSS cert
36
+ "RSA_PSS_2048_SHA256" # SSLyze errors when given an RSA PSS cert
35
37
  }
36
38
  ]
37
39
 
@@ -67,7 +69,7 @@ class CipherSuitesVerifier(ScanVerifier):
67
69
  ]
68
70
 
69
71
  for cipher in rejected_ciphers:
70
- # if a cipher is rejected, it should be an invalid test parameter in combination with the
72
+ # If a cipher is rejected, it should be an invalid test parameter in combination with the
71
73
  # protocol/provider/cert, otherwise it should have been accepted
72
74
  assert invalid_test_parameters(
73
75
  protocol=self.protocol,
@@ -92,7 +94,7 @@ class EllipticCurveVerifier(ScanVerifier):
92
94
  ]
93
95
 
94
96
  for curve in rejected_curves:
95
- # if a curve is rejected, it should be an invalid test parameter in combination with the
97
+ # If a curve is rejected, it should be an invalid test parameter in combination with the
96
98
  # protocol/provider/cert, otherwise it should have been accepted
97
99
  assert invalid_test_parameters(
98
100
  protocol=self.protocol,
@@ -113,7 +115,7 @@ class RobotVerifier(ScanVerifier):
113
115
  class SessionResumptionVerifier(ScanVerifier):
114
116
  def assert_scan_success(self):
115
117
  if self.protocol == Protocols.TLS13:
116
- pass # sslyze does not support session resumption scans for tls 1.3
118
+ pass # SSLyze does not support session resumption scans for tls 1.3
117
119
  else:
118
120
  assert self.scan_result.tls_ticket_resumption_result == sslyze.TlsResumptionSupportEnum.FULLY_SUPPORTED
119
121
 
@@ -177,8 +179,10 @@ def validate_scan_result(scan_attempt, protocol, certificate=None):
177
179
  def get_scan_attempts(scan_results):
178
180
  # scan_results (sslyze.AllScanCommandsAttempts) is an object containing parameters mapped to scan attempts. convert
179
181
  # this to a list containing just scan attempts, and then filter out tests that were not scheduled.
180
- scan_attribute_names = [attr_name for attr_name in dir(scan_results) if not attr_name.startswith("__")]
181
- scan_attempts = [getattr(scan_results, attr_name) for attr_name in scan_attribute_names]
182
+ scan_attribute_names = [attr_name for attr_name in dir(
183
+ scan_results) if not attr_name.startswith("__")]
184
+ scan_attempts = [getattr(scan_results, attr_name)
185
+ for attr_name in scan_attribute_names]
182
186
  scan_attempts = [
183
187
  scan_attempt for scan_attempt in scan_attempts
184
188
  if scan_attempt.status != sslyze.ScanCommandAttemptStatusEnum.NOT_SCHEDULED
@@ -209,9 +213,31 @@ def run_sslyze_scan(host, port, scans):
209
213
  return scanner.get_results()
210
214
 
211
215
 
216
+ def invalid_sslyze_scan_parameters(*args, **kwargs):
217
+ scan_command = kwargs["scan_command"]
218
+ protocol = kwargs["protocol"]
219
+
220
+ # BUG_IN_SSLYZE error in TLS compression and session renegotiation scans
221
+ # in fips libcryptos when TLS version < 1.3
222
+ if "fips" in get_flag(S2N_PROVIDER_VERSION) and protocol != Protocols.TLS13:
223
+ if scan_command in [
224
+ sslyze.ScanCommand.TLS_COMPRESSION,
225
+ sslyze.ScanCommand.SESSION_RENEGOTIATION
226
+ ]:
227
+ return True
228
+ # BUG_IN_SSLYZE error for session resumption scan with openssl 1.0.2 fips
229
+ if "openssl-1.0.2-fips" in get_flag(S2N_PROVIDER_VERSION):
230
+ if scan_command == sslyze.ScanCommand.SESSION_RESUMPTION:
231
+ return True
232
+
233
+ return invalid_test_parameters(*args, **kwargs)
234
+
235
+
236
+ @pytest.mark.uncollect_if(func=invalid_sslyze_scan_parameters)
212
237
  @pytest.mark.parametrize("protocol", PROTOCOLS_TO_TEST, ids=get_parameter_name)
213
238
  @pytest.mark.parametrize("scan_command", SSLYZE_SCANS_TO_TEST, ids=get_parameter_name)
214
- def test_sslyze_scans(managed_process, protocol, scan_command):
239
+ @pytest.mark.parametrize("provider", [S2N], ids=get_parameter_name)
240
+ def test_sslyze_scans(managed_process, protocol, scan_command, provider):
215
241
  port = next(available_ports)
216
242
 
217
243
  server_options = ProviderOptions(
@@ -222,9 +248,10 @@ def test_sslyze_scans(managed_process, protocol, scan_command):
222
248
  extra_flags=["--parallelize"]
223
249
  )
224
250
 
225
- # test 1.3 exclusively
251
+ # Test 1.3 exclusively
226
252
  if protocol == Protocols.TLS13:
227
- server_options.cipher = Cipher("test_all_tls13", Protocols.TLS13, False, False, s2n=True)
253
+ server_options.cipher = Cipher(
254
+ "test_all_tls13", Protocols.TLS13, False, False, s2n=True)
228
255
 
229
256
  if scan_command == sslyze.ScanCommand.SESSION_RESUMPTION:
230
257
  server_options.reconnect = True,
@@ -235,7 +262,7 @@ def test_sslyze_scans(managed_process, protocol, scan_command):
235
262
  server_options.use_session_ticket = True
236
263
  server_options.extra_flags.extend([
237
264
  "--max-early-data", "65535",
238
- "--https-server" # early data scan sends http requests
265
+ "--https-server" # Early data scan sends http requests
239
266
  ])
240
267
 
241
268
  server = managed_process(S2N, server_options, timeout=30)
@@ -253,9 +280,54 @@ def test_sslyze_scans(managed_process, protocol, scan_command):
253
280
  server.kill()
254
281
 
255
282
 
283
+ class CertificateScan(Enum):
284
+ CIPHER_SUITE_SCAN = auto()
285
+ ELLIPTIC_CURVE_SCAN = auto()
286
+
287
+
288
+ def invalid_certificate_scans_parameters(*args, **kwargs):
289
+ certificate = kwargs["certificate"]
290
+ certificate_scan = kwargs["certificate_scan"]
291
+ protocol = kwargs["protocol"]
292
+
293
+ if certificate_scan == CertificateScan.CIPHER_SUITE_SCAN:
294
+ if "openssl-1.0.2" in get_flag(S2N_PROVIDER_VERSION):
295
+ # SSLyze scan results in rejected ciphers that should have been accepted
296
+ # for TLS 1.2
297
+ if protocol == Protocols.TLS12:
298
+ return True
299
+ if "fips" in get_flag(S2N_PROVIDER_VERSION):
300
+ # BUG_IN_SSLYZE / TLS version supported assertion failures for ECDSA scans
301
+ # in SSLv3 and RSA with TLS version < 1.2 with fips libcryptos
302
+ if "ECDSA" in certificate.name and protocol == Protocols.SSLv3:
303
+ return True
304
+ if "RSA" in certificate.name and protocol in [
305
+ Protocols.SSLv3,
306
+ Protocols.TLS10,
307
+ Protocols.TLS11
308
+ ]:
309
+ return True
310
+ elif certificate_scan == CertificateScan.ELLIPTIC_CURVE_SCAN:
311
+ # SSLyze curves scan errors when given ECDSA certs
312
+ if "ECDSA" in certificate.name:
313
+ return True
314
+
315
+ # SSLyze curves scan fails to validate with openssl 1.0.2 fips
316
+ if "openssl-1.0.2-fips" in get_flag(S2N_PROVIDER_VERSION):
317
+ return True
318
+
319
+ return invalid_test_parameters(*args, **kwargs)
320
+
321
+
322
+ @pytest.mark.uncollect_if(func=invalid_certificate_scans_parameters)
256
323
  @pytest.mark.parametrize("protocol", PROTOCOLS_TO_TEST, ids=get_parameter_name)
257
324
  @pytest.mark.parametrize("certificate", CERTS_TO_TEST, ids=get_parameter_name)
258
- def test_sslyze_certificate_scans(managed_process, protocol, certificate):
325
+ @pytest.mark.parametrize("provider", [S2N], ids=get_parameter_name)
326
+ @pytest.mark.parametrize("certificate_scan", [
327
+ CertificateScan.CIPHER_SUITE_SCAN,
328
+ CertificateScan.ELLIPTIC_CURVE_SCAN
329
+ ], ids=lambda certificate_scan: certificate_scan.name)
330
+ def test_sslyze_certificate_scans(managed_process, protocol, certificate, provider, certificate_scan):
259
331
  port = next(available_ports)
260
332
 
261
333
  server_options = ProviderOptions(
@@ -270,13 +342,12 @@ def test_sslyze_certificate_scans(managed_process, protocol, certificate):
270
342
  )
271
343
  server = managed_process(S2N, server_options, timeout=30)
272
344
 
273
- scans = [CIPHER_SUITE_SCANS.get(protocol.value)]
274
-
275
- # sslyze curves scan errors when given ECDSA certs
276
- if "ECDSA" not in certificate.name:
277
- scans.append(sslyze.ScanCommand.ELLIPTIC_CURVES)
345
+ scan = {
346
+ CertificateScan.CIPHER_SUITE_SCAN: CIPHER_SUITE_SCANS.get(protocol.value),
347
+ CertificateScan.ELLIPTIC_CURVE_SCAN: sslyze.ScanCommand.ELLIPTIC_CURVES
348
+ }.get(certificate_scan)
278
349
 
279
- scan_attempt_results = run_sslyze_scan(HOST, port, scans)
350
+ scan_attempt_results = run_sslyze_scan(HOST, port, [scan])
280
351
 
281
352
  for scan_attempt_result in scan_attempt_results:
282
353
  assert_scan_result_completed(scan_attempt_result)
@@ -4,17 +4,39 @@ import pytest
4
4
  from configuration import available_ports, ALL_TEST_CIPHERS, ALL_TEST_CURVES, ALL_TEST_CERTS
5
5
  from common import ProviderOptions, Protocols, data_bytes
6
6
  from fixtures import managed_process
7
- from providers import Provider, S2N, OpenSSL
8
- from utils import invalid_test_parameters, get_parameter_name, get_expected_s2n_version, get_expected_openssl_version, to_bytes
7
+ from providers import Provider, S2N, OpenSSL, GnuTLS
8
+ from utils import invalid_test_parameters, get_parameter_name, get_expected_s2n_version, get_expected_openssl_version, \
9
+ to_bytes, get_expected_gnutls_version
9
10
 
10
11
 
11
- @pytest.mark.uncollect_if(func=invalid_test_parameters)
12
+ def test_nothing():
13
+ """
14
+ Sometimes the version negotiation test parameters in combination with the s2n
15
+ libcrypto results in no test cases existing. In this case, pass a nothing test to
16
+ avoid marking the entire codebuild run as failed.
17
+ """
18
+ assert True
19
+
20
+
21
+ def invalid_version_negotiation_test_parameters(*args, **kwargs):
22
+ # Since s2nd/s2nc will always be using TLS 1.3, make sure the libcrypto is compatible
23
+ if invalid_test_parameters(**{
24
+ "provider": S2N,
25
+ "protocol": Protocols.TLS13
26
+ }):
27
+ return True
28
+
29
+ return invalid_test_parameters(*args, **kwargs)
30
+
31
+
32
+ @pytest.mark.uncollect_if(func=invalid_version_negotiation_test_parameters)
12
33
  @pytest.mark.parametrize("cipher", ALL_TEST_CIPHERS, ids=get_parameter_name)
13
34
  @pytest.mark.parametrize("curve", ALL_TEST_CURVES, ids=get_parameter_name)
14
35
  @pytest.mark.parametrize("certificate", ALL_TEST_CERTS, ids=get_parameter_name)
15
36
  @pytest.mark.parametrize("protocol", [Protocols.TLS12, Protocols.TLS11, Protocols.TLS10], ids=get_parameter_name)
16
- @pytest.mark.parametrize("provider", [S2N, OpenSSL], ids=get_parameter_name)
17
- def test_s2nc_tls13_negotiates_tls12(managed_process, cipher, curve, protocol, provider, certificate):
37
+ @pytest.mark.parametrize("provider", [S2N, OpenSSL, GnuTLS], ids=get_parameter_name)
38
+ @pytest.mark.parametrize("other_provider", [S2N], ids=get_parameter_name)
39
+ def test_s2nc_tls13_negotiates_tls12(managed_process, cipher, curve, certificate, protocol, provider, other_provider):
18
40
  port = next(available_ports)
19
41
 
20
42
  random_bytes = data_bytes(24)
@@ -25,7 +47,8 @@ def test_s2nc_tls13_negotiates_tls12(managed_process, cipher, curve, protocol, p
25
47
  curve=curve,
26
48
  data_to_send=random_bytes,
27
49
  insecure=True,
28
- protocol=Protocols.TLS13)
50
+ protocol=Protocols.TLS13
51
+ )
29
52
 
30
53
  server_options = copy.copy(client_options)
31
54
  server_options.data_to_send = None
@@ -34,7 +57,12 @@ def test_s2nc_tls13_negotiates_tls12(managed_process, cipher, curve, protocol, p
34
57
  server_options.cert = certificate.cert
35
58
  server_options.protocol = protocol
36
59
 
37
- server = managed_process(provider, server_options, timeout=5)
60
+ kill_marker = None
61
+ if provider == GnuTLS:
62
+ kill_marker = random_bytes
63
+
64
+ server = managed_process(provider, server_options,
65
+ timeout=5, kill_marker=kill_marker)
38
66
  client = managed_process(S2N, client_options, timeout=5)
39
67
 
40
68
  client_version = get_expected_s2n_version(Protocols.TLS13, provider)
@@ -42,8 +70,10 @@ def test_s2nc_tls13_negotiates_tls12(managed_process, cipher, curve, protocol, p
42
70
 
43
71
  for results in client.get_results():
44
72
  results.assert_success()
45
- assert to_bytes("Client protocol version: {}".format(client_version)) in results.stdout
46
- assert to_bytes("Actual protocol version: {}".format(actual_version)) in results.stdout
73
+ assert to_bytes("Client protocol version: {}".format(
74
+ client_version)) in results.stdout
75
+ assert to_bytes("Actual protocol version: {}".format(
76
+ actual_version)) in results.stdout
47
77
 
48
78
  for results in server.get_results():
49
79
  results.assert_success()
@@ -51,19 +81,25 @@ def test_s2nc_tls13_negotiates_tls12(managed_process, cipher, curve, protocol, p
51
81
  # The server is only TLS12, so it reads the version from the CLIENT_HELLO, which is never above TLS12
52
82
  # This check only cares about S2N. Trying to maintain expected output of other providers doesn't
53
83
  # add benefit to whether the S2N client was able to negotiate a lower TLS version.
54
- assert to_bytes("Client protocol version: {}".format(actual_version)) in results.stdout
55
- assert to_bytes("Actual protocol version: {}".format(actual_version)) in results.stdout
84
+ assert to_bytes("Client protocol version: {}".format(
85
+ actual_version)) in results.stdout
86
+ assert to_bytes("Actual protocol version: {}".format(
87
+ actual_version)) in results.stdout
56
88
 
57
- assert random_bytes in results.stdout
89
+ assert any([
90
+ random_bytes[1:] in stream
91
+ for stream in results.output_streams()
92
+ ])
58
93
 
59
94
 
60
- @pytest.mark.uncollect_if(func=invalid_test_parameters)
95
+ @pytest.mark.uncollect_if(func=invalid_version_negotiation_test_parameters)
61
96
  @pytest.mark.parametrize("cipher", ALL_TEST_CIPHERS, ids=get_parameter_name)
62
97
  @pytest.mark.parametrize("curve", ALL_TEST_CURVES, ids=get_parameter_name)
63
98
  @pytest.mark.parametrize("certificate", ALL_TEST_CERTS, ids=get_parameter_name)
64
99
  @pytest.mark.parametrize("protocol", [Protocols.TLS12, Protocols.TLS11, Protocols.TLS10], ids=get_parameter_name)
65
- @pytest.mark.parametrize("provider", [S2N, OpenSSL], ids=get_parameter_name)
66
- def test_s2nd_tls13_negotiates_tls12(managed_process, cipher, curve, protocol, provider, certificate):
100
+ @pytest.mark.parametrize("provider", [S2N, OpenSSL, GnuTLS], ids=get_parameter_name)
101
+ @pytest.mark.parametrize("other_provider", [S2N], ids=get_parameter_name)
102
+ def test_s2nd_tls13_negotiates_tls12(managed_process, cipher, curve, certificate, protocol, provider, other_provider):
67
103
  port = next(available_ports)
68
104
 
69
105
  random_bytes = data_bytes(24)
@@ -74,7 +110,8 @@ def test_s2nd_tls13_negotiates_tls12(managed_process, cipher, curve, protocol, p
74
110
  curve=curve,
75
111
  data_to_send=random_bytes,
76
112
  insecure=True,
77
- protocol=protocol)
113
+ protocol=protocol
114
+ )
78
115
 
79
116
  server_options = copy.copy(client_options)
80
117
  server_options.data_to_send = None
@@ -95,16 +132,28 @@ def test_s2nd_tls13_negotiates_tls12(managed_process, cipher, curve, protocol, p
95
132
  results.assert_success()
96
133
  if provider is S2N:
97
134
  # The client will get the server version from the SERVER HELLO, which will be the negotiated version
98
- assert to_bytes("Server protocol version: {}".format(actual_version)) in results.stdout
99
- assert to_bytes("Actual protocol version: {}".format(actual_version)) in results.stdout
135
+ assert to_bytes("Server protocol version: {}".format(
136
+ actual_version)) in results.stdout
137
+ assert to_bytes("Actual protocol version: {}".format(
138
+ actual_version)) in results.stdout
100
139
  elif provider is OpenSSL:
101
140
  # This check cares about other providers because we want to know that they did negotiate the version
102
141
  # that our S2N server intended to negotiate.
103
142
  openssl_version = get_expected_openssl_version(protocol)
104
- assert to_bytes("Protocol : {}".format(openssl_version)) in results.stdout
143
+ assert to_bytes("Protocol : {}".format(
144
+ openssl_version)) in results.stdout
145
+ elif provider is GnuTLS:
146
+ gnutls_version = get_expected_gnutls_version(protocol)
147
+ assert to_bytes(f"Version: {gnutls_version}") in results.stdout
105
148
 
106
149
  for results in server.get_results():
107
150
  results.assert_success()
108
- assert to_bytes("Server protocol version: {}".format(server_version)) in results.stdout
109
- assert to_bytes("Actual protocol version: {}".format(actual_version)) in results.stdout
110
- assert random_bytes in results.stdout
151
+ assert (
152
+ to_bytes("Server protocol version: {}".format(server_version))
153
+ in results.stdout
154
+ )
155
+ assert (
156
+ to_bytes("Actual protocol version: {}".format(actual_version))
157
+ in results.stdout
158
+ )
159
+ assert random_bytes[1:] in results.stdout
@@ -22,8 +22,8 @@ ENDPOINTS = [
22
22
  "rsa2048.badssl.com",
23
23
  "rsa4096.badssl.com",
24
24
  "sha256.badssl.com",
25
- "sha384.badssl.com",
26
- "sha512.badssl.com",
25
+ # "sha384.badssl.com",
26
+ # "sha512.badssl.com",
27
27
  "tls-v1-0.badssl.com",
28
28
  "tls-v1-1.badssl.com",
29
29
  "tls-v1-2.badssl.com",
@@ -109,7 +109,8 @@ def test_well_known_endpoints(managed_process, protocol, endpoint, provider, cip
109
109
 
110
110
  # expect_stderr=True because S2N sometimes receives OCSP responses:
111
111
  # https://github.com/aws/s2n-tls/blob/14ed186a13c1ffae7fbb036ed5d2849ce7c17403/bin/echo.c#L180-L184
112
- client = managed_process(provider, client_options, timeout=5, expect_stderr=True)
112
+ client = managed_process(provider, client_options,
113
+ timeout=5, expect_stderr=True)
113
114
 
114
115
  expected_result = EXPECTED_RESULTS.get((endpoint, cipher), None)
115
116
 
@@ -11,6 +11,7 @@ deps =
11
11
  pytest==5.3.5
12
12
  pytest-xdist==1.34.0
13
13
  sslyze==5.0.2
14
+ pytest-rerunfailures
14
15
  commands =
15
16
  pytest -n 2 --cache-clear -rpfsq \
16
17
  --provider-version={env:S2N_LIBCRYPTO} \
@@ -1,5 +1,6 @@
1
1
  from common import Protocols, Curves, Ciphers
2
2
  from providers import S2N, OpenSSL
3
+ from global_flags import get_flag, S2N_FIPS_MODE, S2N_PROVIDER_VERSION
3
4
 
4
5
 
5
6
  def to_bytes(val):
@@ -23,16 +24,21 @@ def get_expected_s2n_version(protocol, provider):
23
24
 
24
25
 
25
26
  def get_expected_openssl_version(protocol):
26
- if protocol == Protocols.TLS13:
27
- version = 'TLSv1.3'
28
- elif protocol == Protocols.TLS12:
29
- version = 'TLSv1.2'
30
- elif protocol == Protocols.TLS11:
31
- version = 'TLSv1.1'
32
- elif protocol == Protocols.TLS10:
33
- version = 'TLSv1'
27
+ return {
28
+ Protocols.TLS10.value: "TLSv1",
29
+ Protocols.TLS11.value: "TLSv1.1",
30
+ Protocols.TLS12.value: "TLSv1.2",
31
+ Protocols.TLS13.value: "TLSv1.3"
32
+ }.get(protocol.value)
34
33
 
35
- return version
34
+
35
+ def get_expected_gnutls_version(protocol):
36
+ return {
37
+ Protocols.TLS10.value: "TLS1.0",
38
+ Protocols.TLS11.value: "TLS1.1",
39
+ Protocols.TLS12.value: "TLS1.2",
40
+ Protocols.TLS13.value: "TLS1.3"
41
+ }.get(protocol.value)
36
42
 
37
43
 
38
44
  def get_parameter_name(item):
@@ -49,10 +55,14 @@ def invalid_test_parameters(*args, **kwargs):
49
55
  """
50
56
  protocol = kwargs.get('protocol')
51
57
  provider = kwargs.get('provider')
58
+ other_provider = kwargs.get('other_provider')
52
59
  certificate = kwargs.get('certificate')
53
60
  client_certificate = kwargs.get('client_certificate')
54
61
  cipher = kwargs.get('cipher')
55
62
  curve = kwargs.get('curve')
63
+ signature = kwargs.get('signature')
64
+
65
+ providers = [provider_ for provider_ in [provider, other_provider] if provider_]
56
66
 
57
67
  # Only TLS1.3 supports RSA-PSS-PSS certificates
58
68
  # (Earlier versions support RSA-PSS signatures, just via RSA-PSS-RSAE)
@@ -62,8 +72,21 @@ def invalid_test_parameters(*args, **kwargs):
62
72
  if certificate and certificate.algorithm == 'RSAPSS':
63
73
  return True
64
74
 
65
- if provider is not None and not provider.supports_protocol(protocol):
66
- return True
75
+ for provider_ in providers:
76
+ if not provider_.supports_protocol(protocol):
77
+ return True
78
+
79
+ if provider is not None and other_provider is not None:
80
+ if issubclass(provider, S2N) and issubclass(other_provider, S2N):
81
+ # If s2n is built with openssl-1.0.2-fips, and the cert is not ECDSA, it can't connect to itself
82
+ if certificate is not None:
83
+ if "openssl-1.0.2-fips" in get_flag(S2N_PROVIDER_VERSION) and "ECDSA" not in certificate.name:
84
+ return True
85
+
86
+ # If s2n is built with awslc and TLS version is < 1.3, it can't connect to itself
87
+ if protocol is not None:
88
+ if "awslc-fips" in get_flag(S2N_PROVIDER_VERSION) and protocol != Protocols.TLS13:
89
+ return True
67
90
 
68
91
  if cipher is not None:
69
92
  # If the selected protocol doesn't allow the cipher, don't test
@@ -76,14 +99,21 @@ def invalid_test_parameters(*args, **kwargs):
76
99
  if protocol is Protocols.TLS13 and cipher.min_version < protocol:
77
100
  return True
78
101
 
79
- if provider is not None and not provider.supports_cipher(cipher, with_curve=curve):
80
- return True
102
+ for provider_ in providers:
103
+ if not provider_.supports_cipher(cipher, with_curve=curve):
104
+ return True
105
+
106
+ if get_flag(S2N_FIPS_MODE):
107
+ if not cipher.fips:
108
+ return True
81
109
 
82
110
  # If we are using a cipher that depends on a specific certificate algorithm
83
111
  # deselect the test if the wrong certificate is used.
84
112
  if certificate is not None:
85
- if protocol is not None and provider.supports_protocol(protocol, with_cert=certificate) is False:
86
- return True
113
+ if protocol is not None:
114
+ for provider_ in providers:
115
+ if provider_.supports_protocol(protocol, with_cert=certificate) is False:
116
+ return True
87
117
  if cipher is not None and certificate.compatible_with_cipher(cipher) is False:
88
118
  return True
89
119
 
@@ -99,4 +129,9 @@ def invalid_test_parameters(*args, **kwargs):
99
129
  if protocol is not None and curve.min_protocol > protocol:
100
130
  return True
101
131
 
132
+ if signature is not None:
133
+ for provider_ in providers:
134
+ if provider_.supports_signature(signature) is False:
135
+ return True
136
+
102
137
  return False
@@ -1,6 +1,137 @@
1
1
  CHANGELOG
2
2
  `````````
3
3
 
4
+ Version 1.22.0 -- 2022-03-15
5
+ ----------------------------
6
+ - Print out stderr when a job fails
7
+ The entire buffered stderr of a job that fails will now be printed to
8
+ the terminal after the failing command line. This is to help users
9
+ quickly debug these jobs without viewing the HTML report.
10
+
11
+ This commit fixes #131.
12
+
13
+ - Fix content colour in dark mode
14
+
15
+ Previously, some content would appear in a dark colour in dark mode
16
+ because the "color" property was set in the .content class for light
17
+ mode but the <body> element for dark mode.
18
+
19
+ - Rebuild run graph in transform jobs
20
+
21
+ After receiving user input in transform jobs, discard old jobs and make
22
+ a new run graph using the jobs received on stdin. This makes it so that
23
+ running add-job in parallel with transform-jobs will fail.
24
+
25
+ - Add ids to sections on HTML dashboard
26
+
27
+ Every major section on the HTML dashboard now has an "id" attribute,
28
+ making it possible to link to those sections. Prior to this commit, it
29
+ was not possible to link to specific graphs on the front page, for
30
+ example. This PR also introduces a CONTRIBUTING.md file that contains
31
+ guidance to continue this pattern.
32
+
33
+ - Do not run litani tests if 'no-test' label is set
34
+
35
+ - Fix space in release script
36
+
37
+ - Tell release engineer to push develop and release
38
+
39
+ Previously, following the instructions would only push the release
40
+ branch to origin, not the develop branch.
41
+
42
+ - Fix run-tests workflow file name
43
+
44
+
45
+ Version 1.21.0 -- 2022-03-04
46
+ ----------------------------
47
+ - Add release script
48
+ This commit adds a script that creates a new release when run. It takes
49
+ the following actions:
50
+
51
+ - Update the version number in lib/litani.py;
52
+ - Generate a changelog and prompt the user to edit it;
53
+ - Merge the release branch into develop, using the changelog for the
54
+ merge commit;
55
+ - Tag the release;
56
+ - Create a new release candidate on the develop branch.
57
+
58
+ - Litani's homebrew formula is now released on homebrew-core
59
+
60
+ - Add --out-file flag to litani-dump-run
61
+
62
+ With this commit, users can now dump run files to a file instead
63
+ by passing --out-file flag with the file path to litani dump-run.
64
+
65
+ - Add run-tests workflow
66
+ This commit runs Litani's test suite on PRs with label 'test'.
67
+
68
+ - Render rich output in dashboard, pipeline pages
69
+
70
+ This feature allows users to render custom HTML data onto the HTML
71
+ dashboard, allowing Litani jobs to display their results through tables,
72
+ graphs, and other HTML format. This can be done both for the front page
73
+ or on the pipeline page.
74
+
75
+ The intention is that individual litani jobs can be used to measure
76
+ metrics, and then print those metrics out in an easily-viewable format.
77
+ Jobs that calculate metrics for the entire run can present those metrics
78
+ as a graph on the front page. Jobs that calculate metrics for a single
79
+ pipeline (or proof) can display the result on the pipeline page.
80
+
81
+ Users use this feature by adding a tag to a litani job, using the --tags
82
+ flag. If a job is tagged with front-page-text, Litani will render the
83
+ job's output onto the front page, in its own section. A tag of
84
+ literal-stdout will make Litani render the job's output onto the
85
+ pipeline page, but without any HTML escaping.
86
+
87
+ - Add workflow to update gh-pages on release
88
+
89
+ - Sort pipelines by status and then name.
90
+
91
+ The order with which pipelines appear in both the HTML dashboard is
92
+ the same as the order with which they appear in the run.json. An e2e
93
+ test was added to ensure that the order is indeed the intended one.
94
+
95
+
96
+ Version 1.20.0 -- 2022-02-11
97
+ ----------------------------
98
+
99
+ This release introduces workflows for Litani that use GitHub Actions. It
100
+ additionally contains bug fixes.
101
+
102
+ - Workflow were added, which will create a Debian package as well as a PR
103
+ against the aws/homebrew-tap repository in order to update the brew formula.
104
+
105
+ Bug fixes:
106
+
107
+ - Prevent file extension from appearing twice in dot dependency diagram.
108
+ - Litani dump-run will dump the latest run, if no build is concurrently running.
109
+ - Update doc, examples for transform-jobs command.
110
+
111
+
112
+ Version 1.19.0 -- 2022-02--01
113
+ ----------------------------
114
+
115
+ - Change man page extension from .roff to its chapter.
116
+
117
+ This commit is in preparation for Litani to be installed on users'
118
+ systems, where the man pages need to be installed in the correct
119
+ location and have the correct prefix in order for the man program to
120
+ find them.
121
+
122
+ - Inform user that jobs must be added in order for Litani to run a build
123
+
124
+
125
+ Version 1.18.0 -- 2022-01-24
126
+ ----------------------------
127
+
128
+ - Add new transform-jobs command
129
+ - Add --fast option to Litani test suite
130
+ - Add --output-dir flag to Litani test suite
131
+ - Litani will no longer print errors when not connected to a tty device
132
+ - Add documentation for new flags
133
+
134
+
4
135
  Version 1.17.0 -- 2022-01-10
5
136
  ----------------------------
6
137
 
@@ -0,0 +1,16 @@
1
+ Contributing
2
+ ============
3
+
4
+ Thank you for contributing to Litani! This document collects some coding and
5
+ process guidelines.
6
+
7
+
8
+ ### HTML Dashboard
9
+
10
+ - Please test your changes with both light and dark mode, and with a range of
11
+ browser widths.
12
+ - Almost all top-level divs should have an id attribute; this makes it easy to
13
+ link to specific information.
14
+ - We prefer to inline all assets (CSS, images) onto the page so that it's easy
15
+ to send single, self-contained pages around. For this reason, please try to
16
+ keep SVGs small.