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
@@ -16,6 +16,8 @@
|
|
16
16
|
#include <aws/io/socket.h>
|
17
17
|
#include <ctype.h>
|
18
18
|
|
19
|
+
#include <aws/common/json.h>
|
20
|
+
|
19
21
|
#if defined(_MSC_VER)
|
20
22
|
# pragma warning(disable : 4204)
|
21
23
|
# pragma warning(disable : 4232)
|
@@ -1059,32 +1061,46 @@ on_finish:
|
|
1059
1061
|
"InstanceProfileId" : "AIPAQOHATHEGTGNQ5THQB"
|
1060
1062
|
}
|
1061
1063
|
*/
|
1062
|
-
static int s_parse_iam_profile(
|
1064
|
+
static int s_parse_iam_profile(struct aws_json_value *document_root, struct aws_imds_iam_profile *dest) {
|
1063
1065
|
|
1064
1066
|
bool success = false;
|
1065
1067
|
|
1066
|
-
|
1067
|
-
|
1068
|
+
struct aws_byte_cursor last_updated_cursor;
|
1069
|
+
struct aws_json_value *last_updated =
|
1070
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("LastUpdated"));
|
1071
|
+
if (last_updated == NULL) {
|
1072
|
+
last_updated = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("lastupdated"));
|
1073
|
+
}
|
1074
|
+
if (!aws_json_value_is_string(last_updated) ||
|
1075
|
+
(aws_json_value_get_string(last_updated, &last_updated_cursor) == AWS_OP_ERR)) {
|
1068
1076
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse LastUpdated from Json document for iam profile.");
|
1069
1077
|
goto done;
|
1070
1078
|
}
|
1071
1079
|
|
1072
|
-
|
1073
|
-
|
1080
|
+
struct aws_byte_cursor profile_arn_cursor;
|
1081
|
+
struct aws_json_value *profile_arn =
|
1082
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("InstanceProfileArn"));
|
1083
|
+
if (profile_arn == NULL) {
|
1084
|
+
profile_arn = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instanceprofilearn"));
|
1085
|
+
}
|
1086
|
+
if (!aws_json_value_is_string(profile_arn) ||
|
1087
|
+
(aws_json_value_get_string(profile_arn, &profile_arn_cursor) == AWS_OP_ERR)) {
|
1074
1088
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse InstanceProfileArn from Json document for iam profile.");
|
1075
1089
|
goto done;
|
1076
1090
|
}
|
1077
1091
|
|
1078
|
-
|
1079
|
-
|
1092
|
+
struct aws_byte_cursor profile_id_cursor;
|
1093
|
+
struct aws_json_value *profile_id =
|
1094
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("InstanceProfileId"));
|
1095
|
+
if (profile_id == NULL) {
|
1096
|
+
profile_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instanceprofileid"));
|
1097
|
+
}
|
1098
|
+
if (!aws_json_value_is_string(profile_id) ||
|
1099
|
+
(aws_json_value_get_string(profile_id, &profile_id_cursor) == AWS_OP_ERR)) {
|
1080
1100
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse InstanceProfileId from Json document for iam profile.");
|
1081
1101
|
goto done;
|
1082
1102
|
}
|
1083
1103
|
|
1084
|
-
struct aws_byte_cursor last_updated_cursor = aws_byte_cursor_from_c_str(last_updated->valuestring);
|
1085
|
-
struct aws_byte_cursor profile_arn_cursor = aws_byte_cursor_from_c_str(profile_arn->valuestring);
|
1086
|
-
struct aws_byte_cursor profile_id_cursor = aws_byte_cursor_from_c_str(profile_id->valuestring);
|
1087
|
-
|
1088
1104
|
if (last_updated_cursor.len == 0 || profile_arn_cursor.len == 0 || profile_id_cursor.len == 0) {
|
1089
1105
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Parsed an unexpected Json document fro iam profile.");
|
1090
1106
|
goto done;
|
@@ -1107,7 +1123,7 @@ done:
|
|
1107
1123
|
|
1108
1124
|
static void s_process_iam_profile(const struct aws_byte_buf *resource, int error_code, void *user_data) {
|
1109
1125
|
struct imds_get_iam_user_data *wrapped_user_data = user_data;
|
1110
|
-
|
1126
|
+
struct aws_json_value *document_root = NULL;
|
1111
1127
|
struct aws_imds_iam_profile iam;
|
1112
1128
|
AWS_ZERO_STRUCT(iam);
|
1113
1129
|
|
@@ -1126,7 +1142,8 @@ static void s_process_iam_profile(const struct aws_byte_buf *resource, int error
|
|
1126
1142
|
goto on_finish;
|
1127
1143
|
}
|
1128
1144
|
|
1129
|
-
|
1145
|
+
struct aws_byte_cursor json_data_cursor = aws_byte_cursor_from_buf(&json_data);
|
1146
|
+
document_root = aws_json_value_new_from_string(aws_default_allocator(), json_data_cursor);
|
1130
1147
|
if (document_root == NULL) {
|
1131
1148
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse document as Json document for iam profile.");
|
1132
1149
|
goto on_finish;
|
@@ -1141,7 +1158,7 @@ on_finish:
|
|
1141
1158
|
aws_byte_buf_clean_up_secure(&json_data);
|
1142
1159
|
aws_mem_release(wrapped_user_data->allocator, wrapped_user_data);
|
1143
1160
|
if (document_root != NULL) {
|
1144
|
-
|
1161
|
+
aws_json_value_destroy(document_root);
|
1145
1162
|
}
|
1146
1163
|
}
|
1147
1164
|
|
@@ -1164,108 +1181,228 @@ on_finish:
|
|
1164
1181
|
"version" : "2017-09-30"
|
1165
1182
|
}
|
1166
1183
|
*/
|
1167
|
-
static int s_parse_instance_info(
|
1184
|
+
static int s_parse_instance_info(struct aws_json_value *document_root, struct aws_imds_instance_info *dest) {
|
1168
1185
|
|
1169
1186
|
bool success = false;
|
1170
|
-
|
1171
|
-
|
1187
|
+
|
1188
|
+
struct aws_byte_cursor account_id_cursor;
|
1189
|
+
struct aws_json_value *account_id =
|
1190
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("accountId"));
|
1191
|
+
if (account_id == NULL) {
|
1192
|
+
account_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("accountid"));
|
1193
|
+
if (account_id == NULL) {
|
1194
|
+
account_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("AccountId"));
|
1195
|
+
}
|
1196
|
+
}
|
1197
|
+
if (!aws_json_value_is_string(account_id) ||
|
1198
|
+
(aws_json_value_get_string(account_id, &account_id_cursor) == AWS_OP_ERR)) {
|
1172
1199
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse accountId from Json document for ec2 instance info.");
|
1173
1200
|
goto done;
|
1174
1201
|
}
|
1175
|
-
dest->account_id =
|
1202
|
+
dest->account_id = account_id_cursor;
|
1176
1203
|
|
1177
|
-
|
1178
|
-
|
1204
|
+
struct aws_byte_cursor architecture_cursor;
|
1205
|
+
struct aws_json_value *architecture =
|
1206
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("architecture"));
|
1207
|
+
if (architecture == NULL) {
|
1208
|
+
architecture = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("Architecture"));
|
1209
|
+
}
|
1210
|
+
if (!aws_json_value_is_string(architecture) ||
|
1211
|
+
(aws_json_value_get_string(architecture, &architecture_cursor) == AWS_OP_ERR)) {
|
1179
1212
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse architecture from Json document for ec2 instance info.");
|
1180
1213
|
goto done;
|
1181
1214
|
}
|
1182
|
-
dest->architecture =
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1215
|
+
dest->architecture = architecture_cursor;
|
1216
|
+
|
1217
|
+
struct aws_byte_cursor availability_zone_cursor;
|
1218
|
+
struct aws_json_value *availability_zone =
|
1219
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("availabilityZone"));
|
1220
|
+
if (availability_zone == NULL) {
|
1221
|
+
availability_zone =
|
1222
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("availabilityzone"));
|
1223
|
+
if (availability_zone == NULL) {
|
1224
|
+
availability_zone =
|
1225
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("AvailabilityZone"));
|
1226
|
+
}
|
1227
|
+
}
|
1228
|
+
if (!aws_json_value_is_string(availability_zone) ||
|
1229
|
+
(aws_json_value_get_string(availability_zone, &availability_zone_cursor) == AWS_OP_ERR)) {
|
1186
1230
|
AWS_LOGF_ERROR(
|
1187
1231
|
AWS_LS_IMDS_CLIENT, "Failed to parse availabilityZone from Json document for ec2 instance info.");
|
1188
1232
|
goto done;
|
1189
1233
|
}
|
1190
|
-
dest->availability_zone =
|
1234
|
+
dest->availability_zone = availability_zone_cursor;
|
1191
1235
|
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1236
|
+
struct aws_byte_cursor billing_products_cursor;
|
1237
|
+
struct aws_json_value *billing_products =
|
1238
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("billingProducts"));
|
1239
|
+
if (billing_products == NULL) {
|
1240
|
+
billing_products = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("billingproducts"));
|
1241
|
+
if (billing_products == NULL) {
|
1242
|
+
billing_products =
|
1243
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("BillingProducts"));
|
1244
|
+
}
|
1245
|
+
}
|
1246
|
+
if (aws_json_value_is_array(billing_products)) {
|
1247
|
+
struct aws_json_value *element;
|
1248
|
+
for (size_t i = 0; i < aws_json_get_array_size(billing_products); i++) {
|
1249
|
+
element = aws_json_get_array_element(billing_products, i);
|
1250
|
+
if (aws_json_value_is_string(element) &&
|
1251
|
+
aws_json_value_get_string(element, &billing_products_cursor) != AWS_OP_ERR) {
|
1252
|
+
struct aws_byte_cursor item = billing_products_cursor;
|
1198
1253
|
aws_array_list_push_back(&dest->billing_products, (const void *)&item);
|
1199
1254
|
}
|
1200
1255
|
}
|
1201
1256
|
}
|
1202
1257
|
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1258
|
+
struct aws_byte_cursor marketplace_product_codes_cursor;
|
1259
|
+
struct aws_json_value *marketplace_product_codes =
|
1260
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("marketplaceProductCodes"));
|
1261
|
+
if (marketplace_product_codes == NULL) {
|
1262
|
+
marketplace_product_codes =
|
1263
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("marketplaceproductcodes"));
|
1264
|
+
if (marketplace_product_codes == NULL) {
|
1265
|
+
marketplace_product_codes =
|
1266
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("MarketplaceProductCodes"));
|
1267
|
+
}
|
1268
|
+
}
|
1269
|
+
if (aws_json_value_is_array(marketplace_product_codes)) {
|
1270
|
+
struct aws_json_value *element;
|
1271
|
+
for (size_t i = 0; i < aws_json_get_array_size(marketplace_product_codes); i++) {
|
1272
|
+
element = aws_json_get_array_element(marketplace_product_codes, i);
|
1273
|
+
if (aws_json_value_is_string(element) &&
|
1274
|
+
aws_json_value_get_string(element, &marketplace_product_codes_cursor) != AWS_OP_ERR) {
|
1275
|
+
struct aws_byte_cursor item = marketplace_product_codes_cursor;
|
1276
|
+
aws_array_list_push_back(&dest->billing_products, (const void *)&item);
|
1210
1277
|
}
|
1211
1278
|
}
|
1212
1279
|
}
|
1213
1280
|
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1281
|
+
struct aws_byte_cursor image_id_cursor;
|
1282
|
+
struct aws_json_value *image_id =
|
1283
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("imageId"));
|
1284
|
+
if (image_id == NULL) {
|
1285
|
+
image_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("imageid"));
|
1286
|
+
if (image_id == NULL) {
|
1287
|
+
image_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("ImageId"));
|
1288
|
+
}
|
1289
|
+
}
|
1290
|
+
if (aws_json_value_is_string(image_id) && (aws_json_value_get_string(image_id, &image_id_cursor) != AWS_OP_ERR)) {
|
1291
|
+
dest->image_id = image_id_cursor;
|
1217
1292
|
}
|
1218
1293
|
|
1219
|
-
|
1220
|
-
|
1294
|
+
struct aws_byte_cursor instance_id_cursor;
|
1295
|
+
struct aws_json_value *instance_id =
|
1296
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instanceId"));
|
1297
|
+
if (instance_id == NULL) {
|
1298
|
+
instance_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instanceid"));
|
1299
|
+
if (instance_id == NULL) {
|
1300
|
+
instance_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("InstanceId"));
|
1301
|
+
}
|
1302
|
+
}
|
1303
|
+
if (!aws_json_value_is_string(instance_id) ||
|
1304
|
+
(aws_json_value_get_string(instance_id, &instance_id_cursor) == AWS_OP_ERR)) {
|
1221
1305
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse instanceId from Json document for ec2 instance info.");
|
1222
1306
|
goto done;
|
1223
1307
|
}
|
1224
|
-
dest->instance_id =
|
1308
|
+
dest->instance_id = instance_id_cursor;
|
1225
1309
|
|
1226
|
-
|
1227
|
-
|
1310
|
+
struct aws_byte_cursor instance_type_cursor;
|
1311
|
+
struct aws_json_value *instance_type =
|
1312
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instanceType"));
|
1313
|
+
if (instance_type == NULL) {
|
1314
|
+
instance_type = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("instancetype"));
|
1315
|
+
if (instance_type == NULL) {
|
1316
|
+
instance_type = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("InstanceType"));
|
1317
|
+
}
|
1318
|
+
}
|
1319
|
+
if (!aws_json_value_is_string(instance_type) ||
|
1320
|
+
(aws_json_value_get_string(instance_type, &instance_type_cursor) == AWS_OP_ERR)) {
|
1228
1321
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse instanceType from Json document for ec2 instance info.");
|
1229
1322
|
goto done;
|
1230
1323
|
}
|
1231
|
-
dest->instance_type =
|
1324
|
+
dest->instance_type = instance_type_cursor;
|
1232
1325
|
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1326
|
+
struct aws_byte_cursor kernel_id_cursor;
|
1327
|
+
struct aws_json_value *kernel_id =
|
1328
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("kernelId"));
|
1329
|
+
if (kernel_id == NULL) {
|
1330
|
+
kernel_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("kernelid"));
|
1331
|
+
if (kernel_id == NULL) {
|
1332
|
+
kernel_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("KernelId"));
|
1333
|
+
}
|
1334
|
+
}
|
1335
|
+
if (aws_json_value_is_string(kernel_id) &&
|
1336
|
+
(aws_json_value_get_string(kernel_id, &kernel_id_cursor) != AWS_OP_ERR)) {
|
1337
|
+
dest->kernel_id = kernel_id_cursor;
|
1236
1338
|
}
|
1237
1339
|
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1340
|
+
struct aws_byte_cursor private_ip_cursor;
|
1341
|
+
struct aws_json_value *private_ip =
|
1342
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("privateIp"));
|
1343
|
+
if (private_ip == NULL) {
|
1344
|
+
private_ip = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("privateip"));
|
1345
|
+
if (private_ip == NULL) {
|
1346
|
+
private_ip = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("PrivateIp"));
|
1347
|
+
}
|
1348
|
+
}
|
1349
|
+
if (aws_json_value_is_string(private_ip) &&
|
1350
|
+
(aws_json_value_get_string(private_ip, &private_ip_cursor) != AWS_OP_ERR)) {
|
1351
|
+
dest->private_ip = private_ip_cursor;
|
1241
1352
|
}
|
1242
1353
|
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1354
|
+
struct aws_byte_cursor ramdisk_id_cursor;
|
1355
|
+
struct aws_json_value *ramdisk_id =
|
1356
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("ramdiskId"));
|
1357
|
+
if (ramdisk_id == NULL) {
|
1358
|
+
ramdisk_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("ramdiskid"));
|
1359
|
+
if (ramdisk_id == NULL) {
|
1360
|
+
ramdisk_id = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("RamdiskId"));
|
1361
|
+
}
|
1362
|
+
}
|
1363
|
+
if (aws_json_value_is_string(ramdisk_id) &&
|
1364
|
+
(aws_json_value_get_string(ramdisk_id, &ramdisk_id_cursor) != AWS_OP_ERR)) {
|
1365
|
+
dest->ramdisk_id = ramdisk_id_cursor;
|
1246
1366
|
}
|
1247
1367
|
|
1248
|
-
|
1249
|
-
|
1368
|
+
struct aws_byte_cursor region_cursor;
|
1369
|
+
struct aws_json_value *region = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("region"));
|
1370
|
+
if (region == NULL) {
|
1371
|
+
region = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("Region"));
|
1372
|
+
}
|
1373
|
+
if (!aws_json_value_is_string(region) || (aws_json_value_get_string(region, ®ion_cursor) == AWS_OP_ERR)) {
|
1250
1374
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse region from Json document for ec2 instance info.");
|
1251
1375
|
goto done;
|
1252
1376
|
}
|
1253
|
-
dest->region =
|
1377
|
+
dest->region = region_cursor;
|
1254
1378
|
|
1255
|
-
|
1256
|
-
|
1379
|
+
struct aws_byte_cursor version_cursor;
|
1380
|
+
struct aws_json_value *version =
|
1381
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("version"));
|
1382
|
+
if (version == NULL) {
|
1383
|
+
version = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("Version"));
|
1384
|
+
}
|
1385
|
+
if (!aws_json_value_is_string(version) || (aws_json_value_get_string(version, &version_cursor) == AWS_OP_ERR)) {
|
1257
1386
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse version from Json document for ec2 instance info.");
|
1258
1387
|
goto done;
|
1259
1388
|
}
|
1260
|
-
dest->version =
|
1389
|
+
dest->version = version_cursor;
|
1261
1390
|
|
1262
|
-
|
1263
|
-
|
1391
|
+
struct aws_byte_cursor pending_time_cursor;
|
1392
|
+
struct aws_json_value *pending_time =
|
1393
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("pendingTime"));
|
1394
|
+
if (pending_time == NULL) {
|
1395
|
+
pending_time = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("pendingtime"));
|
1396
|
+
if (pending_time == NULL) {
|
1397
|
+
pending_time = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("PendingTime"));
|
1398
|
+
}
|
1399
|
+
}
|
1400
|
+
if (!aws_json_value_is_string(pending_time) ||
|
1401
|
+
(aws_json_value_get_string(pending_time, &pending_time_cursor) == AWS_OP_ERR)) {
|
1264
1402
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse pendingTime from Json document for ec2 instance info.");
|
1265
1403
|
goto done;
|
1266
1404
|
}
|
1267
1405
|
|
1268
|
-
struct aws_byte_cursor pending_time_cursor = aws_byte_cursor_from_c_str(pending_time->valuestring);
|
1269
1406
|
if (aws_date_time_init_from_str_cursor(&dest->pending_time, &pending_time_cursor, AWS_DATE_FORMAT_ISO_8601)) {
|
1270
1407
|
AWS_LOGF_ERROR(
|
1271
1408
|
AWS_LS_IMDS_CLIENT, "pendingTime in instance info Json document is not a valid ISO_8601 date string.");
|
@@ -1285,7 +1422,7 @@ static void s_process_instance_info(const struct aws_byte_buf *resource, int err
|
|
1285
1422
|
struct aws_byte_buf json_data;
|
1286
1423
|
AWS_ZERO_STRUCT(json_data);
|
1287
1424
|
|
1288
|
-
|
1425
|
+
struct aws_json_value *document_root = NULL;
|
1289
1426
|
|
1290
1427
|
if (aws_array_list_init_dynamic(
|
1291
1428
|
&instance_info.billing_products, wrapped_user_data->allocator, 10, sizeof(struct aws_byte_cursor))) {
|
@@ -1312,7 +1449,8 @@ static void s_process_instance_info(const struct aws_byte_buf *resource, int err
|
|
1312
1449
|
goto on_finish;
|
1313
1450
|
}
|
1314
1451
|
|
1315
|
-
|
1452
|
+
struct aws_byte_cursor json_data_cursor = aws_byte_cursor_from_buf(&json_data);
|
1453
|
+
document_root = aws_json_value_new_from_string(aws_default_allocator(), json_data_cursor);
|
1316
1454
|
if (document_root == NULL) {
|
1317
1455
|
AWS_LOGF_ERROR(AWS_LS_IMDS_CLIENT, "Failed to parse document as Json document for ec2 instance info.");
|
1318
1456
|
goto on_finish;
|
@@ -1329,7 +1467,7 @@ on_finish:
|
|
1329
1467
|
aws_byte_buf_clean_up_secure(&json_data);
|
1330
1468
|
aws_mem_release(wrapped_user_data->allocator, wrapped_user_data);
|
1331
1469
|
if (document_root != NULL) {
|
1332
|
-
|
1470
|
+
aws_json_value_destroy(document_root);
|
1333
1471
|
}
|
1334
1472
|
}
|
1335
1473
|
|
@@ -130,6 +130,11 @@ int aws_signing_init_signing_tables(struct aws_allocator *allocator) {
|
|
130
130
|
return AWS_OP_ERR;
|
131
131
|
}
|
132
132
|
|
133
|
+
s_connection_header_name = aws_byte_cursor_from_c_str("expect");
|
134
|
+
if (aws_hash_table_put(&s_skipped_headers, &s_connection_header_name, NULL, NULL)) {
|
135
|
+
return AWS_OP_ERR;
|
136
|
+
}
|
137
|
+
|
133
138
|
s_sec_websocket_key_header_name = aws_byte_cursor_from_c_str("sec-websocket-key");
|
134
139
|
if (aws_hash_table_put(&s_skipped_headers, &s_sec_websocket_key_header_name, NULL, NULL)) {
|
135
140
|
return AWS_OP_ERR;
|
@@ -101,6 +101,10 @@ static void s_cached_credentials_provider_get_credentials_async_callback(
|
|
101
101
|
credentials_expiration_timepoint_seconds = aws_credentials_get_expiration_timepoint_seconds(credentials);
|
102
102
|
}
|
103
103
|
|
104
|
+
/*
|
105
|
+
* If the sourced credentials have an explicit expiration time, we should always use that time
|
106
|
+
* rather than the much cruder, mechanical refresh setting on the caching wrapper.
|
107
|
+
*/
|
104
108
|
if (credentials_expiration_timepoint_seconds < UINT64_MAX) {
|
105
109
|
uint64_t system_now = 0;
|
106
110
|
if (!impl->system_clock_fn(&system_now)) {
|
@@ -109,17 +113,13 @@ static void s_cached_credentials_provider_get_credentials_async_callback(
|
|
109
113
|
aws_timestamp_convert(system_now, AWS_TIMESTAMP_NANOS, AWS_TIMESTAMP_SECS, NULL);
|
110
114
|
if (credentials_expiration_timepoint_seconds >=
|
111
115
|
system_now_seconds + REFRESH_CREDENTIALS_EARLY_DURATION_SECONDS) {
|
112
|
-
|
113
|
-
|
116
|
+
next_refresh_time_in_ns = high_res_now;
|
117
|
+
next_refresh_time_in_ns += aws_timestamp_convert(
|
114
118
|
credentials_expiration_timepoint_seconds - system_now_seconds -
|
115
119
|
REFRESH_CREDENTIALS_EARLY_DURATION_SECONDS,
|
116
120
|
AWS_TIMESTAMP_SECS,
|
117
121
|
AWS_TIMESTAMP_NANOS,
|
118
122
|
NULL);
|
119
|
-
|
120
|
-
if (early_refresh_time_ns < next_refresh_time_in_ns) {
|
121
|
-
next_refresh_time_in_ns = early_refresh_time_ns;
|
122
|
-
}
|
123
123
|
}
|
124
124
|
}
|
125
125
|
}
|
@@ -273,6 +273,7 @@ struct aws_credentials_provider *aws_credentials_provider_new_chain_default(
|
|
273
273
|
struct aws_tls_ctx *tls_ctx = NULL;
|
274
274
|
struct aws_credentials_provider *environment_provider = NULL;
|
275
275
|
struct aws_credentials_provider *profile_provider = NULL;
|
276
|
+
struct aws_credentials_provider *sts_provider = NULL;
|
276
277
|
struct aws_credentials_provider *ecs_or_imds_provider = NULL;
|
277
278
|
struct aws_credentials_provider *chain_provider = NULL;
|
278
279
|
struct aws_credentials_provider *cached_provider = NULL;
|
@@ -304,7 +305,7 @@ struct aws_credentials_provider *aws_credentials_provider_new_chain_default(
|
|
304
305
|
#endif /* BYO_CRYPTO */
|
305
306
|
}
|
306
307
|
|
307
|
-
enum { providers_size =
|
308
|
+
enum { providers_size = 4 };
|
308
309
|
struct aws_credentials_provider *providers[providers_size];
|
309
310
|
AWS_ZERO_ARRAY(providers);
|
310
311
|
size_t index = 0;
|
@@ -330,6 +331,18 @@ struct aws_credentials_provider *aws_credentials_provider_new_chain_default(
|
|
330
331
|
aws_atomic_fetch_add(&impl->shutdowns_remaining, 1);
|
331
332
|
}
|
332
333
|
|
334
|
+
struct aws_credentials_provider_sts_web_identity_options sts_options;
|
335
|
+
AWS_ZERO_STRUCT(sts_options);
|
336
|
+
sts_options.bootstrap = options->bootstrap;
|
337
|
+
sts_options.tls_ctx = tls_ctx;
|
338
|
+
sts_options.shutdown_options = sub_provider_shutdown_options;
|
339
|
+
sts_provider = aws_credentials_provider_new_sts_web_identity(allocator, &sts_options);
|
340
|
+
if (sts_provider != NULL) {
|
341
|
+
providers[index++] = sts_provider;
|
342
|
+
/* 1 shutdown call from the web identity provider's shutdown */
|
343
|
+
aws_atomic_fetch_add(&impl->shutdowns_remaining, 1);
|
344
|
+
}
|
345
|
+
|
333
346
|
ecs_or_imds_provider = s_aws_credentials_provider_new_ecs_or_imds(
|
334
347
|
allocator, &sub_provider_shutdown_options, options->bootstrap, tls_ctx);
|
335
348
|
if (ecs_or_imds_provider != NULL) {
|
@@ -355,6 +368,7 @@ struct aws_credentials_provider *aws_credentials_provider_new_chain_default(
|
|
355
368
|
*/
|
356
369
|
aws_credentials_provider_release(environment_provider);
|
357
370
|
aws_credentials_provider_release(profile_provider);
|
371
|
+
aws_credentials_provider_release(sts_provider);
|
358
372
|
aws_credentials_provider_release(ecs_or_imds_provider);
|
359
373
|
|
360
374
|
struct aws_credentials_provider_cached_options cached_options = {
|
@@ -395,6 +409,7 @@ on_error:
|
|
395
409
|
} else {
|
396
410
|
aws_credentials_provider_release(ecs_or_imds_provider);
|
397
411
|
aws_credentials_provider_release(profile_provider);
|
412
|
+
aws_credentials_provider_release(sts_provider);
|
398
413
|
aws_credentials_provider_release(environment_provider);
|
399
414
|
}
|
400
415
|
|
@@ -5,7 +5,6 @@
|
|
5
5
|
|
6
6
|
#include <aws/auth/credentials.h>
|
7
7
|
|
8
|
-
#include <aws/auth/external/cJSON.h>
|
9
8
|
#include <aws/auth/private/credentials_utils.h>
|
10
9
|
#include <aws/common/clock.h>
|
11
10
|
#include <aws/common/date_time.h>
|
@@ -19,6 +18,8 @@
|
|
19
18
|
#include <aws/io/tls_channel_handler.h>
|
20
19
|
#include <aws/io/uri.h>
|
21
20
|
|
21
|
+
#include <aws/common/json.h>
|
22
|
+
|
22
23
|
#if defined(_MSC_VER)
|
23
24
|
# pragma warning(disable : 4204)
|
24
25
|
# pragma warning(disable : 4232)
|
@@ -146,13 +147,14 @@ static struct aws_credentials *s_parse_credentials_from_iot_core_document(
|
|
146
147
|
struct aws_byte_buf *document) {
|
147
148
|
|
148
149
|
struct aws_credentials *credentials = NULL;
|
149
|
-
|
150
|
+
struct aws_json_value *document_root = NULL;
|
150
151
|
|
151
152
|
if (aws_byte_buf_append_null_terminator(document)) {
|
152
153
|
goto done;
|
153
154
|
}
|
154
155
|
|
155
|
-
|
156
|
+
struct aws_byte_cursor document_cursor = aws_byte_cursor_from_buf(document);
|
157
|
+
document_root = aws_json_value_new_from_string(allocator, document_cursor);
|
156
158
|
if (document_root == NULL) {
|
157
159
|
AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Failed to parse IoT Core response as Json document.");
|
158
160
|
goto done;
|
@@ -161,8 +163,9 @@ static struct aws_credentials *s_parse_credentials_from_iot_core_document(
|
|
161
163
|
/*
|
162
164
|
* pull out the root "Credentials" components
|
163
165
|
*/
|
164
|
-
|
165
|
-
|
166
|
+
struct aws_json_value *creds =
|
167
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str("credentials"));
|
168
|
+
if (!aws_json_value_is_object(creds)) {
|
166
169
|
AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Failed to parse credentials from IoT Core response.");
|
167
170
|
goto done;
|
168
171
|
}
|
@@ -176,7 +179,7 @@ static struct aws_credentials *s_parse_credentials_from_iot_core_document(
|
|
176
179
|
.expiration_required = false,
|
177
180
|
};
|
178
181
|
|
179
|
-
credentials =
|
182
|
+
credentials = aws_parse_credentials_from_aws_json_object(allocator, creds, &parse_options);
|
180
183
|
if (!credentials) {
|
181
184
|
AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "X509 credentials provider failed to parse credentials");
|
182
185
|
}
|
@@ -184,7 +187,7 @@ static struct aws_credentials *s_parse_credentials_from_iot_core_document(
|
|
184
187
|
done:
|
185
188
|
|
186
189
|
if (document_root != NULL) {
|
187
|
-
|
190
|
+
aws_json_value_destroy(document_root);
|
188
191
|
}
|
189
192
|
|
190
193
|
return credentials;
|