aws-crt 0.1.9 → 0.2.0
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/crt/aws-c-auth/include/aws/auth/auth.h +1 -0
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/aws_imds_client.h +5 -0
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/credentials.h +5 -0
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/private/aws_signing.h +1 -0
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/private/credentials_utils.h +2 -0
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/signing_config.h +1 -0
- data/aws-crt-ffi/crt/aws-c-auth/source/auth.c +3 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/aws_imds_client.c +146 -63
- data/aws-crt-ffi/crt/aws-c-auth/source/aws_signing.c +41 -19
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_imds.c +1 -0
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_utils.c +1 -0
- data/aws-crt-ffi/crt/aws-c-auth/source/signable_http_request.c +2 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/signing_config.c +25 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/CMakeLists.txt +3 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/aws_imds_client_test.c +197 -31
- data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_imds_tests.c +16 -18
- data/aws-crt-ffi/crt/aws-c-auth/tests/sigv4_signing_tests.c +3 -1
- data/aws-crt-ffi/crt/aws-c-cal/include/aws/cal/private/opensslcrypto_common.h +22 -0
- data/aws-crt-ffi/crt/aws-c-cal/source/darwin/commoncrypto_aes.c +46 -17
- data/aws-crt-ffi/crt/aws-c-cal/source/unix/openssl_aes.c +1 -0
- data/aws-crt-ffi/crt/aws-c-cal/source/unix/openssl_platform_init.c +7 -0
- data/aws-crt-ffi/crt/aws-c-cal/source/unix/openssl_rsa.c +59 -2
- data/aws-crt-ffi/crt/aws-c-cal/source/unix/opensslcrypto_ecc.c +1 -0
- data/aws-crt-ffi/crt/aws-c-common/CMakeLists.txt +13 -1
- data/aws-crt-ffi/crt/aws-c-common/THIRD-PARTY-LICENSES.txt +28 -7
- data/aws-crt-ffi/crt/aws-c-common/bin/system_info/CMakeLists.txt +18 -0
- data/aws-crt-ffi/crt/aws-c-common/bin/system_info/print_system_info.c +48 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/allocator.h +23 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_buf.h +12 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/cross_process_lock.h +35 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/hash_table.h +1 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/priority_queue.h +24 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/private/system_info_priv.h +37 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/system_info.h +47 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/system_resource_util.h +30 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/testing/aws_test_harness.h +3 -2
- data/aws-crt-ffi/crt/aws-c-common/source/allocator.c +64 -13
- data/aws-crt-ffi/crt/aws-c-common/source/android/logging.c +14 -0
- data/aws-crt-ffi/crt/aws-c-common/source/common.c +3 -3
- data/aws-crt-ffi/crt/aws-c-common/source/file.c +96 -35
- data/aws-crt-ffi/crt/aws-c-common/source/linux/system_info.c +24 -0
- data/aws-crt-ffi/crt/aws-c-common/source/memtrace.c +10 -3
- data/aws-crt-ffi/crt/aws-c-common/source/platform_fallback_stubs/system_info.c +21 -0
- data/aws-crt-ffi/crt/aws-c-common/source/posix/cross_process_lock.c +141 -0
- data/aws-crt-ffi/crt/aws-c-common/source/posix/system_info.c +1 -1
- data/aws-crt-ffi/crt/aws-c-common/source/posix/system_resource_utils.c +32 -0
- data/aws-crt-ffi/crt/aws-c-common/source/priority_queue.c +24 -0
- data/aws-crt-ffi/crt/aws-c-common/source/system_info.c +80 -0
- data/aws-crt-ffi/crt/aws-c-common/source/task_scheduler.c +2 -2
- data/aws-crt-ffi/crt/aws-c-common/source/windows/cross_process_lock.c +93 -0
- data/aws-crt-ffi/crt/aws-c-common/source/windows/system_resource_utils.c +31 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/CMakeLists.txt +16 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/alloc_test.c +83 -22
- data/aws-crt-ffi/crt/aws-c-common/tests/cross_process_lock_tests.c +116 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/file_test.c +103 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/priority_queue_test.c +36 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/system_info_tests.c +19 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/system_resource_util_test.c +37 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection.h +9 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/http.h +1 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/connection_impl.h +5 -4
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/connection_manager_system_vtable.h +10 -18
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/proxy_impl.h +5 -1
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/request_response_impl.h +5 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/request_response.h +10 -0
- data/aws-crt-ffi/crt/aws-c-http/source/connection.c +5 -2
- data/aws-crt-ffi/crt/aws-c-http/source/connection_manager.c +22 -21
- data/aws-crt-ffi/crt/aws-c-http/source/h1_connection.c +102 -17
- data/aws-crt-ffi/crt/aws-c-http/source/h1_stream.c +1 -0
- data/aws-crt-ffi/crt/aws-c-http/source/http.c +3 -0
- data/aws-crt-ffi/crt/aws-c-http/source/proxy_connection.c +2 -2
- data/aws-crt-ffi/crt/aws-c-http/tests/CMakeLists.txt +2 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_manager.c +18 -18
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_client.c +111 -1
- data/aws-crt-ffi/crt/aws-c-http/tests/test_proxy.c +2 -2
- data/aws-crt-ffi/crt/aws-c-http/tests/test_stream_manager.c +2 -2
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/retry_strategy.h +1 -1
- data/aws-crt-ffi/crt/aws-c-io/source/exponential_backoff_retry_strategy.c +1 -1
- data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_tls_op_handler.c +2 -4
- data/aws-crt-ffi/crt/aws-lc/CMakeLists.txt +16 -8
- data/aws-crt-ffi/crt/aws-lc/cmake/go.cmake +6 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/CMakeLists.txt +6 -9
- data/aws-crt-ffi/crt/aws-lc/crypto/asn1/a_time.c +34 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/asn1/a_utctm.c +4 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/asn1/asn1_test.cc +41 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/bio/bio_mem.c +6 -7
- data/aws-crt-ffi/crt/aws-lc/crypto/bio/bio_test.cc +152 -16
- data/aws-crt-ffi/crt/aws-lc/crypto/bio/connect.c +6 -12
- data/aws-crt-ffi/crt/aws-lc/crypto/bio/fd.c +2 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/bio/file.c +20 -8
- data/aws-crt-ffi/crt/aws-lc/crypto/bio/socket.c +2 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/bio/socket_helper.c +2 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/blake2/blake2.c +11 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/bytestring/cbb.c +13 -3
- data/aws-crt-ffi/crt/aws-lc/crypto/bytestring/cbs.c +9 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/chacha/asm/chacha-armv8.pl +1 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/chacha/chacha.c +49 -8
- data/aws-crt-ffi/crt/aws-lc/crypto/chacha/chacha_test.cc +110 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/chacha/internal.h +8 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/compiler_test.cc +4 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/conf/conf_test.cc +1 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/crypto_test.cc +9 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/curve25519.c +189 -108
- data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/curve25519_nohw.c +78 -6
- data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/ed25519_test.cc +9 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/internal.h +24 -10
- data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/spake25519.c +4 -4
- data/aws-crt-ffi/crt/aws-lc/crypto/curve25519/x25519_test.cc +80 -11
- data/aws-crt-ffi/crt/aws-lc/crypto/decrepit/evp/evp_do_all.c +2 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/digest_extra/digest_extra.c +8 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/digest_extra/digest_test.cc +110 -45
- data/aws-crt-ffi/crt/aws-lc/crypto/dsa/dsa_test.cc +8 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/dsa/internal.h +18 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/dynamic_loading_test.c +8 -5
- data/aws-crt-ffi/crt/aws-lc/crypto/ec_extra/ec_derive.c +4 -3
- data/aws-crt-ffi/crt/aws-lc/crypto/ec_extra/hash_to_curve.c +6 -18
- data/aws-crt-ffi/crt/aws-lc/crypto/endian_test.cc +308 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/err/ssl.errordata +2 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/evp_extra_test.cc +2 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/evp_test.cc +11 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/evp_tests.txt +25 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/p_ec_asn1.c +1 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/p_kem.c +2 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/p_rsa_asn1.c +1 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/print.c +7 -6
- data/aws-crt-ffi/crt/aws-lc/crypto/evp_extra/scrypt.c +13 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/CMakeLists.txt +13 -4
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/aes/aes_nohw.c +18 -6
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bcm.c +12 -4
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/bn_assert_test.cc +77 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/bn_test.cc +30 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/bytes.c +112 -22
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/div.c +12 -5
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/exponentiation.c +54 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/gcd.c +5 -6
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/internal.h +37 -15
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/montgomery.c +4 -11
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/bn/montgomery_inv.c +51 -15
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/cipher/aead.c +2 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/digest/digest.c +29 -6
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/digest/digests.c +89 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/digest/internal.h +4 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/ec.c +19 -36
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/ec_key.c +3 -3
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/ec_montgomery.c +9 -7
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/ec_test.cc +33 -9
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/internal.h +17 -12
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/p224-64.c +5 -8
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/p256-nistz.c +8 -8
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/p256.c +9 -8
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/p384.c +33 -16
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/p521.c +14 -6
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/scalar.c +26 -24
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/simple_mul.c +8 -5
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ec/wnaf.c +3 -3
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/ecdsa/ecdsa.c +9 -3
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/evp/evp.c +43 -12
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/evp/p_ec.c +4 -3
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/hmac/hmac.c +3 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/modes/xts.c +26 -3
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rand/cpu_jitter_test.cc +1 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rand/internal.h +20 -11
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rand/rand.c +10 -10
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rand/urandom.c +2 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rsa/internal.h +59 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rsa/padding.c +9 -3
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rsa/rsa.c +7 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/rsa/rsa_impl.c +51 -60
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/service_indicator/service_indicator.c +5 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/service_indicator/service_indicator_test.cc +205 -5
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/asm/sha1-armv8.pl +1 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/asm/sha512-armv8.pl +1 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/internal.h +8 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/sha3.c +37 -15
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/sha3_test.cc +115 -110
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sha/sha512.c +55 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/sshkdf/sshkdf.c +2 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/hmac_extra/hmac_test.cc +12 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/hmac_extra/hmac_tests.txt +10 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S +2 -6
- data/aws-crt-ffi/crt/aws-lc/crypto/impl_dispatch_test.cc +9 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/internal.h +90 -8
- data/aws-crt-ffi/crt/aws-lc/crypto/kem/kem.c +28 -27
- data/aws-crt-ffi/crt/aws-lc/crypto/kyber/kem_kyber.h +14 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/obj/obj_dat.h +52 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/obj/obj_mac.num +5 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/obj/objects.txt +7 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/perlasm/arm-xlate.pl +3 -14
- data/aws-crt-ffi/crt/aws-lc/crypto/perlasm/ppc-xlate.pl +1 -5
- data/aws-crt-ffi/crt/aws-lc/crypto/perlasm/x86_64-xlate.pl +4 -15
- data/aws-crt-ffi/crt/aws-lc/crypto/perlasm/x86asm.pl +4 -13
- data/aws-crt-ffi/crt/aws-lc/crypto/poly1305/poly1305_arm_asm.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/crypto/rand_extra/deterministic.c +4 -3
- data/aws-crt-ffi/crt/aws-lc/crypto/rand_extra/fuchsia.c +4 -4
- data/aws-crt-ffi/crt/aws-lc/crypto/rand_extra/rand_test.cc +0 -63
- data/aws-crt-ffi/crt/aws-lc/crypto/rand_extra/windows.c +41 -19
- data/aws-crt-ffi/crt/aws-lc/crypto/rsa_extra/rsa_test.cc +3 -3
- data/aws-crt-ffi/crt/aws-lc/crypto/siphash/siphash.c +12 -5
- data/aws-crt-ffi/crt/aws-lc/crypto/siphash/siphash_test.cc +5 -5
- data/aws-crt-ffi/crt/aws-lc/crypto/stack/stack.c +68 -46
- data/aws-crt-ffi/crt/aws-lc/crypto/trust_token/pmbtoken.c +4 -4
- data/aws-crt-ffi/crt/aws-lc/crypto/trust_token/voprf.c +2 -2
- data/aws-crt-ffi/crt/aws-lc/crypto/x509/by_dir.c +0 -6
- data/aws-crt-ffi/crt/aws-lc/crypto/x509/internal.h +4 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/x509/x509_lu.c +33 -9
- data/aws-crt-ffi/crt/aws-lc/crypto/x509/x509_test.cc +87 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/x509/x509_trs.c +1 -1
- data/aws-crt-ffi/crt/aws-lc/crypto/x509/x509_vfy.c +35 -13
- data/aws-crt-ffi/crt/aws-lc/crypto/x509v3/v3_lib.c +2 -0
- data/aws-crt-ffi/crt/aws-lc/crypto/x509v3/v3_purp.c +4 -6
- data/aws-crt-ffi/crt/aws-lc/generated-src/crypto_test_data.cc +179 -151
- data/aws-crt-ffi/crt/aws-lc/generated-src/err_data.c +353 -349
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/chacha/chacha-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/cipher_extra/chacha20_poly1305_armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/aesv8-armx.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/aesv8-gcm-armv8-unroll8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/aesv8-gcm-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/armv8-mont.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/bn-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/ghash-neon-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/ghashv8-armx.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/keccak1600-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/md5-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/p256-armv8-asm.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/p256_beeu-armv8-asm.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/sha1-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/sha256-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/sha512-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/fipsmodule/vpaes-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-aarch64/crypto/test/trampoline-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/chacha/chacha-armv4.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/aesv8-armx.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/armv4-mont.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/bsaes-armv7.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/ghash-armv4.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/ghashv8-armx.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/sha1-armv4-large.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/sha256-armv4.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/sha512-armv4.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/fipsmodule/vpaes-armv7.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/ios-arm/crypto/test/trampoline-armv4.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/chacha/chacha-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/cipher_extra/chacha20_poly1305_armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/aesv8-armx.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/aesv8-gcm-armv8-unroll8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/aesv8-gcm-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/armv8-mont.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/bn-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/ghash-neon-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/ghashv8-armx.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/keccak1600-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/md5-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/p256-armv8-asm.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/p256_beeu-armv8-asm.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/sha1-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/sha256-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/sha512-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/vpaes-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-aarch64/crypto/test/trampoline-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/chacha/chacha-armv4.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/aesv8-armx.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/armv4-mont.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/bsaes-armv7.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/ghash-armv4.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/ghashv8-armx.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/sha1-armv4-large.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/sha256-armv4.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/sha512-armv4.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/fipsmodule/vpaes-armv7.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-arm/crypto/test/trampoline-armv4.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-ppc64le/crypto/fipsmodule/aesp8-ppc.S +1 -5
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-ppc64le/crypto/fipsmodule/ghashp8-ppc.S +1 -5
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-ppc64le/crypto/test/trampoline-ppc.S +1 -5
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/chacha/chacha-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/aesni-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/bn-586.S +4 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/co-586.S +4 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/ghash-ssse3-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/ghash-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/md5-586.S +4 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/sha1-586.S +4 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/sha256-586.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/sha512-586.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/vpaes-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/fipsmodule/x86-mont.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86/crypto/test/trampoline-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/chacha/chacha-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/cipher_extra/aesni-sha1-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/cipher_extra/aesni-sha256-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/aesni-gcm-avx512.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/aesni-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/aesni-xts-avx512.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/ghash-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/md5-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/p256-x86_64-asm.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/rdrand-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/rsaz-avx2.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/sha1-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/sha256-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/sha512-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/vpaes-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/x86_64-mont.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/fipsmodule/x86_64-mont5.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/linux-x86_64/crypto/test/trampoline-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/chacha/chacha-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/aesni-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/bn-586.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/co-586.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/ghash-ssse3-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/ghash-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/md5-586.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/sha1-586.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/sha256-586.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/sha512-586.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/vpaes-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/fipsmodule/x86-mont.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86/crypto/test/trampoline-x86.S +3 -12
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/chacha/chacha-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/cipher_extra/aesni-sha1-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/cipher_extra/aesni-sha256-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/aesni-gcm-avx512.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/aesni-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/aesni-xts-avx512.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/ghash-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/md5-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/p256-x86_64-asm.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/rdrand-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/rsaz-avx2.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/sha1-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/sha256-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/sha512-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/vpaes-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/x86_64-mont.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/fipsmodule/x86_64-mont5.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/mac-x86_64/crypto/test/trampoline-x86_64.S +2 -11
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/chacha/chacha-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/cipher_extra/chacha20_poly1305_armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/aesv8-armx.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/aesv8-gcm-armv8-unroll8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/aesv8-gcm-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/armv8-mont.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/bn-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/ghash-neon-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/ghashv8-armx.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/keccak1600-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/md5-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/p256-armv8-asm.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/p256_beeu-armv8-asm.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/sha1-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/sha256-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/sha512-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/fipsmodule/vpaes-armv8.S +3 -13
- data/aws-crt-ffi/crt/aws-lc/generated-src/win-aarch64/crypto/test/trampoline-armv8.S +4 -14
- data/aws-crt-ffi/crt/aws-lc/go.mod +4 -4
- data/aws-crt-ffi/crt/aws-lc/go.sum +8 -10
- data/aws-crt-ffi/crt/aws-lc/include/openssl/aead.h +2 -2
- data/aws-crt-ffi/crt/aws-lc/include/openssl/arm_arch.h +4 -119
- data/aws-crt-ffi/crt/aws-lc/include/openssl/asm_base.h +185 -0
- data/aws-crt-ffi/crt/aws-lc/include/openssl/asn1.h +5 -0
- data/aws-crt-ffi/crt/aws-lc/include/openssl/base.h +31 -134
- data/aws-crt-ffi/crt/aws-lc/include/openssl/bio.h +30 -18
- data/aws-crt-ffi/crt/aws-lc/include/openssl/bn.h +0 -2
- data/aws-crt-ffi/crt/aws-lc/include/openssl/chacha.h +6 -0
- data/aws-crt-ffi/crt/aws-lc/include/openssl/cipher.h +2 -2
- data/aws-crt-ffi/crt/aws-lc/include/openssl/digest.h +9 -6
- data/aws-crt-ffi/crt/aws-lc/include/openssl/dsa.h +0 -21
- data/aws-crt-ffi/crt/aws-lc/include/openssl/ec.h +1 -1
- data/aws-crt-ffi/crt/aws-lc/include/openssl/err.h +1 -1
- data/aws-crt-ffi/crt/aws-lc/include/openssl/evp.h +8 -5
- data/aws-crt-ffi/crt/aws-lc/include/openssl/nid.h +21 -0
- data/aws-crt-ffi/crt/aws-lc/include/openssl/rsa.h +1 -65
- data/aws-crt-ffi/crt/aws-lc/include/openssl/sha.h +22 -1
- data/aws-crt-ffi/crt/aws-lc/include/openssl/ssl.h +121 -13
- data/aws-crt-ffi/crt/aws-lc/include/openssl/stack.h +229 -208
- data/aws-crt-ffi/crt/aws-lc/include/openssl/target.h +166 -0
- data/aws-crt-ffi/crt/aws-lc/include/openssl/x509.h +30 -10
- data/aws-crt-ffi/crt/aws-lc/include/openssl/x509v3.h +6 -4
- data/aws-crt-ffi/crt/aws-lc/sources.cmake +2 -0
- data/aws-crt-ffi/crt/aws-lc/ssl/extensions.cc +12 -7
- data/aws-crt-ffi/crt/aws-lc/ssl/handshake_server.cc +28 -18
- data/aws-crt-ffi/crt/aws-lc/ssl/internal.h +41 -6
- data/aws-crt-ffi/crt/aws-lc/ssl/s3_both.cc +9 -17
- data/aws-crt-ffi/crt/aws-lc/ssl/ssl_cipher.cc +13 -5
- data/aws-crt-ffi/crt/aws-lc/ssl/ssl_key_share.cc +542 -2
- data/aws-crt-ffi/crt/aws-lc/ssl/ssl_lib.cc +35 -0
- data/aws-crt-ffi/crt/aws-lc/ssl/ssl_test.cc +1847 -14
- data/aws-crt-ffi/crt/aws-lc/ssl/ssl_x509.cc +128 -0
- data/aws-crt-ffi/crt/aws-lc/ssl/test/PORTING.md +10 -7
- data/aws-crt-ffi/crt/aws-lc/ssl/test/bssl_shim.cc +133 -77
- data/aws-crt-ffi/crt/aws-lc/ssl/test/handshake_util.cc +3 -3
- data/aws-crt-ffi/crt/aws-lc/ssl/test/handshaker.cc +4 -0
- data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/handshake_client.go +6 -2
- data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/handshake_messages.go +894 -1042
- data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/handshake_server.go +24 -23
- data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/prf.go +6 -5
- data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/runner.go +56 -55
- data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/shim_dispatcher.go +188 -0
- data/aws-crt-ffi/crt/aws-lc/ssl/test/runner/ticket.go +37 -39
- data/aws-crt-ffi/crt/aws-lc/ssl/test/test_config.cc +59 -24
- data/aws-crt-ffi/crt/aws-lc/ssl/test/test_config.h +3 -2
- data/aws-crt-ffi/crt/aws-lc/ssl/tls13_server.cc +10 -11
- data/aws-crt-ffi/crt/aws-lc/tests/ci/cdk/app.py +4 -4
- data/aws-crt-ffi/crt/aws-lc/tests/ci/cdk/cdk/{aws_lc_mac_arm_ci_stack.py → aws_lc_ec2_test_framework_ci_stack.py} +13 -29
- data/aws-crt-ffi/crt/aws-lc/tests/ci/cdk/cdk/ssm/general_test_run_ssm_document.yaml +43 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/common_posix_setup.sh +10 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-aarch/amazonlinux-2023_base/Dockerfile +5 -1
- data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-aarch/ubuntu-22.04_base/Dockerfile +19 -3
- data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/amazonlinux-2_gcc-7x-intel-sde/Dockerfile +5 -4
- data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/build_images.sh +1 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/push_images.sh +2 -1
- data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/ubuntu-20.04_clang-10x_formal-verification/create_image.sh +1 -1
- data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/ubuntu-22.04_base/Dockerfile +1 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/linux-x86/ubuntu-22.04_clang-14x-sde/Dockerfile +42 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/windows/vs2017/Dockerfile +14 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/docker_images/windows/windows_base/Dockerfile +3 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/integration/README.md +12 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/integration/nginx_patch/aws-lc-nginx.patch +68 -23
- data/aws-crt-ffi/crt/aws-lc/tests/ci/integration/run_crt_integration.sh +27 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/integration/run_monit_integration.sh +56 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/integration/sslproxy_patch/aws-lc-sslproxy.patch +2 -2
- data/aws-crt-ffi/crt/aws-lc/tests/ci/run_ec2_test_framework.sh +135 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/run_fips_tests.sh +14 -2
- data/aws-crt-ffi/crt/aws-lc/tests/ci/run_tests_with_sde.sh +4 -1
- data/aws-crt-ffi/crt/aws-lc/tests/ci/run_tests_with_sde_asan.sh +14 -0
- data/aws-crt-ffi/crt/aws-lc/tests/ci/run_windows_tests.bat +39 -3
- data/aws-crt-ffi/crt/aws-lc/third_party/fiat/README.md +21 -6
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/bignum_madd_n25519.S +284 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/bignum_madd_n25519_alt.S +210 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/bignum_mod_n25519.S +186 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/bignum_neg_p25519.S +65 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519.S +1043 -352
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519_alt.S +1043 -352
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519_byte.S +1043 -352
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519_byte_alt.S +1043 -352
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519base.S +1042 -352
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519base_alt.S +1042 -352
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519base_byte.S +1042 -352
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/curve25519_x25519base_byte_alt.S +1043 -354
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_decode.S +700 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_decode_alt.S +563 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_encode.S +131 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_scalarmulbase.S +9626 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_scalarmulbase_alt.S +9468 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_scalarmuldouble.S +3157 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/curve25519/edwards25519_scalarmuldouble_alt.S +2941 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/p384/Makefile +1 -1
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/arm/p521/Makefile +1 -1
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/include/s2n-bignum_aws-lc.h +34 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/bignum_madd_n25519.S +219 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/bignum_madd_n25519_alt.S +245 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/bignum_mod_n25519.S +228 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/bignum_neg_p25519.S +86 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/curve25519_x25519.S +1350 -407
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/curve25519_x25519_alt.S +1350 -407
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/curve25519_x25519base.S +1344 -400
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/curve25519_x25519base_alt.S +1348 -402
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_decode.S +670 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_decode_alt.S +751 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_encode.S +81 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_scalarmulbase.S +9910 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_scalarmulbase_alt.S +9986 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_scalarmuldouble.S +3619 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/s2n-bignum/x86_att/curve25519/edwards25519_scalarmuldouble_alt.S +3736 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/wycheproof_testvectors/hmac_sha512_224_test.json +1978 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/wycheproof_testvectors/hmac_sha512_224_test.txt +1403 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/wycheproof_testvectors/hmac_sha512_256_test.json +1993 -0
- data/aws-crt-ffi/crt/aws-lc/third_party/wycheproof_testvectors/hmac_sha512_256_test.txt +1416 -0
- data/aws-crt-ffi/crt/aws-lc/tool/digest.cc +4 -0
- data/aws-crt-ffi/crt/aws-lc/tool/internal.h +1 -0
- data/aws-crt-ffi/crt/aws-lc/tool/speed.cc +53 -6
- data/aws-crt-ffi/crt/aws-lc/util/all_tests.go +43 -12
- data/aws-crt-ffi/crt/aws-lc/util/all_tests.json +13 -5
- data/aws-crt-ffi/crt/aws-lc/util/bot/DEPS +4 -4
- data/aws-crt-ffi/crt/aws-lc/util/bot/update_clang.py +8 -2
- data/aws-crt-ffi/crt/aws-lc/util/codecov-ci.sh +82 -0
- data/aws-crt-ffi/crt/aws-lc/util/convert_wycheproof/convert_wycheproof.go +7 -5
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/ACVP.md +7 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/subprocess/hash.go +24 -9
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/subprocess/rsa.go +3 -4
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/subprocess/subprocess.go +15 -10
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/expected/HMAC-SHA2-512-224.bz2 +0 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/expected/SHA2-512-224.bz2 +0 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/expected/SHAKE-128.bz2 +0 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/expected/SHAKE-256.bz2 +0 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/sha-tests/sha512-224-tests.json +1 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/sha-tests/shake-128-tests.json +1 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/sha-tests/shake-256-tests.json +1 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/tests.json +1 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/vectors/HMAC-SHA2-512-224.bz2 +0 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/vectors/SHA2-512-224.bz2 +0 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/vectors/SHAKE-128.bz2 +0 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/acvptool/test/vectors/SHAKE-256.bz2 +0 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/modulewrapper/main.cc +4 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/acvp/modulewrapper/modulewrapper.cc +144 -1
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/delocate/delocate.go +9 -3
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/delocate/testdata/aarch64-Basic/in.s +4 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/delocate/testdata/aarch64-Basic/out.s +11 -0
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/inject_hash/inject_hash.go +13 -4
- data/aws-crt-ffi/crt/aws-lc/util/fipstools/test-break-kat.sh +2 -0
- data/aws-crt-ffi/crt/aws-lc/util/testconfig/testconfig.go +2 -1
- data/aws-crt-ffi/crt/s2n/api/s2n.h +9 -5
- data/aws-crt-ffi/crt/s2n/bindings/rust/bench/benches/handshake.rs +9 -6
- data/aws-crt-ffi/crt/s2n/bindings/rust/bench/benches/resumption.rs +14 -14
- data/aws-crt-ffi/crt/s2n/bindings/rust/bench/benches/throughput.rs +9 -6
- data/aws-crt-ffi/crt/s2n/bindings/rust/bench/src/harness.rs +106 -102
- data/aws-crt-ffi/crt/s2n/bindings/rust/bench/src/openssl.rs +24 -20
- data/aws-crt-ffi/crt/s2n/bindings/rust/bench/src/rustls.rs +28 -24
- data/aws-crt-ffi/crt/s2n/bindings/rust/bench/src/s2n_tls.rs +52 -50
- data/aws-crt-ffi/crt/s2n/bindings/rust/generate/Cargo.toml +1 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/integration/Cargo.toml +3 -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/connection.rs +9 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/templates/Cargo.template +2 -1
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/Cargo.toml +2 -2
- data/aws-crt-ffi/crt/s2n/tests/cbmc/sources/make_common_datastructures.c +9 -2
- data/aws-crt-ffi/crt/s2n/tests/fuzz/s2n_client_cert_verify_recv_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/fuzz/s2n_hybrid_ecdhe_kyber_r3_fuzz_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/fuzz/s2n_tls13_cert_verify_recv_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_version_negotiation.py +4 -4
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_auth_selection_test.c +19 -9
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_auth_handshake_test.c +3 -3
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_cert_verify_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_hello_recv_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_hello_test.c +4 -4
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_signature_algorithms_extension_test.c +4 -5
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_connection_protocol_versions_test.c +390 -0
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_connection_test.c +8 -4
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_handshake_test.c +2 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_quic_support_io_test.c +106 -0
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_security_policies_test.c +6 -2
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_self_talk_offload_signing_test.c +3 -3
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_self_talk_session_resumption_test.c +135 -0
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_server_new_session_ticket_test.c +32 -0
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_server_signature_algorithms_extension_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_signature_algorithms_test.c +307 -283
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_cert_request_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_cert_verify_test.c +18 -17
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_x509_validator_test.c +125 -0
- data/aws-crt-ffi/crt/s2n/tls/extensions/s2n_client_signature_algorithms.c +8 -1
- data/aws-crt-ffi/crt/s2n/tls/extensions/s2n_client_supported_versions.c +43 -11
- data/aws-crt-ffi/crt/s2n/tls/extensions/s2n_client_supported_versions.h +3 -0
- data/aws-crt-ffi/crt/s2n/tls/extensions/s2n_server_signature_algorithms.c +8 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_auth_selection.c +4 -2
- data/aws-crt-ffi/crt/s2n/tls/s2n_client_cert_verify.c +7 -10
- data/aws-crt-ffi/crt/s2n/tls/s2n_client_hello.c +2 -2
- data/aws-crt-ffi/crt/s2n/tls/s2n_connection.c +75 -14
- data/aws-crt-ffi/crt/s2n/tls/s2n_handshake.h +2 -2
- data/aws-crt-ffi/crt/s2n/tls/s2n_post_handshake.c +1 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_post_handshake.h +1 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_quic_support.c +29 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_quic_support.h +5 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_security_policies.c +40 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_security_policies.h +4 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_server_cert_request.c +1 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_server_hello.c +0 -3
- data/aws-crt-ffi/crt/s2n/tls/s2n_server_key_exchange.c +8 -9
- data/aws-crt-ffi/crt/s2n/tls/s2n_server_new_session_ticket.c +8 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_signature_algorithms.c +111 -72
- data/aws-crt-ffi/crt/s2n/tls/s2n_signature_algorithms.h +11 -9
- data/aws-crt-ffi/crt/s2n/tls/s2n_signature_scheme.c +9 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_signature_scheme.h +2 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_certificate_verify.c +12 -18
- data/aws-crt-ffi/crt/s2n/tls/s2n_x509_validator.c +7 -7
- data/aws-crt-ffi/src/api.h +1 -0
- data/lib/aws-crt/native.rb +1 -1
- metadata +68 -5
- data/aws-crt-ffi/crt/aws-lc/tests/ci/cdk/cdk/ssm/m1_tests_ssm_document.yaml +0 -34
- data/aws-crt-ffi/crt/aws-lc/tests/ci/run_m1_ec2_instance.sh +0 -96
@@ -0,0 +1,77 @@
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
// SPDX-License-Identifier: Apache-2.0 OR ISC
|
3
|
+
//
|
4
|
+
|
5
|
+
#include <openssl/bn.h>
|
6
|
+
#include <openssl/rand.h>
|
7
|
+
#include "./internal.h"
|
8
|
+
|
9
|
+
#include <gtest/gtest.h>
|
10
|
+
|
11
|
+
TEST(BNAssertTest, Assert_fits_in_bytes_large) {
|
12
|
+
// TODO: Update Android test harness
|
13
|
+
#if !defined(NDEBUG) && !defined(OPENSSL_ANDROID)
|
14
|
+
bssl::UniquePtr<BIGNUM> x(BN_new());
|
15
|
+
uint8_t input[255];
|
16
|
+
OPENSSL_memset(input, 0, sizeof(input));
|
17
|
+
input[0] = 0xaa;
|
18
|
+
input[1] = 0x01;
|
19
|
+
input[254] = 0x01;
|
20
|
+
ASSERT_TRUE(BN_le2bn(input, sizeof(input), x.get()));
|
21
|
+
for (size_t i = 255; i < 260; i++) {
|
22
|
+
bn_assert_fits_in_bytes(x.get(), i);
|
23
|
+
}
|
24
|
+
for (size_t i = 247; i < 255; i++) {
|
25
|
+
EXPECT_DEATH_IF_SUPPORTED(bn_assert_fits_in_bytes(x.get(), i), "");
|
26
|
+
}
|
27
|
+
#endif
|
28
|
+
}
|
29
|
+
|
30
|
+
TEST(BNAssertTest, Assert_fits_in_bytes_small) {
|
31
|
+
#if !defined(NDEBUG) && !defined(OPENSSL_ANDROID)
|
32
|
+
bssl::UniquePtr<BIGNUM> x(BN_new());
|
33
|
+
uint8_t input[8];
|
34
|
+
OPENSSL_memset(input, 0, sizeof(input));
|
35
|
+
input[0] = 0xaa;
|
36
|
+
input[1] = 0xbb;
|
37
|
+
input[2] = 0xcc;
|
38
|
+
ASSERT_TRUE(BN_le2bn(input, sizeof(input), x.get()));
|
39
|
+
for (size_t i = 3; i < 10; i++) {
|
40
|
+
bn_assert_fits_in_bytes(x.get(), i);
|
41
|
+
}
|
42
|
+
for (size_t i = 0; i < 3; i++) {
|
43
|
+
EXPECT_DEATH_IF_SUPPORTED(bn_assert_fits_in_bytes(x.get(), i), "");
|
44
|
+
}
|
45
|
+
#endif
|
46
|
+
}
|
47
|
+
|
48
|
+
TEST(BNAssertTest, Assert_fits_in_bytes_zero) {
|
49
|
+
#if !defined(NDEBUG) && !defined(OPENSSL_ANDROID)
|
50
|
+
bssl::UniquePtr<BIGNUM> x(BN_new());
|
51
|
+
uint8_t input[8];
|
52
|
+
OPENSSL_memset(input, 0, sizeof(input));
|
53
|
+
ASSERT_TRUE(BN_le2bn(input, sizeof(input), x.get()));
|
54
|
+
|
55
|
+
for (size_t i = 0; i < 10; i++) {
|
56
|
+
bn_assert_fits_in_bytes(x.get(), i);
|
57
|
+
}
|
58
|
+
#endif
|
59
|
+
}
|
60
|
+
|
61
|
+
TEST(BNAssertTest, Assert_fits_in_bytes_boundary) {
|
62
|
+
#if !defined(NDEBUG) && !defined(OPENSSL_ANDROID)
|
63
|
+
bssl::UniquePtr<BIGNUM> x(BN_new());
|
64
|
+
uint8_t input[8];
|
65
|
+
OPENSSL_memset(input, 0, sizeof(input));
|
66
|
+
for (size_t i = 0; i < sizeof(input); i++) {
|
67
|
+
input[i] = i * (i + 1) & 0xff;
|
68
|
+
}
|
69
|
+
ASSERT_TRUE(BN_le2bn(input, sizeof(input), x.get()));
|
70
|
+
for (size_t i = 8; i < 18; i++) {
|
71
|
+
bn_assert_fits_in_bytes(x.get(), i);
|
72
|
+
}
|
73
|
+
for (size_t i = 0; i < 8; i++) {
|
74
|
+
EXPECT_DEATH_IF_SUPPORTED(bn_assert_fits_in_bytes(x.get(), i), "");
|
75
|
+
}
|
76
|
+
#endif
|
77
|
+
}
|
@@ -74,6 +74,7 @@
|
|
74
74
|
#include <string.h>
|
75
75
|
|
76
76
|
#include <algorithm>
|
77
|
+
#include <limits>
|
77
78
|
#include <utility>
|
78
79
|
|
79
80
|
#include <gtest/gtest.h>
|
@@ -908,6 +909,14 @@ static void TestModInv(BIGNUMFileTest *t, BN_CTX *ctx) {
|
|
908
909
|
bn_mod_inverse_consttime(ret.get(), &no_inverse, a.get(), m.get(), ctx));
|
909
910
|
EXPECT_BIGNUMS_EQUAL("inv(A) (mod M) (constant-time)", mod_inv.get(),
|
910
911
|
ret.get());
|
912
|
+
|
913
|
+
ASSERT_TRUE(BN_copy(ret.get(), m.get()));
|
914
|
+
ASSERT_TRUE(BN_mod_inverse(ret.get(), a.get(), ret.get(), ctx));
|
915
|
+
EXPECT_BIGNUMS_EQUAL("inv(A) (mod M) (ret == m)", mod_inv.get(), ret.get());
|
916
|
+
|
917
|
+
ASSERT_TRUE(BN_copy(ret.get(), a.get()));
|
918
|
+
ASSERT_TRUE(BN_mod_inverse(ret.get(), ret.get(), m.get(), ctx));
|
919
|
+
EXPECT_BIGNUMS_EQUAL("inv(A) (mod M) (ret == a)", mod_inv.get(), ret.get());
|
911
920
|
}
|
912
921
|
|
913
922
|
static void TestGCD(BIGNUMFileTest *t, BN_CTX *ctx) {
|
@@ -2796,6 +2805,27 @@ TEST_F(BNTest, MontgomeryLarge) {
|
|
2796
2805
|
ctx(), nullptr));
|
2797
2806
|
}
|
2798
2807
|
|
2808
|
+
TEST_F(BNTest, FormatWord) {
|
2809
|
+
char buf[32];
|
2810
|
+
snprintf(buf, sizeof(buf), BN_DEC_FMT1, BN_ULONG{1234});
|
2811
|
+
EXPECT_STREQ(buf, "1234");
|
2812
|
+
snprintf(buf, sizeof(buf), BN_HEX_FMT1, BN_ULONG{1234});
|
2813
|
+
EXPECT_STREQ(buf, "4d2");
|
2814
|
+
|
2815
|
+
// |BN_HEX_FMT2| is zero-padded up to the maximum value.
|
2816
|
+
#if defined(OPENSSL_64_BIT)
|
2817
|
+
snprintf(buf, sizeof(buf), BN_HEX_FMT2, BN_ULONG{1234});
|
2818
|
+
EXPECT_STREQ(buf, "00000000000004d2");
|
2819
|
+
snprintf(buf, sizeof(buf), BN_HEX_FMT2, std::numeric_limits<BN_ULONG>::max());
|
2820
|
+
EXPECT_STREQ(buf, "ffffffffffffffff");
|
2821
|
+
#else
|
2822
|
+
snprintf(buf, sizeof(buf), BN_HEX_FMT2, BN_ULONG{1234});
|
2823
|
+
EXPECT_STREQ(buf, "000004d2");
|
2824
|
+
snprintf(buf, sizeof(buf), BN_HEX_FMT2, std::numeric_limits<BN_ULONG>::max());
|
2825
|
+
EXPECT_STREQ(buf, "ffffffff");
|
2826
|
+
#endif
|
2827
|
+
}
|
2828
|
+
|
2799
2829
|
#if defined(OPENSSL_BN_ASM_MONT) && defined(SUPPORTS_ABI_TEST)
|
2800
2830
|
TEST_F(BNTest, BNMulMontABI) {
|
2801
2831
|
for (size_t words : {4, 5, 6, 7, 8, 16, 32}) {
|
@@ -140,44 +140,120 @@ BIGNUM *BN_le2bn(const uint8_t *in, size_t len, BIGNUM *ret) {
|
|
140
140
|
}
|
141
141
|
ret->width = (int)num_words;
|
142
142
|
|
143
|
-
|
144
|
-
ret->d[num_words - 1] = 0;
|
143
|
+
bn_little_endian_to_words(ret->d, ret->width, in, len);
|
145
144
|
|
146
|
-
// We only support little-endian platforms, so we can simply memcpy the
|
147
|
-
// internal representation.
|
148
|
-
OPENSSL_memcpy(ret->d, in, len);
|
149
145
|
return ret;
|
150
146
|
}
|
151
147
|
|
148
|
+
void bn_little_endian_to_words(BN_ULONG *out, size_t out_len, const uint8_t *in, const size_t in_len) {
|
149
|
+
assert(out_len > 0);
|
150
|
+
#ifdef OPENSSL_BIG_ENDIAN
|
151
|
+
size_t in_index = 0;
|
152
|
+
for (size_t i = 0; i < out_len; i++) {
|
153
|
+
if ((in_len-in_index) < sizeof(BN_ULONG)) {
|
154
|
+
// Load the last partial word.
|
155
|
+
BN_ULONG word = 0;
|
156
|
+
// size_t is unsigned, so j >= 0 is always true.
|
157
|
+
for (size_t j = in_len-1; j >= in_index && j < in_len; j--) {
|
158
|
+
word = (word << 8) | in[j];
|
159
|
+
}
|
160
|
+
in_index = in_len;
|
161
|
+
out[i] = word;
|
162
|
+
|
163
|
+
// Fill the remainder with zeros.
|
164
|
+
OPENSSL_memset(out + i + 1, 0, (out_len - i - 1) * sizeof(BN_ULONG));
|
165
|
+
break;
|
166
|
+
}
|
167
|
+
|
168
|
+
out[i] = CRYPTO_load_word_le(in + in_index);
|
169
|
+
in_index += sizeof(BN_ULONG);
|
170
|
+
}
|
171
|
+
|
172
|
+
// The caller should have sized the output to avoid truncation.
|
173
|
+
assert(in_index == in_len);
|
174
|
+
#else
|
175
|
+
OPENSSL_memcpy(out, in, in_len);
|
176
|
+
// Fill the remainder with zeros.
|
177
|
+
OPENSSL_memset( ((uint8_t*)out) + in_len, 0, sizeof(BN_ULONG)*out_len - in_len);
|
178
|
+
#endif
|
179
|
+
}
|
180
|
+
|
152
181
|
// fits_in_bytes returns one if the |num_words| words in |words| can be
|
153
182
|
// represented in |num_bytes| bytes.
|
154
183
|
static int fits_in_bytes(const BN_ULONG *words, size_t num_words,
|
155
184
|
size_t num_bytes) {
|
185
|
+
uint8_t mask = 0;
|
186
|
+
#ifdef OPENSSL_BIG_ENDIAN
|
187
|
+
for (size_t i = num_bytes / BN_BYTES; i < num_words; i++) {
|
188
|
+
BN_ULONG word = words[i];
|
189
|
+
for (size_t j = 0; j < BN_BYTES; j++) {
|
190
|
+
if ((i * BN_BYTES) + j < num_bytes) {
|
191
|
+
// For the first word we don't need to check any bytes shorter than len
|
192
|
+
continue ;
|
193
|
+
} else {
|
194
|
+
mask |= (word >> (j * 8)) & 0xff;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
#else
|
156
199
|
const uint8_t *bytes = (const uint8_t *)words;
|
157
200
|
size_t tot_bytes = num_words * sizeof(BN_ULONG);
|
158
|
-
uint8_t mask = 0;
|
159
201
|
for (size_t i = num_bytes; i < tot_bytes; i++) {
|
160
202
|
mask |= bytes[i];
|
161
203
|
}
|
204
|
+
#endif
|
162
205
|
return mask == 0;
|
163
206
|
}
|
164
207
|
|
208
|
+
// Asserts that the BIGNUM can be represented within |num| bytes.
|
209
|
+
// The logic is consistent with `fits_in_bytes` but assertions will fail when false.
|
210
|
+
void bn_assert_fits_in_bytes(const BIGNUM *bn, size_t num) {
|
211
|
+
const uint8_t *bytes = (const uint8_t *)bn->d;
|
212
|
+
size_t tot_bytes = bn->width * sizeof(BN_ULONG);
|
213
|
+
if (tot_bytes > num) {
|
214
|
+
CONSTTIME_DECLASSIFY(bytes + num, tot_bytes - num);
|
215
|
+
#ifdef OPENSSL_BIG_ENDIAN
|
216
|
+
for (int i = num / BN_BYTES; i < bn->width; i++) {
|
217
|
+
BN_ULONG word = bn->d[i];
|
218
|
+
for (size_t j = 0; j < BN_BYTES; j++) {
|
219
|
+
if ((i * BN_BYTES) + j < num) {
|
220
|
+
// For the first word we don't need to check any bytes shorter than len
|
221
|
+
continue;
|
222
|
+
} else {
|
223
|
+
uint8_t byte = (word >> (j * 8)) & 0xff;
|
224
|
+
assert(byte == 0);
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}
|
228
|
+
#else
|
229
|
+
for (size_t i = num; i < tot_bytes; i++) {
|
230
|
+
assert(bytes[i] == 0);
|
231
|
+
}
|
232
|
+
#endif
|
233
|
+
(void)bytes;
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
165
237
|
void bn_words_to_big_endian(uint8_t *out, size_t out_len, const BN_ULONG *in,
|
166
238
|
size_t in_len) {
|
167
239
|
// The caller should have selected an output length without truncation.
|
168
240
|
assert(fits_in_bytes(in, in_len, out_len));
|
169
|
-
|
170
|
-
// We only support little-endian platforms, so the internal representation is
|
171
|
-
// also little-endian as bytes. We can simply copy it in reverse.
|
172
|
-
const uint8_t *bytes = (const uint8_t *)in;
|
173
241
|
size_t num_bytes = in_len * sizeof(BN_ULONG);
|
174
242
|
if (out_len < num_bytes) {
|
175
243
|
num_bytes = out_len;
|
176
244
|
}
|
177
245
|
|
246
|
+
#ifdef OPENSSL_BIG_ENDIAN
|
247
|
+
for (size_t i = 0; i < num_bytes; i++) {
|
248
|
+
BN_ULONG l = in[i / BN_BYTES];
|
249
|
+
out[out_len - i - 1] = (uint8_t)(l >> (8 * (i % BN_BYTES))) & 0xff;
|
250
|
+
}
|
251
|
+
#else
|
252
|
+
const uint8_t *bytes = (const uint8_t *)in;
|
178
253
|
for (size_t i = 0; i < num_bytes; i++) {
|
179
254
|
out[out_len - i - 1] = bytes[i];
|
180
255
|
}
|
256
|
+
#endif
|
181
257
|
// Pad out the rest of the buffer with zeroes.
|
182
258
|
OPENSSL_memset(out, 0, out_len - num_bytes);
|
183
259
|
}
|
@@ -188,22 +264,36 @@ size_t BN_bn2bin(const BIGNUM *in, uint8_t *out) {
|
|
188
264
|
return n;
|
189
265
|
}
|
190
266
|
|
267
|
+
void bn_words_to_little_endian(uint8_t *out, size_t out_len, const BN_ULONG *in, const size_t in_len) {
|
268
|
+
// The caller should have selected an output length without truncation.
|
269
|
+
assert(fits_in_bytes(in, in_len, out_len));
|
270
|
+
size_t num_bytes = in_len * sizeof(BN_ULONG);
|
271
|
+
if (out_len < num_bytes) {
|
272
|
+
num_bytes = out_len;
|
273
|
+
}
|
274
|
+
#ifdef OPENSSL_BIG_ENDIAN
|
275
|
+
size_t byte_idx = 0;
|
276
|
+
for (size_t word_idx = 0; word_idx < in_len; word_idx++) {
|
277
|
+
BN_ULONG l = in[word_idx];
|
278
|
+
for(size_t j = 0; j < BN_BYTES && byte_idx < num_bytes; j++) {
|
279
|
+
out[byte_idx] = (uint8_t)(l & 0xff);
|
280
|
+
l >>= 8;
|
281
|
+
byte_idx++;
|
282
|
+
}
|
283
|
+
}
|
284
|
+
#else
|
285
|
+
const uint8_t *bytes = (const uint8_t *)in;
|
286
|
+
OPENSSL_memcpy(out, bytes, num_bytes);
|
287
|
+
#endif
|
288
|
+
// Fill the remainder with zeros.
|
289
|
+
OPENSSL_memset(out + num_bytes, 0, out_len - num_bytes);
|
290
|
+
}
|
291
|
+
|
191
292
|
int BN_bn2le_padded(uint8_t *out, size_t len, const BIGNUM *in) {
|
192
293
|
if (!fits_in_bytes(in->d, in->width, len)) {
|
193
294
|
return 0;
|
194
295
|
}
|
195
|
-
|
196
|
-
// We only support little-endian platforms, so we can simply memcpy into the
|
197
|
-
// internal representation.
|
198
|
-
const uint8_t *bytes = (const uint8_t *)in->d;
|
199
|
-
size_t num_bytes = in->width * BN_BYTES;
|
200
|
-
if (len < num_bytes) {
|
201
|
-
num_bytes = len;
|
202
|
-
}
|
203
|
-
|
204
|
-
OPENSSL_memcpy(out, bytes, num_bytes);
|
205
|
-
// Pad out the rest of the buffer with zeroes.
|
206
|
-
OPENSSL_memset(out + num_bytes, 0, len - num_bytes);
|
296
|
+
bn_words_to_little_endian(out, len, in->d, in->width);
|
207
297
|
return 1;
|
208
298
|
}
|
209
299
|
|
@@ -711,15 +711,22 @@ int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m,
|
|
711
711
|
|
712
712
|
int bn_mod_lshift_consttime(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m,
|
713
713
|
BN_CTX *ctx) {
|
714
|
-
if (!BN_copy(r, a)
|
714
|
+
if (!BN_copy(r, a) ||
|
715
|
+
!bn_resize_words(r, m->width)) {
|
715
716
|
return 0;
|
716
717
|
}
|
717
|
-
|
718
|
-
|
719
|
-
|
718
|
+
|
719
|
+
BN_CTX_start(ctx);
|
720
|
+
BIGNUM *tmp = bn_scratch_space_from_ctx(m->width, ctx);
|
721
|
+
int ok = tmp != NULL;
|
722
|
+
if (ok) {
|
723
|
+
for (int i = 0; i < n; i++) {
|
724
|
+
bn_mod_add_words(r->d, r->d, r->d, m->d, tmp->d, m->width);
|
720
725
|
}
|
726
|
+
r->neg = 0;
|
721
727
|
}
|
722
|
-
|
728
|
+
BN_CTX_end(ctx);
|
729
|
+
return ok;
|
723
730
|
}
|
724
731
|
|
725
732
|
int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m) {
|
@@ -119,6 +119,52 @@
|
|
119
119
|
#include "internal.h"
|
120
120
|
#include "rsaz_exp.h"
|
121
121
|
|
122
|
+
#if !defined(OPENSSL_NO_ASM) && \
|
123
|
+
(defined(OPENSSL_LINUX) || defined(OPENSSL_APPLE)) && \
|
124
|
+
defined(OPENSSL_AARCH64)
|
125
|
+
|
126
|
+
#include "../../../third_party/s2n-bignum/include/s2n-bignum_aws-lc.h"
|
127
|
+
|
128
|
+
#define BN_EXPONENTIATION_S2N_BIGNUM_CAPABLE 1
|
129
|
+
|
130
|
+
OPENSSL_INLINE int exponentiation_use_s2n_bignum(void) { return 1; }
|
131
|
+
|
132
|
+
#else
|
133
|
+
|
134
|
+
OPENSSL_INLINE int exponentiation_use_s2n_bignum(void) { return 0; }
|
135
|
+
|
136
|
+
#endif
|
137
|
+
|
138
|
+
static void exponentiation_s2n_bignum_copy_from_prebuf(BN_ULONG *dest, int width,
|
139
|
+
const BN_ULONG *table, int rowidx,
|
140
|
+
int window) {
|
141
|
+
|
142
|
+
#if defined(BN_EXPONENTIATION_S2N_BIGNUM_CAPABLE)
|
143
|
+
|
144
|
+
int table_height = 1 << window;
|
145
|
+
if (CRYPTO_is_NEON_capable()) {
|
146
|
+
if (width == 32) {
|
147
|
+
bignum_copy_row_from_table_32_neon(dest, table, table_height, rowidx);
|
148
|
+
} else if (width == 16) {
|
149
|
+
bignum_copy_row_from_table_16_neon(dest, table, table_height, rowidx);
|
150
|
+
} else if (width % 8 == 0) {
|
151
|
+
bignum_copy_row_from_table_8n_neon(dest, table, table_height, width,
|
152
|
+
rowidx);
|
153
|
+
} else {
|
154
|
+
bignum_copy_row_from_table(dest, table, table_height, width, rowidx);
|
155
|
+
}
|
156
|
+
} else {
|
157
|
+
bignum_copy_row_from_table(dest, table, table_height, width, rowidx);
|
158
|
+
}
|
159
|
+
|
160
|
+
#else
|
161
|
+
|
162
|
+
// Should not call this function unless s2n-bignum is supported.
|
163
|
+
abort();
|
164
|
+
|
165
|
+
#endif
|
166
|
+
}
|
167
|
+
|
122
168
|
|
123
169
|
int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) {
|
124
170
|
int i, bits, ret = 0;
|
@@ -594,7 +640,8 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
|
594
640
|
OPENSSL_PUT_ERROR(BN, BN_R_NEGATIVE_NUMBER);
|
595
641
|
return 0;
|
596
642
|
}
|
597
|
-
|
643
|
+
// |a| is secret, but |a < m| is not.
|
644
|
+
if (a->neg || constant_time_declassify_int(BN_ucmp(a, m)) >= 0) {
|
598
645
|
OPENSSL_PUT_ERROR(BN, BN_R_INPUT_NOT_REDUCED);
|
599
646
|
return 0;
|
600
647
|
}
|
@@ -848,6 +895,12 @@ static int copy_from_prebuf(BIGNUM *b, int top, const BN_ULONG *table, int idx,
|
|
848
895
|
return 0;
|
849
896
|
}
|
850
897
|
|
898
|
+
if (exponentiation_use_s2n_bignum()) {
|
899
|
+
exponentiation_s2n_bignum_copy_from_prebuf(b->d, top, table, idx, window);
|
900
|
+
b->width = top;
|
901
|
+
return 1;
|
902
|
+
}
|
903
|
+
|
851
904
|
OPENSSL_memset(b->d, 0, sizeof(BN_ULONG) * top);
|
852
905
|
const int width = 1 << window;
|
853
906
|
for (int i = 0; i < width; i++, table += top) {
|
@@ -263,15 +263,14 @@ int BN_mod_inverse_odd(BIGNUM *out, int *out_no_inverse, const BIGNUM *a,
|
|
263
263
|
// Now Y*a == A (mod |n|).
|
264
264
|
|
265
265
|
// Y*a == 1 (mod |n|)
|
266
|
-
if (
|
267
|
-
if (!
|
268
|
-
goto err;
|
269
|
-
}
|
270
|
-
} else {
|
271
|
-
if (!BN_nnmod(R, Y, n, ctx)) {
|
266
|
+
if (Y->neg || BN_ucmp(Y, n) >= 0) {
|
267
|
+
if (!BN_nnmod(Y, Y, n, ctx)) {
|
272
268
|
goto err;
|
273
269
|
}
|
274
270
|
}
|
271
|
+
if (!BN_copy(R, Y)) {
|
272
|
+
goto err;
|
273
|
+
}
|
275
274
|
|
276
275
|
ret = 1;
|
277
276
|
|
@@ -221,8 +221,8 @@ extern "C" {
|
|
221
221
|
#define BN_GENCB_NEW_STYLE 1
|
222
222
|
#define BN_GENCB_OLD_STYLE 2
|
223
223
|
|
224
|
-
// bn_minimal_width returns the minimal
|
225
|
-
//
|
224
|
+
// bn_minimal_width returns the minimal number of words needed to represent
|
225
|
+
// |bn|.
|
226
226
|
int bn_minimal_width(const BIGNUM *bn);
|
227
227
|
|
228
228
|
// bn_set_minimal_width sets |bn->width| to |bn_minimal_width(bn)|. If |bn| is
|
@@ -238,7 +238,7 @@ int bn_wexpand(BIGNUM *bn, size_t words);
|
|
238
238
|
// than a number of words.
|
239
239
|
int bn_expand(BIGNUM *bn, size_t bits);
|
240
240
|
|
241
|
-
// bn_resize_words adjusts |bn->
|
241
|
+
// bn_resize_words adjusts |bn->width| to be |words|. It returns one on success
|
242
242
|
// and zero on allocation error or if |bn|'s value is too large.
|
243
243
|
OPENSSL_EXPORT int bn_resize_words(BIGNUM *bn, size_t words);
|
244
244
|
|
@@ -267,6 +267,12 @@ int bn_fits_in_words(const BIGNUM *bn, size_t num);
|
|
267
267
|
// is representable in |num| words. Otherwise, it returns zero.
|
268
268
|
int bn_copy_words(BN_ULONG *out, size_t num, const BIGNUM *bn);
|
269
269
|
|
270
|
+
// bn_assert_fits_in_bytes asserts that |bn| fits in |num| bytes. This is a
|
271
|
+
// no-op in release builds, but triggers an assert in debug builds, and
|
272
|
+
// declassifies all bytes which are therefore known to be zero in constant-time
|
273
|
+
// validation.
|
274
|
+
OPENSSL_EXPORT void bn_assert_fits_in_bytes(const BIGNUM *bn, size_t num);
|
275
|
+
|
270
276
|
// bn_mul_add_words multiples |ap| by |w|, adds the result to |rp|, and places
|
271
277
|
// the result in |rp|. |ap| and |rp| must both be |num| words long. It returns
|
272
278
|
// the carry word of the operation. |ap| and |rp| may be equal but otherwise may
|
@@ -429,12 +435,11 @@ void bn_power5(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *table,
|
|
429
435
|
|
430
436
|
uint64_t bn_mont_n0(const BIGNUM *n);
|
431
437
|
|
432
|
-
//
|
433
|
-
//
|
434
|
-
//
|
435
|
-
// treated as secret.
|
436
|
-
int
|
437
|
-
BN_CTX *ctx);
|
438
|
+
// bn_mont_ctx_set_RR_consttime initializes |mont->RR|. It returns one on
|
439
|
+
// success and zero on error. |mont->N| and |mont->n0| must have been
|
440
|
+
// initialized already. The bit width of |mont->N| is assumed public, but
|
441
|
+
// |mont->N| is otherwise treated as secret.
|
442
|
+
int bn_mont_ctx_set_RR_consttime(BN_MONT_CTX *mont, BN_CTX *ctx);
|
438
443
|
|
439
444
|
#if defined(_MSC_VER)
|
440
445
|
#if defined(OPENSSL_X86_64)
|
@@ -745,21 +750,38 @@ void bn_mod_inverse0_prime_mont_small(BN_ULONG *r, const BN_ULONG *a,
|
|
745
750
|
// Word-based byte conversion functions.
|
746
751
|
|
747
752
|
// bn_big_endian_to_words interprets |in_len| bytes from |in| as a big-endian,
|
748
|
-
// unsigned integer and writes the result to |out_len| words in |out|.
|
749
|
-
//
|
750
|
-
// must be
|
753
|
+
// unsigned integer and writes the result to |out_len| words in |out|. The output
|
754
|
+
// is in little-endian word order with |out[0]| being the least-significant word.
|
755
|
+
// |out_len| must be large enough to represent any |in_len|-byte value. That is,
|
756
|
+
// |out_len| must be at least |BN_BYTES * in_len|.
|
751
757
|
void bn_big_endian_to_words(BN_ULONG *out, size_t out_len, const uint8_t *in,
|
752
758
|
size_t in_len);
|
753
759
|
|
754
|
-
// bn_words_to_big_endian represents |in_len| words from |in|
|
755
|
-
// unsigned integer in |out_len| bytes. It writes
|
756
|
-
// must be large enough to represent |in| without
|
760
|
+
// bn_words_to_big_endian represents |in_len| words from |in| (in little-endian
|
761
|
+
// word order) as a big-endian, unsigned integer in |out_len| bytes. It writes
|
762
|
+
// the result to |out|. |out_len| must be large enough to represent |in| without
|
763
|
+
// truncation.
|
757
764
|
//
|
758
765
|
// Note |out_len| may be less than |BN_BYTES * in_len| if |in| is known to have
|
759
766
|
// leading zeros.
|
760
767
|
void bn_words_to_big_endian(uint8_t *out, size_t out_len, const BN_ULONG *in,
|
761
768
|
size_t in_len);
|
762
769
|
|
770
|
+
// bn_little_endian_to_words interprets |in_len| bytes from |in| as a little-endian,
|
771
|
+
// unsigned integer and writes the result to |out_len| words in |out|. The output
|
772
|
+
// is in little-endian word order with |out[0]| being the least-significant word.
|
773
|
+
// |out_len| must be large enough to represent any |in_len|-byte value. That is,
|
774
|
+
// |out_len| must be at least |BN_BYTES * in_len|.
|
775
|
+
void bn_little_endian_to_words(BN_ULONG *out, size_t out_len, const uint8_t *in, const size_t in_len);
|
776
|
+
|
777
|
+
// bn_words_to_little_endian represents |in_len| words from |in| (in little-endian
|
778
|
+
// word order) as a little-endian, unsigned integer in |out_len| bytes. It
|
779
|
+
// writes the result to |out|. |out_len| must be large enough to represent |in|
|
780
|
+
// without truncation.
|
781
|
+
//
|
782
|
+
// Note |out_len| may be less than |BN_BYTES * in_len| if |in| is known to have
|
783
|
+
// leading zeros.
|
784
|
+
void bn_words_to_little_endian(uint8_t *out, size_t out_len, const BN_ULONG *in, const size_t in_len);
|
763
785
|
|
764
786
|
#if defined(__cplusplus)
|
765
787
|
} // extern C
|
@@ -279,19 +279,12 @@ BN_MONT_CTX *BN_MONT_CTX_new_for_modulus(const BIGNUM *mod, BN_CTX *ctx) {
|
|
279
279
|
BN_MONT_CTX *BN_MONT_CTX_new_consttime(const BIGNUM *mod, BN_CTX *ctx) {
|
280
280
|
BN_MONT_CTX *mont = BN_MONT_CTX_new();
|
281
281
|
if (mont == NULL ||
|
282
|
-
!bn_mont_ctx_set_N_and_n0(mont, mod)
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
if (!bn_mod_exp_base_2_consttime(&mont->RR, lgBigR * 2, &mont->N, ctx) ||
|
287
|
-
!bn_resize_words(&mont->RR, mont->N.width)) {
|
288
|
-
goto err;
|
282
|
+
!bn_mont_ctx_set_N_and_n0(mont, mod) ||
|
283
|
+
!bn_mont_ctx_set_RR_consttime(mont, ctx)) {
|
284
|
+
BN_MONT_CTX_free(mont);
|
285
|
+
return NULL;
|
289
286
|
}
|
290
287
|
return mont;
|
291
|
-
|
292
|
-
err:
|
293
|
-
BN_MONT_CTX_free(mont);
|
294
|
-
return NULL;
|
295
288
|
}
|
296
289
|
|
297
290
|
int BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_MUTEX *lock,
|
@@ -160,27 +160,63 @@ static uint64_t bn_neg_inv_mod_r_u64(uint64_t n) {
|
|
160
160
|
return v;
|
161
161
|
}
|
162
162
|
|
163
|
-
int
|
164
|
-
|
165
|
-
assert(!
|
166
|
-
assert(
|
167
|
-
assert(
|
163
|
+
int bn_mont_ctx_set_RR_consttime(BN_MONT_CTX *mont, BN_CTX *ctx) {
|
164
|
+
assert(!BN_is_zero(&mont->N));
|
165
|
+
assert(!BN_is_negative(&mont->N));
|
166
|
+
assert(BN_is_odd(&mont->N));
|
167
|
+
assert(bn_minimal_width(&mont->N) == mont->N.width);
|
168
168
|
|
169
|
-
|
170
|
-
|
171
|
-
unsigned n_bits = BN_num_bits(n);
|
169
|
+
unsigned n_bits = BN_num_bits(&mont->N);
|
172
170
|
assert(n_bits != 0);
|
173
|
-
assert(p > n_bits);
|
174
171
|
if (n_bits == 1) {
|
175
|
-
|
172
|
+
BN_zero(&mont->RR);
|
173
|
+
return bn_resize_words(&mont->RR, mont->N.width);
|
176
174
|
}
|
177
175
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
176
|
+
unsigned lgBigR = mont->N.width * BN_BITS2;
|
177
|
+
assert(lgBigR >= n_bits);
|
178
|
+
|
179
|
+
// RR is R, or 2^lgBigR, in the Montgomery domain. We can compute 2 in the
|
180
|
+
// Montgomery domain, 2R or 2^(lgBigR+1), and then use Montgomery
|
181
|
+
// square-and-multiply to exponentiate.
|
182
|
+
//
|
183
|
+
// The multiply steps take 2^n R to 2^(n+1) R. It is faster to double
|
184
|
+
// the value instead. The square steps take 2^n R to 2^(2n) R. This is
|
185
|
+
// equivalent to doubling n times. When n is below some threshold, doubling is
|
186
|
+
// faster. When above, squaring is faster.
|
187
|
+
//
|
188
|
+
// We double to this threshold, then switch to Montgomery squaring. From
|
189
|
+
// benchmarking various 32-bit and 64-bit architectures, the word count seems
|
190
|
+
// to work well as a threshold. (Doubling scales linearly and Montgomery
|
191
|
+
// reduction scales quadratically, so the threshold should scale roughly
|
192
|
+
// linearly.)
|
193
|
+
unsigned threshold = mont->N.width;
|
194
|
+
unsigned iters;
|
195
|
+
for (iters = 0; iters < sizeof(lgBigR) * 8; iters++) {
|
196
|
+
if ((lgBigR >> iters) <= threshold) {
|
197
|
+
break;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
// Compute 2^(lgBigR >> iters) R, or 2^((lgBigR >> iters) + lgBigR), by
|
202
|
+
// doubling. The first n_bits - 1 doubles can be skipped because we don't need
|
203
|
+
// to reduce.
|
204
|
+
if (!BN_set_bit(&mont->RR, n_bits - 1) ||
|
205
|
+
!bn_mod_lshift_consttime(&mont->RR, &mont->RR,
|
206
|
+
(lgBigR >> iters) + lgBigR - (n_bits - 1),
|
207
|
+
&mont->N, ctx)) {
|
182
208
|
return 0;
|
183
209
|
}
|
184
210
|
|
185
|
-
|
211
|
+
for (unsigned i = iters - 1; i < iters; i--) {
|
212
|
+
if (!BN_mod_mul_montgomery(&mont->RR, &mont->RR, &mont->RR, mont, ctx)) {
|
213
|
+
return 0;
|
214
|
+
}
|
215
|
+
if ((lgBigR & (1u << i)) != 0 &&
|
216
|
+
!bn_mod_lshift1_consttime(&mont->RR, &mont->RR, &mont->N, ctx)) {
|
217
|
+
return 0;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
return bn_resize_words(&mont->RR, mont->N.width);
|
186
222
|
}
|
@@ -296,8 +296,8 @@ int EVP_AEAD_get_iv_from_ipv4_nanosecs(
|
|
296
296
|
return 0;
|
297
297
|
}
|
298
298
|
|
299
|
-
|
300
|
-
|
299
|
+
CRYPTO_store_u32_le(&out_iv[0], ipv4_address);
|
300
|
+
CRYPTO_store_u64_le(&out_iv[sizeof(ipv4_address)], nanosecs);
|
301
301
|
|
302
302
|
return 1;
|
303
303
|
}
|