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
@@ -59,19 +59,13 @@ int aws_input_stream_get_length(struct aws_input_stream *stream, int64_t *out_le
|
|
59
59
|
return stream->vtable->get_length(stream, out_length);
|
60
60
|
}
|
61
61
|
|
62
|
-
void aws_input_stream_destroy(struct aws_input_stream *stream) {
|
63
|
-
if (stream != NULL) {
|
64
|
-
AWS_ASSERT(stream->vtable && stream->vtable->destroy);
|
65
|
-
|
66
|
-
stream->vtable->destroy(stream);
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
62
|
/*
|
71
63
|
* cursor stream implementation
|
72
64
|
*/
|
73
65
|
|
74
66
|
struct aws_input_stream_byte_cursor_impl {
|
67
|
+
struct aws_input_stream base;
|
68
|
+
struct aws_allocator *allocator;
|
75
69
|
struct aws_byte_cursor original_cursor;
|
76
70
|
struct aws_byte_cursor current_cursor;
|
77
71
|
};
|
@@ -92,7 +86,8 @@ static int s_aws_input_stream_byte_cursor_seek(
|
|
92
86
|
struct aws_input_stream *stream,
|
93
87
|
int64_t offset,
|
94
88
|
enum aws_stream_seek_basis basis) {
|
95
|
-
struct aws_input_stream_byte_cursor_impl *impl =
|
89
|
+
struct aws_input_stream_byte_cursor_impl *impl =
|
90
|
+
AWS_CONTAINER_OF(stream, struct aws_input_stream_byte_cursor_impl, base);
|
96
91
|
|
97
92
|
uint64_t final_offset = 0;
|
98
93
|
|
@@ -145,7 +140,8 @@ static int s_aws_input_stream_byte_cursor_seek(
|
|
145
140
|
}
|
146
141
|
|
147
142
|
static int s_aws_input_stream_byte_cursor_read(struct aws_input_stream *stream, struct aws_byte_buf *dest) {
|
148
|
-
struct aws_input_stream_byte_cursor_impl *impl =
|
143
|
+
struct aws_input_stream_byte_cursor_impl *impl =
|
144
|
+
AWS_CONTAINER_OF(stream, struct aws_input_stream_byte_cursor_impl, base);
|
149
145
|
|
150
146
|
size_t actually_read = dest->capacity - dest->len;
|
151
147
|
if (actually_read > impl->current_cursor.len) {
|
@@ -164,7 +160,8 @@ static int s_aws_input_stream_byte_cursor_read(struct aws_input_stream *stream,
|
|
164
160
|
static int s_aws_input_stream_byte_cursor_get_status(
|
165
161
|
struct aws_input_stream *stream,
|
166
162
|
struct aws_stream_status *status) {
|
167
|
-
struct aws_input_stream_byte_cursor_impl *impl =
|
163
|
+
struct aws_input_stream_byte_cursor_impl *impl =
|
164
|
+
AWS_CONTAINER_OF(stream, struct aws_input_stream_byte_cursor_impl, base);
|
168
165
|
|
169
166
|
status->is_end_of_stream = impl->current_cursor.len == 0;
|
170
167
|
status->is_valid = true;
|
@@ -173,7 +170,8 @@ static int s_aws_input_stream_byte_cursor_get_status(
|
|
173
170
|
}
|
174
171
|
|
175
172
|
static int s_aws_input_stream_byte_cursor_get_length(struct aws_input_stream *stream, int64_t *out_length) {
|
176
|
-
struct aws_input_stream_byte_cursor_impl *impl =
|
173
|
+
struct aws_input_stream_byte_cursor_impl *impl =
|
174
|
+
AWS_CONTAINER_OF(stream, struct aws_input_stream_byte_cursor_impl, base);
|
177
175
|
|
178
176
|
#if SIZE_MAX > INT64_MAX
|
179
177
|
size_t length = impl->original_cursor.len;
|
@@ -187,8 +185,8 @@ static int s_aws_input_stream_byte_cursor_get_length(struct aws_input_stream *st
|
|
187
185
|
return AWS_OP_SUCCESS;
|
188
186
|
}
|
189
187
|
|
190
|
-
static void s_aws_input_stream_byte_cursor_destroy(struct
|
191
|
-
aws_mem_release(
|
188
|
+
static void s_aws_input_stream_byte_cursor_destroy(struct aws_input_stream_byte_cursor_impl *impl) {
|
189
|
+
aws_mem_release(impl->allocator, impl);
|
192
190
|
}
|
193
191
|
|
194
192
|
static struct aws_input_stream_vtable s_aws_input_stream_byte_cursor_vtable = {
|
@@ -196,44 +194,31 @@ static struct aws_input_stream_vtable s_aws_input_stream_byte_cursor_vtable = {
|
|
196
194
|
.read = s_aws_input_stream_byte_cursor_read,
|
197
195
|
.get_status = s_aws_input_stream_byte_cursor_get_status,
|
198
196
|
.get_length = s_aws_input_stream_byte_cursor_get_length,
|
199
|
-
|
197
|
+
};
|
200
198
|
|
201
199
|
struct aws_input_stream *aws_input_stream_new_from_cursor(
|
202
200
|
struct aws_allocator *allocator,
|
203
201
|
const struct aws_byte_cursor *cursor) {
|
204
202
|
|
205
|
-
struct
|
206
|
-
|
207
|
-
|
208
|
-
aws_mem_acquire_many(
|
209
|
-
allocator,
|
210
|
-
2,
|
211
|
-
&input_stream,
|
212
|
-
sizeof(struct aws_input_stream),
|
213
|
-
&impl,
|
214
|
-
sizeof(struct aws_input_stream_byte_cursor_impl));
|
215
|
-
|
216
|
-
if (!input_stream) {
|
217
|
-
return NULL;
|
218
|
-
}
|
219
|
-
|
220
|
-
AWS_ZERO_STRUCT(*input_stream);
|
221
|
-
AWS_ZERO_STRUCT(*impl);
|
222
|
-
|
223
|
-
input_stream->allocator = allocator;
|
224
|
-
input_stream->vtable = &s_aws_input_stream_byte_cursor_vtable;
|
225
|
-
input_stream->impl = impl;
|
203
|
+
struct aws_input_stream_byte_cursor_impl *impl =
|
204
|
+
aws_mem_calloc(allocator, 1, sizeof(struct aws_input_stream_byte_cursor_impl));
|
226
205
|
|
206
|
+
impl->allocator = allocator;
|
227
207
|
impl->original_cursor = *cursor;
|
228
208
|
impl->current_cursor = *cursor;
|
209
|
+
impl->base.vtable = &s_aws_input_stream_byte_cursor_vtable;
|
210
|
+
aws_ref_count_init(
|
211
|
+
&impl->base.ref_count, impl, (aws_simple_completion_callback *)s_aws_input_stream_byte_cursor_destroy);
|
229
212
|
|
230
|
-
return
|
213
|
+
return &impl->base;
|
231
214
|
}
|
232
215
|
|
233
216
|
/*
|
234
217
|
* file-based input stream
|
235
218
|
*/
|
236
219
|
struct aws_input_stream_file_impl {
|
220
|
+
struct aws_input_stream base;
|
221
|
+
struct aws_allocator *allocator;
|
237
222
|
FILE *file;
|
238
223
|
bool close_on_clean_up;
|
239
224
|
};
|
@@ -242,7 +227,7 @@ static int s_aws_input_stream_file_seek(
|
|
242
227
|
struct aws_input_stream *stream,
|
243
228
|
int64_t offset,
|
244
229
|
enum aws_stream_seek_basis basis) {
|
245
|
-
struct aws_input_stream_file_impl *impl = stream
|
230
|
+
struct aws_input_stream_file_impl *impl = AWS_CONTAINER_OF(stream, struct aws_input_stream_file_impl, base);
|
246
231
|
|
247
232
|
int whence = (basis == AWS_SSB_BEGIN) ? SEEK_SET : SEEK_END;
|
248
233
|
if (aws_fseek(impl->file, offset, whence)) {
|
@@ -253,7 +238,7 @@ static int s_aws_input_stream_file_seek(
|
|
253
238
|
}
|
254
239
|
|
255
240
|
static int s_aws_input_stream_file_read(struct aws_input_stream *stream, struct aws_byte_buf *dest) {
|
256
|
-
struct aws_input_stream_file_impl *impl = stream
|
241
|
+
struct aws_input_stream_file_impl *impl = AWS_CONTAINER_OF(stream, struct aws_input_stream_file_impl, base);
|
257
242
|
|
258
243
|
size_t max_read = dest->capacity - dest->len;
|
259
244
|
size_t actually_read = fread(dest->buffer + dest->len, 1, max_read, impl->file);
|
@@ -269,7 +254,7 @@ static int s_aws_input_stream_file_read(struct aws_input_stream *stream, struct
|
|
269
254
|
}
|
270
255
|
|
271
256
|
static int s_aws_input_stream_file_get_status(struct aws_input_stream *stream, struct aws_stream_status *status) {
|
272
|
-
struct aws_input_stream_file_impl *impl = stream
|
257
|
+
struct aws_input_stream_file_impl *impl = AWS_CONTAINER_OF(stream, struct aws_input_stream_file_impl, base);
|
273
258
|
|
274
259
|
status->is_end_of_stream = feof(impl->file) != 0;
|
275
260
|
status->is_valid = ferror(impl->file) == 0;
|
@@ -278,19 +263,17 @@ static int s_aws_input_stream_file_get_status(struct aws_input_stream *stream, s
|
|
278
263
|
}
|
279
264
|
|
280
265
|
static int s_aws_input_stream_file_get_length(struct aws_input_stream *stream, int64_t *length) {
|
281
|
-
struct aws_input_stream_file_impl *impl = stream
|
266
|
+
struct aws_input_stream_file_impl *impl = AWS_CONTAINER_OF(stream, struct aws_input_stream_file_impl, base);
|
282
267
|
|
283
268
|
return aws_file_get_length(impl->file, length);
|
284
269
|
}
|
285
270
|
|
286
|
-
static void s_aws_input_stream_file_destroy(struct
|
287
|
-
struct aws_input_stream_file_impl *impl = stream->impl;
|
271
|
+
static void s_aws_input_stream_file_destroy(struct aws_input_stream_file_impl *impl) {
|
288
272
|
|
289
273
|
if (impl->close_on_clean_up && impl->file) {
|
290
274
|
fclose(impl->file);
|
291
275
|
}
|
292
|
-
|
293
|
-
aws_mem_release(stream->allocator, stream);
|
276
|
+
aws_mem_release(impl->allocator, impl);
|
294
277
|
}
|
295
278
|
|
296
279
|
static struct aws_input_stream_vtable s_aws_input_stream_file_vtable = {
|
@@ -298,26 +281,11 @@ static struct aws_input_stream_vtable s_aws_input_stream_file_vtable = {
|
|
298
281
|
.read = s_aws_input_stream_file_read,
|
299
282
|
.get_status = s_aws_input_stream_file_get_status,
|
300
283
|
.get_length = s_aws_input_stream_file_get_length,
|
301
|
-
|
284
|
+
};
|
302
285
|
|
303
286
|
struct aws_input_stream *aws_input_stream_new_from_file(struct aws_allocator *allocator, const char *file_name) {
|
304
287
|
|
305
|
-
struct
|
306
|
-
struct aws_input_stream_file_impl *impl = NULL;
|
307
|
-
|
308
|
-
aws_mem_acquire_many(
|
309
|
-
allocator, 2, &input_stream, sizeof(struct aws_input_stream), &impl, sizeof(struct aws_input_stream_file_impl));
|
310
|
-
|
311
|
-
if (!input_stream) {
|
312
|
-
return NULL;
|
313
|
-
}
|
314
|
-
|
315
|
-
AWS_ZERO_STRUCT(*input_stream);
|
316
|
-
AWS_ZERO_STRUCT(*impl);
|
317
|
-
|
318
|
-
input_stream->allocator = allocator;
|
319
|
-
input_stream->vtable = &s_aws_input_stream_file_vtable;
|
320
|
-
input_stream->impl = impl;
|
288
|
+
struct aws_input_stream_file_impl *impl = aws_mem_calloc(allocator, 1, sizeof(struct aws_input_stream_file_impl));
|
321
289
|
|
322
290
|
impl->file = aws_fopen(file_name, "r+b");
|
323
291
|
if (impl->file == NULL) {
|
@@ -326,36 +294,51 @@ struct aws_input_stream *aws_input_stream_new_from_file(struct aws_allocator *al
|
|
326
294
|
}
|
327
295
|
|
328
296
|
impl->close_on_clean_up = true;
|
297
|
+
impl->allocator = allocator;
|
298
|
+
impl->base.vtable = &s_aws_input_stream_file_vtable;
|
299
|
+
aws_ref_count_init(&impl->base.ref_count, impl, (aws_simple_completion_callback *)s_aws_input_stream_file_destroy);
|
329
300
|
|
330
|
-
return
|
301
|
+
return &impl->base;
|
331
302
|
|
332
303
|
on_error:
|
333
|
-
|
334
|
-
aws_input_stream_destroy(input_stream);
|
335
|
-
|
304
|
+
aws_mem_release(allocator, impl);
|
336
305
|
return NULL;
|
337
306
|
}
|
338
307
|
|
339
308
|
struct aws_input_stream *aws_input_stream_new_from_open_file(struct aws_allocator *allocator, FILE *file) {
|
340
|
-
struct
|
341
|
-
struct aws_input_stream_file_impl *impl = NULL;
|
342
|
-
|
343
|
-
aws_mem_acquire_many(
|
344
|
-
allocator, 2, &input_stream, sizeof(struct aws_input_stream), &impl, sizeof(struct aws_input_stream_file_impl));
|
309
|
+
struct aws_input_stream_file_impl *impl = aws_mem_calloc(allocator, 1, sizeof(struct aws_input_stream_file_impl));
|
345
310
|
|
346
|
-
|
347
|
-
|
348
|
-
|
311
|
+
impl->file = file;
|
312
|
+
impl->close_on_clean_up = false;
|
313
|
+
impl->allocator = allocator;
|
349
314
|
|
350
|
-
|
351
|
-
|
315
|
+
impl->base.vtable = &s_aws_input_stream_file_vtable;
|
316
|
+
aws_ref_count_init(&impl->base.ref_count, impl, (aws_simple_completion_callback *)s_aws_input_stream_file_destroy);
|
317
|
+
return &impl->base;
|
318
|
+
}
|
352
319
|
|
353
|
-
|
354
|
-
|
355
|
-
|
320
|
+
struct aws_input_stream *aws_input_stream_acquire(struct aws_input_stream *stream) {
|
321
|
+
if (stream != NULL) {
|
322
|
+
if (stream->vtable->acquire) {
|
323
|
+
stream->vtable->acquire(stream);
|
324
|
+
} else {
|
325
|
+
aws_ref_count_acquire(&stream->ref_count);
|
326
|
+
}
|
327
|
+
}
|
328
|
+
return stream;
|
329
|
+
}
|
356
330
|
|
357
|
-
|
358
|
-
|
331
|
+
struct aws_input_stream *aws_input_stream_release(struct aws_input_stream *stream) {
|
332
|
+
if (stream != NULL) {
|
333
|
+
if (stream->vtable->release) {
|
334
|
+
stream->vtable->release(stream);
|
335
|
+
} else {
|
336
|
+
aws_ref_count_release(&stream->ref_count);
|
337
|
+
}
|
338
|
+
}
|
339
|
+
return NULL;
|
340
|
+
}
|
359
341
|
|
360
|
-
|
342
|
+
void aws_input_stream_destroy(struct aws_input_stream *stream) {
|
343
|
+
aws_input_stream_release(stream);
|
361
344
|
}
|
@@ -13,6 +13,8 @@
|
|
13
13
|
|
14
14
|
#define AWS_DEFAULT_TLS_TIMEOUT_MS 10000
|
15
15
|
|
16
|
+
#include "./pkcs11_private.h"
|
17
|
+
|
16
18
|
#include <aws/common/string.h>
|
17
19
|
|
18
20
|
void aws_tls_ctx_options_init_default_client(struct aws_tls_ctx_options *options, struct aws_allocator *allocator) {
|
@@ -40,11 +42,7 @@ void aws_tls_ctx_options_clean_up(struct aws_tls_ctx_options *options) {
|
|
40
42
|
#endif
|
41
43
|
|
42
44
|
aws_string_destroy(options->alpn_list);
|
43
|
-
|
44
|
-
aws_pkcs11_lib_release(options->pkcs11.lib);
|
45
|
-
aws_string_destroy_secure(options->pkcs11.user_pin);
|
46
|
-
aws_string_destroy(options->pkcs11.token_label);
|
47
|
-
aws_string_destroy(options->pkcs11.private_key_object_label);
|
45
|
+
aws_custom_key_op_handler_release(options->custom_key_op_handler);
|
48
46
|
|
49
47
|
AWS_ZERO_STRUCT(*options);
|
50
48
|
}
|
@@ -134,85 +132,131 @@ error:
|
|
134
132
|
#endif
|
135
133
|
}
|
136
134
|
|
137
|
-
int
|
135
|
+
int aws_tls_ctx_options_init_client_mtls_with_custom_key_operations(
|
138
136
|
struct aws_tls_ctx_options *options,
|
139
137
|
struct aws_allocator *allocator,
|
140
|
-
|
138
|
+
struct aws_custom_key_op_handler *custom,
|
139
|
+
const struct aws_byte_cursor *cert_file_contents) {
|
141
140
|
|
142
|
-
#if
|
141
|
+
#if !USE_S2N
|
142
|
+
(void)options;
|
143
143
|
(void)allocator;
|
144
|
-
(void)
|
144
|
+
(void)custom;
|
145
|
+
(void)cert_file_contents;
|
145
146
|
AWS_ZERO_STRUCT(*options);
|
146
|
-
AWS_LOGF_ERROR(
|
147
|
-
|
147
|
+
AWS_LOGF_ERROR(
|
148
|
+
AWS_LS_IO_TLS, "static: This platform does not currently support TLS with custom private key operations.");
|
149
|
+
return aws_raise_error(AWS_ERROR_UNIMPLEMENTED);
|
148
150
|
#else
|
149
151
|
|
150
152
|
aws_tls_ctx_options_init_default_client(options, allocator);
|
151
153
|
|
152
|
-
/*
|
153
|
-
|
154
|
-
|
155
|
-
|
154
|
+
/* on_key_operation is required */
|
155
|
+
AWS_ASSERT(custom != NULL);
|
156
|
+
AWS_ASSERT(custom->vtable != NULL);
|
157
|
+
AWS_ASSERT(custom->vtable->on_key_operation != NULL);
|
158
|
+
|
159
|
+
/* Hold a reference to the custom key operation handler so it cannot be destroyed */
|
160
|
+
options->custom_key_op_handler = aws_custom_key_op_handler_acquire((struct aws_custom_key_op_handler *)custom);
|
161
|
+
|
162
|
+
/* Copy the certificate data from the cursor */
|
163
|
+
AWS_ASSERT(cert_file_contents != NULL);
|
164
|
+
aws_byte_buf_init_copy_from_cursor(&options->certificate, allocator, *cert_file_contents);
|
165
|
+
|
166
|
+
/* Make sure the certificate is set and valid */
|
167
|
+
if (aws_sanitize_pem(&options->certificate, allocator)) {
|
168
|
+
AWS_LOGF_ERROR(AWS_LS_IO_TLS, "static: Invalid certificate. File must contain PEM encoded data");
|
156
169
|
goto error;
|
157
170
|
}
|
158
|
-
options->pkcs11.lib = aws_pkcs11_lib_acquire(pkcs11_options->pkcs11_lib); /* cannot fail */
|
159
171
|
|
160
|
-
|
161
|
-
if (pkcs11_options->user_pin.ptr != NULL) {
|
162
|
-
options->pkcs11.user_pin = aws_string_new_from_cursor(allocator, &pkcs11_options->user_pin);
|
163
|
-
}
|
172
|
+
return AWS_OP_SUCCESS;
|
164
173
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
options->pkcs11.has_slot_id = true;
|
169
|
-
}
|
174
|
+
error:
|
175
|
+
aws_tls_ctx_options_clean_up(options);
|
176
|
+
return AWS_OP_ERR;
|
170
177
|
|
171
|
-
|
172
|
-
|
173
|
-
options->pkcs11.token_label = aws_string_new_from_cursor(allocator, &pkcs11_options->token_label);
|
174
|
-
}
|
178
|
+
#endif /* PLATFORM-SUPPORTS-CUSTOM-KEY-OPERATIONS */
|
179
|
+
}
|
175
180
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
181
|
+
int aws_tls_ctx_options_init_client_mtls_with_pkcs11(
|
182
|
+
struct aws_tls_ctx_options *options,
|
183
|
+
struct aws_allocator *allocator,
|
184
|
+
const struct aws_tls_ctx_pkcs11_options *pkcs11_options) {
|
185
|
+
|
186
|
+
#if defined(USE_S2N)
|
187
|
+
|
188
|
+
struct aws_custom_key_op_handler *pkcs11_handler = aws_pkcs11_tls_op_handler_new(
|
189
|
+
allocator,
|
190
|
+
pkcs11_options->pkcs11_lib,
|
191
|
+
&pkcs11_options->user_pin,
|
192
|
+
&pkcs11_options->token_label,
|
193
|
+
&pkcs11_options->private_key_object_label,
|
194
|
+
pkcs11_options->slot_id);
|
195
|
+
|
196
|
+
struct aws_byte_buf tmp_cert_buf;
|
197
|
+
AWS_ZERO_STRUCT(tmp_cert_buf);
|
198
|
+
bool success = false;
|
199
|
+
int custom_key_result = AWS_OP_ERR;
|
200
|
+
|
201
|
+
if (pkcs11_handler == NULL) {
|
202
|
+
aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
|
203
|
+
goto finish;
|
180
204
|
}
|
181
205
|
|
182
|
-
|
183
|
-
|
184
|
-
AWS_LOGF_ERROR(
|
185
|
-
AWS_LS_IO_TLS, "static: Both certificate filepath and contents are specified. Only one may be set.");
|
206
|
+
if ((pkcs11_options->cert_file_contents.ptr != NULL) && (pkcs11_options->cert_file_path.ptr != NULL)) {
|
207
|
+
AWS_LOGF_ERROR(AWS_LS_IO_TLS, "static: Cannot use certificate AND certificate file path, only one can be set");
|
186
208
|
aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
|
187
|
-
goto
|
188
|
-
} else if (pkcs11_options->
|
209
|
+
goto finish;
|
210
|
+
} else if (pkcs11_options->cert_file_contents.ptr != NULL) {
|
211
|
+
custom_key_result = aws_tls_ctx_options_init_client_mtls_with_custom_key_operations(
|
212
|
+
options, allocator, pkcs11_handler, &pkcs11_options->cert_file_contents);
|
213
|
+
success = true;
|
214
|
+
} else {
|
189
215
|
struct aws_string *tmp_string = aws_string_new_from_cursor(allocator, &pkcs11_options->cert_file_path);
|
190
|
-
int op = aws_byte_buf_init_from_file(&
|
216
|
+
int op = aws_byte_buf_init_from_file(&tmp_cert_buf, allocator, aws_string_c_str(tmp_string));
|
191
217
|
aws_string_destroy(tmp_string);
|
218
|
+
|
192
219
|
if (op != AWS_OP_SUCCESS) {
|
193
|
-
goto
|
220
|
+
goto finish;
|
194
221
|
}
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
AWS_LOGF_ERROR(AWS_LS_IO_TLS, "static: A certificate must be specified.");
|
201
|
-
aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
|
202
|
-
goto error;
|
222
|
+
|
223
|
+
struct aws_byte_cursor tmp_cursor = aws_byte_cursor_from_buf(&tmp_cert_buf);
|
224
|
+
custom_key_result = aws_tls_ctx_options_init_client_mtls_with_custom_key_operations(
|
225
|
+
options, allocator, pkcs11_handler, &tmp_cursor);
|
226
|
+
success = true;
|
203
227
|
}
|
204
228
|
|
205
|
-
|
206
|
-
|
207
|
-
|
229
|
+
finish:
|
230
|
+
|
231
|
+
if (pkcs11_handler != NULL) {
|
232
|
+
/**
|
233
|
+
* Calling aws_tls_ctx_options_init_client_mtls_with_custom_key_operations will have this options
|
234
|
+
* hold a reference to the custom key operations, but creating the TLS operations handler using
|
235
|
+
* aws_pkcs11_tls_op_handler_set_certificate_data adds a reference too, so we need to release
|
236
|
+
* this reference so the only thing (currently) holding a reference is the TLS options itself and
|
237
|
+
* not this function.
|
238
|
+
*/
|
239
|
+
aws_custom_key_op_handler_release(pkcs11_handler);
|
208
240
|
}
|
241
|
+
if (success == false) {
|
242
|
+
aws_tls_ctx_options_clean_up(options);
|
243
|
+
}
|
244
|
+
aws_byte_buf_clean_up(&tmp_cert_buf);
|
209
245
|
|
210
|
-
|
211
|
-
|
246
|
+
if (success) {
|
247
|
+
return custom_key_result;
|
248
|
+
} else {
|
249
|
+
return AWS_OP_ERR;
|
250
|
+
}
|
251
|
+
|
252
|
+
#else /* Platform does not support S2N */
|
253
|
+
|
254
|
+
(void)allocator;
|
255
|
+
(void)pkcs11_options;
|
256
|
+
AWS_ZERO_STRUCT(*options);
|
257
|
+
AWS_LOGF_ERROR(AWS_LS_IO_TLS, "static: This platform does not currently support TLS with PKCS#11.");
|
258
|
+
return aws_raise_error(AWS_ERROR_PLATFORM_NOT_SUPPORTED);
|
212
259
|
|
213
|
-
error:
|
214
|
-
aws_tls_ctx_options_clean_up(options);
|
215
|
-
return AWS_OP_ERR;
|
216
260
|
#endif /* PLATFORM-SUPPORTS-PKCS11-TLS */
|
217
261
|
}
|
218
262
|
|
@@ -739,3 +783,90 @@ void aws_tls_ctx_release(struct aws_tls_ctx *ctx) {
|
|
739
783
|
aws_ref_count_release(&ctx->ref_count);
|
740
784
|
}
|
741
785
|
}
|
786
|
+
|
787
|
+
const char *aws_tls_hash_algorithm_str(enum aws_tls_hash_algorithm hash) {
|
788
|
+
/* clang-format off */
|
789
|
+
switch (hash) {
|
790
|
+
case (AWS_TLS_HASH_SHA1): return "SHA1";
|
791
|
+
case (AWS_TLS_HASH_SHA224): return "SHA224";
|
792
|
+
case (AWS_TLS_HASH_SHA256): return "SHA256";
|
793
|
+
case (AWS_TLS_HASH_SHA384): return "SHA384";
|
794
|
+
case (AWS_TLS_HASH_SHA512): return "SHA512";
|
795
|
+
default: return "<UNKNOWN HASH ALGORITHM>";
|
796
|
+
}
|
797
|
+
/* clang-format on */
|
798
|
+
}
|
799
|
+
|
800
|
+
const char *aws_tls_signature_algorithm_str(enum aws_tls_signature_algorithm signature) {
|
801
|
+
/* clang-format off */
|
802
|
+
switch (signature) {
|
803
|
+
case (AWS_TLS_SIGNATURE_RSA): return "RSA";
|
804
|
+
case (AWS_TLS_SIGNATURE_ECDSA): return "ECDSA";
|
805
|
+
default: return "<UNKNOWN SIGNATURE ALGORITHM>";
|
806
|
+
}
|
807
|
+
/* clang-format on */
|
808
|
+
}
|
809
|
+
|
810
|
+
const char *aws_tls_key_operation_type_str(enum aws_tls_key_operation_type operation_type) {
|
811
|
+
/* clang-format off */
|
812
|
+
switch (operation_type) {
|
813
|
+
case (AWS_TLS_KEY_OPERATION_SIGN): return "SIGN";
|
814
|
+
case (AWS_TLS_KEY_OPERATION_DECRYPT): return "DECRYPT";
|
815
|
+
default: return "<UNKNOWN OPERATION TYPE>";
|
816
|
+
}
|
817
|
+
/* clang-format on */
|
818
|
+
}
|
819
|
+
|
820
|
+
#if !USE_S2N
|
821
|
+
void aws_tls_key_operation_complete(struct aws_tls_key_operation *operation, struct aws_byte_cursor output) {
|
822
|
+
(void)operation;
|
823
|
+
(void)output;
|
824
|
+
}
|
825
|
+
|
826
|
+
void aws_tls_key_operation_complete_with_error(struct aws_tls_key_operation *operation, int error_code) {
|
827
|
+
(void)operation;
|
828
|
+
(void)error_code;
|
829
|
+
}
|
830
|
+
|
831
|
+
struct aws_byte_cursor aws_tls_key_operation_get_input(const struct aws_tls_key_operation *operation) {
|
832
|
+
(void)operation;
|
833
|
+
return aws_byte_cursor_from_array(NULL, 0);
|
834
|
+
}
|
835
|
+
|
836
|
+
enum aws_tls_key_operation_type aws_tls_key_operation_get_type(const struct aws_tls_key_operation *operation) {
|
837
|
+
(void)operation;
|
838
|
+
return AWS_TLS_KEY_OPERATION_UNKNOWN;
|
839
|
+
}
|
840
|
+
|
841
|
+
enum aws_tls_signature_algorithm aws_tls_key_operation_get_signature_algorithm(
|
842
|
+
const struct aws_tls_key_operation *operation) {
|
843
|
+
(void)operation;
|
844
|
+
return AWS_TLS_SIGNATURE_UNKNOWN;
|
845
|
+
}
|
846
|
+
|
847
|
+
enum aws_tls_hash_algorithm aws_tls_key_operation_get_digest_algorithm(const struct aws_tls_key_operation *operation) {
|
848
|
+
(void)operation;
|
849
|
+
return AWS_TLS_HASH_UNKNOWN;
|
850
|
+
}
|
851
|
+
|
852
|
+
#endif
|
853
|
+
|
854
|
+
struct aws_custom_key_op_handler *aws_custom_key_op_handler_acquire(struct aws_custom_key_op_handler *key_op_handler) {
|
855
|
+
if (key_op_handler != NULL) {
|
856
|
+
aws_ref_count_acquire(&key_op_handler->ref_count);
|
857
|
+
}
|
858
|
+
return key_op_handler;
|
859
|
+
}
|
860
|
+
|
861
|
+
struct aws_custom_key_op_handler *aws_custom_key_op_handler_release(struct aws_custom_key_op_handler *key_op_handler) {
|
862
|
+
if (key_op_handler != NULL) {
|
863
|
+
aws_ref_count_release(&key_op_handler->ref_count);
|
864
|
+
}
|
865
|
+
return NULL;
|
866
|
+
}
|
867
|
+
|
868
|
+
void aws_custom_key_op_handler_perform_operation(
|
869
|
+
struct aws_custom_key_op_handler *key_op_handler,
|
870
|
+
struct aws_tls_key_operation *operation) {
|
871
|
+
key_op_handler->vtable->on_key_operation(key_op_handler, operation);
|
872
|
+
}
|