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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/aws-crt-ffi/CMakeLists.txt +49 -41
- data/aws-crt-ffi/crt/aws-c-auth/CMakeLists.txt +0 -10
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/credentials.h +3 -2
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/private/credentials_utils.h +4 -4
- data/aws-crt-ffi/crt/aws-c-auth/source/auth.c +1 -14
- data/aws-crt-ffi/crt/aws-c-auth/source/aws_imds_client.c +206 -68
- data/aws-crt-ffi/crt/aws-c-auth/source/aws_signing.c +5 -0
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_cached.c +6 -6
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_default_chain.c +16 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_ecs.c +0 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_process.c +0 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_sts_web_identity.c +0 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_x509.c +10 -7
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_utils.c +35 -26
- data/aws-crt-ffi/crt/aws-c-auth/source/signable_chunk.c +3 -2
- data/aws-crt-ffi/crt/aws-c-auth/tests/CMakeLists.txt +3 -2
- data/aws-crt-ffi/crt/aws-c-auth/tests/aws_imds_client_test.c +1 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_ecs_tests.c +3 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_process_tests.c +65 -16
- data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_tests.c +125 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/sigv4_signing_tests.c +68 -46
- data/aws-crt-ffi/crt/aws-c-cal/CMakeLists.txt +8 -3
- data/aws-crt-ffi/crt/aws-c-cal/bin/run_x_platform_fuzz_corpus/main.c +9 -0
- data/aws-crt-ffi/crt/aws-c-cal/builder.json +11 -3
- data/aws-crt-ffi/crt/aws-c-cal/cmake/aws-c-cal-config.cmake +14 -5
- data/aws-crt-ffi/crt/aws-c-cal/source/darwin/securityframework_ecc.c +6 -6
- data/aws-crt-ffi/crt/aws-c-cal/source/windows/bcrypt_ecc.c +12 -12
- data/aws-crt-ffi/crt/aws-c-cal/tests/test_case_helper.h +14 -14
- data/aws-crt-ffi/crt/aws-c-common/CMakeLists.txt +21 -1
- data/aws-crt-ffi/crt/aws-c-common/README.md +8 -0
- data/aws-crt-ffi/crt/aws-c-common/cmake/AwsCFlags.cmake +20 -5
- data/aws-crt-ffi/crt/aws-c-common/cmake/AwsFeatureTests.cmake +7 -1
- data/aws-crt-ffi/crt/aws-c-common/format-check.sh +1 -1
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_buf.h +14 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/config.h.in +1 -0
- data/aws-crt-ffi/crt/{aws-c-auth/include/aws/auth → aws-c-common/include/aws/common}/external/cJSON.h +82 -74
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/json.h +335 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/logging.h +1 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/math.inl +2 -2
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/private/json_impl.h +22 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/testing/aws_test_harness.h +2 -0
- data/aws-crt-ffi/crt/aws-c-common/source/byte_buf.c +36 -0
- data/aws-crt-ffi/crt/aws-c-common/source/common.c +5 -2
- data/aws-crt-ffi/crt/aws-c-common/source/external/cJSON.c +3113 -0
- data/aws-crt-ffi/crt/aws-c-common/source/file.c +9 -0
- data/aws-crt-ffi/crt/aws-c-common/source/json.c +348 -0
- data/aws-crt-ffi/crt/aws-c-common/source/logging.c +7 -2
- data/aws-crt-ffi/crt/aws-c-common/source/posix/system_info.c +8 -0
- data/aws-crt-ffi/crt/aws-c-common/source/ref_count.c +3 -1
- data/aws-crt-ffi/crt/aws-c-common/source/windows/file.c +47 -0
- data/aws-crt-ffi/crt/aws-c-common/source/windows/system_info.c +2 -1
- data/aws-crt-ffi/crt/aws-c-common/tests/CMakeLists.txt +5 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/byte_buf_test.c +69 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/json_test.c +134 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/memtrace_test.c +6 -2
- data/aws-crt-ffi/crt/aws-c-event-stream/README.md +18 -35
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream.h +21 -2
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc_client.h +14 -2
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc_server.h +13 -0
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/private/event_stream_rpc_priv.h +7 -7
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream.c +257 -141
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_channel_handler.c +1 -1
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_rpc_client.c +31 -8
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_rpc_server.c +63 -10
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/CMakeLists.txt +2 -0
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/event_stream_rpc_client_connection_test.c +157 -106
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/event_stream_rpc_server_connection_test.c +168 -1
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/message_deserializer_test.c +4 -2
- data/aws-crt-ffi/crt/aws-c-http/CMakeLists.txt +1 -0
- data/aws-crt-ffi/crt/aws-c-http/README.md +8 -0
- data/aws-crt-ffi/crt/aws-c-http/bin/elasticurl/main.c +1 -1
- data/aws-crt-ffi/crt/aws-c-http/builder.json +4 -3
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection.h +8 -1
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection_manager.h +45 -1
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/http2_stream_manager.h +63 -12
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/connection_impl.h +2 -1
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_connection.h +20 -2
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_frames.h +1 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_stream.h +42 -13
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/http2_stream_manager_impl.h +17 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/http_impl.h +3 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/random_access_set.h +10 -3
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/request_response_impl.h +3 -17
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/request_response.h +108 -4
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/statistics.h +22 -0
- data/aws-crt-ffi/crt/aws-c-http/source/connection.c +8 -3
- data/aws-crt-ffi/crt/aws-c-http/source/connection_manager.c +22 -3
- data/aws-crt-ffi/crt/aws-c-http/source/connection_monitor.c +32 -14
- data/aws-crt-ffi/crt/aws-c-http/source/h1_connection.c +14 -0
- data/aws-crt-ffi/crt/aws-c-http/source/h1_encoder.c +7 -4
- data/aws-crt-ffi/crt/aws-c-http/source/h2_connection.c +161 -45
- data/aws-crt-ffi/crt/aws-c-http/source/h2_decoder.c +37 -8
- data/aws-crt-ffi/crt/aws-c-http/source/h2_frames.c +13 -1
- data/aws-crt-ffi/crt/aws-c-http/source/h2_stream.c +345 -87
- data/aws-crt-ffi/crt/aws-c-http/source/hpack.c +3 -0
- data/aws-crt-ffi/crt/aws-c-http/source/http.c +3 -0
- data/aws-crt-ffi/crt/aws-c-http/source/http2_stream_manager.c +266 -39
- data/aws-crt-ffi/crt/aws-c-http/source/random_access_set.c +9 -3
- data/aws-crt-ffi/crt/aws-c-http/source/request_response.c +80 -20
- data/aws-crt-ffi/crt/aws-c-http/source/statistics.c +11 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/CMakeLists.txt +28 -1
- data/aws-crt-ffi/crt/aws-c-http/tests/fuzz/fuzz_h2_decoder_correct.c +5 -3
- data/aws-crt-ffi/crt/aws-c-http/tests/h2_test_helper.c +133 -29
- data/aws-crt-ffi/crt/aws-c-http/tests/h2_test_helper.h +6 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/README.md +40 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/non_tls_server.py +56 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/server.py +329 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_manager.c +1 -1
- data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_monitor.c +2 -2
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_client.c +47 -34
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_encoder.c +4 -4
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_server.c +15 -12
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h2_client.c +582 -25
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h2_encoder.c +3 -3
- data/aws-crt-ffi/crt/aws-c-http/tests/test_localhost_integ.c +530 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/test_stream_manager.c +459 -67
- data/aws-crt-ffi/crt/aws-c-io/CMakeLists.txt +4 -0
- data/aws-crt-ffi/crt/aws-c-io/builder.json +3 -2
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/channel.h +21 -0
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/io.h +3 -0
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/socket.h +6 -0
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/stream.h +35 -5
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/tls_channel_handler.h +211 -15
- data/aws-crt-ffi/crt/aws-c-io/source/channel.c +56 -30
- data/aws-crt-ffi/crt/aws-c-io/source/darwin/secure_transport_tls_channel_handler.c +0 -24
- data/aws-crt-ffi/crt/aws-c-io/source/io.c +9 -0
- data/aws-crt-ffi/crt/aws-c-io/source/{pkcs11.c → pkcs11_lib.c} +162 -22
- data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_private.h +18 -20
- data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_tls_op_handler.c +221 -0
- data/aws-crt-ffi/crt/aws-c-io/source/posix/socket.c +135 -81
- data/aws-crt-ffi/crt/aws-c-io/source/retry_strategy.c +12 -8
- data/aws-crt-ffi/crt/aws-c-io/source/s2n/s2n_tls_channel_handler.c +252 -215
- data/aws-crt-ffi/crt/aws-c-io/source/stream.c +65 -82
- data/aws-crt-ffi/crt/aws-c-io/source/tls_channel_handler.c +188 -57
- data/aws-crt-ffi/crt/aws-c-io/source/windows/iocp/socket.c +271 -256
- data/aws-crt-ffi/crt/aws-c-io/tests/CMakeLists.txt +21 -12
- data/aws-crt-ffi/crt/aws-c-io/tests/channel_test.c +32 -4
- data/aws-crt-ffi/crt/aws-c-io/tests/io_lib_test.c +37 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/pkcs11_test.c +412 -93
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.crt +15 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.key +5 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.p12 +0 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.p8 +5 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/generateCerts.sh +24 -15
- data/aws-crt-ffi/crt/aws-c-io/tests/socket_test.c +72 -1
- data/aws-crt-ffi/crt/s2n/CMakeLists.txt +6 -1
- data/aws-crt-ffi/crt/s2n/bindings/rust/Cargo.toml +1 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/generate/src/main.rs +105 -82
- data/aws-crt-ffi/crt/s2n/bindings/rust/generate.sh +1 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/Cargo.toml +2 -2
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/src/raw/config.rs +1 -1
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/Cargo.toml +1 -1
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/build.rs +84 -30
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/src/lib.rs +4 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/Cargo.toml +21 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/certs/cert.pem +14 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/certs/key.pem +8 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/client.rs +45 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/server.rs +60 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/src/lib.rs +150 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/tests/handshake.rs +51 -0
- data/aws-crt-ffi/crt/s2n/crypto/s2n_drbg.c +98 -77
- data/aws-crt-ffi/crt/s2n/crypto/s2n_drbg.h +10 -7
- data/aws-crt-ffi/crt/s2n/crypto/s2n_openssl.h +2 -0
- data/aws-crt-ffi/crt/s2n/error/s2n_errno.c +1 -1
- data/aws-crt-ffi/crt/s2n/error/s2n_errno.h +1 -0
- data/aws-crt-ffi/crt/s2n/s2n.mk +7 -0
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/repository.py +233 -0
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/setup-proof.py +8 -7
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/setup.py +17 -18
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/util.py +41 -23
- data/aws-crt-ffi/crt/s2n/tests/fuzz/LD_PRELOAD/global_overrides.c +3 -3
- data/aws-crt-ffi/crt/s2n/tests/integration/s2n_client_endpoint_handshake_test.py +2 -2
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/Makefile +13 -42
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/README.md +6 -1
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/common.py +118 -53
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/configuration.py +108 -88
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/conftest.py +6 -3
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/constants.py +6 -4
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/fixtures.py +21 -12
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/global_flags.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/processes.py +62 -19
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/providers.py +304 -48
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_client_authentication.py +20 -11
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_cross_compatibility.py +41 -17
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_dynamic_record_sizes.py +6 -3
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_early_data.py +105 -48
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_external_psk.py +160 -76
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_fragmentation.py +59 -26
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_happy_path.py +42 -28
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_hello_retry_requests.py +33 -13
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_key_update.py +29 -11
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_ocsp.py +138 -0
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_pq_handshake.py +103 -36
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_session_resumption.py +52 -25
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_signature_algorithms.py +47 -21
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_sni_match.py +13 -9
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_sslyze.py +88 -17
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_version_negotiation.py +71 -22
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_well_known_endpoints.py +4 -3
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/tox.ini +1 -0
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/utils.py +50 -15
- data/aws-crt-ffi/crt/s2n/tests/litani/CHANGELOG +131 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/CONTRIBUTING.md +16 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/README.md +36 -14
- data/aws-crt-ffi/crt/s2n/tests/litani/THIRD-PARTY +205 -41
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/bin/build-html-doc +7 -7
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/configure +27 -23
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-add-job.scdoc +7 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-dump-run.scdoc +7 -5
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-transform-jobs.scdoc +248 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani.scdoc +2 -2
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/templates/index.jinja.html +4 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/README +12 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/original-run.sh +52 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/run-all.py +71 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/README +13 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-1.sh +34 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-2.sh +35 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-3.sh +34 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-all.py +60 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/README.md +10 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/assumptions.html +42 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/file.dat +7 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/histogram.dat +7 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-1.sh +41 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-2.sh +47 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-3.sh +41 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-all.py +34 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib-table.py +40 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib.plt +5 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib.py +32 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin-output.py +40 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin.plt +5 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin.py +30 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/templates/fib-table.jinja.html +45 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/templates/sin-output.jinja.html +30 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/add_job.py +55 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/graph.py +2 -2
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/litani.py +6 -1
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/litani_report.py +18 -21
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/ninja.py +2 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/run_printer.py +26 -7
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/transform_jobs.py +84 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/litani +28 -33
- data/aws-crt-ffi/crt/s2n/tests/litani/script/release +220 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/templates/dashboard.jinja.html +78 -15
- data/aws-crt-ffi/crt/s2n/tests/litani/templates/pipeline.jinja.html +21 -5
- data/aws-crt-ffi/crt/s2n/tests/litani/test/README +15 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/run +56 -33
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/custom_stages.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/cwd.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/dump_run.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/graph_line_break.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/html_node.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/job_id_env.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/multiproc_dump_run.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_pool_serialize.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_pool_serialize_graph.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out_timeout_ignored.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out_timeout_ok.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pipeline_order.py +53 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pool_serialize.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pool_serialize_graph.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/single_pool.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess_multi_shell.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess_shell.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_timeout_ignored.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_timeout_ok.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_delete_job.py +54 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_modify_job.py +46 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_no_change_job.py +44 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/zero_pool.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/run +82 -12
- data/aws-crt-ffi/crt/s2n/tests/s2n_test.h +58 -33
- data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_key_schedule_testlib.c +18 -6
- data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_pq_kat_test_utils.c +4 -4
- data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_testlib.h +2 -0
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_hello_retry_test.c +66 -2
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_connection_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_drbg_test.c +34 -14
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_fork_generation_number_test.c +28 -5
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_mem_usage_test.c +6 -0
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_override_openssl_random_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_random_test.c +60 -41
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_self_talk_broken_pipe_test.c +2 -2
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_handshake_early_data_test.c +3 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_hybrid_shared_secret_test.c +9 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_key_schedule_rfc8448_test.c +31 -130
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_key_schedule_test.c +2 -4
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_pq_handshake_test.c +11 -6
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_secrets_rfc8448_test.c +19 -21
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_secrets_test.c +109 -60
- data/aws-crt-ffi/crt/s2n/tls/s2n_config.c +1 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_config.h +1 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_connection.c +29 -24
- data/aws-crt-ffi/crt/s2n/tls/s2n_connection.h +5 -5
- data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_hashes.h +1 -7
- data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_io.c +2 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_transcript.c +0 -44
- data/aws-crt-ffi/crt/s2n/tls/s2n_internal.h +0 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_quic_support.h +1 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_key_schedule.c +1 -2
- data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_secrets.c +84 -44
- data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_secrets.h +3 -9
- data/aws-crt-ffi/crt/s2n/utils/s2n_blob.h +15 -8
- data/aws-crt-ffi/crt/s2n/utils/s2n_fork_detection.c +2 -6
- data/aws-crt-ffi/crt/s2n/utils/s2n_random.c +9 -9
- data/aws-crt-ffi/src/input_stream.c +32 -15
- data/ext/compile.rb +13 -5
- data/lib/aws-crt/platforms.rb +14 -5
- data/lib/aws-crt/string_blob.rb +3 -3
- metadata +61 -7
- data/aws-crt-ffi/crt/aws-c-auth/source/external/cJSON.c +0 -2987
- data/aws-crt-ffi/crt/aws-c-auth/tests/external/cJSON.c +0 -2986
- data/aws-crt-ffi/crt/aws-c-io/tests/error_test.c +0 -20
@@ -0,0 +1,15 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIICYDCCAgagAwIBAgIJAMhHikin3AYVMAoGCCqGSM49BAMCMIGaMQswCQYDVQQG
|
3
|
+
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjEQMA4GA1UEBwwHU2VhdHRsZTEPMA0G
|
4
|
+
A1UECgwGQW1hem9uMQ0wCwYDVQQLDARTREtzMRIwEAYDVQQDDAlsb2NhbGhvc3Qx
|
5
|
+
MDAuBgkqhkiG9w0BCQEWIWF3cy1zZGstY29tbW9uLXJ1bnRpbWVAYW1hem9uLmNv
|
6
|
+
bTAeFw0yMjAyMDgxODA4NTJaFw0yNDA1MTIxODA4NTJaMIGaMQswCQYDVQQGEwJV
|
7
|
+
UzETMBEGA1UECAwKV2FzaGluZ3RvbjEQMA4GA1UEBwwHU2VhdHRsZTEPMA0GA1UE
|
8
|
+
CgwGQW1hem9uMQ0wCwYDVQQLDARTREtzMRIwEAYDVQQDDAlsb2NhbGhvc3QxMDAu
|
9
|
+
BgkqhkiG9w0BCQEWIWF3cy1zZGstY29tbW9uLXJ1bnRpbWVAYW1hem9uLmNvbTBZ
|
10
|
+
MBMGByqGSM49AgEGCCqGSM49AwEHA0IABCOVOKo+/0+07kUwDp6BQ+6vqYcQhkgL
|
11
|
+
Lj1hnKyRgsK9Na62vyb48RR62eGVau8x/u4hRNUzcQFQZT+k3YGQdLijMzAxMBMG
|
12
|
+
A1UdJQQMMAoGCCsGAQUFBwMBMBoGA1UdEQQTMBGCCWxvY2FsaG9zdIcEfwAAATAK
|
13
|
+
BggqhkjOPQQDAgNIADBFAiBV/D57WihCxkW6RllW8va1TAkDFoCFQZ0ZBIFuD2OA
|
14
|
+
/AIhANSK917av7vJszNr63czldt33YSNjMikb2fhiZkzqROj
|
15
|
+
-----END CERTIFICATE-----
|
Binary file
|
@@ -14,11 +14,15 @@ set -e
|
|
14
14
|
# unittests.crt: self-signed certificate
|
15
15
|
# unittests.p8: private key, pkcs#8 syntax
|
16
16
|
# unittests.p12: pkcs#12 file bundling the certificate and private key. Password is "1234"
|
17
|
+
# ec_unittests.crt: elliptic curve self-signed certificate
|
18
|
+
# ec_unittests.p8: elliptic curve private key, pkcs#8 syntax
|
19
|
+
# ec_unittests.p12: elliptic curve pkcs#12 file bundling the certificate and private key. Password is "1234"
|
17
20
|
|
18
21
|
# Create directory for use with certificate generation
|
19
|
-
mkdir certGeneration
|
22
|
+
mkdir -p certGeneration
|
20
23
|
# Copy files needed to generate new certificates
|
21
24
|
cp unittests.key certGeneration/unittests.key
|
25
|
+
cp ec_unittests.key certGeneration/ec_unittests.key
|
22
26
|
cp unittests.conf certGeneration/unittests.conf
|
23
27
|
cp ca_root.cnf certGeneration/ca_root.cnf
|
24
28
|
cd certGeneration
|
@@ -58,24 +62,27 @@ yes | openssl ca -config ca_root.cnf \
|
|
58
62
|
# Generate a certificate chain containing the ca_root and server certificates
|
59
63
|
cat server.crt ca_root.crt > server_chain.crt
|
60
64
|
|
61
|
-
|
62
|
-
|
65
|
+
# Generate other unittest certificate variations
|
66
|
+
for base in unittests ec_unittests; do
|
67
|
+
openssl req -x509 -new \
|
68
|
+
-key $base.key \
|
63
69
|
-config unittests.conf \
|
64
|
-
-out
|
70
|
+
-out $base.crt \
|
65
71
|
-days 824
|
66
72
|
|
67
|
-
openssl pkcs8 -topk8 \
|
68
|
-
-out
|
69
|
-
-in
|
73
|
+
openssl pkcs8 -topk8 \
|
74
|
+
-out $base.p8 \
|
75
|
+
-in $base.key \
|
70
76
|
-nocrypt
|
71
77
|
|
72
|
-
openssl pkcs12 -export \
|
73
|
-
-out
|
74
|
-
-inkey
|
75
|
-
-in
|
78
|
+
openssl pkcs12 -export \
|
79
|
+
-out $base.p12 \
|
80
|
+
-inkey $base.key \
|
81
|
+
-in $base.crt \
|
76
82
|
-password pass:1234
|
83
|
+
done
|
77
84
|
|
78
|
-
# Copy the generated certificates and keys to the
|
85
|
+
# Copy the generated certificates and keys to the resources folder
|
79
86
|
cd ..
|
80
87
|
cp certGeneration/ca_root.crt ./ca_root.crt
|
81
88
|
cp certGeneration/server.crt ./server.crt
|
@@ -83,9 +90,11 @@ cp certGeneration/server.key ./server.key
|
|
83
90
|
cp certGeneration/server_chain.crt ./server_chain.crt
|
84
91
|
cp certGeneration/server.crt ./server.crt
|
85
92
|
|
86
|
-
|
87
|
-
cp certGeneration
|
88
|
-
cp certGeneration
|
93
|
+
for base in unittests ec_unittests; do
|
94
|
+
cp certGeneration/$base.crt ./$base.crt
|
95
|
+
cp certGeneration/$base.p8 ./$base.p8
|
96
|
+
cp certGeneration/$base.p12 ./$base.p12
|
97
|
+
done
|
89
98
|
|
90
99
|
# Clean up the certGeneration folder
|
91
100
|
rm -r certGeneration
|
@@ -237,6 +237,11 @@ static int s_test_socket_ex(
|
|
237
237
|
|
238
238
|
ASSERT_SUCCESS(aws_socket_bind(&listener, endpoint));
|
239
239
|
|
240
|
+
struct aws_socket_endpoint bound_endpoint;
|
241
|
+
ASSERT_SUCCESS(aws_socket_get_bound_address(&listener, &bound_endpoint));
|
242
|
+
ASSERT_INT_EQUALS(endpoint->port, bound_endpoint.port);
|
243
|
+
ASSERT_STR_EQUALS(endpoint->address, bound_endpoint.address);
|
244
|
+
|
240
245
|
if (options->type == AWS_SOCKET_STREAM) {
|
241
246
|
ASSERT_SUCCESS(aws_socket_listen(&listener, 1024));
|
242
247
|
ASSERT_SUCCESS(aws_socket_start_accept(&listener, event_loop, s_local_listener_incoming, &listener_args));
|
@@ -409,6 +414,7 @@ static int s_test_local_socket_communication(struct aws_allocator *allocator, vo
|
|
409
414
|
uint64_t timestamp = 0;
|
410
415
|
ASSERT_SUCCESS(aws_sys_clock_get_ticks(×tamp));
|
411
416
|
struct aws_socket_endpoint endpoint;
|
417
|
+
AWS_ZERO_STRUCT(endpoint);
|
412
418
|
|
413
419
|
snprintf(endpoint.address, sizeof(endpoint.address), LOCAL_SOCK_TEST_PATTERN, (long long unsigned)timestamp);
|
414
420
|
|
@@ -865,6 +871,71 @@ static int s_test_incoming_duplicate_tcp_bind_errors(struct aws_allocator *alloc
|
|
865
871
|
|
866
872
|
AWS_TEST_CASE(incoming_duplicate_tcp_bind_errors, s_test_incoming_duplicate_tcp_bind_errors)
|
867
873
|
|
874
|
+
/* Ensure that binding to port 0 results in OS assigning a port */
|
875
|
+
static int s_test_bind_on_zero_port(
|
876
|
+
struct aws_allocator *allocator,
|
877
|
+
enum aws_socket_type sock_type,
|
878
|
+
enum aws_socket_domain sock_domain,
|
879
|
+
const char *address) {
|
880
|
+
|
881
|
+
struct aws_event_loop *event_loop = aws_event_loop_new_default(allocator, aws_high_res_clock_get_ticks);
|
882
|
+
|
883
|
+
ASSERT_NOT_NULL(event_loop, "Event loop creation failed with error: %s", aws_error_debug_str(aws_last_error()));
|
884
|
+
ASSERT_SUCCESS(aws_event_loop_run(event_loop));
|
885
|
+
|
886
|
+
struct aws_socket_options options;
|
887
|
+
AWS_ZERO_STRUCT(options);
|
888
|
+
options.connect_timeout_ms = 1000;
|
889
|
+
options.type = sock_type;
|
890
|
+
options.domain = sock_domain;
|
891
|
+
|
892
|
+
struct aws_socket_endpoint endpoint = {
|
893
|
+
.port = 0 /* important: must be 0 for this test */,
|
894
|
+
};
|
895
|
+
strncpy(endpoint.address, address, sizeof(endpoint.address));
|
896
|
+
|
897
|
+
struct aws_socket incoming;
|
898
|
+
ASSERT_SUCCESS(aws_socket_init(&incoming, allocator, &options));
|
899
|
+
|
900
|
+
/* ensure address query fails if socket isn't bound yet */
|
901
|
+
struct aws_socket_endpoint local_address1;
|
902
|
+
ASSERT_FAILS(aws_socket_get_bound_address(&incoming, &local_address1));
|
903
|
+
|
904
|
+
ASSERT_SUCCESS(aws_socket_bind(&incoming, &endpoint));
|
905
|
+
|
906
|
+
ASSERT_SUCCESS(aws_socket_get_bound_address(&incoming, &local_address1));
|
907
|
+
|
908
|
+
if (sock_type != AWS_SOCKET_DGRAM) {
|
909
|
+
ASSERT_SUCCESS(aws_socket_listen(&incoming, 1024));
|
910
|
+
}
|
911
|
+
|
912
|
+
ASSERT_TRUE(local_address1.port > 0);
|
913
|
+
ASSERT_STR_EQUALS(address, local_address1.address);
|
914
|
+
|
915
|
+
/* ensure that querying again gets the same results */
|
916
|
+
struct aws_socket_endpoint local_address2;
|
917
|
+
ASSERT_SUCCESS(aws_socket_get_bound_address(&incoming, &local_address2));
|
918
|
+
ASSERT_INT_EQUALS(local_address1.port, local_address2.port);
|
919
|
+
ASSERT_STR_EQUALS(local_address1.address, local_address2.address);
|
920
|
+
|
921
|
+
aws_socket_close(&incoming);
|
922
|
+
aws_socket_clean_up(&incoming);
|
923
|
+
aws_event_loop_destroy(event_loop);
|
924
|
+
return 0;
|
925
|
+
}
|
926
|
+
|
927
|
+
static int s_bind_on_zero_port_tcp_ipv4(struct aws_allocator *allocator, void *ctx) {
|
928
|
+
(void)ctx;
|
929
|
+
return s_test_bind_on_zero_port(allocator, AWS_SOCKET_STREAM, AWS_SOCKET_IPV4, "127.0.0.1");
|
930
|
+
}
|
931
|
+
AWS_TEST_CASE(bind_on_zero_port_tcp_ipv4, s_bind_on_zero_port_tcp_ipv4)
|
932
|
+
|
933
|
+
static int s_bind_on_zero_port_udp_ipv4(struct aws_allocator *allocator, void *ctx) {
|
934
|
+
(void)ctx;
|
935
|
+
return s_test_bind_on_zero_port(allocator, AWS_SOCKET_DGRAM, AWS_SOCKET_IPV4, "127.0.0.1");
|
936
|
+
}
|
937
|
+
AWS_TEST_CASE(bind_on_zero_port_udp_ipv4, s_bind_on_zero_port_udp_ipv4)
|
938
|
+
|
868
939
|
static int s_test_incoming_udp_sock_errors(struct aws_allocator *allocator, void *ctx) {
|
869
940
|
(void)ctx;
|
870
941
|
if (!s_test_running_as_root(allocator)) {
|
@@ -1581,7 +1652,7 @@ static int s_local_socket_pipe_connected_race(struct aws_allocator *allocator, v
|
|
1581
1652
|
uint64_t timestamp = 0;
|
1582
1653
|
ASSERT_SUCCESS(aws_sys_clock_get_ticks(×tamp));
|
1583
1654
|
struct aws_socket_endpoint endpoint;
|
1584
|
-
|
1655
|
+
AWS_ZERO_STRUCT(endpoint);
|
1585
1656
|
snprintf(endpoint.address, sizeof(endpoint.address), LOCAL_SOCK_TEST_PATTERN, (long long unsigned)timestamp);
|
1586
1657
|
|
1587
1658
|
struct aws_socket listener;
|
@@ -341,7 +341,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C)
|
|
341
341
|
set(CMAKE_C_FLAGS_DEBUGOPT "")
|
342
342
|
|
343
343
|
target_compile_options(${PROJECT_NAME} PRIVATE -pedantic -std=gnu99 -Wall -Wimplicit -Wunused -Wcomment -Wchar-subscripts
|
344
|
-
-Wuninitialized -Wshadow -Wcast-
|
344
|
+
-Wuninitialized -Wshadow -Wcast-align -Wwrite-strings -Wno-deprecated-declarations -Wno-unknown-pragmas -Wformat-security
|
345
345
|
-Wno-missing-braces -Wa,--noexecstack
|
346
346
|
)
|
347
347
|
|
@@ -477,6 +477,11 @@ endif()
|
|
477
477
|
|
478
478
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
479
479
|
|
480
|
+
if (NOT $ENV{S2N_LIBCRYPTO} STREQUAL "awslc")
|
481
|
+
# add cast-qual back in for non AWS-LC
|
482
|
+
target_compile_options(${PROJECT_NAME} PRIVATE -Wcast-qual)
|
483
|
+
endif()
|
484
|
+
|
480
485
|
#work around target differences
|
481
486
|
if (TARGET crypto)
|
482
487
|
message(STATUS "S2N found target: crypto")
|
@@ -1,7 +1,6 @@
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
3
3
|
|
4
|
-
use bindgen::CodegenConfig;
|
5
4
|
use std::{
|
6
5
|
collections::BTreeSet,
|
7
6
|
io,
|
@@ -13,44 +12,51 @@ fn main() {
|
|
13
12
|
let out_dir = std::env::args().nth(1).expect("missing sys dir");
|
14
13
|
let out_dir = Path::new(&out_dir);
|
15
14
|
|
16
|
-
gen_bindings("#include <s2n.h>", &out_dir.join("lib"))
|
17
|
-
.allowlist_type("s2n_.*")
|
18
|
-
.allowlist_function("s2n_.*")
|
19
|
-
.allowlist_var("s2n_.*")
|
20
|
-
.generate()
|
21
|
-
.unwrap()
|
22
|
-
.write_to_file(out_dir.join("src/api.rs"))
|
23
|
-
.unwrap();
|
24
|
-
|
25
|
-
gen_bindings("#include \"tls/s2n_quic_support.h\"", &out_dir.join("lib"))
|
26
|
-
.allowlist_function("s2n_.*quic.*")
|
27
|
-
.allowlist_function("s2n_.*secret_callback.*")
|
28
|
-
.blocklist_type("s2n_config")
|
29
|
-
.blocklist_type("s2n_connection")
|
30
|
-
.raw_line("use crate::api::*;\n")
|
31
|
-
.generate()
|
32
|
-
.unwrap()
|
33
|
-
.write_to_file(out_dir.join("src/quic.rs"))
|
34
|
-
.unwrap();
|
35
|
-
|
36
|
-
gen_bindings("#include \"tls/s2n_internal.h\"", &out_dir.join("lib"))
|
37
|
-
.allowlist_function("s2n_.*")
|
38
|
-
.blocklist_type("s2n_config")
|
39
|
-
.blocklist_type("s2n_connection")
|
40
|
-
.raw_line("use crate::api::*;\n")
|
41
|
-
.generate()
|
42
|
-
.unwrap()
|
43
|
-
.write_to_file(out_dir.join("src/internal.rs"))
|
44
|
-
.unwrap();
|
45
|
-
|
46
15
|
let functions = FunctionCallbacks::default();
|
47
16
|
|
48
|
-
gen_bindings(
|
49
|
-
.
|
50
|
-
.
|
51
|
-
|
52
|
-
|
53
|
-
|
17
|
+
gen_bindings(
|
18
|
+
"#include <s2n.h>",
|
19
|
+
&out_dir.join("lib"),
|
20
|
+
functions.with_feature(None),
|
21
|
+
)
|
22
|
+
.allowlist_type("s2n_.*")
|
23
|
+
.allowlist_function("s2n_.*")
|
24
|
+
.allowlist_var("s2n_.*")
|
25
|
+
.generate()
|
26
|
+
.unwrap()
|
27
|
+
.write_to_file(out_dir.join("src/api.rs"))
|
28
|
+
.unwrap();
|
29
|
+
|
30
|
+
gen_bindings(
|
31
|
+
"#include \"tls/s2n_quic_support.h\"",
|
32
|
+
&out_dir.join("lib"),
|
33
|
+
functions.with_feature(Some("quic")),
|
34
|
+
)
|
35
|
+
.allowlist_function("s2n_.*quic.*")
|
36
|
+
.allowlist_function("s2n_.*secret_callback.*")
|
37
|
+
.allowlist_function("s2n_error_get_alert")
|
38
|
+
.blocklist_type("s2n_config")
|
39
|
+
.blocklist_type("s2n_connection")
|
40
|
+
.raw_line("use crate::api::*;\n")
|
41
|
+
.generate()
|
42
|
+
.unwrap()
|
43
|
+
.write_to_file(out_dir.join("src/quic.rs"))
|
44
|
+
.unwrap();
|
45
|
+
|
46
|
+
gen_bindings(
|
47
|
+
"#include \"tls/s2n_internal.h\"",
|
48
|
+
&out_dir.join("lib"),
|
49
|
+
functions.with_feature(Some("internal")),
|
50
|
+
)
|
51
|
+
// any new internal functions need to be added here
|
52
|
+
.allowlist_function("s2n_.*")
|
53
|
+
.blocklist_type("s2n_config")
|
54
|
+
.blocklist_type("s2n_connection")
|
55
|
+
.raw_line("use crate::api::*;\n")
|
56
|
+
.generate()
|
57
|
+
.unwrap()
|
58
|
+
.write_to_file(out_dir.join("src/internal.rs"))
|
59
|
+
.unwrap();
|
54
60
|
|
55
61
|
functions.tests(&out_dir.join("src/tests.rs")).unwrap();
|
56
62
|
|
@@ -68,7 +74,7 @@ const PRELUDE: &str = r#"
|
|
68
74
|
use libc::{iovec, FILE};
|
69
75
|
"#;
|
70
76
|
|
71
|
-
fn gen_bindings(entry: &str, s2n_dir: &Path) -> bindgen::Builder {
|
77
|
+
fn gen_bindings(entry: &str, s2n_dir: &Path, functions: FunctionCallbacks) -> bindgen::Builder {
|
72
78
|
let builder = bindgen::Builder::default()
|
73
79
|
.use_core()
|
74
80
|
.layout_tests(true)
|
@@ -91,7 +97,7 @@ fn gen_bindings(entry: &str, s2n_dir: &Path) -> bindgen::Builder {
|
|
91
97
|
.raw_line(COPYRIGHT)
|
92
98
|
.raw_line(PRELUDE)
|
93
99
|
.ctypes_prefix("::libc")
|
94
|
-
.parse_callbacks(Box::new(
|
100
|
+
.parse_callbacks(Box::new(functions))
|
95
101
|
.clang_arg(format!("-I{}/api", s2n_dir.display()))
|
96
102
|
.clang_arg(format!("-I{}", s2n_dir.display()));
|
97
103
|
builder
|
@@ -120,51 +126,21 @@ fn gen_files(input: &Path, out: &Path) -> io::Result<()> {
|
|
120
126
|
Ok(())
|
121
127
|
}
|
122
128
|
|
123
|
-
|
124
|
-
struct S2nCallbacks;
|
125
|
-
|
126
|
-
impl bindgen::callbacks::ParseCallbacks for S2nCallbacks {
|
127
|
-
fn enum_variant_name(
|
128
|
-
&self,
|
129
|
-
_enum_name: Option<&str>,
|
130
|
-
variant_name: &str,
|
131
|
-
_variant_value: bindgen::callbacks::EnumVariantValue,
|
132
|
-
) -> Option<String> {
|
133
|
-
if !variant_name.starts_with("S2N_") {
|
134
|
-
return None;
|
135
|
-
}
|
136
|
-
|
137
|
-
let variant_name = variant_name
|
138
|
-
.trim_start_matches("S2N_ERR_T_")
|
139
|
-
.trim_start_matches("S2N_EXTENSION_")
|
140
|
-
// keep the LEN_ so it's a valid identifier
|
141
|
-
.trim_start_matches("S2N_TLS_MAX_FRAG_")
|
142
|
-
.trim_start_matches("S2N_ALERT_")
|
143
|
-
.trim_start_matches("S2N_CT_SUPPORT_")
|
144
|
-
.trim_start_matches("S2N_STATUS_REQUEST_")
|
145
|
-
.trim_start_matches("S2N_CERT_AUTH_")
|
146
|
-
.trim_start_matches("S2N_CLIENT_HELLO_CB_")
|
147
|
-
.trim_start_matches("S2N_TLS_SIGNATURE_")
|
148
|
-
.trim_start_matches("S2N_TLS_HASH_")
|
149
|
-
.trim_start_matches("S2N_PSK_HMAC_")
|
150
|
-
.trim_start_matches("S2N_PSK_MODE_")
|
151
|
-
.trim_start_matches("S2N_ASYNC_PKEY_VALIDATION_")
|
152
|
-
.trim_start_matches("S2N_ASYNC_")
|
153
|
-
.trim_start_matches("S2N_EARLY_DATA_STATUS_")
|
154
|
-
// match everything else
|
155
|
-
.trim_start_matches("S2N_");
|
156
|
-
|
157
|
-
Some(variant_name.to_owned())
|
158
|
-
}
|
159
|
-
}
|
129
|
+
type SharedBTreeSet<T> = Arc<Mutex<BTreeSet<T>>>;
|
160
130
|
|
161
131
|
#[derive(Clone, Debug, Default)]
|
162
132
|
struct FunctionCallbacks {
|
163
|
-
|
164
|
-
|
133
|
+
feature: Arc<Mutex<Option<&'static str>>>,
|
134
|
+
types: SharedBTreeSet<String>,
|
135
|
+
functions: SharedBTreeSet<(Option<&'static str>, String)>,
|
165
136
|
}
|
166
137
|
|
167
138
|
impl FunctionCallbacks {
|
139
|
+
fn with_feature(&self, feature: Option<&'static str>) -> Self {
|
140
|
+
*self.feature.lock().unwrap() = feature;
|
141
|
+
self.clone()
|
142
|
+
}
|
143
|
+
|
168
144
|
fn tests(&self, out: &Path) -> io::Result<()> {
|
169
145
|
use io::Write;
|
170
146
|
let functions = self.functions.lock().unwrap();
|
@@ -180,6 +156,7 @@ impl FunctionCallbacks {
|
|
180
156
|
"s2n_cache_retrieve_callback",
|
181
157
|
"s2n_cache_store_callback",
|
182
158
|
"s2n_cert",
|
159
|
+
"s2n_cert_public_key",
|
183
160
|
"s2n_cert_chain_and_key",
|
184
161
|
"s2n_cert_private_key",
|
185
162
|
"s2n_cert_tiebreak_callback",
|
@@ -206,6 +183,7 @@ impl FunctionCallbacks {
|
|
206
183
|
"s2n_rand_mix_callback",
|
207
184
|
"s2n_rand_seed_callback",
|
208
185
|
"s2n_recv_fn",
|
186
|
+
"s2n_secret_cb",
|
209
187
|
"s2n_send_fn",
|
210
188
|
"s2n_session_ticket",
|
211
189
|
"s2n_session_ticket_fn",
|
@@ -221,8 +199,24 @@ impl FunctionCallbacks {
|
|
221
199
|
let mut o = io::BufWriter::new(&mut tests);
|
222
200
|
|
223
201
|
writeln!(o, "{}", COPYRIGHT)?;
|
224
|
-
for function in functions.
|
202
|
+
for (feature, function) in functions.iter() {
|
203
|
+
// don't generate tests for types
|
204
|
+
if types.contains(function) {
|
205
|
+
continue;
|
206
|
+
}
|
207
|
+
|
208
|
+
// don't generate a test if it's enabled without a feature
|
209
|
+
if feature.is_some() && functions.contains(&(None, function.to_string())) {
|
210
|
+
continue;
|
211
|
+
}
|
212
|
+
|
225
213
|
writeln!(o, "#[test]")?;
|
214
|
+
|
215
|
+
// if the function is behind a feature, gate it with `cfg`
|
216
|
+
if let Some(feature) = feature {
|
217
|
+
writeln!(o, "#[cfg(feature = {:?})]", feature)?;
|
218
|
+
};
|
219
|
+
|
226
220
|
writeln!(o, "fn {} () {{", function)?;
|
227
221
|
writeln!(o, " let ptr = crate::{} as *const ();", function)?;
|
228
222
|
writeln!(o, " assert!(!ptr.is_null());")?;
|
@@ -238,19 +232,48 @@ impl bindgen::callbacks::ParseCallbacks for FunctionCallbacks {
|
|
238
232
|
fn enum_variant_name(
|
239
233
|
&self,
|
240
234
|
name: Option<&str>,
|
241
|
-
|
235
|
+
variant_name: &str,
|
242
236
|
_variant_value: bindgen::callbacks::EnumVariantValue,
|
243
237
|
) -> Option<String> {
|
244
238
|
let name = name.unwrap_or("");
|
245
239
|
if name.starts_with("s2n_") {
|
246
240
|
self.types.lock().unwrap().insert(name.to_owned());
|
247
241
|
}
|
248
|
-
|
242
|
+
|
243
|
+
if !variant_name.starts_with("S2N_") {
|
244
|
+
return None;
|
245
|
+
}
|
246
|
+
|
247
|
+
let variant_name = variant_name
|
248
|
+
.trim_start_matches("S2N_ERR_T_")
|
249
|
+
.trim_start_matches("S2N_EXTENSION_")
|
250
|
+
// keep the LEN_ so it's a valid identifier
|
251
|
+
.trim_start_matches("S2N_TLS_MAX_FRAG_")
|
252
|
+
.trim_start_matches("S2N_ALERT_")
|
253
|
+
.trim_start_matches("S2N_CT_SUPPORT_")
|
254
|
+
.trim_start_matches("S2N_STATUS_REQUEST_")
|
255
|
+
.trim_start_matches("S2N_CERT_AUTH_")
|
256
|
+
.trim_start_matches("S2N_CLIENT_HELLO_CB_")
|
257
|
+
.trim_start_matches("S2N_TLS_SIGNATURE_")
|
258
|
+
.trim_start_matches("S2N_TLS_HASH_")
|
259
|
+
.trim_start_matches("S2N_PSK_HMAC_")
|
260
|
+
.trim_start_matches("S2N_PSK_MODE_")
|
261
|
+
.trim_start_matches("S2N_ASYNC_PKEY_VALIDATION_")
|
262
|
+
.trim_start_matches("S2N_ASYNC_")
|
263
|
+
.trim_start_matches("S2N_EARLY_DATA_STATUS_")
|
264
|
+
// match everything else
|
265
|
+
.trim_start_matches("S2N_");
|
266
|
+
|
267
|
+
Some(variant_name.to_owned())
|
249
268
|
}
|
250
269
|
|
251
270
|
fn item_name(&self, name: &str) -> Option<String> {
|
252
271
|
if name.starts_with("s2n_") {
|
253
|
-
self.
|
272
|
+
let feature = *self.feature.lock().unwrap();
|
273
|
+
self.functions
|
274
|
+
.lock()
|
275
|
+
.unwrap()
|
276
|
+
.insert((feature, name.to_owned()));
|
254
277
|
}
|
255
278
|
None
|
256
279
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
[package]
|
2
2
|
name = "s2n-tls"
|
3
3
|
description = "A C99 implementation of the TLS/SSL protocols"
|
4
|
-
version = "0.0.
|
4
|
+
version = "0.0.5"
|
5
5
|
authors = ["AWS s2n"]
|
6
6
|
edition = "2018"
|
7
7
|
repository = "https://github.com/aws/s2n-tls"
|
@@ -17,7 +17,7 @@ testing = ["errno", "bytes"]
|
|
17
17
|
bytes = { version = "1", optional = true }
|
18
18
|
errno = { version = "0.2", optional = true }
|
19
19
|
libc = "0.2"
|
20
|
-
s2n-tls-sys = { version = "=0.0.
|
20
|
+
s2n-tls-sys = { version = "=0.0.5", path = "../s2n-tls-sys", features = ["internal"] }
|
21
21
|
|
22
22
|
[dev-dependencies]
|
23
23
|
bytes = { version = "1" }
|